本文整理汇总了PHP中Variable::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::get方法的具体用法?PHP Variable::get怎么用?PHP Variable::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
public function admin()
{
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
$form = $this->init_module(Libs_QuickForm::module_name(), 'Changing template');
$themes = Base_Theme::list_themes();
$form->addElement('header', 'install_module_header', __('Themes Administration'));
$form->addElement('select', 'theme', __('Choose template'), $themes);
$form->addElement('static', null, '', '<br /><br />');
$form->addElement('header', 'upload_theme_header', __('Upload template'));
$form->setDefaults(array('theme' => Variable::get('default_theme')));
if ($form->validate()) {
$form->process(array(&$this, 'submit_admin'));
} else {
$form->display();
if (class_exists('ZipArchive')) {
$this->pack_module(Utils_FileUpload::module_name(), array(array($this, 'upload_template'), __('Upload template')));
// Base_ActionBarCommon::add('edit',__('Manage templates'),$this->create_callback_href(array($this,'download_template')));
}
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
}
示例2: auth
private function auth($user, $pass)
{
$error = '';
$t = Variable::get('host_ban_time');
if ($t > 0) {
$fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
if ($fails >= 3) {
$error = 'Host banned.';
}
}
if ($error === '') {
$ret = Base_User_LoginCommon::check_login($user, $pass);
if (!$ret) {
$error = 'Login failed.';
if ($t > 0) {
DB::Execute('DELETE FROM user_login_ban WHERE failed_on<=%d', array(time() - $t));
DB::Execute('INSERT INTO user_login_ban(failed_on,from_addr) VALUES(%d,%s)', array(time(), $_SERVER['REMOTE_ADDR']));
$fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
if ($fails >= 3) {
$error .= ' Host banned.';
}
}
} else {
$uid = Base_UserCommon::get_user_id($user);
Acl::set_user($uid, true);
}
}
return $error;
}
示例3: parseBaseUrl
public static function parseBaseUrl()
{
switch (Config::get("URL_MODEL")) {
case 'NORMAL':
$groupName = ucfirst(Variable::get(Config::get("GROUP_PARAM")));
$controllerName = ucfirst(Variable::get(Config::get("CONTROLLER_PARAM")));
$actionName = ucfirst(Variable::get(Config::get("ACTION_PARAM")));
break;
case 'PATH_INFO':
$pathInfo = Variable::server("PATH_INFO");
if (isset($pathInfo)) {
$pathInfo = ltrim($pathInfo, "/");
$urlInfo = explode("/", $pathInfo);
if (count($urlInfo) >= 3) {
foreach ($urlInfo as &$value) {
$value = ucfirst($value);
}
unset($value);
list($groupName, $controllerName, $actionName) = $urlInfo;
} else {
$groupName = isset($urlInfo[0]) ? ucfirst($urlInfo[0]) : "";
$controllerName = isset($urlInfo[1]) ? ucfirst($urlInfo[1]) : "";
$actionName = isset($urlInfo[2]) ? ucfirst($urlInfo[2]) : "";
}
break;
} else {
break;
}
default:
}
define("GROUP_NAME", !empty($groupName) ? $groupName : Config::get("DEFAULT_GROUP"));
define("CONTROLLER_NAME", !empty($controllerName) ? $controllerName : Config::get("DEFAULT_CONTROLLER"));
define("ACTION_NAME", !empty($actionName) ? $actionName : Config::get("DEFAULT_ACTION"));
}
示例4: epesi_requires_update
function epesi_requires_update()
{
$ret = null;
if (class_exists('Variable', false)) {
$system_version = Variable::get('version');
$ret = version_compare($system_version, EPESI_VERSION, '<');
}
return $ret;
}
示例5: add_signature
public function add_signature($b)
{
$footer = Variable::get('crm_roundcube_global_signature', false);
if ($b['type'] == 'plain') {
$b['body'] .= "\r\n" . strip_tags(preg_replace('/<[bh]r\\s*\\/?>/i', "\r\n", $footer));
} else {
$b['body'] .= '<br />' . $footer;
}
return $b;
}
示例6: i_am_admin
/**
* Returns whether currently logged in user is an administrator.
*
* @return bool true if currently logged in user is an administrator
*/
public static function i_am_admin()
{
static $ret, $user;
$new_user = self::get_user();
if (!isset($ret) || $new_user != $user) {
$user = $new_user;
$ret = Variable::get('anonymous_setup') || self::get_admin_level() >= 1;
}
return $ret;
}
示例7: admin
/**
* For internal use only.
*/
public function admin()
{
if ($this->is_back()) {
$this->parent->reset();
return;
}
$form = $this->init_module(Libs_QuickForm::module_name());
//defaults
$defaults = array();
$defaults['mail_method'] = Variable::get('mail_method');
$defaults['mail_use_replyto'] = Variable::get('mail_use_replyto');
$defaults['mail_user'] = Variable::get('mail_user');
$defaults['mail_from_addr'] = Variable::get('mail_from_addr');
$defaults['mail_from_name'] = Variable::get('mail_from_name');
$defaults['mail_host'] = Variable::get('mail_host');
$defaults['mail_security'] = Variable::get('mail_security', false);
$defaults['mail_auth'] = Variable::get('mail_auth');
$defaults['mail_password'] = Variable::get('mail_password');
$form->setDefaults($defaults);
//form
$form->addElement('header', null, __('Mail settings'));
$form->addElement('select', 'mail_method', __('Choose method'), array('smtp' => __('remote smtp server'), 'mail' => __('local php.ini settings')), 'onChange="' . $form->get_submit_form_js(false) . '"');
$form->addElement('text', 'mail_from_addr', __('Administrator e-mail address'));
$form->addRule('mail_from_addr', __('Invalid e-mail address'), 'email');
$form->addRule('mail_from_addr', __('Field required'), 'required');
$form->addElement('text', 'mail_from_name', __('Send e-mails from name'));
$form->addElement('text', 'mail_use_replyto', __('Set "Reply-To" email address'));
$form->addRule('mail_use_replyto', __('Invalid e-mail address'), 'email');
$method = $form->getElement('mail_method')->getSelected();
if ($method[0] == 'smtp') {
$form->addElement('text', 'mail_host', __('SMTP host address'));
$form->addRule('mail_host', __('Field required'), 'required');
$form->addElement('select', 'mail_security', __('Security'), array('' => __('None'), 'ssl' => 'SSL', 'ssl_ssc' => 'SSL (self signed certificate)', 'tls' => 'TLS', 'tls_ssc' => 'TLS (self signed certificate)'));
$form->addElement('checkbox', 'mail_auth', __('SMTP authorization'), '', 'onChange="' . $form->get_submit_form_js(false) . '"');
$auth = $form->getElement('mail_auth')->getValue();
if ($auth) {
$form->addElement('text', 'mail_user', __('Login'));
$form->addElement('password', 'mail_password', __('Password'));
}
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
$me = CRM_ContactsCommon::get_my_record();
$email = $me['email'];
Base_ActionBarCommon::add('search', __('Test'), $this->create_callback_href(array($this, 'test_mail_config'), array($email)), __('E-mail will be sent to %s to test the configuration', array('<b>' . $email . '</b>')));
}
if ($form->getSubmitValue('submited') && $form->validate() && $form->process(array(&$this, 'submit_admin'))) {
Base_StatusBarCommon::message(__('Settings saved'));
}
$form->display();
}
示例8: update_observer
public function update_observer($type, $message, $errfile, $errline, $errcontext, $backtrace)
{
$mail = Variable::get('error_mail');
if ($mail) {
$backtrace = htmlspecialchars_decode(str_replace(array('<br />', ' '), array("\n", ' '), $backtrace));
$x = "who=" . Base_AclCommon::get_user() . "\ntype=" . $type . "\nmessage=" . $message . "\nerror file=" . $errfile . "\nerror line=" . $errline . "\n" . $backtrace;
$d = ModuleManager::get_data_dir('Base/Error') . md5($x) . '.txt';
file_put_contents($d, $x);
$url = get_epesi_url();
Base_MailCommon::send($mail, 'Epesi Error - ' . $url, substr($x, 0, strpos($x, "error backtrace")) . "\n" . $url . '/' . $d, null, null, false, true);
}
return true;
}
示例9: admin
public function admin() {
if ($this->is_back()) {
$this->parent->reset();
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$google_login = Variable::get('utils_attachments_google_user', false);
$google_pass = Variable::get('utils_attachments_google_pass', false);
$form = $this->init_module('Libs_QuickForm');
$theme = $this->init_module('Base_Theme');
$form->addElement('header', 'header', __('Google Username and Password'));
$form->addElement('text', 'google_user', __('Username'));
$form->addElement('password', 'google_pass', __('Password'));
$form->setDefaults(array('google_user'=>$google_login));
$form->setDefaults(array('google_pass'=>$google_pass));
if ($form->validate()) {
$vals = $form->exportValues();
$ok = true;
if ($vals['google_user']) {
$g_auth = Utils_AttachmentCommon::get_google_auth($vals['google_user'], $vals['google_pass']);
if (!$g_auth) $ok = false;
}
if ($ok) {
Variable::set('utils_attachments_google_user', $vals['google_user']);
Variable::set('utils_attachments_google_pass', $vals['google_pass']);
Base_StatusBarCommon::message(__('Settings saved'));
} else {
Base_StatusBarCommon::message(__('Unable to authenticate'), 'error');
}
location(array());
return;
}
$form->assign_theme('form', $theme);
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ThemeCommon::load_css('Utils_RecordBrowser','View_entry');
$theme->display('admin');
}
示例10: display
public static function display($header, $content, $info = false)
{
$l = Variable::get('logo_file', false);
if (!$l) {
$l = Base_ThemeCommon::get_template_file('images/logo-small.png');
}
$smarty = Base_ThemeCommon::init_smarty();
$smarty->assign('header', $header);
$smarty->assign('contents', $content);
$smarty->assign('info', $info);
$smarty->assign('footer', '');
$smarty->assign('logo', $l);
$smarty->assign('url', get_epesi_url());
Base_ThemeCommon::display_smarty($smarty, 'Utils_FrontPage', 'default');
}
示例11: load_image_cache
private function load_image_cache()
{
if (isset($_SESSION['client']['image_cache'])) {
return;
}
$_SESSION['client']['image_cache'] = true;
$imgs = array();
if (Variable::get('preload_image_cache_selected') && file_exists($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images')) {
$imgs = explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images'));
}
if (Variable::get('preload_image_cache_default') && self::$theme != 'default' && file_exists($this->get_data_dir() . 'templates/' . 'default/__cache.images')) {
$imgs = array_merge($imgs, explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . 'default/__cache.images')));
}
if (!empty($imgs)) {
eval_js("var cache = document.createElement('div');" . "cache.style.display='none';" . "document.body.appendChild(cache);" . "var current_image = null;" . "var cache_pause = false;" . "var images_list = Array('" . implode("','", $imgs) . "');" . "cache_images = function() {" . "if(!cache_pause && (current_image==null || current_image.complete)) {" . "current_image = document.createElement('img');" . "current_image.src = images_list.shift();" . "cache.appendChild(current_image);" . "}" . "if(images_list.length)" . "setTimeout('cache_images()',500);" . "};" . "cache_images();", false);
}
}
示例12: admin_signature
public function admin_signature()
{
$f = $this->init_module('Libs/QuickForm');
$f->addElement('header', null, __('Outgoing mail global signature'));
$fck =& $f->addElement('ckeditor', 'content', __('Content'));
$fck->setFCKProps('800', '300', true);
$f->setDefaults(array('content' => Variable::get('crm_roundcube_global_signature', false)));
Base_ActionBarCommon::add('save', __('Save'), $f->get_submit_form_href());
if ($f->validate()) {
$ret = $f->exportValues();
$content = $ret['content'];
Variable::set('crm_roundcube_global_signature', $content);
Base_StatusBarCommon::message(__('Signature saved'));
$this->parent->reset();
return;
}
$f->display();
}
示例13: user_settings
public static function user_settings($just_retrieve = false)
{
if (!Variable::get('allow_lang_change')) {
return null;
}
if (DEMO_MODE && Base_UserCommon::get_my_user_login() == 'admin') {
$langs = array('en' => 'en');
} else {
$langs = Base_LangCommon::get_installed_langs();
}
if ($just_retrieve) {
$group = $label1 = $label2 = '';
} else {
$group = __('Regional Settings');
$label1 = __('Language');
$label2 = __('Language you want to use');
}
return array($group => array(array('type' => 'header', 'label' => $label1, 'name' => null), array('name' => 'language', 'label' => $label2, 'type' => 'select', 'values' => $langs, 'default' => Variable::get('default_lang'))));
}
示例14: admin
public function admin()
{
if ($this->is_back()) {
$this->parent->reset();
}
$form = $this->init_module('Libs/QuickForm', 'Errors to mail');
$form->addElement('text', 'mail', __('Send bugs to'));
$form->addRule('mail', __('Invalid e-mail address'), 'email');
$form->addElement('static', '', '', __('Leave empty to disable bug reports.'));
Base_ActionBarCommon::add('back', __('Cancel'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
$form->setDefaults(array('mail' => Variable::get('error_mail')));
if ($form->validate()) {
Variable::set('error_mail', $form->exportValue('mail'));
$this->parent->reset();
} else {
$form->display();
}
}
示例15: form
static function form()
{
try {
$anonymous = Variable::get('anonymous_setup');
} catch (NoSuchVariableException $e) {
$anonymous = true;
}
if (!Base_AclCommon::is_user() && Base_User_LoginCommon::is_banned()) {
return self::t('You have exceeded the number of allowed login attempts.');
}
require_once 'modules/Libs/QuickForm/requires.php';
if (!Base_AclCommon::is_user() && !$anonymous) {
Base_User_LoginCommon::autologin();
}
if (!Base_AclCommon::is_user() && !$anonymous) {
$get = count($_GET) ? '?' . http_build_query($_GET) : '';
$form = new HTML_QuickForm('loginform', 'post', $_SERVER['PHP_SELF'] . $get);
$form->setRequiredNote('<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;">' . self::t('denotes required field') . '</span>');
$form->addElement('text', 'username', self::t('Username'));
$form->addRule('username', 'Field required', 'required');
$form->addElement('password', 'password', self::t('Password'));
$form->addRule('password', 'Field required', 'required');
// register and add a rule to check if user is banned
$form->registerRule('check_user_banned', 'callback', 'rule_login_banned', 'Base_User_LoginCommon');
$form->addRule('username', self::t('You have exceeded the number of allowed login attempts.'), 'check_user_banned');
// register and add a rule to check if user and password exists
$form->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
$form->addRule(array('username', 'password'), self::t('Login or password incorrect'), 'check_login', $form);
$form->addElement('submit', null, self::t('Login'));
if ($form->validate()) {
$user = $form->exportValue('username');
Base_AclCommon::set_user(Base_UserCommon::get_user_id($user), true);
// redirect below is used to better browser refresh behavior.
header('Location: ' . $_SERVER['REQUEST_URI']);
} else {
return "<center>" . $form->toHtml() . "</center>";
}
}
}