本文整理汇总了PHP中cms_table_name函数的典型用法代码示例。如果您正苦于以下问题:PHP cms_table_name函数的具体用法?PHP cms_table_name怎么用?PHP cms_table_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cms_table_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __update_module
private function __update_module()
{
$bypass = '';
$query = $this->db->select('password')->from(cms_table_name('main_user'))->where('user_id', 1)->get();
if ($query->num_rows() > 0) {
$row = $query->row();
$bypass = $row->password;
}
if ($bypass != '') {
$module_list = $this->cms_get_module_list();
foreach ($module_list as $module) {
$module_path = $module['module_path'];
$module_name = $module['module_name'];
$old_version = $module['old_version'];
$current_version = $module['current_version'];
$active = $module['active'];
$upgrade_link = $module['upgrade_link'];
if ($active && $old_version != $current_version) {
$url = str_replace(site_url(), '', $upgrade_link);
$url = trim($url, '/');
$response = @Modules::run($url, $bypass);
}
}
}
}
示例2: cms_module_table_prefix
function cms_module_table_prefix($module_directory, $new_prefix = NULL)
{
$module_table_prefix = cms_module_config($module_directory, 'module_table_prefix', $new_prefix);
if ($module_table_prefix == '') {
return cms_table_prefix();
} else {
return cms_table_name($module_table_prefix);
}
}
示例3: privileges
public function privileges($keyword = '')
{
$query = $this->db->select('privilege_id, privilege_name')->from(cms_table_name('main_privilege'))->like('privilege_name', $keyword)->limit(20)->get();
$result = array();
foreach ($query->result() as $row) {
$result[] = array('value' => $row->privilege_id, 'caption' => $row->privilege_name);
}
echo json_encode($result);
}
示例4: get_subsite_config_table_name
public function get_subsite_config_table_name($subsite_name){
$cms_config_file = APPPATH.'config/site-'.$subsite_name.'/cms_config.php';
if(file_exists($cms_config_file)){
$config = array();
include $cms_config_file;
if(array_key_exists('__cms_table_prefix', $config)){
$table_prefix = $config['__cms_table_prefix'];
}else if(array_key_exists('cms_table_prefix', $config)){
$table_prefix = $config['cms_table_prefix'];
}else{
$table_prefix = 'site_'.$subsite_name;
}
$config_table_name = $table_prefix.'_main_config';
}else{
$config_table_name = cms_table_name('site_'.$subsite_name.'_main_config');
}
return $config_table_name;
}
示例5: do_upgrade
public function do_upgrade($old_version)
{
$module_path = $this->cms_module_path();
// table : blog article
$table_name = $this->t('message');
$field_list = $this->db->list_fields($table_name);
$missing_fields = array('read' => array('type' => 'INT', 'constraint' => 20, 'unsigned' => TRUE, 'null' => FALSE, 'default' => 0));
$fields = array();
foreach ($missing_fields as $key => $value) {
if (!in_array($key, $field_list)) {
$fields[$key] = $value;
}
}
$this->dbforge->add_column($table_name, $fields);
$version_part = explode('.', $old_version);
$major = $version_part[0];
$minor = $version_part[1];
$build = $version_part[2];
if ($major == 0 && $minor == 0 && $build <= 1) {
$this->db->update(cms_table_name('main_navigation'), array('notif_url' => $this->cms_module_path() . '/notif/new_message'), array('navigation_name' => $this->n('index')));
$this->db->update(cms_table_name('main_navigation'), array('notif_url' => $this->cms_module_path() . '/notif/new_message'), array('navigation_name' => $this->n('manage_message')));
}
}
示例6: do_upgrade
protected function do_upgrade($old_version)
{
// table : blog article
$table_name = $this->cms_complete_table_name('article');
$field_list = $this->db->list_fields($table_name);
$missing_fields = array('keyword' => $this->TYPE_VARCHAR_100_NULL, 'description' => $this->TYPE_TEXT);
$fields = array();
foreach ($missing_fields as $key => $value) {
if (!in_array($key, $field_list)) {
$fields[$key] = $value;
}
}
$this->dbforge->add_column($table_name, $fields);
// table : blog comment
$table_name = $this->cms_complete_table_name('comment');
$field_list = $this->db->list_fields($table_name);
$missing_fields = array('parent_comment_id' => $this->TYPE_INT_UNSIGNED_NULL, 'read' => array('type' => 'INT', 'constraint' => 20, 'unsigned' => TRUE, 'null' => FALSE, 'default' => 0));
$fields = array();
foreach ($missing_fields as $key => $value) {
if (!in_array($key, $field_list)) {
$fields[$key] = $value;
}
}
$this->dbforge->add_column($table_name, $fields);
// navigation: blog_index
$table_name = cms_table_name('main_navigation');
$navigation_name = $this->cms_complete_navigation_name('index');
$this->db->update($table_name, array('notif_url' => $this->cms_module_path($this->NAME) . '/notif/new_comment'), array('navigation_name' => $navigation_name));
// navigation: blog_article
$navigation_name = $this->cms_complete_navigation_name('manage_article');
$this->db->update($table_name, array('notif_url' => $this->cms_module_path($this->NAME) . '/notif/new_comment'), array('navigation_name' => $navigation_name));
// add widget archive
$query = $this->db->select('widget_name')->from(cms_table_name('main_widget'))->where('widget_name', $this->cms_complete_navigation_name('archive'))->get();
if ($query->num_rows() > 0) {
$this->add_widget($this->cms_complete_navigation_name('archive'), 'Archive', $this->PRIV_EVERYONE, $module_path . '/blog_widget/archive', 'sidebar');
}
}
示例7: __update_to_1_0_4
private function __update_to_1_0_4()
{
// Last time, I forgot to add authorization_id for all generated privileges, so here is
$this->db->update(cms_table_name('main_privilege'), array('authorization_id' => 4), array('privilege_id >=' => 0));
}
示例8: _callback_column_translations
public function _callback_column_translations($value, $row)
{
$module_path = $this->cms_module_path();
$query = $this->db->select('detail_language_id, key, translation')->from(cms_table_name('main_detail_language'))->where('id_language', $row->language_id)->get();
$num_row = $query->num_rows();
// show how many records
if ($num_row > 1) {
return $num_row . ' Translations';
} else {
if ($num_row > 0) {
return $num_row . ' Translation';
} else {
return 'No Translation';
}
}
}
示例9: remove_quicklink
protected final function remove_quicklink($navigation_name)
{
$SQL = "SELECT navigation_id FROM " . cms_table_name('main_navigation') . " WHERE navigation_name ='" . addslashes($navigation_name) . "'";
$query = $this->db->query($SQL);
if ($query->num_rows() > 0) {
$row = $query->row();
$navigation_id = $row->navigation_id;
// delete
$where = array("navigation_id" => $navigation_id);
$this->db->delete(cms_table_name('main_quicklink'), $where);
}
}
示例10: route
public function route()
{
$this->cms_guard_page('main_route_management');
$crud = $this->new_crud();
$crud->unset_jquery();
$crud->set_table(cms_table_name('main_route'));
$crud->set_subject('Route');
$crud->required_fields('key', 'value');
$crud->unique_fields('key');
$crud->unset_read();
$crud->columns('key', 'value', 'description');
$crud->edit_fields('key', 'value', 'description');
$crud->add_fields('key', 'value', 'description');
$crud->display_as('key', 'Key')->display_as('value', 'Value')->display_as('description', 'Description');
$crud->unset_texteditor('key');
$crud->unset_texteditor('value');
$crud->unset_texteditor('description');
$crud->callback_after_insert(array($this, '_after_insert_route'));
$crud->callback_after_delete(array($this, '_after_delete_route'));
$crud->callback_after_update(array($this, '_after_update_route'));
$crud->set_language($this->cms_language());
$output = $crud->render();
// prepare css & js, add them to config
$config = array();
$asset = new Cms_asset();
foreach ($output->css_files as $file) {
$asset->add_css($file);
}
$config['css'] = $asset->compile_css();
foreach ($output->js_files as $file) {
$asset->add_js($file);
}
$config['js'] = $asset->compile_js();
// show the view
$this->view('main/main_route', $output, 'main_route_management', $config);
}
示例11: __update_to_0_7_7
private function __update_to_0_7_7()
{
// make route for 404_override
$pattern = array();
$pattern[] = '/(\\$route\\[(\'|")404_override(\'|")\\] *= *")(.*?)(";)/si';
$pattern[] = "/(" . '\\$' . "route\\[('|\")404_override('|\")\\] *= *')(.*?)(';)/si";
if (CMS_SUBSITE == '') {
$file_name = APPPATH . 'config/main/routes.php';
} else {
$file_name = APPPATH . 'config/site-' . CMS_SUBSITE . '/routes.php';
}
$str = file_get_contents($file_name);
$replacement = '${1}main/not_found${5}';
$found = FALSE;
foreach ($pattern as $single_pattern) {
if (preg_match($single_pattern, $str)) {
$found = TRUE;
break;
}
}
if (!$found) {
$str .= PHP_EOL . '$route[\'404_override\'] = \'not_found\';';
} else {
$str = preg_replace($pattern, $replacement, $str);
}
@chmod($file_name, 0777);
if (strpos($str, '<?php') !== FALSE && strpos($str, '$route') !== FALSE) {
@file_put_contents($file_name, $str);
@chmod($file_name, 0555);
}
// make register default-one-column
$this->db->update(cms_table_name('main_navigation'), array('default_layout' => 'default-one-column'), array('navigation_name' => 'main_register'));
// add 404 navigation
$this->cms_add_navigation('main_404', '404 Not Found', 'not_found', 1, NULL, 9, '404 Not found page', NULL, NULL, 'default-one-column', NULL, 1, '<h1>404 Page not found</h1><p>Sorry, the page does not exists.<br /><a class="btn btn-primary" href="{{ site_url }}">Please go back <i class="glyphicon glyphicon-home"></i></a></p>');
}
示例12: get_comments
public function get_comments($article_id)
{
$search = array('<', '>');
$replace = array('<', '>');
$SQL = "SELECT comment_id, date, author_user_id, name, email, website, content\n FROM " . $this->cms_complete_table_name('comment') . "\n WHERE article_id = '{$article_id}' ORDER BY `date` asc";
$query = $this->db->query($SQL);
$data = array();
foreach ($query->result() as $row) {
$user_id = $row->author_user_id;
if (isset($user_id) && $user_id > 0) {
$query_user = $this->db->select('real_name, user_name')->from(cms_table_name('main_user'))->where('user_id', $user_id)->get();
$row_user = $query_user->row();
$name = trim($row_user->real_name) == '' ? $row_user->user_name : $row_user->real_name;
} else {
$name = $row->name;
}
$this->load->helper('url');
$result = array("date" => date('Y-m-d'), "content" => str_replace($search, $replace, $row->content), "name" => $name, "website" => prep_url($row->website));
$data[] = $result;
}
return $data;
}
示例13: preprocess_comment
private function preprocess_comment($row)
{
$search = array('<', '>');
$replace = array('<', '>');
$user_id = $row->author_user_id;
if (isset($user_id) && $user_id > 0) {
$query_user = $this->db->select('real_name, user_name, email')->from(cms_table_name('main_user'))->where('user_id', $user_id)->get();
$row_user = $query_user->row();
$name = trim($row_user->real_name) == '' ? $row_user->user_name : $row_user->real_name;
$email = $row_user->email;
} else {
$name = $row->name;
$email = $row->email;
}
$email = $email === NULL ? '' : $email;
$website = $row->website === NULL ? '' : $row->website;
$this->load->helper('url');
$result = array("comment_id" => $row->comment_id, "date" => date('Y-m-d'), "content" => str_replace($search, $replace, $row->content), "name" => $name, "website" => prep_url($website), "email" => $email, "gravatar_url" => 'http://www.gravatar.com/avatar/' . md5($email) . '?s=32&r=pg&d=identicon');
return $result;
}
示例14: child_module
private final function child_module()
{
$SQL = 'SELECT module_id FROM ' . cms_table_name('main_module') . " WHERE module_name='" . addslashes($this->NAME) . "'";
$query = $this->db->query($SQL);
if ($query->num_rows() > 0) {
$row = $query->row();
$parent_id = $row->module_id;
$SQL = '
SELECT module_name, module_path
FROM
' . cms_table_name('main_module_dependency') . ',
' . cms_table_name('main_module') . '
WHERE
' . cms_table_name('main_module') . '.module_id = ' . cms_table_name('main_module_dependency') . '.module_id AND
parent_id=' . $parent_id;
$query = $this->db->query($SQL);
$result = array();
foreach ($query->result() as $row) {
$result[] = array('module_name' => $row->module_name, 'module_path' => $row->module_name);
}
return $result;
} else {
return array();
}
}
示例15: cms_assign_widget
public function cms_assign_widget($widget_name, $group_name)
{
$query = $this->db->select('group_id')->from(cms_table_name('main_group'))->where('group_name', $group_name)->get();
if ($query->num_rows() > 0) {
$row = $query->row();
$group_id = $row->group_id;
$query = $this->db->select('widget_id')->from(cms_table_name('main_widget'))->where('widget_name', $widget_name)->get();
if ($query->num_rows() > 0) {
$row = $query->row();
$widget_id = $row->widget_id;
$query = $this->db->select('group_id')->from(cms_table_name('main_group_widget'))->where('widget_id', $widget_id)->where('group_id', $group_id)->get();
if ($query->num_rows() == 0) {
$this->db->insert(cms_table_name('main_group_widget'), array('widget_id' => $widget_id, 'group_id' => $group_id));
}
}
}
}