From c94655a5e9fff626c59913837028abd11d3811bc Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 7 Nov 2016 12:09:12 -0800 Subject: [PATCH 1/6] Fixes #1967 - Allow for display of page which doesn't contain a page title. --- e107_admin/cpage.php | 2 +- e107_handlers/admin_ui.php | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index abf963a7b..116d6e02e 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -440,7 +440,7 @@ class page_admin_ui extends e_admin_ui LEFT JOIN #user AS u ON p.page_author = u.user_id LEFT JOIN #page_chapters AS pch ON p.page_chapter = pch.chapter_id LEFT JOIN #page_chapters AS pbk ON pch.chapter_parent = pbk.chapter_id - WHERE p.page_title != '' "; // without any Order or Limit. + WHERE (p.page_title != '' OR p.page_text != '') "; // without any Order or Limit. //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}"; protected $pid = "page_id"; diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index fce59e322..b8a778d5e 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -4349,24 +4349,25 @@ class e_admin_ui extends e_admin_controller_ui $form = e107::getAddon($plug, 'e_admin', $plug."_admin_form"); // class | false. - foreach($config['fields'] as $k=>$v) + if(!empty($config['fields'])) { - $v['data'] = false; // disable data-saving to db table. . - - $fieldName = 'x_'.$plug.'_'.$k; - - if($v['type'] == 'method' && method_exists($form,$fieldName)) + foreach($config['fields'] as $k=>$v) { - $v['method'] = $plug."_admin_form::".$fieldName; - //echo "Found method ".$fieldName." in ".$plug."_menu_form"; - //echo $form->$fieldName(); + $v['data'] = false; // disable data-saving to db table. . + + $fieldName = 'x_'.$plug.'_'.$k; + + if($v['type'] == 'method' && method_exists($form,$fieldName)) + { + $v['method'] = $plug."_admin_form::".$fieldName; + //echo "Found method ".$fieldName." in ".$plug."_menu_form"; + //echo $form->$fieldName(); + } + + + $this->fields[$fieldName] = $v; // ie. x_plugin_key + } - - - $this->fields[$fieldName] = $v; // ie. x_plugin_key - - - } if(!empty($config['batchOptions'])) From 41d873a9ba62d1da2832fd0d6e905741c482e086 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Nov 2016 09:27:37 -0800 Subject: [PATCH 2/6] Fixes #2007 #2014 - Search template path. --- search.php | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/search.php b/search.php index 5746b456a..16d5b3009 100644 --- a/search.php +++ b/search.php @@ -86,7 +86,19 @@ class search extends e_shortcode } else { - if (file_exists(THEME."search_template.php")) + $SEARCH_TOP_TABLE = ''; + $SEARCH_BOT_TABLE = ''; + $SEARCH_CATS = ''; + $SEARCH_TYPE = ''; + $SEARCH_ADV = ''; + $SEARCH_ENHANCED = ''; + $SEARCH_ADV_COMBO = ''; + + if (file_exists(THEME."templates/search_template.php")) + { + require(THEME."templates/search_template.php"); + } + elseif (file_exists(THEME."search_template.php")) { require(THEME."search_template.php"); } @@ -229,6 +241,14 @@ class search extends e_shortcode private function selectElement($parm) { // standard search config + $dropdown = ''; + $PRE_CHECKBOXES = ''; + $POST_CHECKBOXES = ''; + + $search_count = count($this->search_info); + $google_id = $search_count + 1; + + if ($this->search_prefs['selector'] == 2) { $dropdown = "\n"; + + $text .= $frm->hidden("event[".$id."][include]", $include); + $text .= $frm->hidden("event[".$id."][legacy]", $legacy); // function or method + + if(isset($this->notify_prefs['event'][$id]['class']) && $this->notify_prefs['event'][$id]['class'] != e_UC_NOBODY) + { + $text .= $frm->button('test['.$id.']', $id, 'confirm', 'Test'); + } + + + $text .= ""; + + + + + $text .= " + "; + return $text; + } + + + function update() + { + $this->changeList = array(); + + $active = false; + + foreach ($_POST['event'] as $key => $value) + { + if ($this -> update_event($key)) + { + $active = true; + } + } + + // print_a($this->notify_prefs); + /* + $s_prefs = $tp -> toDB($this -> notify_prefs); + $s_prefs = $eArrayStorage -> WriteArray($s_prefs); + if($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'")!==FALSE) + */ + + e107::getConfig()->set('notify',$active)->save(true,true,false); + e107::getConfig('notify')->updatePref($this->notify_prefs); + if (e107::getConfig('notify')->save(FALSE)) + { + // e107::getAdminLog()->logArrayAll('NOTIFY_01',$this->changeList); + return true; + } + else + { + return false; + } + + } + + + + + + function update_event($id) + { + $changed = FALSE; + + if ($this -> notify_prefs['event'][$id]['class'] != $_POST['event'][$id]['class']) + { + $this -> notify_prefs['event'][$id]['class'] = $_POST['event'][$id]['class']; + $changed = TRUE; + } + if ($this -> notify_prefs['event'][$id]['email'] != $_POST['event'][$id]['email']) + { + $this -> notify_prefs['event'][$id]['email'] = $_POST['event'][$id]['email']; + $changed = TRUE; + } + + $this -> notify_prefs['event'][$id]['include'] = $_POST['event'][$id]['include']; + $this -> notify_prefs['event'][$id]['legacy'] = $_POST['event'][$id]['legacy']; + + unset($this -> notify_prefs['event'][$id]['plugin']); + unset($this -> notify_prefs['event'][$id]['type']); + + if ($changed) + { + $this->changeList[$id] = $this->notify_prefs['event'][$id]['class'].', '.$this->notify_prefs['event'][$id]['email']; + } + if ($this -> notify_prefs['event'][$id]['class'] != 255) + { + return TRUE; + } + else + { + return FALSE; + } + } +} + +class plugin_notify_admin_form_ui extends e_admin_form_ui +{ + + + +} + + +new plugin_notify_admin(); + + +require_once(e_ADMIN."auth.php"); + +e107::getAdminUI()->runPage(); + +require_once(e_ADMIN."footer.php"); + +function headerjs() +{ + + $js = " + "; + + return $js; +} + +exit; + + + + + + + + + + + + + + + + + + + + + + + + $e_sub_cat = 'notify'; @@ -534,7 +1030,7 @@ class notify_config } } -require_once(e_ADMIN.'footer.php'); +require_once(e_ADMIN.'footer.php');/* function headerjs() { @@ -556,5 +1052,5 @@ function headerjs() "; return $js; -} +}*/ ?> From 9eba6b5a236aeceeba9ecb08937de2d49723bc19 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Nov 2016 10:14:27 -0800 Subject: [PATCH 4/6] Fixes #2008 - Search Form URL --- e107_core/templates/search_template.php | 4 ++-- e107_plugins/search_menu/search_menu.php | 11 +++++++---- search.php | 11 +++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/e107_core/templates/search_template.php b/e107_core/templates/search_template.php index f8e467208..0ef9a594b 100644 --- a/e107_core/templates/search_template.php +++ b/e107_core/templates/search_template.php @@ -27,7 +27,7 @@ if(!isset($SEARCH_SHORTCODE)) if(!isset($SEARCH_TOP_TABLE)) { $SEARCH_TOP_TABLE = "
-
+
".LAN_199." @@ -135,7 +135,7 @@ if(!isset($POST_CHECKBOXES)) $SEARCH_TEMPLATE['form']['start'] = ' - +
{SEARCH_MAIN} diff --git a/e107_plugins/search_menu/search_menu.php b/e107_plugins/search_menu/search_menu.php index f86acc0b5..3798078d7 100644 --- a/e107_plugins/search_menu/search_menu.php +++ b/e107_plugins/search_menu/search_menu.php @@ -61,12 +61,12 @@ if (isset($custom_query[5]) && $custom_query[5]) { $value_text = "value=''"; } - +$search_form_url = e107::getUrl()->create('search'); if(deftrue('BOOTSTRAP')) { $text = ' - +
'; @@ -85,7 +85,7 @@ if(deftrue('BOOTSTRAP')) } else // Legacy v1 code. { - $text = ""; + $text = ""; $text .= "
@@ -109,7 +109,10 @@ else // Legacy v1 code. if (isset($searchflat) && $searchflat) { echo $text; -} else { +} +else +{ $ns->tablerender(LAN_SEARCH." ".SITENAME, "
".$text."
", 'search'); } + ?> \ No newline at end of file diff --git a/search.php b/search.php index 16d5b3009..c70451979 100644 --- a/search.php +++ b/search.php @@ -238,6 +238,17 @@ class search extends e_shortcode return $this->message; } + function sc_search_form_url($parm='') + { + return e107::getUrl()->create('search'); + } + + + + // ----------------------- + + + private function selectElement($parm) { // standard search config From 593533298b091d7bf773a067de3c4b819e9dd0cb Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Nov 2016 11:04:12 -0800 Subject: [PATCH 5/6] Issue #2003 Remove old files. --- e107_admin/search.php | 6 ++ e107_handlers/search/advanced_download.php | 45 --------------- e107_handlers/search/search_download.php | 64 ---------------------- 3 files changed, 6 insertions(+), 109 deletions(-) delete mode 100644 e107_handlers/search/advanced_download.php delete mode 100644 e107_handlers/search/search_download.php diff --git a/e107_admin/search.php b/e107_admin/search.php index c2d3a918e..a75e647d9 100644 --- a/e107_admin/search.php +++ b/e107_admin/search.php @@ -494,6 +494,12 @@ else foreach ($search_prefs['comments_handlers'] as $key => $value) { $path = ($value['dir'] == 'core') ? e_HANDLER.'search/comments_'.$key.'.php' : e_PLUGIN.$value['dir'].'/search/search_comments.php'; + + if($value['dir'] == 'download' && !e107::isInstalled($value['dir'])) + { + continue; + } + if(is_readable($path)) { require_once($path); diff --git a/e107_handlers/search/advanced_download.php b/e107_handlers/search/advanced_download.php deleted file mode 100644 index ec7385ae0..000000000 --- a/e107_handlers/search/advanced_download.php +++ /dev/null @@ -1,45 +0,0 @@ - 'all', 'title' => LAN_SEARCH_51); - -$advanced_caption['id'] = 'cat'; -$advanced_caption['title']['all'] = LAN_SEARCH_64; - -if ($sql -> db_Select_gen("SELECT download_category_id, download_category_name FROM #download_category WHERE download_category_parent != 0 AND download_category_class IN (".USERCLASS_LIST.")")) { - while ($row = $sql -> db_Fetch()) { - $advanced['cat']['list'][] = array('id' => $row['download_category_id'], 'title' => $row['download_category_name']); - $advanced_caption['title'][$row['download_category_id']] = LAN_SEARCH_65.' -> '.$row['download_category_name']; - } -} - -$advanced['date']['type'] = 'date'; -$advanced['date']['text'] = LAN_SEARCH_66.':'; - -$advanced['author']['type'] = 'author'; -$advanced['author']['text'] = LAN_SEARCH_61.':'; - -$advanced['match']['type'] = 'dropdown'; -$advanced['match']['text'] = LAN_SEARCH_52.':'; -$advanced['match']['list'][] = array('id' => 0, 'title' => LAN_SEARCH_67); -$advanced['match']['list'][] = array('id' => 1, 'title' => LAN_SEARCH_54); -*/ - -?> \ No newline at end of file diff --git a/e107_handlers/search/search_download.php b/e107_handlers/search/search_download.php deleted file mode 100644 index 2c74e8e55..000000000 --- a/e107_handlers/search/search_download.php +++ /dev/null @@ -1,64 +0,0 @@ -=' : '<=')." '".(time() - $_GET['time'])."' AND"; -} - -if (isset($_GET['author']) && $_GET['author'] != '') { - $advanced_where .= " (d.download_author = '".$tp -> toDB($_GET['author'])."') AND"; -} - -if (isset($_GET['match']) && $_GET['match']) { - $search_fields = array('d.download_name'); -} else { - $search_fields = array('d.download_name', 'd.download_url', 'd.download_description', 'd.download_author', 'd.download_author_website'); -} - -// basic -$return_fields = 'd.download_id, d.download_category, download_category_id, d.download_name, d.download_description, d.download_author, d.download_author_website, d.download_datestamp, d.download_class, c.download_category_name, c.download_category_class'; -$weights = array('1.2', '0.9', '0.6', '0.6', '0.4'); -$no_results = LAN_198; -$where = "download_active > '0' AND d.download_visible IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND".$advanced_where; -$order = array('download_datestamp' => DESC); -$table = "download AS d LEFT JOIN #download_category AS c ON d.download_category = c.download_category_id"; - -$ps = $sch -> parsesearch($table, $return_fields, $search_fields, $weights, 'search_downloads', $no_results, $where, $order); -$text .= $ps['text']; -$results = $ps['results']; - -function search_downloads($row) { - global $con; - $datestamp = $con -> convert_date($row['download_datestamp'], "long"); - $res['link'] = "download.php?view.".$row['download_id']; - $res['pre_title'] = $row['download_category_name']." | "; - $res['title'] = $row['download_name']; - $res['pre_summary'] = ""; - $res['summary'] = $row['download_description']; - $res['detail'] = LAN_SEARCH_15." ".$row['download_author']." | ".LAN_SEARCH_66.": ".$datestamp; - return $res; -} -*/ -?> \ No newline at end of file From 1bed9da9ab99991e834423e198b3bc35a654b220 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Nov 2016 19:01:26 -0800 Subject: [PATCH 6/6] Option added to set unique IDs for each tablerender() instance. --- class2.php | 26 +++++++++++++++---- .../shortcodes/batch/admin_shortcodes.php | 5 ++-- e107_handlers/menu_class.php | 2 ++ e107_themes/bootstrap3/admin_theme.php | 3 +++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/class2.php b/class2.php index 12a111c1f..a0dabcde8 100644 --- a/class2.php +++ b/class2.php @@ -908,7 +908,8 @@ if (!class_exists('e107table', false)) private $themeClass = ''; private $adminThemeClass = ''; public $frontend = null; - + private $uniqueId = null; + function __construct() { @@ -918,13 +919,23 @@ if (!class_exists('e107table', false)) /** - * @param $style + * Set the style mode for use in tablestyle() method/function + * @param string $style */ - function setStyle($style) + public function setStyle($style) { $this->eSetStyle = $style; } + /** + * Set a unique id for use in tablestyle() method/function + * @param string $id + */ + public function setUniqueId($id) + { + $this->uniqueId = $id; + } + /** * @param $caption string caption text @@ -948,6 +959,10 @@ if (!class_exists('e107table', false)) extract($result); } + + + + if ($return) { if(!empty($text) && $this->eMenuArea) @@ -998,13 +1013,14 @@ if (!class_exists('e107table', false)) if(is_object(vartrue($thm))) { - $thm->tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle)); + $thm->tablestyle($caption, $text, $mode, array('uniqueId'=>$this->uniqueId, 'menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle)); } else { - tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle)); + tablestyle($caption, $text, $mode, array('uniqueId'=>$this->uniqueId, 'menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle)); } + $this->uniqueId = null; } diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 43be7fc1d..17486a70b 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -507,7 +507,7 @@ class admin_shortcodes // $text .= "
"; - + $ns->setUniqueId('e-latest-list'); return ($parm != 'norender') ? $ns -> tablerender(ADLAN_LAT_1, $text, '', TRUE) : $text; } @@ -983,6 +983,7 @@ class admin_shortcodes if ($pref['adminpwordchange'] && ((ADMINPWCHANGE+2592000) < time())) { $text = "
".ADLAN_102." ".ADLAN_103.'
'; + $ns->setUniqueId('e-password-change'); return $ns -> tablerender(ADLAN_104, $text, '', true); } } @@ -1208,7 +1209,7 @@ class admin_shortcodes // $text .= "\n\t\t\t\t\t
"; - + $ns->setUniqueId('e-status-list'); return ($parm != 'norender') ? $ns -> tablerender(LAN_STATUS, $text, '', TRUE) : $text; } } diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 15c410dcd..59405a8a5 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -513,6 +513,7 @@ class e_menu // if($template['noTableRender'] !==true) // XXX Deprecated - causes confusion while themeing. use {SETSTYLE=none} instead. // { + $ns->setUniqueId('cmenu-'.$page['menu_name']); $ns->tablerender($caption, $text, 'cmenu-'.$page['menu_template']); // } // else @@ -524,6 +525,7 @@ class e_menu else { $text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants'); + $ns->setUniqueId('cmenu-'.$page['menu_name']); $ns->tablerender($caption, $text, 'cmenu'); } diff --git a/e107_themes/bootstrap3/admin_theme.php b/e107_themes/bootstrap3/admin_theme.php index 24b253d1a..89ed4f7b1 100644 --- a/e107_themes/bootstrap3/admin_theme.php +++ b/e107_themes/bootstrap3/admin_theme.php @@ -102,6 +102,9 @@ class bootstrap3_admintheme $style = $data['setStyle']; // echo "Style: ".$style; + + echo "\n\n\n\n"; + $class = ''; if(is_string($mode) && $mode == 'admin_help') $class = ' '.str_replace('_', '-', $mode);