本文整理汇总了PHP中IPSSetUp::setSavedData方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSSetUp::setSavedData方法的具体用法?PHP IPSSetUp::setSavedData怎么用?PHP IPSSetUp::setSavedData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSSetUp
的用法示例。
在下文中一共展示了IPSSetUp::setSavedData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* INIT */
$error = false;
/* Check input? */
if ($this->request['do'] == 'check') {
/* Check Directory */
if (!is_dir($this->request['install_dir'])) {
$error = true;
$this->registry->output->addWarning('The specified directory does not exist');
}
/* Check URL */
if (!$this->request['install_dir']) {
$error = true;
$this->registry->output->addWarning('You did not specify a URL');
}
if (!$error) {
/* Save Form Data */
IPSSetUp::setSavedData('install_dir', preg_replace("#(//)\$#", "", str_replace('\\', '/', $this->request['install_dir']) . '/'));
IPSSetUp::setSavedData('install_url', preg_replace("#(//)\$#", "", str_replace('\\', '/', $this->request['install_url']) . '/'));
/* Next Action */
$this->registry->autoLoadNextAction('db');
}
}
/* Guess at directory */
if (!defined('CP_DIRECTORY')) {
define('CP_DIRECTORY', 'admin');
}
$dir = str_replace(CP_DIRECTORY . '/install', '', getcwd());
$dir = str_replace(CP_DIRECTORY . '\\install', '', $dir);
// Windows
$dir = str_replace('\\', '/', $dir);
/* Guess at URL */
$url = str_replace("/" . CP_DIRECTORY . "/installer/index.php", "", $_SERVER['HTTP_REFERER']);
$url = str_replace("/" . CP_DIRECTORY . "/installer/", "", $url);
$url = str_replace("/" . CP_DIRECTORY . "/installer", "", $url);
$url = str_replace("/" . CP_DIRECTORY . "/install/index.php", "", $_SERVER['HTTP_REFERER']);
$url = str_replace("/" . CP_DIRECTORY . "/install/", "", $url);
$url = str_replace("/" . CP_DIRECTORY . "/install", "", $url);
$url = str_replace("/" . CP_DIRECTORY, "", $url);
$url = str_replace("index.php", "", $url);
$url = preg_replace("!\\?(.+?)*!", "", $url);
$url = "{$url}/";
/* Page Output */
$this->registry->output->setTitle("Paths and URLs");
$this->registry->output->setNextAction("address&do=check");
$this->registry->output->addContent($this->registry->output->template()->page_address($dir, $url));
$this->registry->output->sendOutput();
}
示例2: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
$_e = 0;
/* Check input? */
if ($this->request['do'] == 'check') {
if (!$this->request['username']) {
$_e = 1;
$this->registry->output->addWarning('You must specify a display name for the admin account');
}
if (!$this->request['password']) {
$_e = 1;
$this->registry->output->addWarning('You must specify a password for the admin account');
} else {
if ($this->request['password'] != $this->request['confirm_password']) {
$_e = 1;
$this->registry->output->addWarning('The admin passwords did not match');
}
}
if (!$this->request['email'] or IPSText::checkEmailAddress($this->request['email']) !== TRUE) {
$_e = 1;
$this->registry->output->addWarning('You must specify an email address for the admin account');
}
if ($_e) {
$this->registry->output->setTitle("Admin: Errors");
$this->registry->output->setNextAction('admin&do=check');
$this->registry->output->addContent($this->registry->output->template()->page_admin());
$this->registry->output->sendOutput();
} else {
/* Save Form Data */
IPSSetUp::setSavedData('admin_user', $this->request['username']);
IPSSetUp::setSavedData('admin_pass', $this->request['password']);
IPSSetUp::setSavedData('admin_email', $this->request['email']);
/* Next Action */
$this->registry->autoLoadNextAction('install');
return;
}
}
/* Output */
$this->registry->output->setTitle("Admin Account Creation");
$this->registry->output->setNextAction('admin&do=check');
$this->registry->output->addContent($this->registry->output->template()->page_admin());
$this->registry->output->sendOutput();
}
示例3: doExecute
/**
* 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'])));
//.........这里部分代码省略.........
示例4: settings
/**
* Import Settings
*
* @return @e void
*/
public function settings()
{
/* INIT */
$vars = $this->getVars();
$output = array();
$errors = array();
$knownSettings = array();
$this->registry->class_localization->loadLanguageFile(array('admin_tools'), 'core');
if (is_file($this->app_full_path . 'xml/' . $vars['app_directory'] . '_settings.xml')) {
/* Get the settings class */
$classToLoad = IPSLib::loadActionOverloader(IPS_ROOT_PATH . 'applications/core/modules_admin/settings/settings.php', 'admin_core_settings_settings');
$settings = new $classToLoad();
$settings->makeRegistryShortcuts($this->registry);
$this->request['app_dir'] = $vars['app_directory'];
//-----------------------------------------
// Known settings
//-----------------------------------------
if (substr($this->settings['_original_base_url'], -1) == '/') {
IPSSetUp::setSavedData('install_url', substr($this->settings['_original_base_url'], 0, -1));
}
if (substr($this->settings['base_dir'], -1) == '/') {
IPSSetUp::setSavedData('install_dir', substr($this->settings['base_dir'], 0, -1));
}
/* Fetch known settings */
if (is_file(IPSLib::getAppDir($vars['app_directory']) . '/setup/versions/install/knownSettings.php')) {
require IPSLib::getAppDir($vars['app_directory']) . '/setup/versions/install/knownSettings.php';
/*noLibHook*/
}
$settings->importAllSettings(1, 1, $knownSettings);
$settings->settingsRebuildCache();
} else {
$this->registry->output->global_message = $this->lang->words['settings_nofile'];
}
$output[] = $this->registry->output->global_message;
/* Clear main messaage */
$this->registry->output->global_message = '';
/* Show redirect... */
$this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('hooks', $vars));
}
示例5: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* Dealing with the result of the form asking for DB input */
if ($this->request['do'] == 'check') {
/* Make sure the fields were filled out */
if (!$this->request['overwrite'] and !$this->request['db_host'] || !$this->request['db_name'] || !$this->request['db_user']) {
$this->registry->output->addWarning('You must fill out the form completely');
} else {
if (preg_match("/[^a-zA-Z0-9_]/", $this->request['db_pre'])) {
$this->registry->output->addWarning('You cannot use special characters in the database prefix');
} else {
//-----------------------------------------
// Quick basic check for extensions
//-----------------------------------------
if (strtolower(IPSSetUp::getSavedData('sql_driver')) == 'mysql') {
if (!function_exists('mysqli_connect') and !function_exists('mysql_connect')) {
$this->registry->output->setTitle("Databases: Error");
$this->registry->output->setNextAction('db&do=check');
$this->registry->output->addWarning("You do not have the mysql or mysqli PHP extension installed. You must install one of these PHP extensions before you can continue.");
$this->registry->output->addContent($this->fetchContent());
$this->registry->output->sendOutput();
return;
}
}
//-----------------------------------------
// Load DB driver..
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classDb' . ucwords(IPSSetUp::getSavedData('sql_driver')) . '.php';
/*noLibHook*/
$classname = "db_driver_" . IPSSetUp::getSavedData('sql_driver');
$DB = new $classname();
$DB->obj['sql_database'] = $this->request['db_name'];
$DB->obj['sql_user'] = $this->request['db_user'];
$DB->obj['sql_pass'] = $_REQUEST['db_pass'];
$DB->obj['sql_host'] = $this->request['db_host'];
$DB->obj['sql_tbl_prefix'] = $this->request['db_pre'];
//--------------------------------------------------
// Any "extra" configs required for this driver?
//--------------------------------------------------
if (is_file(IPS_ROOT_PATH . 'setup/sql/' . IPSSetUp::getSavedData('sql_driver') . '_install.php')) {
require_once IPS_ROOT_PATH . 'setup/sql/' . IPSSetUp::getSavedData('sql_driver') . '_install.php';
/*noLibHook*/
$extra_install = new install_extra($this->registry);
$extra_install->install_form_process();
if (count($extra_install->errors)) {
$this->registry->output->addWarning(implode("<br />", $extra_install->errors));
}
if (is_array($extra_install->info_extra) and count($extra_install->info_extra)) {
foreach ($extra_install->info_extra as $k => $v) {
IPSSetUp::setSavedData('__sql__' . $k, $v);
}
}
if (is_array($DB->connect_vars) and count($DB->connect_vars)) {
foreach ($DB->connect_vars as $k => $v) {
$DB->connect_vars[$k] = $extra_install->info_extra[$k];
}
}
}
//-----------------------------------------
// Error check
//-----------------------------------------
if (count($extra_install->errors)) {
$this->registry->output->setTitle("Databases: Error");
$this->registry->output->setNextAction('db&do=check');
$this->registry->output->addContent($this->fetchContent());
$this->registry->output->sendOutput();
return;
}
//------------------------------------------
// Make CONSTANT
//------------------------------------------
define('SQL_DRIVER', IPSSetUp::getSavedData('sql_driver'));
define('IPS_MAIN_DB_CLASS_LOADED', TRUE);
//------------------------------------------
// Try a DB connection
//------------------------------------------
$DB->return_die = true;
if (!$DB->connect()) {
$errors[] = $DB->error;
}
//-----------------------------------------
// Error check
//-----------------------------------------
if (is_array($errors) and count($errors)) {
$this->registry->output->setTitle("Databases: Error");
$this->registry->output->setNextAction('db&do=check');
$this->registry->output->addWarning(implode("<br />", $errors));
$this->registry->output->addContent($this->fetchContent());
$this->registry->output->sendOutput();
return;
}
/* Save Form Data */
IPSSetUp::setSavedData('db_host', $_REQUEST['db_host']);
//.........这里部分代码省略.........
示例6: rebuildFromXml
/**
* Rebuilds language from XML files
*
* @return @e void
*/
public function rebuildFromXml()
{
//-----------------------------------------
// Init
//-----------------------------------------
$apps = array();
$previous = trim($this->request['previous']);
$type = trim($this->request['type']);
$id = intval($this->request['id']);
$_word = $type == 'admin' ? 'admin' : 'public';
//-----------------------------------------
// Verify writable
//-----------------------------------------
if (!is_writeable(IPS_CACHE_PATH . 'cache/lang_cache/' . $id)) {
$this->registry->output->global_error = $this->lang->words['cannot_write_to_cache'] ? sprintf($this->lang->words['cannot_write_to_cache'], $id) : "Cannot write to cache/lang_cache/" . $id;
$this->languagesList();
return;
}
//-----------------------------------------
// Get setup class
//-----------------------------------------
require_once IPS_ROOT_PATH . "setup/sources/base/setup.php";
/*noLibHook*/
//-----------------------------------------
// Get apps
//-----------------------------------------
foreach (ipsRegistry::$applications as $appDir => $appData) {
$apps[] = $appDir;
}
//-----------------------------------------
// Klude for setup class
//-----------------------------------------
IPSSetUp::setSavedData('install_apps', implode(',', $apps));
//-----------------------------------------
// Get next app
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']);
if ($next['key']) {
$msg = $next['title'] . sprintf($this->lang->words['importing_x_langs'], $_word);
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
//-----------------------------------------
// Try to import all the lang packs
//-----------------------------------------
try {
foreach (new DirectoryIterator($_PATH) as $f) {
if (preg_match("#" . $_word . "_(.+?)_language_pack.xml#", $f->getFileName())) {
$this->request['file_location'] = $_PATH . $f->getFileName();
$this->imprtFromXML(1, true, true, $next['key']);
}
}
} catch (Exception $e) {
}
//-----------------------------------------
// Off to next setp
//-----------------------------------------
$this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&id={$id}&type={$type}&previous=" . $next['key'], $msg . '<br>' . $this->registry->output->global_message);
$this->registry->output->global_message = '';
return;
} else {
if ($type == 'public') {
//-----------------------------------------
// Onto admin languages
//-----------------------------------------
$this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&id={$id}&type=admin", $this->lang->words['starting_admin_import']);
return;
} else {
//-----------------------------------------
// And we're done
//-----------------------------------------
$this->registry->output->redirect($this->settings['base_url'] . $this->form_code, $this->lang->words['lang_reimport_done']);
}
}
}
示例7: restorePreviousSession
/**
* 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();
}
示例8: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* Check input? */
if ($this->request['do'] == 'check') {
/* Check Directory */
if (!is_array($_POST['apps']) or !count($_POST['apps'])) {
$this->registry->output->addError('You must select to install at least one application');
} else {
/* Save Form Data */
IPSSetUp::setSavedData('install_apps', implode(',', array_keys($_POST['apps'])));
/* Check writeable files */
foreach (array_keys($_POST['apps']) as $appDir) {
$info = IPSSetUp::fetchXmlAppWriteableFiles($appDir);
if (count($info['notexist'])) {
foreach ($info['notexist'] as $path) {
$this->registry->output->addWarning('File or directory does not exist: "' . $path . '", please create it via FTP');
}
}
if (count($info['notwrite'])) {
foreach ($info['notwrite'] as $path) {
$this->registry->output->addWarning('File or directory is not writeable: "' . $path . '", please CHMOD via FTP');
}
}
/**
* Custom errors
*/
if (count($info['other'])) {
foreach ($info['other'] as $error) {
$this->registry->output->addWarning($error);
}
}
}
/* Do we have errors? */
if (!count($this->registry->output->fetchWarnings())) {
/* Next Action */
$this->registry->autoLoadNextAction('address');
}
}
}
/* Generate apps... */
$apps = array('core' => array(), 'ips' => array(), 'other' => array());
foreach (array('applications', 'applications_addon/ips', 'applications_addon/other') as $_pBit) {
$path = IPS_ROOT_PATH . $_pBit;
$handle = opendir($path);
while (($file = readdir($handle)) !== FALSE) {
if (!preg_match("#^\\.#", $file)) {
if (is_dir($path . '/' . $file)) {
//-----------------------------------------
// Get it!
//-----------------------------------------
if (!is_file(IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml')) {
continue;
}
$data = IPSSetUp::fetchXmlAppInformation($file, $this->settings['gb_char_set']);
switch ($_pBit) {
case 'applications':
$apps['core'][$file] = $data;
break;
case 'applications_addon/ips':
$apps['ips'][$file] = $data;
break;
case 'applications_addon/other':
$apps['other'][$file] = $data;
break;
}
}
}
}
closedir($handle);
}
/* We don't want IP.SEO to be installed on future versions. Bad things happen. */
unset($apps['ips']['ipseo']);
unset($apps['other']['ipseo']);
/* Reorder the array so that core is first */
$new_array = array();
$new_array['core'] = $apps['core']['core'];
foreach ($apps['core'] as $app => $data) {
if ($app == 'core') {
continue;
}
$new_array[$app] = $data;
}
$apps['core'] = $new_array;
/* Page Output */
$this->registry->output->setTitle("Applications");
$this->registry->output->setNextAction('apps&do=check');
$this->registry->output->addContent($this->registry->output->template()->page_apps($apps));
$this->registry->output->sendOutput();
}
示例9: CLIOutput
//-----------------------------------------
// Set Configuration
//-----------------------------------------
IPSSetUp::setSavedData('install_apps', $_SERVER['argv'][1]);
IPSSetUp::setSavedData('install_dir', $_SERVER['argv'][2]);
IPSSetUp::setSavedData('install_url', $_SERVER['argv'][3]);
IPSSetUp::setSavedData('lkey', $_SERVER['argv'][4]);
IPSSetUp::setSavedData('sql_driver', 'mysql');
IPSSetUp::setSavedData('db_host', $_SERVER['argv'][5]);
IPSSetUp::setSavedData('db_name', $_SERVER['argv'][6]);
IPSSetUp::setSavedData('db_user', $_SERVER['argv'][7]);
IPSSetUp::setSavedData('db_pass', $_SERVER['argv'][8]);
IPSSetUp::setSavedData('db_pre', '');
IPSSetUp::setSavedData('admin_user', $_SERVER['argv'][9]);
IPSSetUp::setSavedData('admin_pass', $_SERVER['argv'][10]);
IPSSetUp::setSavedData('admin_email', $_SERVER['argv'][11]);
/* Write it */
IPSInstall::writeConfiguration();
//-----------------------------------------
// Install
//-----------------------------------------
file_get_contents("http://license.invisionpower.com/?a=activate&key={$_SERVER['argv'][4]}&url={$_SERVER['argv'][3]}");
file_put_contents("../../../cache/installer_lock.php", "AUTOINSTALLED");
require_once IPS_ROOT_PATH . 'setup/applications/install/sections/install.php';
/*noLibHook*/
$controller = new install_install();
$output = new CLIOutput($steps, $controller);
$registry->setClass('output', $output);
$controller->makeRegistryShortcuts($registry);
$output->setNextAction('do=sql');
$output->sendOutput();
示例10: convert_polls
function convert_polls()
{
$start = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
$lend = 50;
$end = $start + $lend;
$max = intval(IPSSetUp::getSavedData('max'));
$converted = intval(IPSSetUp::getSavedData('conv'));
//-----------------------------------------
// First off.. grab number of polls to convert
//-----------------------------------------
if (!$max) {
$total = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as max', 'from' => 'topics', 'where' => "poll_state IN ('open', 'close', 'closed')"));
$max = $total['max'];
}
//-----------------------------------------
// In steps...
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'topics', 'where' => "poll_state IN ('open', 'close', 'closed' )", 'limit' => array(0, $lend)));
$o = $this->DB->execute();
//-----------------------------------------
// Do it...
//-----------------------------------------
if ($this->DB->getTotalRows($o)) {
//-----------------------------------------
// Got some to convert!
//-----------------------------------------
while ($r = $this->DB->fetch($o)) {
$converted++;
//-----------------------------------------
// All done?
//-----------------------------------------
if ($converted >= $max) {
$done = 1;
}
$new_poll = array(1 => array());
$poll_data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'polls', 'where' => "tid=" . $r['tid']));
if (!$poll_data['pid']) {
continue;
}
if (!$poll_data['poll_question']) {
$poll_data['poll_question'] = $r['title'];
}
//-----------------------------------------
// Kick start new poll
//-----------------------------------------
$new_poll[1]['question'] = $poll_data['poll_question'];
//-----------------------------------------
// Get OLD polls
//-----------------------------------------
$poll_answers = unserialize(stripslashes($poll_data['choices']));
reset($poll_answers);
foreach ($poll_answers as $entry) {
$id = $entry[0];
$choice = $entry[1];
$votes = $entry[2];
$total_votes += $votes;
if (strlen($choice) < 1) {
continue;
}
$new_poll[1]['choice'][$id] = $choice;
$new_poll[1]['votes'][$id] = $votes;
}
//-----------------------------------------
// Got something?
//-----------------------------------------
if (count($new_poll[1]['choice'])) {
$this->DB->update('polls', array('choices' => serialize($new_poll)), 'tid=' . $r['tid']);
$this->DB->update('topics', array('poll_state' => 1), 'tid=' . $r['tid']);
}
}
} else {
$done = 1;
}
if (!$done) {
$this->registry->output->addMessage("Polls: {$start} to {$end} completed....");
$this->request['workact'] = 'polls';
$this->request['st'] = $end;
IPSSetUp::setSavedData('max', $max);
IPSSetUp::setSavedData('conv', $converted);
return FALSE;
} else {
$this->registry->output->addMessage("Polls converted, proceeding to calendar events...");
$this->request['workact'] = 'calevents';
$this->request['st'] = '0';
return FALSE;
}
}
示例11: step_11
function step_11()
{
$this->DB->return_die = 1;
$start = intval($this->request['st']) ? intval($this->request['st']) : 0;
$lend = 300;
$end = $start + $lend;
$max = 0;
$this->DB->build(array('select' => 'id', 'from' => 'members', 'where' => "id > {$end}"));
$this->DB->execute();
$max = $this->DB->fetch();
$o = $this->DB->query($this->sql_members_converge($start, $end));
$found = 0;
//-----------------------------------------
// Do it...
//-----------------------------------------
while ($r = $this->DB->fetch($o)) {
if (!$r['cid'] or !$r['id']) {
$r['password'] = $r['password'] ? $r['password'] : $r['legacy_password'];
$salt = IPSMember::generatePasswordSalt(5);
$salt = str_replace('\\', "\\\\", $salt);
$this->DB->insert('members_converge', array('converge_id' => $r['id'], 'converge_email' => strtolower($r['email']), 'converge_joined' => $r['joined'], 'members_pass_hash' => md5(md5($salt) . $r['password']), 'members_pass_salt' => $salt));
$member_login_key = IPSMember::generateAutoLoginKey();
$this->DB->update('members', array('member_login_key' => $member_login_key, 'email' => strtolower($r['email'])), 'id=' . $r['id']);
if ($r['id'] == IPSSetUp::getSavedData('mid')) {
// Reset loginkey
IPSSetUp::setSavedData('loginkey', $member_login_key);
$this->member->setProperty('member_login_key', $member_login_key);
IPSSetUp::setSavedData('securekey', $this->member->form_hash);
}
}
$found++;
}
if (!$found and !$max['id']) {
$this->registry->output->addMessage("Converge completed, converting personal messages...");
$this->request['workact'] = 'step_12';
$this->request['st'] = 0;
} else {
$this->request['st'] = $end;
$this->registry->output->addMessage("Converge added: {$start} to {$end} completed....");
$this->request['workact'] = 'step_11';
}
}
示例12: install_settings
/**
* Installs Settings schematic
*
* @return void
*/
public function install_settings()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
//-----------------------------------------
// Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, '{app}_settings.xml', $this->settings['gb_char_set']);
//-----------------------------------------
// Install settings
//-----------------------------------------
if ($next['key']) {
$output[] = $next['title'] . ": Обновление настроек";
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
if (is_file($_PATH . $next['key'] . '_settings.xml')) {
//-----------------------------------------
// Continue
//-----------------------------------------
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/settings/settings.php';
/*noLibHook*/
$settings = new admin_core_settings_settings();
$settings->makeRegistryShortcuts($this->registry);
$this->request['app_dir'] = $next['key'];
//-----------------------------------------
// Known settings
//-----------------------------------------
if (substr(IPSSetUp::getSavedData('install_url'), -1) == '/') {
IPSSetUp::setSavedData('install_url', substr(IPSSetUp::getSavedData('install_url'), 0, -1));
}
if (substr(IPSSetUp::getSavedData('install_dir'), -1) == '/') {
IPSSetUp::setSavedData('install_dir', substr(IPSSetUp::getSavedData('install_dir'), 0, -1));
}
/* Fetch known settings */
$knownSettings = array();
if (is_file(IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php')) {
require IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php';
/*noLibHook*/
}
$settings->importAllSettings(1, 1, $knownSettings);
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Обновление: Настройки для " . $next['title'], 'upgrade&do=settings&previous=' . $next['key']);
} else {
//-----------------------------------------
// Next...
//-----------------------------------------
$output[] = "Все настройки обновлены";
$this->_finishStep($output, "Обновление: Настройки", 'upgrade&do=templates');
}
}
示例13: install_settings
/**
* Installs Settings schematic
*
* @return void
*/
public function install_settings()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
//-----------------------------------------
// Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, '{app}_settings.xml', $this->settings['gb_char_set']);
/* Set up DB driver */
$extra_install = $this->_setUpDBDriver(FALSE);
//-----------------------------------------
// Install settings
//-----------------------------------------
if ($next['key']) {
$output[] = $next['title'] . ": Добавление настроек";
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
$knownSettings = array();
if (is_file($_PATH . $next['key'] . '_settings.xml')) {
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('settings');
}
//-----------------------------------------
// Continue
//-----------------------------------------
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/settings/settings.php';
/*noLibHook*/
$settings = new admin_core_settings_settings();
$settings->makeRegistryShortcuts($this->registry);
$this->request['app_dir'] = $next['key'];
//-----------------------------------------
// Known settings
//-----------------------------------------
if (substr(IPSSetUp::getSavedData('install_url'), -1) == '/') {
IPSSetUp::setSavedData('install_url', substr(IPSSetUp::getSavedData('install_url'), 0, -1));
}
if (substr(IPSSetUp::getSavedData('install_dir'), -1) == '/') {
IPSSetUp::setSavedData('install_dir', substr(IPSSetUp::getSavedData('install_dir'), 0, -1));
}
/* Fetch known settings */
if (is_file(IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php')) {
require IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php';
/*noLibHook*/
}
$this->request['app_dir'] = $next['key'];
$settings->importAllSettings(1, 1, $knownSettings);
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('settings');
}
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Установка: Настройки", 'install&do=settings&previous=' . $next['key']);
} else {
//-----------------------------------------
// Next...
//-----------------------------------------
$output[] = "Настройки добавлены";
$this->_finishStep($output, "Установка: Настройки", 'install&do=templates');
}
}
示例14: doExecute
/**
* 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();
//.........这里部分代码省略.........
示例15: install_settings
/**
* Installs Settings schematic
*
* @return void
*/
public function install_settings()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
//-----------------------------------------
// Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, '{app}_settings.xml');
//-----------------------------------------
// Install settings
//-----------------------------------------
if ($next['key']) {
$output[] = $next['title'] . ": Upgrading settings...";
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
if (file_exists($_PATH . $next['key'] . '_settings.xml')) {
//-----------------------------------------
// Continue
//-----------------------------------------
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/tools/settings.php';
$settings = new admin_core_tools_settings();
$settings->makeRegistryShortcuts($this->registry);
$this->request['app_dir'] = $next['key'];
//-----------------------------------------
// Known settings
//-----------------------------------------
if (substr(IPSSetUp::getSavedData('install_url'), -1) == '/') {
IPSSetUp::setSavedData('install_url', substr(IPSSetUp::getSavedData('install_url'), 0, -1));
}
if (substr(IPSSetUp::getSavedData('install_dir'), -1) == '/') {
IPSSetUp::setSavedData('install_dir', substr(IPSSetUp::getSavedData('install_dir'), 0, -1));
}
/* Fetch known settings */
if (file_exists(IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php')) {
require IPSLib::getAppDir($next['key']) . '/setup/versions/install/knownSettings.php';
}
$settings->importAllSettings(1, 1, $knownSettings);
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Upgrade: " . $next['title'] . " Settings", 'upgrade&do=settings&previous=' . $next['key']);
} else {
//-----------------------------------------
// Next...
//-----------------------------------------
$output[] = "All settings upgraded";
$this->_finishStep($output, "Upgrade: Settings", 'upgrade&do=templates');
}
}