mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 18:30:53 +02:00
- Important URL assembling feature, all routes have now safe fallback option
- News configs updates and refactoring, introducing new config, various bugfixes - News DB changes: news_sef and category_sef fields, titles no more used in URL assembling - Aliases now not able to match existing URL module - New URL setting - choose type of SEF string when auto-extracted from titles (implemented in News and Custom pages, leave SEF string empty to see it in action) - Overall system stability bugfixes
This commit is contained in:
@@ -559,7 +559,7 @@ class page
|
|||||||
e107::getRedirect()->redirect(e_ADMIN_ABS.'cpage.php');
|
e107::getRedirect()->redirect(e_ADMIN_ABS.'cpage.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$type && $sql->db_Count('page', 'page_id', ($mode ? "page_id<>{$mode} AND " : '')."page_sef!={$page_sef}"))
|
if(!$type && $sql->db_Count('page', '(page_id)', ($mode ? "page_id<>{$mode} AND " : '')."page_sef!={$page_sef}"))
|
||||||
{
|
{
|
||||||
e107::getMessage()->addError(CUSLAN_34, 'default', true);
|
e107::getMessage()->addError(CUSLAN_34, 'default', true);
|
||||||
e107::getRedirect()->redirect(e_ADMIN_ABS.'cpage.php');
|
e107::getRedirect()->redirect(e_ADMIN_ABS.'cpage.php');
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
@@ -57,6 +57,7 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
'url_disable_pathinfo' => array('title'=>LAN_EURL_SETTINGS_PATHINFO, 'type'=>'boolean', 'help'=>LAN_EURL_MODREWR_DESCR),
|
'url_disable_pathinfo' => array('title'=>LAN_EURL_SETTINGS_PATHINFO, 'type'=>'boolean', 'help'=>LAN_EURL_MODREWR_DESCR),
|
||||||
'url_main_module' => array('title'=>LAN_EURL_SETTINGS_MAINMODULE, 'type'=>'dropdown', 'data' => 'string', 'help'=>LAN_EURL_SETTINGS_MAINMODULE_HELP),
|
'url_main_module' => array('title'=>LAN_EURL_SETTINGS_MAINMODULE, 'type'=>'dropdown', 'data' => 'string', 'help'=>LAN_EURL_SETTINGS_MAINMODULE_HELP),
|
||||||
'url_error_redirect' => array('title'=>LAN_EURL_SETTINGS_REDIRECT, 'type'=>'boolean', 'help'=>LAN_EURL_SETTINGS_REDIRECT_HELP),
|
'url_error_redirect' => array('title'=>LAN_EURL_SETTINGS_REDIRECT, 'type'=>'boolean', 'help'=>LAN_EURL_SETTINGS_REDIRECT_HELP),
|
||||||
|
'url_sef_translate' => array('title'=>LAN_EURL_SETTINGS_SEFTRANSLATE, 'type'=>'dropdown', 'data' => 'string', 'help'=>LAN_EURL_SETTINGS_SEFTRANSLATE_HELP),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
@@ -82,6 +83,7 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
|
|
||||||
public function SettingsObserver()
|
public function SettingsObserver()
|
||||||
{
|
{
|
||||||
|
// main module pref dropdown
|
||||||
$this->prefs['url_main_module']['writeParms'][''] = 'None';
|
$this->prefs['url_main_module']['writeParms'][''] = 'None';
|
||||||
$modules = e107::getPref('url_config', array());
|
$modules = e107::getPref('url_config', array());
|
||||||
ksort($modules);
|
ksort($modules);
|
||||||
@@ -99,6 +101,14 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
$this->prefs['url_main_module']['writeParms'][$module] = vartrue($section['name'], eHelper::labelize($module));
|
$this->prefs['url_main_module']['writeParms'][$module] = vartrue($section['name'], eHelper::labelize($module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// title2sef transform type pref
|
||||||
|
$types = explode('|', 'none|dashl|dashc|dash|underscorel|underscorec|underscore|plusl|plusc|plus');
|
||||||
|
$this->prefs['url_sef_translate']['writeParms'] = array();
|
||||||
|
foreach ($types as $type)
|
||||||
|
{
|
||||||
|
$this->prefs['url_sef_translate']['writeParms'][$type] = deftrue('LAN_EURL_SETTINGS_SEFTRTYPE_'.strtoupper($type), ucfirst($type));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['etrigger_save']))
|
if(isset($_POST['etrigger_save']))
|
||||||
{
|
{
|
||||||
$this->getConfig()
|
$this->getConfig()
|
||||||
@@ -121,7 +131,10 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
if(isset($_POST['update']))
|
if(isset($_POST['update']))
|
||||||
{
|
{
|
||||||
$posted = is_array($_POST['eurl_aliases']) ? e107::getParser()->post_toForm($_POST['eurl_aliases']) : '';
|
$posted = is_array($_POST['eurl_aliases']) ? e107::getParser()->post_toForm($_POST['eurl_aliases']) : '';
|
||||||
|
$locations = array_keys(e107::getPref('url_locations', array()));
|
||||||
$aliases = array();
|
$aliases = array();
|
||||||
|
$message = e107::getMessage();
|
||||||
|
|
||||||
foreach ($posted as $lan => $als)
|
foreach ($posted as $lan => $als)
|
||||||
{
|
{
|
||||||
foreach ($als as $module => $alias)
|
foreach ($als as $module => $alias)
|
||||||
@@ -130,8 +143,12 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
$module = trim($module);
|
$module = trim($module);
|
||||||
if($module !== $alias)
|
if($module !== $alias)
|
||||||
{
|
{
|
||||||
// TODO - basic validation
|
$cindex = array_search($module, $locations);
|
||||||
$aliases[$lan][$alias] = $module;
|
$sarray = $locations;
|
||||||
|
unset($sarray[$cindex]);
|
||||||
|
|
||||||
|
if(!in_array(strtolower($alias), $sarray)) $aliases[$lan][$alias] = $module;
|
||||||
|
else $message->addError(sprintf(LAN_EURL_ERR_ALIAS_MODULE, $alias, $module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,8 +215,7 @@ class eurl_admin_ui extends e_admin_controller_ui
|
|||||||
{
|
{
|
||||||
$this->addTitle(LAN_EURL_NAME_CONFIG);
|
$this->addTitle(LAN_EURL_NAME_CONFIG);
|
||||||
$active = e107::getPref('url_config');
|
$active = e107::getPref('url_config');
|
||||||
//echo(e107::getUrl()->create('system/error/notfound', '', 'full=1'));
|
|
||||||
//eRouter::adminReadConfigs(e_CORE.'url/news', 'core');
|
|
||||||
$set = array();
|
$set = array();
|
||||||
// all available URL modules
|
// all available URL modules
|
||||||
$set['url_modules'] = eRouter::adminReadModules();
|
$set['url_modules'] = eRouter::adminReadModules();
|
||||||
|
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* News Administration
|
* News Administration
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
* $URL $
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('../class2.php');
|
require_once('../class2.php');
|
||||||
@@ -36,9 +34,13 @@ $newspost = new admin_newspost(e_QUERY, $pst);
|
|||||||
e107::setRegistry('_newspost_admin', $newspost);
|
e107::setRegistry('_newspost_admin', $newspost);
|
||||||
$gen = new convert();
|
$gen = new convert();
|
||||||
|
|
||||||
|
|
||||||
//Handle Ajax Calls
|
//Handle Ajax Calls
|
||||||
if($newspost->ajax_observer()) exit;
|
if($newspost->ajax_observer()) exit;
|
||||||
|
|
||||||
|
e107::getJs()->requireCoreLib('core/admin.js');
|
||||||
|
|
||||||
|
|
||||||
function headerjs()
|
function headerjs()
|
||||||
{
|
{
|
||||||
$newspost = e107::getRegistry('_newspost_admin');
|
$newspost = e107::getRegistry('_newspost_admin');
|
||||||
@@ -113,7 +115,6 @@ function headerjs()
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
";
|
";
|
||||||
e107::getJs()->requireCoreLib('core/admin.js');
|
|
||||||
|
|
||||||
if($newspost->getAction() == 'cat')
|
if($newspost->getAction() == 'cat')
|
||||||
{
|
{
|
||||||
@@ -228,7 +229,7 @@ require_once("footer.php");
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
// FIXME - advanced filter, ready to be chunked, cleaned up and pluginized some day...
|
// FIXME - news2plugin! Full rewrite.
|
||||||
|
|
||||||
|
|
||||||
class admin_newspost
|
class admin_newspost
|
||||||
@@ -266,7 +267,7 @@ class admin_newspost
|
|||||||
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
|
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
|
||||||
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
||||||
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||||
'news_rewrite_string' => array('title' => 'SEF URL', 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
'news_sef' => array('title' => 'SEF URL', 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||||
'user_name' => array('title' => LAN_NEWS_50, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
'user_name' => array('title' => LAN_NEWS_50, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||||
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
|
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
|
||||||
'category_name' => array('title' => NWSLAN_6, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
'category_name' => array('title' => NWSLAN_6, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||||
@@ -378,17 +379,12 @@ class admin_newspost
|
|||||||
|
|
||||||
function clear_rwcache($sefstr = '')
|
function clear_rwcache($sefstr = '')
|
||||||
{
|
{
|
||||||
/*if($sefstr) $sefstr = md5($sefstr);
|
// obsolete
|
||||||
ecache::clear_sys("news_sefurl".$sefstr);*/
|
|
||||||
// news::clearRewriteCache($sefstr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_rwcache($sefstr, $data)
|
function set_rwcache($sefstr, $data)
|
||||||
{
|
{
|
||||||
/**$sefstr = md5($sefstr);
|
// obsolete
|
||||||
if(is_array($data)) $data = e107::getArrayStorage()->WriteArray($data, false);
|
|
||||||
ecache::set_sys("news_sefurl".$sefstr, $data, true);*/
|
|
||||||
// news::setRewriteCache($sefstr, $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajax_observer()
|
function ajax_observer()
|
||||||
@@ -516,7 +512,7 @@ class admin_newspost
|
|||||||
|
|
||||||
function _observe_delete()
|
function _observe_delete()
|
||||||
{
|
{
|
||||||
global $admin_log;
|
$admin_log = e107::getAdminLog();
|
||||||
//FIXME - SEF URL cache
|
//FIXME - SEF URL cache
|
||||||
$tmp = array_keys($_POST['delete']);
|
$tmp = array_keys($_POST['delete']);
|
||||||
list($delete, $del_id) = explode("_", $tmp[0]);
|
list($delete, $del_id) = explode("_", $tmp[0]);
|
||||||
@@ -529,7 +525,7 @@ class admin_newspost
|
|||||||
switch ($delete) {
|
switch ($delete) {
|
||||||
case 'main':
|
case 'main':
|
||||||
|
|
||||||
if ($e107->sql->db_Count('news','(*)',"WHERE news_id={$del_id}"))
|
if ($e107->sql->db_Count('news','(*)',"news_id={$del_id}"))
|
||||||
{
|
{
|
||||||
e107::getEvent()->trigger("newsdel", $del_id);
|
e107::getEvent()->trigger("newsdel", $del_id);
|
||||||
if($e107->sql->db_Delete("news", "news_id={$del_id}"))
|
if($e107->sql->db_Delete("news", "news_id={$del_id}"))
|
||||||
@@ -550,8 +546,13 @@ class admin_newspost
|
|||||||
|
|
||||||
if(!getperms('0|7')) $this->noPermissions();
|
if(!getperms('0|7')) $this->noPermissions();
|
||||||
|
|
||||||
|
if (($count = $e107->sql->db_Count('news','(news_id)',"news_category={$del_id}")) === false || $count > 0)
|
||||||
|
{
|
||||||
|
$this->show_message('Category is in used in <strong>'.$count.'</strong> news items and cannot be deleted.', E_MESSAGE_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($e107->sql->db_Count('news_category','(*)',"WHERE category_id={$del_id}"))
|
if ($e107->sql->db_Count('news_category','(*)',"category_id={$del_id}"))
|
||||||
{
|
{
|
||||||
e107::getEvent()->trigger("newscatdel", $del_id);
|
e107::getEvent()->trigger("newscatdel", $del_id);
|
||||||
if ($e107->sql->db_Delete("news_category", "category_id={$del_id}"))
|
if ($e107->sql->db_Delete("news_category", "category_id={$del_id}"))
|
||||||
@@ -647,14 +648,13 @@ class admin_newspost
|
|||||||
$tmp = explode(chr(35), $_POST['news_author']);
|
$tmp = explode(chr(35), $_POST['news_author']);
|
||||||
$_POST['news_author'] = $tmp[0];
|
$_POST['news_author'] = $tmp[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$ret = $ix->submit_item($_POST, !vartrue($_POST['create_edit_stay']));
|
$ret = $ix->submit_item($_POST, !vartrue($_POST['create_edit_stay']));
|
||||||
if($ret['error'])
|
if($ret['error'])
|
||||||
{
|
{
|
||||||
eMessage::getInstance()->mergeWithSession(); //merge with session messages
|
e107::getMessage()->mergeWithSession() //merge with session messages
|
||||||
eMessage::getInstance()->add(($id ? LAN_UPDATED_FAILED : LAN_CREATED_FAILED), E_MESSAGE_ERROR);
|
->add(($id ? LAN_UPDATED_FAILED : LAN_CREATED_FAILED), E_MESSAGE_ERROR);
|
||||||
|
|
||||||
|
$_POST['news_sef'] = $ret['data']['news_sef'];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->clear_cache();
|
$this->clear_cache();
|
||||||
@@ -689,34 +689,39 @@ class admin_newspost
|
|||||||
{
|
{
|
||||||
$this->show_message('Validation Error: Missing Category name', E_MESSAGE_ERROR);
|
$this->show_message('Validation Error: Missing Category name', E_MESSAGE_ERROR);
|
||||||
$this->error = true;
|
$this->error = true;
|
||||||
|
if(!empty($_POST['category_sef']))
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// first format sef...
|
||||||
|
if(empty($_POST['category_sef']))
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::title2sef($_POST['category_name']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!empty($_POST['news_rewrite_string']) && preg_match('#[^\w\pL\-]#u', $_POST['news_rewrite_string']))
|
// ...then check it
|
||||||
|
if(empty($_POST['category_sef']))
|
||||||
{
|
{
|
||||||
// $this->show_message('Validation Error: Bad value for Category friendly URL', E_MESSAGE_ERROR);
|
$this->error = true;
|
||||||
// $this->error = true;
|
$this->show_message('Validation error: News Category SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR);
|
||||||
|
}
|
||||||
|
elseif(e107::getDb()->db_Count('news_category', '(category_id)', "category_sef='".e107::getParser()->toDB($_POST['category_sef'])."'"))
|
||||||
|
{
|
||||||
|
$this->error = true;
|
||||||
|
$this->show_message('Validation error: News Category SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->error)
|
if (!$this->error)
|
||||||
{
|
{
|
||||||
$inserta = array();
|
$inserta = array();
|
||||||
/* Why? Categoty Icon is not required field
|
|
||||||
if (empty($_POST['category_icon']))
|
|
||||||
{
|
|
||||||
$handle = opendir(e_IMAGE."icons");
|
|
||||||
while ($file = readdir($handle))
|
|
||||||
{
|
|
||||||
if ($file != "." && $file != ".." && $file != "/" && $file != "null.txt" && $file != "CVS") {
|
|
||||||
$iconlist[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
$inserta['category_icon'] = $iconlist[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$inserta['category_icon'] = e107::getParser()->toDB($_POST['category_icon']);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$inserta['data']['category_icon'] = $_POST['category_icon'];
|
$inserta['data']['category_icon'] = $_POST['category_icon'];
|
||||||
$inserta['_FIELD_TYPES']['category_icon'] = 'todb';
|
$inserta['_FIELD_TYPES']['category_icon'] = 'todb';
|
||||||
@@ -724,11 +729,14 @@ class admin_newspost
|
|||||||
$inserta['data']['category_name'] = $_POST['category_name'];
|
$inserta['data']['category_name'] = $_POST['category_name'];
|
||||||
$inserta['_FIELD_TYPES']['category_name'] = 'todb';
|
$inserta['_FIELD_TYPES']['category_name'] = 'todb';
|
||||||
|
|
||||||
$inserta['data']['category_meta_description'] = strip_tags($_POST['category_meta_description']);
|
$inserta['data']['category_sef'] = $_POST['category_sef'];
|
||||||
$inserta['_FIELD_TYPES']['category_meta_description'] = 'str';
|
$inserta['_FIELD_TYPES']['category_sef'] = 'todb';
|
||||||
|
|
||||||
$inserta['data']['category_meta_keywords'] = $_POST['category_meta_keywords'];
|
$inserta['data']['category_meta_description'] = eHelper::formatMetaDescription($_POST['category_meta_description']);
|
||||||
$inserta['_FIELD_TYPES']['category_meta_keywords'] = 'str';
|
$inserta['_FIELD_TYPES']['category_meta_description'] = 'todb';
|
||||||
|
|
||||||
|
$inserta['data']['category_meta_keywords'] = eHelper::formatMetaKeys($_POST['category_meta_keywords']);
|
||||||
|
$inserta['_FIELD_TYPES']['category_meta_keywords'] = 'todb';
|
||||||
|
|
||||||
$inserta['data']['category_manager'] = $_POST['category_manager'];
|
$inserta['data']['category_manager'] = $_POST['category_manager'];
|
||||||
$inserta['_FIELD_TYPES']['category_manager'] = 'int';
|
$inserta['_FIELD_TYPES']['category_manager'] = 'int';
|
||||||
@@ -736,17 +744,14 @@ class admin_newspost
|
|||||||
$inserta['data']['category_order'] = $_POST['category_order'];
|
$inserta['data']['category_order'] = $_POST['category_order'];
|
||||||
$inserta['_FIELD_TYPES']['category_order'] = 'int';
|
$inserta['_FIELD_TYPES']['category_order'] = 'int';
|
||||||
|
|
||||||
//e107::getDb()->db_Insert('news_category', "'0', '{$_POST['category_name']}', '{$_POST['category_icon']}'");
|
|
||||||
$id = e107::getDb()->db_Insert('news_category', $inserta);
|
$id = e107::getDb()->db_Insert('news_category', $inserta);
|
||||||
if($id)
|
if($id)
|
||||||
{
|
{
|
||||||
$inserta['data']['category_id'] = $id;
|
$inserta['data']['category_id'] = $id;
|
||||||
|
|
||||||
|
|
||||||
//admin log now supports DB array and method chaining
|
//admin log now supports DB array and method chaining
|
||||||
e107::getAdminLog()->log_event('NEWS_04', $inserta, E_LOG_INFORMATIVE, '');
|
e107::getAdminLog()->log_event('NEWS_04', $inserta, E_LOG_INFORMATIVE, '');
|
||||||
|
|
||||||
|
|
||||||
$this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS);
|
$this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS);
|
||||||
$this->clear_cache();
|
$this->clear_cache();
|
||||||
|
|
||||||
@@ -785,8 +790,35 @@ class admin_newspost
|
|||||||
{
|
{
|
||||||
$this->show_message('Validation Error: Missing Category name', E_MESSAGE_ERROR);
|
$this->show_message('Validation Error: Missing Category name', E_MESSAGE_ERROR);
|
||||||
$this->error = true;
|
$this->error = true;
|
||||||
|
if(!empty($_POST['category_sef']))
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// first format sef...
|
||||||
|
if(empty($_POST['category_sef']))
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::title2sef($_POST['category_name']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ...then check it
|
||||||
|
if(empty($_POST['category_sef']))
|
||||||
|
{
|
||||||
|
$this->error = true;
|
||||||
|
$this->show_message('Validation error: News Category SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR);
|
||||||
|
}
|
||||||
|
elseif(e107::getDb()->db_Count('news_category', '(category_id)', "category_id<>".$this->getId()." AND category_sef='".(e107::getParser()->toDB($_POST['category_sef'])."'")))
|
||||||
|
{
|
||||||
|
$this->error = true;
|
||||||
|
$this->show_message('Validation error: News Category SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->error)
|
if (!$this->error)
|
||||||
{
|
{
|
||||||
@@ -797,6 +829,9 @@ class admin_newspost
|
|||||||
$updatea['data']['category_name'] = $_POST['category_name'];
|
$updatea['data']['category_name'] = $_POST['category_name'];
|
||||||
$updatea['_FIELD_TYPES']['category_name'] = 'todb';
|
$updatea['_FIELD_TYPES']['category_name'] = 'todb';
|
||||||
|
|
||||||
|
$updatea['data']['category_sef'] = $_POST['category_sef'];
|
||||||
|
$updatea['_FIELD_TYPES']['category_sef'] = 'todb';
|
||||||
|
|
||||||
$updatea['data']['category_meta_description'] = strip_tags($_POST['category_meta_description']);
|
$updatea['data']['category_meta_description'] = strip_tags($_POST['category_meta_description']);
|
||||||
$updatea['_FIELD_TYPES']['category_meta_description'] = 'str';
|
$updatea['_FIELD_TYPES']['category_meta_description'] = 'str';
|
||||||
|
|
||||||
@@ -814,7 +849,6 @@ class admin_newspost
|
|||||||
$inserta = array();
|
$inserta = array();
|
||||||
$rid = 0;
|
$rid = 0;
|
||||||
|
|
||||||
|
|
||||||
$upcheck = e107::getDb()->db_Update("news_category", $updatea);
|
$upcheck = e107::getDb()->db_Update("news_category", $updatea);
|
||||||
$rwupcheck = false;
|
$rwupcheck = false;
|
||||||
if($upcheck || !e107::getDb()->getLastErrorNumber())
|
if($upcheck || !e107::getDb()->getLastErrorNumber())
|
||||||
@@ -937,15 +971,14 @@ class admin_newspost
|
|||||||
|
|
||||||
function show_existing_items()
|
function show_existing_items()
|
||||||
{
|
{
|
||||||
global $user_pref,$gen;
|
$user_pref = e107::getUser()->getPref();
|
||||||
|
|
||||||
if(!getperms('H'))
|
if(!getperms('H'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once(e_HANDLER."form_handler.php");
|
//require_once(e_HANDLER."form_handler.php");
|
||||||
$frm = new e_form(true); //enable inner tabindex counter
|
$frm = e107::getForm(true); //enable inner tabindex counter
|
||||||
|
|
||||||
// Effectively toggle setting for headings
|
// Effectively toggle setting for headings
|
||||||
|
|
||||||
@@ -1212,6 +1245,7 @@ class admin_newspost
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_POST['news_title'] = $row['news_title'];
|
$_POST['news_title'] = $row['news_title'];
|
||||||
|
$_POST['news_sef'] = $row['news_sef'];
|
||||||
$_POST['news_body'] = $row['news_body'];
|
$_POST['news_body'] = $row['news_body'];
|
||||||
$_POST['news_author'] = $row['news_author'];
|
$_POST['news_author'] = $row['news_author'];
|
||||||
$_POST['news_extended'] = $row['news_extended'];
|
$_POST['news_extended'] = $row['news_extended'];
|
||||||
@@ -1236,8 +1270,7 @@ class admin_newspost
|
|||||||
|
|
||||||
function show_create_item()
|
function show_create_item()
|
||||||
{
|
{
|
||||||
global $pref;
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$this->_pre_create();
|
$this->_pre_create();
|
||||||
|
|
||||||
require_once(e_HANDLER."userclass_class.php");
|
require_once(e_HANDLER."userclass_class.php");
|
||||||
@@ -1440,85 +1473,6 @@ class admin_newspost
|
|||||||
<td>";
|
<td>";
|
||||||
|
|
||||||
$text .= $frm->mediaUrl('news', NWSLAN_69);
|
$text .= $frm->mediaUrl('news', NWSLAN_69);
|
||||||
/* //FIXME - below is a quick fix for media-manager upload. Requires popup window without header/footer.
|
|
||||||
$text .= "<a rel='external' class='e-dialog' href='".e_ADMIN_ABS."image.php?mode=main&action=create&for=news'>".NWSLAN_69."</a>";
|
|
||||||
// FIXME - make it system wide available
|
|
||||||
e107::getJs()->requireCoreLib('core/admin.js')
|
|
||||||
->requireCoreLib('core/dialog.js')
|
|
||||||
->requireCoreLib('core/draggable.js')
|
|
||||||
->coreCSS('core/dialog/dialog.css')
|
|
||||||
->coreCSS('core/dialog/e107/e107.css')
|
|
||||||
->footerInline('
|
|
||||||
$$("a.e-dialog").invoke("observe", "click", function(ev) {
|
|
||||||
var element = ev.findElement("a");
|
|
||||||
ev.stop();
|
|
||||||
new e107Widgets.URLDialog(element.href + "&iframe=1", {
|
|
||||||
id: element["id"] || "e-dialog",
|
|
||||||
width: 800,
|
|
||||||
height: 600,
|
|
||||||
title: "Media Manager"
|
|
||||||
}).center().activate().show();
|
|
||||||
});
|
|
||||||
');*/
|
|
||||||
// e_NEWSIMAGE is deprecated.
|
|
||||||
|
|
||||||
// DEPRECATED METHOD below.
|
|
||||||
/*$text .= "<a href='#news-upload-cont' class='e-expandit'>".NWSLAN_69."</a>
|
|
||||||
<div class='e-hideme' id='news-upload-cont'>
|
|
||||||
";
|
|
||||||
|
|
||||||
if (!FILE_UPLOADS)
|
|
||||||
{
|
|
||||||
$text .= "<b>".LAN_UPLOAD_SERVEROFF."</b>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!is_writable(e_DOWNLOAD))
|
|
||||||
{
|
|
||||||
$text .= LAN_UPLOAD_777."<b>".str_replace("../","",e_DOWNLOAD)."</b><br /><br />";
|
|
||||||
}
|
|
||||||
if (!is_writable(e_NEWSIMAGE))
|
|
||||||
{
|
|
||||||
$text .= LAN_UPLOAD_777."<b>".str_replace("../","",e_NEWSIMAGE)."</b><br /><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
$up_name = array(LAN_NEWS_24, NWSLAN_67, LAN_NEWS_22, NWSLAN_68);
|
|
||||||
$up_value = array("resize", "image", "thumb", "file");
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<div class='field-spacer'>
|
|
||||||
".$frm->admin_button('dupfield', LAN_NEWS_26, 'action', '', array('other' => 'onclick="duplicateHTML(\'upline\',\'up_container\');"'))."
|
|
||||||
</div>
|
|
||||||
<div id='up_container' class='field-spacer'>
|
|
||||||
<div id='upline' class='left nowrap'>
|
|
||||||
".$frm->file('file_userfile[]')."
|
|
||||||
".$frm->select_open('uploadtype[]')."
|
|
||||||
";
|
|
||||||
|
|
||||||
for ($i=0; $i<count($up_value); $i++)
|
|
||||||
{
|
|
||||||
$text .= $frm->option($up_name[$i], $up_value[$i], varset($_POST['uploadtype']) == $up_value[$i]);
|
|
||||||
}
|
|
||||||
//FIXME - upload shortcode, flexible enough to be used everywhere
|
|
||||||
// Note from Cameron: should include iframe and use ajax as to not require a full refresh of the page.
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='field-spacer'>
|
|
||||||
<span class='smalltext'>".LAN_NEWS_25."</span> ".$frm->text('resize_value', ($_POST['resize_value'] ? $_POST['resize_value'] : '100'), 4, 'size=3&class=tbox')." px
|
|
||||||
</div>
|
|
||||||
<div class='field-spacer'>
|
|
||||||
".$frm->admin_button('submitupload', NWSLAN_66, 'upload')."
|
|
||||||
</div>
|
|
||||||
";
|
|
||||||
|
|
||||||
}
|
|
||||||
$text .= "
|
|
||||||
</div>";
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</td>
|
</td>
|
||||||
@@ -1528,29 +1482,8 @@ class admin_newspost
|
|||||||
<td>
|
<td>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
$parms = "name=news_thumbnail";
|
|
||||||
$parms .= "&path=".e_NEWSIMAGE;
|
|
||||||
$parms .= "&filter=0";
|
|
||||||
$parms .= "&fullpath=1";
|
|
||||||
$parms .= "&default=".urlencode(basename($_POST['news_thumbnail']));
|
|
||||||
$parms .= "&multiple=FALSE";
|
|
||||||
$parms .= "&label=-- ".LAN_NEWS_48." --";
|
|
||||||
$parms .= "&subdirs=0";
|
|
||||||
$parms .= "&tabindex=".$frm->getNext();
|
|
||||||
*/
|
|
||||||
|
|
||||||
//$parms .= "&click_target=data";
|
|
||||||
//$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
|
|
||||||
//$parms .= "&click_postfix=[/img]";
|
|
||||||
|
|
||||||
|
|
||||||
$text .= $frm->imagepicker('news_thumbnail', $_POST['news_thumbnail'],'','news');
|
$text .= $frm->imagepicker('news_thumbnail', $_POST['news_thumbnail'],'','news');
|
||||||
|
|
||||||
// $text .= "<div class='field-section'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
|
|
||||||
// $text .= "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
|
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<div class='field-help'>".LAN_NEWS_23."</div>
|
<div class='field-help'>".LAN_NEWS_23."</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -1569,23 +1502,16 @@ class admin_newspost
|
|||||||
<col class='col-label' />
|
<col class='col-label' />
|
||||||
<col class='col-control' />
|
<col class='col-control' />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>";
|
<tbody>
|
||||||
|
|
||||||
// news_rewrite table Deprecated. e_url.php standard to be established.
|
|
||||||
/*
|
|
||||||
$text .= "
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>Friendly URL string: </td>
|
<td class='label'>Friendly URL string: </td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->text('news_rewrite_string', $tp->post_toForm($_POST['news_rewrite_string']), 255)."
|
".$frm->text('news_sef', $tp->post_toForm($_POST['news_sef']), 255)."
|
||||||
".$frm->hidden('news_rewrite_id', intval($_POST['news_rewrite_id']))."
|
<div class='field-help'>If left empty will be automatically created from current News Title based on your current <a href='".e_ADMIN_ABS."eurl.php?mode=main&action=settings' title='To URL settings area' rel='external'>URL settings</a></div>
|
||||||
<div class='field-help'>To make this work, you need to enable 'SEF URLs' config profile from <a href='".e_ADMIN_ABS."eurl.php'>URL Configuration area</a></div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>Meta keywords: </td>
|
<td class='label'>Meta keywords: </td>
|
||||||
<td class='control'>".$frm->text('news_meta_keywords', $tp->post_toForm($_POST['news_meta_keywords']), 255)."</td>
|
<td class='control'>".$frm->text('news_meta_keywords', $tp->post_toForm($_POST['news_meta_keywords']), 255)."</td>
|
||||||
@@ -1881,8 +1807,8 @@ class admin_newspost
|
|||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
require_once (e_HANDLER.'js_helper.php');
|
//require_once (e_HANDLER.'js_helper.php');
|
||||||
$e107 = &e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
|
||||||
$category = array();
|
$category = array();
|
||||||
if ($e107->sql->db_Select("news_category", "*", "category_id=".$this->getId()))
|
if ($e107->sql->db_Select("news_category", "*", "category_id=".$this->getId()))
|
||||||
@@ -1896,22 +1822,8 @@ class admin_newspost
|
|||||||
}
|
}
|
||||||
$jshelper = new e_jshelper();
|
$jshelper = new e_jshelper();
|
||||||
|
|
||||||
|
|
||||||
$jshelper->addResponseAction('fill-form', $category);
|
$jshelper->addResponseAction('fill-form', $category);
|
||||||
|
|
||||||
//reset if required
|
|
||||||
$category_rewrite = array(
|
|
||||||
'news_rewrite_id' => 0,
|
|
||||||
'news_rewrite_source' => 0,
|
|
||||||
'news_rewrite_string' => '',
|
|
||||||
'news_rewrite_type' => 0
|
|
||||||
);
|
|
||||||
// if ($e107->sql->db_Select('news_rewrite', '*', 'news_rewrite_source='.$this->getId().' AND news_rewrite_type=2'))
|
|
||||||
{
|
|
||||||
// $category_rewrite = $e107->sql->db_Fetch();
|
|
||||||
}
|
|
||||||
$jshelper->addResponseAction('fill-form', $category_rewrite);
|
|
||||||
|
|
||||||
//show cancel and update, hide create buttons; disable create button (just in case)
|
//show cancel and update, hide create buttons; disable create button (just in case)
|
||||||
$jshelper->addResponseAction('element-invoke-by-id', array(
|
$jshelper->addResponseAction('element-invoke-by-id', array(
|
||||||
'show' => 'category-clear,update-category',
|
'show' => 'category-clear,update-category',
|
||||||
@@ -2024,19 +1936,14 @@ class admin_newspost
|
|||||||
".$frm->text('category_name', $category['category_name'], 200)."
|
".$frm->text('category_name', $category['category_name'], 200)."
|
||||||
<div class='field-help'>Required field</div>
|
<div class='field-help'>Required field</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>
|
||||||
|
<tr>
|
||||||
// Disabled until e_url is complete.
|
<td class='label'>Category friendly URL string</td>
|
||||||
// $text .= "
|
<td class='control'>
|
||||||
// <tr>
|
".$frm->text('category_sef', $category['category_sef'], 200)."
|
||||||
// <td class='label'>Category friendly URL string</td>
|
<div class='field-help'>If left empty will be automatically created from current Category Title based on your current <a href='".e_ADMIN_ABS."eurl.php?mode=main&action=settings' title='To URL settings area' rel='external'>URL settings</a></div>
|
||||||
// <td class='control'>
|
</td>
|
||||||
// ".$frm->text('category_sefurl', $category['category_sefurl'], 255)."
|
</tr>
|
||||||
// <div class='field-help'></div>
|
|
||||||
// </td>
|
|
||||||
// </tr>";
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>Category meta keywords</td>
|
<td class='label'>Category meta keywords</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
@@ -2126,7 +2033,7 @@ class admin_newspost
|
|||||||
<tr>
|
<tr>
|
||||||
<th class='center'>".LAN_NEWS_45."</th>
|
<th class='center'>".LAN_NEWS_45."</th>
|
||||||
<th class='center'>".NWSLAN_122."</th>
|
<th class='center'>".NWSLAN_122."</th>
|
||||||
<th>".NWSLAN_6." / SEF String</th>
|
<th>".NWSLAN_6."</th>
|
||||||
<th>Manage Permissions</th>
|
<th>Manage Permissions</th>
|
||||||
<th class='center last'>".LAN_OPTIONS."</th>
|
<th class='center last'>".LAN_OPTIONS."</th>
|
||||||
<th class='center'>Order</th>
|
<th class='center'>Order</th>
|
||||||
@@ -2146,16 +2053,15 @@ class admin_newspost
|
|||||||
$icon = "<img class='icon action' src='{$icon}' alt='' />";
|
$icon = "<img class='icon action' src='{$icon}' alt='' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
//$sefstr = $category['news_rewrite_string'] ? "<br />SEF: <strong>{$category['news_rewrite_string']}</strong>" : '';
|
$url = '<a href="'.e107::getUrl()->create('news/list/category', $category).'" title="'.$category['category_name'].'" rel="external">'.$category['category_name'].'</a>';
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='center middle'>{$category['category_id']}</td>
|
<td class='center middle'>{$category['category_id']}</td>
|
||||||
<td class='center middle'>{$icon}</td>
|
<td class='center middle'>{$icon}</td>
|
||||||
<td class='middle'>{$category['category_name']}{$sefstr}</td>
|
<td class='middle'>{$url}</td>
|
||||||
<td class='middle'>".$frm->uc_select('multi_category_manager['.$category['category_id'].']', vartrue($category['category_manager'], e_UC_ADMIN), 'main,admin,classes')."</td>
|
<td class='middle'>".$frm->uc_select('multi_category_manager['.$category['category_id'].']', vartrue($category['category_manager'], e_UC_ADMIN), 'main,admin,classes')."</td>
|
||||||
<td class='center middle'>
|
<td class='center middle'>
|
||||||
<a class='action' id='core-news-catedit-{$category['category_id']}' href='".e_SELF."?cat.edit.{$category['category_id']}' tabindex='".$frm->getNext()."'>".ADMIN_EDIT_ICON."</a>
|
<a class='action' id='core-news-catedit-{$category['category_id']}' href='".e_SELF."?cat.edit.{$category['category_id']}' tabindex='".$frm->getNext()."'>".defset('ADMIN_EDIT_ICON', '<img src="'.e_IMAGE_ABS.'admin_images/edit_16.png" alt="Edit" />')."</a>
|
||||||
".$frm->submit_image("delete[category_{$category['category_id']}]", $category['category_id'], 'delete', e107::getParser()->toJS(NWSLAN_37." [ID: {$category['category_id']} ]"))."
|
".$frm->submit_image("delete[category_{$category['category_id']}]", $category['category_id'], 'delete', e107::getParser()->toJS(NWSLAN_37." [ID: {$category['category_id']} ]"))."
|
||||||
</td>
|
</td>
|
||||||
<td class='middle center'>".$frm->text('multi_category_order['.$category['category_id'].']', $category['category_order'], 3, 'size=2&tabindex='.$tindex)."</td>
|
<td class='middle center'>".$frm->text('multi_category_order['.$category['category_id'].']', $category['category_order'], 3, 'size=2&tabindex='.$tindex)."</td>
|
||||||
|
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Core SQL
|
* Core SQL
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
header("location:../index.php");
|
header("location:../index.php");
|
||||||
@@ -294,6 +292,7 @@ CREATE TABLE menus (
|
|||||||
CREATE TABLE news (
|
CREATE TABLE news (
|
||||||
news_id int(10) unsigned NOT NULL auto_increment,
|
news_id int(10) unsigned NOT NULL auto_increment,
|
||||||
news_title varchar(200) NOT NULL default '',
|
news_title varchar(200) NOT NULL default '',
|
||||||
|
news_sef varchar(200) NOT NULL default '',
|
||||||
news_body text NOT NULL,
|
news_body text NOT NULL,
|
||||||
news_extended text NOT NULL,
|
news_extended text NOT NULL,
|
||||||
news_meta_keywords varchar(255) NOT NULL default '',
|
news_meta_keywords varchar(255) NOT NULL default '',
|
||||||
@@ -329,6 +328,7 @@ CREATE TABLE news (
|
|||||||
CREATE TABLE news_category (
|
CREATE TABLE news_category (
|
||||||
category_id tinyint(3) unsigned NOT NULL auto_increment,
|
category_id tinyint(3) unsigned NOT NULL auto_increment,
|
||||||
category_name varchar(200) NOT NULL default '',
|
category_name varchar(200) NOT NULL default '',
|
||||||
|
category_sef varchar(200) NOT NULL default '',
|
||||||
category_meta_description text NOT NULL,
|
category_meta_description text NOT NULL,
|
||||||
category_meta_keywords varchar(255) NOT NULL default '',
|
category_meta_keywords varchar(255) NOT NULL default '',
|
||||||
category_manager tinyint(3) unsigned NOT NULL default '254',
|
category_manager tinyint(3) unsigned NOT NULL default '254',
|
||||||
|
125
e107_core/url/news/sef_full_url.php
Normal file
125
e107_core/url/news/sef_full_url.php
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Full SEF URLs support and the most risky one, almost the same as sef_noid, just working with rules only
|
||||||
|
*/
|
||||||
|
class core_news_sef_full_url extends eUrlConfig
|
||||||
|
{
|
||||||
|
public function config()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'config' => array(
|
||||||
|
'allowMain' => true,
|
||||||
|
'legacy' => '{e_BASE}news.php',
|
||||||
|
'format' => 'path',
|
||||||
|
'defaultRoute' => 'list/items',
|
||||||
|
'urlSuffix' => '.e107', // just for fun!
|
||||||
|
'allowVars' => false,
|
||||||
|
'matchValue' => 'empty',
|
||||||
|
|
||||||
|
'mapVars' => array(
|
||||||
|
'news_id' => 'id',
|
||||||
|
'news_sef' => 'name',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
'rules' => array(
|
||||||
|
'/' => array('list/items', 'allowVars' => array('page'), 'legacyQuery' => 'default.0.{page}', ),
|
||||||
|
'Category' => array('list/items', 'allowVars' => array('page'), 'legacyQuery' => 'default.0.{page}', ),
|
||||||
|
'Category/<name:{sefsecure}>' => array('list/category', 'allowVars' => array('page'), 'mapVars' => array('category_sef' => 'name'), 'legacyQuery' => 'list.{name}.{page}', 'parseCallback' => 'categoryIdByTitle'),
|
||||||
|
|
||||||
|
'Short/<name:{sefsecure}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_sef' => 'name'), 'legacyQuery' => 'cat.{name}.{page}', 'parseCallback' => 'categoryIdByTitle'),
|
||||||
|
'Short/<id:{number}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id'), 'legacyQuery' => 'cat.{id}.{page}'),
|
||||||
|
'Day/<id:{number}>' => array('list/day', 'allowVars' => array('page'), 'legacyQuery' => 'day.{id}.{page}'),
|
||||||
|
'Month/<id:{number}>' => array('list/month', 'allowVars' => array('page'), 'legacyQuery' => 'month.{id}.{page}'),
|
||||||
|
|
||||||
|
'<category:{sefsecure}>/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('category_sef' => 'category', 'news_sef' => 'name'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
|
'<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_id' => 'id', 'news_sef' => 'name'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
|
'<id:{number}>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Admin callback
|
||||||
|
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
|
||||||
|
*/
|
||||||
|
public function admin()
|
||||||
|
{
|
||||||
|
// static may be used for performance
|
||||||
|
static $admin = array(
|
||||||
|
|
||||||
|
'labels' => array(
|
||||||
|
'name' => LAN_EURL_CORE_NEWS, // Module name
|
||||||
|
'label' => LAN_EURL_NEWS_REWRITEF_LABEL, // Current profile name
|
||||||
|
'description' => LAN_EURL_NEWS_REWRITEF_DESCR, //
|
||||||
|
),
|
||||||
|
|
||||||
|
'form' => array(), // Under construction - additional configuration options
|
||||||
|
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
|
||||||
|
);
|
||||||
|
|
||||||
|
return $admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
### CUSTOM METHODS ###
|
||||||
|
|
||||||
|
/**
|
||||||
|
* view/item by name callback
|
||||||
|
* @param eRequest $request
|
||||||
|
*/
|
||||||
|
public function itemIdByTitle(eRequest $request)
|
||||||
|
{
|
||||||
|
$name = $request->getRequestParam('name');
|
||||||
|
if(($id = $request->getRequestParam('id')))
|
||||||
|
{
|
||||||
|
$request->setRequestParam('name', $id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif(!$name) return;
|
||||||
|
elseif(is_numeric($name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = e107::getDb('url');
|
||||||
|
$name = e107::getParser()->toDB($name);
|
||||||
|
if($sql->db_Select('news', 'news_id', "news_sef='{$name}'")) // TODO - it'll be news_sef (new) field
|
||||||
|
{
|
||||||
|
$name = $sql->db_Fetch();
|
||||||
|
$request->setRequestParam('name', $name['news_id']);
|
||||||
|
}
|
||||||
|
else $request->setRequestParam('name', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list/items by name callback
|
||||||
|
* @param eRequest $request
|
||||||
|
*/
|
||||||
|
public function categoryIdByTitle(eRequest $request)
|
||||||
|
{
|
||||||
|
$name = $request->getRequestParam('name');
|
||||||
|
if(($id = $request->getRequestParam('id')))
|
||||||
|
{
|
||||||
|
$request->setRequestParam('name', $id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elseif(!$name) return;
|
||||||
|
elseif(is_numeric($name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = e107::getDb('url');
|
||||||
|
$id = e107::getParser()->toDB($name);
|
||||||
|
if($sql->db_Select('news_category', 'category_id', "category_sef='{$name}'")) // TODO - it'll be category_sef (new) field
|
||||||
|
{
|
||||||
|
$name = $sql->db_Fetch();
|
||||||
|
$request->setRequestParam('name', $name['category_id']);
|
||||||
|
}
|
||||||
|
else $request->setRequestParam('name', 0);
|
||||||
|
}
|
||||||
|
}
|
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Mod rewrite & SEF URLs support, example of manually (rules-less) created/parsed urls
|
* SEF URLs support, example of manually (rules-less) created/parsed urls
|
||||||
*/
|
*/
|
||||||
class core_news_rewrite_url extends eUrlConfig
|
class core_news_sef_noid_url extends eUrlConfig
|
||||||
{
|
{
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
{
|
{
|
||||||
## news are passing array as it is retrieved from the DB, map vars to proper values
|
## news are passing array as it is retrieved from the DB, map vars to proper values
|
||||||
if(isset($params['news_id']) && !empty($params['news_id'])) $params['id'] = $params['news_id'];
|
if(isset($params['news_id']) && !empty($params['news_id'])) $params['id'] = $params['news_id'];
|
||||||
if(isset($params['news_title']) && !empty($params['news_title'])) $params['id'] = $params['news_title']; // TODO - news_sef
|
if(isset($params['news_sef']) && !empty($params['news_sef'])) $params['id'] = $params['news_sef']; // TODO - news_sef
|
||||||
|
|
||||||
switch ($route[1])
|
switch ($route[1])
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
{
|
{
|
||||||
## news are passing array as it is retrieved from the DB, map vars to proper values
|
## news are passing array as it is retrieved from the DB, map vars to proper values
|
||||||
if(isset($params['category_id']) && !empty($params['category_id'])) $params['id'] = $params['category_id'];
|
if(isset($params['category_id']) && !empty($params['category_id'])) $params['id'] = $params['category_id'];
|
||||||
if(isset($params['category_name']) && !empty($params['category_name'])) $params['name'] = $params['category_name']; // TODO - news_sef
|
if(isset($params['category_sef']) && !empty($params['category_sef'])) $params['name'] = $params['category_sef']; // TODO - news_sef
|
||||||
|
|
||||||
switch ($route[1])
|
switch ($route[1])
|
||||||
{
|
{
|
||||||
@@ -162,8 +162,8 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $pathInfo, 2);
|
$parts = explode('/', $pathInfo, 2);
|
||||||
|
$parts[0] = strtolower($parts[0]);
|
||||||
switch (strtolower($parts[0]))
|
switch ($parts[0])
|
||||||
{
|
{
|
||||||
# map to list.xxx.xxx
|
# map to list.xxx.xxx
|
||||||
case 'short':
|
case 'short':
|
||||||
@@ -247,13 +247,13 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
|
|
||||||
### CUSTOM METHODS ###
|
### CUSTOM METHODS ###
|
||||||
|
|
||||||
//retrieve news_id by Title (XXX - news_sef column, equals to news_title if not set explicit)
|
//retrieve news_id by news_sef (
|
||||||
public function itemIdByTitle($id)
|
public function itemIdByTitle($id)
|
||||||
{
|
{
|
||||||
$sql = e107::getDb('url');
|
$sql = e107::getDb('url');
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$id = $tp->toDB($id);
|
$id = $tp->toDB($id);
|
||||||
if($sql->db_Select('news', 'news_id', "news_title='{$id}'")) // TODO - it'll be news_url (new) field
|
if($sql->db_Select('news', 'news_id', "news_sef='{$id}'"))
|
||||||
{
|
{
|
||||||
$id = $sql->db_Fetch();
|
$id = $sql->db_Fetch();
|
||||||
return $id['news_id'];
|
return $id['news_id'];
|
||||||
@@ -261,13 +261,13 @@ class core_news_rewrite_url extends eUrlConfig
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//retrieve category_id by Title (XXX - category_sef column, equals to category_name if not set explicit)
|
//retrieve category_id by Title (XXX - category_sef column, equals to category_sef if not set explicit)
|
||||||
public function categoryIdByTitle($id)
|
public function categoryIdByTitle($id)
|
||||||
{
|
{
|
||||||
$sql = e107::getDb('url');
|
$sql = e107::getDb('url');
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$id = $tp->toDB($id);
|
$id = $tp->toDB($id);
|
||||||
if($sql->db_Select('news_category', 'category_id', "category_name='{$id}'")) // TODO - it'll be category_url (new) field
|
if($sql->db_Select('news_category', 'category_id', "category_sef='{$id}'"))
|
||||||
{
|
{
|
||||||
$id = $sql->db_Fetch();
|
$id = $sql->db_Fetch();
|
||||||
return $id['category_id'];
|
return $id['category_id'];
|
@@ -4,12 +4,12 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Mod rewrite & SEF URLs support, managed entirely by the core router (rules)
|
* Most balanced config - performance and friendly URLs
|
||||||
* It contains a lot of examples (mostly complex), use them to play around and learn things :/
|
* It contains a lot of examples (mostly complex), use them to play around and learn things :/
|
||||||
* Generally, things are much more simpler...
|
* Generally, things are much more simpler...
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class core_news_rewrite_extended_url extends eUrlConfig
|
class core_news_sef_url extends eUrlConfig
|
||||||
{
|
{
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
@@ -24,9 +24,12 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
### default vars mapping (create URL), override per rule is allowed
|
### default vars mapping (create URL), override per rule is allowed
|
||||||
'mapVars' => array(
|
'mapVars' => array(
|
||||||
'news_id' => 'id',
|
'news_id' => 'id',
|
||||||
'news_title' => 'name',
|
'news_sef' => 'name',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
### match will only check if parameter is empty to invalidate the assembling vs current rule
|
||||||
|
'matchValue' => 'empty',
|
||||||
|
|
||||||
### Numerical array containing allowed vars by default (create URL, used for legacyQuery parsing in parse routine as well),
|
### Numerical array containing allowed vars by default (create URL, used for legacyQuery parsing in parse routine as well),
|
||||||
### false means - disallow all vars beside those required by the rules
|
### false means - disallow all vars beside those required by the rules
|
||||||
### Override per rule is allowed
|
### Override per rule is allowed
|
||||||
@@ -62,23 +65,23 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
|
|
||||||
## URL with ID and Title - no DB call, balanced performance, name optional
|
## URL with ID and Title - no DB call, balanced performance, name optional
|
||||||
## Demonstrating the usage of custom user defined regex template defined above - 'testIt'
|
## Demonstrating the usage of custom user defined regex template defined above - 'testIt'
|
||||||
'Category/<id:{testIt}>/<name:{sefsecure}>' => array('list/category', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_name' => 'name'), 'legacyQuery' => 'list.{id}.{page}'),
|
'Category/<id:{testIt}>/<name:{sefsecure}>' => array('list/category', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_sef' => 'name'), 'legacyQuery' => 'list.{id}.{page}'),
|
||||||
|
|
||||||
## URL with Title only - prettiest and slowest! Example with direct regex - no templates
|
## URL with Title only - prettiest and slowest! Example with direct regex - no templates
|
||||||
//'Category/<name:{sefsecure}>' => array('list/category', 'allowVars' => array('page'), 'mapVars' => array('category_name' => 'name'), 'legacyQuery' => 'list.{name}.{page}', 'parseCallback' => 'categoryIdByTitle'),
|
//'Category/<name:{sefsecure}>' => array('list/category', 'allowVars' => array('page'), 'mapVars' => array('category_sef' => 'name'), 'legacyQuery' => 'list.{name}.{page}', 'parseCallback' => 'categoryIdByTitle'),
|
||||||
|
|
||||||
## URL with ID only - best performance, fallback when no sef name provided
|
## URL with ID only - best performance, fallback when no sef name provided
|
||||||
'Category/<id:{number}>' => array('list/category', 'allowVars' => array('page'), 'legacyQuery' => 'list.{id}.{page}', 'mapVars' => array('category_id' => 'id')),
|
'Category/<id:{number}>' => array('list/category', 'allowVars' => array('page'), 'legacyQuery' => 'list.{id}.{page}', 'mapVars' => array('category_id' => 'id')),
|
||||||
|
|
||||||
### View item requested by id or string, if you remove the catch ALL example, uncomment at least on row from this block
|
### View item requested by id or string, if you remove the catch ALL example, uncomment at least on row from this block
|
||||||
### leading category name example - could be enabled together with the next example to handle creating of URLs without knowing the category title
|
### leading category name example - could be enabled together with the next example to handle creating of URLs without knowing the category title
|
||||||
// 'View/<category:[\w\pL.\-\s]+>/<name:[\w\pL.\-\s]+>' => array('view/item', 'mapVars' => array('news_title' => 'name', 'category_name' => 'category'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
// 'View/<category:[\w\pL.\-\s]+>/<name:[\w\pL.\-\s]+>' => array('view/item', 'mapVars' => array('news_sef' => 'name', 'category_sef' => 'category'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
// to be noted here - value 'name' is replaced by item id within the callback method; TODO replace news_title with news_sef field
|
// to be noted here - value 'name' is replaced by item id within the callback method; TODO replace news_sef with news_sef field
|
||||||
// 'View/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_title' => 'name', 'news_id' => 'id'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
// 'View/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_sef' => 'name', 'news_id' => 'id'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
// 'View/<id:{number}>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
// 'View/<id:{number}>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
||||||
|
|
||||||
## URL with ID and Title - no DB call, balanced performance!
|
## URL with ID and Title - no DB call, balanced performance!
|
||||||
'Short/<id:{number}>/<name:{sefsecure}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_name' => 'name'), 'legacyQuery' => 'cat.{id}.{page}'),
|
'Short/<id:{number}>/<name:{sefsecure}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id', 'category_sef' => 'name'), 'legacyQuery' => 'cat.{id}.{page}'),
|
||||||
## fallback when name is not provided
|
## fallback when name is not provided
|
||||||
'Short/<id:{number}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id'), 'legacyQuery' => 'cat.{id}.{page}'),
|
'Short/<id:{number}>' => array('list/short', 'allowVars' => array('page'), 'mapVars' => array('category_id' => 'id'), 'legacyQuery' => 'cat.{id}.{page}'),
|
||||||
|
|
||||||
@@ -90,10 +93,13 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
|
|
||||||
### View news item - kinda catch all - very bad performance when News is chosen as default namespace - two additional DB queries on every site call!
|
### View news item - kinda catch all - very bad performance when News is chosen as default namespace - two additional DB queries on every site call!
|
||||||
## Leading category name - uncomment to enable
|
## Leading category name - uncomment to enable
|
||||||
'<category:{sefsecure}>/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('category_name' => 'category', 'news_title' => 'name', 'news_id' => 'id'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
//'<category:{sefsecure}>/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('category_sef' => 'category', 'news_sef' => 'name', 'news_id' => 'id'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
|
'View/<id:{number}>/<category:{sefsecure}>/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('category_sef' => 'category', 'news_sef' => 'name', 'news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
||||||
// Base location as item view - fallback if category sef is missing
|
// Base location as item view - fallback if category sef is missing
|
||||||
'<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_id' => 'id', 'news_title' => 'name'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
//'<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_id' => 'id', 'news_sef' => 'name'), 'legacyQuery' => 'extend.{name}', 'parseCallback' => 'itemIdByTitle'),
|
||||||
// fallback if news sef is missing
|
// fallback if news sef is missing
|
||||||
|
'View/<id:{number}>/<name:{sefsecure}>' => array('view/item', 'mapVars' => array('news_id' => 'id', 'news_sef' => 'name'), 'legacyQuery' => 'extend.{id}'),
|
||||||
|
|
||||||
'View/<id:{number}>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
'View/<id:{number}>' => array('view/item', 'mapVars' => array('news_id' => 'id'), 'legacyQuery' => 'extend.{id}'),
|
||||||
|
|
||||||
)
|
)
|
||||||
@@ -140,7 +146,7 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
* view/item by name callback
|
* view/item by name callback
|
||||||
* @param eRequest $request
|
* @param eRequest $request
|
||||||
*/
|
*/
|
||||||
public function itemIdByTitle(eRequest $request)
|
/*public function itemIdByTitle(eRequest $request)
|
||||||
{
|
{
|
||||||
$name = $request->getRequestParam('name');
|
$name = $request->getRequestParam('name');
|
||||||
if(($id = $request->getRequestParam('id')))
|
if(($id = $request->getRequestParam('id')))
|
||||||
@@ -156,19 +162,19 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
|
|
||||||
$sql = e107::getDb('url');
|
$sql = e107::getDb('url');
|
||||||
$name = e107::getParser()->toDB($name);
|
$name = e107::getParser()->toDB($name);
|
||||||
if($sql->db_Select('news', 'news_id', "news_title='{$name}'")) // TODO - it'll be news_sef (new) field
|
if($sql->db_Select('news', 'news_id', "news_sef='{$name}'")) // TODO - it'll be news_sef (new) field
|
||||||
{
|
{
|
||||||
$name = $sql->db_Fetch();
|
$name = $sql->db_Fetch();
|
||||||
$request->setRequestParam('name', $name['news_id']);
|
$request->setRequestParam('name', $name['news_id']);
|
||||||
}
|
}
|
||||||
else $request->setRequestParam('name', 0);
|
else $request->setRequestParam('name', 0);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list/items by name callback
|
* list/items by name callback
|
||||||
* @param eRequest $request
|
* @param eRequest $request
|
||||||
*/
|
*/
|
||||||
public function categoryIdByTitle(eRequest $request)
|
/*public function categoryIdByTitle(eRequest $request)
|
||||||
{
|
{
|
||||||
$name = $request->getRequestParam('name');
|
$name = $request->getRequestParam('name');
|
||||||
if(($id = $request->getRequestParam('id')))
|
if(($id = $request->getRequestParam('id')))
|
||||||
@@ -184,11 +190,11 @@ class core_news_rewrite_extended_url extends eUrlConfig
|
|||||||
|
|
||||||
$sql = e107::getDb('url');
|
$sql = e107::getDb('url');
|
||||||
$id = e107::getParser()->toDB($name);
|
$id = e107::getParser()->toDB($name);
|
||||||
if($sql->db_Select('news_category', 'category_id', "category_name='{$name}'")) // TODO - it'll be category_sef (new) field
|
if($sql->db_Select('news_category', 'category_id', "category_sef='{$name}'")) // TODO - it'll be category_sef (new) field
|
||||||
{
|
{
|
||||||
$name = $sql->db_Fetch();
|
$name = $sql->db_Fetch();
|
||||||
$request->setRequestParam('name', $name['category_id']);
|
$request->setRequestParam('name', $name['category_id']);
|
||||||
}
|
}
|
||||||
else $request->setRequestParam('name', 0);
|
else $request->setRequestParam('name', 0);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
@@ -23,9 +23,12 @@ class core_news_url extends eUrlConfig
|
|||||||
'defaultRoute' => 'list/new',// [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
|
'defaultRoute' => 'list/new',// [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
|
||||||
'errorRoute' => '', // [optional] default empty; route (no leading module) used when module is found but no inner route is matched, leave empty to force error 404 page
|
'errorRoute' => '', // [optional] default empty; route (no leading module) used when module is found but no inner route is matched, leave empty to force error 404 page
|
||||||
'urlSuffix' => '', // [optional] default empty; string to append to the URL (e.g. .html), not used when format is 'get' or legacy non-empty
|
'urlSuffix' => '', // [optional] default empty; string to append to the URL (e.g. .html), not used when format is 'get' or legacy non-empty
|
||||||
),
|
|
||||||
|
|
||||||
'rules' => array(), // rule set array - can't be used with format 'get' and noSingleEntry true
|
### [optional] used only when assembling URLs via rules();
|
||||||
|
### if 'empty' - check if the required parameter is empty (results in assemble fail),
|
||||||
|
### if 1 or true - it uses the route pattern to match every parameter - EXTREMELY SLOW, be warned
|
||||||
|
'matchValue' => false,
|
||||||
|
|
||||||
|
|
||||||
### [optional] vars mapping (create URL routine), override per rule is allowed
|
### [optional] vars mapping (create URL routine), override per rule is allowed
|
||||||
### Keys of this array will be used as a map for finding values from the provided parameters array.
|
### Keys of this array will be used as a map for finding values from the provided parameters array.
|
||||||
@@ -55,6 +58,9 @@ class core_news_url extends eUrlConfig
|
|||||||
### varTemplates are merged with the core predefined templates. Full list with core regex templates and examples can be found
|
### varTemplates are merged with the core predefined templates. Full list with core regex templates and examples can be found
|
||||||
### in rewrite_extended news URL config
|
### in rewrite_extended news URL config
|
||||||
'varTemplates' => array(/*'testIt' => '[\d]+'*/),
|
'varTemplates' => array(/*'testIt' => '[\d]+'*/),
|
||||||
|
),
|
||||||
|
|
||||||
|
'rules' => array(), // rule set array - can't be used with format 'get' and noSingleEntry true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +95,8 @@ class core_news_url extends eUrlConfig
|
|||||||
|
|
||||||
## news are passing array as it is retrieved from the DB, map vars to proper values
|
## news are passing array as it is retrieved from the DB, map vars to proper values
|
||||||
if(isset($params['news_id']) && !empty($params['news_id'])) $params['id'] = $params['news_id'];
|
if(isset($params['news_id']) && !empty($params['news_id'])) $params['id'] = $params['news_id'];
|
||||||
if(isset($params['news_sef']) && !empty($params['news_sef'])) $params['id'] = $params['news_sef'];
|
//if(isset($params['news_sef']) && !empty($params['news_sef'])) $params['id'] = $params['news_sef'];
|
||||||
if(isset($params['category_name']) && !empty($params['category_name'])) $params['category'] = $params['category_name'];
|
//if(isset($params['category_sef']) && !empty($params['category_sef'])) $params['category'] = $params['category_sef'];
|
||||||
|
|
||||||
$url = 'news.php?';
|
$url = 'news.php?';
|
||||||
if('--FROM--' != vartrue($params['page'])) $page = varset($params['page']) ? intval($params['page']) : '0';
|
if('--FROM--' != vartrue($params['page'])) $page = varset($params['page']) ? intval($params['page']) : '0';
|
||||||
|
@@ -1401,14 +1401,6 @@ class eRouter
|
|||||||
$lanCode = e107::getLanguage()->convert(e_LANGUAGE);
|
$lanCode = e107::getLanguage()->convert(e_LANGUAGE);
|
||||||
|
|
||||||
$aliases = e107::findPref('url_aliases/'.$lanCode, array());
|
$aliases = e107::findPref('url_aliases/'.$lanCode, array());
|
||||||
// __REMOVE__ Temporary test data
|
|
||||||
/*
|
|
||||||
$aliases = array(
|
|
||||||
'Blog' => 'news',
|
|
||||||
'People' => 'user',
|
|
||||||
'Myplug' => 'test'
|
|
||||||
);*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->_aliases = $aliases;
|
$this->_aliases = $aliases;
|
||||||
|
|
||||||
@@ -1493,7 +1485,7 @@ class eRouter
|
|||||||
$rules = $this->getRuleSet($module);
|
$rules = $this->getRuleSet($module);
|
||||||
$config = $this->getConfig($module);
|
$config = $this->getConfig($module);
|
||||||
$this->_parsedRules[$module] = array();
|
$this->_parsedRules[$module] = array();
|
||||||
$map = array('urlSuffix' => 'urlSuffix', 'legacy' => 'legacy', 'legacyQuery' => 'legacyQuery', 'mapVars' => 'mapVars', 'allowVars' => 'allowVars');
|
$map = array('urlSuffix' => 'urlSuffix', 'legacy' => 'legacy', 'legacyQuery' => 'legacyQuery', 'mapVars' => 'mapVars', 'allowVars' => 'allowVars', 'matchValue' => 'matchValue');
|
||||||
foreach ($rules as $pattern => $set)
|
foreach ($rules as $pattern => $set)
|
||||||
{
|
{
|
||||||
foreach ($map as $key => $value)
|
foreach ($map as $key => $value)
|
||||||
@@ -2204,6 +2196,13 @@ class eUrlRule
|
|||||||
*/
|
*/
|
||||||
public $allowVars = array();
|
public $allowVars = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be values matched vs route patterns when assembling URLs
|
||||||
|
* Warning SLOW when true!!!
|
||||||
|
* @var mixed true or 1 for preg_match (extremely slower), or 'empty' for only empty check (better)
|
||||||
|
*/
|
||||||
|
public $matchValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method member of module config object, to be called after successful request parsing
|
* Method member of module config object, to be called after successful request parsing
|
||||||
* @var string
|
* @var string
|
||||||
@@ -2412,6 +2411,27 @@ class eUrlRule
|
|||||||
|
|
||||||
foreach ($this->params as $key => $value) if (!isset($params[$key])) return false;
|
foreach ($this->params as $key => $value) if (!isset($params[$key])) return false;
|
||||||
|
|
||||||
|
if($this->matchValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
if('empty' !== $this->matchValue)
|
||||||
|
{
|
||||||
|
foreach($this->params as $key=>$value)
|
||||||
|
{
|
||||||
|
if(!preg_match('/'.$value.'/'.$case,$params[$key]))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach($this->params as $key=>$value)
|
||||||
|
{
|
||||||
|
if(empty($params[$key]) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->params as $key => $value)
|
foreach ($this->params as $key => $value)
|
||||||
{
|
{
|
||||||
$tr["<$key>"] = $params[$key];
|
$tr["<$key>"] = $params[$key];
|
||||||
@@ -3817,7 +3837,7 @@ class eHelper
|
|||||||
|
|
||||||
if(null === $type)
|
if(null === $type)
|
||||||
{
|
{
|
||||||
$type = 'none'; // FIXME - site preference
|
$type = e107::getPref('url_sef_translate'); // FIXME - site preference
|
||||||
}
|
}
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
switch ($type)
|
switch ($type)
|
||||||
|
@@ -2,16 +2,12 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $URL$
|
* $URL$
|
||||||
* $Revision$
|
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +33,8 @@ class e_bbcode
|
|||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $pref;
|
$pref = e107::getPref();
|
||||||
|
|
||||||
$core_bb = array(
|
$core_bb = array(
|
||||||
'blockquote', 'img', 'i', 'u', 'center',
|
'blockquote', 'img', 'i', 'u', 'center',
|
||||||
'_br', 'color', 'size', 'code',
|
'_br', 'color', 'size', 'code',
|
||||||
|
@@ -138,6 +138,7 @@ class e_form
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME - Dialog JS no more working, investigate
|
||||||
public function mediaUrl($category = '', $label = '')
|
public function mediaUrl($category = '', $label = '')
|
||||||
{
|
{
|
||||||
if($category) $category = '&for='.$category;
|
if($category) $category = '&for='.$category;
|
||||||
@@ -700,22 +701,22 @@ class e_form
|
|||||||
{
|
{
|
||||||
case 'edit':
|
case 'edit':
|
||||||
$image = ADMIN_EDIT_ICON_PATH;
|
$image = ADMIN_EDIT_ICON_PATH;
|
||||||
$options['class'] = vartrue($options['class'] , 'action edit');
|
$options['class'] = $options['class'] == 'action' ? 'action edit' : $options['class'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$image = ADMIN_DELETE_ICON_PATH;
|
$image = ADMIN_DELETE_ICON_PATH;
|
||||||
$options['class'] = vartrue($options['class'] , 'action delete');
|
$options['class'] = $options['class'] == 'action' ? 'action delete' : $options['class'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'execute':
|
case 'execute':
|
||||||
$image = ADMIN_EXECUTE_ICON_PATH;
|
$image = ADMIN_EXECUTE_ICON_PATH;
|
||||||
$options['class'] = vartrue($options['class'] , 'action execute');
|
$options['class'] = $options['class'] == 'action' ? 'action execute' : $options['class'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'view':
|
case 'view':
|
||||||
$image = ADMIN_VIEW_ICON_PATH;
|
$image = ADMIN_VIEW_ICON_PATH;
|
||||||
$options['class'] = vartrue($options['class'] , 'action view');
|
$options['class'] = $options['class'] == 'action' ? 'action view' : $options['class'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$options['title'] = $title;//shorthand
|
$options['title'] = $title;//shorthand
|
||||||
|
@@ -2,25 +2,26 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Administration - Media Management Class
|
* Administration - Media Management Class
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
* $URL$
|
||||||
* $Revision: 11315 $
|
* $Id$
|
||||||
* $Date: 2010-02-10 10:18:01 -0800 (Wed, 10 Feb 2010) $
|
|
||||||
* $Author: secretr $
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subject of rewrite/rethinking after the pre-alpha
|
||||||
|
*/
|
||||||
class e_media
|
class e_media
|
||||||
{
|
{
|
||||||
var $imagelist = array();
|
public $imagelist = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import files from specified path into media database.
|
* Import files from specified path into media database.
|
||||||
@@ -273,7 +274,7 @@ class e_media
|
|||||||
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
|
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
|
||||||
|
|
||||||
$total = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE;
|
$total = ($sql->db_Select_gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE;
|
||||||
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='Close' style='text-decoration:none;color:white' href=\"javascript:expandit('{$formid}')\" >x</div>";
|
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='Close' style='text-decoration:none;color:white' href='#' onclick=\"expandit('{$formid}'); return false;\" >x</a></div>";
|
||||||
|
|
||||||
while ($row = $sql->db_Fetch())
|
while ($row = $sql->db_Fetch())
|
||||||
{
|
{
|
||||||
@@ -283,8 +284,8 @@ class e_media
|
|||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<div style='border:1px solid silver;margin:5px;width:50px;height:50px;overflow:hidden;float:left'>
|
<div style='border:1px solid silver;margin:5px;width:50px;height:50px;overflow:hidden;float:left'>
|
||||||
<a title=\"".$diz."\" href=\"javascript:addtext('".$insert."', true); expandit('{$formid}')\" >
|
<a title=\"".$diz."\" href='#' onclick=\"addtext('".$insert."', true); expandit('{$formid}'); return false;\" >
|
||||||
<img src='".e107::getParser()->thumbUrl($image, 'w=100', true)."' alt=\"".$diz."\" width='50px' />
|
<img src='".e107::getParser()->thumbUrl($image, 'w=100', true)."' alt=\"".$diz."\" style='width: 50px' />
|
||||||
</a>
|
</a>
|
||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
|
@@ -38,19 +38,48 @@ class news {
|
|||||||
//TODO - synch WIKI docs, add rewrite data to the event data
|
//TODO - synch WIKI docs, add rewrite data to the event data
|
||||||
function submit_item($news, $smessages = false)
|
function submit_item($news, $smessages = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $e107cache, $e_event, $pref, $admin_log;
|
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
$admin_log = e107::getAdminLog();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
$e_event = e107::getEvent();
|
||||||
|
$e107cache = e107::getCache();
|
||||||
$emessage = e107::getMessage();
|
$emessage = e107::getMessage();
|
||||||
|
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
if(empty($news['news_title']))
|
if(empty($news['news_title']))
|
||||||
{
|
{
|
||||||
$error = true;
|
$error = true;
|
||||||
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||||
|
if(!empty($news['news_sef']))
|
||||||
|
{
|
||||||
|
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// first format sef...
|
||||||
|
if(empty($news['news_sef']))
|
||||||
|
{
|
||||||
|
$news['news_sef'] = eHelper::title2sef($news['news_title']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ...then check it
|
||||||
|
if(empty($news['news_sef']))
|
||||||
|
{
|
||||||
|
$error = true;
|
||||||
|
$emessage->add('Validation error: News SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||||
|
}
|
||||||
|
elseif($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>'.intval($news['news_id']).' AND ' : '')."news_sef='".$tp->toDB($news['news_sef'])."'"))
|
||||||
|
{
|
||||||
|
$error = true;
|
||||||
|
$emessage->add('Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR, $smessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($news['news_category']))
|
if(empty($news['news_category']))
|
||||||
@@ -65,6 +94,9 @@ class news {
|
|||||||
$data['data']['news_title'] = $news['news_title'];
|
$data['data']['news_title'] = $news['news_title'];
|
||||||
$data['_FIELD_TYPES']['news_title'] = 'todb';
|
$data['_FIELD_TYPES']['news_title'] = 'todb';
|
||||||
|
|
||||||
|
$data['data']['news_sef'] = $news['news_sef'];
|
||||||
|
$data['_FIELD_TYPES']['news_sef'] = 'todb';
|
||||||
|
|
||||||
$data['data']['news_body'] = $news['news_body'];
|
$data['data']['news_body'] = $news['news_body'];
|
||||||
$data['_FIELD_TYPES']['news_body'] = 'todb';
|
$data['_FIELD_TYPES']['news_body'] = 'todb';
|
||||||
|
|
||||||
@@ -107,20 +139,12 @@ class news {
|
|||||||
$data['data']['news_sticky'] = $news['news_sticky'];
|
$data['data']['news_sticky'] = $news['news_sticky'];
|
||||||
$data['_FIELD_TYPES']['news_sticky'] = 'int';
|
$data['_FIELD_TYPES']['news_sticky'] = 'int';
|
||||||
|
|
||||||
$data['data']['news_meta_keywords'] = $news['news_meta_keywords'];
|
$data['data']['news_meta_keywords'] = eHelper::formatMetaKeys($news['news_meta_keywords']);
|
||||||
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
|
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
|
||||||
|
|
||||||
$data['data']['news_meta_description'] = strip_tags($tp->toHTML($news['news_meta_description'], true)); //handle bbcodes
|
$data['data']['news_meta_description'] = eHelper::formatMetaDescription($news['news_meta_description']); //handle bbcodes
|
||||||
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
|
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
|
||||||
|
|
||||||
$datarw = array();
|
|
||||||
$datarw['data']['news_rewrite_id'] = $news['news_rewrite_id'];
|
|
||||||
$datarw['_FIELD_TYPES']['news_rewrite_id'] = 'int';
|
|
||||||
$datarw['data']['news_rewrite_string'] = trim($news['news_rewrite_string']);
|
|
||||||
$datarw['_FIELD_TYPES']['news_rewrite_string'] = 'todb';
|
|
||||||
$datarw['data']['news_rewrite_type'] = 1;
|
|
||||||
$datarw['_FIELD_TYPES']['news_rewrite_type'] = 'int';
|
|
||||||
|
|
||||||
if($error)
|
if($error)
|
||||||
{
|
{
|
||||||
$data['error'] = true;
|
$data['error'] = true;
|
||||||
@@ -510,7 +534,7 @@ class e_news_item extends e_front_model
|
|||||||
$id = intval($id);
|
$id = intval($id);
|
||||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||||
|
|
||||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n
|
||||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||||
WHERE n.news_id={$id} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
WHERE n.news_id={$id} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||||
@@ -726,7 +750,7 @@ class e_news_category_item extends e_front_model
|
|||||||
public function sc_news_category_url($parm = '')
|
public function sc_news_category_url($parm = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
$url = e107::getUrl()->create('news/list/category', array('id' => $this->getId(), 'name' => $this->cat('name')));
|
$url = e107::getUrl()->create('news/list/category', array('id' => $this->getId(), 'name' => $this->cat('sef')));
|
||||||
switch($parm)
|
switch($parm)
|
||||||
{
|
{
|
||||||
case 'link':
|
case 'link':
|
||||||
|
@@ -21,29 +21,41 @@ define("LAN_EURL_NAME_HELP", "Help");
|
|||||||
define("LAN_EURL_EMPTY", "The list is empty");
|
define("LAN_EURL_EMPTY", "The list is empty");
|
||||||
define("LAN_EURL_LEGEND_CONFIG", "Choose URL profile per site area");
|
define("LAN_EURL_LEGEND_CONFIG", "Choose URL profile per site area");
|
||||||
define("LAN_EURL_LEGEND_ALIASES", "Configure Base URL aliases per URL Profile");
|
define("LAN_EURL_LEGEND_ALIASES", "Configure Base URL aliases per URL Profile");
|
||||||
//define("LAN_EURL_PLUGCONFIG", "Configure Plugin URLs");
|
|
||||||
define("LAN_EURL_DEFAULT", "Default");
|
define("LAN_EURL_DEFAULT", "Default");
|
||||||
define("LAN_EURL_PROFILE", "Profile");
|
define("LAN_EURL_PROFILE", "Profile");
|
||||||
//define("LAN_EURL_UDEFINED", "User Defined Config");
|
|
||||||
define("LAN_EURL_INFOALT", "Info");
|
define("LAN_EURL_INFOALT", "Info");
|
||||||
//define("LAN_EURL_UDEFINED_INFO", "User defined URL configuration - overrides (disables) all custom configuration profiles. Remove the User defined configuration folder to enable the custom configuration profiles.");
|
|
||||||
define("LAN_EURL_PROFILE_INFO", "Profile info not available");
|
define("LAN_EURL_PROFILE_INFO", "Profile info not available");
|
||||||
define("LAN_EURL_LOCATION", "Profile Location:");
|
define("LAN_EURL_LOCATION", "Profile Location:");
|
||||||
define("LAN_EURL_LOCATION_NONE", "Config file not available");
|
define("LAN_EURL_LOCATION_NONE", "Config file not available");
|
||||||
//define("LAN_EURL_AUTOSAVE", "URL profile changes were detected. Configuration state successfully updated.");
|
|
||||||
define("LAN_EURL_FORM_HELP_DEFAULT", "Alias when in default language.");
|
define("LAN_EURL_FORM_HELP_DEFAULT", "Alias when in default language.");
|
||||||
define("LAN_EURL_FORM_HELP_ALIAS_0", "Default value is ");
|
define("LAN_EURL_FORM_HELP_ALIAS_0", "Default value is ");
|
||||||
define("LAN_EURL_FORM_HELP_ALIAS_1", "Alias when in ");
|
define("LAN_EURL_FORM_HELP_ALIAS_1", "Alias when in ");
|
||||||
define("LAN_EURL_FORM_HELP_EXAMPLE", "Base URL: ");
|
define("LAN_EURL_FORM_HELP_EXAMPLE", "Base URL: ");
|
||||||
|
|
||||||
|
// messages
|
||||||
|
define("LAN_EURL_ERR_ALIAS_MODULE", "Alias "%1\$s" can't be saved - there is a system URL profile with the same name. Please choose another alias value for system URL profile "%2\$s"");
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
define("LAN_EURL_SETTINGS_PATHINFO", "Remove filename from the URL");
|
define("LAN_EURL_SETTINGS_PATHINFO", "Remove filename from the URL");
|
||||||
define("LAN_EURL_SETTINGS_MAINMODULE", "Associate Root namespace");
|
define("LAN_EURL_SETTINGS_MAINMODULE", "Associate Root namespace");
|
||||||
define("LAN_EURL_SETTINGS_MAINMODULE_HELP", "Choose which site area will be connected with your base site URL. Example: When News is your root namespace http://yoursite.com/News-Item-Title will be associated with news (item view page will be resolved)");
|
define("LAN_EURL_SETTINGS_MAINMODULE_HELP", "Choose which site area will be connected with your base site URL. Example: When News is your root namespace http://yoursite.com/News-Item-Title will be associated with news (item view page will be resolved)");
|
||||||
define("LAN_EURL_SETTINGS_REDIRECT", "Redirect to System not found page");
|
define("LAN_EURL_SETTINGS_REDIRECT", "Redirect to System not found page");
|
||||||
define("LAN_EURL_SETTINGS_REDIRECT_HELP", "If set to false, not found page will be direct rendered (without browser redirect)");
|
define("LAN_EURL_SETTINGS_REDIRECT_HELP", "If set to false, not found page will be direct rendered (without browser redirect)");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRANSLATE", "Automated SEF string creation type");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRANSLATE_HELP", "Choose how will be assembled SEF string when it's automatically built from a Title value (e.g. in news, custom pages, etc.)");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_NONE", "Just secure it");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_DASHL", "dasherize-to-lower-case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_DASHC", "Dasherize-To-Camel-Case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_DASH", "Dasherize-with-no-case-CHANGE");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_UNDERSCOREL", "underscore_to_lower_case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_UNDERSCOREC", "Underscore_To_Camel_Case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_UNDERSCORE", "Underscore_with_no_case_CHANGE");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_PLUSL", "plus+separator+to+lower+case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_PLUSC", "Plus+Separator+To+Camel+Case");
|
||||||
|
define("LAN_EURL_SETTINGS_SEFTRTYPE_PLUS", "Plus+separator+with+no+case+CHANGE");
|
||||||
|
|
||||||
//define("LAN_EURL_MODREWR_TITLE", "User Friendly URLs");
|
|
||||||
define("LAN_EURL_MODREWR_DESCR", "Removes entry script file name (rewrite.php) from your URLs. You'll need mod_rewrite installed and running on your server (Apache Web Server). After enabling this setting go to your site root folder, rename htaccess.txt to .htaccess and modifgy <em>"RewriteBase"</em> Directive if required.");
|
define("LAN_EURL_MODREWR_DESCR", "Removes entry script file name (rewrite.php) from your URLs. You'll need mod_rewrite installed and running on your server (Apache Web Server). After enabling this setting go to your site root folder, rename htaccess.txt to .htaccess and modifgy <em>"RewriteBase"</em> Directive if required.");
|
||||||
|
|
||||||
// navigation
|
// navigation
|
||||||
@@ -62,10 +74,13 @@ define("LAN_EURL_CORE_MAIN", "Site Root Namespace - alias not in use.");
|
|||||||
define("LAN_EURL_CORE_NEWS", "News");
|
define("LAN_EURL_CORE_NEWS", "News");
|
||||||
define("LAN_EURL_NEWS_DEFAULT_LABEL", "Default");
|
define("LAN_EURL_NEWS_DEFAULT_LABEL", "Default");
|
||||||
define("LAN_EURL_NEWS_DEFAULT_DESCR", "Legacy direct URLs. Examples: <br />http://yoursite.com/news.php<br />http://yoursite.com/news.php?extend.1 <em>(view news item)</em>");
|
define("LAN_EURL_NEWS_DEFAULT_DESCR", "Legacy direct URLs. Examples: <br />http://yoursite.com/news.php<br />http://yoursite.com/news.php?extend.1 <em>(view news item)</em>");
|
||||||
define("LAN_EURL_NEWS_REWRITE_LABEL", "User Friendly URLs (mod_rewrite)");
|
define("LAN_EURL_NEWS_REWRITE_LABEL", "Friendly URLs without ID (no performance, more friendly)");
|
||||||
define("LAN_EURL_NEWS_REWRITE_DESCR", "Demonstrates manual link parsing and assembling.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/News Title <em>(view news item)</em>");
|
define("LAN_EURL_NEWS_REWRITE_DESCR", "Demonstrates manual link parsing and assembling.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/News Title <em>(view news item)</em>");
|
||||||
define("LAN_EURL_NEWS_REWRITEX_LABEL", "Extended User Friendly URLs (mod_rewrite)");
|
define("LAN_EURL_NEWS_REWRITEX_LABEL", "Friendly URLs with ID (performance wise)");
|
||||||
define("LAN_EURL_NEWS_REWRITEX_DESCR", "Demonstrates automated link parsing and assembling based on predefined route rules.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/News Category Name/News Title <em>(view news item)</em>");
|
define("LAN_EURL_NEWS_REWRITEX_DESCR", "Demonstrates automated link parsing and assembling based on predefined route rules.<br />Examples: <br />http://yoursite.com/news<br />http://yoursite.com/news/1/News Title <em>(view news item)</em>");
|
||||||
|
define("LAN_EURL_NEWS_REWRITEF_LABEL", "Full Friendly URLs (no performance and most friendly)");
|
||||||
|
define("LAN_EURL_NEWS_REWRITEF_DESCR", "Examples: <br />http://yoursite.com/news/News Category/News Title<em>(view news item)</em><br />http://yoursite.com/news/Category/News Category <em>(list news items)</em>");
|
||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
//define("LAN_EURL_CORE_DOWNLOADS", "Downloads");
|
//define("LAN_EURL_CORE_DOWNLOADS", "Downloads");
|
||||||
|
|
||||||
@@ -73,30 +88,30 @@ define("LAN_EURL_NEWS_REWRITEX_DESCR", "Demonstrates automated link parsing and
|
|||||||
define("LAN_EURL_CORE_USER", "Users");
|
define("LAN_EURL_CORE_USER", "Users");
|
||||||
define("LAN_EURL_USER_DEFAULT_LABEL", "Default");
|
define("LAN_EURL_USER_DEFAULT_LABEL", "Default");
|
||||||
define("LAN_EURL_USER_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/user.php?id.1");
|
define("LAN_EURL_USER_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/user.php?id.1");
|
||||||
define("LAN_EURL_USER_REWRITE_LABEL", "User Friendly URLs (mod_rewrite)");
|
define("LAN_EURL_USER_REWRITE_LABEL", "Friendly URLs");
|
||||||
define("LAN_EURL_USER_REWRITE_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/user/UserDisplayName");
|
define("LAN_EURL_USER_REWRITE_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/user/UserDisplayName");
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
define("LAN_EURL_CORE_PAGE", "Custom Pages");
|
define("LAN_EURL_CORE_PAGE", "Custom Pages");
|
||||||
define("LAN_EURL_PAGE_DEFAULT_LABEL", "Default");
|
define("LAN_EURL_PAGE_DEFAULT_LABEL", "Default");
|
||||||
define("LAN_EURL_PAGE_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/page.php?1");
|
define("LAN_EURL_PAGE_DEFAULT_DESCR", "Legacy direct URLs. Example: http://yoursite.com/page.php?1");
|
||||||
define("LAN_EURL_PAGE_SEF_LABEL", "User Friendly URLs with ID (safe)");
|
define("LAN_EURL_PAGE_SEF_LABEL", "Friendly URLs with ID (performance)");
|
||||||
define("LAN_EURL_PAGE_SEF_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/1/Page-Name");
|
define("LAN_EURL_PAGE_SEF_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/1/Page-Name");
|
||||||
define("LAN_EURL_PAGE_SEFNOID_LABEL", "User Friendly URLs without ID (not suitable for old DB's)");
|
define("LAN_EURL_PAGE_SEFNOID_LABEL", "Friendly URLs without ID (no performance, more friendly)");
|
||||||
define("LAN_EURL_PAGE_SEFNOID_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/Page-Name");
|
define("LAN_EURL_PAGE_SEFNOID_DESCR", "Search engine and user friendly URLs. <br />Example: http://yoursite.com/page/Page-Name");
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
define("LAN_EURL_CORE_SEARCH", "Search");
|
define("LAN_EURL_CORE_SEARCH", "Search");
|
||||||
define("LAN_EURL_SEARCH_DEFAULT_LABEL", "Default Search URL");
|
define("LAN_EURL_SEARCH_DEFAULT_LABEL", "Default Search URL");
|
||||||
define("LAN_EURL_SEARCH_DEFAULT_DESCR", "Legacy direct URL. Example: http://yoursite.com/search.php");
|
define("LAN_EURL_SEARCH_DEFAULT_DESCR", "Legacy direct URL. Example: http://yoursite.com/search.php");
|
||||||
define("LAN_EURL_SEARCH_REWRITE_LABEL", "User Friendly URL (mod_rewrite)");
|
define("LAN_EURL_SEARCH_REWRITE_LABEL", "Friendly URL");
|
||||||
define("LAN_EURL_SEARCH_REWRITE_DESCR", "Example: http://yoursite.com/search/");
|
define("LAN_EURL_SEARCH_REWRITE_DESCR", "Example: http://yoursite.com/search/");
|
||||||
|
|
||||||
// System
|
// System
|
||||||
define("LAN_EURL_CORE_SYSTEM", "System");
|
define("LAN_EURL_CORE_SYSTEM", "System");
|
||||||
define("LAN_EURL_SYSTEM_DEFAULT_LABEL", "Default System URLs");
|
define("LAN_EURL_SYSTEM_DEFAULT_LABEL", "Default System URLs");
|
||||||
define("LAN_EURL_SYSTEM_DEFAULT_DESCR", "URLs for pages like Not Found, Acess denied, etc. Example: http://yoursite.com/?route=system/error/notfound");
|
define("LAN_EURL_SYSTEM_DEFAULT_DESCR", "URLs for pages like Not Found, Acess denied, etc. Example: http://yoursite.com/?route=system/error/notfound");
|
||||||
define("LAN_EURL_SYSTEM_REWRITE_LABEL", "User Friendly URL (mod_rewrite)");
|
define("LAN_EURL_SYSTEM_REWRITE_LABEL", "Friendly System URLs");
|
||||||
define("LAN_EURL_SYSTEM_REWRITE_DESCR", "URLs for pages like Not Found, Acess denied, etc.<br />Example: http://yoursite.com/system/error404");
|
define("LAN_EURL_SYSTEM_REWRITE_DESCR", "URLs for pages like Not Found, Acess denied, etc.<br />Example: http://yoursite.com/system/error404");
|
||||||
|
|
||||||
// System
|
// System
|
||||||
|
5
news.php
5
news.php
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
* Copyright (C) e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
@@ -689,7 +689,8 @@ else
|
|||||||
if($sub_action && 'list' == $action && vartrue($newsAr[1]['category_name']))
|
if($sub_action && 'list' == $action && vartrue($newsAr[1]['category_name']))
|
||||||
{
|
{
|
||||||
// we know category name - pass it to the nexprev url
|
// we know category name - pass it to the nexprev url
|
||||||
$category_name = $newsUrlparms['name'] = $newsAr[1]['category_name'];
|
$category_name = $newsAr[1]['category_name'];
|
||||||
|
if(vartrue($newsAr[1]['category_sef'])) $newsUrlparms['name'] = $newsAr[1]['category_sef'];
|
||||||
if(!isset($NEWSLISTCATTITLE))
|
if(!isset($NEWSLISTCATTITLE))
|
||||||
{
|
{
|
||||||
$NEWSLISTCATTITLE = "<h1 class='newscatlist-title'>".$tp->toHTML($category_name,FALSE,'TITLE')."</h1>";
|
$NEWSLISTCATTITLE = "<h1 class='newscatlist-title'>".$tp->toHTML($category_name,FALSE,'TITLE')."</h1>";
|
||||||
|
Reference in New Issue
Block a user