/** * 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; }
/** * 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; }
/** * 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(); }
/** * 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; }
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&module=applications&section=applications&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&module=applications&section=applications&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'] . "&module=settings&section=settings&do=findsetting&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'] . "&module=settings&section=settings&do=findsetting&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'] . "&module=settings&section=settings&do=findsetting&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; }
/** * 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}&module={$module['sys_module_key']}&section={$DEFAULT_SECTION}"); } } } } } } } /* If all else fails, take them to the change details page */ $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "core&module=mycp&section=details"); } else { if (!$this->registry->getClass('class_permissions')->checkPermission('dashboard', 'core', 'mycp')) { $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "core&module=mycp&section=details"); } } //----------------------------------------- // Set up stuff //----------------------------------------- $this->form_code = $this->html->form_code = 'module=mycp&section=dashboard'; $this->form_code_js = $this->html->form_code_js = 'module=mycp§ion=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("&#", "&#", $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&module=settings&section=settings&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&module=applications&section=applications&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&module=system&section=taskmanager&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&module=tools&section=help&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&module=posts&section=bbcode&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", ' ', $_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(); }
/** * 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(); }
/** * 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); }
/** * 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('&', '&', 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; }
/** * Check for previous sessions. * Checks to see if there's an unfinished upgrade. * * @param array * @access public */ public static function restorePreviousSession($session) { /* Delete all previous sessions */ ipsRegistry::DB()->delete('upgrade_sessions', 'session_id != \'' . ipsRegistry::$request['s'] . '\''); /* Update the session */ ipsRegistry::DB()->update('upgrade_sessions', array('session_current_time' => time(), 'session_section' => $session['session_section'], 'session_post' => serialize($session['_session_post']), 'session_get' => serialize($session['_session_get'])), 'session_id=\'' . ipsRegistry::$request['s'] . '\''); /* Set correct app */ $_GET['app'] = 'upgrade'; $_POST['app'] = 'upgrade'; ipsRegistry::$request['app'] = 'upgrade'; ipsRegistry::$current_section = 'upgrade'; /* Set correct section */ $_GET['section'] = $session['_session_get']['section']; $_POST['section'] = $session['_session_get']['section']; ipsRegistry::$request['section'] = $session['_session_get']['section']; ipsRegistry::$current_section = $session['_session_get']['section']; /* Set up the correct do */ $_GET['do'] = $session['_session_get']['do']; $_POST['do'] = $session['_session_get']['do']; ipsRegistry::$request['do'] = $session['_session_get']['do']; /* Set up the correct previous */ $_GET['previous'] = $session['_session_get']['previous']; $_POST['previous'] = $session['_session_get']['previous']; ipsRegistry::$request['previous'] = $session['_session_get']['previous']; /* Set up SD */ $_POST['_sd'] = $session['_sd']; ipsRegistry::$request['_sd'] = $session['_sd']; /* App dir, etc */ ipsRegistry::$request['appdir'] = $session['_sd']['appdir']; ipsRegistry::$request['man'] = $session['_sd']['man']; ipsRegistry::$request['helpfile'] = $session['_sd']['helpfile']; $apps = explode(',', $session['_sd']['install_apps']); $toSave = array(); $vNums = array(); /* set saved data */ if (count($session['_sd'])) { foreach ($session['_sd'] as $k => $v) { if ($k) { IPSSetUp::setSavedData($k, $v); } } } if (is_array($apps) and count($apps)) { /* Grab data */ 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 (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(ipsRegistry::instance()); 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); } } /* Freeze data */ IPSSetUp::freezeSavedData(); /* Thaw it */ IPSSetUp::thawSavedData(); } /* Re run our controller */ ipsController::run(); }
/** * Main class entry point * * @access public * @param object ipsRegistry reference * @return void [Outputs to screen] */ 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')); //----------------------------------------- // Set up stuff //----------------------------------------- $this->form_code = $this->html->form_code = 'module=mycp&section=dashboard'; $this->form_code_js = $this->html->form_code_js = 'module=mycp§ion=dashboard'; //----------------------------------------- // INIT //----------------------------------------- define('IPS_NEWS_URL', 'http://external./globalfeeds/news/'); define('IPS_BULLETINS_URL', 'http://external./ipbfeeds/300/staffbulletin/'); define('IPS_VERSION_CHECK_URL', 'http://www./latestversioncheck/ipb30x.php'); $content = array(); $thiscontent = ""; $latest_version = array(); $reg_end = ""; $sm_install = 0; $lock_file = 0; $converter = 0; $fulltext_a = 0; $unfinished_upgrade = 0; $urls = array('news' => IPS_NEWS_URL, 'keiths_bits' => IPS_BULLETINS_URL, 'version_check' => IPS_VERSION_CHECK_URL, 'blogs' => 'http://external./globalfeeds/blog/'); if (@file_exists(IPS_ROOT_PATH . 'install/index.php')) { $sm_install = 1; } if (@file_exists(DOC_IPS_ROOT_PATH . 'cache/installer_lock.php')) { $lock_file = 1; } if (@is_dir(IPS_ROOT_PATH . 'applications_addon/ips/convert/')) { $converter = 1; if (!@file_exists(DOC_IPS_ROOT_PATH . 'cache/converter_lock.php')) { $converter = 2; } } if ($this->DB->checkFulltextSupport()) { if (!$this->DB->getFulltextStatus('posts')) { $fulltext_a = 1; } } require_once IPS_ROOT_PATH . '/setup/sources/base/setup.php'; $versions = IPSSetUp::fetchAppVersionNumbers('core'); if ($versions['current'][0] != $versions['latest'][0]) { $unfinished_upgrade = 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 = (isset($latest_version['upgrade_notes']) and $latest_version['upgrade_notes']) ? $latest_version['upgrade_notes'] : ipsRegistry::$vn_full; //----------------------------------------- // Licensed? //----------------------------------------- $urls['keiths_bits'] = IPS_BULLETINS_URL . '?v=' . 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, 'deletefirst' => 0, 'array' => 0)); } $text = $this->lang->words['cp_acpnotes']; if (!$this->cache->getCache('adminnotes') or !$this->cache->getCache('adminnotes')) { $this->cache->setCache('adminnotes', $text, array('donow' => 1, 'deletefirst' => 0, 'array' => 0)); } $this->cache->updateCacheWithoutSaving('adminnotes', htmlspecialchars($this->cache->getCache('adminnotes'), ENT_QUOTES)); $this->cache->updateCacheWithoutSaving('adminnotes', str_replace("&#", "&#", $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'] ? "<a href='" . preg_replace('/&app=([a-zA-Z0-9\\-_]+)/', '', $this->settings['base_url']) . $r['session_url'] . "'>{$r['session_location']}</a>" : $this->lang->words['cp_index']; $acponline .= $this->html->acp_onlineadmin_row(IPSMember::buildDisplayData($r)); } $content['acp_online'] = $this->html->acp_onlineadmin_wrapper($acponline); //----------------------------------------- // Stats //----------------------------------------- $reg = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as reg', 'from' => array('validating' => 'v'), 'where' => 'v.lost_pass <> 1 AND m.member_group_id=' . $this->settings['auth_group'], 'add_join' => array(array('from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left')))); if ($this->settings['ipb_bruteforce_attempts']) { $lock = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as mems', 'from' => 'members', 'where' => 'failed_login_count >= ' . $this->settings['ipb_bruteforce_attempts'])); } $coppa = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as coppa', 'from' => 'validating', 'where' => 'coppa_user=1')); $my_timestamp = time() - $this->settings['au_cutoff'] * 60; $online = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as sessions', 'from' => 'sessions', 'where' => 'running_time>' . $my_timestamp)); $pending = $this->DB->buildAndFetch(array('select' => 'SUM(queued_topics) as topics, SUM(queued_posts) as posts', 'from' => 'forums')); $spammers = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as count, MAX(joined) as joined', 'from' => 'members', 'where' => "members_bitoptions = '1'")); $content['stats'] = $this->html->acp_stats_wrapper(array('topics' => intval($this->caches['stats']['total_topics']), 'replies' => intval($this->caches['stats']['total_replies']), 'topics_mod' => intval($pending['topics']), 'posts_mod' => intval($pending['posts']), 'members' => intval($this->caches['stats']['mem_count']), 'validate' => intval($reg['reg']), 'spammer' => array(intval($spammers['count']), intval($spammers['joined'])), 'locked' => intval($lock['mems']), 'coppa' => intval($coppa['coppa']), 'sql_driver' => strtoupper(SQL_DRIVER), 'sql_version' => $this->DB->true_version, 'php_version' => phpversion(), 'sessions' => intval($online['sessions']), 'php_sapi' => @php_sapi_name(), 'ipb_version' => ipsRegistry::$version, 'ipb_id' => ipsRegistry::$vn_full)); //----------------------------------------- // 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); } } //----------------------------------------- // Forum and group dropdowns //----------------------------------------- require_once IPSLib::getAppDir('forums') . '/sources/classes/forums/class_forums.php'; $this->registry->setClass('class_forums', new class_forums($this->registry)); $this->registry->getClass('class_forums')->forumsInit(); $forums = $this->registry->getClass('class_forums')->forumsForumJump(1); $groups = array(); $groups_html = ''; foreach ($this->cache->getCache('group_cache') as $k => $v) { $groups[$v['g_title']] = "<option value='{$k}'>{$v['g_title']}</option>"; } ksort($groups); $groups_html = implode("\n", $groups); //----------------------------------------- // Piece it together //----------------------------------------- $urls['version_check'] = IPS_VERSION_CHECK_URL . '?' . base64_encode(ipsRegistry::$vn_full . '|^|' . $this->settings['board_url']); $this->registry->output->html .= $this->html->mainTemplate($content, $forums, $groups_html, $urls); //----------------------------------------- // FURL cache OOD? //----------------------------------------- if (file_exists(IPS_CACHE_PATH . 'cache/furlCache.php')) { $mtime = intval(@filemtime(IPS_CACHE_PATH . 'cache/furlCache.php')); /* Check mtimes on extensions.. */ foreach (ipsRegistry::$applications as $app_dir => $application) { if (file_exists(IPSLib::getAppDir($app_dir) . '/extensions/furlTemplates.php')) { $_mtime = intval(@filemtime(IPSLib::getAppDir($app_dir) . '/extensions/furlTemplates.php')); if ($_mtime > $mtime) { $_html = $this->html->warning_box($this->lang->words['furlcache_outofdate'], "<a href='" . $this->settings['base_url'] . "app=core&module=applications&section=applications&do=seoRebuild'>{$this->lang->words['rebuild_furl_cache']}</a>") . "<br />"; $this->registry->output->html = str_replace('<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html); break; } } } } //----------------------------------------- // Minify on but /cache/tmp not writeable? //----------------------------------------- if (isset($this->settings['_use_minify']) and $this->settings['_use_minify']) { $_html = $this->html->warning_box($this->lang->words['minifywrite_head'], $this->lang->words['minifynot_writeable']) . "<br />"; $this->registry->output->html = str_replace('<!--in_dev_check-->', $_html . '<!--in_dev_check-->', $this->registry->output->html); } //----------------------------------------- // 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); } 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&module=system&section=taskmanager&do=tasksImportAllApps'>{$this->lang->words['cp_clickhere']}</a> {$this->lang->words['cp_clickhere_info']}."); } //----------------------------------------- // 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(); $apps = new IPSApplicationsIterator(); $_html = ''; foreach ($apps as $app) { $app_dir = $apps->fetchAppDir(); /* 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>" . $app['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>" . $app['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>" . $app['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>" . $app['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>" . $app['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&module=tools&section=settings&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&module=applications&section=applications&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&module=system&section=taskmanager&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&module=tools&section=help&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&module=posts&section=bbcode&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); if (@file_exists(DOC_IPS_ROOT_PATH . '_dev_notes.txt')) { $_notes = @file_get_contents(DOC_IPS_ROOT_PATH . '_dev_notes.txt'); if ($_notes) { $_html = $this->registry->output->global_template->information_box($this->lang->words['cp_devnotes'], nl2br($_notes)) . "<br />"; $this->registry->output->html = str_replace('<!--in_dev_notes-->', $_html, $this->registry->output->html); } } } //----------------------------------------- // INSTALLER PRESENT? //----------------------------------------- if ($sm_install == 1) { if ($lock_file != 1) { $installer = $this->html->warning_box($this->lang->words['cp_unlockedinstaller'], $this->html->warning_unlocked_installer()) . "<br />"; $this->registry->output->html = str_replace('<!--warninginstaller-->', $installer, $this->registry->output->html); } else { $installer = $this->html->warning_box($this->lang->words['cp_installerpresent'], $this->html->warning_installer()) . "<br />"; $this->registry->output->html = str_replace('<!--warninginstaller-->', $installer, $this->registry->output->html); } } else { if ($converter) { $text = $converter == 2 ? $this->lang->words['cp_unlocked_converter'] : $this->lang->words['cp_converterpresent']; $installer = $this->html->warning_box($text, $this->html->warning_converter($converter)) . "<br />"; $this->registry->output->html = str_replace('<!--warninginstaller-->', $installer, $this->registry->output->html); } } //----------------------------------------- // UNFINISHED UPGRADE? //----------------------------------------- if ($unfinished_upgrade == 1) { $this->lang->words['cp_upgrade_warning'] = sprintf($this->lang->words['cp_upgrade_warning'], $versions['current'][1], $versions['latest'][1], $this->settings['base_acp_url']); $upgrade = $this->html->warning_box($this->lang->words['cp_unfinishedupgrade'], $this->html->warning_upgrade()) . "<br />"; $this->registry->output->html = str_replace('<!--warningupgrade-->', $upgrade, $this->registry->output->html); } //----------------------------------------- // INSUFFICIENT PHP VERSION? //----------------------------------------- if (PHP_VERSION < '5.1.0') { $version = $this->html->warning_box(sprintf($this->lang->words['cp_yourphpversion'], PHP_VERSION), $this->html->acp_php_version_warning()) . "<br />"; $this->registry->output->html = str_replace('<!--phpversioncheck-->', $version, $this->registry->output->html); } //----------------------------------------- // BOARD OFFLINE? //----------------------------------------- if ($this->settings['board_offline']) { $offline = $this->html->warning_box($this->lang->words['cp_boardoffline'], "{$this->lang->words['cp_boardoffline1']}<br /><br />» <a href='" . $this->settings['base_url'] . "&module=tools&section=settings&do=findsetting&key=boardoffline'>{$this->lang->words['cp_boardoffline2']}</a>") . "<br />"; $this->registry->output->html = str_replace('<!--boardoffline-->', $offline, $this->registry->output->html); } //----------------------------------------- // No fulltext //----------------------------------------- if ($this->settings['search_method'] == 'traditional' and !$this->settings['use_fulltext'] and !$this->settings['hide_ftext_note']) { $ftext = $this->html->warning_box($this->lang->words['fulltext_off'], "{$this->lang->words['fulltext_turnon']}<br /><br />» <a href='" . $this->settings['base_url'] . "&module=tools&section=settings&do=findsetting&key=searchsetup'>{$this->lang->words['fulltext_find']}</a>") . "<br />"; $this->registry->output->html = str_replace('<!--fulltext-->', $ftext, $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')) { $this->DB->build(array('select' => '*', 'from' => 'admin_login_logs', 'order' => 'admin_time DESC', 'limit' => array(0, 5))); $this->DB->execute(); while ($rowb = $this->DB->fetch()) { $rowb['_admin_time'] = $this->registry->class_localization->getDate($rowb['admin_time'], 'long'); $rowb['_admin_img'] = $rowb['admin_success'] ? 'aff_tick.png' : 'aff_cross.png'; $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(); }
/** * Execute selected method * [ REPEAT FOR APPS: SQL > VERSION UPGRADER / FINISH ] -> SETTINGS > TEMPLATES > TASKS > LANGUAGES > PUBLIC LANGUAGES > BBCODE > ACP HELP OTHER [ Email Templates ] > Build Caches * * @access public * @param object Registry object * @return @e void */ public function doExecute(ipsRegistry $registry) { /* Set Up */ IPSSetUp::setSavedData('man', intval($this->request['man']) ? intval($this->request['man']) : IPSSetUp::getSavedData('man')); IPSSetUp::setSavedData('appdir', $this->request['appdir'] ? $this->request['appdir'] : IPSSetUp::getSavedData('appdir')); IPSSetUp::setSavedData('helpfile', intval($this->request['helpfile']) ? intval($this->request['helpfile']) : IPSSetUp::getSavedData('helpfile')); /* Do we have a current application? */ if (!IPSSetUp::getSavedData('appdir')) { $_app = IPSSetUp::fetchNextApplication('', '', $this->settings['gb_char_set']); IPSSetUp::setSavedData('appdir', $_app['key']); } /* Set current app */ $this->_currentApp = IPSSetUp::getSavedData('appdir'); /* Fetch numbers */ $numbers = IPSSetUp::fetchAppVersionNumbers($this->_currentApp); /* Set numbers */ $this->_currentLong = $numbers['current'][0]; $this->_currentHuman = $numbers['current'][1]; $this->_uipLong = $numbers['next'][0]; $this->_uipHuman = $numbers['next'][1]; $this->_latestLong = $numbers['latest'][0]; $this->_latestHuman = $numbers['latest'][1]; $this->_dbDriver = strtolower($this->settings['sql_driver']); if ($this->_currentApp) { $this->_appData = IPSSetUp::fetchXmlAppInformation($this->_currentApp, $this->settings['gb_char_set']); if ($this->_currentApp == 'core') { $this->_appData['name'] = 'IP.Board'; } } /* Fail safe */ if (!$this->_currentApp) { print "No app"; exit; } $this->registry->output->setVersionAndApp($this->_uipHuman, $this->_appData); /* Switch */ switch ($this->request['do']) { case 'sql': $this->_stepCount = 1; $this->install_sql(); break; case 'appclass': $this->_stepCount = 2; $this->install_appclass(); break; case 'checkdb': $this->_stepCount = 3; $this->install_checkdb(); break; case 'modules': $this->_stepCount = 4; $this->install_modules(); break; case 'settings': $this->_stepCount = 5; $this->install_settings(); break; case 'templates': $this->_stepCount = 6; $this->install_templates(); break; case 'tasks': $this->_stepCount = 7; $this->install_tasks(); break; case 'languages': $this->_stepCount = 8; $this->install_languages(); break; case 'clientlanguages': $this->_stepCount = 9; $this->install_client_languages(); break; case 'bbcode': $this->_stepCount = 10; $this->install_bbcode(); break; case 'acphelp': $this->_stepCount = 11; $this->install_acphelp(); break; case 'other': $this->_stepCount = 12; $this->install_other(); break; case 'caches': $this->_stepCount = 13; $this->install_caches(); break; case 'templatecache': $this->_stepCount = 14; $this->install_template_caches(); break; default: $this->_splash(); break; } /* Log errors for support */ if (count($this->_errorMsg) > 0) { IPSSetUp::addLogMessage(implode("\n", $this->_errorMsg), $this->_uipHuman, $this->_currentApp); } }
public function get() { /* INIT */ $entries = array(); if (!$this->settings['ipb_reg_number']) { $entries[] = array($this->lang->words['lc_title_nokey'], sprintf($this->lang->words['lc_msg_nokey'], "{$this->settings['base_url']}module=tools&section=licensekey")); } else { /* Is the Spam Service Working? */ if ($this->settings['spam_service_enabled']) { $GOT_SPAM_ERROR = false; /* Are we entitled to it? */ $licenseData = $this->cache->getCache('licenseData'); if (is_array($licenseData['ipbMain']) && count($licenseData['ipbMain'])) { foreach ($licenseData['ipbMain'] as $data) { if ($data['name'] == 'Spam Monitoring Service' && $data['status'] != 'Ok') { $disableLink = $this->settings['base_url'] . "app=core&module=settings&section=settings&do=findsetting&key=spamservice"; if (is_numeric($data['_expires']) && time() > $data['_expires']) { $entries[] = array($this->lang->words['spam_service_error'], sprintf($this->lang->words['spam_service_expired'], $disableLink)); } else { $entries[] = array($this->lang->words['spam_service_error'], sprintf($this->lang->words['spam_service_unavailable'], $disableLink)); } $GOT_SPAM_ERROR = true; break; } } } if (!$GOT_SPAM_ERROR) { /* Get last 5 logs, and if all 5 are errors, show message */ $_errors = 0; $_entries = 0; $_lastError = ''; $this->DB->build(array('select' => 'log_code, log_msg', 'from' => 'spam_service_log', 'order' => 'id DESC', 'limit' => 5)); $this->DB->execute(); while ($_r = $this->DB->fetch()) { $_entries++; if ($_r['log_code'] === '0') { $_errors++; if (!$_lastError) { $_lastError = $_r['log_msg']; } } } if ($_entries > 0 && $_errors == $_entries) { $entries[] = array($this->lang->words['spam_service_error'], sprintf($this->lang->words['spam_service_error_msg'], $_lastError)); } } } else { $licenseData = $this->cache->getCache('licenseData'); if (is_array($licenseData['ipbMain']) && count($licenseData['ipbMain'])) { foreach ($licenseData['ipbMain'] as $data) { if ($data['name'] == 'Spam Monitoring Service' && $data['status'] == 'Ok') { $entries[] = array($this->lang->words['spam_service_disabled'], $this->lang->words['spam_service_disabled_msg']); break; } } } } } /* 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) { $furltemplatesfile = IPSLib::getAppDir($app_dir); if (IPB_USE_ONLY_ID_FURL && is_file($furltemplatesfile . '/extensions/furlTemplatesID.php')) { $furltemplatesfile .= '/extensions/furlTemplatesID.php'; } else { $furltemplatesfile .= '/extensions/furlTemplates.php'; } if (is_file($furltemplatesfile)) { $_mtime = intval(@filemtime($furltemplatesfile)); 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&module=applications&section=applications&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&module=applications&section=applications&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'] . "&module=settings&section=settings&do=findsetting&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'] . "&module=settings&section=settings&do=findsetting&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'] . "&module=settings&section=settings&do=findsetting&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; }
/** * View details about an application * * @return @e void [Outputs to screen] */ protected function applicationViewDetails() { $id = intval($this->request['app_id']); if (!$id) { $this->registry->output->showError($this->lang->words['a_noid'], 11110.1); } $appData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_applications', 'where' => 'app_id=' . $id)); if (!$appData['app_id']) { $this->registry->output->showError($this->lang->words['a_nodetails'], 11111.1); } /* Format dates */ $lastUpdate = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'upgrade_history', 'where' => "upgrade_app='{$appData['app_directory']}'", 'order' => 'upgrade_version_id DESC', 'limit' => array(1))); $appData['_installed'] = $this->registry->getClass('class_localization')->getDate($appData['app_added'], 'DATE'); $appData['_updated'] = $lastUpdate['upgrade_date'] > $appData['app_added'] ? $this->registry->getClass('class_localization')->getDate($lastUpdate['upgrade_date'], 'DATE') : '--'; /* Get the setup class */ require_once IPS_ROOT_PATH . "setup/sources/base/setup.php"; /*noLibHook*/ /* Version numbers */ $_a = in_array($appData['app_directory'], array('forums', 'members')) ? 'core' : $appData['app_directory']; $numbers = IPSSetUp::fetchAppVersionNumbers($_a); $appData['_human_version'] = $numbers['latest'][1]; $appData['_long_version'] = $numbers['latest'][0]; $appData['_human_current'] = $numbers['current'][1]; $appData['_long_current'] = $numbers['current'][0]; /* Got updates? */ if ($appData['app_update_check']) { /* Get hooks file for update check */ $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . '/modules_admin/applications/hooks.php', 'admin_core_applications_hooks'); $hooksClass = new $classToLoad(); $hooksClass->makeRegistryShortcuts($this->registry); $appData['app_update_available'] = $hooksClass->_updateAvailable($appData['app_update_check'], $appData['app_long_version']); } else { $appData['app_update_available'] = array(0); } /* Get related hooks */ $hooks = array(); $this->DB->build(array('select' => '*', 'from' => 'core_hooks', 'where' => 'hook_requirements LIKE \'%:"' . $this->DB->addSlashes($appData['app_directory']) . '";a:%\'', 'order' => 'hook_id ASC')); $outer = $this->DB->execute(); /* Got results? */ if ($this->DB->getTotalRows($outer)) { /* Get hooks file for update check */ $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . '/modules_admin/applications/hooks.php', 'admin_core_applications_hooks'); $hooksClass = new $classToLoad(); $hooksClass->makeRegistryShortcuts($this->registry); /* Loop */ while ($rh = $this->DB->fetch($outer)) { /* Check requirements */ if ($rh['hook_enabled']) { $rh['_require_errors'] = $hooksClass->checkHookRequirements($rh); } $hooks[] = $rh; } } /* Upgrade history */ $upgradeHistory = array(); $this->DB->build(array('select' => '*', 'from' => 'upgrade_history', 'where' => "upgrade_app='" . $this->DB->addSlashes($appData['app_directory']) . "'", 'order' => 'upgrade_version_id DESC')); $this->DB->execute(); while ($r = $this->DB->fetch()) { $upgradeHistory[] = $r; } /* Output */ $this->registry->output->html .= $this->html->application_details($appData, $upgradeHistory, $hooks); }
/** * 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(); }
/** * List applications * * @access private * @return void [Outputs to screen] */ private function applicationsOverview() { //----------------------------------------- // INIT //----------------------------------------- $folders = array(); $application = array(); $_apps = array(); $seen_count = 0; $total_items = 0; $uninstalled = array(); /* Get the setup class */ require IPS_ROOT_PATH . "setup/sources/base/setup.php"; //----------------------------------------- // Get DB applications //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'core_applications', 'order' => 'app_position')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $_apps[IPSLib::getAppFolder($row['app_directory']) . '/' . $row['app_directory']] = $row; $total_items++; } //----------------------------------------- // Get folder applications... //----------------------------------------- foreach (array('applications', 'applications_addon/ips', 'applications_addon/other') as $folder) { try { foreach (new DirectoryIterator(IPS_ROOT_PATH . $folder) as $file) { if (!$file->isDot() and $file->isDir()) { $_name = $file->getFileName(); if (substr($_name, 0, 1) != '.') { $folders[$folder . '/' . $_name] = $_name; } } } } catch (Exception $e) { } } //----------------------------------------- // Installed Loop... //----------------------------------------- foreach ($_apps as $_app_path => $row) { $app_dir = $row['app_directory']; //----------------------------------------- // Enabled? //----------------------------------------- $row['_app_enabled'] = $row['app_enabled'] ? 'tick.png' : 'cross.png'; /* Version numbers */ $_a = ($app_dir == 'forums' or $app_dir == 'members') ? 'core' : $app_dir; $numbers = IPSSetUp::fetchAppVersionNumbers($_a); $row['_human_version'] = $numbers['latest'][1]; $row['_long_version'] = $numbers['latest'][0]; $row['_human_current'] = $numbers['current'][1]; $row['_long_current'] = $numbers['current'][0]; /* Exists? */ if (!file_exists(IPSLib::getAppDir($app_dir))) { $row['_missing'] = 1; } $seen_count++; $application[$row['app_location']][] = $row; } /* Make sure they are in the proper order, hacky but it works :) */ $__apps = array(); $__apps['root'] = $application['root'] ? $application['root'] : array(); $__apps['ips'] = $application['ips'] ? $application['ips'] : array(); $__apps['other'] = $application['other'] ? $application['other'] : array(); $application = $__apps; //----------------------------------------- // Uninstalled //----------------------------------------- foreach ($folders as $filepath => $_file) { if (!in_array($filepath, array_keys($_apps))) { $info = IPSSetUp::fetchXmlAppInformation($_file); /* OK, we're making no effort to conceal the secret behind the ipskey. It's an honourable setting - do not abuse it. We only mildly obfuscate it to stop copy and paste mistakes in information.xml */ $okToGo = 0; if (strstr($filepath, 'applications_addon/ips') or strstr($filepath, 'applications/')) { if (md5('ips_' . $_file) == $info['ipskey']) { $okToGo = 1; } } else { if (strstr($filepath, 'applications_addon/other')) { if (!$info['ipskey']) { $okToGo = 1; } } } $uninstalled[$_file] = array('title' => $info['name'], 'author' => $info['author'], 'path' => $filepath, 'okToGo' => $okToGo, 'directory' => $_file); } } //----------------------------------------- // Show it... //----------------------------------------- $this->registry->output->html .= $this->html->applications_list($application, $uninstalled); }