Discuss: Support Toolkit RC1

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Suggested Hosts
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean

Re: Discuss: Support Toolkit RC1

Post by Erik Frèrejean »

Shaythong wrote:I think this gave my server an overload.
What tool where you using?
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: Discuss: Support Toolkit RC1

Post by Karl1987 »

how can add a new module?
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean

Re: Discuss: Support Toolkit RC1

Post by Erik Frèrejean »

Adding new modules is pretty straight forward. The new module has to be located in the stk/tools/[some group]/ folder to be recognized by the plugin engine.
In stk/tools/tutorial.php you'll find an example file of how the module file must be formatted.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: Discuss: Support Toolkit RC1

Post by Karl1987 »

ok if i want add a title for example:

Image

i have this code:

Code: Select all

return array(
    'title'                => 'ADD_USER',
    'vars'                => array(
        'legend1'                => 'ADD_USER',
        'ad_username'            => array('lang' => 'USERNAME', 'explain' => false, 'type' => 'text:40:255'),
        'ad_userpass'            => array('lang' => 'PASSWORD', 'explain' => false, 'type' => 'password:40:255'),
    )
);         
and here the code midified:

Code: Select all

return array(
    'title'                => 'ADD_USER',
    'menu_title'         => 'TEST',
    'vars'                => array(
        'legend1'                => 'ADD_USER',
        'ad_username'            => array('lang' => 'USERNAME', 'explain' => false, 'type' => 'text:40:255'),
        'ad_userpass'            => array('lang' => 'PASSWORD', 'explain' => false, 'type' => 'password:40:255'),
    )
);
but in the code i have the menu_title TEST and the image appear ADD_USER why? how ca fix?
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean

Re: Discuss: Support Toolkit RC1

Post by Erik Frèrejean »

Can you please post the whole module class?
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
User avatar
Shaythong
Registered User
Posts: 48
Joined: Sun May 22, 2005 1:57 am

Re: Discuss: Support Toolkit RC1

Post by Shaythong »

Erik Frèrejean wrote:What tool where you using?
It happened after I used the "Reclean Usernames" module. Although, I think it was because I ran each run fast instead of waiting a few seconds so the server doesn't load. You guys should put in a 5-second wait before running each module like the converters do. :geek:

Can you guys add a module to switch user ids?
Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: Discuss: Support Toolkit RC1

Post by Karl1987 »

Erik Frèrejean wrote:Can you please post the whole module class?
here class:

Code: Select all

    <?php
    /**
    *
    * @package Support Toolkit - Plugin handler
    * @version $Id: plugin.php 153 2009-06-13 17:06:48Z iwisdom $
    * @copyright (c) 2009 phpBB Group
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License
    *
    */

    /**
     * @ignore
     */
    if (!defined('IN_PHPBB'))
    {
        exit;
    }

    // Load functions_admin.php if required
    if (!function_exists('filelist'))
    {
        include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
    }

    class plugin
    {
        /**
         * A list containing file and directory names that should be ignored
         *
         * @var array
         * @access private
         */
        var $ignore_tools = array('index.htm', 'tutorial.php');

        /**
         * List containing all available tools and in which category they belong.
         * On default it contains the "main" category
         *
         * @var array
         * @access private
         */
        var $plugin_list = array(
            'main'         => array(),
            'support'    => array(),
        );

        /**
         * Path to the tools directory
         *
         * @var String
         * @access public
         */
        var $tool_box_path = '';

        /**
         * Parts, used to build the query string
         */
        var $_parts = array(
            'c' => 'main',
            't' => '',
        );

        /**
         * Constructor
         * Load the list with available plugins and assign them in the correct category
         */
        function plugin()
        {
            // Set the path
            $this->tool_box_path = STK_ROOT_PATH . 'tools/';

            // Create a list with tools
            $filelist = filelist($this->tool_box_path, '', PHP_EXT);

            // Need to do some sanitization on the result of filelist
            foreach ($filelist as $cat => $tools)
            {
                // Don't need those
                if (empty($cat))
                {
                    continue;
                }

                $cat = (substr($cat, -1) == '/') ? substr($cat, 0, -1) : $cat;

                if (!isset($this->plugin_list[$cat]))
                {
                    $this->plugin_list[$cat] = array();
                }

                // Don't want the extension
                foreach ($tools as $key => $tool)
                {
                    $tools[$key] = (($pos = strpos($tool, '.' . PHP_EXT)) !== false) ? substr($tool, 0, $pos) : $tool;
                }

                $this->plugin_list[$cat] = $tools;
            }

            // Get the requested cat and tool
            $this->_parts['c'] = request_var('c', $this->_parts['c']);
            $this->_parts['t'] = request_var('t', $this->_parts['t']);

            // We shouldn't rely on the given category request, unless there really is a tool with that name in the given category
            if ($this->_parts['t'] && (!isset($this->plugin_list[$this->_parts['c']]) || !in_array($this->_parts['t'], $this->plugin_list[$this->_parts['c']])))
            {
                foreach ($this->plugin_list as $cat => $tools)
                {
                    foreach ($tools as $tool)
                    {
                        if ($tool == $this->_parts['t'])
                        {
                            $this->_parts['c'] = $cat;
                        }
                    }
                }
            }

            // Check if they want to use a tool or not, make sure that the tool name is legal, and make sure the tool exists
            if (!$this->_parts['t'] || preg_match('#([^a-zA-Z0-9_])#', $this->_parts['t']) || !file_exists(STK_ROOT_PATH . 'tools/' . $this->_parts['c'] . '/' . $this->_parts['t'] . '.' . PHP_EXT))
            {
                $this->_parts['t'] = '';
            }

            // Make sure the form_key is set
            add_form_key($this->_parts['t']);

            // Assign the two menus to the template
            $this->gen_top_nav();
            $this->gen_left_nav();
        }

        /**
         * Load the requested tool
         *
         * @param String $tool_cat The category of this tool.
         * @param String $tool_name The name of this tool
         * @param Boolean $return Specify whether an object of this tool will be returned
         * @return The object of the requested tool if $return is set to true else this method will return true
         */
        function load_tool($tool_cat, $tool_name, $return = true)
        {
            global $user;

            static $tools_loaded = array();

            if (isset($tools_loaded[$tool_name]))
            {
                return ($return) ? $tools_loaded[$tool_name] : true;
            }

            $tool_path = $this->tool_box_path . $tool_cat . '/' . $tool_name . '.' . PHP_EXT;
            if (false === (@include $tool_path))
            {
                trigger_error(sprintf($user->lang['TOOL_INCLUTION_NOT_FOUND'], $tool_path), E_USER_ERROR);
            }

            if (!class_exists($tool_name))
            {
                trigger_error(sprintf($user->lang['INCORRECT_CLASS'], $tool_name, PHP_EXT), E_USER_ERROR);
            }

            // Construct the class
            $tools_loaded[$tool_name] = new $tool_name();

            // Add the language file
            stk_add_lang('tools/' . $tool_name);

            // Return
            return ($return) ? $tools_loaded[$tool_name] : true;
        }

        /**
         * Create the correct URI arguments for the current page
         *
         * @param Define whether this function returns an array with elements or a string
         * @return An array|String with the URI parameters
         */
        function url_arg($string = false)
        {
            $args    = array();
            $str    = '?';

            // Run through the parts
            foreach ($this->_parts as $key => $value)
            {
                if ($value != '')
                {
                    $args[$key] = $value;

                    if (substr($str, -5) != '&')
                    {
                        $str .= '&';
                    }

                    $str .= $key . '=' . $value;
                }
            }

            return ($string) ? $str : $args;
        }

        /**
         * Get a given part
         */
        function get_part($key)
        {
            if (empty($this->_parts))
            {
                return false;
            }

            return $this->_parts[$key];
        }

        /**
         * Add a new part
         */
        function set_part($key, $value)
        {
            $this->_parts[$key] = $value;
        }

        /**
         * Build the top "category" navigation for every page
         */
        function gen_top_nav()
        {
            global $template, $user;

            // Loop through the plugin list. The first keys are the categories
            $cats = array_keys($this->plugin_list);
            foreach ($cats as $cat)
            {
                // Ignore all categories that are empty (excluding "main")
                if (empty($this->plugin_list[$cat]) && $cat != 'main')
                {
                    continue;
                }

                // Active cat?
                $_s_active = ($cat == $this->_parts['c']) ? true : false;

                // Assign to the template
                $template->assign_block_vars('top_nav', array(
                    'L_TITLE'        => $user->lang['CAT_' . strtoupper($cat)],
                    'S_SELECTED'    => $_s_active,
                    'U_TITLE'        => append_sid(STK_INDEX, array('c' => $cat)),
                ));
            }
        }

        /**
         * Build the left "tool" navigation for every page
         * This is based upon the active tool
         */
        function gen_left_nav()
        {
            global $template, $user;

            // Grep the correct category
            $tool_list = $this->plugin_list[$this->_parts['c']];

            // Loop through the tools and create the template
            foreach ($tool_list as $tool)
            {
                // Active tool?
                $_s_active = ($tool == $this->_parts['t']) ? true : false;

                // Make sure the tool is loaded
                $class = $this->load_tool($this->_parts['c'], $tool);
                
                $menu_header = (isset($tool['menu_title'])) ? $tool['menu_title'] : '';
                
                // Get the info
                if (method_exists($class, 'info'))
                {
                    $info = $class->info();
                }
                else
                {
                    // For us lazy people
                    $info = array(
                        'NAME'            => (isset($user->lang[strtoupper($tool)])) ? $user->lang[strtoupper($tool)] : strtoupper($tool),
                        'MENU_NAME'        => (isset($user->lang['MENU_' . $menu_header])) ? $user->lang['MENU_' . $menu_header] : '',                
                    );
                }

                // Assign to the template
                $template->assign_block_vars('left_nav', array(
                    'L_TITLE'        => $info['NAME'],
                    'L_MENU_TITLE'    => $info['MENU_NAME'],
                    'S_SELECTED'    => $_s_active,
                    'U_TITLE'        => append_sid(STK_INDEX, array('c' => $this->_parts['c'], 't' => $tool)),
                ));
            }
        }
    }
    ?>
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean

Re: Discuss: Support Toolkit RC1

Post by Erik Frèrejean »

Karl1987 wrote:
Erik Frèrejean wrote:Can you please post the whole module class?
here class:
[...]
I meant the one you are creating ;).
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: Discuss: Support Toolkit RC1

Post by Karl1987 »

I changed the news script. But the structure is like:

Code: Select all

    <?php
    /**
    *
    * @package Support Toolkit - Add User
    * @version $Id: add_user.php 155 2009-06-13 20:06:09Z marshalrusty $
    * @copyright (c) 2009 phpBB Group
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License
    *
    */

    /**
     * @ignore
     */
    if (!defined('IN_PHPBB'))
    {
        exit;
    }

    class config_site
    {
        /**
        * Display Options
        *
        * Output the options available
        */
        function display_options()
        {
            global $user;

            $user->add_lang('ucp');

            return array(
                'title'                => 'CONFIG_SITE',
                'vars'                => array(
                    'legend1'            => 'CONFIG_SITE',
                    'name_Game'            => array('lang' => 'NAME_GAME', 'explain' => true, 'type' => 'text:40:255'),
                    'mail_contact'        => array('lang' => 'MAIL_CONTACT', 'explain' => true, 'type' => 'text:40:255'),
                )
            );
        }

        /**
        * Run Tool
        *
        * Does the actual stuff we want the tool to do after submission
        */
        function run_tool(&$error)
        {
            global $config, $user;

            if (!check_form_key('add_user'))
            {
                $error[] = 'FORM_INVALID';
                return;
            }

        }
    }
    ?>
Lucky13ca
Registered User
Posts: 4
Joined: Fri Jul 17, 2009 3:19 pm

Getting an Error when Clicking on User/Group Tab

Post by Lucky13ca »

If anyone can help me, I am getting an error when I click on the User/Group Tools Tab.

All works fine except for that.

The error is: 406 Not Available then a link to return to home page.

Any help would be appreciated.

Thanks
raizen
Registered User
Posts: 67
Joined: Sat Jan 05, 2008 8:34 pm

Re: Discuss: Support Toolkit RC1

Post by raizen »

Can Reparse BBCode: Reparses the BBCode for the board's post repare phpbb 2 bbcode? Becouse in my phpbb3 after conversion they can't work..
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run

Re: Discuss: Support Toolkit RC1

Post by A_Jelly_Doughnut »

raizen wrote:Can Reparse BBCode: Reparses the BBCode for the board's post repare phpbb 2 bbcode? Becouse in my phpbb3 after conversion they can't work..
Yes, it will do that :)
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
raizen
Registered User
Posts: 67
Joined: Sat Jan 05, 2008 8:34 pm

Re: Discuss: Support Toolkit RC1

Post by raizen »

A_Jelly_Doughnut wrote:
raizen wrote:Can Reparse BBCode: Reparses the BBCode for the board's post repare phpbb 2 bbcode? Becouse in my phpbb3 after conversion they can't work..
Yes, it will do that :)
Ok perfetc, i've many problem with old youtube codes...many thantks
User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: Discuss: Support Toolkit RC1

Post by EXreaction »

It *should* reparse them correctly, but there have been issues reported with it (which I was not able to reproduce), so I am not sure they will work perfectly. As always remember to backup the database before attempting and if you have any issues please let us know so we can try and track them down and get them fixed. :)
User avatar
CTCNetwork
Former Team Member
Posts: 15424
Joined: Fri Dec 19, 2003 3:50 am
Location: In that Volvo behind you!

Re: Discuss: Support Toolkit RC1

Post by CTCNetwork »

Hi,

Well done team on getting this piece of s/ware out...

Looking forwards to the full release.. :)

Des. . . ;)
Density:- Not just a measurement~Its a whole way of Life.! ! !
| Welcome! | RTFM!!! | Search! It's Easy! | Problem? | Spam? | Advice! |

Return to “phpBB Discussion”