/** * Builds the upgader page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/100To110/templates'); $tpl->SetBlock('100To110'); $tpl->setVariable('lbl_info', _t('UPGRADE_VER_INFO', '1.0.0', '1.1.0')); $tpl->setVariable('lbl_notes', _t('UPGRADE_VER_NOTES')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $tpl->ParseBlock('100To110'); return $tpl->Get(); }
/** * Builds the upgrader page. * * @access public * @return string A block of valid XHTML to display the status of old/current jaws versions */ function Display() { include_once JAWS_PATH . 'include/Jaws/DB.php'; $objDatabase = Jaws_DB::getInstance('default', $_SESSION['upgrade']['Database']); require_once JAWS_PATH . 'include/Jaws.php'; $GLOBALS['app'] = jaws(); if (!isset($_SESSION['upgrade']['InstalledVersion'])) { $_SESSION['upgrade']['InstalledVersion'] = $GLOBALS['app']->Registry->Init(); } $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false); $supportedversions = array(array('version' => '1.2.0', 'stage' => '9'), array('version' => '1.1.1', 'stage' => '8'), array('version' => '1.1.0', 'stage' => '7'), array('version' => '1.0.0', 'stage' => '6'), array('version' => '0.9.3', 'stage' => null), array('version' => '0.9.2', 'stage' => null), array('version' => '0.9.1', 'stage' => null), array('version' => '0.9.0', 'stage' => null)); _log(JAWS_LOG_DEBUG, "Checking/Reporting previous missed installations"); $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Report/templates'); $tpl->SetBlock('Report'); $tpl->setVariable('lbl_info', _t('UPGRADE_REPORT_INFO', JAWS_VERSION)); $tpl->setVariable('lbl_message', _t('UPGRADE_REPORT_MESSAGE')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $versions_to_upgrade = 0; $_SESSION['upgrade']['stagedVersions'] = array(); foreach ($supportedversions as $supported) { $tpl->SetBlock('Report/versions'); $tpl->SetBlock('Report/versions/version'); $tpl->SetVariable('description', $supported['version']); $_SESSION['upgrade']['versions'][$supported['version']] = array('version' => $supported['version'], 'stage' => $supported['stage'], 'file' => isset($supported['file']) ? $supported['file'] : '', 'script' => isset($supported['script']) ? $supported['script'] : ''); if (version_compare($supported['version'], $_SESSION['upgrade']['InstalledVersion'], '<=')) { if ($supported['version'] == JAWS_VERSION) { $tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED_CURRENT')); _log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade(is current)"); } else { $tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED')); _log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade"); } $_SESSION['upgrade']['versions'][$supported['version']]['status'] = true; } else { $tpl->SetVariable('status', _t('UPGRADE_REPORT_NEED')); $_SESSION['upgrade']['versions'][$supported['version']]['status'] = false; $versions_to_upgrade++; _log(JAWS_LOG_DEBUG, $supported['version'] . " requires upgrade"); $_SESSION['upgrade']['versions'][$supported['version']]['status'] = false; } if (!is_null($supported['stage'])) { $_SESSION['upgrade']['stagedVersions'][] = $supported['version']; } $tpl->ParseBlock('Report/versions/version'); $tpl->ParseBlock('Report/versions'); } $_SESSION['upgrade']['versions_to_upgrade'] = $versions_to_upgrade; arsort($_SESSION['upgrade']['versions']); krsort($_SESSION['upgrade']['stagedVersions']); $tpl->ParseBlock('Report'); return $tpl->Get(); }
/** * Builds the installer page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Finished/templates'); $tpl->SetBlock('Finished'); $base_url = Jaws_Utils::getBaseURL('', true); $tpl->setVariable('lbl_info', _t('INSTALL_FINISH_INFO')); $tpl->setVariable('lbl_choices', _t('INSTALL_FINISH_CHOICES', "{$base_url}/", "{$base_url}/admin.php")); $tpl->setVariable('lbl_thanks', _t('INSTALL_FINISH_THANKS')); $tpl->SetVariable('move_log', _t('INSTALL_FINISH_MOVE_LOG')); $tpl->ParseBlock('Finished'); // Kill the session session_destroy(); return $tpl->Get(); }
/** * Builds the upgrader page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { require_once JAWS_PATH . 'include/Jaws.php'; $GLOBALS['app'] = jaws(); $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false); $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Finished/templates'); $tpl->SetBlock('Finished'); $base_url = $GLOBALS['app']->getSiteURL(); $tpl->setVariable('lbl_info', _t('UPGRADE_FINISH_INFO')); $tpl->setVariable('lbl_choices', _t('UPGRADE_FINISH_CHOICES', "{$base_url}/", "{$base_url}/admin.php")); $tpl->setVariable('lbl_thanks', _t('UPGRADE_FINISH_THANKS')); $tpl->SetVariable('move_log', _t('UPGRADE_FINISH_MOVE_LOG')); $tpl->ParseBlock('Finished'); return $tpl->Get(); }
/** * Builds the installer page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { $values = $this->_Fields; $keys = array_keys($values); $request = Jaws_Request::getInstance(); $post = $request->fetch($keys, 'post'); foreach ($this->_Fields as $key => $value) { if ($post[$key] !== null) { $values[$key] = $post[$key]; } } $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/CreateUser/templates'); $tpl->SetBlock('CreateUser'); $tpl->setVariable('lbl_info', _t('INSTALL_USER_INFO')); $tpl->setVariable('lbl_notice', _t('INSTALL_USER_NOTICE')); $tpl->setVariable('lbl_user', _t('INSTALL_USER_USER')); $tpl->setVariable('user_info', _t('INSTALL_USER_USER_INFO')); $tpl->setVariable('lbl_pass', _t('INSTALL_USER_PASS')); $tpl->setVariable('lbl_repeat', _t('INSTALL_USER_REPEAT')); $tpl->setVariable('repeat_info', _t('INSTALL_USER_REPEAT_INFO')); $tpl->setVariable('lbl_nickname', _t('INSTALL_USER_NAME')); $tpl->setVariable('name_info', _t('INSTALL_USER_NAME_INFO')); $tpl->setVariable('lbl_email', _t('INSTALL_USER_EMAIL')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); if ($_SESSION['secure']) { $JCrypt = Jaws_Crypt::getInstance(array('pvt_key' => $_SESSION['pvt_key'], 'pub_key' => $_SESSION['pub_key'])); if (!Jaws_Error::IsError($JCrypt)) { $tpl->SetVariable('length', $JCrypt->length()); $tpl->SetVariable('modulus', $JCrypt->modulus()); $tpl->SetVariable('exponent', $JCrypt->exponent()); $tpl->SetVariable('func_onsubmit', 'EncryptPassword(this)'); } else { $_SESSION['secure'] = false; $tpl->SetVariable('func_onsubmit', 'true'); } } else { $tpl->SetVariable('func_onsubmit', 'true'); } $tpl->SetVariable('username', $values['username']); $tpl->SetVariable('password', ''); $tpl->SetVariable('repeat', ''); $tpl->SetVariable('nickname', $values['nickname']); $tpl->SetVariable('email', $values['email']); $tpl->ParseBlock('CreateUser'); return $tpl->Get(); }
/** * Builds the upgrader page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { // Create application include_once JAWS_PATH . 'include/Jaws.php'; $GLOBALS['app'] = jaws(); $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false); $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/WriteConfig/templates'); _log(JAWS_LOG_DEBUG, "Preparing configuaration file"); $tpl->SetBlock('WriteConfig'); $config_path = JAWS_PATH . 'config' . DIRECTORY_SEPARATOR; $tpl->setVariable('lbl_info', _t('UPGRADE_CONFIG_INFO')); $tpl->setVariable('lbl_solution', _t('UPGRADE_CONFIG_SOLUTION')); $tpl->setVariable('lbl_solution_permission', _t('UPGRADE_CONFIG_SOLUTION_PERMISSION', $config_path)); $tpl->setVariable('lbl_solution_upload', _t('UPGRADE_CONFIG_SOLUTION_UPLOAD', $config_path . 'JawsConfig.php')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $tpl->SetVariable('config', $this->BuildConfig()); $tpl->ParseBlock('WriteConfig'); return $tpl->Get(); }
/** * Builds the installer page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { _log(JAWS_LOG_DEBUG, "Preparing configuration file"); $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/WriteConfig/templates'); $tpl->SetBlock('WriteConfig'); $config_path = JAWS_PATH . 'config' . DIRECTORY_SEPARATOR; $tpl->setVariable('lbl_info', _t('INSTALL_CONFIG_INFO')); $tpl->setVariable('lbl_solution', _t('INSTALL_CONFIG_SOLUTION')); $tpl->setVariable('lbl_solution_permission', _t('INSTALL_CONFIG_SOLUTION_PERMISSION', $config_path)); $tpl->setVariable('lbl_solution_upload', _t('INSTALL_CONFIG_SOLUTION_UPLOAD', $config_path . 'JawsConfig.php')); $tpl->SetVariable('lbl_loglevel', _t('INSTALL_CONFIG_LOGLEVEL')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $request = Jaws_Request::getInstance(); $loglevel = $request->fetch('loglevel', 'post'); $loglevel = is_null($loglevel) ? JAWS_LOG_ERROR : (int) $loglevel; $_SESSION['install']['LogLevel'] = $loglevel; $tpl->SetVariable('config', $this->BuildConfig()); $log_levels_messages = $GLOBALS['log']->_Log_Priority_Str; array_unshift($log_levels_messages, 'LOG_DISABLED'); foreach ($log_levels_messages as $level => $title) { $tpl->SetBlock('WriteConfig/loglevel'); $tpl->setVariable('level', $level); $tpl->setVariable('title', $title); $tpl->SetVariable('selected', $level == $loglevel ? 'selected="selected"' : ''); $tpl->ParseBlock('WriteConfig/loglevel'); } $tpl->ParseBlock('WriteConfig'); return $tpl->Get(); }
/** * Builds the upgrader page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { // Create application include_once JAWS_PATH . 'include/Jaws.php'; $GLOBALS['app'] = jaws(); $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false); $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Cleanup/templates'); _log(JAWS_LOG_DEBUG, "Preparing cleanup stage"); $tpl->SetBlock('cleanup'); $tpl->setVariable('lbl_info', _t('UPGRADE_CLEANUP_INFO')); $cleanup_required = false; $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/folders.txt'); $cleanup_items = array_filter(explode("\n", $cleanup_items)); foreach ($cleanup_items as $item) { if (file_exists(JAWS_PATH . $item)) { $cleanup_required = true; $tpl->SetBlock('cleanup/item'); $tpl->setVariable('type', '1'); $tpl->setVariable('item_path', $item); $tpl->ParseBlock('cleanup/item'); } } $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/files.txt'); $cleanup_items = array_filter(explode("\n", $cleanup_items)); foreach ($cleanup_items as $item) { if (file_exists(JAWS_PATH . $item)) { $cleanup_required = true; $tpl->SetBlock('cleanup/item'); $tpl->setVariable('type', '0'); $tpl->setVariable('item_path', $item); $tpl->ParseBlock('cleanup/item'); } } if (!$cleanup_required) { $tpl->SetBlock('cleanup/not_required'); $tpl->setVariable('message', _t('UPGRADE_CLEANUP_NOT_REQUIRED')); $tpl->ParseBlock('cleanup/not_required'); } $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $tpl->ParseBlock('cleanup'); return $tpl->Get(); }
/** * Builds the upgrader page stage * * @access public * @return string A block of valid XHTML to display the requirements */ function Display() { $tpl = new Jaws_Template(false, false); $tpl->load('display.html', 'stages/Requirements/templates'); $tpl->setBlock('Requirements'); $tpl->setVariable('requirements', _t('UPGRADE_REQUIREMENTS')); $tpl->setVariable('requirement', _t('UPGRADE_REQ_REQUIREMENT')); $tpl->setVariable('optional', _t('UPGRADE_REQ_OPTIONAL')); $tpl->setVariable('recommended', _t('UPGRADE_REQ_RECOMMENDED')); $tpl->setVariable('directive', _t('UPGRADE_REQ_DIRECTIVE')); $tpl->setVariable('actual', _t('UPGRADE_REQ_ACTUAL')); $tpl->setVariable('result', _t('UPGRADE_REQ_RESULT')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $modules = get_loaded_extensions(); $modules = array_map('strtolower', $modules); _log(JAWS_LOG_DEBUG, "Checking requirements..."); // PHP version $tpl->setBlock('Requirements/req_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_PHP_VERSION')); $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_GREATER_THAN', MIN_PHP_VERSION)); $tpl->setVariable('item_actual', phpversion()); if (version_compare(phpversion(), MIN_PHP_VERSION, ">=") == 1) { _log(JAWS_LOG_DEBUG, "PHP installed version looks ok (>= " . MIN_PHP_VERSION . ")"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "PHP installed version (" . phpversion() . ") is not supported"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/req_item'); // config directory $tpl->setBlock('Requirements/req_item'); $result = $this->_check_path('config', 'r'); $tpl->setVariable('item', _t('UPGRADE_REQ_DIRECTORY', 'config')); $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_READABLE')); $tpl->setVariable('item_actual', $this->_get_perms('config')); if ($result) { _log(JAWS_LOG_DEBUG, "config directory has read-permission privileges"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "config directory doesn't have read-permission privileges"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/req_item'); // data directory $tpl->setBlock('Requirements/req_item'); $result = $this->_check_path('data', 'rw'); $tpl->setVariable('item', _t('UPGRADE_REQ_DIRECTORY', 'data')); $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_WRITABLE')); $tpl->setVariable('item_actual', $this->_get_perms('data')); if ($result) { _log(JAWS_LOG_DEBUG, "data directory has read and write permission privileges"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "data directory doesn't have read and write permission privileges"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/req_item'); // Database drivers $tpl->setBlock('Requirements/req_item'); $tpl->setVariable('item', implode('<br/>', $this->_db_drivers)); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $actual = ''; $db_state = false; foreach (array_keys($this->_db_drivers) as $ext) { $db_state = $db_state || in_array($ext, $modules); $actual .= (!empty($actual) ? '<br />' : '') . (in_array($ext, $modules) ? $ext : '-----'); } $tpl->setVariable('item_actual', $actual); if ($db_state) { _log(JAWS_LOG_DEBUG, "Available database drivers: {$actual}"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "No database driver found"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/req_item'); // XML extension $tpl->setBlock('Requirements/req_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'XML')); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $tpl->setVariable('item_actual', in_array('xml', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO')); if (in_array('xml', $modules)) { _log(JAWS_LOG_DEBUG, "xml support is enabled"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "xml support is not enabled"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/req_item'); // File Upload $tpl->setBlock('Requirements/rec_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_FILE_UPLOAD')); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $check = (bool) ini_get('file_uploads'); $tpl->setVariable('item_actual', $check ? _t('GLOBAL_YES') : _t('GLOBAL_NO')); if ($check) { _log(JAWS_LOG_DEBUG, "PHP accepts file uploads"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "PHP doesn't accept file uploads"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/rec_item'); // Safe mode $tpl->setBlock('Requirements/rec_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_SAFE_MODE')); $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_OFF')); $safe_mode = (bool) ini_get('safe_mode'); $tpl->setVariable('item_actual', $safe_mode ? _t('UPGRADE_REQ_ON') : _t('UPGRADE_REQ_OFF')); if ($safe_mode) { _log(JAWS_LOG_DEBUG, "PHP has safe-mode turned on"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "PHP has safe-mode turned off"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/rec_item'); // GD/ImageMagick $tpl->setBlock('Requirements/rec_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'GD/ImageMagick')); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $actual = in_array('gd', $modules) ? 'GD' : ''; $actual .= in_array('magickwand', $modules) ? (empty($actual) ? '' : ' + ') . 'ImageMagick' : ''; $actual = empty($actual) ? 'No' : $actual; $tpl->setVariable('item_actual', $actual); if (in_array('gd', $modules) || in_array('magickwand', $modules)) { _log(JAWS_LOG_DEBUG, "PHP has GD or ImageMagick turned on"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "PHP has GD or ImageMagick turned off"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/rec_item'); // Exif extension $tpl->setBlock('Requirements/rec_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'Exif')); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $tpl->setVariable('item_actual', in_array('exif', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO')); if (in_array('exif', $modules)) { _log(JAWS_LOG_DEBUG, "exif support is enabled"); $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "exif support is not enabled"); $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/rec_item'); // OpenSSL extension $tpl->setBlock('Requirements/rec_item'); $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'OpenSSL')); $tpl->setVariable('item_requirement', _t('GLOBAL_YES')); $tpl->setVariable('item_actual', in_array('openssl', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO')); if (in_array('openssl', $modules)) { _log(JAWS_LOG_DEBUG, "openssl extension is loaded"); $result_txt = '<span style="color: #0b0;">' . _t('INSTALL_REQ_OK') . '</span>'; } else { _log(JAWS_LOG_DEBUG, "openssl extension is not loaded"); $result_txt = '<span style="color: #b00;">' . _t('INSTALL_REQ_BAD') . '</span>'; } $tpl->setVariable('result', $result_txt); $tpl->parseBlock('Requirements/rec_item'); $tpl->parseBlock('Requirements'); return $tpl->get(); }
/** * Builds the upgrader page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { // Get values $values = $this->_Defaults; foreach ($this->_Defaults as $name => $value) { if (isset($_SESSION['upgrade']['Database'][$name])) { $values[$name] = $_SESSION['upgrade']['Database'][$name]; } } $data = array(); if (isset($_SESSION['upgrade']['data']['Database'])) { $data = $_SESSION['upgrade']['data']['Database']; } $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Database/templates'); $tpl->SetBlock('Database'); $tpl->setVariable('db_info', _t('UPGRADE_DB_INFO')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); if ($_SESSION['secure']) { $JCrypt = Jaws_Crypt::getInstance(array('pvt_key' => $_SESSION['pvt_key'], 'pub_key' => $_SESSION['pub_key'])); if (!Jaws_Error::IsError($JCrypt)) { $tpl->SetVariable('length', $JCrypt->length()); $tpl->SetVariable('modulus', $JCrypt->modulus()); $tpl->SetVariable('exponent', $JCrypt->exponent()); $tpl->SetVariable('func_onsubmit', 'EncryptPassword(this)'); } else { $_SESSION['secure'] = false; $tpl->SetVariable('func_onsubmit', 'true'); } } else { $_SESSION['pub_key'] = ''; $_SESSION['pvt_key'] = ''; $tpl->SetVariable('func_onsubmit', 'true'); } $fields = 0; if (!isset($data['host'])) { $fields++; $tpl->SetBlock('Database/host'); $tpl->setVariable('lbl_host', _t('UPGRADE_DB_HOST')); $tpl->setVariable('host_info', _t('UPGRADE_DB_HOST_INFO', 'localhost')); $tpl->SetVariable('host', $values['host']); $tpl->ParseBlock('Database/host'); } if (!isset($data['user'])) { $fields++; $tpl->SetBlock('Database/user'); $tpl->setVariable('lbl_user', _t('UPGRADE_DB_USER')); $tpl->setVariable('is_db_admin', _t('UPGRADE_DB_IS_ADMIN')); $tpl->SetVariable('user', $values['user']); $tpl->SetVariable('isdba_checked', empty($values['isdba']) || $values['isdba'] == 'false' ? '' : 'checked="checked"'); $tpl->ParseBlock('Database/user'); } if (!isset($data['password'])) { $fields++; $tpl->SetBlock('Database/password'); $tpl->setVariable('lbl_pass', _t('UPGRADE_DB_PASS')); $tpl->SetVariable('dbpass', ''); $tpl->ParseBlock('Database/password'); } if (!isset($data['name'])) { $fields++; $tpl->SetBlock('Database/name'); $tpl->setVariable('lbl_db_name', _t('UPGRADE_DB_NAME')); $tpl->SetVariable('name', $values['name']); $tpl->ParseBlock('Database/name'); } if (!isset($data['path'])) { $fields++; $tpl->SetBlock('Database/path'); $tpl->setVariable('lbl_db_path', _t('UPGRADE_DB_PATH')); $tpl->setVariable('path_info', _t('UPGRADE_DB_PATH_INFO')); $tpl->SetVariable('path', $values['path']); $tpl->ParseBlock('Database/path'); } if (!isset($data['port'])) { $fields++; $tpl->SetBlock('Database/port'); $tpl->setVariable('lbl_port', _t('UPGRADE_DB_PORT')); $tpl->setVariable('port_info', _t('UPGRADE_DB_PORT_INFO')); $tpl->SetVariable('port', $values['port']); $tpl->ParseBlock('Database/port'); } if (!isset($data['prefix'])) { $fields++; $tpl->SetBlock('Database/prefix'); $tpl->setVariable('lbl_prefix', _t('UPGRADE_DB_PREFIX')); $tpl->setVariable('prefix_info', _t('UPGRADE_DB_PREFIX_INFO')); $tpl->SetVariable('prefix', $values['prefix']); $tpl->ParseBlock('Database/prefix'); } // drivers if (!isset($data['driver'])) { $fields++; $tpl->SetBlock('Database/drivers'); $tpl->setVariable('lbl_driver', _t('UPGRADE_DB_DRIVER')); $drivers = array('mysqli' => array('ext' => 'mysqli', 'title' => 'MySQLi (4.1.3 and above)'), 'mysql' => array('ext' => 'mysql', 'title' => 'MySQL'), 'pgsql' => array('ext' => 'pgsql', 'title' => 'PostgreSQL'), 'oci8' => array('ext' => 'oci8', 'title' => 'Oracle'), 'mssql' => array('ext' => 'mssql', 'title' => 'MSSQL Server'), 'sqlsrv' => array('ext' => 'sqlsrv', 'title' => 'MSSQL Server(Microsoft Driver)'), 'ibase' => array('ext' => 'interbase', 'title' => 'Interbase/Firebird')); $modules = get_loaded_extensions(); $modules = array_map('strtolower', $modules); foreach ($drivers as $driver => $driver_info) { _log(JAWS_LOG_DEBUG, "Checking if " . $driver_info['title'] . "(" . $driver_info['ext'] . ") driver is available"); if (!in_array($driver_info['ext'], $modules)) { $available = false; //However... mssql support exists in some Linux distros with the sybase package if ($driver_info['ext'] == 'mssql' && function_exists('mssql_connect')) { $available = true; } if ($available === false) { _log(JAWS_LOG_DEBUG, "Driver " . $driver_info['title'] . "(" . $driver_info['ext'] . ") is NOT available"); continue; } } _log(JAWS_LOG_DEBUG, "Driver " . $driver_info['title'] . "(" . $driver_info['ext'] . ") is available"); $tpl->setBlock('Database/drivers/driver'); $tpl->setVariable('d_name', $driver); $tpl->setVariable('d_realname', $driver_info['title']); if (!empty($values['driver']) && $values['driver'] == $driver) { $selected = ' selected="selected"'; } else { $selected = ''; } $tpl->setVariable('d_selected', $selected); $tpl->ParseBlock('Database/drivers/driver'); } $tpl->ParseBlock('Database/drivers'); } if ($fields === 0 && !isset($GLOBALS['message'])) { $_SESSION['upgrade']['Database']['skip'] = '1'; header('Location: index.php'); } $tpl->ParseBlock('Database'); return $tpl->Get(); }
/** * Shows a given month/year */ function ShowMonth($month, $year = null) { if (empty($year)) { $year = $this->Today['year']; } $tpl = new Jaws_Template(); $tpl->Load('Calendar.html', $this->_TemplateDir); $tpl->SetBlock('calendar'); $tpl->setVariable('title', _t('BLOG_LAYOUT_CALENDAR')); $objDate = Jaws_Date::getInstance(); // Obtain first week day of month $date = $objDate->GetDateInfo($year, $month, 1, 12, 0, 0); $first = $date['wday']; if ($first == 0 && START_WEEKDAY != 0) { $first += 7; } // Move to date to first week day. $date = $objDate->GetDateInfo($year, $month, START_WEEKDAY + 1 - $first, 12, 0, 0); // type cast to int $date['year'] = (int) $date['year']; $date['mon'] = (int) $date['mon']; $date['mday'] = (int) $date['mday']; // Set header if (isset($this->Arrow['left'])) { $left_arrow = '<a href="' . $this->Arrow['left']['url'] . '">' . $this->Arrow['left']['text'] . '</a>'; $tpl->setVariable('left_arrow', $left_arrow); } if ($this->Arrow['right']) { $right_arrow = '<a href="' . $this->Arrow['right']['url'] . '">' . $this->Arrow['right']['text'] . '</a>'; $tpl->setVariable('right_arrow', $right_arrow); } $tpl->SetVariable('month', $objDate->MonthString($month)); $tpl->SetVariable('year', $year); // weekdays $wd = START_WEEKDAY; for ($i = 0; $i <= 6; $i++) { $tpl->SetBlock('calendar/weekday'); $tpl->SetVariable('weekday', $objDate->DayShortString($wd)); $tpl->ParseBlock('calendar/weekday'); $wd < 6 ? $wd++ : ($wd = 0); } // days $end = false; while (!$end) { $tpl->SetBlock('calendar/week'); for ($iDay = 0; $iDay <= 6; $iDay++) { $tpl->SetBlock('calendar/week/day'); if ($date['mday'] == $this->Today['mday'] && $date['mon'] == $this->Today['mon'] && $date['year'] == $this->Today['year']) { $style = 'today'; } elseif ($date['mday'] == $this->Day && $date['mon'] == $this->Month && $date['year'] == $this->Year) { $style = 'selectedday'; } elseif ($date['mon'] == $month) { $style = 'day'; } else { $style = 'noday'; // TODO: Simplify this condition ;-) if (($date['mon'] > $month || $date['mon'] == 1 && $month == 12) && !($date['mon'] == 12 && $month == 1)) { $end = true; } } $tpl->SetVariable('style', $style); $url = $title = ''; // Got URL? if (isset($this->Items[$date['year']][$date['mon']][$date['mday']]['url'])) { $url = $this->Items[$date['year']][$date['mon']][$date['mday']]['url']; } if (isset($this->Items[$date['year']][$date['mon']][$date['mday']]['title'])) { $title = $this->Items[$date['year']][$date['mon']][$date['mday']]['title']; } if (!empty($url)) { $tpl->SetVariable('day', '<a href="' . $url . '" title="' . $title . '">' . $date['mday'] . '</a>'); } else { $tpl->SetVariable('day', $date['mday']); } $date = $objDate->GetDateInfo($date['year'], $date['mon'], $date['mday'] + 1, 12, 0, 0); // type cast to int $date['year'] = (int) $date['year']; $date['mon'] = (int) $date['mon']; $date['mday'] = (int) $date['mday']; $tpl->ParseBlock('calendar/week/day'); } $tpl->ParseBlock('calendar/week'); } $tpl->ParseBlock('calendar'); return $tpl->Get(); }
/** * Builds the installer page. * * @access public * @return string A block of valid XHTML to display an introduction and form. */ function Display() { $values = $this->_Fields; $keys = array_keys($values); $request = Jaws_Request::getInstance(); $post = $request->fetch($keys, 'post'); foreach ($this->_Fields as $key => $value) { if ($post[$key] !== null) { $values[$key] = $post[$key]; } } $data = array(); if (isset($_SESSION['install']['data']['Settings'])) { $data = $_SESSION['install']['data']['Settings']; } $tpl = new Jaws_Template(false, false); $tpl->Load('display.html', 'stages/Settings/templates'); $tpl->SetBlock('Settings'); $tpl->setVariable('lbl_info', _t('INSTALL_SETTINGS_INFO')); $tpl->setVariable('lbl_site_name', _t('INSTALL_SETTINGS_SITE_NAME')); $tpl->setVariable('site_name_info', _t('INSTALL_SETTINGS_SITE_NAME_INFO')); $tpl->setVariable('lbl_site_slogan', _t('INSTALL_SETTINGS_SLOGAN')); $tpl->setVariable('site_slogan_info', _t('INSTALL_SETTINGS_SLOGAN_INFO')); $tpl->setVariable('lbl_site_language', _t('INSTALL_SETTINGS_SITE_LANGUAGE')); $tpl->setVariable('site_language_info', _t('INSTALL_SETTINGS_SITE_LANGUAGE_INFO')); $tpl->setVariable('lbl_site_sample', _t('INSTALL_SETTINGS_SITE_SAMPLE')); $tpl->setVariable('site_sample_info', _t('INSTALL_SETTINGS_SITE_SAMPLE_INFO')); $tpl->SetVariable('next', _t('GLOBAL_NEXT')); $tpl->SetVariable('site_name', $values['site_name']); $tpl->SetVariable('site_slogan', $values['site_slogan']); // fill languages combo box $languages = Jaws_Utils::GetLanguagesList(); foreach ($languages as $k => $v) { $tpl->SetBlock('Settings/lang'); $tpl->setVariable('code', $k); $tpl->setVariable('title', $v); if ($values['site_language'] == $k) { $tpl->setVariable('selected', 'selected="selected"'); } else { $tpl->setVariable('selected', ''); } $tpl->ParseBlock('Settings/lang'); } $tpl->ParseBlock('Settings'); return $tpl->Get(); }
} } if (isset($GLOBALS['message'])) { switch ($GLOBALS['message']->getLevel()) { case JAWS_ERROR_INFO: $type = 'info'; break; case JAWS_ERROR_WARNING: $type = 'warning'; break; case JAWS_ERROR_ERROR: $type = 'error'; break; } $tpl->setBlock('page/message'); $tpl->setVariable('text', $GLOBALS['message']->getMessage()); $tpl->setVariable('type', $type); $tpl->parseBlock('page/message'); } $tpl->ParseBlock('page'); // Defines where the layout template should be loaded from. $direction = _t('GLOBAL_LANG_DIRECTION'); $dir = $direction == 'rtl' ? '.' . $direction : ''; // Display the layout $layout = new Jaws_Template(false, false); $layout->Load('layout.html', 'templates'); $layout->SetBlock('layout'); // Basic setup $layout->SetVariable('BASE_URL', Jaws_Utils::getBaseURL('/install/')); $layout->SetVariable('.dir', $dir); $layout->SetVariable('site-title', 'Jaws ' . JAWS_VERSION);