예제 #1
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 > Chat > Tools to convert the ignored users.";
     }
     return $notices;
 }
예제 #2
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;
 }
예제 #3
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'];
 }
예제 #4
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();
 }
예제 #5
0
 /**
  * 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);
     }
 }
예제 #6
0
 function upgrade_sql($id = 1)
 {
     $man = 0;
     // Manual upgrade ? intval( $this->request['man'] );
     $cnt = 0;
     $SQL = array();
     $file = '_updates_' . $id . '.php';
     $output = "";
     $path = IPSLib::getAppDir('core') . '/setup/versions/upg_22005/' . strtolower($this->registry->dbFunctions()->getDriverType()) . $file;
     $prefix = $this->registry->dbFunctions()->getPrefix();
     if (is_file($path)) {
         require_once $path;
         /*noLibHook*/
         $this->sqlcount = 0;
         $output = "";
         $this->DB->return_die = 1;
         foreach ($SQL as $query) {
             $this->DB->allow_sub_select = 1;
             $this->DB->error = '';
             $query = str_replace("<%time%>", time(), $query);
             if ($this->settings['mysql_tbl_type']) {
                 if (preg_match("/^create table(.+?)/i", $query)) {
                     $query = preg_replace("/^(.+?)\\);\$/is", "\\1) ENGINE={$this->settings['mysql_tbl_type']};", $query);
                 }
             }
             /* Need to tack on a prefix? */
             if ($prefix) {
                 $query = IPSSetUp::addPrefixToQuery($query, $prefix);
             }
             if (IPSSetUp::getSavedData('man')) {
                 $output .= 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("{$this->sqlcount} запросов выполнено....");
     }
     //--------------------------------
     // Next page...
     //--------------------------------
     $this->request['st'] = 0;
     if ($id != 4) {
         $nextid = $id + 1;
         $this->request['workact'] = 'sql' . $nextid;
     } else {
         $this->request['workact'] = 'forums';
     }
     if (IPSSetUp::getSavedData('man') and $output) {
         /* Create source file */
         if ($this->registry->dbFunctions()->getDriverType() == 'mysql') {
             $sourceFile = IPSSetUp::createSqlSourceFile($output, '22005', $id);
         }
         $this->_output = $this->registry->output->template()->upgrade_manual_queries($output, $sourceFile);
     }
 }
예제 #7
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;
     }
 }
예제 #8
0
 /**
  * Clean up conf global
  * Removes data variables
  *
  * @access	public
  * @return 	boolean
  */
 public static function cleanConfGlobal()
 {
     if ($contents = @file_get_contents(IPSSetUp::getSavedData('install_dir') . '/conf_global.php')) {
         if ($contents) {
             $contents = preg_replace("#/\\*~~DATA~~\\*/(.+?)\n/\\*\\*/#s", "", $contents);
             return IPSSetUp::writeFile(IPSSetUp::getSavedData('install_dir') . '/conf_global.php', $contents);
         }
     }
     return FALSE;
 }
예제 #9
0
 /**
  * Return any post-installation notices
  * 
  * @return	array	 Array of notices
  */
 public function postInstallNotices()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $_doSkin = $options['core'][30001]['exportSkins'];
     $_doLang = $options['core'][30001]['exportLangs'];
     $rootAdmins = $options['core'][30001]['rootAdmins'];
     $skipPms = $options['core'][30001]['skipPms'];
     $notices = array();
     if ($_doSkin) {
         $notices[] = "Все старые стили сохранены в 'cache/previousSkinFiles'";
     }
     if ($_doLang) {
         $notices[] = "Все старые языки сохранены в 'cache/previousLangFiles'";
     }
     if ($skipPms) {
         $notices[] = "Конвертация личных сообщений пропущена. Для конвертации личных сообщений в будущем воспользуйтесь shell-скриптом из директории 'tools' дистрибутива";
     }
     /* Notice about post content */
     $notices[] = "Теперь вам необходимо обновить содержимое всех сообщений через админцентр (Система &gt; Пересчет и обновление). <br />";
     /* Notice about admin restrictions */
     $notices[] = "Из-за изменений в системе прав доступа. Все администраторы, имевшие ограничения, будут лишены доступа ко всем модулям, пока вы не измените права.";
     /* Notice about admin restrictions */
     if ($rootAdmins) {
         $notices[] = "Были сброшены все ограничения для доступа в админцентр Вы можете восстановить их через АЦ.<br />";
     } else {
         $notices[] = "Все администраторы получили полный доступ к админцентру. Вы можете ограничить их доступ через АЦ.<br />";
     }
     /* Notice about custom time settings */
     $notices[] = "Формат показа времени изменен в настройках.<br />";
     /* Notice about FURLs */
     $notices[] = "Для использования Friendly URLs (ЧПУ), добавьте в ваш conf_global.php строчку: \$INFO['use_friendly_urls'] = '1';.";
     return $notices;
 }
예제 #10
0
파일: apps.php 프로젝트: mover5/imobackup
 /**
  * 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();
 }
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* 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);
                 $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 (file_exists(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                             $_class = 'version_class_' . $num;
                             require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                             $_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('upgrade');
     } else {
         if ($this->request['do'] == 'check') {
             /* Check Directory */
             if (!is_array($_POST['apps']) or !count($_POST['apps'])) {
                 $this->registry->output->addError('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;
                     $_POST['apps']['portal'] = 1;
                     //$_POST['apps']['subscriptions'] = 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);
                     $appClasses[$app] = IPSSetUp::fetchVersionClasses($app, $numbers['current'][0], $numbers['latest'][0]);
                 }
                 /* Got anything? */
                 if (count($appClasses)) {
                     foreach ($appClasses as $app => $data) {
                         foreach ($data as $num) {
                             if (file_exists(IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php')) {
                                 $_class = 'version_class_' . $num;
                                 require_once IPSLib::getAppDir($app) . '/setup/versions/upg_' . $num . '/version_class.php';
                                 $_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)) {
                     $this->registry->output->setTitle("Applications");
                     $this->registry->output->setNextAction('apps&do=save');
                     //$this->registry->output->setHideButton( TRUE );
                     $this->registry->output->addContent($this->registry->output->template()->upgrade_appsOptions($output));
                     $this->registry->output->sendOutput();
                 } else {
                     /* Next Action */
                     $this->registry->autoLoadNextAction('upgrade');
                 }
             }
         }
     }
     /* 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 (!file_exists(IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml')) {
                         continue;
                     }
                     $data = IPSSetUp::fetchXmlAppInformation($file);
                     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);
             $apps[$type][$app]['_vnumbers'] = $numbers;
         }
     }
     /* 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']);
         unset($apps['ips']['portal']);
         unset($apps['other']['subscriptions']);
     }
     /* 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));
     $this->registry->output->sendOutput();
 }
예제 #12
0
 /**
  * Fetch next application
  *
  * @access	public
  * @param	string		Previous application
  * @param	string		XML file to search for. If supplied, function will return next app that has the XML file. Use {app} for $app ({app}_settings.xml)
  * @param	string		Charset (used post-install)
  * @return	mixed
  */
 public static function fetchNextApplication($previous = '', $xmlFileSearch = '', $charset = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $apps = explode(",", IPSSetUp::getSavedData('install_apps'));
     $return = FALSE;
     $flag = $previous ? 0 : 1;
     $array = array();
     if (!count($apps) or !count($apps)) {
         return FALSE;
     }
     foreach ($apps as $_app) {
         # Looking for an XML file?
         if ($xmlFileSearch) {
             $_xmlFileSearch = str_replace('{app}', $_app, $xmlFileSearch);
             if (!is_file(IPSLib::getAppDir($_app) . '/xml/' . $_xmlFileSearch)) {
                 continue;
             }
         }
         # Flag raised? Grab it!
         if ($flag) {
             $return = $_app;
             break;
         }
         # Got this one? Set the flag
         if ($_app == $previous) {
             $flag = 1;
         }
     }
     //-----------------------------------------
     // Got something?
     //-----------------------------------------
     if ($return) {
         $result = self::fetchXmlAppInformation($return, $charset);
         if ($result) {
             return $result;
         } else {
             return self::fetchNextApplication($return, $xmlFileSearch, $charset);
         }
     }
     return FALSE;
 }
 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']);
 }
예제 #14
0
 /**
  * Set up DB driver
  *
  * @access	private
  * @param	bool		Whether the DB driver returns with an error or not
  * @return	@e void
  */
 private function _setUpDBDriver($returnDie = TRUE)
 {
     $extra_install = '';
     //--------------------------------------------------
     // Any "extra" configs required for this driver?
     //--------------------------------------------------
     if (is_file(IPS_ROOT_PATH . 'setup/sql/' . strtolower(IPSSetUp::getSavedData('sql_driver')) . '_install.php')) {
         require_once IPS_ROOT_PATH . 'setup/sql/' . strtolower(IPSSetUp::getSavedData('sql_driver')) . '_install.php';
         /*noLibHook*/
         $extra_install = new install_extra($this->registry);
     }
     //-----------------------------------------
     // Set DB Handle
     //-----------------------------------------
     $this->registry->loadConfGlobal();
     $this->registry->setDBHandle();
     $this->DB = $this->registry->DB();
     /* Return error? */
     if ($returnDie === TRUE) {
         $this->DB->return_die = 1;
     }
     return $extra_install;
 }
<?php

/*
 * Returns known settings
 *
 * No, really it does!
 *
 * Remember: ipsRegistry::$settings probably won't be available.
 *
 *
 * IPSSetUp::getSavedData('admin_email')
 * IPSSetUp::getSavedData('install_dir')   [Example: /home/user/public_html/forums] - No trailing slash supplied
 * IPSSetUp::getSavedData('install_url')   [Example: http://www.domain.tld/forums]  - No trailing slash supplied
 */
$knownSettings = array('email_in' => IPSSetUp::getSavedData('admin_email'), 'email_out' => IPSSetUp::getSavedData('admin_email'), 'base_dir' => IPSSetUp::getSavedData('install_dir'), 'css_cache_url' => IPSSetUp::getSavedData('install_url') . '/public/style_images', 'upload_url' => IPSSetUp::getSavedData('install_url') . '/uploads', 'upload_dir' => IPSSetUp::getSavedData('install_dir') . '/uploads', 'search_sql_method' => ipsRegistry::DB()->checkFulltextSupport() ? 'ftext' : 'man', 'safe_mode_skins' => @ini_get("safe_mode") ? 1 : 0);
 /**
  * Return any post-installation notices
  * 
  * @return	array	 Array of notices
  */
 public function postInstallNotices()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $_doSkin = $options['core'][30001]['exportSkins'];
     $_doLang = $options['core'][30001]['exportLangs'];
     $rootAdmins = $options['core'][30001]['rootAdmins'];
     $skipPms = $options['core'][30001]['skipPms'];
     $notices = array();
     if ($_doSkin) {
         $notices[] = "All previous skins have been exported into 'cache/previousSkinFiles'";
     }
     if ($_doLang) {
         $notices[] = "All previous language files have been exported into 'cache/previousLangFiles'";
     }
     if ($skipPms) {
         $notices[] = "PM Conversion was skipped. If you want to convert PMs, please use the provided shell tool found in your 'tools' directory of the download";
     }
     /* Notice about post content */
     $notices[] = "You should now log into your Admin CP and rebuild post content (System &gt; Recount &amp; Rebuild)";
     /* Notice about admin restrictions */
     $notices[] = "Due to the change in permission systems, any admins that had restrictions have been updated to have no access to any module until you edit them.";
     /* Notice about admin restrictions */
     if ($rootAdmins) {
         $notices[] = "Due to the change in permission systems, 'Root Admins' and 'Administrators' both have full access to the ACP including SQL toolbox, etc. You chose to remove all ACP permissions on upgrade. You can restore selective permissions via the ACP.";
     } else {
         $notices[] = "Due to the change in permission systems, 'Root Admins' and 'Administrators' both have full access to the ACP including SQL toolbox, etc. You can restrict individual admins using the ACP permission system.";
     }
     /* Notice about custom time settings */
     $notices[] = "Due to the change in how times are shown, all custom time/clock formats have been reset.";
     /* Notice about FURLs */
     $notices[] = "If you wish to use Friendly URLs, you will need to edit your conf_global.php file and add: \$INFO['use_friendly_urls'] = '1';. Once this is done run also the tool in \"ACP -> System TAB -> Recount &amp; Rebuild -> Resynchronize Forums\".";
     return $notices;
 }
예제 #17
0
 /**
  * Execute selected method
  *
  * @param	object		Registry object
  * @return	@e void
  */
 public function banUpdate()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $flagBanned = $options['core'][33000]['flagBanned'];
     if ($flagBanned) {
         if (!empty(ipsRegistry::$settings['banned_group'])) {
             $this->DB->update('members', array('member_banned' => 1), "member_group_id=" . intval(ipsRegistry::$settings['banned_group']));
         }
     }
     $this->registry->output->addMessage("Banned members updated");
     $this->request['workact'] = '';
 }
예제 #18
0
    /**
     * Show the DB override page
     *
     * @access	public
     * @return	string		HTML
     */
    public function page_dbOverride()
    {
        $IPBHTML = "";
        //--starthtml--//
        $url = IPSSetUp::getSavedData('install_url');
        $IPBHTML .= <<<EOF
\t<div class='message'>
         В базе данных (<em>{$this->request['db_name']}</em>) уже есть таблицы с таким же префиксом (<em>{$this->request['db_pre']}</em>).
\t\t<br />Вы можете перезаписать существующие таблицы или вы можете выбрать другую базу данных или префикс.
\t\t<br /><span style='font-weight:bold'>Может быть</span> вы хотели запустить <a class='color:gray' href='{$url}/admin/upgrade/index.php'>обновление</a> ?
\t</div>
\t<br />
\t<fieldset>
\t\t<legend>Перезапись таблиц</legend>
\t\t<table style='width: 100%; border: 0px; padding:0px' cellspacing='0'>
\t\t\t<tr>
               <td width='70%' class='title'>Перезаписать существующие в базе данных таблицы</td>
               <td width='30%' class='content'><input type='checkbox' class='sql_form' value='1' name='overwrite' ></td>
           </tr>
\t\t</table>
\t</fieldset>
\t<br />
\t<fieldset>
\t\t<legend>Изменить данные базы данных</legend>
\t\t<table style='width: 100%; border: 0px; padding:0px' cellspacing='0'>
\t\t\t<tr>
\t               <td width='30%' class='title'>Хост SQL:</td>
\t               <td width='70%' class='content'>
\t               \t<input type='text' class='sql_form' value='{$this->request['db_host']}' name='db_host'>
\t               </td>
\t           </tr>
\t\t\t<tr>
\t           <td class='title'>Название базы данных:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_name' value='{$this->request['db_name']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>Имя пользователя:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_user' value='{$this->request['db_user']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>Пароль:</td>
               <td class='content'>
               \t<input type='password' class='sql_form' name='db_pass' value='{$_REQUEST['db_pass']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>Префикс таблиц:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_pre' value='{$this->request['db_pre']}'>
               </td>
           </tr>
        <!--{EXTRA.SQL}-->
\t\t</table>
\t</fieldset>
EOF;
        return $IPBHTML;
    }
예제 #19
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;
 }
예제 #20
0
    /**
     * Show the DB override page
     *
     * @access	public
     * @return	string		HTML
     */
    public function page_dbOverride()
    {
        $IPBHTML = "";
        //--starthtml--//
        $url = IPSSetUp::getSavedData('install_url');
        $IPBHTML .= <<<EOF
\t<div class='message'>
\t\t The database (<em>{$this->request['db_name']}</em>) you are attempting to install into has existing tables using the same prefix (<em>{$this->request['db_pre']}</em>).
\t\t<br />You can either select to overwrite or choose a new database or table prefix.
\t\t<br /><span style='font-weight:bold'>Or</span> did you mean to <a class='color:gray' href='{$url}/admin/upgrade/index.php'>upgrade</a>
\t</div>
\t<br />
\t<fieldset>
\t\t<legend>Database Override</legend>
\t\t<table style='width: 100%; border: 0px; padding:0px' cellspacing='0'>
\t\t\t<tr>
               <td width='70%' class='title'>Overwrite current database with new installation</td>
               <td width='30%' class='content'><input type='checkbox' class='sql_form' value='1' name='overwrite' ></td>
           </tr>
\t\t</table>
\t</fieldset>
\t<br />
\t<fieldset>
\t\t<legend>Or Modify Your Database Details</legend>
\t\t<table style='width: 100%; border: 0px; padding:0px' cellspacing='0'>
\t\t\t<tr>
\t               <td width='30%' class='title'>SQL Host:</td>
\t               <td width='70%' class='content'>
\t               \t<input type='text' class='sql_form' value='{$this->request['db_host']}' name='db_host'>
\t               </td>
\t           </tr>
\t\t\t<tr>
\t           <td class='title'>Database Name:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_name' value='{$this->request['db_name']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>SQL Username:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_user' value='{$this->request['db_user']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>SQL Password:</td>
               <td class='content'>
               \t<input type='password' class='sql_form' name='db_pass' value='{$_REQUEST['db_pass']}'>
               </td>
           </tr>
           <tr>
               <td class='title'>SQL Table Prefix:</td>
               <td class='content'>
               \t<input type='text' class='sql_form' name='db_pre' value='{$this->request['db_pre']}'>
               </td>
           </tr>
        <!--{EXTRA.SQL}-->
\t\t</table>
\t</fieldset>
EOF;
        return $IPBHTML;
    }
예제 #21
0
 /**
  * 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'] = '';
 }
예제 #22
0
 /**
  * Construct
  *
  * @access	public
  * @param	object	ipsRegistry reference
  * @param	bool	Whether to init
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $init = FALSE)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     if ($init === TRUE) {
         /* Load 'template' */
         require_once IPS_ROOT_PATH . 'setup/templates/skin_setup.php';
         /*noLibHook*/
         $this->template = new skin_setup($registry);
         /* Images URL */
         $this->imageUrl = '../setup/' . PUBLIC_DIRECTORY . '/images';
         /* Fetch sequence data */
         require_once IPS_KERNEL_PATH . 'classXML.php';
         /*noLibHook*/
         $xml = new classXML(IPSSetUp::charSet);
         $file = IPS_IS_UPGRADER ? IPS_ROOT_PATH . 'setup/xml/upgrade_sequence.xml' : IPS_ROOT_PATH . 'setup/xml/sequence.xml';
         try {
             $xml->load($file);
             foreach ($xml->fetchElements('action') as $xmlelement) {
                 $data = $xml->fetchElementsFromRecord($xmlelement);
                 $_tmp[$data['position']] = $data;
                 ksort($_tmp);
                 foreach ($_tmp as $pos => $data) {
                     $this->sequenceData[$data['file']] = $data['menu'];
                 }
             }
         } catch (Exception $error) {
             $this->addError("Could not locate: " . $file);
         }
         /* Set up URLs */
         $this->settings['base_url'] = $this->settings['base_url'] ? $this->settings['base_url'] : IPSSetUp::getSavedData('install_url');
         $this->settings['public_dir'] = $this->settings['base_url'] . '/' . PUBLIC_DIRECTORY . '/';
         $this->settings['img_url_no_dir'] = $this->settings['base_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/';
         /* Set Current Page */
         $this->currentPage = $this->request['section'] ? $this->request['section'] : 'index';
         if (!$this->sequenceData[$this->currentPage]) {
             $this->currentPage = 'index';
         }
         /* Set default next action */
         $_hit = 0;
         foreach ($this->sequenceData as $file => $text) {
             if ($_hit) {
                 $this->nextAction = $file;
                 break;
             }
             if ($file == $this->currentPage) {
                 $_hit = 1;
             }
         }
         /* Build all skins array */
         if (IPS_IS_UPGRADER) {
             /* For < 3.0.0 upgrades, they won't have this table, so check for it */
             if ($this->DB->checkForTable('skin_collections')) {
                 $this->DB->build(array('select' => '*', 'from' => 'skin_collections', 'order' => 'set_id ASC'));
                 $this->DB->execute();
                 while ($_skinSets = $this->DB->fetch()) {
                     $id = $_skinSets['set_id'];
                     $this->allSkins[$id] = $_skinSets;
                     $this->allSkins[$id]['_parentTree'] = unserialize($_skinSets['set_parent_array']);
                     $this->allSkins[$id]['_childTree'] = unserialize($_skinSets['set_child_array']);
                     $this->allSkins[$id]['_userAgents'] = unserialize($_skinSets['set_locked_uagent']);
                     $this->allSkins[$id]['_cssGroupsArray'] = unserialize($_skinSets['set_css_groups']);
                     $this->allSkins[$id]['_youCanUse'] = TRUE;
                     $this->allSkins[$id]['_gatewayExclude'] = FALSE;
                     /* Array groups */
                     if (is_array($this->allSkins[$id]['_cssGroupsArray'])) {
                         ksort($this->allSkins[$id]['_cssGroupsArray'], SORT_NUMERIC);
                     } else {
                         $this->allSkins[$id]['_cssGroupsArray'] = array();
                     }
                 }
             }
         }
     }
 }
예제 #23
0
 /**
  * Install Tenplate Caches
  *
  * @return void
  */
 public function install_template_caches()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->settings['base_url'] = IPSSetUp::getSavedData('install_url');
     $previous = $_REQUEST['previous'];
     //-----------------------------------------
     // Fetch next 'un
     //-----------------------------------------
     $skinId = intval($this->request['skinId']);
     $skinData = array();
     $output = array();
     //-----------------------------------------
     // Recache skins: Moved here so they are
     // build after hooks are added
     //-----------------------------------------
     /* Load skin classes */
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php';
     /*noLibHook*/
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
     /*noLibHook*/
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php';
     /*noLibHook*/
     $skinFunctions = new skinImportExport($this->registry);
     /* Grab skin data */
     $skinData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => 'set_id > ' . $skinId . ' AND set_parent_id=0', 'order' => 'set_id ASC', 'limit' => array(0, 1)));
     if ($skinData['set_id']) {
         $skinFunctions->rebuildPHPTemplates($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $skinFunctions->rebuildCSS($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $skinFunctions->rebuildReplacementsCache($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $output[] = "Обновлен кеш стиля " . $skinData['set_name'] . "...";
         /* Go for the next */
         $this->_finishStep($output, "Обновление: Кеш стилей", 'upgrade&do=templatecache&skinId=' . $skinData['set_id']);
     } else {
         /* All diddly done */
         $output[] = "Кеш стилей обновлен";
         $skinFunctions->rebuildSkinSetsCache();
         /* Rebuild FURL & GLOBAL caches */
         try {
             IPSLib::cacheFurlTemplates();
             IPSLib::cacheGlobalCaches();
         } catch (Exception $error) {
         }
         /* Clear out minify files */
         try {
             if (is_dir(DOC_IPS_ROOT_PATH . 'cache/tmp')) {
                 foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/tmp') as $cache) {
                     if ($cache->getMTime() < time() - 60 * 60 * 24 * 7 and $cache->getFilename() != 'index.html') {
                         @unlink($cache->getPathname());
                     }
                 }
             }
         } catch (Exception $e) {
         }
         /* Show message and go */
         $this->_finishStep($output, "Upgrade: Skin Caches", 'done');
     }
 }
 /**
  * Install Tenplate Caches
  *
  * @return void
  */
 public function install_template_caches()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->settings['base_url'] = IPSSetUp::getSavedData('install_url');
     $previous = $_REQUEST['previous'];
     //-----------------------------------------
     // Fetch next 'un
     //-----------------------------------------
     $skinId = intval($this->request['skinId']);
     $skinData = array();
     $output = array();
     //-----------------------------------------
     // Recache skins: Moved here so they are
     // build after hooks are added
     //-----------------------------------------
     /* Load skin classes */
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php';
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php';
     $skinFunctions = new skinImportExport($this->registry);
     /* Grab skin data */
     $skinData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => 'set_id > ' . $skinId . ' AND set_parent_id=0', 'order' => 'set_id ASC', 'limit' => array(0, 1)));
     if ($skinData['set_id']) {
         $skinFunctions->rebuildPHPTemplates($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $skinFunctions->rebuildCSS($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $skinFunctions->rebuildReplacementsCache($skinData['set_id']);
         $output = array_merge($output, $skinFunctions->fetchMessages(TRUE));
         if ($skinFunctions->fetchErrorMessages() !== FALSE) {
             $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages()));
         }
         $output[] = "Recached skin " . $skinData['set_name'] . "...";
         /* Go for the next */
         $this->_finishStep($output, "Upgrade: Skin Caches", 'upgrade&do=templatecache&skinId=' . $skinData['set_id']);
     } else {
         /* All diddly done */
         $output[] = "All skins recached";
         $skinFunctions->rebuildSkinSetsCache();
         /* Rebuild FURL cache */
         try {
             IPSLib::cacheFurlTemplates();
         } catch (Exception $error) {
         }
         $this->_finishStep($output, "Upgrade: Skin Caches", 'done');
     }
 }