Пример #1
0
    return;
}
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './../');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require 'pagestart.' . PHP_EXT;
define('THIS_PAGE', 'admin_plugins.' . PHP_EXT);
// PLUGINS CLASS - BEGIN
if (!class_exists('class_plugins')) {
    include IP_ROOT_PATH . 'includes/class_plugins.' . PHP_EXT;
}
if (empty($class_plugins)) {
    $class_plugins = new class_plugins();
}
// PLUGINS CLASS - END
// MODES - BEGIN
$mode_types = array('list', 'save');
$mode = request_var('mode', $mode_types[0]);
$mode = isset($_POST['save']) ? 'save' : $mode;
$mode = !in_array($mode, $mode_types) ? $mode_types[0] : $mode;
// MODES - END
// ACTIONS - BEGIN
$actions_types = array('none', 'update', 'install', 'uninstall');
$action = request_var('action', $actions_types[0]);
$action = !in_array($action, $actions_types) ? $actions_types[0] : $action;
// ACTIONS - END
$plugin_dir = request_var('plugin_dir', '');
if (!empty($plugin_dir)) {
/**
* Add permission language - this will make sure custom files will be included
*/
function add_permission_language()
{
    global $user, $class_plugins;
    // First of all, our own file. We need to include it as the first file because it presets all relevant variables.
    // MIGHTY GORGON - LANG - BEGIN
    global $class_plugins;
    global $db, $cache, $lang;
    setup_extra_lang(array('lang_cms_permissions', 'lang_permissions'));
    // Add Plugins Lang!
    if (!class_exists('class_plugins')) {
        include IP_ROOT_PATH . 'includes/class_plugins.' . PHP_EXT;
    }
    if (empty($class_plugins)) {
        $class_plugins = new class_plugins();
    }
    foreach ($cache->obtain_plugins_config() as $k => $plugin) {
        if (!empty($plugin['plugin_enabled'])) {
            $class_plugins->setup_lang($plugin['plugin_dir'] . '/', 'permissions');
        }
    }
    // Merge $lang with $user->lang
    merge_user_lang();
    // MIGHTY GORGON - LANG - END
    // CODE REMOVED
    /*
    $files_to_add = array();
    
    // Now search in acp and mods folder for permissions_ files.
    foreach (array('acp/', 'mods/') as $path)
    {
    	$dh = @opendir($user->lang_path . $user->lang_name . '/' . $path);
    
    	if ($dh)
    	{
    		while (($file = readdir($dh)) !== false)
    		{
    			if (($file !== 'permissions_phpbb.' . PHP_EXT) && (strpos($file, 'permissions_') === 0) && (substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT))
    			{
    				$files_to_add[] = $path . substr($file, 0, -(strlen(PHP_EXT) + 1));
    			}
    		}
    		closedir($dh);
    	}
    }
    
    if (!sizeof($files_to_add))
    {
    	return false;
    }
    
    $user->add_lang($files_to_add);
    */
    return true;
}