mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Linkgen Fixes. Added e107::url() backward compatibility with earlier SEF creation method.
This commit is contained in:
@@ -301,10 +301,17 @@ class links_admin_ui extends e_admin_ui
|
|||||||
$sublink_type['news']['title'] = LINKLAN_8; // "News Categories";
|
$sublink_type['news']['title'] = LINKLAN_8; // "News Categories";
|
||||||
$sublink_type['news']['table'] = "news_category";
|
$sublink_type['news']['table'] = "news_category";
|
||||||
$sublink_type['news']['query'] = "category_id !='-2' ORDER BY category_name ASC";
|
$sublink_type['news']['query'] = "category_id !='-2' ORDER BY category_name ASC";
|
||||||
$sublink_type['news']['url'] = "news.php?cat.#";
|
$sublink_type['news']['url'] = "news.php?list.#";
|
||||||
$sublink_type['news']['fieldid'] = "category_id";
|
$sublink_type['news']['fieldid'] = "category_id";
|
||||||
$sublink_type['news']['fieldname'] = "category_name";
|
$sublink_type['news']['fieldname'] = "category_name";
|
||||||
$sublink_type['news']['fieldicon'] = "category_icon";
|
$sublink_type['news']['fieldicon'] = "category_icon";
|
||||||
|
$sublink_type['news']['sef'] = "news/list/category";
|
||||||
|
|
||||||
|
$sublink_type['newsalt'] = $sublink_type['news'];
|
||||||
|
$sublink_type['newsalt']['url'] = "news.php?cat.#";
|
||||||
|
$sublink_type['newsalt']['title'] = LINKLAN_8." (".LAN_LIST.")"; // "News Categories";
|
||||||
|
$sublink_type['newsalt']['sef'] = "news/list/short";
|
||||||
|
|
||||||
|
|
||||||
$sublink_type['downloads']['title'] = LINKLAN_9; //"Download Categories";
|
$sublink_type['downloads']['title'] = LINKLAN_9; //"Download Categories";
|
||||||
$sublink_type['downloads']['table'] = "download_category";
|
$sublink_type['downloads']['table'] = "download_category";
|
||||||
@@ -377,7 +384,16 @@ class links_admin_ui extends e_admin_ui
|
|||||||
$subcat = $row[($sublink['fieldid'])];
|
$subcat = $row[($sublink['fieldid'])];
|
||||||
$name = $row[($sublink['fieldname'])];
|
$name = $row[($sublink['fieldname'])];
|
||||||
$subname = $name; // eliminate old embedded hierarchy from names. (e.g. 'submenu.TopName.name')
|
$subname = $name; // eliminate old embedded hierarchy from names. (e.g. 'submenu.TopName.name')
|
||||||
$suburl = str_replace("#", $subcat, $sublink['url']);
|
|
||||||
|
if(!empty($sublink['sef']))
|
||||||
|
{
|
||||||
|
$suburl = e107::url($sublink['sef'], $row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$suburl = str_replace("#", $subcat, $sublink['url']);
|
||||||
|
}
|
||||||
|
|
||||||
$subicon = ($sublink['fieldicon']) ? $row[($sublink['fieldicon'])] : $par['link_button'];
|
$subicon = ($sublink['fieldicon']) ? $row[($sublink['fieldicon'])] : $par['link_button'];
|
||||||
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
|
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
|
||||||
$subparent = $pid;
|
$subparent = $pid;
|
||||||
@@ -406,7 +422,14 @@ class links_admin_ui extends e_admin_ui
|
|||||||
$subcat = $row[($sublink['fieldid'])];
|
$subcat = $row[($sublink['fieldid'])];
|
||||||
$name = $row[($sublink['fieldname'])];
|
$name = $row[($sublink['fieldname'])];
|
||||||
$subname = $name; // eliminate old embedded hierarchy from names. (e.g. 'submenu.TopName.name')
|
$subname = $name; // eliminate old embedded hierarchy from names. (e.g. 'submenu.TopName.name')
|
||||||
$suburl = str_replace("#", $subcat, $sublink['url']);
|
if(!empty($sublink['sef']))
|
||||||
|
{
|
||||||
|
$suburl = e107::url($sublink['sef'], $row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$suburl = str_replace("#", $subcat, $sublink['url']);
|
||||||
|
}
|
||||||
$subicon = ($sublink['fieldicon']) ? $row[($sublink['fieldicon'])] : $par['link_button'];
|
$subicon = ($sublink['fieldicon']) ? $row[($sublink['fieldicon'])] : $par['link_button'];
|
||||||
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
|
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
|
||||||
$subparent = $pid;
|
$subparent = $pid;
|
||||||
@@ -424,6 +447,8 @@ class links_admin_ui extends e_admin_ui
|
|||||||
'link_function' => ''
|
'link_function' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
e107::getMessage()->addDebug(print_a($insert_array,true));
|
||||||
|
|
||||||
if($sql2->insert("links",$insert_array))
|
if($sql2->insert("links",$insert_array))
|
||||||
{
|
{
|
||||||
$message = LAN_CREATED." ({$name})[!br!]";
|
$message = LAN_CREATED." ({$name})[!br!]";
|
||||||
|
@@ -134,7 +134,7 @@ class news_cat_ui extends e_admin_ui
|
|||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center', 'sort' => true)
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center', 'sort' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $fieldpref = array('checkboxes', 'category_icon', 'category_id', 'category_name', 'category_description','category_manager', 'category_order', 'options');
|
protected $fieldpref = array('checkboxes', 'category_icon', 'category_id', 'category_name', 'category_description', 'category_sef', 'category_manager', 'category_order', 'options');
|
||||||
|
|
||||||
// protected $newspost;
|
// protected $newspost;
|
||||||
|
|
||||||
|
@@ -2743,27 +2743,23 @@ class e107
|
|||||||
public static function url($plugin='',$key, $row=array(), $options = array())
|
public static function url($plugin='',$key, $row=array(), $options = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
/* TODO backward compat - core keys. */
|
/* backward compat - core keys. ie. news/xxx/xxx user/xxx/xxx etc, */
|
||||||
/*
|
$legacy = array('news','page','search','user','download','gallery');
|
||||||
if($plugin == 'user')
|
|
||||||
|
if(strpos($plugin,'/')!==false)
|
||||||
{
|
{
|
||||||
switch($key)
|
$tmp = explode("/",$plugin,2);
|
||||||
|
|
||||||
|
if(in_array($tmp[0], $legacy))
|
||||||
{
|
{
|
||||||
case "profile":
|
return self::getUrl()->create($plugin, $key, $row);
|
||||||
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
|
|
||||||
return self::getUrl()->create('user/profile/view', $uparams);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "settings":
|
|
||||||
// code
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// shorthand - for internal use.
|
||||||
|
$plugin = $tmp[0];
|
||||||
|
$row = $key;
|
||||||
|
$key = $tmp[1];
|
||||||
|
}
|
||||||
|
|
||||||
$tmp = e107::getAddonConfig('e_url');
|
$tmp = e107::getAddonConfig('e_url');
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
42
e107_plugins/download/e_url.php
Normal file
42
e107_plugins/download/e_url.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 Bootstrap CMS
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
* IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
|
||||||
|
*
|
||||||
|
* if (!defined('e107_INIT'))
|
||||||
|
* {
|
||||||
|
* require_once("../../class2.php");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
// v2.x Standard - Simple mod-rewrite module.
|
||||||
|
|
||||||
|
class download_url // plugin-folder + '_url'
|
||||||
|
{
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
$config = array();
|
||||||
|
|
||||||
|
$config['index'] = array(
|
||||||
|
// 'regex' => '^download/?$', // matched against url, and if true, redirected to 'redirect' below.
|
||||||
|
'alias' => 'download',
|
||||||
|
'sef' => '{alias}', // used by e107::url(); to create a url from the db table.
|
||||||
|
'redirect' => '{e_PLUGIN}download/download.php', // file-path of what to load when the regex returns true.
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -13,7 +13,7 @@
|
|||||||
<link url='admin_download.php?mirror' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_128</link>
|
<link url='admin_download.php?mirror' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_128</link>
|
||||||
</adminLinks>
|
</adminLinks>
|
||||||
<siteLinks>
|
<siteLinks>
|
||||||
<link url="{e_PLUGIN}download/download.php" perm="everyone">LAN_PLUGIN_DOWNLOAD_NAME</link>
|
<link url="{e_PLUGIN}download/download.php" sef='index' perm="everyone">LAN_PLUGIN_DOWNLOAD_NAME</link>
|
||||||
</siteLinks>
|
</siteLinks>
|
||||||
<mainPrefs>
|
<mainPrefs>
|
||||||
<pref name="download_php"></pref>
|
<pref name="download_php"></pref>
|
||||||
|
@@ -23,6 +23,7 @@ $sublink_type['forum']['url'] = "{e_PLUGIN}forum/forum_viewforum.php?#";
|
|||||||
$sublink_type['forum']['fieldid'] = 'forum_id';
|
$sublink_type['forum']['fieldid'] = 'forum_id';
|
||||||
$sublink_type['forum']['fieldname'] = 'forum_name';
|
$sublink_type['forum']['fieldname'] = 'forum_name';
|
||||||
$sublink_type['forum']['fielddiz'] = 'forum_description';
|
$sublink_type['forum']['fielddiz'] = 'forum_description';
|
||||||
|
$sublink_type['forum']['sef'] = 'forum/forum';
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
42
e107_plugins/gallery/e_url.php
Normal file
42
e107_plugins/gallery/e_url.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 Bootstrap CMS
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
* IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
|
||||||
|
*
|
||||||
|
* if (!defined('e107_INIT'))
|
||||||
|
* {
|
||||||
|
* require_once("../../class2.php");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
// v2.x Standard - Simple mod-rewrite module.
|
||||||
|
|
||||||
|
class gallery_url // plugin-folder + '_url'
|
||||||
|
{
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
$config = array();
|
||||||
|
|
||||||
|
$config['index'] = array(
|
||||||
|
// 'regex' => '^gallery/?$', // matched against url, and if true, redirected to 'redirect' below.
|
||||||
|
'alias' => 'gallery',
|
||||||
|
'sef' => '{alias}', // used by e107::url(); to create a url from the db table.
|
||||||
|
'redirect' => '{e_PLUGIN}gallery/gallery.php', // file-path of what to load when the regex returns true.
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -7,7 +7,7 @@
|
|||||||
<link url='admin_gallery.php' description='LAN_CONFIGURE' icon='images/gallery_32.png' iconSmall='images/gallery_16.png' primary='true' >LAN_CONFIGURE</link>
|
<link url='admin_gallery.php' description='LAN_CONFIGURE' icon='images/gallery_32.png' iconSmall='images/gallery_16.png' primary='true' >LAN_CONFIGURE</link>
|
||||||
</adminLinks>
|
</adminLinks>
|
||||||
<siteLinks>
|
<siteLinks>
|
||||||
<link url="{e_PLUGIN}gallery/gallery.php" perm="everyone" >LAN_PLUGIN_GALLERY_TITLE</link>
|
<link url="{e_PLUGIN}gallery/gallery.php" sef='index' perm="everyone" >LAN_PLUGIN_GALLERY_TITLE</link>
|
||||||
</siteLinks>
|
</siteLinks>
|
||||||
<mainPrefs>
|
<mainPrefs>
|
||||||
</mainPrefs>
|
</mainPrefs>
|
||||||
|
@@ -1234,6 +1234,10 @@ li.rssRow > div {
|
|||||||
.tab-content #plugin,
|
.tab-content #plugin,
|
||||||
.tab-content #theme { padding-top:20px }
|
.tab-content #theme { padding-top:20px }
|
||||||
|
|
||||||
|
.alert-warning pre { color: white }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
body { background-color: rgb(68, 68, 68); }
|
body { background-color: rgb(68, 68, 68); }
|
||||||
|
Reference in New Issue
Block a user