diff --git a/e107_admin/links.php b/e107_admin/links.php
index d9d45d0c7..602e16f4d 100644
--- a/e107_admin/links.php
+++ b/e107_admin/links.php
@@ -71,22 +71,24 @@ class links_admin_ui extends e_admin_ui
public $sublink_data = null;
protected $fields = array(
- 'checkboxes' => array('title'=> '', 'width' => '3%','forced' => true,'thclass' => 'center first','class' => 'center first'),
- 'link_button' => array('title'=> LAN_ICON, 'type'=>'icon', 'width'=>'5%', 'thclass' => 'center', 'class'=>'center'),
- 'link_id' => array('title'=> ID, 'noedit'=>TRUE),
- 'link_name' => array('title'=> LCLAN_15, 'width'=>'auto','type'=>'text', 'validate' => true),
- 'link_parent' => array('title'=> 'Sublink of', 'type' => 'method', 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first'),
- 'link_url' => array('title'=> LCLAN_93, 'width'=>'auto', 'type'=>'text', 'validate' => true),
+ 'checkboxes' => array('title'=> '', 'width' => '3%','forced' => true,'thclass' => 'center first','class' => 'center first'),
+ 'link_button' => array('title'=> LAN_ICON, 'type'=>'icon', 'width'=>'5%', 'thclass' => 'center', 'class'=>'center'),
+ 'link_id' => array('title'=> ID, 'noedit'=>TRUE),
+ 'link_name' => array('title'=> LCLAN_15, 'width'=>'auto','type'=>'text', 'validate' => true),
+ 'link_parent' => array('title'=> 'Sublink of', 'type' => 'method', 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first'),
+ 'link_url' => array('title'=> LCLAN_93, 'width'=>'auto', 'type'=>'text', 'validate' => true),
+ 'link_sefurl' => array('title'=> LAN_SEFURL, 'type' => 'text', 'width' => 'auto'),
'link_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'writeParms' => 'classlist=public,guest,nobody,member,classes,admin,main', 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
'link_description' => array('title'=> LCLAN_17, 'type' => 'bbarea', 'method'=>'tinymce_plugins', 'width' => 'auto'),
'link_category' => array('title'=> LCLAN_12, 'type' => 'dropdown', 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
'link_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto'),
'link_open' => array('title'=> LCLAN_19, 'type' => 'dropdown', 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first'),
'link_function' => array('title'=> 'Function', 'type' => 'method', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left first'),
- 'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center')
+
+ 'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center')
);
- protected $fieldpref = array('checkboxes','link_id','link_name','link_class','link_order','options');
+ protected $fieldpref = array('checkboxes','link_id','link_name','link_sefurl','link_class','link_order','options');
protected $prefs = array(
'linkpage_screentip' => array('title'=>LCLAN_78, 'type'=>'boolean', 'help'=>LCLAN_79),
@@ -504,6 +506,27 @@ class links_model_admin_tree extends e_admin_tree_model
class links_admin_form_ui extends e_admin_form_ui
{
protected $current_parent = null;
+
+ private $linkFunctions;
+
+ function init()
+ {
+
+
+ $tmp = e107::getAddonConfig('e_sitelink','sitelinks');
+
+ foreach($tmp as $cat=> $array)
+ {
+ $func = array();
+ foreach($array as $val)
+ {
+ $newkey = $cat.'::'.$val['function'];
+ $func[$newkey] = $val['name'];
+ }
+ $this->linkFunctions[$cat] = $func;
+ }
+ }
+
function link_parent($value, $mode)
{
switch($mode)
@@ -547,6 +570,24 @@ class links_admin_form_ui extends e_admin_form_ui
}
}
+ function link_function($curVal,$mode)
+ {
+ if($mode == 'read')
+ {
+ return $curVal; // $this->linkFunctions[$curVal];
+ }
+
+ if($mode == 'write')
+ {
+ return $this->selectbox('link_function',$this->linkFunctions,$curVal,array('default'=> "(".LAN_OPTIONAL.")"));
+ }
+
+ else
+ {
+ return $this->linkFunctions;
+ }
+ }
+
/**
*
* @param integer $category_id
diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php
index 362707cf1..3c7cfbdb6 100644
--- a/e107_admin/sql/core_sql.php
+++ b/e107_admin/sql/core_sql.php
@@ -220,6 +220,7 @@ CREATE TABLE links (
link_open tinyint(1) unsigned NOT NULL default '0',
link_class varchar(255) NOT NULL default '0',
link_function varchar(100) NOT NULL default '',
+ link_sefurl varchar(255) NOT NULL,
PRIMARY KEY (link_id)
) ENGINE=MyISAM;
@@ -338,21 +339,6 @@ CREATE TABLE news_category (
) ENGINE=MyISAM;
# --------------------------------------------------------
-#
-# Table structure for table `news_rewrite`
-#
-
-CREATE TABLE news_rewrite (
- news_rewrite_id int(10) unsigned NOT NULL auto_increment,
- news_rewrite_source int(10) unsigned NOT NULL,
- news_rewrite_string varchar(255) NOT NULL default '',
- news_rewrite_type tinyint(1) unsigned NOT NULL default '1',
- PRIMARY KEY (news_rewrite_id),
- UNIQUE KEY news_rewrite_string (news_rewrite_string),
- UNIQUE KEY news_rewrite_source_type (news_rewrite_source,news_rewrite_type)
-) ENGINE=MyISAM;
-# --------------------------------------------------------
-
#
# Table structure for table `online`
#
diff --git a/e107_handlers/e107Url.php b/e107_handlers/e107Url.php
index 26850a12e..ebe3f72dd 100755
--- a/e107_handlers/e107Url.php
+++ b/e107_handlers/e107Url.php
@@ -14,8 +14,11 @@
* $Author$
*/
+
if (!defined('e107_INIT')) { exit; }
+// IMPORTANT: This class is deprecated in it's current form and should not be utilized.
+
class eURL
{
/**
@@ -24,6 +27,7 @@ class eURL
protected $_link_handlers = array();
/**
+ *
* Create site url
* Example:
* e107::getUrl()->create('core::news', 'main', 'action=extend&id=1&sef=Item-SEF-URL');
@@ -233,3 +237,4 @@ class eURL
throw new Exception('Method '.$method.' does not exist!');//FIXME - e107Exception handler
}
}
+
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 803764343..7c6528218 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -2263,9 +2263,10 @@ class e107
}*/
$eSelf = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME'];
+ $_self = $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$eSelf;
if(!deftrue('e_SELF_DISABLE'))
{
- define('e_SELF', $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$eSelf);
+ define('e_SELF', $_self);
}
@@ -2322,8 +2323,8 @@ class e107
// e_SELF has the full HTML path
$inAdminDir = FALSE;
- $isPluginDir = strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE; // True if we're in a plugin
- $e107Path = str_replace($this->base_path, '', e_SELF); // Knock off the initial bits
+ $isPluginDir = strpos($_self,'/'.$PLUGINS_DIRECTORY) !== FALSE; // True if we're in a plugin
+ $e107Path = str_replace($this->base_path, '', $_self); // Knock off the initial bits
if (
(!$isPluginDir && strpos($e107Path, $ADMIN_DIRECTORY) === 0 ) // Core admin directory
@@ -2408,7 +2409,11 @@ class e107
define('e_TBQS', $_SERVER['QUERY_STRING']);
- $_SERVER['QUERY_STRING'] = e_QUERY;
+ if(defined('e_QUERY'))
+ {
+ $_SERVER['QUERY_STRING'] = e_QUERY;
+ }
+
}
diff --git a/e107_handlers/secure_img_handler.php b/e107_handlers/secure_img_handler.php
index 14969e75e..b7096e8c7 100644
--- a/e107_handlers/secure_img_handler.php
+++ b/e107_handlers/secure_img_handler.php
@@ -16,17 +16,39 @@
if (!defined('e107_INIT')) { exit; }
-class secure_image {
+class secure_image
+{
var $random_number;
+ var $HANDLERS_DIRECTORY;
+ var $IMAGES_DIRECTORY;
+ var $THIS_DIR;
- function secure_image() {
+ function secure_image()
+ {
list($usec, $sec) = explode(" ", microtime());
$this->random_number = str_replace(".", "", $sec.$usec);
+
+ $imgp = dirname(__FILE__);
+ if (substr($imgp,-1,1) != '/') $imgp .= '/';
+ if(!require($imgp.'../e107_config.php'))
+ {
+ if(defined('e_DEBUG'))
+ {
+ echo "FAILED TO LOAD e107_config.php in secure_img_handler.php";
+ }
+ }
+
+ $this->THIS_DIR = $imgp;
+ $this->HANDLERS_DIRECTORY = $HANDLERS_DIRECTORY;
+ $this->IMAGES_DIRECTORY = $IMAGES_DIRECTORY;
}
- function create_code() {
- global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
+ function create_code()
+ {
+ $pref = e107::getPref();
+ $sql = e107::getDb();
+
/*
require_once('e107_class.php');
$e107 = new e107(false, false);
@@ -34,10 +56,7 @@ class secure_image {
$imgpy = str_replace($HANDLERS_DIRECTORY, "", $e107->file_path);
*/
- $imgp = dirname(__FILE__);
- if (substr($imgp,-1,1) != '/') $imgp .= '/';
- if (!isset($HANDLERS_DIRECTORY)) require_once($imgp.'../e107_config.php');
- $imgp = str_replace($HANDLERS_DIRECTORY,$IMAGES_DIRECTORY,$imgp);
+ $imgp = str_replace($this->HANDLERS_DIRECTORY, $this->IMAGES_DIRECTORY, $this->THIS_DIR);
mt_srand ((double)microtime() * 1000000);
$maxran = 1000000;
@@ -51,8 +70,12 @@ class secure_image {
return $recnum;
}
- function verify_code($rec_num, $checkstr) {
- global $sql, $tp;
+
+ function verify_code($rec_num, $checkstr)
+ {
+ $sql = e107::getDb();
+ $tp = e107::getParser();
+
if ($sql->db_Select("tmp", "tmp_info", "tmp_ip = '".$tp -> toDB($rec_num)."'")) {
$row = $sql->db_Fetch();
$sql->db_Delete("tmp", "tmp_ip = '".$tp -> toDB($rec_num)."'");
@@ -62,10 +85,10 @@ class secure_image {
return FALSE;
}
- function r_image() {
- global $HANDLERS_DIRECTORY;
+ function r_image()
+ {
$code = $this->create_code();
- return "";
+ return "
";
}
}
?>
diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php
index 06e6567e5..5fae3ac43 100644
--- a/e107_handlers/sitelinks_class.php
+++ b/e107_handlers/sitelinks_class.php
@@ -18,16 +18,23 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_sitelinks.php');
class sitelinks
{
var $eLinkList = array();
+ var $sefList = array();
function getlinks($cat=1)
- {
+ {
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
$sql = e107::getDb('sqlSiteLinks');
- $query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
+ $ins = ($cat > 0) ? "link_category = ".intval($cat)." AND " : "";
+ $query = "SELECT * FROM #links WHERE ".$ins." link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
if($sql->db_Select_gen($query))
{
while ($row = $sql->db_Fetch())
{
+ if($row['link_sefurl'])
+ {
+ $this->sefList[$row['link_sefurl']] = $row['link_url'];
+ }
+
// if (substr($row['link_name'], 0, 8) == 'submenu.'){
// $tmp=explode('.', $row['link_name'], 3);
// $this->eLinkList[$tmp[1]][]=$row;
@@ -239,6 +246,11 @@ class sitelinks
// Start with an empty link
$linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
$highlighted = FALSE;
+
+ if(vartrue($linkInfo['link_sefurl']))
+ {
+ $linkInfo['link_url'] = $linkInfo['link_sefurl'];
+ }
// If submenu: Fix Name, Add Indentation.
if ($submenu == TRUE)
diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php
index b0a79bd62..778a81dd0 100644
--- a/e107_languages/English/admin/lan_admin.php
+++ b/e107_languages/English/admin/lan_admin.php
@@ -319,9 +319,10 @@ define("LAN_ICON", "Icon");
define("LAN_LOADING", "Loading...");
define("LAN_FILE", "File");
define("LAN_EXECUTE","Execute");
+define("LAN_SEFURL","SEF URL");
-define("LAN_SECURITYL_0", "Looking for troubles (none)");
+define("LAN_SECURITYL_0", "Looking for trouble (none)");
define("LAN_SECURITYL_5", "Balanced");
define("LAN_SECURITYL_7", "High");
define("LAN_SECURITYL_9", "Paranoid");
diff --git a/e107_plugins/news/e_url.php b/e107_plugins/news/e_url.php
index af816a1d2..6a083a571 100644
--- a/e107_plugins/news/e_url.php
+++ b/e107_plugins/news/e_url.php
@@ -8,29 +8,42 @@ class news_url // must match the plugin's folder name. ie. [PLUGIN_FOLDER]_url
function config()
{
- e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_newspost.php');
+ // e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_newspost.php');
- $config = array();
+ $urls = array();
- $config[] = array(
- 'name' => LAN_EURL_MODREWR_TITLE,
- 'description' => LAN_EURL_MODREWR_DESCR
+ $urls[] = array(
+ 'path' => "", // default only - should also be configurable from admin->url
+ 'function' => "myfunction",
+ 'description' => "SEF Urls for Custom-Pages"
);
- return $config;
+ return $this->urls;
}
+ function myfunction($curVal)
+ {
+
+ //Simulated
+ $urls = array(
+ 'welcome-to-e107' => "{e_BASE}news.php?extend.1"
+ );
+
+ return (isset($urls[$curVal])) ? $urls[$curVal] : FALSE;
+
+ }
- function apache_create($parms)
- {
-
- }
-
-
- function apache_parse($parms)
- {
-
+ function create($data,$mode='default') // generate a URL from Table Data.
+ {
+ if($mode == 'default')
+ {
+ if($data['news_id']==1)
+ {
+ return "{e_BASE}welcome-to-e107";
+ }
+ }
}
+
}
?>
\ No newline at end of file
diff --git a/news.php b/news.php
index 609695ab4..67160510b 100644
--- a/news.php
+++ b/news.php
@@ -48,7 +48,8 @@ if (!defined('ITEMVIEW'))
if (e_QUERY)
{
- $tmp = e107::getUrl()->parseRequest('core:news', 'main', urldecode(e_QUERY));
+
+ $tmp = explode(".",e_QUERY);
$action = $tmp[0]; // At least one parameter here
$sub_action = varset($tmp[1],''); // Usually a numeric category, or numeric news item number, but don't presume yet
// $id = varset($tmp[2],''); // ID of specific news item where required
@@ -87,19 +88,6 @@ Variables Used:
$ix = new news;
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
-//Add rewrite search to db queries only if needed
-$rewrite_join = $rewrite_cols = $rewrite_join_cat = $rewrite_cols_cat = '';
-if(NEWS_REWRITE)
-{
- //item
- $rewrite_join = 'LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1';
- $rewrite_cols = ', nr.*';
-
- //category
- $rewrite_join_cat = 'LEFT JOIN #news_rewrite AS ncr ON n.news_category=ncr.news_rewrite_source AND ncr.news_rewrite_type=2';
- $rewrite_cols_cat = ', ncr.news_rewrite_id AS news_category_rewrite_id, ncr.news_rewrite_string AS news_category_rewrite_string ';
-}
-
//------------------------------------------------------
// DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
//------------------------------------------------------
@@ -133,8 +121,6 @@ if ($action == 'cat' || $action == 'all')
FROM #news AS n
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
- {$rewrite_join}
- {$rewrite_join_cat}
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
AND (n.news_end=0 || n.news_end>".time().")
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
@@ -152,8 +138,6 @@ if ($action == 'cat' || $action == 'all')
FROM #news AS n
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
- {$rewrite_join}
- {$rewrite_join_cat}
WHERE n.news_category=".intval($sub_action)."
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
@@ -217,7 +201,10 @@ if ($action == 'cat' || $action == 'all')
$icon = ($row['category_icon']) ? "
" : "";
- $parms = $news_total.",".$amount.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action={$action}&subaction={$category}");
+ // Deprecated.
+ // $parms = $news_total.",".$amount.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action={$action}&subaction={$category}");
+ $parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
+
$text .= "