本文整理汇总了PHP中cms_utils::get_db方法的典型用法代码示例。如果您正苦于以下问题:PHP cms_utils::get_db方法的具体用法?PHP cms_utils::get_db怎么用?PHP cms_utils::get_db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cms_utils
的用法示例。
在下文中一共展示了cms_utils::get_db方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* The constructor.
* This method does numerous things, including setup an extended autoloader,
* create defines for the module itself. i.e: MOD_CGEXTENSIONS, or MOD_FRONTENDUSERS.
* sets up a built in cache driver for temporarily caching data.
* and register numerous smarty plugins (see the documentation for those).
*/
public function __construct()
{
spl_autoload_register(array($this, 'autoload'));
parent::__construct();
global $CMS_INSTALL_PAGE, $CMS_PHAR_INSTALL;
if (isset($CMS_INSTALL_PAGE) || isset($CMS_PHAR_INSTALL)) {
return;
}
$class = get_class($this);
if (!defined('MOD_' . strtoupper($class))) {
/**
* @ignore
*/
define('MOD_' . strtoupper($class), $class);
}
if (self::$_initialized || $class != 'CGExtensions') {
return;
}
self::$_initialized = TRUE;
// from here down only happens once per request (for CGExtensions only)
// setup caching
if ($class == MOD_CGEXTENSIONS && !is_object(cms_cache_handler::get_instance()->get_driver())) {
$lifetime = (int) $this->GetPreference('cache_lifetime', 300);
$filelock = (int) $this->GetPreference('cache_filelock', 1);
$autoclean = (int) $this->GetPreference('cache_autoclean', 1);
if ($autoclean) {
// autoclean is enabled... but we don't want to search through the directory for files to delete
// on each request... so we just do that once per interval.
$tmp = $this->GetPreference('cache_autoclean_last', 0);
if (time() - $tmp < $lifetime) {
$autoclean = 0;
} else {
$autoclean = 1;
$this->SetPreference('cache_autoclean_last', time());
}
}
$driver = new cms_filecache_driver(array('cache_dir' => TMP_CACHE_LOCATION, 'lifetime' => $lifetime, 'locking' => $filelock, 'auto_cleaning' => $autoclean));
cms_cache_handler::get_instance()->set_driver($driver);
}
$smarty = CmsApp::get_instance()->GetSmarty();
if (!$smarty) {
return;
}
$smarty->register_function('cge_yesno_options', 'cge_smarty_plugins::smarty_function_cge_yesno_options');
$smarty->register_function('cge_have_module', array('cge_smarty_plugins', 'plugin_have_module'));
$smarty->register_block('cgerror', array('cge_smarty_plugins', 'blockDisplayError'));
$smarty->register_block('jsmin', array('cge_smarty_plugins', 'jsmin'));
$smarty->register_function('cge_cached_url', array('cge_smarty_plugins', 'cge_cached_url'));
$smarty->register_function('cgimage', array('cge_smarty_plugins', 'smarty_function_cgimage'));
$smarty->register_function('cge_helptag', array('cge_smarty_plugins', 'smarty_function_helptag'));
$smarty->register_function('cge_helphandler', array('cge_smarty_plugins', 'smarty_function_helphandler'));
$smarty->register_function('cge_helpcontent', array('cge_smarty_plugins', 'smarty_function_helpcontent'));
$smarty->register_function('cge_state_options', array('cge_smarty_plugins', 'smarty_function_cge_state_options'));
$smarty->register_function('cge_country_options', array('cge_smarty_plugins', 'smarty_function_cge_country_options'));
$smarty->register_function('cge_textarea', array('cge_smarty_plugins', 'smarty_function_cge_textarea'));
$smarty->register_function('get_current_url', array('cge_smarty_plugins', 'smarty_function_get_current_url'));
$smarty->register_function('cge_str_to_assoc', array('cge_smarty_plugins', 'smarty_function_str_to_assoc'));
$smarty->register_modifier('rfc_date', array('cge_smarty_plugins', 'smarty_modifier_rfc_date'));
$smarty->register_modifier('time_fmt', array('cge_smarty_plugins', 'smarty_modifier_time_fmt'));
$smarty->register_modifier('cge_entity_decode', array('cge_smarty_plugins', 'smarty_modifier_cge_entity_decode'));
$smarty->register_compiler_function('cge_cache', array('cge_smarty_plugins', 'cache_start'));
$smarty->register_compiler_function('cge_cacheclose', array('cge_smarty_plugins', 'cache_end'));
$smarty->register_function('cge_module_hint', array('cge_smarty_plugins', 'cge_module_hint'));
$smarty->register_function('cge_file_list', array('cge_smarty_plugins', 'cge_file_list'));
$smarty->register_function('cge_image_list', array('cge_smarty_plugins', 'cge_image_list'));
$smarty->register_function('cge_array_set', array('cge_smarty_plugins', 'cge_array_set'));
$smarty->register_function('cge_array_erase', array('cge_smarty_plugins', 'cge_array_erase'));
$smarty->register_function('cge_array_get', array('cge_smarty_plugins', 'cge_array_get'));
$smarty->register_function('cge_array_getall', array('cge_smarty_plugins', 'cge_array_getall'));
$smarty->register_function('cge_admin_error', array('cge_smarty_plugins', 'cge_admin_error'));
$smarty->register_function('cge_wysiwyg', array('cge_smarty_plugins', 'cge_wysiwyg'));
$smarty->register_modifier('cge_createurl', array('cge_smarty_plugins', 'smarty_modifier_createurl'));
$smarty->register_function('cge_setlist', array('cge_smarty_plugins', 'cge_setlist'));
$smarty->register_function('cge_unsetlist', array('cge_smarty_plugins', 'cge_unsetlist'));
$smarty->register_function('cge_message', array('cge_smarty_plugins', 'cge_message'));
$smarty->register_function('cge_isbot', array('cge_smarty_plugins', 'cge_isbot'));
$smarty->register_function('cge_is_smartphone', array('cge_smarty_plugins', 'cge_is_smartphone'));
$smarty->register_function('cge_getbrowser', array('cge_smarty_plugins', 'cge_get_browser'));
$smarty->register_function('cge_isie', array('cge_smarty_plugins', 'cge_isie'));
$smarty->register_function('cge_content_type', array('cge_smarty_plugins', 'cge_content_type'));
$smarty->register_function('cge_start_tabs', array('cge_smarty_plugins', 'cge_start_tabs'));
$smarty->register_function('cge_end_tabs', array('cge_smarty_plugins', 'cge_end_tabs'));
$smarty->register_function('cge_tabheader', array('cge_smarty_plugins', 'cge_tabheader'));
$smarty->register_function('cge_tabcontent_start', array('cge_smarty_plugins', 'cge_tabcontent_start'));
$smarty->register_function('cge_tabcontent_end', array('cge_smarty_plugins', 'cge_tabcontent_end'));
$smarty->register_function('cgjs_render', array('cge_smarty_plugins', 'cgjs_render'));
$smarty->register_function('cgjs_require', array('cge_smarty_plugins', 'cgjs_require'));
$smarty->register_block('cgjs_add', array('cge_smarty_plugins', 'cgjs_add'));
$smarty->register_block('cgcss_add', array('cge_smarty_plugins', 'cgcss_add'));
// should be admin only
$smarty->register_function('cge_pageoptions', array('cge_smarty_plugins', 'cge_pageoptions'));
$db = cms_utils::get_db();
if (is_object($db)) {
//.........这里部分代码省略.........
示例2: GetTemplateContent
function GetTemplateContent($templatename="")
{
$db = cms_utils::get_db();
if ($templatename=="") $templatename=$this->GetDefaultTemplate();
$q = "SELECT template_content FROM ".cms_db_prefix()."templates WHERE template_name = ?";
//echo $templatename;
$p = array($templatename);
$dbresult = $db->Execute($q, $p);
if (!$dbresult || $dbresult->RecordCount()==0) return false;
$row = $dbresult->FetchRow();
return $row["template_content"];
}
示例3: GetCurrentAcePrefs
public function GetCurrentAcePrefs()
{
$db = \cms_utils::get_db();
$sql = 'SELECT * from ' . CMS_DB_PREFIX . 'mod_ace_editor2 WHERE id = ?';
$row = $db->GetRow($sql, array(1));
return $row;
}
示例4: NewDataDictionary
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
*
* ------------------------------------------------------------------------- */
if (!defined('CMS_VERSION')) {
exit;
}
$this->CreatePermission(AceEditor2::MANAGE_PERM, 'Manage Ace Editor 2');
$db = $this->GetDb();
$dict = NewDataDictionary($db);
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$flds = "\nid I KEY AUTO,\neditor_width_type X,\neditor_width_px X,\neditor_width_pc X,\neditor_height_px X,\neditor_css_prefmode X\n";
$sqlarray = $dict->CreateTableSQL(CMS_DB_PREFIX . 'mod_ace_editor2', $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
// Create the first and only line in the table, used to store the preferences
$db = \cms_utils::get_db();
$sql = 'INSERT INTO ' . CMS_DB_PREFIX . 'mod_ace_editor2 (editor_width_type, editor_width_px, editor_width_pc, editor_height_px, editor_css_prefmode) VALUE (?,?,?,?,?)';
$startvalues = array('pc', '800', '95', '600', 'css');
$db->Execute($sql, $startvalues);