本文整理汇总了PHP中cms_db_prefix函数的典型用法代码示例。如果您正苦于以下问题:PHP cms_db_prefix函数的具体用法?PHP cms_db_prefix怎么用?PHP cms_db_prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cms_db_prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DisplayErrorPage
function DisplayErrorPage(&$mod, &$smarty, &$db, &$params, $err = TRUE, $message = '')
{
if ($err) {
$smarty->assign('title', $mod->Lang('err_system'));
}
if (!empty($params['bracket_id'])) {
$sql = "SELECT name FROM " . cms_db_prefix() . "module_tmt_brackets WHERE bracket_id=?";
$name = $db->GetOne($sql, array($params['alias']));
} elseif (!empty($params['alias'])) {
$sql = "SELECT name FROM " . cms_db_prefix() . "module_tmt_brackets WHERE alias=?";
$name = $db->GetOne($sql, array($params['alias']));
} else {
$name = false;
}
if ($name) {
$smarty->assign('name', $mod->Lang('tournament') . ': ' . $name);
}
if ($message) {
$detail = $message;
if ($err) {
$detail .= '<br /><br />' . $mod->Lang('telladmin');
}
} else {
$detail = '';
}
$smarty->assign('message', $detail);
echo $mod->ProcessTemplate('error.tpl');
}
示例2: GetFieldInput
function GetFieldInput($id, &$params, $returnid)
{
$mod = $this->form_ptr->module_ptr;
if ($this->Value !== false) {
$ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $this->Value);
if ($this->GetOption('show_to_user', '0') == '1') {
$ret .= $this->Value;
}
} else {
if ($this->GetOption('use_random_generator', '0') == '1') {
$times = $this->GetOption('numbers_to_generate', '5') ? $this->GetOption('numbers_to_generate', '5') : 5;
$number = $this->generate_numbers(0, 9, $times);
$ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $number);
if ($this->GetOption('show_to_user', '0') == '1') {
$ret .= $number;
}
} else {
$db = $mod->dbHandle;
$seq = $db->GenID(cms_db_prefix() . 'module_fb_uniquefield_seq');
$ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $seq);
if ($this->GetOption('show_to_user', '0') == '1') {
$ret .= $seq;
}
}
}
return $ret;
}
示例3: smarty_function_recently_updated
function smarty_function_recently_updated($params, &$template)
{
$smarty = $template->smarty;
if (empty($params['number'])) {
$number = 10;
} else {
$number = $params['number'];
}
if (empty($params['leadin'])) {
$leadin = "Modified: ";
} else {
$leadin = $params['leadin'];
}
if (empty($params['showtitle'])) {
$showtitle = 'true';
} else {
$showtitle = $params['showtitle'];
}
$dateformat = isset($params['dateformat']) ? $params['dateformat'] : "d.m.y h:m";
$css_class = isset($params['css_class']) ? $params['css_class'] : "";
if (isset($params['css_class'])) {
$output = '<div class="' . $css_class . '"><ul>';
} else {
$output = '<ul>';
}
$gCms = cmsms();
$hm = $gCms->GetHierarchyManager();
$db = $gCms->GetDb();
// Get list of most recently updated pages excluding the home page
$q = "SELECT * FROM " . cms_db_prefix() . "content WHERE (type='content' OR type='link')\nAND default_content != 1 AND active = 1 AND show_in_menu = 1 \nORDER BY modified_date DESC LIMIT " . (int) $number;
$dbresult = $db->Execute($q);
if (!$dbresult) {
echo 'DB error: ' . $db->ErrorMsg() . "<br/>";
}
while ($dbresult && ($updated_page = $dbresult->FetchRow())) {
$curnode = $hm->getNodeById($updated_page['content_id']);
$curcontent =& $curnode->GetContent();
$output .= '<li>';
$output .= '<a href="' . $curcontent->GetURL() . '">' . $updated_page['content_name'] . '</a>';
if (FALSE == empty($updated_page['titleattribute']) && $showtitle == 'true') {
$output .= '<br />';
$output .= $updated_page['titleattribute'];
}
$output .= '<br />';
$output .= $leadin;
$output .= date($dateformat, strtotime($updated_page['modified_date']));
$output .= '</li>';
}
$output .= '</ul>';
if (isset($params['css_class'])) {
$output .= '</div>';
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $output);
return;
}
return $output;
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->AddImageDir('images');
$this->categories_table_name = cms_db_prefix() . 'module_cgcalendar_categories';
$this->events_to_categories_table_name = cms_db_prefix() . 'module_cgcalendar_events_to_categories';
$this->events_table_name = cms_db_prefix() . 'module_cgcalendar_events';
$this->event_field_values_table_name = cms_db_prefix() . 'module_cgcalendar_event_field_values';
$this->fields_table_name = cms_db_prefix() . 'module_cgcalendar_fields';
$this->admin_tools_loaded = false;
}
示例5: fetch
protected function fetch($name, &$source, &$mtime)
{
debug_buffer('', 'CMSModuleDbTemplateResource start' . $name);
$db = cmsms()->GetDb();
$tmp = explode(';', $name);
$query = "SELECT * from " . cms_db_prefix() . "module_templates WHERE module_name = ? and template_name = ?";
$row = $db->GetRow($query, preg_split('/;/', $name));
if ($row) {
$source = $row['content'];
$mtime = $db->UnixTimeStamp($row['modified_date']);
}
debug_buffer('', 'CMSModuleDbTemplateResource end' . $name);
}
示例6: DeleteBracket
/**
DeleteBracket:
@mod: reference to Tourney module object
@bracket_id: single bracket identifier, or array of them
*/
function DeleteBracket(&$mod, $bracket_id)
{
$db = cmsms()->GetDb();
$pref = cms_db_prefix();
if (!is_array($bracket_id)) {
$bracket_id = array($bracket_id);
}
foreach ($bracket_id as $bid) {
$sql = 'SELECT chartcss FROM ' . $pref . 'module_tmt_brackets WHERE bracket_id=?';
$file = $db->GetOne($sql, array($bid));
if ($file) {
$sql = 'SELECT COUNT(*) AS sharers FROM ' . $pref . 'module_tmt_brackets WHERE chartcss=?';
$num = $db->GetOne($sql, array($file));
if ($num < 2) {
if ($mod->GetPreference('uploads_dir')) {
$path = cms_join_path($config['uploads_path'], $mod->GetPreference('uploads_dir'), $file);
} else {
$path = cms_join_path($config['uploads_path'], $file);
}
if (is_file($path)) {
unlink($path);
}
}
}
$file = $mod->ChartImageFile($bid);
if ($file) {
unlink($file);
}
$sql = 'DELETE FROM ' . $pref . 'module_tmt_tweet WHERE bracket_id=?';
$db->Execute($sql, array($bid));
$sql = 'DELETE FROM ' . $pref . 'module_tmt_people WHERE id IN
(SELECT team_id FROM ' . $pref . 'module_tmt_teams WHERE bracket_id=?)';
$db->Execute($sql, array($bid));
$sql = 'DELETE FROM ' . $pref . 'module_tmt_teams WHERE bracket_id=?';
$db->Execute($sql, array($bid));
$sql = 'DELETE FROM ' . $pref . 'module_tmt_matches WHERE bracket_id=?';
$db->Execute($sql, array($bid));
$sql = 'DELETE FROM ' . $pref . 'module_tmt_brackets WHERE bracket_id=?';
$db->Execute($sql, array($bid));
$bid = $params['bracket_id'];
$mod->DeleteTemplate('mailout_' . $bid . '_template');
$mod->DeleteTemplate('mailcancel_' . $bid . '_template');
$mod->DeleteTemplate('mailrequest_' . $bid . '_template');
$mod->DeleteTemplate('mailin_' . $bid . '_template');
$mod->DeleteTemplate('tweetout_' . $bid . '_template');
$mod->DeleteTemplate('tweetcancel_' . $bid . '_template');
$mod->DeleteTemplate('tweetrequest_' . $bid . '_template');
$mod->DeleteTemplate('tweetin_' . $bid . '_template');
$mod->DeleteTemplate('chart_' . $bid . '_template');
}
}
示例7: preContent
function preContent(&$db)
{
$test = new StdClass();
$test->error = false;
$test->messages = array();
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$current_version = 1;
$query = "SELECT version from " . cms_db_prefix() . "version";
$dbresult = $db->Execute($query);
if (!$dbresult) {
$test->messages[] = ilang('invalid_query', $query);
$test->error = true;
} else {
while ($row = $dbresult->FetchRow()) {
$current_version = $row["version"];
}
if ($current_version == 1) {
$test->messages[] = ilang('empty_query', $query);
$test->error = true;
}
}
if (!$test->error && $current_version < CMS_SCHEMA_VERSION) {
$test->messages[] = ilang('need_upgrade_schema', $current_version, CMS_SCHEMA_VERSION);
while ($current_version < CMS_SCHEMA_VERSION) {
$filename = cms_join_path(CMS_INSTALL_BASE, 'upgrades', "upgrade.{$current_version}.to." . ($current_version + 1) . '.php');
if (file_exists($filename)) {
if ($this->debug) {
include $filename;
} else {
@(include $filename);
}
} else {
$test->messages[] = ilang('nofiles') . ": {$filename}";
}
$current_version++;
}
$test->messages[] = ilang('schema_ok', $current_version);
} elseif (!$test->error) {
$test->messages[] = ilang('noneed_upgrade_schema', CMS_SCHEMA_VERSION);
}
if (isset($_SESSION['disable_hierarchy'])) {
// gotta move the hierarchy stuff
$query = 'UPDATE ' . cms_db_prefix() . 'content SET page_url = content_alias';
$db->Execute($query);
set_site_preference('content_autocreate_urls', 1);
set_site_preference('content_autocreate_flaturls', 1);
$test->messages[] = ilang('setup_flat_urls');
unset($_SESSION['disable_hierarchy']);
}
$this->smarty->assign('test', $test);
}
示例8: 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;
}
示例9: OrderTeamMembers
function OrderTeamMembers(&$db, $tid)
{
$pref = cms_db_prefix();
$sql = 'SELECT * FROM ' . $pref . 'module_tmt_people WHERE id=? AND flags!=2 ORDER BY displayorder';
$rows = $db->GetAll($sql, array($tid));
if ($rows) {
//to avoid overwrites,in the first pass stored orders are < 0,-1-based
$tmporder = -1;
$sql = 'UPDATE ' . $pref . 'module_tmt_people SET displayorder=? WHERE id=? AND displayorder=?';
foreach ($rows as &$row) {
$db->Execute($sql, array($tmporder, $tid, $row['displayorder']));
$row['displayorder'] = -$tmporder;
$tmporder--;
$row['id'] = (int) $row['id'];
//cleanups
$row['flags'] = (int) $row['flags'];
}
unset($row);
$sql = 'UPDATE ' . $pref . 'module_tmt_people SET displayorder=-displayorder WHERE id=?';
$db->Execute($sql, array($tid));
}
return $rows;
}
示例10: NewDataDictionary
<?php
echo '<p>Adding stylesheet association ordering capability... ';
$dbdict = NewDataDictionary($db);
$sqlarray = $dbdict->AddColumnSQL(cms_db_prefix() . 'css_assoc', 'assoc_order I');
$dbdict->ExecuteSQLArray($sqlarray);
// Now update the values
$query = 'SELECT assoc_to_id, assoc_css_id FROM ' . cms_db_prefix() . 'css_assoc
ORDER BY assoc_to_id, assoc_css_id';
$allrows = $db->GetArray($query);
$assoc_to_id = -1;
foreach ($allrows as $row) {
if ($assoc_to_id != $row['assoc_to_id']) {
$ord = 1;
$assoc_to_id = $row['assoc_to_id'];
}
$q2 = 'UPDATE ' . cms_db_prefix() . 'css_assoc SET assoc_order = ?
WHERE assoc_to_id = ? AND assoc_css_id = ?';
$db->Execute($q2, array($ord, $row['assoc_to_id'], $row['assoc_css_id']));
$ord++;
}
echo '[done]</p>';
echo '<p>Updating schema version... ';
$query = "UPDATE " . cms_db_prefix() . "version SET version = 30";
$db->Execute($query);
echo '[done]</p>';
示例11: Copyright
<?php
/*
This file is part of CMS Made Simple module: Tourney.
Copyright (C) 2014-2015 Tom Phane <tpgww@onepost.net>
Refer to licence and other details at the top of file Tourney.module.php
More info at http://dev.cmsmadesimple.org/projects/tourney
*/
if (!$this->CheckAccess('admin')) {
return $this->Lang('lackpermission');
}
$pref = cms_db_prefix();
$taboptarray = array('mysql' => 'ENGINE MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci', 'mysqli' => 'ENGINE MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci');
$dict = NewDataDictionary($db);
switch ($oldversion) {
case '0.1.0':
case '0.1.1':
$rel = $this->GetPreference('uploads_dir');
if (!$rel) {
$this->SetPreference('uploads_dir', $this->GetName());
}
$this->SetPreference('phone_regex', '^(\\+|\\d)[0-9]{7,16}$');
$flds = "\n\ttype I(1) DEFAULT " . Tourney::KOTYPE . ",\n\tmatch_days C(256),\n\tplaygap N(6.2),\n\tplaygaptype I(1) DEFAULT 2,\n\tplacegap N(6.2),\n\tplacegaptype I(1) DEFAULT 2\n";
$sql = $dict->AlterColumnSQL($pref . 'module_tmt_brackets', $flds);
if (!$dict->ExecuteSQLArray($sql)) {
$msg = $this->Lang('err_upgrade', 'change fields');
$this->Audit(0, $this->Lang('friendlyname'), $msg);
return $msg;
}
$flds = "\n\tadmin_editgroup,\n\tmatch_hours,\n";
$sql = $dict->DropColumnSQL($pref . 'module_tmt_brackets', $flds);
示例12: register_routes
/**
* Grab URLs from the content table and register them with the route manager.
*
* @since 1.9
* @author Robert Campbell <calguy1000@hotmail.com>
* @internal
* @access private
*/
public function register_routes()
{
$gCms = cmsms();
$db = $gCms->GetDb();
$query = 'SELECT content_id,page_url FROM ' . cms_db_prefix() . 'content
WHERE active = 1 AND default_content = 0 AND page_url != \'\'';
$data = $db->GetArray($query);
if (is_array($data)) {
foreach ($data as $onerow) {
$route = new CmsRoute($onerow['page_url'], $onerow['content_id'], '', TRUE);
cms_route_manager::register($route);
}
}
}
示例13: NewDataDictionary
<?php
if (!isset($gCms)) {
exit;
}
// Typical Database Initialization
$db =& $this->cms->db;
$dict = NewDataDictionary($db);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_attach_attachments");
$dict->ExecuteSQLArray($sqlarray);
$db->DropSequence(cms_db_prefix() . "module_attach_attachments_seq");
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_attach_restypes");
$dict->ExecuteSQLArray($sqlarray);
$db->DropSequence(cms_db_prefix() . "module_attach_restypes_seq");
$this->DeleteTemplate("", $this->GetName());
$this->RemovePreference();
// permissions
$this->RemovePermission("attach_use");
$this->RemovePermission("attach_admin");
// put mention into the admin log
$this->Audit(0, $this->Lang("friendlyname"), $this->Lang("uninstalled"));
示例14: cms_db_prefix
if (!isset($gCms)) {
exit;
}
$this->CheckPermission('dummy permission');
//Redirect if not logged in
if (isset($params['reindex'])) {
$this->Reindex();
echo '<div class="pagemcontainer"><p class="pagemessage">' . $this->Lang('reindexcomplete') . '</p></div>';
} else {
if (isset($params['clearwordcount'])) {
$query = 'DELETE FROM ' . cms_db_prefix() . 'module_search_words';
$db->Execute($query);
} else {
if (isset($params['exportcsv'])) {
$query = 'SELECT * FROM ' . cms_db_prefix() . 'module_search_words ORDER BY count DESC';
$data = $db->GetArray($query);
if (is_array($data)) {
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename=search.csv');
while (@ob_end_clean()) {
}
$output = '';
for ($i = 0; $i < count($data); $i++) {
$output .= "\"{$data[$i]['word']}\",{$data[$i]['count']}\n";
}
echo $output;
exit;
}
} else {
示例15: array
//end switch
$smarty->assign('message', $this->Lang('addslides_bulksuccess'));
}
//end if $params['imgselect']
}
// end is multiactionsubmit
$navigation = $this->CreateLink($id, 'addpicture', $returnid, '<img src="../modules/Showtime/images/add_picture.png" class="systemicon">', array('showid' => $showid), '', false, false, '') . ' ' . $this->CreateLink($id, 'addpicture', $returnid, $this->Lang('addpicture'), array('showid' => $showid), '', false, false, 'class="pageoptions"');
$navigation .= " ";
$navigation .= $this->CreateLink($id, 'editshow', $returnid, '<img src="../modules/Showtime/images/showoptions.gif" class="systemicon">', array('showid' => $showid), '', false, true, '') . ' ' . $this->CreateLink($id, 'editshow', $returnid, $this->Lang('EditShow'), array('showid' => $showid), '', false, true, '');
$navigation .= " ";
$navigation .= $this->CreateLink($id, 'defaultadmin', $returnid, '<img src="../modules/Showtime/images/edit_show.png" class="systemicon">', array('showid' => $showid), '', false, false, '') . ' ' . $this->CreateLink($id, 'defaultadmin', $returnid, $this->Lang('back_to_admin'), array('showid' => $showid), '', false, false, 'class="pageoptions"');
$navigation .= ' <strong>Slidehow ' . $showid . ' (' . $showname . ')</strong>';
$this->smarty->assign('navigation', $navigation);
$counter = 0;
$entryarray = array();
$sql = 'SELECT * FROM ' . cms_db_prefix() . 'module_showtime WHERE show_id=' . $showid . ' order by picture_number;';
$result = $db->Execute($sql);
$picturenumber = $result->_numOfRows;
if ($picturenumber > 0) {
$this->smarty->assign('picturetable', 1);
//print header if there are pictures
$this->smarty->assign('L_picture', $this->Lang('picture'));
$this->smarty->assign('L_order', $this->Lang('order'));
$this->smarty->assign('L_picture_name', $this->Lang('picture_name'));
$this->smarty->assign('L_picture_link', $this->Lang('picture_link'));
$this->smarty->assign('L_picture_descriptioin', $this->Lang('picture_descriptioin'));
$this->smarty->assign('L_change_picture', $this->Lang('change_picture'));
$this->smarty->assign('L_status', $this->Lang('status'));
$this->smarty->assign('L_edit_picture', $this->Lang('edit_picture'));
while (!$result->EOF()) {
$fields = $result->fields;