diff --git a/e107.htaccess b/e107.htaccess index 3c5d70424..32ec1ff6a 100644 --- a/e107.htaccess +++ b/e107.htaccess @@ -14,6 +14,9 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l +### TAGWORDS ### + RewriteRule ^tagwords/?(.*)$ e107_plugins/tagwords/tagwords.php?q=$1 [L] + ### NEWS SEF URLs - set 'news' to the 'URL identifier' value (news Administration area) ### RewriteRule ^news/?$ news.php [L] RewriteRule ^news/(.*)$ news.php?rewrite=$1 [L] diff --git a/e107_admin/eurl.php b/e107_admin/eurl.php index 32ad2f5bf..cac209893 100644 --- a/e107_admin/eurl.php +++ b/e107_admin/eurl.php @@ -9,9 +9,9 @@ * URL Management * * $Source: /cvs_backup/e107_0.8/e107_admin/eurl.php,v $ - * $Revision: 1.9 $ - * $Date: 2009-08-28 16:11:00 $ - * $Author: marj_nl_fr $ + * $Revision: 1.10 $ + * $Date: 2009-09-25 20:20:23 $ + * $Author: secretr $ */ require_once('../class2.php'); @@ -21,24 +21,19 @@ if (!getperms('L')) exit; } -include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); +e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); $e_sub_cat = 'eurl'; require_once(e_ADMIN.'auth.php'); -require_once(e_HANDLER."form_handler.php"); -require_once(e_HANDLER."form_handler.php"); -require_once(e_HANDLER."message_handler.php"); -$frm = new e_form(); //new form handler -$emessage = &eMessage::getInstance(); -$urlc = new admin_url_config(); +$urlc = new admin_eurl_config(); if (isset($_POST['update'])) { - //$res = $urlc->update(); - admin_update($urlc->update(), 'update', false, false, false); - //$plug_message = $res ? LAN_UPDATED : ($res === 0 ? LAN_NO_CHANGE : LAN_UPDATED_FAILED); - //$plug_message = "
".$plug_message."

"; + if($urlc->update()) + { + e107::getAdminLog()->logArrayDiffs(e107::getConfig('core')->getPref('url_config'), e107::getConfig('core_backup')->getPref('url_config'), 'EURL_01'); + } } //var_dump($pref['url_config'], $e107->url->getUrl('pm', 'main', array('f'=>'box', 'box'=>2))); @@ -46,28 +41,39 @@ if (isset($_POST['update'])) $urlc->renderPage(); require_once(e_ADMIN.'footer.php'); -class admin_url_config { +class admin_eurl_config { - var $_frm; - var $_plug; - var $_api; + /** + * @var e_form + */ + protected $_frm; + + /** + * @var e107plugin + */ + protected $_plug; + + /** + * @var e_file + */ + protected $_fl; + + /** + * @var e107 + */ + protected $_api; - function admin_url_config() + function __construct() { - global $e107; - require_once(e_HANDLER.'plugin_class.php'); - require_once(e_HANDLER.'file_class.php'); - require_once(e_HANDLER."form_handler.php"); - - $this->_frm = new e_form(); - $this->_plug = new e107plugin(); - $this->_fl = new e_file(); - $this->_api = &$e107; + $this->_api = e107::getInstance(); + $this->_frm = e107::getObject('e_form'); + $this->_plug = e107::getObject('e107Plugin'); + $this->_fl = e107::getFile(); } function renderPage() { - global $emessage; + $emessage = e107::getMessageHandler(); $empty = " ".LAN_EURL_EMPTY." @@ -119,7 +125,7 @@ class admin_url_config { "; - $this->_api->ns->tablerender(PAGE_NAME, $emessage->render().$text); + e107::getRender()->tablerender(PAGE_NAME, $emessage->render().$text); } function render_sections($id) @@ -165,7 +171,7 @@ class admin_url_config { { global $pref; //DEFAULT - $checked_def = varset($pref['url_config'][$section['path']]) ? '' : ' checked="checked"'; + $checked_def = e107::findPref('url_config/'.$section['path']) ? '' : ' checked="checked"'; $def = "
@@ -261,12 +267,12 @@ class admin_url_config { function render_shutdown($save) { - global $pref, $emessage; + global $pref; if($save && !isset($_POST['update'])) { if(save_prefs()) { - $emessage->add(LAN_EURL_AUTOSAVE); + e107::getMessageHandler()->add(LAN_EURL_AUTOSAVE); } } @@ -296,9 +302,9 @@ class admin_url_config { function update() { - global $pref; - $pref['url_config'] = $_POST['cprofile']; - return save_prefs(); + $core = e107::getConfig(); + $core->setPosted('url_config', $_POST['cprofile']); + return $core->save(); } } diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index bf409aab1..3eebbc1a9 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -9,8 +9,8 @@ * News Administration * * $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ - * $Revision: 1.54 $ - * $Date: 2009-09-19 15:27:25 $ + * $Revision: 1.55 $ + * $Date: 2009-09-25 20:20:23 $ * $Author: secretr $ */ require_once("../class2.php"); @@ -351,9 +351,14 @@ class admin_newspost function clear_cache() { $ecache = e107::getCache(); - $ecache->clear("news.php"); - $ecache->clear("othernews"); - $ecache->clear("othernews2"); + $ecache->clear("news.php"); //TODO change it to 'news_*' everywhere + + $ecache->clear("news_", false, true); //NEW global news cache prefix + //$ecache->clear("nq_news_"); - supported by cache::clear() now + //$ecache->clear("nomd5_news_"); supported by cache::clear() now + + $ecache->clear("othernews"); //TODO change it to 'news_othernews' everywhere + $ecache->clear("othernews2"); //TODO change it to 'news_othernews2' everywhere return $this; } @@ -502,7 +507,7 @@ class admin_newspost $this->clear_cache(); $data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete'); - $this->show_message($e107->e_event->triggerHook($data), E_MESSAGE_WARNING); + $this->show_message(e107::getEvent()->triggerHook($data), E_MESSAGE_WARNING); admin_purge_related("news", $del_id); } @@ -1655,7 +1660,7 @@ class admin_newspost } //triggerHook $data = array('method'=>'form', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'create_item'); - $hooks = $e107->e_event->triggerHook($data); + $hooks = e107::getEvent()->triggerHook($data); if(!empty($hooks)) { $text .= " diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php index d1bd96b24..4a531261d 100644 --- a/e107_admin/sql/core_sql.php +++ b/e107_admin/sql/core_sql.php @@ -9,9 +9,9 @@ * Core SQL * * $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ - * $Revision: 1.27 $ - * $Date: 2009-09-17 14:25:09 $ - * $Author: e107coders $ + * $Revision: 1.28 $ + * $Date: 2009-09-25 20:20:23 $ + * $Author: secretr $ */ header("location:../index.php"); @@ -224,7 +224,7 @@ CREATE TABLE news ( KEY news_datestamp (news_datestamp), KEY news_sticky (news_sticky), KEY news_render_type (news_render_type), - FULLTEXT KEY news_class (news_class) + KEY news_class (news_class) ) TYPE=MyISAM; diff --git a/e107_files/shortcode/news_categories.sc b/e107_files/shortcode/news_categories.sc index 7a7541ca2..0ccec1827 100644 --- a/e107_files/shortcode/news_categories.sc +++ b/e107_files/shortcode/news_categories.sc @@ -1,10 +1,19 @@ /* * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) - * $Id: news_categories.sc,v 1.5 2009-09-15 15:08:50 secretr Exp $ + * $Id: news_categories.sc,v 1.6 2009-09-25 20:20:23 secretr Exp $ * * News Categories shortcode */ global $e107, $sql,$pref,$tp,$NEWSCAT,$NEWSCAT_ITEM; + +$cString = 'nq_news_categories_sc'; +$cached = e107::getCache()->retrieve($cString); + +if(false !== $cached) +{ + return $cached; +} + require_once(e_HANDLER."news_class.php"); $ix = new news; @@ -72,7 +81,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols; $sql2 = new db; $qry = "SELECT nc.*, ncr.news_rewrite_string AS news_category_rewrite_string, ncr.news_rewrite_id AS news_category_rewrite_id FROM #news_category AS nc LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2 - ORDER BY nc.category_order + ORDER BY nc.category_order ASC "; if(!$sql2->db_Select_gen($qry)) { @@ -145,4 +154,5 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols; $text3 .= "
"; +e107::getCache()->set($cString, $text3); return $text3; \ No newline at end of file diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 6fd138789..5914ffee2 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -9,8 +9,8 @@ * e107 Base Model * * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ - * $Revision: 1.8 $ - * $Date: 2009-09-08 12:13:00 $ + * $Revision: 1.9 $ + * $Date: 2009-09-25 20:20:23 $ * $Author: secretr $ */ @@ -121,7 +121,7 @@ class e_model */ public function setFieldIdName($name) { - $this->_idFieldName = $name; + $this->_field_id = $name; return $this; } @@ -135,7 +135,7 @@ class e_model */ public function getFieldIdName() { - return $this->_idFieldName; + return $this->_field_id; } /** @@ -168,11 +168,11 @@ class e_model */ public function getId() { - if ($this->getIdFieldName()) + if ($this->getFieldIdName()) { - return $this->getData($this->getIdFieldName(), 0, null); + return $this->get($this->getFieldIdName(), 0); } - return $this->getData('id', 0, null); + return $this->get('id', 0); } /** @@ -439,6 +439,15 @@ class e_model { return $this->_hasData('', '_posted_data'); } + + /** + * @param string $key + * @return boolean + */ + public function is($key) + { + return (isset($this->_data[$key])); + } /** * @param string $key @@ -448,6 +457,15 @@ class e_model { return $this->_isData($key); } + + /** + * @param string $key + * @return boolean + */ + public function isPosted($key) + { + return (isset($this->_posted_data[$key])); + } /** * @param string $key diff --git a/e107_languages/English/admin/lan_log_messages.php b/e107_languages/English/admin/lan_log_messages.php index c29c39406..49242958b 100644 --- a/e107_languages/English/admin/lan_log_messages.php +++ b/e107_languages/English/admin/lan_log_messages.php @@ -1,6 +1,6 @@ create('core:news', 'main', 'action=day&value='.formatDate($req_year, $xmonth, $xday)); } } } @@ -123,7 +123,7 @@ for($i = 1; $i <= 12; $i++) // href the current month regardless of newsposts or any month with news if (($req_year == $cur_year && $i == $cur_month) || $day_links[$i]) { - $archive .= "".$marray[$i-1].""; + $archive .= "".$marray[$i-1].""; } else { diff --git a/e107_plugins/blogcalendar_menu/blogcalendar_menu.php b/e107_plugins/blogcalendar_menu/blogcalendar_menu.php index 1493f9c2a..885503ac9 100644 --- a/e107_plugins/blogcalendar_menu/blogcalendar_menu.php +++ b/e107_plugins/blogcalendar_menu/blogcalendar_menu.php @@ -3,7 +3,7 @@ + ----------------------------------------------------------------------------+ | e107 website system | -| ©Steve Dunstan 2001-2002 +| Steve Dunstan 2001-2002 | http://e107.org | jalist@e107.org | @@ -11,135 +11,145 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/blogcalendar_menu.php,v $ -| $Revision: 1.3 $ -| $Date: 2009-09-23 16:21:09 $ +| $Revision: 1.4 $ +| $Date: 2009-09-25 20:20:22 $ | $Author: secretr $ +----------------------------------------------------------------------------+ | Based on code by: Thomas Bouve (crahan@gmx.net) */ if (!defined('e107_INIT')) { exit; } -require_once(e_PLUGIN."blogcalendar_menu/calendar.php"); -require_once(e_PLUGIN."blogcalendar_menu/functions.php"); - -// ------------------------------ -// initialization + fetch options -// ------------------------------ -$prefix = e_PLUGIN."blogcalendar_menu"; -$marray = array(BLOGCAL_M1, BLOGCAL_M2, BLOGCAL_M3, BLOGCAL_M4, - BLOGCAL_M5, BLOGCAL_M6, BLOGCAL_M7, BLOGCAL_M8, - BLOGCAL_M9, BLOGCAL_M10, BLOGCAL_M11, BLOGCAL_M12); -$pref['blogcal_ws'] = "monday"; - -// ---------------------------------------------- -// get the requested and current date information -// ---------------------------------------------- -list($cur_year, $cur_month, $cur_day) = explode(" ", date("Y n j")); -if (e_PAGE == 'news.php' && strstr(e_QUERY, "day")) -{ - //$tmp = explode(".", e_QUERY); - $tmp = e107::getUrl()->parseRequest('core:news', 'main', urldecode(e_QUERY)); - $item = $tmp[1]; - $req_year = intval(substr($item, 0, 4)); - $req_month = intval(substr($item, 4, 2)); - // decide on the behaviour here, do we highlight - // the day being viewed? or only 'today'? - //$req_day = substr($item, 6, 2); - // if the requested year and month are the current, then add - // the current day to the mix so the calendar highlights it - if (($req_year == $cur_year) && ($req_month == $cur_month)) - { - $req_day = $cur_day; - } - else - { - $req_day = ""; - } -} -elseif(e_PAGE == 'news.php' && strstr(e_QUERY, "month")) -{ - //$tmp = explode(".", e_QUERY); - $tmp = e107::getUrl()->parseRequest('core:news', 'main', urldecode(e_QUERY)); - $item = $tmp[1]; - $req_year = intval(substr($item, 0, 4)); - $req_month = intval(substr($item, 4, 2)); - // if the requested year and month are the current, then add - // the current day to the mix so the calendar highlights it - if (($req_year == $cur_year) && ($req_month == $cur_month)) - { - $req_day = $cur_day; - } - else - { - $req_day = ""; - } -} -else -{ - $req_year = $cur_year; - $req_month = $cur_month; - $req_day = $cur_day; -} - -// ------------------------------- -// create the month selection item -// ------------------------------- -$month_selector = "
"; -$month_selector .= ""; + + // get all newsposts since the beginning of the year till now + // ------------------------------------------- + // get links to all newsitems in current month + // ------------------------------------------- + $month_start = mktime(0, 0, 0, $req_month, 1, $req_year); + $lastday = date("t", $month_start); + $month_end = mktime(23, 59, 59, $req_month, $lastday, $req_year); + $start = mktime(0, 0, 0, 1, 1, $req_year); + $end = time(); + $sql->db_Select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)); + while ($news = $sql->db_Fetch()) + { + $xmonth = date("n", $news['news_datestamp']); + if (!isset($month_links[$xmonth]) || !$month_links[$xmonth]) + { + $month_links[$xmonth] = e107::getUrl()->create('core:news', 'main', 'action=month&value='.formatDate($req_year, $xmonth));//e_BASE."news.php?month.".formatDate($req_year, $xmonth); + } + if($news['news_datestamp'] >= $month_start AND $news['news_datestamp'] <= $month_end) + { + $xday = date("j", $news['news_datestamp']); + if (!isset($day_links[$xday]) || !$day_links[$xday]) + { + $day_links[$xday] = e107::getUrl()->create('core:news', 'main', 'action=day&value='.formatDate($req_year, $xmonth, $xday));//e_BASE."news.php?day.".formatDate($req_year, $req_month, $xday); + } + } + } + + // if we're listing the current year, add the current month to the list regardless of posts + if ($req_year == $cur_year) + { + $month_links[$cur_month] = e107::getUrl()->create('core:news', 'main', 'action=month&value='.formatDate($cur_year, $cur_month));//e_BASE."news.php?month.".formatDate($cur_year, $cur_month); + } + + // go over the link array and create the option fields + foreach($month_links as $index => $val) + { + $month_selector .= "
"; + + + // ------------------------ + // create and show calendar + // ------------------------ + $menu = "
"; + $menu .= ""; + $menu .= "
$month_selector"; + $menu .= "
".calendar($req_day, $req_month, $req_year, $day_links, $pref['blogcal_ws'])."
"; + $menu .= "
"; + $cached = $ns->tablerender(BLOGCAL_L1." ".$req_year, $menu, 'blog_calendar', true); + + $cached = e107::getCache()->set($cString, $menu_text); } -// if we're listing the current year, add the current month to the list regardless of posts -if ($req_year == $cur_year) -{ - $month_links[$cur_month] = e107::getUrl()->create('core:news', 'main', 'action=month&value='.formatDate($cur_year, $cur_month));//e_BASE."news.php?month.".formatDate($cur_year, $cur_month); -} - -// go over the link array and create the option fields -foreach($month_links as $index => $val) -{ - $month_selector .= "