From d32715dcefb98a8123f596ba38334a199763b132 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 9 Mar 2013 14:53:01 -0800 Subject: [PATCH] Rename page_theme to menu_name --- e107_admin/cpage.php | 22 +++++++++++----------- e107_admin/frontpage.php | 2 +- e107_admin/update_routines.php | 9 +++------ e107_core/sql/core_sql.php | 3 +-- e107_core/url/page/sef_noid_url.php | 2 +- e107_handlers/menu_class.php | 2 +- e107_handlers/mysql_class.php | 7 ++++++- e107_handlers/search/search_pages.php | 2 +- e107_plugins/import/import_page_class.php | 2 +- e107_themes/bootstrap/install/install.xml | 4 ++-- page.php | 2 +- 11 files changed, 29 insertions(+), 28 deletions(-) diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 391d9d119..d1c3f0943 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -182,7 +182,7 @@ class menu_admin_ui extends e_admin_ui protected $pluginName = 'core'; protected $table = "page"; - protected $listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme != '' "; // without any Order or Limit. + protected $listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.menu_name != '' "; // without any Order or Limit. //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}"; protected $pid = "page_id"; @@ -196,7 +196,7 @@ class menu_admin_ui extends e_admin_ui protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'page_id' => array('title'=> 'ID', 'type'=>'text', 'tab' => 0, 'width'=>'5%', 'readParms'=>'','forced'=> TRUE), - 'page_theme' => array('title'=> "Menu Name", 'tab' => 0, 'type' => 'text', 'width' => 'auto','nolist'=>true), + 'menu_name' => array('title'=> "Menu Name", 'tab' => 0, 'type' => 'text', 'width' => 'auto','nolist'=>true), 'page_title' => array('title'=> LAN_TITLE, 'tab' => 0, 'type' => 'text', 'width'=>'25%', 'inline'=>true), // 'page_template' => array('title'=> 'Template', 'tab' => 0, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), @@ -207,7 +207,7 @@ class menu_admin_ui extends e_admin_ui 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center' ); - protected $fieldpref = array("page_id","page_theme", "page_title", "page_text"); + protected $fieldpref = array("page_id","menu_name", "page_title", "page_text"); function init() @@ -348,8 +348,8 @@ class page_admin_ui extends e_admin_ui 'page_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'width' => 'auto', 'inline'=>true), - // Menu Tab XXX 'page_theme' is 'menu_name' - not caption. - 'page_theme' => array('title'=> "Menu Name", 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {MENU|name} in your theme."), + // Menu Tab XXX 'menu_name' is 'menu_name' - not caption. + 'menu_name' => array('title'=> "Menu Name", 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {MENU|name} in your theme."), 'menu_title' => array('title'=> "Menu Title", 'nolist'=>true, 'tab' => 2, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Caption displayed on the menu item."), 'menu_text' => array('title'=> "Menu Body", 'nolist'=>true, 'tab' => 2, 'type' => 'bbarea', 'data'=>'str', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page' ), 'menu_template' => array('title'=> "Menu Template", 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), @@ -381,7 +381,7 @@ class page_admin_ui extends e_admin_ui if($this->getMode() == 'menu' && ($this->getACtion() == 'list' || $this->getACtion() == 'inline')) { - $this->listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme != '' "; // without any Order or Limit. + $this->listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.menu_name != '' "; // without any Order or Limit. $this->batchDelete = false; $this->fields = array( @@ -390,7 +390,7 @@ class page_admin_ui extends e_admin_ui 'menu_image' => array('title' =>"Menu Image", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80','readonly'=>false), - 'page_theme' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => 'auto','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name"), + 'menu_name' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => 'auto','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name"), 'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => 'auto', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), // 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'), @@ -402,7 +402,7 @@ class page_admin_ui extends e_admin_ui 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'noselector' => true, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'deleteClass=252') ); - $this->fieldpref = array("page_id","page_theme", "menu_title", "menu_text", 'menu_image', 'menu_template'); + $this->fieldpref = array("page_id","menu_name", "menu_title", "menu_text", 'menu_image', 'menu_template'); } @@ -444,7 +444,7 @@ class page_admin_ui extends e_admin_ui $sql = e107::getDb(); $mes = e107::getMessage(); - $menu_name = $tp->toDB($newdata['page_theme']); // not to be confused with menu-caption. + $menu_name = $tp->toDB($newdata['menu_name']); // not to be confused with menu-caption. $menu_path = intval($id); if (!$sql->select('menus', 'menu_name', "`menu_path` = ".$menu_path." LIMIT 1")) @@ -465,14 +465,14 @@ class page_admin_ui extends e_admin_ui function beforeCreate($newdata,$olddata) { - $newdata['page_theme'] = preg_replace('/[^\w-*]/','',$newdata['page_theme']); + $newdata['menu_name'] = preg_replace('/[^\w-*]/','',$newdata['menu_name']); return $newdata; } function beforeUpdate($newdata,$olddata) { - $newdata['page_theme'] = preg_replace('/[^\w-*]/','',$newdata['page_theme']); + $newdata['menu_name'] = preg_replace('/[^\w-*]/','',$newdata['menu_name']); return $newdata; } diff --git a/e107_admin/frontpage.php b/e107_admin/frontpage.php index 32336d514..7c6b25175 100644 --- a/e107_admin/frontpage.php +++ b/e107_admin/frontpage.php @@ -42,7 +42,7 @@ $front_page['news'] = array('page' => 'news.php', 'title' => ADLAN_0); //$front_page['download'] = array('page' => 'download.php', 'title' => ADLAN_24); // Its a plugin now $front_page['wmessage'] = array('page' => 'index.php', 'title' => ADLAN_28); -if($sql->db_Select('page', 'page_id, page_title', "page_theme=''")) +if($sql->db_Select('page', 'page_id, page_title', "menu_name=''")) { $front_page['custom']['title'] = FRTLAN_30; while($row = $sql->db_Fetch()) diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index a1238a369..0678774b2 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -953,6 +953,7 @@ function update_706_to_800($type='') /* -------------- Upgrade Entire Table Structure - Multi-Language Supported ----------------- */ + // ONLY ever add fields, never deletes. require_once(e_HANDLER."db_verify_class.php"); $dbv = new db_verify; @@ -984,8 +985,9 @@ function update_706_to_800($type='') return update_needed("Pages/Menus Table requires updating."); } - if($sql->update('page',"menu_title = page_title, menu_text = page_text, menu_template='default' WHERE menu_title = '' AND menu_text = '' ")) + if($sql->update('page',"menu_name = page_theme, menu_title = page_title, menu_text = page_text, menu_template='default' WHERE menu_title = '' AND menu_text = '' ")) { + $sql->gen("ALTER TABLE `#page` DROP `page_theme`"); $mes = e107::getMessage(); $mes->addDebug("Successfully updated pages/menus table to new format. "); } @@ -993,11 +995,6 @@ function update_706_to_800($type='') } - - - - - // --- Notify Prefs $notify_prefs = $sysprefs -> get('notify_prefs'); diff --git a/e107_core/sql/core_sql.php b/e107_core/sql/core_sql.php index db075eaa5..c64c1d024 100644 --- a/e107_core/sql/core_sql.php +++ b/e107_core/sql/core_sql.php @@ -383,10 +383,9 @@ CREATE TABLE page ( page_password varchar(50) NOT NULL default '', page_class varchar(250) NOT NULL default '', page_ip_restrict text NOT NULL, - page_theme varchar(50) NOT NULL default '', page_template varchar(50) NOT NULL default '', page_order int(4) unsigned NOT NULL default '9999', - + menu_name varchar(50) NOT NULL default '', menu_title varchar(50) NOT NULL default '', menu_text mediumtext NOT NULL, menu_image varchar(250) NOT NULL default '', diff --git a/e107_core/url/page/sef_noid_url.php b/e107_core/url/page/sef_noid_url.php index 94149207e..bcb030321 100644 --- a/e107_core/url/page/sef_noid_url.php +++ b/e107_core/url/page/sef_noid_url.php @@ -80,7 +80,7 @@ class core_page_sef_noid_url extends eUrlConfig $sql = e107::getDb('url'); $name = e107::getParser()->toDB($name); - if($sql->db_Select('page', 'page_id', "page_theme='' AND page_sef='{$name}'")) + if($sql->db_Select('page', 'page_id', "menu_name='' AND page_sef='{$name}'")) { $name = $sql->db_Fetch(); $request->setRequestParam('name', $name['page_id']); diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 0a69d7f8c..31d49233d 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -273,7 +273,7 @@ class e_menu if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu { - $query = ($mname === false) ? "page_theme = '".$mpath."' " : "page_id=".intval($mpath)." "; // load by ID or load by menu-name (page_theme) + $query = ($mname === false) ? "menu_name = '".$mpath."' " : "page_id=".intval($mpath)." "; // load by ID or load by menu-name (menu_name) $sql->select("page", "*", $query); $page = $sql->fetch(); diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 5107155e2..96c86a736 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -1445,6 +1445,11 @@ class e_db_mysql } + function db_Field($table,$fieldid="",$key="", $retinfo = FALSE) + { + return $this->field($table,$fieldid,$key, $retinfo); + } + /** * Determines if a plugin field (and key) exist. OR if fieldid is numeric - return the field name in that position. @@ -1455,7 +1460,7 @@ class e_db_mysql * @param boolean $retinfo = FALSE - just returns array of field names. TRUE - returns all field info * @return array|boolean - FALSE on error, field information on success */ - function db_Field($table,$fieldid="",$key="", $retinfo = FALSE) + function field($table,$fieldid="",$key="", $retinfo = FALSE) { if(!$this->mySQLdefaultdb) { diff --git a/e107_handlers/search/search_pages.php b/e107_handlers/search/search_pages.php index 5617655c6..5a1e4fb45 100644 --- a/e107_handlers/search/search_pages.php +++ b/e107_handlers/search/search_pages.php @@ -24,7 +24,7 @@ $search_fields = array('page_title', 'page_text'); $weights = array('1.2', '0.6'); $no_results = LAN_198; -$where = "page_class IN (".USERCLASS_LIST.") AND `page_theme` = '' AND".$advanced_where; +$where = "page_class IN (".USERCLASS_LIST.") AND `menu_name` = '' AND".$advanced_where; $order = array('page_datestamp' => DESC); $table = "page"; diff --git a/e107_plugins/import/import_page_class.php b/e107_plugins/import/import_page_class.php index 1cd708d59..8bb3c1411 100644 --- a/e107_plugins/import/import_page_class.php +++ b/e107_plugins/import/import_page_class.php @@ -48,7 +48,7 @@ class page_import 'page_password' => '', 'page_class' => '0', 'page_ip_restrict' => '', - 'page_theme' => '', + 'menu_name' => '', 'page_template' => 'default' ); diff --git a/e107_themes/bootstrap/install/install.xml b/e107_themes/bootstrap/install/install.xml index e721d0708..cbd988c09 100644 --- a/e107_themes/bootstrap/install/install.xml +++ b/e107_themes/bootstrap/install/install.xml @@ -208,7 +208,7 @@ 0 - + default 9999 @@ -227,7 +227,7 @@ 0 - + panel 9999 diff --git a/page.php b/page.php index 0e2ead5ff..6f50540dd 100644 --- a/page.php +++ b/page.php @@ -224,7 +224,7 @@ class pageClass } else { - if(!$sql->db_Select("page", "*", "page_theme='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC ")) + if(!$sql->db_Select("page", "*", "menu_name='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC ")) { $text = ""; }