本文整理汇总了PHP中Installer::getTimeZoneList方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::getTimeZoneList方法的具体用法?PHP Installer::getTimeZoneList怎么用?PHP Installer::getTimeZoneList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::getTimeZoneList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authControl
public function authControl()
{
$this->disableCaching();
$this->addHeaderJavaScript('assets/js/jqBootstrapValidation.js');
$this->addHeaderJavaScript('assets/js/validate-fields.js');
$this->addHeaderJavaScript('assets/js/jstz-1.0.4.min.js');
$owner_dao = DAOFactory::getDAO('OwnerDAO');
$invite_dao = DAOFactory::getDAO('InviteDAO');
$owner = $owner_dao->getByEmail($this->getLoggedInUser());
$this->addToView('owner', $owner);
$this->addToView('notification_options', $this->notification_frequencies);
$this->addToView('tz_list', Installer::getTimeZoneList());
$this->view_mgr->addHelp('api', 'userguide/api/posts/index');
$this->view_mgr->addHelp('application_settings', 'userguide/settings/application');
$this->view_mgr->addHelp('users', 'userguide/settings/allaccounts');
$this->view_mgr->addHelp('backup', 'install/backup');
$this->view_mgr->addHelp('account', 'userguide/settings/account');
//process password change
if (isset($_POST['changepass']) && $_POST['changepass'] == 'Change password' && isset($_POST['oldpass']) && isset($_POST['pass1']) && isset($_POST['pass2'])) {
// Check their old password is correct
if (!$owner_dao->isOwnerAuthorized($this->getLoggedInUser(), $_POST['oldpass'])) {
$this->addErrorMessage("Password is incorrect.", 'password');
} elseif ($_POST['pass1'] != $_POST['pass2']) {
$this->addErrorMessage("New passwords did not match. Your password has not been changed.", 'password');
} elseif (!preg_match("/(?=.{8,})(?=.*[a-zA-Z])(?=.*[0-9])/", $_POST['pass1'])) {
$this->addErrorMessage("Your new password must be at least 8 characters and contain both numbers " . "and letters. Your password has not been changed.", 'password');
} else {
// verify CSRF token
$this->validateCSRFToken();
// Try to update the password
if ($owner_dao->updatePassword($this->getLoggedInUser(), $_POST['pass1']) < 1) {
$this->addErrorMessage("Your password has NOT been updated.", 'password');
} else {
$this->addSuccessMessage("Your password has been updated.", 'password');
}
}
}
//reset api_key
if (isset($_POST['reset_api_key']) && $_POST['reset_api_key'] == 'Reset API Key') {
$this->validateCSRFToken();
$api_key = $owner_dao->resetAPIKey($owner->id);
if (!$api_key) {
throw new Exception("Unbale to update user's api_key, something bad must have happened");
}
$this->addSuccessMessage("Your API Key has been reset! Please update your ThinkUp RSS feed subscription.", 'api_key');
$owner->api_key = $api_key;
}
// process invite
if (isset($_POST['invite']) && $_POST['invite'] == 'Create Invitation') {
// verify CSRF token
$this->validateCSRFToken();
$invite_code = substr(md5(uniqid(rand(), true)), 0, 10);
$invite_added = $invite_dao->addInviteCode($invite_code);
if ($invite_added == 1) {
//invite generated and inserted
$invite_link = Utils::getApplicationURL() . 'session/register.php?code=' . $invite_code;
$this->addSuccessMessage("Invitation created!<br />Copy this link and send it to someone you want to " . 'invite to register on your ThinkUp installation.<br /><a href="' . $invite_link . '" id="clippy_12345">' . $invite_link . '</a>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="100"
height="14"
class="clippy"
id="clippy" >
<param name="movie" value="' . Utils::getApplicationURL() . 'assets/flash/clippy.swf"/>
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param NAME="FlashVars" value="id=clippy_12345&copied=copied!&copyto=copy to clipboard">
<param name="bgcolor" value="#D5F0FC">
<param name="wmode" value="opaque">
<embed src="' . Utils::getApplicationURL() . 'assets/flash/clippy.swf"
width="100"
height="14"
name="clippy"
quality="high"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
FlashVars="id=clippy_12345&copied=copied!&copyto=copy to clipboard"
bgcolor="#dff0d8"
wmode="opaque"/></object>
<br /> Good for one new registration. Expires in 7 days.', 'invite', true);
} else {
$this->addErrorMessage("There was an error creating a new invite. Please try again.", 'invite');
}
}
//process service user deletion
if (isset($_POST['action']) && $_POST['action'] == 'Delete' && isset($_POST['instance_id']) && is_numeric($_POST['instance_id']) && !isset($_POST['hashtag_id']) && !isset($_POST['new_hashtag_name'])) {
$owner_instance_dao = DAOFactory::getDAO('OwnerInstanceDAO');
$instance_dao = DAOFactory::getDAO('InstanceDAO');
$instancehashtag_dao = DAOFactory::getDAO('InstanceHashtagDAO');
$hashtagpost_dao = DAOFactory::getDAO('HashtagPostDAO');
$hashtag_dao = DAOFactory::getDAO('HashtagDAO');
$instance = $instance_dao->get($_POST['instance_id']);
$message = '';
if (isset($instance)) {
// verify CSRF token
$this->validateCSRFToken();
if ($this->isAdmin()) {
//Retrieve this instance's saved searches
$instances_hashtags = $instancehashtag_dao->getByInstance($instance->id);
//.........这里部分代码省略.........
示例2: step3
//.........这里部分代码省略.........
$this->addErrorMessage("Please choose a password.", "password");
} else {
if (!preg_match("/(?=.{8,})(?=.*[a-zA-Z])(?=.*[0-9])/", $password)) {
$this->addErrorMessage("Password must be at least 8 characters and contain both numbers and letters.", "password");
}
}
}
$display_errors = true;
}
if ($_POST['db_name'] == '') {
$this->addErrorMessage("Please enter a database name.", "database_name");
$display_errors = true;
}
if ($_POST['db_host'] == '') {
$this->addErrorMessage("Please enter a database host.", "database_host");
$display_errors = true;
}
if ($_POST['timezone'] == '') {
$this->addErrorMessage("Please select a time zone.", "timezone");
$display_errors = true;
}
if (($error = $this->installer->checkDb($db_config)) !== true) {
//check db
if (($p = strpos($error->getMessage(), "Unknown MySQL server host")) !== false || ($p = strpos($error->getMessage(), "Can't connect to MySQL server")) !== false || ($p = strpos($error->getMessage(), "Can't connect to local MySQL server through socket")) !== false || ($p = strpos($error->getMessage(), "Access denied for user")) !== false) {
$db_error = substr($error->getMessage(), $p);
} else {
$db_error = $error->getMessage();
}
$disable_xss = true;
$db_error = filter_var($db_error, FILTER_SANITIZE_SPECIAL_CHARS);
$this->addErrorMessage("ThinkUp couldn't connect to your database. The error message is:<br /> " . " <strong>{$db_error}</strong><br />Please correct your database information and try again.", "database", $disable_xss);
$display_errors = true;
}
if ($display_errors) {
$this->setViewTemplate('install.step2.tpl');
$this->addToView('db_name', $db_config['db_name']);
$this->addToView('db_user', $db_config['db_user']);
$this->addToView('db_passwd', $db_config['db_password']);
$this->addToView('db_host', $db_config['db_host']);
$this->addToView('db_prefix', $db_config['table_prefix']);
$this->addToView('db_socket', $db_config['db_socket']);
$this->addToView('db_port', $db_config['db_port']);
$this->addToView('db_type', $db_config['db_type']);
$this->addToView('current_tz', $_POST['timezone']);
$this->addToView('tz_list', Installer::getTimeZoneList());
$this->addToView('site_email', $email);
$this->addToView('full_name', $full_name);
return;
}
$admin_user = array('email' => $email, 'password' => $password, 'confirm_password' => $confirm_password);
// trying to create config file
if (!$config_file_exists && !$this->installer->createConfigFile($db_config, $admin_user)) {
$config_file_contents_arr = $this->installer->generateConfigFile($db_config, $admin_user);
$config_file_contents_str = '';
foreach ($config_file_contents_arr as $line) {
$config_file_contents_str .= htmlentities($line);
}
$whoami = @exec('whoami');
$disable_xss = true;
if (!empty($whoami)) {
$whoami = filter_var($whoami, FILTER_SANITIZE_SPECIAL_CHARS);
$this->addErrorMessage("ThinkUp couldn't write the <code>config.inc.php</code> file.<br /><br />" . "Use root (or sudo) to create the file manually, and allow PHP to write to it, by executing the " . "following commands:<br /><code>sudo touch " . escapeshellcmd(THINKUP_WEBAPP_PATH . "config.inc.php") . "</code><br /><code>sudo chown {$whoami} " . escapeshellcmd(THINKUP_WEBAPP_PATH . "config.inc.php") . "</code><br /><br />If you don't have root access, create the <code>" . THINKUP_WEBAPP_PATH . "config.inc.php</code> file, show the contents of your config file below," . " and copy and paste the text into the <code>config.inc.php</code> file.", null, $disable_xss);
} else {
$this->addErrorMessage("ThinkUp couldn't write the <code>config.inc.php</code> file.<br /><br />" . "You will need to create the <code>" . THINKUP_WEBAPP_PATH . "config.inc.php</code> file manually, and paste the following text into it.", null, $disable_xss);
}
$this->addToView('config_file_contents', $config_file_contents_str);
$this->addToView('_POST', $_POST);
$this->setViewTemplate('install.config.tpl');
return;
}
unset($admin_user['confirm_password']);
// check tables
$this->installer->checkTable($db_config);
// if empty, we're ready to populate the database with ThinkUp tables
$this->installer->populateTables($db_config);
//Set the application server name in app settings for access by command-line scripts
Installer::storeServerName();
$owner_dao = DAOFactory::getDAO('OwnerDAO', $db_config);
if (!$owner_dao->doesAdminExist() && !$owner_dao->doesOwnerExist($email)) {
// create admin if not exists
$activation_code = $owner_dao->createAdmin($email, $password, $full_name);
// view for email
$cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
$email_view = new ViewManager($cfg_array);
$email_view->caching = false;
$email_view->assign('application_url', Utils::getApplicationURL());
$email_view->assign('email', urlencode($email));
$email_view->assign('activ_code', $activation_code);
$message = $email_view->fetch('_email.registration.tpl');
Mailer::mail($email, "Activate Your New ThinkUp Account", $message);
} else {
$email = 'Use your old email admin';
$password = 'Use your old password admin';
}
unset($THINKUP_CFG);
$this->addToView('errors', $this->installer->getErrorMessages());
$this->addToView('username', $email);
$this->addToView('password', $password);
$this->addToView('login_url', Utils::getSiteRootPathFromFileSystem() . 'session/login.php');
}