/**
  * Constructor
  *
  * @access	public
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Make sure tables exist that won't in pre 3.0 versions */
     if (file_exists(IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower(ipsRegistry::$settings['sql_driver']) . '.php')) {
         require IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower(ipsRegistry::$settings['sql_driver']) . '.php';
         $prefix = $this->registry->dbFunctions()->getPrefix();
         if (!$this->DB->checkForField('upgrade_app', 'upgrade_history')) {
             if ($UPGRADE_TABLE_FIELD) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_TABLE_FIELD, $prefix));
             }
         }
         if (!$this->DB->checkForTable('upgrade_sessions')) {
             if ($UPGRADE_SESSION_TABLE) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_SESSION_TABLE, $prefix));
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * Check we can upgrade
  *
  * @return	mixed	Boolean true or error message
  */
 public function checkForProblems()
 {
     //-----------------------------------------
     // Compatibility check
     //-----------------------------------------
     $minAppVersions = array();
     $args = func_get_args();
     if (!empty($args)) {
         $errors = array();
         foreach ($minAppVersions as $k => $v) {
             if (!isset(ipsRegistry::$applications[$k]) or !ipsRegistry::$applications[$k]['app_enabled']) {
                 continue;
             }
             $numbers = IPSSetUp::fetchAppVersionNumbers($k);
             /* Are we upgrading this app now? */
             if (isset($args[0][$k])) {
                 $ourVersion = $numbers['latest'][0];
             } else {
                 $ourVersion = $numbers['current'][0];
             }
             if ($v > $ourVersion) {
                 $appName = ipsRegistry::$applications[$k]['app_title'];
                 $allVersions = IPSSetUp::fetchXmlAppVersions($k);
                 return "Установленная версия {$appName} не будет работать с этой версией IP.Board. Вы должны обновить {$appName} версии {$allVersions[$v]} или выше, или отключить приложение в админцентре для продолжения.";
             }
         }
     }
     return TRUE;
 }
Esempio n. 3
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* If less than 3, just bounce out as settings tables won't be here, etc */
     if (IPSSetUp::is300plus() !== TRUE) {
         $this->registry->autoLoadNextAction('upgrade');
         return;
     }
     if ($this->request['do'] == 'check') {
         $lcheck = $this->check();
         if ($lcheck === TRUE) {
             $this->registry->autoLoadNextAction('upgrade');
             return;
         }
     } else {
         $lcheck = $this->check(TRUE);
         if ($lcheck === TRUE) {
             $this->registry->autoLoadNextAction('upgrade');
             return;
         }
     }
     $this->registry->output->setTitle("License Key");
     $this->registry->output->setNextAction("license&do=check");
     $this->registry->output->addContent($this->registry->output->template()->page_license($lcheck));
     $this->registry->output->sendOutput();
 }
    /**
     * Add pre-upgrade options: Form
     * 
     * @return	string	 HTML block
     */
    public function preInstallOptionsForm()
    {
        $_wrapper = "<ul>%s</ul>";
        $_html = '';
        $posts = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'posts'));
        // Is 3.1?
        if (IPSSetUp::is300plus() && !IPSSetUp::is320plus()) {
            // Got more than 100K posts?
            if ($posts['total'] > 100000 && !$this->DB->checkForField('post_field_int', 'posts')) {
                $_html .= <<<EOF
\t\t<li>
\t\t\t<input type='checkbox' name='manualPostsTableQuery' value='1' checked='checked' />
\t\t\tВнести изменения в структуру таблицы Posts вручную?  На вашем форуме более 100,000 сообщений.  Мы <b>настоятельно рекомендуем</b> вам включить данную опцию и самостоятельно выполнить 
\t\t\tSQL запросы для обновления таблицы сообщений. Если вы отключите данную опцию существует большая вероятность того, что мастер обновления не сможет обновить форум.
\t\t</li>
EOF;
            }
        }
        $_html .= <<<EOF
\t\t<li>
\t\t\t<input type='checkbox' name='flagBanned' value='1' checked='checked' />
\t\t\t<strong>Отметить всех пользователей из группы "Забаненные", как забаненных</strong><br />
\t\t\tВ 3.3.0 удалена отдельная группа для заблокированных, теперь проверка осуществляется на основе метки для каждого пользователя. Возможно, что часть пользователей, отмеченных как
\t\t\tзабаненные, в результате такого переноса, не будут находится поиском в админ-центре при применении фильтра поиска по заблокированным.
\t\t\t<br />Мы рекомендуем воспользоваться этой опцией.
\t\t</li>
EOF;
        if ($_html) {
            return sprintf($_wrapper, $_html);
        } else {
            return '';
        }
    }
Esempio n. 5
0
    /**
     * Add pre-upgrade options: Form
     * 
     * @return	string	 HTML block
     */
    public function preInstallOptionsForm()
    {
        $_wrapper = "<ul>%s</ul>";
        $_html = '';
        $posts = $this->DB->buildAndFetch(array('select' => 'count(*) as total', 'from' => 'posts'));
        // Is 3.1?
        if (IPSSetUp::is300plus() && !IPSSetUp::is320plus()) {
            // Got more than 100K posts?
            if ($posts['total'] > 100000 && !$this->DB->checkForField('post_field_int', 'posts')) {
                $_html .= <<<EOF
\t\t<li>
\t\t\t<input type='checkbox' name='manualPostsTableQuery' value='1' checked='checked' />
\t\t\tManually apply changes to the posts table?  Your site has more than 100,000 posts.  We <b>strongly recommend</b> that you enable this option and manually run the provided 
\t\t\tSQL query to alter your posts table in order to prevent timeouts in the web-based upgrader.  If you uncheck this option, it is very possible the upgrader will timeout attempting to
\t\t\tupdate your posts table.
\t\t</li>
EOF;
            }
        }
        $_html .= <<<EOF
\t\t<li>
\t\t\t<input type='checkbox' name='flagBanned' value='1' checked='checked' />
\t\t\t<strong>Flag all members in the Banned member group as banned</strong><br />
\t\t\t3.3.0 removes the need for a specific Banned Group and uses the built in 'flag' on a per-member basis. However, unless you choose to update all
\t\t\tmembers in the current Banned Group as 'banned' they may not appear when searching for banned members in the ACP.
\t\t\t<br />We recommend you keep this box ticked
\t\t</li>
EOF;
        if ($_html) {
            return sprintf($_wrapper, $_html);
        } else {
            return '';
        }
    }
 /**
  * Check we can upgrade
  *
  * @return	mixed	Boolean true or error message
  */
 public function checkForProblems()
 {
     //-----------------------------------------
     // Compatibility check
     //-----------------------------------------
     $minAppVersions = array();
     $args = func_get_args();
     if (!empty($args)) {
         $errors = array();
         foreach ($minAppVersions as $k => $v) {
             if (!isset(ipsRegistry::$applications[$k]) or !ipsRegistry::$applications[$k]['app_enabled']) {
                 continue;
             }
             $numbers = IPSSetUp::fetchAppVersionNumbers($k);
             /* Are we upgrading this app now? */
             if (isset($args[0][$k])) {
                 $ourVersion = $numbers['latest'][0];
             } else {
                 $ourVersion = $numbers['current'][0];
             }
             if ($v > $ourVersion) {
                 $appName = ipsRegistry::$applications[$k]['app_title'];
                 $allVersions = IPSSetUp::fetchXmlAppVersions($k);
                 return "The version of {$appName} you have installed will not work with this version of IP.Board. You must upgrade {$appName} to {$allVersions[$v]} or higher, or disable it in the Admin CP in order continue.";
             }
         }
     }
     return TRUE;
 }
Esempio n. 7
0
 /**
  * Return any post-installation notices
  * 
  * @return	array	 Array of notices
  */
 public function postInstallNotices()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $_skip = $options['ipchat'][13000]['skipIgnoredUsers'];
     $notices = array();
     if ($_skip) {
         $notices[] = "Ignored chat users have not been converted.  You should run the tool in the ACP under Other Apps &gt; Chat &gt; Tools to convert the ignored users.";
     }
     return $notices;
 }
Esempio n. 8
0
 /**
  * Convert ignored users
  * 
  * @param	int
  * @return	@e void
  */
 public function convertIgnored()
 {
     /* Are we skipping this step? */
     $options = IPSSetUp::getSavedData('custom_options');
     $_skip = $options['ipchat'][13000]['skipIgnoredUsers'];
     if ($_skip) {
         $this->registry->output->addMessage("Skipping chat ignored users conversion...");
         $this->request['st'] = 0;
         $this->request['workact'] = '';
         return;
     }
     /* Init */
     $st = intval($this->request['st']);
     $did = 0;
     $each = 500;
     /* Find chat ignored users */
     $this->DB->build(array('select' => 'member_id, members_cache', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($st, $each)));
     $outer = $this->DB->execute();
     while ($r = $this->DB->fetch($outer)) {
         $did++;
         /* Unpack cache */
         $_cache = unserialize($r['members_cache']);
         /* Now look for ignored users in chat */
         if (is_array($_cache['ignore_chat']) and count($_cache['ignore_chat'])) {
             foreach ($_cache['ignore_chat'] as $_mid) {
                 /* Are we already 'ignoring' this user for other reasons? */
                 $_check = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . $r['member_id'] . ' AND ignore_ignore_id=' . $_mid));
                 /* If yes, then update record to also ignore chat */
                 if ($_check['ignore_id']) {
                     $this->DB->update('ignored_users', array('ignore_chats' => 1), 'ignore_id=' . $_check['ignore_id']);
                 } else {
                     $this->DB->insert('ignored_users', array('ignore_chats' => 1, 'ignore_owner_id' => $r['member_id'], 'ignore_ignore_id' => $_mid));
                 }
             }
             /* Rebuild cache */
             IPSMember::rebuildIgnoredUsersCache($r);
             /* Clean up members_cache */
             unset($_cache['ignore_chat']);
             $_cache = serialize($_cache);
             $this->DB->update('members', array('members_cache' => $_cache), 'member_id=' . $r['member_id']);
         }
     }
     /* Show message and redirect */
     if ($did > 0) {
         $this->request['st'] = $st + $did;
         $this->request['workact'] = 'ignored';
         $this->registry->output->addMessage("Up to {$this->request['st']} members checked for ignored chat users...");
     } else {
         $this->request['st'] = 0;
         $this->request['workact'] = '';
         $this->registry->output->addMessage("All ignored chat users converted...");
     }
     /* Next Page */
     return;
 }
Esempio n. 9
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* INIT */
     $error = false;
     /* Check input? */
     if ($this->request['do'] == 'check') {
         /* Check Directory */
         if (!is_dir($this->request['install_dir'])) {
             $error = true;
             $this->registry->output->addWarning('The specified directory does not exist');
         }
         /* Check URL */
         if (!$this->request['install_dir']) {
             $error = true;
             $this->registry->output->addWarning('You did not specify a URL');
         }
         if (!$error) {
             /* Save Form Data */
             IPSSetUp::setSavedData('install_dir', preg_replace("#(//)\$#", "", str_replace('\\', '/', $this->request['install_dir']) . '/'));
             IPSSetUp::setSavedData('install_url', preg_replace("#(//)\$#", "", str_replace('\\', '/', $this->request['install_url']) . '/'));
             /* Next Action */
             $this->registry->autoLoadNextAction('db');
         }
     }
     /* Guess at directory */
     if (!defined('CP_DIRECTORY')) {
         define('CP_DIRECTORY', 'admin');
     }
     $dir = str_replace(CP_DIRECTORY . '/install', '', getcwd());
     $dir = str_replace(CP_DIRECTORY . '\\install', '', $dir);
     // Windows
     $dir = str_replace('\\', '/', $dir);
     /* Guess at URL */
     $url = str_replace("/" . CP_DIRECTORY . "/installer/index.php", "", $_SERVER['HTTP_REFERER']);
     $url = str_replace("/" . CP_DIRECTORY . "/installer/", "", $url);
     $url = str_replace("/" . CP_DIRECTORY . "/installer", "", $url);
     $url = str_replace("/" . CP_DIRECTORY . "/install/index.php", "", $_SERVER['HTTP_REFERER']);
     $url = str_replace("/" . CP_DIRECTORY . "/install/", "", $url);
     $url = str_replace("/" . CP_DIRECTORY . "/install", "", $url);
     $url = str_replace("/" . CP_DIRECTORY, "", $url);
     $url = str_replace("index.php", "", $url);
     $url = preg_replace("!\\?(.+?)*!", "", $url);
     $url = "{$url}/";
     /* Page Output */
     $this->registry->output->setTitle("Paths and URLs");
     $this->registry->output->setNextAction("address&do=check");
     $this->registry->output->addContent($this->registry->output->template()->page_address($dir, $url));
     $this->registry->output->sendOutput();
 }
Esempio n. 10
0
 /**
  * Set db prefix
  *
  * @access	public
  * @param	object	Registry reference
  * @return	@e void
  */
 public function setDbPrefix($prefix = '')
 {
     if ($prefix) {
         $this->prefix = $prefix;
         return;
     } else {
         if (class_exists('IPSSetUp')) {
             if (IPSSetUp::getSavedData('db_pre')) {
                 $this->prefix = IPSSetUp::getSavedData('db_pre');
                 return;
             }
         }
     }
     /* Still 'ere? */
     $this->prefix = $this->settings['sql_tbl_prefix'];
 }
Esempio n. 11
0
 /**
  * Constructor
  *
  * @access	public
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     //* Make sure tables exist that won't in pre 3.0 versions */
     if (is_file(IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower(ipsRegistry::$settings['sql_driver']) . '.php')) {
         /* Init vars */
         $UPGRADE_HISTORY_TABLE = '';
         $UPGRADE_TABLE_FIELD = '';
         $UPGRADE_SESSION_TABLE = '';
         $UPGRADE_CSS_PREVIOUS = '';
         $UPGRADE_TEMPLATE_PREVIOUS = '';
         require IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower(ipsRegistry::$settings['sql_driver']) . '.php';
         /*noLibHook*/
         $prefix = $this->registry->dbFunctions()->getPrefix();
         if (!$this->DB->checkForTable('upgrade_history')) {
             if ($UPGRADE_HISTORY_TABLE) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_HISTORY_TABLE, $prefix));
             }
         }
         if (!$this->DB->checkForField('upgrade_app', 'upgrade_history')) {
             if ($UPGRADE_TABLE_FIELD) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_TABLE_FIELD, $prefix));
             }
         }
         if (!$this->DB->checkForTable('upgrade_sessions')) {
             if ($UPGRADE_SESSION_TABLE) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_SESSION_TABLE, $prefix));
             }
         }
         if (!$this->DB->checkForTable('skin_css_previous')) {
             if ($UPGRADE_CSS_PREVIOUS) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_CSS_PREVIOUS, $prefix));
             }
         }
         if (!$this->DB->checkForTable('skin_templates_previous')) {
             if ($UPGRADE_TEMPLATE_PREVIOUS) {
                 $this->DB->query(IPSSetUp::addPrefixToQuery($UPGRADE_TEMPLATE_PREVIOUS, $prefix));
             }
         }
     }
 }
Esempio n. 12
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Remove the FURL cache */
     @unlink(FURL_CACHE_PATH);
     /* Got anything to show? */
     $apps = explode(',', IPSSetUp::getSavedData('install_apps'));
     $vNums = IPSSetUp::getSavedData('version_numbers');
     $output = array();
     if (is_array($apps) and count($apps)) {
         foreach ($apps as $app) {
             /* Grab version numbers */
             $numbers = IPSSetUp::fetchAppVersionNumbers($app);
             /* Grab all numbers */
             $nums[$app] = IPSSetUp::fetchXmlAppVersions($app);
             /* Grab app data */
             $appData[$app] = IPSSetUp::fetchXmlAppInformation($app, $this->settings['gb_char_set']);
             $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $vNums[$app], $numbers['latest'][0]);
         }
         /* Got anything? */
         if (count($appClasses)) {
             foreach ($appClasses as $app => $data) {
                 foreach ($data as $num) {
                     if (is_file(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                         $_class = 'version_class_' . $app . '_' . $num;
                         require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                         /*noLibHook*/
                         $_tmp = new $_class($this->registry);
                         if (method_exists($_tmp, 'postInstallNotices')) {
                             $_t = $_tmp->postInstallNotices();
                             if (is_array($_t) and count($_t)) {
                                 $output[$app][$num] = array('long' => $nums[$app][$num], 'app' => $appData[$app], 'out' => implode("<br />", $_t));
                             }
                         }
                     }
                 }
             }
         }
     }
     /* Remove any SQL source files */
     IPSSetUp::removeSqlSourceFiles();
     /* Simply return the Done page */
     $this->registry->output->setTitle("Complete!");
     $this->registry->output->setHideButton(TRUE);
     $this->registry->output->addContent($this->registry->output->template()->upgrade_complete($output));
     $this->registry->output->sendOutput();
 }
Esempio n. 13
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     $_e = 0;
     /* Check input? */
     if ($this->request['do'] == 'check') {
         if (!$this->request['username']) {
             $_e = 1;
             $this->registry->output->addWarning('You must specify a display name for the admin account');
         }
         if (!$this->request['password']) {
             $_e = 1;
             $this->registry->output->addWarning('You must specify a password for the admin account');
         } else {
             if ($this->request['password'] != $this->request['confirm_password']) {
                 $_e = 1;
                 $this->registry->output->addWarning('The admin passwords did not match');
             }
         }
         if (!$this->request['email'] or IPSText::checkEmailAddress($this->request['email']) !== TRUE) {
             $_e = 1;
             $this->registry->output->addWarning('You must specify an email address for the admin account');
         }
         if ($_e) {
             $this->registry->output->setTitle("Admin: Errors");
             $this->registry->output->setNextAction('admin&do=check');
             $this->registry->output->addContent($this->registry->output->template()->page_admin());
             $this->registry->output->sendOutput();
         } else {
             /* Save Form Data */
             IPSSetUp::setSavedData('admin_user', $this->request['username']);
             IPSSetUp::setSavedData('admin_pass', $this->request['password']);
             IPSSetUp::setSavedData('admin_email', $this->request['email']);
             /* Next Action */
             $this->registry->autoLoadNextAction('install');
             return;
         }
     }
     /* Output */
     $this->registry->output->setTitle("Admin Account Creation");
     $this->registry->output->setNextAction('admin&do=check');
     $this->registry->output->addContent($this->registry->output->template()->page_admin());
     $this->registry->output->sendOutput();
 }
Esempio n. 14
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     $_e = 0;
     /* Check input? */
     if ($this->request['do'] == 'check') {
         if (!$this->request['username']) {
             $_e = 1;
             $this->registry->output->addWarning('Необходимо указать отображаемое имя пользователя');
         }
         if (!$this->request['password']) {
             $_e = 1;
             $this->registry->output->addWarning('Необходимо ввести пароль');
         } else {
             if ($this->request['password'] != $this->request['confirm_password']) {
                 $_e = 1;
                 $this->registry->output->addWarning('Введенные пароли не совпадают');
             }
         }
         if (!$this->request['email'] or IPSText::checkEmailAddress($this->request['email']) !== TRUE) {
             $_e = 1;
             $this->registry->output->addWarning('Необходимо указать Email');
         }
         if ($_e) {
             $this->registry->output->setTitle("Администратор: Ошибка");
             $this->registry->output->setNextAction('admin&do=check');
             $this->registry->output->addContent($this->registry->output->template()->page_admin());
             $this->registry->output->sendOutput();
         } else {
             /* Save Form Data */
             IPSSetUp::setSavedData('admin_user', $this->request['username']);
             IPSSetUp::setSavedData('admin_pass', $this->request['password']);
             IPSSetUp::setSavedData('admin_email', $this->request['email']);
             /* Next Action */
             $this->registry->autoLoadNextAction('install');
             return;
         }
     }
     /* Output */
     $this->registry->output->setTitle("Создание учетной записи администратора");
     $this->registry->output->setNextAction('admin&do=check');
     $this->registry->output->addContent($this->registry->output->template()->page_admin());
     $this->registry->output->sendOutput();
 }
Esempio n. 15
0
 /**
  * Check we can upgrade
  *
  * @return	mixed	Boolean true or error message
  */
 public function checkForProblems()
 {
     //-----------------------------------------
     // Compatibility check
     //-----------------------------------------
     $requiredIpbVersion = 32006;
     // 3.2.3
     $args = func_get_args();
     if (!empty($args)) {
         $numbers = IPSSetUp::fetchAppVersionNumbers('core');
         /* Are we upgrading core now? */
         if (isset($args[0]['core'])) {
             $ourVersion = $numbers['latest'][0];
         } else {
             $ourVersion = $numbers['current'][0];
         }
         if ($requiredIpbVersion > $ourVersion) {
             $allVersions = IPSSetUp::fetchXmlAppVersions('core');
             return "This version of IP.Chat requires IP.Board {$allVersions[$requiredIpbVersion]} or higher.";
         }
     }
     return TRUE;
 }
Esempio n. 16
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Delete sessions and continue */
     if ($this->request['do'] == 'rsessions') {
         IPSSetUp::removePreviousSession();
     }
     /* Rebuild from last session and continue */
     if ($this->request['do'] == 'rcontinue') {
         $oldSession = IPSSetUp::checkForPreviousSessions();
         if (count($oldSession) and $oldSession['_session_get']['section'] and $oldSession['_sd']['install_apps']) {
             IPSSetUp::restorePreviousSession($oldSession);
             exit;
         }
     }
     /* Check for failed upgrade */
     if (!$this->request['do'] or $this->request['do'] != 'rsessions') {
         $oldSession = IPSSetUp::checkForPreviousSessions();
         if (count($oldSession) and $oldSession['_session_get']['section'] and $oldSession['_sd']['install_apps']) {
             /* Page Output */
             $this->registry->output->setTitle("Applications");
             $this->registry->output->setNextAction('apps&do=rsessions');
             //$this->registry->output->setHideButton( TRUE );
             $this->registry->output->addContent($this->registry->output->template()->upgrade_previousSession($oldSession));
             $this->registry->output->sendOutput();
         }
     }
     /* Save data */
     if ($this->request['do'] == 'save') {
         $apps = explode(',', IPSSetUp::getSavedData('install_apps'));
         $toSave = array();
         $vNums = array();
         if (is_array($apps) and count($apps)) {
             foreach ($apps as $app) {
                 /* Grab version numbers */
                 $numbers = IPSSetUp::fetchAppVersionNumbers($app);
                 /* Grab all numbers */
                 $nums[$app] = IPSSetUp::fetchXmlAppVersions($app);
                 /* Grab app data */
                 $appData[$app] = IPSSetUp::fetchXmlAppInformation($app, $this->settings['gb_char_set']);
                 $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $numbers['current'][0], $numbers['latest'][0]);
                 /* Store starting vnums */
                 $vNums[$app] = $numbers['current'][0];
             }
             /* Got anything? */
             if (count($appClasses)) {
                 foreach ($appClasses as $app => $data) {
                     foreach ($data as $num) {
                         if (is_file(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                             $_class = 'version_class_' . $app . '_' . $num;
                             require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                             /*noLibHook*/
                             $_tmp = new $_class($this->registry);
                             if (method_exists($_tmp, 'preInstallOptionsSave')) {
                                 $_t = $_tmp->preInstallOptionsSave();
                                 if (is_array($_t) and count($_t)) {
                                     $toSave[$app][$num] = $_t;
                                 }
                             }
                         }
                     }
                 }
                 /* Save it */
                 if (count($toSave)) {
                     IPSSetUp::setSavedData('custom_options', $toSave);
                 }
                 if (count($vNums)) {
                     IPSSetUp::setSavedData('version_numbers', $vNums);
                 }
             }
         }
         /* Next Action */
         $this->registry->autoLoadNextAction('license');
     } else {
         if ($this->request['do'] == 'check') {
             /* Check Directory */
             if (!is_array($_POST['apps']) or !count($_POST['apps'])) {
                 /* We use 'warning' because it has same effect but does not block the 'next' button (which they'll want to use after selecting an app when page reloads) */
                 $this->registry->output->addWarning('You must select to upgrade at least one application');
             } else {
                 /* If it's lower than 3.0.0, then add in the removed apps */
                 if (IPSSetUp::is300plus() !== TRUE) {
                     $_POST['apps']['forums'] = 1;
                     $_POST['apps']['members'] = 1;
                     $_POST['apps']['calendar'] = 1;
                     $_POST['apps']['chat'] = 1;
                 } else {
                     if ($_POST['apps']['core']) {
                         $_POST['apps']['forums'] = 1;
                         $_POST['apps']['members'] = 1;
                     }
                 }
                 /* Save Form Data */
                 IPSSetUp::setSavedData('install_apps', implode(',', array_keys($_POST['apps'])));
                 /* Got any app-version classes? */
                 $appClasses = array();
                 $output = array();
                 $nums = array();
                 $appData = array();
                 foreach ($_POST['apps'] as $app => $val) {
                     /* Grab version numbers */
                     $numbers = IPSSetUp::fetchAppVersionNumbers($app);
                     /* Grab all numbers */
                     $nums[$app] = IPSSetUp::fetchXmlAppVersions($app);
                     /* Grab app data */
                     $appData[$app] = IPSSetUp::fetchXmlAppInformation($app, $this->settings['gb_char_set']);
                     $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $numbers['current'][0], $numbers['latest'][0]);
                 }
                 /* Got anything? */
                 $error = FALSE;
                 if (count($appClasses)) {
                     foreach ($appClasses as $app => $data) {
                         if (is_file(IPSLib::getAppDir($app) . '/setup/upgradeCheck.php')) {
                             $_class = $app . '_upgradeCheck';
                             require_once IPSLib::getAppDir($app) . '/setup/upgradeCheck.php';
                             /*noLibHook*/
                             $requirements_class = new $_class();
                             if (method_exists($requirements_class, 'checkForProblems')) {
                                 $check = $requirements_class->checkForProblems($appClasses);
                                 if ($check !== TRUE) {
                                     $error = TRUE;
                                     $this->registry->output->addError($check);
                                 }
                             }
                         }
                         foreach ($data as $num) {
                             if (is_file(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                                 $_class = 'version_class_' . $app . '_' . $num;
                                 require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                                 /*noLibHook*/
                                 $_tmp = new $_class($this->registry);
                                 if (method_exists($_tmp, 'preInstallOptionsForm')) {
                                     $_t = $_tmp->preInstallOptionsForm();
                                     if ($_t) {
                                         $output[$app][$num] = array('long' => $nums[$app][$num], 'app' => $appData[$app], 'out' => $_t);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 /* Finally... */
                 if (count($output) or $error === TRUE) {
                     $this->registry->output->setTitle("Applications");
                     $this->registry->output->setNextAction('apps&do=save');
                     //$this->registry->output->setHideButton( TRUE );
                     if (!$error) {
                         $this->registry->output->addContent($this->registry->output->template()->upgrade_appsOptions($output));
                     }
                     $this->registry->output->sendOutput();
                 } else {
                     /* Next Action */
                     $this->registry->autoLoadNextAction('license');
                 }
             }
         }
     }
     /* Generate apps... */
     $apps = array('core' => array(), 'ips' => array(), 'other' => array());
     foreach (array('applications', 'applications_addon/ips', 'applications_addon/other') as $_pBit) {
         $path = IPS_ROOT_PATH . $_pBit;
         $handle = opendir($path);
         while (($file = readdir($handle)) !== FALSE) {
             if (!preg_match("#^\\.#", $file)) {
                 if (is_dir($path . '/' . $file)) {
                     //-----------------------------------------
                     // Get it!
                     //-----------------------------------------
                     if (!is_file(IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml')) {
                         continue;
                     }
                     $data = IPSSetUp::fetchXmlAppInformation($file, $this->settings['gb_char_set']);
                     switch ($_pBit) {
                         case 'applications':
                             $apps['core'][$file] = $data;
                             break;
                         case 'applications_addon/ips':
                             $apps['ips'][$file] = $data;
                             break;
                         case 'applications_addon/other':
                             $apps['other'][$file] = $data;
                             break;
                     }
                 }
             }
         }
         closedir($handle);
     }
     /* Reorder the array so that core is first */
     $new_array = array();
     $new_array['core'] = $apps['core']['core'];
     foreach ($apps['core'] as $app => $data) {
         if ($app == 'core') {
             continue;
         }
         $new_array[$app] = $data;
     }
     $apps['core'] = $new_array;
     /* Now get version numbers */
     foreach ($apps as $type => $app) {
         foreach ($apps[$type] as $app => $data) {
             if ($type == 'core' and ($app == 'forums' or $app == 'members')) {
                 /* Skip forums and members and just count core for now */
                 continue;
             }
             /* Grab version numbers */
             $numbers = IPSSetUp::fetchAppVersionNumbers($app);
             $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $numbers['current'][0], $numbers['latest'][0]);
             $apps[$type][$app]['_vnumbers'] = $numbers;
         }
     }
     /* Any notices? */
     $notices = array();
     if (count($appClasses)) {
         foreach ($appClasses as $app => $data) {
             $notices[$app] = array();
             foreach ($data as $num) {
                 if (is_file(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                     $_class = 'version_class_' . $app . '_' . $num;
                     require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                     /*noLibHook*/
                     $_tmp = new $_class($this->registry);
                     if (method_exists($_tmp, 'preInstallNotices')) {
                         $_t = $_tmp->preInstallNotices();
                         if ($_t) {
                             $notices[$app] = array_merge($_t, $notices[$app]);
                         }
                     }
                 }
             }
         }
     }
     /* If it's lower than 3.0.0, then remove some apps and make them part of 'core' */
     if (IPSSetUp::is300plus() !== TRUE) {
         unset($apps['ips']['calendar']);
         unset($apps['ips']['chat']);
     }
     /* Page Output */
     $this->registry->output->setTitle("Applications");
     $this->registry->output->setNextAction('apps&do=check');
     //$this->registry->output->setHideButton( TRUE );
     $this->registry->output->addContent($this->registry->output->template()->upgrade_apps($apps, $notices));
     $this->registry->output->sendOutput();
 }
Esempio n. 17
0
 /**
  * Main function executed automatically by the controller
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Load skin
     //-----------------------------------------
     $this->html = $this->registry->output->loadTemplate('cp_skin_mycp');
     //-----------------------------------------
     // Load language
     //-----------------------------------------
     $this->registry->getClass('class_localization')->loadLanguageFile(array('admin_mycp'));
     /* This is a little hacky, but we have to allow access to the whole module to get access to 
        'change my details'.  This check just makes sure that we don't also get access to the Dashboard
        if the permission system automatically added permission for 'change my details' */
     if ($this->registry->getClass('class_permissions')->editDetailsOnly) {
         /* If they just don't have access to the dashboard, let's show them something we do have access to */
         if (!$this->request['app']) {
             foreach (ipsRegistry::$applications as $k => $data) {
                 if ($this->registry->getClass('class_permissions')->checkForAppAccess($k) and ($k != 'core' or !$this->registry->getClass('class_permissions')->editDetailsOnly)) {
                     foreach (ipsRegistry::$modules[$k] as $module) {
                         if ($this->registry->getClass('class_permissions')->checkForModuleAccess($k, $module['sys_module_key'])) {
                             $filepath = IPSLib::getAppDir($k) . '/modules_admin/' . $module['sys_module_key'] . '/defaultSection.php';
                             if (is_file($filepath)) {
                                 $DEFAULT_SECTION = '';
                                 include $filepath;
                                 /*noLibHook*/
                                 if ($this->registry->getClass('class_permissions')->checkForSectionAccess($k, $module['sys_module_key'], $DEFAULT_SECTION)) {
                                     $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "app={$k}&amp;module={$module['sys_module_key']}&amp;section={$DEFAULT_SECTION}");
                                 }
                             }
                         }
                     }
                 }
             }
         }
         /* If all else fails, take them to the change details page */
         $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "core&amp;module=mycp&amp;section=details");
     } else {
         if (!$this->registry->getClass('class_permissions')->checkPermission('dashboard', 'core', 'mycp')) {
             $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "core&amp;module=mycp&amp;section=details");
         }
     }
     //-----------------------------------------
     // Set up stuff
     //-----------------------------------------
     $this->form_code = $this->html->form_code = 'module=mycp&amp;section=dashboard';
     $this->form_code_js = $this->html->form_code_js = 'module=mycp&section=dashboard';
     //-----------------------------------------
     // Hang on, do we need the upgrader?
     // The only reason this is still here, since we check on the login form, is because Rhett Buck AKA BHP wants to
     // login to the ACP, then upload files, then click the System tab and be automatically redirected to the upgrader.
     // Seriously though?  Who does that?  The login form redirects you, so if you happen to upload files and click on
     // the ACP link you're already covered.  Only Mr. RB, that's who.
     //-----------------------------------------
     if (!IN_DEV and (!defined('SKIP_UPGRADE_CHECK') or !SKIP_UPGRADE_CHECK)) {
         require_once IPS_ROOT_PATH . 'setup/sources/base/setup.php';
         /*noLibHook*/
         foreach (ipsRegistry::$applications as $app_dir => $app) {
             $_a = ($app_dir == 'forums' or $app_dir == 'members') ? 'core' : $app_dir;
             $numbers = IPSSetUp::fetchAppVersionNumbers($_a);
             if ($numbers['latest'][0] and $numbers['latest'][0] > $numbers['current'][0]) {
                 $this->registry->output->silentRedirect($this->settings['base_acp_url'] . '/upgrade/index.php?_acpRedirect=1');
                 return;
             }
         }
     }
     //-----------------------------------------
     // Get external data
     //-----------------------------------------
     $content = array();
     $thiscontent = "";
     $latest_version = array();
     $reg_end = "";
     $unfinished_upgrade = 0;
     $ipsNewsData = $this->cache->getCache('ipsNewsData');
     if (!isset($ipsNewsData['time']) or $ipsNewsData['time'] < time() - 43200) {
         $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
         $classFileManagement = new $classToLoad();
         if (strpos($this->settings['base_url'], 'https://') !== false) {
             $ipsNewsData['news'] = $classFileManagement->getFileContents('https://external.ipslink.com/ipboard33/dashboard/index.php?v=' . ipsRegistry::$vn_full);
             $ipsNewsData['vcheck'] = $classFileManagement->getFileContents('https://external.ipslink.com/latestversioncheck/ipb30x.php?' . base64_encode(ipsRegistry::$vn_full . '|^|' . $this->settings['board_url']));
         } else {
             $ipsNewsData['news'] = $classFileManagement->getFileContents('http://external.ipslink.com/ipboard33/dashboard/index.php?v=' . ipsRegistry::$vn_full);
             $ipsNewsData['vcheck'] = $classFileManagement->getFileContents('http://external.ipslink.com/latestversioncheck/ipb30x.php?' . base64_encode(ipsRegistry::$vn_full . '|^|' . $this->settings['board_url']));
         }
         $ipsNewsData['time'] = time();
         $this->cache->setCache('ipsNewsData', $ipsNewsData, array('array' => 1));
     }
     //-----------------------------------------
     // Get MySQL & PHP Version
     //-----------------------------------------
     $this->DB->getSqlVersion();
     //-----------------------------------------
     // Upgrade history?
     //-----------------------------------------
     $latest_version = array('upgrade_version_id' => NULL);
     $this->DB->build(array('select' => '*', 'from' => 'upgrade_history', 'order' => 'upgrade_version_id DESC', 'limit' => array(1)));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $latest_version = $r;
     }
     //-----------------------------------------
     // Resetting security image?
     //-----------------------------------------
     if ($this->request['reset_security_flag'] and $this->request['reset_security_flag'] == 1 and $this->request['new_build']) {
         $_latest = IPSLib::fetchVersionNumber('core');
         $new_build = intval($this->request['new_build']);
         $new_reason = trim(substr($this->request['new_reason'], 0, 1));
         $new_version = $_latest['long'] . '.' . $new_build . '.' . $new_reason;
         $this->DB->update('upgrade_history', array('upgrade_notes' => $new_version), 'upgrade_version_id=' . $latest_version['upgrade_version_id']);
         $latest_version['upgrade_notes'] = $new_version;
     }
     //-----------------------------------------
     // Got real version number?
     //-----------------------------------------
     ipsRegistry::$version = 'v' . $latest_version['upgrade_version_human'];
     ipsRegistry::$vn_full = !empty($latest_version['upgrade_notes']) ? $latest_version['upgrade_notes'] : ipsRegistry::$vn_full;
     //-----------------------------------------
     // Notepad
     //-----------------------------------------
     if ($this->request['save'] and $this->request['save'] == 1) {
         $_POST['notes'] = $_POST['notes'] ? $_POST['notes'] : $this->lang->words['cp_acpnotes'];
         $this->cache->setCache('adminnotes', IPSText::stripslashes($_POST['notes']), array('donow' => 1, 'array' => 0));
     }
     $text = $this->lang->words['cp_acpnotes'];
     if (!$this->cache->getCache('adminnotes')) {
         $this->cache->setCache('adminnotes', $text, array('donow' => 1, 'array' => 0));
     }
     $this->cache->updateCacheWithoutSaving('adminnotes', htmlspecialchars($this->cache->getCache('adminnotes'), ENT_QUOTES));
     $this->cache->updateCacheWithoutSaving('adminnotes', str_replace("&amp;#", "&#", $this->cache->getCache('adminnotes')));
     $content['ad_notes'] = $this->html->acp_notes($this->cache->getCache('adminnotes'));
     //-----------------------------------------
     // ADMINS USING CP
     //-----------------------------------------
     $t_time = time() - 60 * 10;
     $time_now = time();
     $seen_name = array();
     $acponline = "";
     $this->DB->build(array('select' => 's.session_member_name, s.session_member_id, s.session_location, s.session_log_in_time, s.session_running_time, s.session_ip_address, s.session_url', 'from' => array('core_sys_cp_sessions' => 's'), 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => "m.member_id=s.session_member_id", 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
     $q = $this->DB->execute();
     while ($r = $this->DB->fetch($q)) {
         if (isset($seen_name[$r['session_member_name']]) and $seen_name[$r['session_member_name']] == 1) {
             continue;
         } else {
             $seen_name[$r['session_member_name']] = 1;
         }
         $r['_log_in'] = $time_now - $r['session_log_in_time'];
         $r['_click'] = $time_now - $r['session_running_time'];
         if ($r['_log_in'] / 60 < 1) {
             $r['_log_in'] = sprintf("%0d", $r['_log_in']) . ' ' . $this->lang->words['cp_secondsago'];
         } else {
             $r['_log_in'] = sprintf("%0d", $r['_log_in'] / 60) . ' ' . $this->lang->words['cp_minutesago'];
         }
         if ($r['_click'] / 60 < 1) {
             $r['_click'] = sprintf("%0d", $r['_click']) . ' ' . $this->lang->words['cp_secondsago'];
         } else {
             $r['_click'] = sprintf("%0d", $r['_click'] / 60) . ' ' . $this->lang->words['cp_minutesago'];
         }
         $r['session_location'] = $r['session_location'] ? $r['session_location'] : $this->lang->words['cp_index'];
         $r['seo_link'] = $this->registry->output->buildSEOUrl($this->settings['board_url'] . '/index.php?showuser='******'session_member_id'], 'none', $r['members_seo_name'], 'showuser');
         $admins_online[] = $r;
     }
     $content['acp_online'] = $this->html->acp_onlineadmin_wrapper($admins_online);
     //-----------------------------------------
     // Members awaiting admin validation?
     //-----------------------------------------
     if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'admin') {
         $where_extra = $this->settings['reg_auth_type'] == 'admin_user' ? ' AND user_verified=1' : '';
         $admin_reg = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as reg', 'from' => 'validating', 'where' => 'new_reg=1' . $where_extra));
         if ($admin_reg['reg'] > 0) {
             // We have some member's awaiting admin validation
             $data = null;
             $this->DB->build(array('select' => 'v.*', 'from' => array('validating' => 'v'), 'where' => 'new_reg=1' . $where_extra, 'limit' => array(3), 'add_join' => array(array('type' => 'left', 'select' => 'm.members_display_name, m.email, m.ip_address', 'from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id'))));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 if ($r['coppa_user'] == 1) {
                     $r['_coppa'] = ' ( COPPA )';
                 } else {
                     $r['_coppa'] = "";
                 }
                 $r['_entry'] = $this->registry->getClass('class_localization')->getDate($r['entry_date'], 'TINY');
                 $data .= $this->html->acp_validating_block($r);
             }
             $content['validating'] = $this->html->acp_validating_wrapper($data);
         }
     }
     //-----------------------------------------
     // Info for the stats bar
     //-----------------------------------------
     $stats = array('performance' => false, 'active_users' => 0, 'server_load' => 0);
     $record = $this->cache->getCache('performanceCache');
     if (is_array($record) and count($record)) {
         $stats['performance'] = true;
     }
     list($load, $time) = explode('-', $this->caches['systemvars']['loadlimit']);
     $time = time() - $this->settings['au_cutoff'] * 60;
     $online = $this->DB->buildAndFetch(array('select' => 'count(*) as rows', 'from' => 'sessions', 'where' => "running_time > {$time}"));
     $stats['active_users'] = $online['rows'];
     $stats['server_load'] = $load;
     //-----------------------------------------
     // Piece it together
     //-----------------------------------------
     $this->registry->output->html .= $this->html->mainTemplate($content, $ipsNewsData, $this->getNotificationPanelEntries(), $stats);
     //-----------------------------------------
     // Left log all on?
     //-----------------------------------------
     if (IPS_LOG_ALL === TRUE) {
         $_html = $this->html->warning_box($this->lang->words['ds_log_all_title'], $this->lang->words['ds_log_all_desc']) . "<br />";
         $this->registry->output->html = str_replace('<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html);
     }
     //-----------------------------------------
     // IN DEV stuff...
     //-----------------------------------------
     if (IN_DEV) {
         $lastUpdate = $this->caches['indev'];
         $lastUpdate = is_array($lastUpdate) ? $lastUpdate : array('import' => array('settings' => array()));
         $lastModUpdate = is_array($lastUpdate) ? $lastUpdate : array('import' => array('modules' => array()));
         $lastTaskUpdate = is_array($lastUpdate) ? $lastUpdate : array('import' => array('tasks' => array()));
         $lastHelpUpdate = is_array($lastUpdate) ? $lastUpdate : array('import' => array('help' => array()));
         $lastbbUpdate = is_array($lastUpdate) ? $lastUpdate : array('import' => array('bbcode' => array()));
         $content = array();
         $modContent = array();
         $tasksContent = array();
         $helpContent = array();
         $bbContent = array();
         $_html = '';
         foreach (ipsRegistry::$applications as $app_dir => $data) {
             /* Settings */
             $lastMtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_settings.xml'));
             $lastDBtime = intval($lastUpdate['import']['settings'][$app_dir]);
             if ($lastMtime > $lastDBtime) {
                 $_mtime = $this->registry->getClass('class_localization')->getDate($lastMtime, 'JOINED');
                 $_dbtime = $this->registry->getClass('class_localization')->getDate($lastDBtime, 'JOINED');
                 $content[] = "<strong>" . $data['app_title'] . " {$this->lang->words['cp_settingsupdated']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
             }
             /* Modules */
             $lastMtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_modules.xml'));
             $lastDBtime = intval($lastUpdate['import']['modules'][$app_dir]);
             if ($lastMtime > $lastDBtime) {
                 $_mtime = $this->registry->getClass('class_localization')->getDate($lastMtime, 'JOINED');
                 $_dbtime = $this->registry->getClass('class_localization')->getDate($lastDBtime, 'JOINED');
                 $modContent[] = "<strong>" . $data['app_title'] . " {$this->lang->words['cp_modulessneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
             }
             /* Tasks */
             $lastMtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_tasks.xml'));
             $lastDBtime = intval($lastUpdate['import']['tasks'][$app_dir]);
             if ($lastMtime > $lastDBtime) {
                 $_mtime = $this->registry->getClass('class_localization')->getDate($lastMtime, 'JOINED');
                 $_dbtime = $this->registry->getClass('class_localization')->getDate($lastDBtime, 'JOINED');
                 $tasksContent[] = "<strong>" . $data['app_title'] . " {$this->lang->words['cp_taskssneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
             }
             /* Help Files */
             $lastMtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_help.xml'));
             $lastDBtime = intval($lastUpdate['import']['help'][$app_dir]);
             if ($lastMtime > $lastDBtime) {
                 $_mtime = $this->registry->getClass('class_localization')->getDate($lastMtime, 'JOINED');
                 $_dbtime = $this->registry->getClass('class_localization')->getDate($lastDBtime, 'JOINED');
                 $helpContent[] = "<strong>" . $data['app_title'] . " {$this->lang->words['cp_helpneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
             }
             /* BBCode Files */
             $lastMtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_bbcode.xml'));
             $lastDBtime = intval($lastUpdate['import']['bbcode'][$app_dir]);
             if ($lastMtime > $lastDBtime) {
                 $_mtime = $this->registry->getClass('class_localization')->getDate($lastMtime, 'JOINED');
                 $_dbtime = $this->registry->getClass('class_localization')->getDate($lastDBtime, 'JOINED');
                 $bbContent[] = "<strong>" . $data['app_title'] . " {$this->lang->words['cp_bbcodeneedup']}.</strong><br />-- {$this->lang->words['cp_lastimportrun']}: {$_dbtime}<br />-- {$this->lang->words['cp_lastxmlexport']}: {$_mtime}";
             }
         }
         if (count($content)) {
             $_html = $this->html->warning_box($this->lang->words['cp_settingsneedup'], implode($content, "<br />") . "<br /><a href='" . $this->settings['base_url'] . "app=core&amp;module=settings&amp;section=settings&amp;do=settingsImportApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
         }
         if (count($modContent)) {
             $_html .= $this->html->warning_box($this->lang->words['cp_modulessneedup'], implode($modContent, "<br />") . "<br /><a href='" . $this->settings['base_url'] . "app=core&amp;module=applications&amp;section=applications&amp;do=inDevRebuildAll'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
         }
         if (count($tasksContent)) {
             $_html .= $this->html->warning_box($this->lang->words['cp_taskssneedup'], implode($tasksContent, "<br />") . "<br /><a href='" . $this->settings['base_url'] . "app=core&amp;module=system&amp;section=taskmanager&amp;do=tasksImportAllApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
         }
         if (count($helpContent)) {
             $_html .= $this->html->warning_box($this->lang->words['cp_helpneedup'], implode($helpContent, "<br />") . "<br /><a href='" . $this->settings['base_url'] . "app=core&amp;module=tools&amp;section=help&amp;do=importXml'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
         }
         if (count($bbContent)) {
             $_html .= $this->html->warning_box($this->lang->words['cp_bbcodeneedup'], implode($bbContent, "<br />") . "<br /><a href='" . $this->settings['base_url'] . "app=core&amp;module=posts&amp;section=bbcode&amp;do=bbcode_import_all'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}.");
         }
         $this->registry->output->html = str_replace('<!--in_dev_check-->', $_html, $this->registry->output->html);
         /* Got notes!? */
         if (is_file(DOC_IPS_ROOT_PATH . '_dev_notes.txt')) {
             /* file retains tabs, file_get_contents not! */
             $_notes = file(DOC_IPS_ROOT_PATH . '_dev_notes.txt');
             if ($_notes) {
                 /* sanitize data and convert tabs! */
                 //$_notes = array_map( 'htmlentities', $_notes );
                 $_notes = implode('', $_notes);
                 $_notes = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $_notes);
                 $_html = $this->registry->output->global_template->warning_box($this->lang->words['cp_devnotes'], nl2br($_notes)) . "<br />";
                 $this->registry->output->html = str_replace('<!--in_dev_notes-->', $_html, $this->registry->output->html);
             }
         }
     }
     //-----------------------------------------
     // Last 5 log in attempts
     //-----------------------------------------
     $this->registry->getClass('class_permissions')->return = true;
     if ($this->registry->getClass('class_permissions')->checkPermission('acplogin_log', 'core', 'logs')) {
         $this->DB->build(array('select' => '*', 'from' => 'admin_login_logs', 'where' => 'admin_success = 0 AND admin_time > 0', 'order' => 'admin_time DESC', 'limit' => array(0, 4)));
         $this->DB->execute();
         while ($rowb = $this->DB->fetch()) {
             $rowb['_admin_time'] = $this->registry->class_localization->getDate($rowb['admin_time'], 'long');
             $logins .= $this->html->acp_last_logins_row($rowb);
         }
         $this->registry->output->html = str_replace('<!--acplogins-->', $this->html->acp_last_logins_wrapper($logins), $this->registry->output->html);
     }
     //-----------------------------------------
     // Pass to CP output hander
     //-----------------------------------------
     $this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
     $this->registry->getClass('output')->sendOutput();
 }
 /**
  * Finish up conversion stuff
  * 
  * @return	@e void
  */
 public function finish()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $skipPms = $options['core'][30001]['skipPms'];
     $output = array();
     /* Emoticons */
     if (file_exists(DOC_IPS_ROOT_PATH . 'style_emoticons/default')) {
         try {
             foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'style_emoticons/default') as $file) {
                 if (!$file->isDot()) {
                     $_name = $file->getFileName();
                     /* Annoyingly, isDot doesn't match .svn, etc */
                     if (substr($_name, 0, 1) == '.') {
                         continue;
                     }
                     if (@copy(DOC_IPS_ROOT_PATH . 'style_emoticons/default/' . $_name, IPS_PUBLIC_PATH . 'style_emoticons/default/' . $_name)) {
                         $output[] = "Смайлики: скопирован {$_name}...";
                     } else {
                         $output[] = "Не удалось скопировать {$_name} - после обновления перенесите его самостоятельно";
                     }
                 }
             }
         } catch (Exception $e) {
         }
     }
     /* LOG IN METHODS */
     $this->DB->build(array('select' => '*', 'from' => 'login_methods'));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $loginMethods[$row['login_folder_name']] = $row;
     }
     $count = 6;
     $recount = array('internal' => 1, 'ipconverge' => 2, 'ldap' => 3, 'external' => 4);
     /* Fetch XML */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPSSetUp::charSet);
     $xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
     foreach ($xml->fetchElements('login_methods') as $xmlelement) {
         $data = $xml->fetchElementsFromRecord($xmlelement);
         $data['login_order'] = isset($recount[$data['login_folder_name']]) ? $recount[$data['login_folder_name']] : ++$count;
         unset($data['login_id']);
         if (!$loginMethods[$data['login_folder_name']]) {
             $this->DB->insert('login_methods', $data);
         } else {
             $this->DB->update('login_methods', array('login_order' => $data['login_order']), 'login_folder_name=\'' . $data['login_folder_name'] . '\'');
         }
     }
     /* Reset member languages and skins */
     $this->DB->update('members', array('language' => IPSLib::getDefaultLanguage(), 'skin' => 0));
     /* Empty caches */
     $this->DB->delete('cache_store', "cs_key='forum_cache'");
     $this->DB->delete('cache_store', "cs_key='skin_id_cache'");
     /* Empty other tables */
     $this->DB->delete('skin_cache');
     $this->DB->delete('skin_templates_cache');
     /* Reset admin permissions */
     $this->DB->update('admin_permission_rows', array('row_perm_cache' => ''));
     /* Drop Tables */
     $this->DB->dropTable('contacts');
     $this->DB->dropTable('skin_macro');
     $this->DB->dropTable('skin_template_links');
     $this->DB->dropTable('skin_templates_old');
     $this->DB->dropTable('skin_sets');
     $this->DB->dropTable('languages');
     $this->DB->dropTable('topics_read');
     $this->DB->dropTable('topic_markers');
     $this->DB->dropTable('acp_help');
     $this->DB->dropTable('members_converge');
     $this->DB->dropTable('member_extra');
     $this->DB->dropTable('custom_bbcode_old');
     $this->DB->dropTable('admin_sessions');
     $this->DB->dropTable('components');
     $this->DB->dropTable('admin_permission_keys');
     $this->DB->dropTable('conf_settings');
     $this->DB->dropTable('conf_settings_titles');
     $this->DB->dropTable('reg_antispam');
     if (!$skipPms) {
         $this->DB->dropTable('message_text');
         $this->DB->dropTable('message_topics_old');
     }
     $message = (is_array($output) and count($output)) ? implode("<br />", $output) . '<br />' : '';
     $this->registry->output->addMessage($message . "очистка SQL завершена...");
     /* Last function, so unset workact */
     $this->request['workact'] = '';
 }
Esempio n. 19
0
 /**
  * Show the redirect screen
  *
  * @param	string	$app_directory
  * @param	string	$output
  * @param	string	$errors
  * @param	string	$next_url
  * @return	@e void
  */
 protected function showRedirectScreen($app_directory, $output, $errors, $next_url)
 {
     /* Init Data */
     $data = IPSSetUp::fetchXmlAppInformation($app_directory, $this->settings['gb_char_set']);
     $_numbers = IPSSetUp::fetchAppVersionNumbers($app_directory);
     /* Grab Data */
     $data['app_directory'] = $app_directory;
     $data['current_version'] = $_numbers['current'][0] ? $_numbers['current'][0] : $this->lang->words['cur_version_none'];
     $data['latest_version'] = $_numbers['latest'][1];
     $data['next_version'] = $_numbers['next'][0];
     /* Setup Redirect */
     $this->registry->output->html .= $this->html->setup_redirectScreen($output, $errors, $next_url);
 }
Esempio n. 20
0
 /**
  * Fetch content 
  *
  * @access	public
  * @param	bool
  * @return	string
  */
 public function fetchContent($check = FALSE)
 {
     /* Output */
     $content = $check === FALSE ? $this->registry->output->template()->page_db() : $this->registry->output->template()->page_dbOverride();
     /* Driver extras? */
     if (is_file(IPS_ROOT_PATH . 'setup/sql/' . IPSSetUp::getSavedData('sql_driver') . '_install.php')) {
         require_once IPS_ROOT_PATH . 'setup/sql/' . IPSSetUp::getSavedData('sql_driver') . '_install.php';
         /*noLibHook*/
         $extra_install = new install_extra($this->registry);
         $content = str_replace('<!--{EXTRA.SQL}-->', $extra_install->install_form_extra(), $content);
     }
     return $content;
 }
 function step_21()
 {
     #$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."posts drop index topic_id;";
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "posts drop index author_id;";
     #$SQL[] = "alter table ".ipsRegistry::dbFunctions()->getPrefix()."posts add index topic_id (topic_id, queued, pid);";
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "posts add index author_id( author_id, topic_id);";
     $SQL[] = "ALTER TABLE " . ipsRegistry::dbFunctions()->getPrefix() . "posts DROP INDEX forum_id, ADD INDEX(post_date);";
     $this->error = array();
     $this->sqlcount = 0;
     $output = "";
     $this->DB->return_die = 1;
     foreach ($SQL as $query) {
         $this->DB->allow_sub_select = 1;
         $this->DB->error = '';
         if (IPSSetUp::getSavedData('man')) {
             $output .= preg_replace("/\\sibf_(\\S+?)([\\s\\.,]|\$)/", " " . $this->DB->obj['sql_tbl_prefix'] . "\\1\\2", preg_replace("/\\s{1,}/", " ", $query)) . "\n\n";
         } else {
             $this->DB->query($query);
             if ($this->DB->error) {
                 $this->registry->output->addError($query . "<br /><br />" . $this->DB->error);
             } else {
                 $this->sqlcount++;
             }
         }
     }
     $this->registry->output->addMessage("Optimization completed");
     $this->request['workact'] = 'step_22';
     if (IPSSetUp::getSavedData('man') and $output) {
         $this->_output = $this->registry->output->template()->upgrade_manual_queries($output);
     }
     unset($this->request['workact']);
     unset($this->request['st']);
 }
Esempio n. 22
0
 /**
  * Log the user out
  *
  * @param	string		Message to show on the form
  * @return	@e void
  */
 public function loginForm($message = '')
 {
     //-----------------------------------------
     // Hang on, do we need the upgrader?
     //-----------------------------------------
     if (!IN_DEV and (!defined('SKIP_UPGRADE_CHECK') or !SKIP_UPGRADE_CHECK)) {
         require_once IPS_ROOT_PATH . 'setup/sources/base/setup.php';
         /*noLibHook*/
         foreach (ipsRegistry::$applications as $app_dir => $app) {
             $_a = ($app_dir == 'forums' or $app_dir == 'members') ? 'core' : $app_dir;
             $numbers = IPSSetUp::fetchAppVersionNumbers($_a);
             if ($numbers['latest'][0] and $numbers['latest'][0] > $numbers['current'][0]) {
                 $this->registry->output->silentRedirect($this->settings['base_acp_url'] . '/upgrade/index.php?_acpRedirect=1');
                 return;
             }
         }
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $message = $message ? $message : $this->member->sessionClass()->getMessage();
     //-------------------------------------------------------
     // Remove all out of date sessions, like a good boy. Woof.
     //-------------------------------------------------------
     $cut_off_stamp = time() - 60 * 60 * 2;
     $this->DB->delete('core_sys_cp_sessions', "session_running_time < {$cut_off_stamp}");
     //------------------------------------------------------
     // Start form
     //------------------------------------------------------
     $qs = str_replace('&amp;', '&', IPSText::parseCleanValue(urldecode(my_getenv('QUERY_STRING'))));
     $qs = str_replace('adsess=', 'old_adsess=', $qs);
     $qs = str_replace('module=menu', '', $qs);
     $additional_data = $this->han_login->additionalFormHTML();
     $replace = false;
     $data = array();
     if (!is_null($additional_data) and is_array($additional_data) and count($additional_data)) {
         $replace = $additional_data[0];
         $data = $additional_data[1];
     }
     $uses_name = false;
     $uses_email = false;
     foreach (ipsRegistry::cache()->getCache('login_methods') as $method) {
         $login_methods[$method['login_folder_name']] = $method['login_folder_name'];
         if ($method['login_user_id'] == 'username' or $method['login_user_id'] == 'either') {
             $uses_name = true;
         }
         if ($method['login_user_id'] == 'email' or $method['login_user_id'] == 'either') {
             $uses_email = true;
         }
     }
     if ($uses_name and $uses_email) {
         $this->lang->words['gl_signinname'] = $this->lang->words['enter_name_and_email'];
     } else {
         if ($uses_email) {
             $this->lang->words['gl_signinname'] = $this->lang->words['enter_useremail'];
         } else {
             $this->lang->words['gl_signinname'] = $this->lang->words['enter_username'];
         }
     }
     ipsRegistry::getClass('output')->html_title = $this->lang->words['ipb_login'];
     ipsRegistry::getClass('output')->html_main = ipsRegistry::getClass('output')->global_template->log_in_form($qs, $message, $replace == 'replace' ? true : false, $data);
     ipsRegistry::getClass('output')->html_main = str_replace('<%TITLE%>', ipsRegistry::getClass('output')->html_title, ipsRegistry::getClass('output')->html_main);
     @header("Content-type: text/html");
     print ipsRegistry::getClass('output')->html_main;
     exit;
 }
 /**
  * Rebuilds language from XML files
  *
  * @return @e void
  */
 public function rebuildFromXml()
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $apps = array();
     $previous = trim($this->request['previous']);
     $type = trim($this->request['type']);
     $id = intval($this->request['id']);
     $_word = $type == 'admin' ? 'admin' : 'public';
     //-----------------------------------------
     // Verify writable
     //-----------------------------------------
     if (!is_writeable(IPS_CACHE_PATH . 'cache/lang_cache/' . $id)) {
         $this->registry->output->global_error = $this->lang->words['cannot_write_to_cache'] ? sprintf($this->lang->words['cannot_write_to_cache'], $id) : "Cannot write to cache/lang_cache/" . $id;
         $this->languagesList();
         return;
     }
     //-----------------------------------------
     // Get setup class
     //-----------------------------------------
     require_once IPS_ROOT_PATH . "setup/sources/base/setup.php";
     /*noLibHook*/
     //-----------------------------------------
     // Get apps
     //-----------------------------------------
     foreach (ipsRegistry::$applications as $appDir => $appData) {
         $apps[] = $appDir;
     }
     //-----------------------------------------
     // Klude for setup class
     //-----------------------------------------
     IPSSetUp::setSavedData('install_apps', implode(',', $apps));
     //-----------------------------------------
     // Get next app
     //-----------------------------------------
     $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']);
     if ($next['key']) {
         $msg = $next['title'] . sprintf($this->lang->words['importing_x_langs'], $_word);
         $_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
         //-----------------------------------------
         // Try to import all the lang packs
         //-----------------------------------------
         try {
             foreach (new DirectoryIterator($_PATH) as $f) {
                 if (preg_match("#" . $_word . "_(.+?)_language_pack.xml#", $f->getFileName())) {
                     $this->request['file_location'] = $_PATH . $f->getFileName();
                     $this->imprtFromXML(1, true, true, $next['key']);
                 }
             }
         } catch (Exception $e) {
         }
         //-----------------------------------------
         // Off to next setp
         //-----------------------------------------
         $this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&amp;id={$id}&amp;type={$type}&amp;previous=" . $next['key'], $msg . '<br>' . $this->registry->output->global_message);
         $this->registry->output->global_message = '';
         return;
     } else {
         if ($type == 'public') {
             //-----------------------------------------
             // Onto admin languages
             //-----------------------------------------
             $this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&amp;id={$id}&amp;type=admin", $this->lang->words['starting_admin_import']);
             return;
         } else {
             //-----------------------------------------
             // And we're done
             //-----------------------------------------
             $this->registry->output->redirect($this->settings['base_url'] . $this->form_code, $this->lang->words['lang_reimport_done']);
         }
     }
 }
Esempio n. 24
0
 /**
  * Thaw Data
  *
  * @access	public
  * @param	string		Raw data for thawing
  * @return	@e void
  */
 static function thawSavedData($data = '')
 {
     if (!$data) {
         /* Check cache file first */
         $data = self::_readFreezerCache();
         /* Nothing? Try post data */
         if (!$data) {
             $data = $_POST['_sd'];
         }
     }
     self::$_savedData = json_decode(base64_decode($data), TRUE);
 }
 /**
  * Upgrade log file tables
  * 
  * @param	int
  * @return	@e void
  */
 public function upgradeLogs($id = 1)
 {
     /* Verify posts alter table query has run */
     if ($id == 1) {
         if (!$this->DB->checkForField('post_bwoptions', 'posts')) {
             $this->_output = ' ';
             $this->registry->output->addError("Вы должны выполнить запрос изменяющий таблицу posts.  После того как вы выполните это, просто обновите данную страницу и обновление будет продолжено.");
             return;
         }
     }
     $cnt = 0;
     $file = '_updates_logs_' . $id . '.php';
     $output = "";
     $path = IPSLib::getAppDir('core') . '/setup/versions/upg_32000/' . strtolower($this->registry->dbFunctions()->getDriverType()) . $file;
     $prefix = $this->registry->dbFunctions()->getPrefix();
     if (is_file($path)) {
         $SQL = array();
         $TABLE = '';
         require $path;
         /*noLibHook*/
         /* Set DB driver to return any errors */
         $this->DB->return_die = 1;
         foreach ($SQL as $query) {
             $this->DB->allow_sub_select = 1;
             $this->DB->error = '';
             /* Need to tack on a prefix? */
             if ($prefix) {
                 $query = IPSSetUp::addPrefixToQuery($query, $prefix);
             }
             /* Chose to prune and run? */
             if ($this->request['pruneAndRun']) {
                 $this->DB->delete($TABLE);
                 $man = false;
             } else {
                 /* Show alter table / prune option? */
                 $man = IPSSetUp::getSavedData('man');
                 if ($TABLE) {
                     $count = $this->DB->buildAndFetch(array('select' => 'count(*) as logs', 'from' => $TABLE));
                     if ($count['logs'] > 100000) {
                         $man = true;
                     }
                 }
             }
             /* Show option to run manually or prune ? */
             if ($man) {
                 $query = trim($query);
                 /* Ensure the last character is a semi-colon */
                 if (substr($query, -1) != ';') {
                     $query .= ';';
                 }
                 $output .= $query . "\n\n";
             } else {
                 $this->DB->query($query);
                 if ($this->DB->error) {
                     $this->registry->output->addError("<br />" . $query . "<br />" . $this->DB->error);
                 } else {
                     $cnt++;
                 }
             }
         }
         $this->registry->output->addMessage("{$cnt} запросов выполнено....");
     }
     /* Next Page */
     if ($id < 10) {
         $nextid = $id + 1;
         $this->request['workact'] = 'logs' . $nextid;
     } else {
         $this->request['workact'] = 'forums';
     }
     if ($output) {
         $this->_output = $this->registry->output->template()->upgrade_manual_queries_logs($output, $id, $TABLE);
     }
 }
Esempio n. 26
0
 function convert_polls()
 {
     $start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
     $lend = 50;
     $end = $start + $lend;
     $max = intval(IPSSetUp::getSavedData('max'));
     $converted = intval(IPSSetUp::getSavedData('conv'));
     //-----------------------------------------
     // First off.. grab number of polls to convert
     //-----------------------------------------
     if (!$max) {
         $total = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as max', 'from' => 'topics', 'where' => "poll_state IN ('open', 'close', 'closed')"));
         $max = $total['max'];
     }
     //-----------------------------------------
     // In steps...
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'topics', 'where' => "poll_state IN ('open', 'close', 'closed' )", 'limit' => array(0, $lend)));
     $o = $this->DB->execute();
     //-----------------------------------------
     // Do it...
     //-----------------------------------------
     if ($this->DB->getTotalRows($o)) {
         //-----------------------------------------
         // Got some to convert!
         //-----------------------------------------
         while ($r = $this->DB->fetch($o)) {
             $converted++;
             //-----------------------------------------
             // All done?
             //-----------------------------------------
             if ($converted >= $max) {
                 $done = 1;
             }
             $new_poll = array(1 => array());
             $poll_data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'polls', 'where' => "tid=" . $r['tid']));
             if (!$poll_data['pid']) {
                 continue;
             }
             if (!$poll_data['poll_question']) {
                 $poll_data['poll_question'] = $r['title'];
             }
             //-----------------------------------------
             // Kick start new poll
             //-----------------------------------------
             $new_poll[1]['question'] = $poll_data['poll_question'];
             //-----------------------------------------
             // Get OLD polls
             //-----------------------------------------
             $poll_answers = unserialize(stripslashes($poll_data['choices']));
             reset($poll_answers);
             foreach ($poll_answers as $entry) {
                 $id = $entry[0];
                 $choice = $entry[1];
                 $votes = $entry[2];
                 $total_votes += $votes;
                 if (strlen($choice) < 1) {
                     continue;
                 }
                 $new_poll[1]['choice'][$id] = $choice;
                 $new_poll[1]['votes'][$id] = $votes;
             }
             //-----------------------------------------
             // Got something?
             //-----------------------------------------
             if (count($new_poll[1]['choice'])) {
                 $this->DB->update('polls', array('choices' => serialize($new_poll)), 'tid=' . $r['tid']);
                 $this->DB->update('topics', array('poll_state' => 1), 'tid=' . $r['tid']);
             }
         }
     } else {
         $done = 1;
     }
     if (!$done) {
         $this->registry->output->addMessage("Polls: {$start} to {$end} completed....");
         $this->request['workact'] = 'polls';
         $this->request['st'] = $end;
         IPSSetUp::setSavedData('max', $max);
         IPSSetUp::setSavedData('conv', $converted);
         return FALSE;
     } else {
         $this->registry->output->addMessage("Polls converted, proceeding to calendar events...");
         $this->request['workact'] = 'calevents';
         $this->request['st'] = '0';
         return FALSE;
     }
 }
Esempio n. 27
0
 /**
  * Get application versions
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function _getAppVersions()
 {
     /* Init vars */
     $i = intval($this->request['i']);
     $app = trim($this->request['chosenApp']);
     $versions = array();
     /* Load setup library & get versions */
     require_once IPS_ROOT_PATH . 'setup/sources/base/setup.php';
     /*noLibHook*/
     $_versions = IPSSetUp::fetchXmlAppVersions($app);
     krsort($_versions);
     /* Setup our default 'no version' value */
     $versions[] = array(0, $this->lang->words['h_any_version']);
     foreach ($_versions as $long => $human) {
         if ($long < 30000 && in_array($app, array('core', 'forums', 'members'))) {
             continue;
         }
         $versions[] = array($long, $human);
     }
     /* Return data ;o */
     $minVersions = $this->registry->output->formDropdown("minVersion[{$i}]", $versions);
     $maxVersions = $this->registry->output->formDropdown("maxVersion[{$i}]", $versions);
     $this->returnHtml("{$this->lang->words['a_min']}: {$minVersions}<br /><br />{$this->lang->words['a_max']}: {$maxVersions}");
 }
Esempio n. 28
0
//-----------------------------------------
// Set Configuration
//-----------------------------------------
IPSSetUp::setSavedData('install_apps', $_SERVER['argv'][1]);
IPSSetUp::setSavedData('install_dir', $_SERVER['argv'][2]);
IPSSetUp::setSavedData('install_url', $_SERVER['argv'][3]);
IPSSetUp::setSavedData('lkey', $_SERVER['argv'][4]);
IPSSetUp::setSavedData('sql_driver', 'mysql');
IPSSetUp::setSavedData('db_host', $_SERVER['argv'][5]);
IPSSetUp::setSavedData('db_name', $_SERVER['argv'][6]);
IPSSetUp::setSavedData('db_user', $_SERVER['argv'][7]);
IPSSetUp::setSavedData('db_pass', $_SERVER['argv'][8]);
IPSSetUp::setSavedData('db_pre', '');
IPSSetUp::setSavedData('admin_user', $_SERVER['argv'][9]);
IPSSetUp::setSavedData('admin_pass', $_SERVER['argv'][10]);
IPSSetUp::setSavedData('admin_email', $_SERVER['argv'][11]);
/* Write it */
IPSInstall::writeConfiguration();
//-----------------------------------------
// Install
//-----------------------------------------
file_get_contents("http://license.invisionpower.com/?a=activate&key={$_SERVER['argv'][4]}&url={$_SERVER['argv'][3]}");
file_put_contents("../../../cache/installer_lock.php", "AUTOINSTALLED");
require_once IPS_ROOT_PATH . 'setup/applications/install/sections/install.php';
/*noLibHook*/
$controller = new install_install();
$output = new CLIOutput($steps, $controller);
$registry->setClass('output', $output);
$controller->makeRegistryShortcuts($registry);
$output->setNextAction('do=sql');
$output->sendOutput();
 public function get()
 {
     /* INIT */
     $entries = array();
     /* FURL cache OOD? */
     if (is_file(FURL_CACHE_PATH)) {
         $mtime = intval(@filemtime(FURL_CACHE_PATH));
         /* Check mtimes on extensions.. */
         foreach (ipsRegistry::$applications as $app_dir => $application) {
             if (is_file(IPSLib::getAppDir($app_dir) . '/extensions/furlTemplates.php')) {
                 $_mtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/extensions/furlTemplates.php'));
                 if ($_mtime > $mtime) {
                     $entries[] = array($this->lang->words['furlcache_outofdate'], sprintf($this->lang->words['furlcache_outofdate_desc'], $application['app_title']) . "<a href='" . $this->settings['base_url'] . "app=core&amp;module=applications&amp;section=applications&amp;do=seoRebuild'>{$this->lang->words['rebuild_furl_cache']}</a>");
                     break;
                 }
             }
         }
     }
     /* Sphinx cache OOD? */
     if ($this->settings['search_method'] == 'sphinx') {
         $mtime = intval($this->cache->getCache('sphinx_config'));
         /* Check mtimes on extensions.. */
         foreach (ipsRegistry::$applications as $app_dir => $application) {
             if (is_file(IPSLib::getAppDir($app_dir) . '/extensions/sphinxTemplate.php')) {
                 $_mtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/extensions/sphinxTemplate.php'));
                 if (!$mtime or $_mtime > $mtime) {
                     $entries[] = array($this->lang->words['sphinxconfig_outofdate'], $this->lang->words['sphinxconfig_outofdate_desc'] . ' ' . "<a href='" . $this->settings['base_url'] . "app=core&amp;module=applications&amp;section=applications&amp;do=applications_overview'>{$this->lang->words['rebuild_sphinx_config']}</a>");
                     break;
                 }
             }
         }
     }
     /* Minify on but /cache/tmp not writeable? */
     if (!empty($this->settings['_use_minify'])) {
         $entries[] = array($this->lang->words['minifywrite_head'], $this->lang->words['minifynot_writeable']);
     }
     /* Installer Check */
     if (@is_file(IPS_ROOT_PATH . 'install/index.php')) {
         if (!@is_file(DOC_IPS_ROOT_PATH . 'cache/installer_lock.php')) {
             $this->lang->words['cp_unlocked_warning'] = sprintf($this->lang->words['cp_unlocked_warning'], CP_DIRECTORY);
             $entries[] = array($this->lang->words['cp_unlockedinstaller'], $this->lang->words['cp_unlocked_warning']);
         }
     }
     /* Unfinished Upgrade */
     require_once IPS_ROOT_PATH . '/setup/sources/base/setup.php';
     /*noLibHook*/
     $versions = IPSSetUp::fetchAppVersionNumbers('core');
     if ($versions['current'][0] != $versions['latest'][0]) {
         $this->lang->words['cp_upgrade_warning'] = sprintf($this->lang->words['cp_upgrade_warning'], $versions['current'][1], $versions['latest'][1], $this->settings['base_acp_url']);
         $entries[] = array($this->lang->words['cp_unfinishedupgrade'], $this->lang->words['cp_upgrade_warning']);
     }
     /**
      * PHP Version Check
      * 
      * @todo	Remove this for 4.0? Installer/upgrader already do check for this anyway...
      */
     if (PHP_VERSION < '5.2.0') {
         $entries[] = array(sprintf($this->lang->words['cp_yourphpversion'], PHP_VERSION), $this->lang->words['cp_php_warning']);
     }
     /* Outgoing email address specified */
     if (!$this->settings['email_out'] or !$this->settings['email_in']) {
         $entries[] = array($this->lang->words['cp_missingemail'], "{$this->lang->words['cp_missingemail1']}<br /><br />{$this->lang->words['_raquo']} <a href='" . $this->settings['base_url'] . "&amp;module=settings&amp;section=settings&amp;do=findsetting&amp;key=email'>{$this->lang->words['cp_missingemail2']}</a>");
     }
     /* Board Offline Check */
     if ($this->settings['board_offline']) {
         $entries[] = array($this->lang->words['cp_boardoffline'], "{$this->lang->words['cp_boardoffline1']}<br /><br />{$this->lang->words['_raquo']} <a href='" . $this->settings['base_url'] . "&amp;module=settings&amp;section=settings&amp;do=findsetting&amp;key=boardoffline'>{$this->lang->words['cp_boardoffline2']}</a>");
     }
     /* Fulltext Check */
     if ($this->settings['search_method'] == 'traditional' and !$this->settings['use_fulltext'] and !$this->settings['hide_ftext_note']) {
         $entries[] = array($this->lang->words['fulltext_off'], "{$this->lang->words['fulltext_turnon']}<br /><br />{$this->lang->words['_raquo']} <a href='" . $this->settings['base_url'] . "&amp;module=settings&amp;section=settings&amp;do=findsetting&amp;key=searchsetup'>{$this->lang->words['fulltext_find']}</a>");
     }
     /* Make sure the profile directory is writable */
     if (!is_dir($this->settings['upload_dir'] . '/profile/') || !is_writable($this->settings['upload_dir'] . '/profile/')) {
         $entries[] = array($this->lang->words['cp_profilephotoerr_title'], sprintf($this->lang->words['cp_profilephotoerr_msg'], $this->settings['upload_dir'] . '/profile/'));
     }
     /* Check for upgrade finish folder */
     if (is_dir(IPS_ROOT_PATH . 'upgradeFinish/')) {
         $entries[] = array($this->lang->words['cp_upgradefinishfolder'], sprintf($this->lang->words['cp_upgradefinishfolder_msg'], IPS_ROOT_PATH . 'upgradeFinish/'));
     }
     /* Check to see if GD is intalled */
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         $entries[] = array($this->lang->words['cp_gdnotinstalled_title'], $this->lang->words['cp_gdnotinstalled_msg']);
     }
     /* Performance mode check */
     $perfMode = $this->cache->getCache('performanceCache');
     if (is_array($perfMode) && count($perfMode)) {
         $entries[] = array($this->lang->words['cp_perfmodeon_title'], $this->lang->words['cp_perfmodeon_msg']);
     }
     /* Suhosin check */
     if (extension_loaded('suhosin')) {
         $_postMaxVars = @ini_get('suhosin.post.max_vars');
         $_reqMaxVars = @ini_get('suhosin.request.max_vars');
         $_getMaxLen = @ini_get('suhosin.get.max_value_length');
         $_postMaxLen = @ini_get('suhosin.post.max_value_length');
         $_reqMaxLen = @ini_get('suhosin.request.max_value_length');
         $_reqMaxVar = @ini_get('suhosin.request.max_varname_length');
         if ($_postMaxVars < 4096) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue1'], $_postMaxVars));
         }
         if ($_reqMaxVars < 4096) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue2'], $_reqMaxVars));
         }
         if ($_getMaxLen < 2000) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue6'], $_getMaxLen));
         }
         if ($_postMaxLen < 1000000) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue3'], $_postMaxLen));
         }
         if ($_reqMaxLen < 1000000) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue4'], $_reqMaxLen));
         }
         if ($_reqMaxVar < 350) {
             $entries[] = array($this->lang->words['suhosin_notification'], sprintf($this->lang->words['suhosin_badvalue5'], $_reqMaxVar));
         }
     }
     /* SQL error check */
     /*if ( is_file( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' ) )
     		{
     			$unix = @filemtime( IPS_CACHE_PATH . 'cache/sql_error_latest.cgi' );
     			
     			if ( $unix )
     			{
     				$mtime = gmdate( 'd-j-Y', $unix );
     				$now   = gmdate( 'd-j-Y', time() );
     				
     				if ( $mtime == $now )
     				{
     					// Display a message
     				}
     			}
     		}*/
     return $entries;
 }
Esempio n. 30
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Check input? */
     if ($this->request['do'] == 'check') {
         /* Check Directory */
         if (!is_array($_POST['apps']) or !count($_POST['apps'])) {
             $this->registry->output->addError('You must select to install at least one application');
         } else {
             /* Save Form Data */
             IPSSetUp::setSavedData('install_apps', implode(',', array_keys($_POST['apps'])));
             /* Check writeable files */
             foreach (array_keys($_POST['apps']) as $appDir) {
                 $info = IPSSetUp::fetchXmlAppWriteableFiles($appDir);
                 if (count($info['notexist'])) {
                     foreach ($info['notexist'] as $path) {
                         $this->registry->output->addWarning('File or directory does not exist: "' . $path . '", please create it via FTP');
                     }
                 }
                 if (count($info['notwrite'])) {
                     foreach ($info['notwrite'] as $path) {
                         $this->registry->output->addWarning('File or directory is not writeable: "' . $path . '", please CHMOD via FTP');
                     }
                 }
                 /**
                  * Custom errors
                  */
                 if (count($info['other'])) {
                     foreach ($info['other'] as $error) {
                         $this->registry->output->addWarning($error);
                     }
                 }
             }
             /* Do we have errors? */
             if (!count($this->registry->output->fetchWarnings())) {
                 /* Next Action */
                 $this->registry->autoLoadNextAction('address');
             }
         }
     }
     /* Generate apps... */
     $apps = array('core' => array(), 'ips' => array(), 'other' => array());
     foreach (array('applications', 'applications_addon/ips', 'applications_addon/other') as $_pBit) {
         $path = IPS_ROOT_PATH . $_pBit;
         $handle = opendir($path);
         while (($file = readdir($handle)) !== FALSE) {
             if (!preg_match("#^\\.#", $file)) {
                 if (is_dir($path . '/' . $file)) {
                     //-----------------------------------------
                     // Get it!
                     //-----------------------------------------
                     if (!is_file(IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml')) {
                         continue;
                     }
                     $data = IPSSetUp::fetchXmlAppInformation($file, $this->settings['gb_char_set']);
                     switch ($_pBit) {
                         case 'applications':
                             $apps['core'][$file] = $data;
                             break;
                         case 'applications_addon/ips':
                             $apps['ips'][$file] = $data;
                             break;
                         case 'applications_addon/other':
                             $apps['other'][$file] = $data;
                             break;
                     }
                 }
             }
         }
         closedir($handle);
     }
     /* We don't want IP.SEO to be installed on future versions. Bad things happen. */
     unset($apps['ips']['ipseo']);
     unset($apps['other']['ipseo']);
     /* Reorder the array so that core is first */
     $new_array = array();
     $new_array['core'] = $apps['core']['core'];
     foreach ($apps['core'] as $app => $data) {
         if ($app == 'core') {
             continue;
         }
         $new_array[$app] = $data;
     }
     $apps['core'] = $new_array;
     /* Page Output */
     $this->registry->output->setTitle("Applications");
     $this->registry->output->setNextAction('apps&do=check');
     $this->registry->output->addContent($this->registry->output->template()->page_apps($apps));
     $this->registry->output->sendOutput();
 }