Пример #1
0
                    $user->lang['UPDATE_' . $mod_name . '_CONFIRM'] = sprintf($user->lang['UPDATE_MOD_CONFIRM'], $user->lang[$mod_name]);
                }
                $umil->confirm_box(false, 'UPDATE_' . $mod_name, $hidden);
                break;
            case 'uninstall':
                if (!isset($user->lang['UNINSTALL_' . $mod_name])) {
                    $user->lang['UNINSTALL_' . $mod_name] = sprintf($user->lang['UNINSTALL_MOD'], $user->lang[$mod_name]);
                    $user->lang['UNINSTALL_' . $mod_name . '_CONFIRM'] = sprintf($user->lang['UNINSTALL_MOD_CONFIRM'], $user->lang[$mod_name]);
                }
                $umil->confirm_box(false, 'UNINSTALL_' . $mod_name, $hidden);
                break;
        }
    } else {
        if ($umil->confirm_box(true)) {
            $umil->display_stages($stages, 3);
            $umil->run_actions($action, $versions, $version_config_name, $version_select);
            $umil->done();
        }
    }
}
// Shouldn't get here.
redirect($phpbb_root_path . $current_page);
function umil_install_update_uninstall_select($value, $key)
{
    global $config, $current_version, $user, $version_config_name;
    $db_version = isset($config[$version_config_name]) ? $config[$version_config_name] : false;
    if ($db_version === false) {
        return '<input id="' . $key . '" class="radio" type="radio" name="' . $key . '" value="install" checked="checked" /> ' . $user->lang['INSTALL'] . '&nbsp;&nbsp;
		<input id="' . $key . '" class="radio" type="radio" name="' . $key . '" value="update" disabled="disabled" /> ' . $user->lang['UPDATE'] . '&nbsp;&nbsp;
		<input id="' . $key . '" class="radio" type="radio" name="' . $key . '" value="uninstall" disabled="disabled" /> ' . $user->lang['UNINSTALL'];
    } else {
*/
define('IN_PHPBB', true);
$phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'common.' . $phpEx;
require $phpbb_root_path . 'ads/constants.' . $phpEx;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/info_acp_ads');
// Display a login box if they are not logged in
if (!$user->data['is_registered']) {
    login_box();
}
if (!file_exists($phpbb_root_path . 'umil/umil_frontend.' . $phpEx)) {
    trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
include $phpbb_root_path . 'umil/umil_frontend.' . $phpEx;
$umil = new umil_frontend('ACP_ADVERTISEMENT_MANAGEMENT', true);
// Check after initiating UMIL.
if ($user->data['user_type'] != USER_FOUNDER) {
    trigger_error('FOUNDERS_ONLY');
}
if ($umil->confirm_box(true)) {
    include $phpbb_root_path . 'ads/versions.' . $phpEx;
    $umil->run_actions('uninstall', $versions, 'ads_version');
} else {
    $umil->display_stages(array('CONFIRM', 'UNINSTALL'));
    $umil->confirm_box(false, 'UNINSTALL');
}
$umil->done();
 public static function install_automod($board_dir, $make_writable)
 {
     global $quickinstall_path, $phpbb_root_path, $phpEx;
     global $qi_config, $user, $db;
     // The name of the mod to be displayed during installation.
     $mod_name = 'AUTOMOD';
     $version_config_name = 'automod_version';
     // Since AutoMOD is no longer shipped with QI we need to do some checking...
     $automod_path = '';
     if (file_exists($quickinstall_path . 'sources/automod/includes')) {
         // Let's assume they copied the contents.
         $automod_path = $quickinstall_path . 'sources/automod/';
     } else {
         if (file_exists($quickinstall_path . 'sources/automod/root/includes')) {
             // They copied to complete root to automod instead of its contents.
             $automod_path = $quickinstall_path . 'sources/automod/root/';
         } else {
             if (file_exists($quickinstall_path . 'sources/automod/upload/includes')) {
                 // They copied to complete upload directory to automod instead of its contents.
                 $automod_path = $quickinstall_path . 'sources/automod/upload/';
             } else {
                 trigger_error($user->lang['NO_AUTOMOD']);
             }
         }
     }
     file_functions::copy_dir($automod_path, $board_dir);
     // include AutoMOD lanugage files.
     if (file_exists($phpbb_root_path . 'language/' . $user->lang . '/mods/info_acp_modman.' . $phpEx)) {
         include $phpbb_root_path . 'language/' . $user->lang . '/mods/info_acp_modman.' . $phpEx;
     } else {
         include "{$phpbb_root_path}language/en/mods/info_acp_modman.{$phpEx}";
     }
     unset($GLOBALS['lang']);
     $GLOBALS['lang'] =& $user->lang;
     global $lang;
     require $phpbb_root_path . 'includes/functions_mods.' . $phpEx;
     require $phpbb_root_path . 'install/install_versions.' . $phpEx;
     require $phpbb_root_path . 'includes/functions_convert.' . $phpEx;
     require $phpbb_root_path . 'includes/functions_transfer.' . $phpEx;
     require $phpbb_root_path . 'umil/umil_frontend.' . $phpEx;
     global $current_version;
     $current_version = $qi_config['automod_version'];
     // add some language entries to prevent notices
     $user->lang += array('FILE_EDITS' => '', 'NEXT_STEP' => '');
     $umil = new umil_frontend($mod_name);
     // We will sort the actions to prevent issues from mod authors incorrectly listing the version numbers
     uksort($versions, 'version_compare');
     // Find the current version to install
     $current_version = '0.0.0';
     foreach ($versions as $version => $actions) {
         $current_version = $version;
     }
     $action = 'install';
     $version_select = $current_version;
     $umil->run_actions($action, $versions, $version_config_name, $version_select);
     if ($make_writable) {
         // Tell AutoMOD to make files world writable if that is selected
         set_config('am_file_perms', '0666');
         set_config('am_dir_perms', '0777');
     }
 }