From dab9ef360c36de3e0b4060996a533036c1a58de0 Mon Sep 17 00:00:00 2001 From: lisa Date: Tue, 27 Jan 2009 21:34:02 +0000 Subject: [PATCH] recode list_new plugin + e_list.php files --- e107_plugins/calendar_menu/e_list.php | 156 +-- e107_plugins/chatbox_menu/e_list.php | 95 +- e107_plugins/forum/e_list.php | 251 ++-- e107_plugins/links_page/e_list.php | 103 +- e107_plugins/list_new/admin_list_config.php | 577 +--------- e107_plugins/list_new/languages/English.php | 27 +- .../languages/English_admin_list_new.php | 29 +- e107_plugins/list_new/list.php | 141 +-- e107_plugins/list_new/list_admin_class.php | 570 +++++++++ e107_plugins/list_new/list_class.php | 1020 +++++++++++------ e107_plugins/list_new/list_new_menu.php | 65 +- e107_plugins/list_new/list_recent_menu.php | 68 +- e107_plugins/list_new/list_shortcodes.php | 135 ++- e107_plugins/list_new/list_template.php | 101 +- e107_plugins/list_new/plugin.xml | 4 +- .../list_new/section/list_comment.php | 120 +- .../list_new/section/list_download.php | 107 +- .../list_new/section/list_members.php | 82 +- e107_plugins/list_new/section/list_news.php | 175 ++- 19 files changed, 2213 insertions(+), 1613 deletions(-) create mode 100644 e107_plugins/list_new/list_admin_class.php diff --git a/e107_plugins/calendar_menu/e_list.php b/e107_plugins/calendar_menu/e_list.php index 4f92f5b8b..1691a4ea9 100644 --- a/e107_plugins/calendar_menu/e_list.php +++ b/e107_plugins/calendar_menu/e_list.php @@ -1,87 +1,101 @@ db_Select("plugin", "*", "plugin_path = 'calendar_menu' AND plugin_installflag = '1' ")) - { - return; - } -} - - $LIST_CAPTION = $arr[0]; - $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); - -require_once('ecal_class.php'); -$ecal_class = new ecal_class; - -$current_day = $ecal_class->cal_date['mday']; -$current_month = $ecal_class->cal_date['mon']; -$current_year = $ecal_class->cal_date['year']; - - $current = mktime(0,0,0,$current_month, $current_day, $current_year); - - if($mode == "new_page" || $mode == "new_menu" ){ - $lvisit = $this -> getlvisit(); - $qry = " event_datestamp>".intval($lvisit)." AND "; - }else{ - $qry = ""; + function list_calendar_menu($parent) + { + $this->parent = $parent; } - $bullet = $this -> getBullet($arr[6], $mode); + function getListData() + { + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); - $qry = " - SELECT e.*, c.event_cat_name - FROM #event AS e - LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category - WHERE ".$qry." e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."' - ORDER BY e.event_start ASC LIMIT 0,".intval($arr[7]); + require_once('ecal_class.php'); + $ecal_class = new ecal_class; - if(!$event_items = $sql->db_Select_gen($qry)){ - $LIST_DATA = LIST_CALENDAR_2; - }else{ - while($row = $sql -> db_Fetch()){ + $current_day = $ecal_class->cal_date['mday']; + $current_month = $ecal_class->cal_date['mon']; + $current_year = $ecal_class->cal_date['year']; - $tmp = explode(".", $row['event_author']); - if($tmp[0] == "0"){ - $AUTHOR = $tmp[1]; - }elseif(is_numeric($tmp[0]) && $tmp[0] != "0"){ - $AUTHOR = (USER ? "".$tmp[1]."" : $tmp[1]); - }else{ - $AUTHOR = ""; - } + $current = mktime(0,0,0,$current_month, $current_day, $current_year); - $rowheading = $this -> parse_heading($row['event_title'], $mode); - $ICON = $bullet; - $HEADING = "".$rowheading.""; - $CATEGORY = $row['event_cat_name']; - $DATE = ($arr[5] ? ($row['event_start'] ? $this -> getListDate($row['event_start'], $mode) : "") : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $lvisit = $this->parent->getlvisit(); + $qry = " event_datestamp>".intval($lvisit)." AND "; } + else + { + $qry = ""; + } + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + $qry = " + SELECT e.*, c.event_cat_name + FROM #event AS e + LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category + WHERE ".$qry." e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."' + ORDER BY e.event_start ASC LIMIT 0,".intval($this->parent->settings['amount']); + + if(!$event_items = $this->parent->e107->sql->db_Select_gen($qry)) + { + $list_data = LIST_CALENDAR_2; + } + else + { + while($row = $this->parent->e107->sql->db_Fetch()) + { + $record = array(); + $tmp = explode(".", $row['event_author']); + if($tmp[0] == "0") + { + $record['author'] = $tmp[1]; + } + elseif(is_numeric($tmp[0]) && $tmp[0] != "0") + { + $record['author'] = (USER ? "".$tmp[1]."" : $tmp[1]); + } + else + { + $record['author'] = ""; + } + + $rowheading = $this->parent->parse_heading($row['event_title']); + $record['icon'] = $bullet; + $record['heading'] = "".$rowheading.""; + $record['category'] = $row['event_cat_name']; + $record['date'] = ($this->parent->settings['date'] ? ($row['event_start'] ? $this->parent->getListDate($row['event_start']) : "") : ""); + $record['info'] = ''; + + $list_data[] = $record; + } + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } +} ?> \ No newline at end of file diff --git a/e107_plugins/chatbox_menu/e_list.php b/e107_plugins/chatbox_menu/e_list.php index 8677e1d6d..2bc551e56 100644 --- a/e107_plugins/chatbox_menu/e_list.php +++ b/e107_plugins/chatbox_menu/e_list.php @@ -1,41 +1,74 @@ db_Select("plugin", "*", "plugin_path = 'chatbox_menu' AND plugin_installflag = '1' ")){ - return; +class list_chatbox_menu +{ + function list_chatbox_menu($parent) + { + $this->parent = $parent; } - $LIST_CAPTION = $arr[0]; - $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); + function getListData() + { + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); - if($mode == "new_page" || $mode == "new_menu" ){ - $lvisit = $this -> getlvisit(); - $qry = "cb_datestamp>".$lvisit; - }else{ - $qry = "cb_id != '0' "; - } - $qry .= " ORDER BY cb_datestamp DESC LIMIT 0,".intval($arr[7]); - - $bullet = $this -> getBullet($arr[6], $mode); - - if(!$chatbox_posts = $sql -> db_Select("chatbox", "*", $qry)){ - $LIST_DATA = LIST_CHATBOX_2; - }else{ - while($row = $sql -> db_Fetch()) { - - $cb_id = substr($row['cb_nick'] , 0, strpos($row['cb_nick'] , ".")); - $cb_nick = substr($row['cb_nick'] , (strpos($row['cb_nick'] , ".")+1)); - $cb_message = ($row['cb_blocked'] ? CHATBOX_L6 : str_replace("
", " ", $tp -> toHTML($row['cb_message']))); - $rowheading = $this -> parse_heading($cb_message, $mode); - $ICON = $bullet; - $HEADING = $rowheading; - $AUTHOR = ($arr[3] ? ($cb_id != 0 ? "".$cb_nick."" : $cb_nick) : ""); - $CATEGORY = ""; - $DATE = ($arr[5] ? ($row['cb_datestamp'] ? $this -> getListDate($row['cb_datestamp'], $mode) : "") : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $lvisit = $this->parent->getlvisit(); + $qry = "cb_datestamp>".$lvisit; } + else + { + $qry = "cb_id != '0' "; + } + $qry .= " ORDER BY cb_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + if(!$chatbox_posts = $this->parent->e107->sql->db_Select_gen("SELECT * FROM #chatbox WHERE ".$qry)) + { + $list_data = LIST_CHATBOX_2; + } + else + { + while($row = $this->parent->e107->sql->db_Fetch()) + { + $cb_id = substr($row['cb_nick'] , 0, strpos($row['cb_nick'] , ".")); + $cb_nick = substr($row['cb_nick'] , (strpos($row['cb_nick'] , ".")+1)); + $cb_message = ($row['cb_blocked'] ? CHATBOX_L6 : str_replace("
", " ", $tp->toHTML($row['cb_message']))); + $rowheading = $this->parent->parse_heading($cb_message); + $record['icon'] = $bullet; + $record['heading'] = $rowheading; + $record['author'] = ($this->parent->settings['author'] ? ($cb_id != 0 ? "".$cb_nick."" : $cb_nick) : ""); + $record['category'] = ""; + $record['date'] = ($this->parent->settings['date'] ? ($row['cb_datestamp'] ? $this->parent->getListDate($row['cb_datestamp']) : "") : ""); + $record['info'] = ""; + + $list_data[] = $record; + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } +} ?> \ No newline at end of file diff --git a/e107_plugins/forum/e_list.php b/e107_plugins/forum/e_list.php index c94e33b6d..9d75efed0 100644 --- a/e107_plugins/forum/e_list.php +++ b/e107_plugins/forum/e_list.php @@ -1,152 +1,157 @@ db_Select("plugin", "*", "plugin_path = 'forum' AND plugin_installflag = '1' ")) +class list_forum +{ + function list_forum($parent) { - return; + $this->parent = $parent; } - $LIST_CAPTION = $arr[0]; - $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); - - $bullet = $this -> getBullet($arr[6], $mode); - - if($mode == "new_page" || $mode == "new_menu" ) + function getListData() { - $lvisit = $this -> getlvisit(); - $qry = " - SELECT tp.thread_name AS parent_name, tp.thread_id as parent_id, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name, t.thread_thread, t.thread_id, t.thread_views as tviews, t.thread_name, tp.thread_parent, t.thread_datestamp, t.thread_user, tp.thread_views, tp.thread_lastpost, tp.thread_lastuser, tp.thread_total_replies - FROM #forum_t AS t - LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id - LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id - LEFT JOIN #user AS u ON t.thread_user = u.user_id - LEFT JOIN #user AS lp ON tp.thread_lastuser = lp.user_id - WHERE f.forum_class REGEXP '".e_CLASS_REGEXP."' - AND t.thread_datestamp > $lvisit - ORDER BY t.thread_datestamp DESC LIMIT 0,".intval($arr[7]); - } - else - { - $qry = " - SELECT t.thread_id, t.thread_name AS parent_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name - FROM #forum_t AS t - LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id - LEFT JOIN #user AS u ON t.thread_user = u.user_id - LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id - WHERE t.thread_parent=0 AND f.forum_class REGEXP '".e_CLASS_REGEXP."' - ORDER BY t.thread_lastpost DESC LIMIT 0,".intval($arr[7]); - - } + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); - if(!$results = $sql->db_Select_gen($qry)) - { - $LIST_DATA = LIST_FORUM_2; - } - else - { - $forumArray = $sql->db_getList(); - $path = e_PLUGIN."forum/"; + $bullet = $this->parent->getBullet($this->parent->settings['icon']); - foreach($forumArray as $forumInfo) + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) { - extract($forumInfo); - - //last user - $r_id = substr($thread_lastuser, 0, strpos($thread_lastuser, ".")); - $r_name = substr($thread_lastuser, (strpos($thread_lastuser, ".")+1)); - if (strstr($thread_lastuser, chr(1))) { - $tmp = explode(chr(1), $thread_lastuser); - $r_name = $tmp[0]; - } - $thread_lastuser = $r_id; + $lvisit = $this->parent->getlvisit(); + $qry = " + SELECT tp.thread_name AS parent_name, tp.thread_id as parent_id, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name, t.thread_thread, t.thread_id, t.thread_views as tviews, t.thread_name, tp.thread_parent, t.thread_datestamp, t.thread_user, tp.thread_views, tp.thread_lastpost, tp.thread_lastuser, tp.thread_total_replies + FROM #forum_t AS t + LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id + LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id + LEFT JOIN #user AS u ON t.thread_user = u.user_id + LEFT JOIN #user AS lp ON tp.thread_lastuser = lp.user_id + WHERE f.forum_class REGEXP '".e_CLASS_REGEXP."' + AND t.thread_datestamp > $lvisit + ORDER BY t.thread_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); + } + else + { + $qry = " + SELECT t.thread_id, t.thread_name AS parent_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name + FROM #forum_t AS t + LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id + LEFT JOIN #user AS u ON t.thread_user = u.user_id + LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id + WHERE t.thread_parent=0 AND f.forum_class REGEXP '".e_CLASS_REGEXP."' + ORDER BY t.thread_lastpost DESC LIMIT 0,".intval($this->parent->settings['amount']); + } - //user - $u_id = substr($thread_user, 0, strpos($thread_user, ".")); - $u_name = substr($thread_user, (strpos($thread_user, ".")+1)); - $thread_user = $u_id; + if(!$results = $this->parent->e107->sql->db_Select_gen($qry)) + { + $list_data = LIST_FORUM_2; + } + else + { + $forumArray = $this->parent->e107->sql->db_getList(); + $path = e_PLUGIN."forum/"; - if ($thread_anon) { - $tmp = explode(chr(1), $thread_anon); - $thread_user = $tmp[0]; - $thread_user_ip = $tmp[1]; - } - - $gen = new convert; - $r_datestamp = $gen->convert_date($thread_lastpost, "short"); - if($thread_total_replies) + foreach($forumArray as $forumInfo) { - $LASTPOST = ""; - if($lp_name) - { - $LASTPOST = "$lp_name"; + extract($forumInfo); + + $record = array(); + + //last user + $r_id = substr($thread_lastuser, 0, strpos($thread_lastuser, ".")); + $r_name = substr($thread_lastuser, (strpos($thread_lastuser, ".")+1)); + if (strstr($thread_lastuser, chr(1))) { + $tmp = explode(chr(1), $thread_lastuser); + $r_name = $tmp[0]; } - else + $thread_lastuser = $r_id; + + //user + $u_id = substr($thread_user, 0, strpos($thread_user, ".")); + $u_name = substr($thread_user, (strpos($thread_user, ".")+1)); + $thread_user = $u_id; + + if ($thread_anon) { + $tmp = explode(chr(1), $thread_anon); + $thread_user = $tmp[0]; + $thread_user_ip = $tmp[1]; + } + + $gen = new convert; + $r_datestamp = $gen->convert_date($thread_lastpost, "short"); + if($thread_total_replies) { - if($thread_lastuser{0} == "0") + $LASTPOST = ""; + if($lp_name) { - $LASTPOST = substr($thread_lastuser, 2); + $LASTPOST = "$lp_name"; } else { - //$LASTPOST = NFPM_L16; + if($thread_lastuser{0} == "0") + { + $LASTPOST = substr($thread_lastuser, 2); + } + else + { + //$LASTPOST = NFPM_L16; + } } + $LASTPOST .= " ".LIST_FORUM_6." $r_datestamp"; + } + else + { + $LASTPOST = " - "; + $LASTPOSTDATE = ''; } - $LASTPOST .= " ".LIST_FORUM_6." $r_datestamp"; - } - else - { - $LASTPOST = " - "; - $LASTPOSTDATE = ""; - } - if($parent_name == "") - { - $parent_name = $thread_name; + if($parent_name == '') + { + $parent_name = $thread_name; + } + $rowheading = $this->parent->parse_heading($parent_name); + $lnk = ($parent_id ? $thread_id.".post" : $thread_id); + + $record['heading'] = "".$rowheading.""; + $record['author'] = ($this->parent->settings['author'] ? ($thread_anon ? $thread_user : "$user_name") : ""); + $record['category'] = ($this->parent->settings['category'] ? "$forum_name" : ""); + $record['date'] = ($this->parent->settings['date'] ? $this->parent->getListDate($thread_datestamp) : ""); + $record['icon'] = $bullet; + $VIEWS = $thread_views; + $REPLIES = $thread_total_replies; + if($thread_total_replies) + { + $record['info'] = "[ ".LIST_FORUM_3." ".$VIEWS.", ".LIST_FORUM_4." ".$REPLIES.", ".LIST_FORUM_5." ".$LASTPOST." ]"; + } + else + { + $record['info'] = "[ ".LIST_FORUM_3." ".intval($tviews)." ]"; + } + + $list_data[] = $record; } - $rowheading = $this -> parse_heading($parent_name, $mode); - if($parent_id) - { - $lnk = $thread_id.".post"; - } - else - { - $lnk = $thread_id; - } - $HEADING = "".$rowheading.""; - $AUTHOR = ($arr[3] ? ($thread_anon ? $thread_user : "$user_name") : ""); - $CATEGORY = ($arr[4] ? "$forum_name" : ""); - $DATE = ($arr[5] ? $this -> getListDate($thread_datestamp, $mode) : ""); - $ICON = $bullet; - $VIEWS = $thread_views; - $REPLIES = $thread_total_replies; - if($thread_total_replies) - { - $INFO = "[ ".LIST_FORUM_3." ".$VIEWS.", ".LIST_FORUM_4." ".$REPLIES.", ".LIST_FORUM_5." ".$LASTPOST." ]"; - } - else - { - $INFO = "[ ".LIST_FORUM_3." ".intval($tviews)." ]"; - } - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } - +} ?> \ No newline at end of file diff --git a/e107_plugins/links_page/e_list.php b/e107_plugins/links_page/e_list.php index b94351498..28e6ea864 100644 --- a/e107_plugins/links_page/e_list.php +++ b/e107_plugins/links_page/e_list.php @@ -1,46 +1,77 @@ db_Select("plugin", "*", "plugin_path = 'links_page' AND plugin_installflag = '1' ")){ - return; +class list_links_page +{ + function list_links_page($parent) + { + $this->parent = $parent; } - $LIST_CAPTION = $arr[0]; - $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); - - if($mode == "new_page" || $mode == "new_menu" ){ - $lvisit = $this -> getlvisit(); - $qry = " l.link_datestamp>".$lvisit." AND "; - }else{ - $qry = ""; - } - - $bullet = $this -> getBullet($arr[6], $mode); - - $qry = " - SELECT l.*, c.link_category_id, c.link_category_name - FROM #links_page AS l - LEFT JOIN #links_page_cat AS c ON c.link_category_id = l.link_category - WHERE ".$qry." l.link_class REGEXP '".e_CLASS_REGEXP."' AND c.link_category_class REGEXP '".e_CLASS_REGEXP."' - ORDER BY l.link_datestamp DESC LIMIT 0,".intval($arr[7])." - "; - - if(!$sql -> db_Select_gen($qry)){ - $LIST_DATA = LIST_LINKS_2; - }else{ - while($row = $sql -> db_Fetch()){ - - $rowheading = $this -> parse_heading($row['link_name'], $mode); - $ICON = $bullet; - $HEADING = "".$rowheading.""; - $AUTHOR = ""; - $CATEGORY = ($arr[4] ? "".$row['link_category_name']."" : ""); - $DATE = ($arr[5] ? ($row['link_datestamp'] > 0 ? $this -> getListDate($row['link_datestamp'], $mode) : "") : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); + function getListData() + { + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); + $qry = ''; + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $lvisit = $this->parent->getlvisit(); + $qry = " l.link_datestamp>".$lvisit." AND "; } + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + $qry = " + SELECT l.*, c.link_category_id, c.link_category_name + FROM #links_page AS l + LEFT JOIN #links_page_cat AS c ON c.link_category_id = l.link_category + WHERE ".$qry." l.link_class REGEXP '".e_CLASS_REGEXP."' AND c.link_category_class REGEXP '".e_CLASS_REGEXP."' + ORDER BY l.link_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." "; + + if(!$this->parent->e107->sql->db_Select_gen($qry)) + { + $list_data = LIST_LINKS_2; + } + else + { + $list_data = array(); + while($row = $this->parent->e107->sql->db_Fetch()) + { + $record = array(); + $rowheading = $this->parent->parse_heading($row['link_name']); + $record['icon'] = $bullet; + $record['heading'] = "".$rowheading.""; + $record['author'] = ""; + $record['category'] = ($this->parent->settings['category'] ? "".$row['link_category_name']."" : ""); + $record['date'] = ($this->parent->settings['date'] ? ($row['link_datestamp'] > 0 ? $this->parent->getListDate($row['link_datestamp']) : "") : ""); + $record['info'] = ""; + + $list_data[] = $record; + } + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } +} ?> \ No newline at end of file diff --git a/e107_plugins/list_new/admin_list_config.php b/e107_plugins/list_new/admin_list_config.php index 61281a8da..38214ca83 100644 --- a/e107_plugins/list_new/admin_list_config.php +++ b/e107_plugins/list_new/admin_list_config.php @@ -1,20 +1,18 @@ getSections(); +$rc->getSections(); //update preferences in database if(isset($_POST['update_menu'])) { - $list_pref = $rc -> getListPrefs(); // Get the preferences so we've got a reference for changes - $temp = array(); - while(list($key, $value) = each($_POST)) - { - if($value != LIST_ADMIN_2){ $temp[$tp->toDB($key)] = $tp->toDB($value); } - } - - if ($admin_log->logArrayDiffs($temp, $list_pref, 'LISTNEW_01')) - { - $tmp = $eArrayStorage->WriteArray($list_pref); - $sql -> db_Update("core", "e107_value='{$tmp}' WHERE e107_name='list' "); - $message = LIST_ADMIN_3; - } - else - { - $message = LIST_ADMIN_LAN_41; - } + $message = $rc->admin->db_update_menu(); } //check preferences from database -$list_pref = $rc -> getListPrefs(); - - -$iconlist = $fl->get_files($listplugindir."images/"); +$rc->list_pref = $rc->getListPrefs(); //render message if set if(isset($message)) { - $ns -> tablerender("", "
".$message."
"); + $rc->e107->ns->tablerender("", "
".$message."
"); } +//display admin page +$text = $rc->admin->display(); -//define some variables -$stylespacer = "style='border:0; height:20px;'"; -$styletable = "style='width:90%; border:1px solid #444; border-collapse:collapse;' cellpadding='0' cellspacing='0' "; +$rc->e107->ns->tablerender(LIST_ADMIN_1, $text); -//template for non expanding row -$TOPIC_ROW_NOEXPAND = " - - {TOPIC_TOPIC} - {TOPIC_FIELD} - -"; - -//template for expanding row -$TOPIC_ROW = " - - {TOPIC_TOPIC} - - {TOPIC_HEADING} -
-
{TOPIC_HELP}

- {TOPIC_FIELD} -
- - -"; - -//template for spacer row -$TOPIC_ROW_SPACER = ""; - -$TOPIC_TABLE_START = " -
-".$rs -> form_open("post", e_SELF, "menu_conf_form", "", "enctype='multipart/form-data'")." -"; - -//$TOPIC_TABLE_END = " -//
-// -//
"; -$TOPIC_TABLE_END = pref_submit().""; - - -$text .= " -
-".$rs -> form_open("post", e_SELF, "menu_conf_form", "", "class='admin-menu' enctype='multipart/form-data'")."\n"; - -$text .= parse_menu_options("recent_menu"); -$text .= parse_menu_options("new_menu"); -$text .= parse_page_options("recent_page"); -$text .= parse_page_options("new_page"); - -$text .= " - -
"; - -$ns -> tablerender(LIST_ADMIN_1, $text); - - -function parse_global_options($type){ - global $rc, $list_pref, $rs, $tp, $sections, $titles, $iconlist, $TOPIC_ROW, $TOPIC_ROW_SPACER, $TOPIC_TABLE_END; - - //show sections - $TOPIC_TOPIC = LIST_ADMIN_SECT_1; - $TOPIC_HEADING = LIST_ADMIN_SECT_2; - $TOPIC_HELP = LIST_ADMIN_SECT_3; - $TOPIC_CONTID = "list-new-{$type}-expandable-sections"; - $TOPIC_FIELD = ""; - for($i=0;$i form_checkbox($sections[$i]."_".$type."_display", 1, ($list_pref[$sections[$i]."_".$type."_display"]) ? "1" : "0")." ".$titles[$i]."
"; - } - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //open or closed - $TOPIC_TOPIC = LIST_ADMIN_SECT_4; - $TOPIC_HEADING = LIST_ADMIN_SECT_5; - $TOPIC_HELP = LIST_ADMIN_SECT_6; - $TOPIC_CONTID = "list-new-{$type}-expandable-display-style"; - $TOPIC_FIELD = ""; - for($i=0;$i form_checkbox($sections[$i]."_".$type."_open", 1, (isset($list_pref[$sections[$i]."_".$type."_open"]) ? "1" : "0"))." ".$titles[$i]."
"; - } - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //author - $TOPIC_TOPIC = LIST_ADMIN_SECT_7; - $TOPIC_HEADING = LIST_ADMIN_SECT_8; - $TOPIC_HELP = LIST_ADMIN_SECT_9; - $TOPIC_CONTID = "list-new-{$type}-expandable-author"; - $TOPIC_FIELD = ""; - for($i=0;$i form_checkbox($sections[$i]."_".$type."_author", 1, (isset($list_pref[$sections[$i]."_".$type."_author"]) ? "1" : "0"))." ".$titles[$i]."
"; - } - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //category - $TOPIC_TOPIC = LIST_ADMIN_SECT_10; - $TOPIC_HEADING = LIST_ADMIN_SECT_11; - $TOPIC_HELP = LIST_ADMIN_SECT_12; - $TOPIC_FIELD = ""; - $TOPIC_CONTID = "list-new-{$type}-expandable-category"; - for($i=0;$i form_checkbox($sections[$i]."_".$type."_category", 1, (isset($list_pref[$sections[$i]."_".$type."_category"]) ? "1" : "0"))." ".$titles[$i]."
"; - } - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //date - $TOPIC_TOPIC = LIST_ADMIN_SECT_13; - $TOPIC_HEADING = LIST_ADMIN_SECT_14; - $TOPIC_HELP = LIST_ADMIN_SECT_15; - $TOPIC_FIELD = ""; - $TOPIC_CONTID = "list-new-{$type}-expandable-date"; - for($i=0;$i form_checkbox($sections[$i]."_".$type."_date", 1, (isset($list_pref[$sections[$i]."_".$type."_date"]) ? "1" : "0"))." ".$titles[$i]."
"; - } - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //icon - $TOPIC_TOPIC = LIST_ADMIN_SECT_22; - $TOPIC_HEADING = LIST_ADMIN_SECT_23; - $TOPIC_HELP = LIST_ADMIN_SECT_24; - $TOPIC_CONTID = "list-new-{$type}-expandable-icon"; - $TOPIC_FIELD = ""; - for($i=0;$i - - "; - } - $TOPIC_FIELD .= "
- ".$rs -> form_text($sections[$i]."_".$type."_icon", 15, $list_pref[$sections[$i]."_".$type."_icon"], 100)." - - -
"; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //amount - $maxitems_amount = "50"; - $TOPIC_TOPIC = LIST_ADMIN_SECT_16; - $TOPIC_HEADING = LIST_ADMIN_SECT_17; - $TOPIC_HELP = LIST_ADMIN_SECT_18; - $TOPIC_CONTID = "list-new-{$type}-expandable-amount"; - $TOPIC_FIELD = ""; - for($i=0;$i - - "; - } - $TOPIC_FIELD .= "
- ".$rs -> form_select_open($sections[$i]."_".$type."_amount"); - for($a=1; $a<=$maxitems_amount; $a++){ - $TOPIC_FIELD .= ($list_pref[$sections[$i]."_".$type."_amount"] == $a ? $rs -> form_option($a, 1, $a) : $rs -> form_option($a, 0, $a)); - } - $TOPIC_FIELD .= $rs -> form_select_close()." -
"; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //order - $max = count($sections); - $TOPIC_TOPIC = LIST_ADMIN_SECT_19; - $TOPIC_HEADING = LIST_ADMIN_SECT_20; - $TOPIC_HELP = LIST_ADMIN_SECT_21; - $TOPIC_CONTID = "list-new-{$type}-expandable-order"; - $TOPIC_FIELD = ""; - for($i=0;$i - - "; - } - $TOPIC_FIELD .= "
- ".$rs -> form_select_open($sections[$i]."_".$type."_order"); - for($a=1; $a<=$max; $a++){ - $TOPIC_FIELD .= ($list_pref[$sections[$i]."_".$type."_order"] == $a ? $rs -> form_option($a, 1, $a) : $rs -> form_option($a, 0, $a)); - } - $TOPIC_FIELD .= $rs -> form_select_close()." -
"; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //caption - $TOPIC_TOPIC = LIST_ADMIN_SECT_25; - $TOPIC_HEADING = LIST_ADMIN_SECT_26; - $TOPIC_HELP = LIST_ADMIN_SECT_27; - $TOPIC_CONTID = "list-new-{$type}-expandable-caption"; - $TOPIC_FIELD = ""; - for($i=0;$i - - "; - } - $TOPIC_FIELD .= "
- ".$rs -> form_text($sections[$i]."_".$type."_caption", 30, $tp->toHTML($list_pref[$sections[$i]."_".$type."_caption"],"","defs"), "50", "tbox")." -
"; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - $text .= $TOPIC_ROW_SPACER; - - return $text; +/** + * Display admin menu + * + * @return string menu + */ +function admin_list_config_adminmenu() +{ + $act = ""; + unset($var); + $var=array(); + //$var['general']['text'] = LIST_ADMIN_OPT_1; + $var['list-new-recent-page']['text'] = LIST_ADMIN_OPT_2; + $var['list-new-recent-menu']['text'] = LIST_ADMIN_OPT_3; + $var['list-new-new-page']['text'] = LIST_ADMIN_OPT_4; + $var['list-new-new-menu']['text'] = LIST_ADMIN_OPT_5; + e_admin_menu(LIST_ADMIN_OPT_6.'--id--list_new', 'list-new-recent-page', $var); } - -//--------------------------------------------------------------------------------------------------- -function parse_menu_options($type){ - global $rc, $list_pref, $rs, $tp, $sections, $titles, $iconlist, $TOPIC_ROW, $TOPIC_ROW_SPACER, $TOPIC_TABLE_END; - - $text = " -
- "; - - if($type == "new_menu"){ - $text .= $rc -> parse_headerrow_title(LIST_ADMIN_OPT_5); - }else{ - $text .= $rc -> parse_headerrow_title(LIST_ADMIN_OPT_3); - } - - $text .= parse_global_options($type); - - //menu preference : caption - $TOPIC_TOPIC = LIST_ADMIN_LAN_2; - $TOPIC_HEADING = LIST_ADMIN_LAN_3; - $TOPIC_HELP = LIST_ADMIN_LAN_4; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-caption"; - $TOPIC_FIELD = $rs -> form_text($type."_caption", "30", $tp->toHTML($list_pref[$type."_caption"],"","defs"), "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : icon : use - $TOPIC_TOPIC = LIST_ADMIN_LAN_5; - $TOPIC_HEADING = LIST_ADMIN_LAN_6; - $TOPIC_HELP = LIST_ADMIN_LAN_7; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-icon-use"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_icon_use", "1", ($list_pref[$type."_icon_use"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_icon_use", "0", ($list_pref[$type."_icon_use"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : icon : show default theme bullet - $TOPIC_TOPIC = LIST_ADMIN_MENU_2; - $TOPIC_HEADING = LIST_ADMIN_MENU_3; - $TOPIC_HELP = LIST_ADMIN_MENU_4; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-icon-show"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_icon_default", "1", ($list_pref[$type."_icon_default"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_icon_default", "0", ($list_pref[$type."_icon_default"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : amount chars - $TOPIC_TOPIC = LIST_ADMIN_LAN_8; - $TOPIC_HEADING = LIST_ADMIN_LAN_9; - $TOPIC_HELP = LIST_ADMIN_LAN_10; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-amount-chars"; - $TOPIC_FIELD = $rs -> form_text($type."_char_heading", "30", $list_pref[$type."_char_heading"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : postfix - $TOPIC_TOPIC = LIST_ADMIN_LAN_11; - $TOPIC_HEADING = LIST_ADMIN_LAN_12; - $TOPIC_HELP = LIST_ADMIN_LAN_13; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-postfix"; - $TOPIC_FIELD = $rs -> form_text($type."_char_postfix", "30", $list_pref[$type."_char_postfix"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : date - $TOPIC_TOPIC = LIST_ADMIN_LAN_14; - $TOPIC_HEADING = LIST_ADMIN_LAN_15; - $TOPIC_HELP = LIST_ADMIN_LAN_16; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-date"; - $TOPIC_FIELD = $rs -> form_text($type."_datestyle", "30", $list_pref[$type."_datestyle"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : date today - $TOPIC_TOPIC = LIST_ADMIN_LAN_17; - $TOPIC_HEADING = LIST_ADMIN_LAN_18; - $TOPIC_HELP = LIST_ADMIN_LAN_19; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-datet"; - $TOPIC_FIELD = $rs -> form_text($type."_datestyletoday", "30", $list_pref[$type."_datestyletoday"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : show empty - $TOPIC_TOPIC = LIST_ADMIN_LAN_26; - $TOPIC_HEADING = LIST_ADMIN_LAN_27; - $TOPIC_HELP = LIST_ADMIN_LAN_28; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-sempty"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_showempty", "1", ($list_pref[$type."_showempty"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_showempty", "0", ($list_pref[$type."_showempty"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //menu preference : open section if content exists? this will override the individual setting of the section - $TOPIC_TOPIC = LIST_ADMIN_LAN_39; - $TOPIC_HEADING = LIST_ADMIN_LAN_40; - $TOPIC_HELP = LIST_ADMIN_LAN_41; - $TOPIC_CONTID = "list-new-menu-{$type}-expandable-osie"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_openifrecords", "1", ($list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_openifrecords", "0", ($list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - $text .= $TOPIC_ROW_SPACER; - $text .= $TOPIC_TABLE_END; - - return $text; -} -//--------------------------------------------------------------------------------------------------- - - -//--------------------------------------------------------------------------------------------------- -function parse_page_options($type){ - global $rc, $list_pref, $rs, $tp, $sections, $TOPIC_ROW, $TOPIC_ROW_SPACER, $TOPIC_TABLE_END; - - if($type == "recent_page"){ - $display = ""; - }else{ - $display = "display:none;"; - } - - $text = " -
-
"; - - if($type == "new_page"){ - $text .= $rc -> parse_headerrow_title(LIST_ADMIN_OPT_4); - }else{ - $text .= $rc -> parse_headerrow_title(LIST_ADMIN_OPT_2); - } - - $text .= parse_global_options($type); - - //page preference : caption - $TOPIC_TOPIC = LIST_ADMIN_LAN_2; - $TOPIC_HEADING = LIST_ADMIN_LAN_3; - $TOPIC_HELP = LIST_ADMIN_LAN_4; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-caption"; - $TOPIC_FIELD = $rs -> form_text($type."_caption", "30", $tp->toHTML($list_pref[$type."_caption"],"","defs"), "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : icon : use - $TOPIC_TOPIC = LIST_ADMIN_LAN_5; - $TOPIC_HEADING = LIST_ADMIN_LAN_6; - $TOPIC_HELP = LIST_ADMIN_LAN_7; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-icon-use"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_icon_use", "1", ($list_pref[$type."_icon_use"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_icon_use", "0", ($list_pref[$type."_icon_use"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : icon : show default theme bullet - $TOPIC_TOPIC = LIST_ADMIN_LAN_29; - $TOPIC_HEADING = LIST_ADMIN_LAN_30; - $TOPIC_HELP = LIST_ADMIN_LAN_31; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-icon-show"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_icon_default", "1", ($list_pref[$type."_icon_default"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_icon_default", "0", ($list_pref[$type."_icon_default"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : amount chars - $TOPIC_TOPIC = LIST_ADMIN_LAN_8; - $TOPIC_HEADING = LIST_ADMIN_LAN_9; - $TOPIC_HELP = LIST_ADMIN_LAN_10; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-amount-chars"; - $TOPIC_FIELD = $rs -> form_text($type."_char_heading", "30", $list_pref[$type."_char_heading"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : postfix - $TOPIC_TOPIC = LIST_ADMIN_LAN_11; - $TOPIC_HEADING = LIST_ADMIN_LAN_12; - $TOPIC_HELP = LIST_ADMIN_LAN_13; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-postfix"; - $TOPIC_FIELD = $rs -> form_text($type."_char_postfix", "30", $list_pref[$type."_char_postfix"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : date - $TOPIC_TOPIC = LIST_ADMIN_LAN_14; - $TOPIC_HEADING = LIST_ADMIN_LAN_15; - $TOPIC_HELP = LIST_ADMIN_LAN_16; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-date"; - $TOPIC_FIELD = $rs -> form_text($type."_datestyle", "30", $list_pref[$type."_datestyle"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : date today - $TOPIC_TOPIC = LIST_ADMIN_LAN_17; - $TOPIC_HEADING = LIST_ADMIN_LAN_18; - $TOPIC_HELP = LIST_ADMIN_LAN_19; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-datet"; - $TOPIC_FIELD = $rs -> form_text($type."_datestyletoday", "30", $list_pref[$type."_datestyletoday"], "50", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : show empty - $TOPIC_TOPIC = LIST_ADMIN_LAN_26; - $TOPIC_HEADING = LIST_ADMIN_LAN_27; - $TOPIC_HELP = LIST_ADMIN_LAN_28; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-showe"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_showempty", "1", ($list_pref[$type."_showempty"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_showempty", "0", ($list_pref[$type."_showempty"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : colomn - $TOPIC_TOPIC = LIST_ADMIN_LAN_20; - $TOPIC_HEADING = LIST_ADMIN_LAN_21; - $TOPIC_HELP = LIST_ADMIN_LAN_22; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-colomn"; - $TOPIC_FIELD = $rs -> form_select_open($type."_colomn"); - for($a=1; $a<=count($sections); $a++){ - $TOPIC_FIELD .= ($list_pref[$type."_colomn"] == $a ? $rs -> form_option($a, 1, $a) : $rs -> form_option($a, 0, $a)); - } - $TOPIC_FIELD .= $rs -> form_select_close(); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //page preference : welcome text - $TOPIC_TOPIC = LIST_ADMIN_LAN_23; - $TOPIC_HEADING = LIST_ADMIN_LAN_24; - $TOPIC_HELP = LIST_ADMIN_LAN_25; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-wtext"; - $TOPIC_FIELD = $rs -> form_textarea($type."_welcometext", "50", "5", $tp->toHTML($list_pref[$type."_welcometext"],"","defs"), "", "tbox"); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - if($type == "new_page"){ - //timelapse:show - $TOPIC_TOPIC = LIST_ADMIN_LAN_36; - $TOPIC_HEADING = LIST_ADMIN_LAN_37; - $TOPIC_HELP = LIST_ADMIN_LAN_38; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-timelapse-show"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_timelapse", "1", ($list_pref[$type."_timelapse"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_timelapse", "0", ($list_pref[$type."_timelapse"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - //timelapse day number maximum - $TOPIC_TOPIC = LIST_ADMIN_LAN_32; - $TOPIC_HEADING = LIST_ADMIN_LAN_33; - $TOPIC_HELP = LIST_ADMIN_LAN_34; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-timelapse-dnm"; - $TOPIC_FIELD = $rs -> form_text($type."_timelapse_days", "3", $list_pref[$type."_timelapse_days"], "3", "tbox")." ".LIST_ADMIN_LAN_35; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - } - - //page preference : open section if content exists? this will override the individual setting of the section - $TOPIC_TOPIC = LIST_ADMIN_LAN_39; - $TOPIC_HEADING = LIST_ADMIN_LAN_40; - $TOPIC_HELP = LIST_ADMIN_LAN_41; - $TOPIC_CONTID = "list-new-page-{$type}-expandable-osie"; - $TOPIC_FIELD = " - ".$rs -> form_radio($type."_openifrecords", "1", ($list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7." - ".$rs -> form_radio($type."_openifrecords", "0", ($list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8." - "; - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); - - $text .= $TOPIC_ROW_SPACER; - $text .= $TOPIC_TABLE_END; - - return $text; -} -//--------------------------------------------------------------------------------------------------- - - - -function pref_submit() { - global $rs, $TOPIC_ROW_NOEXPAND; - - $TOPIC_TOPIC = LIST_ADMIN_11; - $TOPIC_FIELD = $rs -> form_button("submit", update_menu, LIST_ADMIN_2); - return (preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND)); -} - - -// ##### Display options -------------------------------------------------------------------------- -function admin_list_config_adminmenu(){ - - $act = ""; - unset($var); - $var=array(); - //$var['general']['text'] = LIST_ADMIN_OPT_1; - $var['list-new-recent-page']['text'] = LIST_ADMIN_OPT_2; - $var['list-new-recent-menu']['text'] = LIST_ADMIN_OPT_3; - $var['list-new-new-page']['text'] = LIST_ADMIN_OPT_4; - $var['list-new-new-menu']['text'] = LIST_ADMIN_OPT_5; - e_admin_menu(LIST_ADMIN_OPT_6.'--id--list_new', 'list-new-recent-page', $var); - //e_admin_menu(LIST_ADMIN_OPT_6, $act, $var, TRUE); - -} -// ##### End -------------------------------------------------------------------------------------- - require_once(e_ADMIN."footer.php"); /** diff --git a/e107_plugins/list_new/languages/English.php b/e107_plugins/list_new/languages/English.php index 828b09ec6..80abe300f 100644 --- a/e107_plugins/list_new/languages/English.php +++ b/e107_plugins/list_new/languages/English.php @@ -1,23 +1,22 @@ mode = (varsettrue($mode) == 'new' ? 'new_page' : 'recent_page'); -if(!isset($list_pref)) -{ - $list_pref = $rc->getListPrefs(); -} -$sections = $rc -> prepareSection($mode); -$arr = $rc -> prepareSectionArray($mode, $sections); +//parse page +$text = $rc->displayPage(); -$text = ""; -$timelapse = 0; -if(isset($qs[0]) && $qs[0] == "new") -{ - if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){ - if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days'])){ - $days = $list_pref['new_page_timelapse_days']; - }else{ - $days = "30"; - } - if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days){ - $timelapse = $qs[1]; - } - $url = e_PLUGIN."list_new/list.php?new"; - $selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\""; - - $LIST_TIMELAPSE = LIST_MENU_6; - $LIST_TIMELAPSE .= $rs -> form_select_open("timelapse", $selectjs).$rs -> form_option(LIST_MENU_5, 0, $url); - for($a=1; $a<=$days; $a++){ - $LIST_TIMELAPSE .= $rs -> form_option($a, ($timelapse == $a ? "1" : "0"), $url.".".$a); - } - $LIST_TIMELAPSE .= $rs -> form_select_close(); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_TIMELAPSE_TABLE); - } -} - - - -//display the sections -$LIST_COL_COLS = $list_pref[$mode."_colomn"]; - -$LIST_COL_CELLWIDTH = round((100/$list_pref[$mode."_colomn"]),0); -$text .= $LIST_COL_START; - -if($list_pref[$mode."_welcometext"]) -{ - $LIST_COL_WELCOMETEXT = $tp -> toHTML($list_pref[$mode."_welcometext"]); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_COL_WELCOME); -} -$k=0; -for($i=0;$i show_section_list($arr[$i], $mode); - if($sectiontext != "") - { - if( intval($k/$list_pref[$mode."_colomn"]) == $k/$list_pref[$mode."_colomn"] ) - { - $rowswitch = $LIST_COL_ROWSWITCH; - } - $text .= (isset($rowswitch) ? $rowswitch : ""); - $text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_COL_CELL_START); - $text .= $sectiontext; - $text .= $LIST_COL_CELL_END; - $k++; - } - } -} -$text .= $LIST_COL_END; - -$caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1); -$ns -> tablerender($caption, $text); +$caption = varsettrue($rc->list_pref[$rc->mode."_caption"], LIST_MENU_1); +$rc->e107->ns->tablerender($caption, $text); unset($text); require_once(FOOTERF); diff --git a/e107_plugins/list_new/list_admin_class.php b/e107_plugins/list_new/list_admin_class.php new file mode 100644 index 000000000..b5ee30433 --- /dev/null +++ b/e107_plugins/list_new/list_admin_class.php @@ -0,0 +1,570 @@ +e107 = e107::getInstance(); + $this->parent = $parent; + + $this->styletable = "style='width:90%; border:1px solid #444; border-collapse:collapse;' cellpadding='0' cellspacing='0' "; + } + + /** + * database update settings + * + * @return sting $message + * + */ + function db_update_menu() + { + // Get the preferences so we've got a reference for changes + $list_pref = $this->parent->getListPrefs(); + $temp = array(); + while(list($key, $value) = each($_POST)) + { + if($value != LIST_ADMIN_2){ $temp[$this->e107->tp->toDB($key)] = $this->e107->tp->toDB($value); } + } + + if ($this->e107->admin_log->logArrayDiffs($temp, $list_pref, 'LISTNEW_01')) + { + $tmp = $this->e107->arrayStorage->WriteArray($list_pref); + $this->e107->sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='list' "); + $message = LIST_ADMIN_3; + } + else + { + $message = LIST_ADMIN_17; + } + return $message; + } + + /** + * display the admin configuration page + * + * @return string + * + */ + function display() + { + global $rs; + + $text = " +
+ ".$rs->form_open("post", e_SELF, "menu_conf_form", "", "class='admin-menu' enctype='multipart/form-data'")."\n"; + + $text .= $this->parse_menu_options("recent_menu"); + $text .= $this->parse_menu_options("new_menu"); + $text .= $this->parse_page_options("recent_page"); + $text .= $this->parse_page_options("new_page"); + + $text .= " + +
"; + + return $text; + } + + /** + * display global options + * + * @param string $type the area to display + * @return string + * + */ + function parse_global_options($type) + { + global $rs, $fl; + + $text = ''; + + //show sections + $this->row['TOPIC'] = LIST_ADMIN_SECT_1; + $this->row['HEADING'] = LIST_ADMIN_SECT_2; + $this->row['HELP'] = LIST_ADMIN_SECT_3; + $this->row['CONTID'] = "list-new-{$type}-expandable-sections"; + $this->row['FIELD'] = ""; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= $rs->form_checkbox($this->parent->sections[$i]."_".$type."_display", 1, (varsettrue($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_display"]) ? "1" : "0"))." ".$this->parent->titles[$i]."
"; + } + $text .= $this->parseTemplate('TOPIC_ROW'); + + //open or closed + $this->row['TOPIC'] = LIST_ADMIN_SECT_4; + $this->row['HEADING'] = LIST_ADMIN_SECT_5; + $this->row['HELP'] = LIST_ADMIN_SECT_6; + $this->row['CONTID'] = "list-new-{$type}-expandable-display-style"; + $this->row['FIELD'] = ""; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= $rs->form_checkbox($this->parent->sections[$i]."_".$type."_open", 1, (varsettrue($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_open"]) ? "1" : "0"))." ".$this->parent->titles[$i]."
"; + } + $text .= $this->parseTemplate('TOPIC_ROW'); + + //author + $this->row['TOPIC'] = LIST_ADMIN_SECT_7; + $this->row['HEADING'] = LIST_ADMIN_SECT_8; + $this->row['HELP'] = LIST_ADMIN_SECT_9; + $this->row['CONTID'] = "list-new-{$type}-expandable-author"; + $this->row['FIELD'] = ""; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= $rs->form_checkbox($this->parent->sections[$i]."_".$type."_author", 1, (varsettrue($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_author"]) ? "1" : "0"))." ".$this->parent->titles[$i]."
"; + } + $text .= $this->parseTemplate('TOPIC_ROW'); + + //category + $this->row['TOPIC'] = LIST_ADMIN_SECT_10; + $this->row['HEADING'] = LIST_ADMIN_SECT_11; + $this->row['HELP'] = LIST_ADMIN_SECT_12; + $this->row['FIELD'] = ""; + $this->row['CONTID'] = "list-new-{$type}-expandable-category"; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= $rs->form_checkbox($this->parent->sections[$i]."_".$type."_category", 1, (varsettrue($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_category"]) ? "1" : "0"))." ".$this->parent->titles[$i]."
"; + } + $text .= $this->parseTemplate('TOPIC_ROW'); + + //date + $this->row['TOPIC'] = LIST_ADMIN_SECT_13; + $this->row['HEADING'] = LIST_ADMIN_SECT_14; + $this->row['HELP'] = LIST_ADMIN_SECT_15; + $this->row['FIELD'] = ""; + $this->row['CONTID'] = "list-new-{$type}-expandable-date"; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= $rs->form_checkbox($this->parent->sections[$i]."_".$type."_date", 1, (varsettrue($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_date"]) ? "1" : "0"))." ".$this->parent->titles[$i]."
"; + } + $text .= $this->parseTemplate('TOPIC_ROW'); + + //icon + $this->row['TOPIC'] = LIST_ADMIN_SECT_22; + $this->row['HEADING'] = LIST_ADMIN_SECT_23; + $this->row['HELP'] = LIST_ADMIN_SECT_24; + $this->row['CONTID'] = "list-new-{$type}-expandable-icon"; + $this->row['FIELD'] = "
styletable>"; + $iconlist = $fl->get_files($this->parent->plugin_dir."images/"); + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= " + + + + "; + } + $this->row['FIELD'] .= "
".$this->parent->titles[$i]." + ".$rs->form_text($this->parent->sections[$i]."_".$type."_icon", 15, $this->parent->list_pref[$this->parent->sections[$i]."_".$type."_icon"], 100)." + parent->sections[$i]."_".$type."_icon'); return false;\" /> + +
"; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //amount + $maxitems_amount = "50"; + $this->row['TOPIC'] = LIST_ADMIN_SECT_16; + $this->row['HEADING'] = LIST_ADMIN_SECT_17; + $this->row['HELP'] = LIST_ADMIN_SECT_18; + $this->row['CONTID'] = "list-new-{$type}-expandable-amount"; + $this->row['FIELD'] = "styletable>"; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= " + + + + "; + } + $this->row['FIELD'] .= "
".$this->parent->titles[$i]." + ".$rs->form_select_open($this->parent->sections[$i]."_".$type."_amount"); + for($a=1; $a<=$maxitems_amount; $a++) + { + $this->row['FIELD'] .= ($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_amount"] == $a ? $rs->form_option($a, 1, $a) : $rs->form_option($a, 0, $a)); + } + $this->row['FIELD'] .= $rs->form_select_close()." +
"; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //order + $max = count($this->parent->sections); + $this->row['TOPIC'] = LIST_ADMIN_SECT_19; + $this->row['HEADING'] = LIST_ADMIN_SECT_20; + $this->row['HELP'] = LIST_ADMIN_SECT_21; + $this->row['CONTID'] = "list-new-{$type}-expandable-order"; + $this->row['FIELD'] = "styletable>"; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= " + + + + "; + } + $this->row['FIELD'] .= "
".$this->parent->titles[$i]." + ".$rs->form_select_open($this->parent->sections[$i]."_".$type."_order"); + for($a=1; $a<=$max; $a++) + { + $this->row['FIELD'] .= ($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_order"] == $a ? $rs->form_option($a, 1, $a) : $rs->form_option($a, 0, $a)); + } + $this->row['FIELD'] .= $rs->form_select_close()." +
"; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //caption + $this->row['TOPIC'] = LIST_ADMIN_SECT_25; + $this->row['HEADING'] = LIST_ADMIN_SECT_26; + $this->row['HELP'] = LIST_ADMIN_SECT_27; + $this->row['CONTID'] = "list-new-{$type}-expandable-caption"; + $this->row['FIELD'] = "styletable>"; + for($i=0;$iparent->sections);$i++) + { + $this->row['FIELD'] .= " + + + + "; + } + $this->row['FIELD'] .= "
".$this->parent->titles[$i]." + ".$rs->form_text($this->parent->sections[$i]."_".$type."_caption", 30, $this->e107->tp->toHTML($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_caption"],"","defs"), "50", "tbox")." +
"; + $text .= $this->parseTemplate('TOPIC_ROW'); + + $text .= $this->parseTemplate('TOPIC_ROW_SPACER'); + + return $text; + } + + /** + * display menu options + * + * @param string $type the area to display + * @return string + * + */ + function parse_menu_options($type) + { + global $rs; + + $text = " +
+ "; + + $title = ($type == "new_menu" ? LIST_ADMIN_OPT_5 : LIST_ADMIN_OPT_3); + $text .= ""; + + $text .= $this->parse_global_options($type); + + //menu preference : caption + $this->row['TOPIC'] = LIST_ADMIN_LAN_2; + $this->row['HEADING'] = LIST_ADMIN_LAN_3; + $this->row['HELP'] = LIST_ADMIN_LAN_4; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-caption"; + $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $this->e107->tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : icon : use + $this->row['TOPIC'] = LIST_ADMIN_LAN_5; + $this->row['HEADING'] = LIST_ADMIN_LAN_6; + $this->row['HELP'] = LIST_ADMIN_LAN_7; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-icon-use"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_icon_use", "1", ($this->parent->list_pref[$type."_icon_use"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_icon_use", "0", ($this->parent->list_pref[$type."_icon_use"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : icon : show default theme bullet + $this->row['TOPIC'] = LIST_ADMIN_MENU_2; + $this->row['HEADING'] = LIST_ADMIN_MENU_3; + $this->row['HELP'] = LIST_ADMIN_MENU_4; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-icon-show"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_icon_default", "1", ($this->parent->list_pref[$type."_icon_default"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_icon_default", "0", ($this->parent->list_pref[$type."_icon_default"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : amount chars + $this->row['TOPIC'] = LIST_ADMIN_LAN_8; + $this->row['HEADING'] = LIST_ADMIN_LAN_9; + $this->row['HELP'] = LIST_ADMIN_LAN_10; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-amount-chars"; + $this->row['FIELD'] = $rs->form_text($type."_char_heading", "3", $this->parent->list_pref[$type."_char_heading"], "3", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : postfix + $this->row['TOPIC'] = LIST_ADMIN_LAN_11; + $this->row['HEADING'] = LIST_ADMIN_LAN_12; + $this->row['HELP'] = LIST_ADMIN_LAN_13; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-postfix"; + $this->row['FIELD'] = $rs->form_text($type."_char_postfix", "3", $this->parent->list_pref[$type."_char_postfix"], "3", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : date + $this->row['TOPIC'] = LIST_ADMIN_LAN_14; + $this->row['HEADING'] = LIST_ADMIN_LAN_15; + $this->row['HELP'] = LIST_ADMIN_LAN_16; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-date"; + $this->row['FIELD'] = $rs->form_text($type."_datestyle", "30", $this->parent->list_pref[$type."_datestyle"], "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : date today + $this->row['TOPIC'] = LIST_ADMIN_LAN_17; + $this->row['HEADING'] = LIST_ADMIN_LAN_18; + $this->row['HELP'] = LIST_ADMIN_LAN_19; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-datet"; + $this->row['FIELD'] = $rs->form_text($type."_datestyletoday", "30", $this->parent->list_pref[$type."_datestyletoday"], "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : show empty + $this->row['TOPIC'] = LIST_ADMIN_LAN_26; + $this->row['HEADING'] = LIST_ADMIN_LAN_27; + $this->row['HELP'] = LIST_ADMIN_LAN_28; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-sempty"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_showempty", "1", ($this->parent->list_pref[$type."_showempty"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_showempty", "0", ($this->parent->list_pref[$type."_showempty"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //menu preference : open section if content exists? this will override the individual setting of the section + $this->row['TOPIC'] = LIST_ADMIN_LAN_39; + $this->row['HEADING'] = LIST_ADMIN_LAN_40; + $this->row['HELP'] = LIST_ADMIN_LAN_41; + $this->row['CONTID'] = "list-new-menu-{$type}-expandable-osie"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_openifrecords", "1", ($this->parent->list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_openifrecords", "0", ($this->parent->list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + $text .= $this->parseTemplate('TOPIC_ROW_SPACER'); + $this->row['SUBMIT'] = $this->pref_submit(); + $text .= $this->parseTemplate('TOPIC_TABLE_END'); + return $text; + } + + /** + * display page options + * + * @param string $type the area to display + * @return string + * + */ + function parse_page_options($type) + { + global $rs; + + $display = ($type == "recent_page" ? "display:none;" : ''); + + $text = " +
+
".$title."
"; + + $title = ($type == "new_page" ? LIST_ADMIN_OPT_4 : LIST_ADMIN_OPT_2); + $text .= ""; + + $text .= $this->parse_global_options($type); + + //page preference : caption + $this->row['TOPIC'] = LIST_ADMIN_LAN_2; + $this->row['HEADING'] = LIST_ADMIN_LAN_3; + $this->row['HELP'] = LIST_ADMIN_LAN_4; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-caption"; + $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $this->e107->tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : icon : use + $this->row['TOPIC'] = LIST_ADMIN_LAN_5; + $this->row['HEADING'] = LIST_ADMIN_LAN_6; + $this->row['HELP'] = LIST_ADMIN_LAN_7; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-icon-use"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_icon_use", "1", ($this->parent->list_pref[$type."_icon_use"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_icon_use", "0", ($this->parent->list_pref[$type."_icon_use"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : icon : show default theme bullet + $this->row['TOPIC'] = LIST_ADMIN_LAN_29; + $this->row['HEADING'] = LIST_ADMIN_LAN_30; + $this->row['HELP'] = LIST_ADMIN_LAN_31; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-icon-show"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_icon_default", "1", ($this->parent->list_pref[$type."_icon_default"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_icon_default", "0", ($this->parent->list_pref[$type."_icon_default"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : amount chars + $this->row['TOPIC'] = LIST_ADMIN_LAN_8; + $this->row['HEADING'] = LIST_ADMIN_LAN_9; + $this->row['HELP'] = LIST_ADMIN_LAN_10; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-amount-chars"; + $this->row['FIELD'] = $rs->form_text($type."_char_heading", "3", $this->parent->list_pref[$type."_char_heading"], "3", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : postfix + $this->row['TOPIC'] = LIST_ADMIN_LAN_11; + $this->row['HEADING'] = LIST_ADMIN_LAN_12; + $this->row['HELP'] = LIST_ADMIN_LAN_13; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-postfix"; + $this->row['FIELD'] = $rs->form_text($type."_char_postfix", "3", $this->parent->list_pref[$type."_char_postfix"], "3", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : date + $this->row['TOPIC'] = LIST_ADMIN_LAN_14; + $this->row['HEADING'] = LIST_ADMIN_LAN_15; + $this->row['HELP'] = LIST_ADMIN_LAN_16; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-date"; + $this->row['FIELD'] = $rs->form_text($type."_datestyle", "30", $this->parent->list_pref[$type."_datestyle"], "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : date today + $this->row['TOPIC'] = LIST_ADMIN_LAN_17; + $this->row['HEADING'] = LIST_ADMIN_LAN_18; + $this->row['HELP'] = LIST_ADMIN_LAN_19; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-datet"; + $this->row['FIELD'] = $rs->form_text($type."_datestyletoday", "30", $this->parent->list_pref[$type."_datestyletoday"], "50", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : show empty + $this->row['TOPIC'] = LIST_ADMIN_LAN_26; + $this->row['HEADING'] = LIST_ADMIN_LAN_27; + $this->row['HELP'] = LIST_ADMIN_LAN_28; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-showe"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_showempty", "1", ($this->parent->list_pref[$type."_showempty"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_showempty", "0", ($this->parent->list_pref[$type."_showempty"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : colomn + $this->row['TOPIC'] = LIST_ADMIN_LAN_20; + $this->row['HEADING'] = LIST_ADMIN_LAN_21; + $this->row['HELP'] = LIST_ADMIN_LAN_22; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-colomn"; + $this->row['FIELD'] = $rs->form_select_open($type."_colomn"); + for($a=1; $a<=count($this->parent->sections); $a++) + { + $this->row['FIELD'] .= ($this->parent->list_pref[$type."_colomn"] == $a ? $rs->form_option($a, 1, $a) : $rs->form_option($a, 0, $a)); + } + $this->row['FIELD'] .= $rs->form_select_close(); + $text .= $this->parseTemplate('TOPIC_ROW'); + + //page preference : welcome text + $this->row['TOPIC'] = LIST_ADMIN_LAN_23; + $this->row['HEADING'] = LIST_ADMIN_LAN_24; + $this->row['HELP'] = LIST_ADMIN_LAN_25; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-wtext"; + $this->row['FIELD'] = $rs->form_textarea($type."_welcometext", "50", "5", $this->e107->tp->toHTML($this->parent->list_pref[$type."_welcometext"],"","defs"), "", "tbox"); + $text .= $this->parseTemplate('TOPIC_ROW'); + + if($type == "new_page") + { + //timelapse:show + $this->row['TOPIC'] = LIST_ADMIN_LAN_36; + $this->row['HEADING'] = LIST_ADMIN_LAN_37; + $this->row['HELP'] = LIST_ADMIN_LAN_38; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-timelapse-show"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_timelapse", "1", ($this->parent->list_pref[$type."_timelapse"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_timelapse", "0", ($this->parent->list_pref[$type."_timelapse"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + //timelapse day number maximum + $this->row['TOPIC'] = LIST_ADMIN_LAN_32; + $this->row['HEADING'] = LIST_ADMIN_LAN_33; + $this->row['HELP'] = LIST_ADMIN_LAN_34; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-timelapse-dnm"; + $this->row['FIELD'] = $rs->form_text($type."_timelapse_days", "3", $this->parent->list_pref[$type."_timelapse_days"], "3", "tbox")." ".LIST_ADMIN_LAN_35; + $text .= $this->parseTemplate('TOPIC_ROW'); + } + + //page preference : open section if content exists? this will override the individual setting of the section + $this->row['TOPIC'] = LIST_ADMIN_LAN_39; + $this->row['HEADING'] = LIST_ADMIN_LAN_40; + $this->row['HELP'] = LIST_ADMIN_LAN_41; + $this->row['CONTID'] = "list-new-page-{$type}-expandable-osie"; + $this->row['FIELD'] = " + ".$rs->form_radio($type."_openifrecords", "1", ($this->parent->list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7." + ".$rs->form_radio($type."_openifrecords", "0", ($this->parent->list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8." + "; + $text .= $this->parseTemplate('TOPIC_ROW'); + + $text .= $this->parseTemplate('TOPIC_ROW_SPACER'); + $this->row['SUBMIT'] = $this->pref_submit(); + $text .= $this->parseTemplate('TOPIC_TABLE_END'); + + return $text; + } + + /** + * parseTemplate for admin page + * + * @param string $template the template to parse + * @return string + * + */ + function parseTemplate($template) + { + return preg_replace("/\{(.*?)\}/e", '$this->row[\'\1\']', $this->parent->template[$template]); + } + + /** + * display submit button + * + * @return string + * + */ + function pref_submit() + { + global $rs; + + $this->row['TOPIC'] = LIST_ADMIN_11; + $this->row['FIELD'] = $rs->form_button("submit", 'update_menu', LIST_ADMIN_2); + return $this->parseTemplate('TOPIC_ROW_NOEXPAND'); + } +} + +?> \ No newline at end of file diff --git a/e107_plugins/list_new/list_class.php b/e107_plugins/list_new/list_class.php index 3161eff6a..7a2bc6a85 100644 --- a/e107_plugins/list_new/list_class.php +++ b/e107_plugins/list_new/list_class.php @@ -1,517 +1,664 @@ db_Select("core", "*", "e107_name='list' "); - $row = $sql -> db_Fetch(); + $this->plugin_dir = e_PLUGIN."list_new/"; + $this->e107 = e107::getInstance(); - //insert default preferences - if (empty($row['e107_value'])) { + //language + @include_lan($this->plugin_dir."languages/".e_LANGUAGE.".php"); + + //template + if (is_readable(THEME."list_template.php")) + { + require_once(THEME."list_template.php"); + } + else + { + require_once($this->plugin_dir."list_template.php"); + } + $this->template = $TEMPLATE_LIST_NEW; - $this -> getSections(); - $list_pref = $this -> getDefaultPrefs(); - $tmp = $eArrayStorage->WriteArray($list_pref); + //shortcodes + require_once($this->plugin_dir."list_shortcodes.php"); + $this->shortcodes = $list_shortcodes; - $sql -> db_Insert("core", "'list', '$tmp' "); - $sql -> db_Select("core", "*", "e107_name='list' "); + if($mode=='admin') + { + require_once($this->plugin_dir."list_admin_class.php"); + $this->admin = new list_admin($this); } - $list_pref = $eArrayStorage->ReadArray($row['e107_value']); - return $list_pref; + //default sections (present in this list plugin) + $this->defaultArray = array("news", "comment", "download", "members"); } - function prepareSection($mode){ - global $list_pref; + /** + * helper method, parse the template + * + * @param string $template the template to parse + * @return string + * + */ + function parseTemplate($template) + { + //for each call to the template, provide the correct data set through load_globals + list_shortcodes::load_globals(); + return $this->e107->tp->parseTemplate($this->template[$template], true, $this->shortcodes); + } + /** + * get preferences, retrieve all preferences from core table + * + * @return array + * + */ + function getListPrefs() + { + //check preferences from database + $num_rows = $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='list' "); + $row = $this->e107->sql->db_Fetch(); + + //insert default preferences + if (empty($row['e107_value'])) + { + $this->getSections(); + $this->list_pref = $this->getDefaultPrefs(); + $tmp = $this->e107->arrayStorage->WriteArray($this->list_pref); + + $this->e107->sql->db_Insert("core", "'list', '$tmp' "); + $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='list' "); + } + + $this->list_pref = $this->e107->arrayStorage->ReadArray($row['e107_value']); + return $this->list_pref; + } + + /** + * prepareSection checks if the sections should be displayed + * + * @param string $mode the mode of the area (menu/page - new/recent) + * @return array + * + */ + function prepareSection($mode) + { $len = strlen($mode) + 9; + $sections = array(); + //get all sections to use - foreach ($list_pref as $key => $value) { - if(substr($key,-$len) == "_{$mode}_display" && $value == "1"){ + foreach($this->list_pref as $key=>$value) + { + if(substr($key,-$len) == "_{$mode}_display" && $value == "1") + { $sections[] = substr($key,0,-$len); } } - return $sections; } - function prepareSectionArray($mode, $sections){ - global $list_pref; - + /** + * prepareSectionArray parses the preferences for each section + * + * @param string $mode the mode of the area (menu/page - new/recent) + * @return array + * + */ + function prepareSectionArray($mode) + { //section reference - for($i=0;$isections);$i++) + { + $s = $this->sections[$i]; + if(varsettrue($this->list_pref[$s."_".$mode."_display"]) == '1') + { + $arr[$s]['caption'] = varsettrue($this->list_pref[$s."_".$mode."_caption"]); + $arr[$s]['display'] = varsettrue($this->list_pref[$s."_".$mode."_display"]); + $arr[$s]['open'] = varsettrue($this->list_pref[$s."_".$mode."_open"]); + $arr[$s]['author'] = varsettrue($this->list_pref[$s."_".$mode."_author"]); + $arr[$s]['category'] = varsettrue($this->list_pref[$s."_".$mode."_category"]); + $arr[$s]['date'] = varsettrue($this->list_pref[$s."_".$mode."_date"]); + $arr[$s]['icon'] = varsettrue($this->list_pref[$s."_".$mode."_icon"]); + $arr[$s]['amount'] = varsettrue($this->list_pref[$s."_".$mode."_amount"]); + $arr[$s]['order'] = varsettrue($this->list_pref[$s."_".$mode."_order"]); + $arr[$s]['section'] = $s; } } //sort array on order values set in preferences - usort($arr, create_function('$e,$f','return $e[8]==$f[8]?0:($e[8]>$f[8]?1:-1);')); + usort($arr, create_function('$e,$f','return $e["order"]==$f["order"]?0:($e["order"]>$f["order"]?1:-1);')); return $arr; } - function getDefaultSections(){ - global $sql, $sections, $titles, $defaultarray; - + /** + * getDefaultSections loads all default 'core' sections from the constructor + * + * @return void + * + */ + function getDefaultSections() + { //default always present sections - for($i=0;$idefaultArray);$i++) + { + $this->sections[] = $this->defaultArray[$i]; + $this->titles[] = $this->defaultArray[$i]; } return; } //content needs this to split each main parent into separate sections - function getContentSections($mode) + /** + * getContentSections loads all top level content categories + * + * @param string $mode (default, add) + * @return void + * + */ + function getContentSections($mode='') { - global $sql, $sections, $titles, $content_types, $content_name, $pref; + global $pref; -// if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' ")) if (!$content_install = isset($pref['plug_installed']['content'])) { - return; + return; } - $datequery = " AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") "; - //get main parent types - if($mainparents = $sql -> db_Select("pcontent", "content_id, content_heading", "content_parent = '0' ".$datequery." ORDER BY content_heading")) + $content_types = array(); + + //get top level categories + if($mainparents = $this->e107->sql->db_Select_gen("SELECT content_id, content_heading FROM #pcontent WHERE content_parent = '0' AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ORDER BY content_heading")) { - while($row = $sql -> db_Fetch()) + $content_name = 'content'; + while($row = $this->e107->sql->db_Fetch()) { $content_types[] = "content_".$row['content_id']; - $content_name = 'content'; - if($mode == "add") + if(varsettrue($mode) == "add") { - $sections[] = "content_".$row['content_id']; - $titles[] = $content_name." : ".$row['content_heading']; + $this->sections[] = "content_".$row['content_id']; + $this->titles[] = $content_name." : ".$row['content_heading']; } } } - $content_types = array_unique($content_types); + $this->content_types = array_unique($content_types); + $this->content_name = $content_name; return; } + /** + * getSections loads all sections + * + * @return void + * + */ function getSections() { - global $sql, $sections, $titles, $pref; + global $pref; - $this -> getDefaultSections(); + $this->getDefaultSections(); - require_once(e_HANDLER."file_class.php"); - $fl = new e_file; - $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', '.bak'); - $iconlist = $fl->get_files(e_PLUGIN, "e_list\.php$", "standard", 1); - foreach($iconlist as $icon) + if(is_array($pref['e_list_list'])) { - $tmp = explode("/", $icon['path']); - $tmp = array_reverse($tmp); - $icon['fname'] = $tmp[1]; - -// if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' ")) - if ($plugin_installed = isset($pref['plug_installed'][$icon['fname']])) + foreach($pref['e_list_list'] as $file) { - if($icon['fname'] == "content") + if ($plugin_installed = isset($pref['plug_installed'][$file])) { - $this -> getContentSections("add"); - } - else - { - $sections[] = $icon['fname']; - $titles[] = $icon['fname']; + if($file == "content") + { + $this->getContentSections("add"); + } + else + { + $this->sections[] = $file; + $this->titles[] = $file; + } } } } return; } + /** + * getDefaultPrefs retrieve all default preferences (if none present) + * + * @return array + * + */ function getDefaultPrefs() { - global $sql, $sections, $titles, $defaultarray, $content_types, $tp, $pref; + global $pref; + $prf = array(); //section preferences - for($i=0;$isections);$i++) { - if(!in_array($sections[$i], $defaultarray)) + $s = $this->sections[$i]; + if(!in_array($this->sections[$i], $this->defaultArray)) { - if(!in_array($sections[$i], $content_types)) + if(!in_array($s, $this->content_types)) { -// if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' ")) - if ($plugin_installed = isset($pref['plug_installed'][$tp -> toDB($sections[$i], true)])) + if ($plugin_installed = isset($pref['plug_installed'][$this->e107->tp->toDB($s, true)])) { - $list_pref["$sections[$i]_recent_menu_caption"] = $sections[$i]; - $list_pref["$sections[$i]_recent_page_caption"] = $sections[$i]; - $list_pref["$sections[$i]_new_menu_caption"] = $sections[$i]; - $list_pref["$sections[$i]_new_page_caption"] = $sections[$i]; + $prf["$s_recent_menu_caption"] = $s; + $prf["$s_recent_page_caption"] = $s; + $prf["$s_new_menu_caption"] = $s; + $prf["$s_new_page_caption"] = $s; } } else { - $list_pref["$sections[$i]_recent_menu_caption"] = $titles[$i]; - $list_pref["$sections[$i]_recent_page_caption"] = $titles[$i]; - $list_pref["$sections[$i]_new_menu_caption"] = $titles[$i]; - $list_pref["$sections[$i]_new_page_caption"] = $titles[$i]; + $prf["$s_recent_menu_caption"] = $this->titles[$i]; + $prf["$s_recent_page_caption"] = $this->titles[$i]; + $prf["$s_new_menu_caption"] = $this->titles[$i]; + $prf["$s_new_page_caption"] = $this->titles[$i]; } } else { - $list_pref["$sections[$i]_recent_menu_caption"] = $sections[$i]; - $list_pref["$sections[$i]_recent_page_caption"] = $sections[$i]; - $list_pref["$sections[$i]_new_menu_caption"] = $sections[$i]; - $list_pref["$sections[$i]_new_page_caption"] = $sections[$i]; + $prf["$s_recent_menu_caption"] = $s; + $prf["$s_recent_page_caption"] = $s; + $prf["$s_new_menu_caption"] = $s; + $prf["$s_new_page_caption"] = $s; } - $list_pref["$sections[$i]_recent_menu_display"] = "1"; - $list_pref["$sections[$i]_recent_menu_open"] = "0"; - $list_pref["$sections[$i]_recent_menu_author"] = "0"; - $list_pref["$sections[$i]_recent_menu_category"] = "0"; - $list_pref["$sections[$i]_recent_menu_date"] = "1"; - $list_pref["$sections[$i]_recent_menu_amount"] = "5"; - $list_pref["$sections[$i]_recent_menu_order"] = ($i+1); - $list_pref["$sections[$i]_recent_menu_icon"] = ""; + $prf["$s_recent_menu_display"] = "1"; + $prf["$s_recent_menu_open"] = "0"; + $prf["$s_recent_menu_author"] = "0"; + $prf["$s_recent_menu_category"] = "0"; + $prf["$s_recent_menu_date"] = "1"; + $prf["$s_recent_menu_amount"] = "5"; + $prf["$s_recent_menu_order"] = ($i+1); + $prf["$s_recent_menu_icon"] = ''; - $list_pref["$sections[$i]_recent_page_display"] = "1"; - $list_pref["$sections[$i]_recent_page_open"] = "1"; - $list_pref["$sections[$i]_recent_page_author"] = "1"; - $list_pref["$sections[$i]_recent_page_category"] = "1"; - $list_pref["$sections[$i]_recent_page_date"] = "1"; - $list_pref["$sections[$i]_recent_page_amount"] = "10"; - $list_pref["$sections[$i]_recent_page_order"] = ($i+1); - $list_pref["$sections[$i]_recent_page_icon"] = "1"; + $prf["$s_recent_page_display"] = "1"; + $prf["$s_recent_page_open"] = "1"; + $prf["$s_recent_page_author"] = "1"; + $prf["$s_recent_page_category"] = "1"; + $prf["$s_recent_page_date"] = "1"; + $prf["$s_recent_page_amount"] = "10"; + $prf["$s_recent_page_order"] = ($i+1); + $prf["$s_recent_page_icon"] = "1"; - $list_pref["$sections[$i]_new_menu_display"] = "1"; - $list_pref["$sections[$i]_new_menu_open"] = "0"; - $list_pref["$sections[$i]_new_menu_author"] = "0"; - $list_pref["$sections[$i]_new_menu_category"] = "0"; - $list_pref["$sections[$i]_new_menu_date"] = "1"; - $list_pref["$sections[$i]_new_menu_amount"] = "5"; - $list_pref["$sections[$i]_new_menu_order"] = ($i+1); - $list_pref["$sections[$i]_new_menu_icon"] = "1"; + $prf["$s_new_menu_display"] = "1"; + $prf["$s_new_menu_open"] = "0"; + $prf["$s_new_menu_author"] = "0"; + $prf["$s_new_menu_category"] = "0"; + $prf["$s_new_menu_date"] = "1"; + $prf["$s_new_menu_amount"] = "5"; + $prf["$s_new_menu_order"] = ($i+1); + $prf["$s_new_menu_icon"] = "1"; - $list_pref["$sections[$i]_new_page_display"] = "1"; - $list_pref["$sections[$i]_new_page_open"] = "1"; - $list_pref["$sections[$i]_new_page_author"] = "1"; - $list_pref["$sections[$i]_new_page_category"] = "1"; - $list_pref["$sections[$i]_new_page_date"] = "1"; - $list_pref["$sections[$i]_new_page_amount"] = "10"; - $list_pref["$sections[$i]_new_page_order"] = ($i+1); - $list_pref["$sections[$i]_new_page_icon"] = "1"; + $prf["$s_new_page_display"] = "1"; + $prf["$s_new_page_open"] = "1"; + $prf["$s_new_page_author"] = "1"; + $prf["$s_new_page_category"] = "1"; + $prf["$s_new_page_date"] = "1"; + $prf["$s_new_page_amount"] = "10"; + $prf["$s_new_page_order"] = ($i+1); + $prf["$s_new_page_icon"] = "1"; } //new menu preferences - $list_pref['new_menu_caption'] = LIST_ADMIN_15; - $list_pref['new_menu_icon_use'] = "1"; - $list_pref['new_menu_icon_default'] = "1"; - $list_pref['new_menu_char_heading'] = "20"; - $list_pref['new_menu_char_postfix'] = "..."; - $list_pref['new_menu_datestyle'] = "%d %b"; - $list_pref['new_menu_datestyletoday'] = "%H:%M"; - $list_pref['new_menu_showempty'] = "1"; - $list_pref['new_menu_openifrecords'] = ""; + $prf['new_menu_caption'] = LIST_ADMIN_15; + $prf['new_menu_icon_use'] = "1"; + $prf['new_menu_icon_default'] = "1"; + $prf['new_menu_char_heading'] = "20"; + $prf['new_menu_char_postfix'] = "..."; + $prf['new_menu_datestyle'] = "%d %b"; + $prf['new_menu_datestyletoday'] = "%H:%M"; + $prf['new_menu_showempty'] = "1"; + $prf['new_menu_openifrecords'] = ''; //new page preferences - $list_pref['new_page_caption'] = LIST_ADMIN_15; - $list_pref['new_page_icon_use'] = "1"; - $list_pref['new_page_icon_default'] = "1"; - $list_pref['new_page_char_heading'] = ""; - $list_pref['new_page_char_postfix'] = ""; - $list_pref['new_page_datestyle'] = "%d %b"; - $list_pref['new_page_datestyletoday'] = "%H:%M"; - $list_pref['new_page_showempty'] = "1"; - $list_pref['new_page_colomn'] = "1"; - $list_pref['new_page_welcometext'] = LIST_ADMIN_16; - $list_pref['new_page_timelapse'] = "1"; - $list_pref['new_page_timelapse_days'] = "30"; - $list_pref['new_page_openifrecords'] = ""; + $prf['new_page_caption'] = LIST_ADMIN_15; + $prf['new_page_icon_use'] = "1"; + $prf['new_page_icon_default'] = "1"; + $prf['new_page_char_heading'] = ''; + $prf['new_page_char_postfix'] = ''; + $prf['new_page_datestyle'] = "%d %b"; + $prf['new_page_datestyletoday'] = "%H:%M"; + $prf['new_page_showempty'] = "1"; + $prf['new_page_colomn'] = "1"; + $prf['new_page_welcometext'] = LIST_ADMIN_16; + $prf['new_page_timelapse'] = "1"; + $prf['new_page_timelapse_days'] = "30"; + $prf['new_page_openifrecords'] = ''; //recent menu preferences - $list_pref['recent_menu_caption'] = LIST_ADMIN_14; - $list_pref['recent_menu_icon_use'] = "1"; - $list_pref['recent_menu_icon_default'] = "1"; - $list_pref['recent_menu_char_heading'] = "20"; - $list_pref['recent_menu_char_postfix'] = "..."; - $list_pref['recent_menu_datestyle'] = "%d %b"; - $list_pref['recent_menu_datestyletoday'] = "%H:%M"; - $list_pref['recent_menu_showempty'] = ""; - $list_pref['recent_menu_openifrecords'] = ""; + $prf['recent_menu_caption'] = LIST_ADMIN_14; + $prf['recent_menu_icon_use'] = "1"; + $prf['recent_menu_icon_default'] = "1"; + $prf['recent_menu_char_heading'] = "20"; + $prf['recent_menu_char_postfix'] = "..."; + $prf['recent_menu_datestyle'] = "%d %b"; + $prf['recent_menu_datestyletoday'] = "%H:%M"; + $prf['recent_menu_showempty'] = ''; + $prf['recent_menu_openifrecords'] = ''; //recent page preferences - $list_pref['recent_page_caption'] = LIST_ADMIN_14; - $list_pref['recent_page_icon_use'] = "1"; - $list_pref['recent_page_icon_default'] = "1"; - $list_pref['recent_page_char_heading'] = ""; - $list_pref['recent_page_char_postfix'] = ""; - $list_pref['recent_page_datestyle'] = "%d %b"; - $list_pref['recent_page_datestyletoday'] = "%H:%M"; - $list_pref['recent_page_showempty'] = ""; - $list_pref['recent_page_colomn'] = "1"; - $list_pref['recent_page_welcometext'] = LIST_ADMIN_13; - $list_pref['recent_page_openifrecords'] = ""; + $prf['recent_page_caption'] = LIST_ADMIN_14; + $prf['recent_page_icon_use'] = "1"; + $prf['recent_page_icon_default'] = "1"; + $prf['recent_page_char_heading'] = ''; + $prf['recent_page_char_postfix'] = ''; + $prf['recent_page_datestyle'] = "%d %b"; + $prf['recent_page_datestyletoday'] = "%H:%M"; + $prf['recent_page_showempty'] = ''; + $prf['recent_page_colomn'] = "1"; + $prf['recent_page_welcometext'] = LIST_ADMIN_13; + $prf['recent_page_openifrecords'] = ''; - return $list_pref; + return $prf; } - function show_section_list($arr, $mode, $max="") + /** + * displaySection, prepare and render a section + * + * @param array $arr the array of preferences for this section + * @return string + * + */ + function displaySection($arr) { - global $tp, $listplugindir, $list_shortcodes, $sql, $list_pref, $defaultarray, $content_types, $content_name; - global $LIST_ICON, $LIST_DATE, $LIST_HEADING, $LIST_AUTHOR, $LIST_CATEGORY, $LIST_INFO; - global $LIST_DISPLAYSTYLE, $LIST_CAPTION, $LIST_STYLE_CAPTION, $LIST_STYLE_BODY; - global $LIST_PAGE_NEW, $LIST_PAGE_RECENT, $LIST_MENU_NEW, $LIST_MENU_RECENT, $LIST_PAGE_NEW_START, $LIST_PAGE_RECENT_START, $LIST_MENU_NEW_START, $LIST_MENU_RECENT_START, $LIST_PAGE_NEW_END, $LIST_PAGE_RECENT_END, $LIST_MENU_NEW_END, $LIST_MENU_RECENT_END; + //set settings + $this->settings = $arr; - // Following query no longer used - //$menu_installed = $sql -> db_Select("menus", "menu_id", "(menu_name = 'list_new_menu' || menu_name = 'list_recent_menu') AND menu_location != '0' AND menu_class REGEXP '".e_CLASS_REGEXP."' "); - $LIST_DATA = ""; - $LIST_CAPTION = ""; + //get content sections + $this->getContentSections(); - $this -> getContentSections(""); + //load e_list file + $this->data = $this->load_elist(); + + //set record variables + $this->row = array(); + $this->row['caption'] = ''; + $this->row['icon'] = ''; + $this->row['date'] = ''; + $this->row['heading'] = ''; + $this->row['author'] = ''; + $this->row['category'] = ''; + $this->row['info'] = ''; + + $text = ''; + + switch($this->mode) + { + case 'recent_menu': + $text .= $this->parseRecord('MENU_RECENT'); + break; + case 'new_menu': + $text .= $this->parseRecord('MENU_NEW'); + break; + case 'recent_page': + $text .= $this->parseRecord('PAGE_RECENT'); + break; + case 'new_page': + $text .= $this->parseRecord('PAGE_NEW'); + break; + } + + return $text; + } + + /** + * parseRecord renders the items within a section + * + * @param string $area the area for display + * @return string + * + */ + function parseRecord($area) + { + if(!in_array($area, array('MENU_RECENT', 'MENU_NEW', 'PAGE_RECENT', 'PAGE_NEW'))) + { + return; + } + + //echo "parse: ".$area."_START
"; + $text = $this->parseTemplate($area.'_START'); + if(is_array($this->data['records'])) + { + foreach($this->data['records'] as $this->row) + { + //echo "parse: ".$area."
"; + $text .= $this->parseTemplate($area); + } + } + elseif(!is_array($this->data['records']) && $this->data['records'] != "") + { + if($this->list_pref[$this->mode."_showempty"]) + { + $this->row['heading'] = $this->data['records']; + //echo "parse: ".$area."
"; + $text .= $this->parseTemplate($area); + } + } + //echo "parse: ".$area."_END
"; + $text .= $this->parseTemplate($area.'_END'); + return $text; + } + + /** + * load_elist loads and checks all e_list.php files + * + * @return array + * + */ + function load_elist() + { + $listArray = ''; //require is needed here instead of require_once, since both the menu and the page could be visible at the same time - if(is_array($content_types) && in_array($arr[9], $content_types)) + if(is_array($this->content_types) && in_array($this->settings['section'], $this->content_types)) { - $file = $content_name; - if(file_exists(e_PLUGIN.$file."/e_list.php")) + $file = $this->content_name; + if(is_readable(e_PLUGIN.$file."/e_list.php")) { - global $contentmode; - $contentmode = $arr[9]; - require(e_PLUGIN.$file."/e_list.php"); + $this->mode_content = $this->settings['section']; + //echo "require: ".e_PLUGIN.$file."/e_list.php
"; + require_once(e_PLUGIN.$file."/e_list.php"); + $listArray = $this->load_data($file); } } else { - $file = $arr[9]; - if(in_array($file, $defaultarray)) + $file = $this->settings['section']; + if(in_array($file, $this->defaultArray)) { - require($listplugindir."section/list_".$file.".php"); + //echo "require: ".$this->plugin_dir."section/list_".$file.".php
"; + require_once($this->plugin_dir."section/list_".$file.".php"); + $listArray = $this->load_data($file); } else { - if(file_exists(e_PLUGIN.$file."/e_list.php")) + if (plugInstalled($file)) { - require(e_PLUGIN.$file."/e_list.php"); + if(is_readable(e_PLUGIN.$file."/e_list.php")) + { + //echo "require: ".e_PLUGIN.$file."/e_list.php
"; + require_once(e_PLUGIN.$file."/e_list.php"); + $listArray = $this->load_data($file); + } } } } - $menutext = ""; - $start = ""; - $end = ""; - - $LIST_ICON = ""; - $LIST_DATE = ""; - $LIST_HEADING = ""; - $LIST_AUTHOR = ""; - $LIST_CATEGORY = ""; - $LIST_INFO = ""; - //$LIST_CAPTION = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : ""); - //$LIST_CAPTION = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : ""); - //echo $list_pref["$arr_{$mode}_caption"]; - - if(is_array($LIST_DATA)){ //if it is an array, data exists and data is not empty - for($i=0;$i parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes); - - }elseif($mode == "new_page"){ - $menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes); - } - } - }elseif(!is_array($LIST_DATA) && $LIST_DATA != ""){ - $LIST_HEADING = $LIST_DATA; - if($mode == "recent_menu"){ - if($list_pref[$mode."_showempty"]){ - $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT); - } - }elseif($mode == "new_menu"){ - if($list_pref[$mode."_showempty"]){ - $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW); - } - }elseif($mode == "recent_page"){ - if($list_pref[$mode."_showempty"]){ - $menutext .= $tp -> parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes); - } - }elseif($mode == "new_page"){ - if($list_pref[$mode."_showempty"]){ - $menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes); - } - - } - } - - if($LIST_DATA != ""){ - - //open sections if content exists ? yes if true, else use individual setting of section - $LIST_DISPLAYSTYLE = ($list_pref[$mode."_openifrecords"] ? "" : $LIST_DISPLAYSTYLE); - - if($mode == "recent_menu"){ - if($list_pref[$mode."_showempty"] || $menutext){ - $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_START); - $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_END); - } - - }elseif($mode == "new_menu"){ - if($list_pref[$mode."_showempty"] || $menutext){ - $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_START); - $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_END); - } - - }elseif($mode == "recent_page"){ - if($list_pref[$mode."_showempty"] || $menutext){ - $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_RECENT_START); - $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_RECENT_END); - } - - }elseif($mode == "new_page"){ - if($list_pref[$mode."_showempty"] || $menutext){ - $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_NEW_START); - $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_NEW_END); - } - } - $text = $start.$menutext.$end; - }else{ - $text = ""; - } - return $text; + return $listArray; } - function getlvisit(){ - global $qs, $list_pref; + /** + * load_data calls the class from the e_list file and retrieves the data + * + * @param string $file the section to load (class name) + * @return array + * + */ + function load_data($file) + { + $name = "list_".$file; - if(isset($qs[0]) && $qs[0] == "new"){ - if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){ - if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days']) && $list_pref['new_page_timelapse_days']){ - $days = $list_pref['new_page_timelapse_days']; - }else{ + $listArray = ''; + + //instantiate the class with this as parm + if(!class_exists($name)) + { + //echo "class $name doesn't exist
"; + } + else + { + $class = new $name($this); + //call method + if(!method_exists($class, 'getListData')) + { + //echo "method getListData doesn't exist in class $class
"; + } + else + { + $listArray = $class->getListData(); + } + } + return $listArray; + } + + /** + * get datestamp last visit + * + * @return int datestamp + * + */ + function getlvisit() + { + global $qs; + + $lvisit = USERLV; + if(varsettrue($qs[0]) == "new") + { + if(varsettrue($this->list_pref['new_page_timelapse'])) + { + if(varsettrue($this->list_pref['new_page_timelapse_days']) && is_numeric($this->list_pref['new_page_timelapse_days'])) + { + $days = $this->list_pref['new_page_timelapse_days']; + } + else + { $days = "30"; } - if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days){ + if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days) + { $lvisit = time()-$qs[1]*86400; - }else{ - $lvisit = USERLV; } - }else{ - $lvisit = USERLV; } - }else{ - $lvisit = USERLV; } return $lvisit; } - function getBullet($sectionicon, $mode) + /** + * get bullet icon, either use the icon set in admin or the default theme bullet + * + * @param string $icon the icon to use as set in admin + * @return string $bullet + * + */ + function getBullet($icon) { - global $list_pref, $listplugindir; + $default_bullet = ''; - $default_bullet = ""; - - if($list_pref[$mode."_icon_default"]) + if($this->list_pref[$this->mode."_icon_default"]) { - if(file_exists(THEME."images/bullet2.gif")) + if(is_readable(THEME."images/bullet2.gif")) { $default_bullet = ""; } } - $icon_width = "8"; - $icon_height = "8"; - $style_pre = ""; + $icon_width = '8'; + $icon_height = '8'; + $style_pre = ''; - if($list_pref[$mode."_icon_use"]){ - if($sectionicon){ - if(file_exists($listplugindir."images/".$sectionicon)){ - $bullet = ""; + if($this->list_pref[$this->mode."_icon_use"]) + { + if($icon) + { + if(is_readable($this->plugin_dir."images/".$icon)) + { + $bullet = ""; } } } - $bullet = (isset($bullet) ? $bullet : $default_bullet); + $bullet = varsettrue($bullet, $default_bullet); return $bullet; } - function parse_heading($heading, $mode){ - global $list_pref; - - if($list_pref[$mode."_char_heading"] && strlen($heading) > $list_pref[$mode."_char_heading"]){ - $heading = substr($heading, 0, $list_pref[$mode."_char_heading"]).$list_pref[$mode."_char_postfix"]; + /** + * helper method, parse heading to specific length with postfix + * + * @param string $heading the heading from the item record + * @return string $heading the parsed heading + * + */ + function parse_heading($heading) + { + if($this->list_pref[$this->mode."_char_heading"] && strlen($heading) > $this->list_pref[$this->mode."_char_heading"]) + { + $heading = substr($heading, 0, $this->list_pref[$this->mode."_char_heading"]).$this->list_pref[$this->mode."_char_postfix"]; } return $heading; } - function getListDate($datestamp, $mode){ - global $list_pref; - + /** + * helper method, format the date + * + * @param int $datestamp the datestamp of the item record + * @return string the formatted date + * + */ + function getListDate($datestamp) + { $datestamp += TIMEOFFSET; $todayarray = getdate(); @@ -524,33 +671,156 @@ class listclass { $thisyear = date("Y", $datestamp); //check and use the today date style if day is today - if($thisyear == $current_year){ - if($thismonth == $current_month){ - if($thisday == $current_day){ - $datepreftoday = $list_pref[$mode."_datestyletoday"]; - $date = strftime($datepreftoday, $datestamp); - return $date; + if($thisyear == $current_year) + { + if($thismonth == $current_month) + { + if($thisday == $current_day) + { + $datepreftoday = $this->list_pref[$this->mode."_datestyletoday"]; + return strftime($datepreftoday, $datestamp); } } } //else use default date style - $datepref = $list_pref[$mode."_datestyle"]; - $date = strftime($datepref, $datestamp); - return $date; + $datepref = $this->list_pref[$this->mode."_datestyle"]; + return strftime($datepref, $datestamp); } + /** + * display timelapse element (on newpage) + * + * @return string the timelapse element + * + */ + function displayTimelapse() + { + global $rs; - //##### FUNCTIONS BENEATH ARE ONLY USED IN THE ADMIN PAGE + if(isset($this->list_pref['new_page_timelapse']) && $this->list_pref['new_page_timelapse']) + { + if(isset($this->list_pref['new_page_timelapse_days']) && is_numeric($this->list_pref['new_page_timelapse_days'])) + { + $days = $this->list_pref['new_page_timelapse_days']; + } + else + { + $days = '30'; + } + $timelapse = 0; + if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days) + { + $timelapse = $qs[1]; + } + $url = $this->plugin_dir."list.php?new"; + $selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\""; - function parse_headerrow_title($title){ - global $rs, $list_pref; + $this->row['timelapse'] = LIST_MENU_6; + $this->row['timelapse'] .= $rs->form_select_open("timelapse", $selectjs).$rs->form_option(LIST_MENU_5, 0, $url); + for($a=1; $a<=$days; $a++) + { + $this->row['timelapse'] .= $rs->form_option($a, ($timelapse == $a ? '1' : '0'), $url.".".$a); + } + $this->row['timelapse'] .= $rs->form_select_close(); - $text = "
"; + return $this->parseTemplate('TIMELAPSE_TABLE'); + } + return; + } + /** + * display the page (either recent or new) + * + * @return string + * + */ + function displayPage() + { + global $qs; + + //get preferences + if(!isset($this->list_pref)) + { + $this->list_pref = $this->getListPrefs(); + } + + //get sections + $this->sections = $this->prepareSection($this->mode); + $arr = $this->prepareSectionArray($this->mode); + + //timelapse + if(varsettrue($qs[0]) == "new") + { + $text .= $this->displayTimelapse(); + } + + $text .= $this->parseTemplate('COL_START'); + + //welcometext + if($this->list_pref[$this->mode."_welcometext"]) + { + $text .= $this->parseTemplate('COL_WELCOME'); + } + + //display the sections + $k=0; + foreach($arr as $sect) + { + if($sect['display'] == '1') + { + $sectiontext = $this->displaySection($sect); + if($sectiontext != '') + { + $v = $k/$this->list_pref[$this->mode."_colomn"]; + if( intval($v) == $v ) + { + $text .= $this->parseTemplate('COL_ROWSWITCH'); + } + $text .= $this->parseTemplate('COL_CELL_START'); + $text .= $sectiontext; + $text .= $this->parseTemplate('COL_CELL_END'); + $k++; + } + } + } + $text .= $this->parseTemplate('COL_END'); return $text; } + /** + * display the menu (either recent or new) + * + * @return string + * + */ + function displayMenu() + { + //get preferences + if(!isset($this->list_pref)) + { + $this->list_pref = $this->getListPrefs(); + } + + //get sections + $this->sections = $this->prepareSection($this->mode); + $arr = $this->prepareSectionArray($this->mode); + + //display the sections + $text = ''; + foreach($arr as $sect) + { + if($sect['display'] == '1') + { + $sectiontext = $this->displaySection($sect); + if($sectiontext != '') + { + $text .= $sectiontext; + } + } + } + return $text; + } } ?> \ No newline at end of file diff --git a/e107_plugins/list_new/list_new_menu.php b/e107_plugins/list_new/list_new_menu.php index 5c2d5d705..e45cc4677 100644 --- a/e107_plugins/list_new/list_new_menu.php +++ b/e107_plugins/list_new/list_new_menu.php @@ -1,20 +1,18 @@ getListPrefs(); -} +//set mode +$rc->mode = "new_menu"; -$mode = "new_menu"; -$sections = $rc->prepareSection($mode); -$arr = $rc->prepareSectionArray($mode, $sections); -// display the sections -$text = ""; -for($i = 0;$i < count($arr);$i++) -{ - if ($arr[$i][1] == "1") - { - $sectiontext = $rc->show_section_list($arr[$i], $mode); - if ($sectiontext != "") - { - $text .= $sectiontext; - } - } -} +//parse menu +$text = $rc->displayMenu(); -$caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1); -$ns->tablerender($caption, $text, 'list_new'); +$caption = varsettrue($rc->list_pref[$rc->mode."_caption"], LIST_MENU_1); +$rc->e107->ns->tablerender($caption, $text, 'list_new'); unset($text); ?> \ No newline at end of file diff --git a/e107_plugins/list_new/list_recent_menu.php b/e107_plugins/list_new/list_recent_menu.php index 449380a3d..15a239a02 100644 --- a/e107_plugins/list_new/list_recent_menu.php +++ b/e107_plugins/list_new/list_recent_menu.php @@ -1,20 +1,18 @@ getListPrefs(); -} +//set mode +$rc->mode = "recent_menu"; -$mode = "recent_menu"; -$sections = $rc -> prepareSection($mode); -$arr = $rc -> prepareSectionArray($mode, $sections); +//parse menu +$text = $rc->displayMenu(); -//display the sections -$text = ""; -for($i=0;$i show_section_list($arr[$i], $mode); - if($sectiontext != "") - { - $text .= $sectiontext; - } - } -} - -$caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1); -$ns -> tablerender($caption, $text, 'list_recent'); +$caption = varsettrue($rc->list_pref[$rc->mode."_caption"], LIST_MENU_1); +$rc->e107->ns->tablerender($caption, $text, 'list_recent'); unset($text); ?> \ No newline at end of file diff --git a/e107_plugins/list_new/list_shortcodes.php b/e107_plugins/list_new/list_shortcodes.php index 337e4faec..320f66ffd 100644 --- a/e107_plugins/list_new/list_shortcodes.php +++ b/e107_plugins/list_new/list_shortcodes.php @@ -1,38 +1,105 @@ e_sc -> parse_scbatch(__FILE__); /* -SC_BEGIN LIST_DATE -global $LIST_DATE; -return $LIST_DATE; -SC_END - -SC_BEGIN LIST_ICON -global $LIST_ICON; -return $LIST_ICON; -SC_END - -SC_BEGIN LIST_HEADING -global $LIST_HEADING; -return $LIST_HEADING; -SC_END - -SC_BEGIN LIST_AUTHOR -global $LIST_AUTHOR; -return $LIST_AUTHOR; -SC_END - -SC_BEGIN LIST_CATEGORY -global $LIST_CATEGORY; -return $LIST_CATEGORY; -SC_END - -SC_BEGIN LIST_INFO -global $LIST_INFO; -return $LIST_INFO; -SC_END - - + * e107 website system + * + * Copyright (C) 2001-2008 e107 Inc (e107.org) + * Released under the terms and conditions of the + * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) + * + * List Shortcodes + * + * $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_shortcodes.php,v $ + * $Revision: 1.2 $ + * $Date: 2009-01-27 21:33:52 $ + * $Author: lisa_ $ + * */ + +if (!defined('e107_INIT')) { exit; } + +register_shortcode('list_shortcodes', true); +initShortcodeClass('list_shortcodes'); + +class list_shortcodes +{ + var $rc; + var $e107; + var $row; + var $list_pref; + + function list_shortcodes() + { + $this->e107 = e107::getInstance(); + } + + function load_globals() + { + global $rc; + $e107 = e107::getInstance(); + $e107->tp->e_sc->scClasses['list_shortcodes']->rc = $rc; + $e107->tp->e_sc->scClasses['list_shortcodes']->row = $rc->row; + $e107->tp->e_sc->scClasses['list_shortcodes']->list_pref = $rc->list_pref; + } + + function get_list_date() + { + return $this->row['date']; + } + + function get_list_icon() + { + return $this->row['icon']; + } + + function get_list_heading() + { + return $this->row['heading']; + } + + function get_list_author() + { + return $this->row['author']; + } + + function get_list_category() + { + return $this->row['category']; + } + + function get_list_info() + { + return $this->row['info']; + } + + function get_list_caption() + { + return $this->rc->data['caption']; + } + + function get_list_displaystyle() + { + //open sections if content exists ? yes if true, else use individual setting of section + return (varsettrue($this->list_pref[$this->rc->mode."_openifrecords"]) && is_array($this->rc->data['records']) ? "" : $this->rc->data['display']); + } + + function get_list_col_cols() + { + return $this->list_pref[$this->rc->mode."_colomn"]; + } + + function get_list_col_welcometext() + { + return $this->e107->tp->toHTML($this->list_pref[$this->rc->mode."_welcometext"]); + } + + function get_list_col_cellwidth() + { + return round((100/$this->list_pref[$this->rc->mode."_colomn"]),0); + } + + function get_list_timelapse() + { + return $this->row['timelapse']; + } +} ?> \ No newline at end of file diff --git a/e107_plugins/list_new/list_template.php b/e107_plugins/list_new/list_template.php index f4b8baa8e..be7693cb6 100644 --- a/e107_plugins/list_new/list_template.php +++ b/e107_plugins/list_new/list_template.php @@ -1,8 +1,23 @@ {LIST_CAPTION} -
\n"; -$LIST_MENU_NEW = " +
\n"; +$TEMPLATE_LIST_NEW['MENU_NEW'] = "
{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
"; -$LIST_MENU_NEW_END = " +$TEMPLATE_LIST_NEW['MENU_NEW_END'] = "
\n"; //LIST_MENU_RECENT TEMPLATE ------------------------------------------------------------------------- -$LIST_MENU_RECENT_START = " +$TEMPLATE_LIST_NEW['MENU_RECENT_START'] = "
{LIST_CAPTION}
-
\n"; -$LIST_MENU_RECENT = " +
\n"; +$TEMPLATE_LIST_NEW['MENU_RECENT'] = "
{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
"; -$LIST_MENU_RECENT_END = " +$TEMPLATE_LIST_NEW['MENU_RECENT_END'] = "
\n"; //PAGE TEMPLATE ------------------------------------------------------------------------- -$LIST_PAGE_RECENT_START = " +$TEMPLATE_LIST_NEW['PAGE_RECENT_START'] = "
{LIST_CAPTION}
-
\n"; -$LIST_PAGE_RECENT = " +
\n"; +$TEMPLATE_LIST_NEW['PAGE_RECENT'] = "
{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
"; -$LIST_PAGE_RECENT_END = " +$TEMPLATE_LIST_NEW['PAGE_RECENT_END'] = "
\n"; //NEW TEMPLATE ------------------------------------------------------------------------- -$LIST_PAGE_NEW_START = " +$TEMPLATE_LIST_NEW['PAGE_NEW_START'] = "
{LIST_CAPTION}
-
\n"; -$LIST_PAGE_NEW = " +
\n"; +$TEMPLATE_LIST_NEW['PAGE_NEW'] = "
{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
"; -$LIST_PAGE_NEW_END = " +$TEMPLATE_LIST_NEW['PAGE_NEW_END'] = "
\n"; - //MULTI COLOMNS LAYOUT MASTER ----------------------------------------------------------- -$LIST_COL_START = " +$TEMPLATE_LIST_NEW['COL_START'] = "
".$title."
".$title."
"; -$LIST_COL_WELCOME = ""; -$LIST_COL_ROWSWITCH = ""; -$LIST_COL_CELL_START = ""; -$LIST_COL_END = "
{LIST_COL_WELCOMETEXT}

"; -$LIST_COL_CELL_END = "
"; +$TEMPLATE_LIST_NEW['COL_WELCOME'] = "{LIST_COL_WELCOMETEXT}

"; +$TEMPLATE_LIST_NEW['COL_ROWSWITCH'] = ""; +$TEMPLATE_LIST_NEW['COL_CELL_START'] = ""; +$TEMPLATE_LIST_NEW['COL_CELL_END'] = ""; +$TEMPLATE_LIST_NEW['COL_END'] = "
"; //TIMELAPSE SELECT ----------------------------------------------------------- -$LIST_TIMELAPSE_TABLE = "
{LIST_TIMELAPSE}
"; +$TEMPLATE_LIST_NEW['TIMELAPSE_TABLE'] = "
{LIST_TIMELAPSE}
"; + + +//##### ADMIN + +//define some variables +//$stylespacer = "style='border:0; height:20px;'"; + +//template for non expanding row +$TEMPLATE_LIST_NEW['TOPIC_ROW_NOEXPAND'] = " + + {TOPIC} + {FIELD} +"; + +//template for expanding row +$TEMPLATE_LIST_NEW['TOPIC_ROW'] = " + + {TOPIC} + + {HEADING} +
+
{HELP}

+ {FIELD} +
+ +"; + +//template for spacer row +$TEMPLATE_LIST_NEW['TOPIC_ROW_SPACER'] = ""; + +$TEMPLATE_LIST_NEW['TOPIC_TABLE_START'] = " +
+
"; ?> \ No newline at end of file diff --git a/e107_plugins/list_new/plugin.xml b/e107_plugins/list_new/plugin.xml index 1e1081854..62bfa533a 100644 --- a/e107_plugins/list_new/plugin.xml +++ b/e107_plugins/list_new/plugin.xml @@ -1,9 +1,9 @@ - + - + LIST_PLUGIN_2 list_new diff --git a/e107_plugins/list_new/section/list_comment.php b/e107_plugins/list_new/section/list_comment.php index 6eb70f826..812430c66 100644 --- a/e107_plugins/list_new/section/list_comment.php +++ b/e107_plugins/list_new/section/list_comment.php @@ -1,43 +1,99 @@ getBullet($arr[6], $mode); - -$qry = ''; -if($mode == "new_page" || $mode == "new_menu" ){ - $lvisit = $this -> getlvisit(); - $qry = "comment_datestamp>".$lvisit; +global $tp, $cobj; +if(!is_object($cobj)) +{ + require_once(e_HANDLER."comment_class.php"); + $cobj = new comment; } -$data = $cobj->getCommentData(intval($arr[7]), '0', $qry); +class list_comment +{ + function list_comment($parent) + { + $this->parent = $parent; + } -foreach($data as $row){ - $rowheading = $this -> parse_heading($row['comment_title'], $mode); - if($row['comment_url']){ - $HEADING = "".$tp -> toHTML($rowheading, TRUE).""; - }else{ - $HEADING = $tp -> toHTML($rowheading, TRUE); - } - $CATEGORY = ''; - if($arr[4]){ - if($row['comment_category_url']){ - $CATEGORY = "".$row['comment_category_heading'].""; - }else{ - $CATEGORY = $row['comment_category_heading']; + function getListData() + { + global $tp, $cobj; + + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + $qry = ''; + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $qry = "comment_datestamp>".$this->parent->getlvisit(); } + + $data = $cobj->getCommentData(intval($this->parent->settings['amount']), '0', $qry); + + if(empty($data)) + { + $list_data = LIST_COMMENT_2; + } + else + { + $list_data = array(); + foreach($data as $row) + { + $record = array(); + $rowheading = $this->parent->parse_heading($row['comment_title']); + $record['icon'] = $bullet; + if($row['comment_url']) + { + $record['heading'] = "".$this->parent->e107->tp->toHTML($rowheading, TRUE).""; + } + else + { + $record['heading'] = $this->parent->e107->tp->toHTML($rowheading, TRUE); + } + $category = ''; + if(varsettrue($this->parent->settings['category'])) + { + if($row['comment_category_url']) + { + $record['category'] = "".$row['comment_category_heading'].""; + } + else + { + $record['category'] = $row['comment_category_heading']; + } + } + $record['author'] = (varsettrue($this->parent->settings['author']) ? $row['comment_author'] : ''); + $record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['comment_datestamp']) : ""); + $record['icon'] = $bullet; + $record['info'] = ''; + + $list_data[] = $record; + } + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } - $AUTHOR = ($arr[3] ? $row['comment_author'] : ''); - $DATE = ($arr[5] ? $this -> getListDate($row['comment_datestamp'], $mode) : ""); - $ICON = $bullet; - $INFO = ''; - - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); } ?> \ No newline at end of file diff --git a/e107_plugins/list_new/section/list_download.php b/e107_plugins/list_new/section/list_download.php index 5f29e0127..b10e99ec8 100644 --- a/e107_plugins/list_new/section/list_download.php +++ b/e107_plugins/list_new/section/list_download.php @@ -1,45 +1,80 @@ getlvisit(); - $qry = " AND download_datestamp>".$lvisit; - }else{ - $qry = " "; - } - - $bullet = $this -> getBullet($arr[6], $mode); - - $qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp, - dc.download_category_id, dc.download_category_name, dc.download_category_class - FROM #download AS d - LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id - WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry." - ORDER BY download_datestamp DESC LIMIT 0,".intval($arr[7])." "; - - $downloads = $sql -> db_Select_gen($qry); - if($downloads == 0) +class list_download +{ + function list_download($parent) { - $LIST_DATA = LIST_DOWNLOAD_2; + $this->parent = $parent; } - else - { - while($row = $sql -> db_Fetch()) - { - $rowheading = $this -> parse_heading($row['download_name'], $mode); - $ICON = $bullet; - $HEADING = "".$rowheading.""; - $AUTHOR = ($arr[3] ? $row['download_author'] : ""); - $CATEGORY = ($arr[4] ? "".$row['download_category_name']."" : ""); - $DATE = ($arr[5] ? $this -> getListDate($row['download_datestamp'], $mode) : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); - } + function getListData() + { + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); + + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $qry = " AND download_datestamp>".$this->parent->getlvisit(); + } + else + { + $qry = ''; + } + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + $qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp, + dc.download_category_id, dc.download_category_name, dc.download_category_class + FROM #download AS d + LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id + WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry." + ORDER BY download_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." "; + + $downloads = $this->parent->e107->sql->db_Select_gen($qry); + if($downloads == 0) + { + $list_data = LIST_DOWNLOAD_2; + } + else + { + $list_data = array(); + while($row = $this->parent->e107->sql->db_Fetch()) + { + $record = array(); + $rowheading = $this->parent->parse_heading($row['download_name']); + $record['icon'] = $bullet; + $record['heading'] = "".$rowheading.""; + $record['author'] = (varsettrue($this->parent->settings['author']) ? $row['download_author'] : ""); + $record['category'] = (varsettrue($this->parent->settings['category']) ? "".$row['download_category_name']."" : ""); + $record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['download_datestamp']) : ""); + $record['info'] = ""; + + $list_data[] = $record; + } + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } +} ?> \ No newline at end of file diff --git a/e107_plugins/list_new/section/list_members.php b/e107_plugins/list_new/section/list_members.php index d61345c67..f952da367 100644 --- a/e107_plugins/list_new/section/list_members.php +++ b/e107_plugins/list_new/section/list_members.php @@ -1,34 +1,68 @@ getlvisit(); - $qry = "user_join>".$lvisit." AND "; - }else{ - $qry = " "; +class list_members +{ + function list_members($parent) + { + $this->parent = $parent; } - $qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0,".intval($arr[7]); - $bullet = $this -> getBullet($arr[6], $mode); + function getListData() + { + $list_caption = $this->parent->settings['caption']; + $list_display = ($this->parent->settings['open'] ? "" : "none"); - if(!$sql -> db_Select("user", "user_id,user_name,user_join", $qry)){ - $LIST_DATA = LIST_MEMBER_2; - }else{ - while($row = $sql -> db_Fetch()){ - - $rowheading = $this -> parse_heading($row['user_name'], $mode); - $ICON = $bullet; - $HEADING = (USER ? "".$rowheading."" : $rowheading); - $CATEGORY = ""; - $AUTHOR = ""; - $DATE = ($arr[5] ? $this -> getListDate($row['user_join'], $mode) : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); + $qry = ''; + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $qry = "user_join>".$this->parent->getlvisit()." AND "; } + $qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0,".intval($this->parent->settings['amount']); + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + if(!$this->parent->e107->sql->db_Select_gen("SELECT user_id,user_name,user_join FROM #user WHERE ".$qry)) + { + $list_data = LIST_MEMBER_2; + } + else + { + while($row = $this->parent->e107->sql->db_Fetch()) + { + $record = array(); + $rowheading = $this->parent->parse_heading($row['user_name']); + $record['icon'] = $bullet; + $record['heading'] = (USER ? "".$rowheading."" : $rowheading); + $record['category'] = ''; + $record['author'] = ''; + $record['date'] = (varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['user_join']) : ""); + $record['info'] = ''; + $list_data[] = $record; + } + } + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } +} ?> \ No newline at end of file diff --git a/e107_plugins/list_new/section/list_news.php b/e107_plugins/list_new/section/list_news.php index cf0ba9e34..dabb4c41b 100644 --- a/e107_plugins/list_new/section/list_news.php +++ b/e107_plugins/list_new/section/list_news.php @@ -1,62 +1,131 @@ getlvisit(); - $qry = " news_datestamp>".$lvisit; - }else{ - $qry = " (news_start=0 || news_start < ".time().") AND (news_end=0 || news_end>".time().") "; +class list_news +{ + function list_news($parent) + { + $this->parent = $parent; } - $bullet = $this -> getBullet($arr[6], $mode); - - $LIST_CAPTION = $arr[0]; - $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); - - $qry = " - SELECT n.*, c.category_id AS news_category_id, c.category_name AS news_category_name, u.user_id AS news_author_id, u.user_name AS news_author_name - FROM #news AS n - LEFT JOIN #news_category AS c ON c.category_id = n.news_category - LEFT JOIN #user AS u ON n.news_author = u.user_id - WHERE ".$qry." AND n.news_class REGEXP '".e_CLASS_REGEXP."' - ORDER BY n.news_datestamp DESC LIMIT 0,".intval($arr[7])." - "; - - if(!$sql -> db_Select_gen($qry)){ - $LIST_DATA = LIST_NEWS_2; - }else{ - while($row = $sql -> db_Fetch()){ - - // Code from Lisa - // copied from the rss creation, but added here to make sure the url for the newsitem is to the news.php?item.X - // instead of the actual hyperlink that may have been added to a newstitle on creation - $search = array(); - $replace = array(); - $search[0] = "/\(.*?)<\/a>/si"; - $replace[0] = '\\2'; - $search[1] = "/\(.*?)<\/a>/si"; - $replace[1] = '\\2'; - $search[2] = "/\(.*?)<\/a>/si"; - $replace[2] = '\\2'; - $search[3] = "/\(.*?)<\/a>/si"; - $replace[3] = '\\2'; - $search[4] = "/\(.*?)<\/a>/si"; - $replace[4] = '\\2'; - $search[5] = "/\(.*?)<\/a>/si"; - $replace[5] = '\\2'; - $news_title = preg_replace($search, $replace, $row['news_title']); - // End of code from Lisa - - $rowheading = $this -> parse_heading($news_title, $mode); - $ICON = $bullet; - $HEADING = "".$rowheading.""; - $AUTHOR = ($arr[3] ? ($row['news_author'] == 0 ? $row['news_author'] : ($row['news_author_name'] ? "".$row['news_author_name']."" : "") ) : ""); - $CATEGORY = ($arr[4] ? "".$row['news_category_name']."" : ""); - $DATE = ($arr[5] ? $this -> getListDate($row['news_datestamp'], $mode) : ""); - $INFO = ""; - $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); + function getListData() + { + if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" ) + { + $qry = " n.news_datestamp>".$this->parent->getlvisit(); } + else + { + $qry = " (n.news_start=0 || n.news_start < ".time().") AND (n.news_end=0 || n.news_end>".time().") "; + } + + $bullet = $this->parent->getBullet($this->parent->settings['icon']); + + $list_caption = $this->parent->settings['caption']; + $list_display = (varsettrue($this->parent->settings['open']) ? '' : 'none'); + + $qry = " + SELECT n.*, c.category_id AS news_category_id, c.category_name AS news_category_name, u.user_id AS news_author_id, u.user_name AS news_author_name + FROM #news AS n + LEFT JOIN #news_category AS c ON c.category_id = n.news_category + LEFT JOIN #user AS u ON n.news_author = u.user_id + WHERE ".$qry." AND n.news_class REGEXP '".e_CLASS_REGEXP."' + ORDER BY n.news_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); + + if(!$this->parent->e107->sql->db_Select_gen($qry)) + { + $list_data = LIST_NEWS_2; + } + else + { + $list_data = array(); + while($row=$this->parent->e107->sql->db_Fetch()) + { + $row['news_title'] = $this->parse_news_title($row['news_title']); + $rowheading = $this->parent->parse_heading($row['news_title']); + + $record = array(); + $record['icon'] = $bullet; + $record['heading'] = "".$rowheading.""; + + $record['author'] = ''; + if(varsettrue($this->parent->settings['author'])) + { + if($row['news_author'] == 0) + { + $record['author'] = $row['news_author']; + } + else + { + if(varsettrue($row['news_author_name'])) + { + $record['author'] = "".$row['news_author_name'].""; + } + } + } + + $record['category'] = ''; + if(varsettrue($this->parent->settings['category'])) + { + $record['category'] = "".$row['news_category_name'].""; + } + + $record['date'] = ''; + if(varsettrue($this->parent->settings['date'])) + { + $record['date'] = $this->parent->getListDate($row['news_datestamp']); + } + + $record['info'] = ''; + + //collect each result + $list_data[] = $record; + } + } + + //return array with 'records', (global)'caption', 'display' + return array( + 'records'=>$list_data, + 'caption'=>$list_caption, + 'display'=>$list_display + ); } + //helpers + function parse_news_title($title) + { + // copied from the rss creation, but added here to make sure the url for the newsitem is to the news.php?item.X + // instead of the actual hyperlink that may have been added to a newstitle on creation + $search = array(); + $replace = array(); + $search[0] = "/\(.*?)<\/a>/si"; + $replace[0] = '\\2'; + $search[1] = "/\(.*?)<\/a>/si"; + $replace[1] = '\\2'; + $search[2] = "/\(.*?)<\/a>/si"; + $replace[2] = '\\2'; + $search[3] = "/\(.*?)<\/a>/si"; + $replace[3] = '\\2'; + $search[4] = "/\(.*?)<\/a>/si"; + $replace[4] = '\\2'; + $search[5] = "/\(.*?)<\/a>/si"; + $replace[5] = '\\2'; + return preg_replace($search, $replace, $title); + } +} ?> \ No newline at end of file