本文整理汇总了PHP中get_site_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_preference函数的具体用法?PHP get_site_preference怎么用?PHP get_site_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_preference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_sitedown
/**
* A convenience function to test if the site is marked as down according to the config panel.
* This method includes handling the preference that indicates that site-down behaviour should
* be disabled for certain IP address ranges.
*
* @return boolean
*/
function is_sitedown()
{
global $CMS_INSTALL_PAGE;
if (isset($CMS_INSTALL_PAGE)) {
return TRUE;
}
if (get_site_preference('enablesitedownmessage') !== '1') {
return FALSE;
}
if (get_site_preference('sitedownexcludeadmins')) {
$uid = get_userid(FALSE);
if ($uid) {
return FALSE;
}
}
if (!isset($_SERVER['REMOTE_ADDR'])) {
return TRUE;
}
$excludes = get_site_preference('sitedownexcludes', '');
if (empty($excludes)) {
return TRUE;
}
$tmp = explode(',', $excludes);
$ret = cms_ipmatches($_SERVER['REMOTE_ADDR'], $excludes);
if ($ret) {
return FALSE;
}
return TRUE;
}
示例2: smarty_modifier_cms_date_format
function smarty_modifier_cms_date_format($string, $format = '', $default_date = '')
{
$gCms = cmsms();
if ($format == '') {
$format = get_site_preference('defaultdateformat');
if ($format == '') {
$format = '%b %e, %Y';
}
if (!isset($gCms->variables['page_id'])) {
$uid = get_userid(false);
if ($uid) {
$tmp = get_preference($uid, 'date_format_string');
if ($tmp != '') {
$format = $tmp;
}
}
}
}
$config = $gCms->GetConfig();
$fn = cms_join_path($config['root_path'], 'lib', 'smarty', 'plugins', 'modifier.date_format.php');
if (!file_exists($fn)) {
die;
}
require_once $fn;
return smarty_modifier_date_format($string, $format, $default_date);
}
示例3: __construct
function __construct(&$content_obj, &$params = array())
{
$params['type'] = 'image';
parent::__construct($content_obj, $params);
$config = cmsms()->GetConfig();
$this->SetBlockProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_');
$this->SetBlockProperty('exclude', isset($params['exclude']) && $this->content_obj->IsFalse($params['exclude']));
$this->SetBlockProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path')));
$this->SetBlockProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetBlockProperty('id'));
}
示例4: smarty_function_sitename
function smarty_function_sitename($params, &$template)
{
$smarty = $template->smarty;
$result = get_site_preference('sitename', 'CMSMS Site');
if (isset($params['assign'])) {
$gCms = cmsms();
$smarty->assign(trim($params['assign']), $result);
return;
}
return $result;
}
示例5: smarty_cms_function_sitename
function smarty_cms_function_sitename($params, &$smarty)
{
$result = get_site_preference('sitename', 'CMSMS Site');
if (isset($params['assign'])) {
$gCms = cmsms();
$smarty =& $gCms->GetSmarty();
$smarty->assign(trim($params['assign']), $result);
return;
}
return $result;
}
示例6: execute
public function execute($time = '')
{
if (!$time) {
$time = time();
}
// do the task.
$age_days = (int) get_site_preference(self::CACHEDFILEAGE_SITEPREF, 0);
$gCms = cmsms();
$gCms->clear_cached_files($age_days);
return TRUE;
}
示例7: execute
public function execute($time = '')
{
if (!$time) {
$time = time();
}
// do the task.
$lifetime = (int) get_site_preference(self::LIFETIME_SITEPREF, 60 * 60 * 24 * 31);
$db = cmsms()->GetDB();
$q = "DELETE FROM " . cms_db_prefix() . "adminlog WHERE timestamp<?";
$p = array(time() - $lifetime);
$dbresult = $db->Execute($q, $p);
//$gCms->clear_cached_files($age_days);
return TRUE;
}
示例8: fetch
protected function fetch($name, &$source, &$mtime)
{
$gCms = cmsms();
$config = $gCms->GetConfig();
$contentobj = $gCms->variables['content_obj'];
if (!is_object($contentobj)) {
// We've a custom error message... return it here
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
if ($name == 'content_en') {
$source = get_site_preference('custom404');
} else {
$source = null;
}
$mtime = time();
return;
} else {
if (isset($_SESSION['cms_preview_data']) && $contentobj->Id() == '__CMS_PREVIEW_PAGE__') {
if (!isset($_SESSION['cms_preview_data']['content_obj'])) {
$contentops = $gCms->GetContentOperations();
$_SESSION['cms_preview_data']['content_obj'] = $contentops->LoadContentFromSerializedData($_SESSION['cms_preview_data']);
$contentobj =& $_SESSION['cms_preview_data']['content_obj'];
}
$contentobj =& $_SESSION['cms_preview_data']['content_obj'];
$source = $contentobj->Show($name);
$mtime = $contentobj->GetModifiedDate();
// So no one can do anything nasty, take out the php smarty tags. Use a user
// defined plugin instead.
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
$source = preg_replace("/\\{\\/?php\\}/", "", $source);
}
return;
} else {
if (isset($contentobj) && $contentobj !== FALSE) {
$source = $contentobj->Show($name);
$mtime = $contentobj->GetModifiedDate();
// So no one can do anything nasty, take out the php smarty tags. Use a user
// defined plugin instead.
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
$source = preg_replace("/\\{\\/?php\\}/", "", $source);
}
return;
}
}
}
$source = null;
$mtime = null;
return;
}
示例9: execute
public function execute($time = '')
{
if (!$time) {
$time = time();
}
// do the task.
if (!get_site_preference('enablenotifications', 1)) {
return TRUE;
}
$allmodules = ModuleOperations::get_instance()->GetInstalledModules();
$loadedmods = ModuleOperations::get_instance()->GetLoadedModules();
foreach ($allmodules as $modulename) {
$did_load = FALSE;
$module = '';
if (isset($loadedmods[$modulename])) {
$module = $loadedmods[$modulename];
} else {
$module = ModuleOperations::get_instance()->get_module_instance($modulename);
$did_load = TRUE;
}
if (!is_object($module)) {
continue;
}
// now see if this module has notifications
$data = $module->GetNotificationOutput(3);
if (empty($data)) {
continue;
}
if (is_object($data)) {
$data = array($data);
}
for ($i = 0; $i < count($data); $i++) {
if (!isset($data[$i]->name)) {
$data[$i]->name = $modulename;
}
if (!isset($data[$i]->friendlyname)) {
$data[$i]->friendlyname = $module->GetFriendlyName();
}
}
if (!is_array($this->_notifications)) {
$this->_notifications = array();
}
$this->_notifications = array_merge($this->_notifications, $data);
}
return TRUE;
}
示例10: __construct
function __construct(&$content_obj, $params = array())
{
$params['block_type'] = 'image';
parent::__construct($content_obj, $params);
$config = cmsms()->GetConfig();
$this->SetProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_');
$this->SetProperty('exclude', !isset($params['exclude']) || ac_utils::IsFalse($params['exclude']));
$this->SetProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path')));
$this->SetProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetProperty('id'));
$this->SetProperty('urlonly', isset($params['urlonly']) && ac_utils::IsTrue($params['urlonly']));
$this->SetProperty('class', isset($params['class']) ? $params['class'] : '');
$this->SetProperty('alt', isset($params['alt']) ? $params['alt'] : '');
$this->SetProperty('css_id', isset($params['id']) ? $params['id'] : '');
$this->SetProperty('width', isset($params['width']) ? $params['width'] : '');
$this->SetProperty('height', isset($params['height']) ? $params['height'] : '');
$this->SetProperty('title', isset($params['title']) ? $params['title'] : '');
}
示例11: send_recovery_email
/**
* A function to send lost password recovery email to a specified admin user (by name)
*
* @internal
* @access private
* @param string the username
* @return results from the attempt to send a message.
*/
function send_recovery_email($username)
{
$gCms = cmsms();
$config = $gCms->GetConfig();
$userops = $gCms->GetUserOperations();
$user = $userops->LoadUserByUsername($username);
$obj = cms_utils::get_module('CMSMailer');
if ($obj == null) {
return false;
}
$obj->AddAddress($user->email, html_entity_decode($user->firstname . ' ' . $user->lastname));
$obj->SetSubject(lang('lostpwemailsubject', html_entity_decode(get_site_preference('sitename', 'CMSMS Site'))));
$url = $config['admin_url'] . '/login.php?recoverme=' . md5(md5($config['root_path'] . '--' . $user->username . md5($user->password)));
$body = lang('lostpwemail', html_entity_decode(get_site_preference('sitename', 'CMSMS Site')), $user->username, $url);
$obj->SetBody($body);
audit('', 'Core', 'Sent Lost Password Email for ' . $username);
return $obj->Send();
}
示例12: smarty_cms_function_metadata
function smarty_cms_function_metadata($params, &$smarty)
{
$gCms = cmsms();
$config = $gCms->GetConfig();
$content_obj =& $gCms->variables['content_obj'];
$result = '';
$showbase = true;
#Show a base tag unless showbase is false in config.php
#It really can't hinder, only help.
if (isset($config['showbase'])) {
$showbase = $config['showbase'];
}
# but allow a parameter to override it.
if (isset($params['showbase'])) {
if ($params['showbase'] == 'false') {
$showbase = false;
}
}
if ($showbase) {
$base = $config['root_url'];
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$base = $config['ssl_url'];
}
$result .= "\n<base href=\"" . $base . "/\" />\n";
}
$result .= get_site_preference('metadata', '');
if (is_object($content_obj) && $content_obj->Metadata() != '') {
$result .= "\n" . $content_obj->Metadata();
}
if (!strpos($result, $smarty->left_delimiter) === false and !strpos($result, $smarty->right_delimiter) === false) {
$smarty->_compile_source('metadata template', $result, $_compiled);
@ob_start();
$smarty->_eval('?>' . $_compiled);
$result = @ob_get_contents();
@ob_end_clean();
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $result);
return;
}
return $result;
}
示例13: execute
public function execute($target = '', $data = array(), $age = '')
{
$mod = cms_utils::get_module('ModuleManager');
if (!$age) {
$age = get_site_preference('browser_cache_expiry', 60);
}
if ($age) {
$age = max(1, (int) $age);
}
// build a signature
$this->_signature = md5(serialize(array($target, $data)));
$fn = $this->_getCacheFile();
if (!$fn) {
return;
}
// check for the cached file
$atime = time() - $age * 60;
$status = '';
$resutl = '';
if ($mod->GetPreference('disable_caching', 0) || !file_exists($fn) || filemtime($fn) <= $atime) {
// execute the request
$req = new cms_http_request();
if ($this->_timeout) {
$req->setTimeout($this->_timeout);
}
$req->execute($target, '', 'POST', $data);
$this->_status = $req->getStatus();
$this->_result = $req->getResult();
@unlink($fn);
if ($this->_status == 200) {
// create a cache file
$fh = fopen($fn, 'w');
fwrite($fh, serialize(array($this->_status, $this->_result)));
fclose($fh);
}
} else {
// get data from the cache.
$data = unserialize(file_get_contents($fn));
$this->_status = $data[0];
$this->_result = $data[1];
}
}
示例14: getUserFormat
public function getUserFormat($fmt = '')
{
$config = cmsms()->GetConfig();
$stz = new DateTimeZone($config['timezone']);
$utz = new DateTimeZone($config['user_timezone']);
// this calls the cms_date_format stuff.
if (empty($fmt)) {
$fmt = get_site_preference('defaultdateformat', '%b %e, %Y');
global $gCms;
if (!isset($gCms->variables['page_id'])) {
$uid = get_userid(FALSE);
if ($uid) {
$fmt = get_preference($uid, 'date_format_string', $fmt);
}
}
}
$this->setTimeZone($utz);
$when = $this->format('U');
$this->setTimeZone($stz);
return strftime($fmt, $when);
}
示例15: smarty_function_cms_init_editor
function smarty_function_cms_init_editor($params, &$template)
{
$smarty = $template->smarty;
// if the editor is not specified.
$wysiwyg = '';
if (isset($params['wysiwyg'])) {
$wysiwyg = trim($params['wysiwyg']);
}
// get the frontend editor preference
if (!$wysiwyg) {
$wysiwyg = get_site_preference('frontendwysiwyg');
}
if (!$wysiwyg || (int) $wysiwyg < 0) {
return;
}
$mod = cms_utils::get_module($wysiwyg);
if (!is_object($mod)) {
return;
}
if (!$mod->IsWYSIWYG()) {
return;
}
// check to see if it is active
if (!isset($params['force']) || $params['force'] != 0) {
if (!$mod->WYSIWYGActive()) {
return;
}
}
// get the output
$output = $mod->WYSIWYGGenerateHeader();
if (!$output) {
return;
}
// assign it or echo it.
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']) . $output);
return;
}
return $output;
}