1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Linkgen Fixes. Added e107::url() backward compatibility with earlier SEF creation method.

This commit is contained in:
Cameron
2016-03-08 13:53:58 -08:00
parent 7e55a677b3
commit daf5495214
9 changed files with 133 additions and 23 deletions

View File

@@ -301,10 +301,17 @@ class links_admin_ui extends e_admin_ui
$sublink_type['news']['title'] = LINKLAN_8; // "News Categories";
$sublink_type['news']['table'] = "news_category";
$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']['fieldname'] = "category_name";
$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']['table'] = "download_category";
@@ -377,7 +384,16 @@ class links_admin_ui extends e_admin_ui
$subcat = $row[($sublink['fieldid'])];
$name = $row[($sublink['fieldname'])];
$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'];
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
$subparent = $pid;
@@ -406,7 +422,14 @@ class links_admin_ui extends e_admin_ui
$subcat = $row[($sublink['fieldid'])];
$name = $row[($sublink['fieldname'])];
$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'];
$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $par['link_description'];
$subparent = $pid;
@@ -424,6 +447,8 @@ class links_admin_ui extends e_admin_ui
'link_function' => ''
);
e107::getMessage()->addDebug(print_a($insert_array,true));
if($sql2->insert("links",$insert_array))
{
$message = LAN_CREATED." ({$name})[!br!]";

View File

@@ -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)
);
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;

View File

@@ -2743,27 +2743,23 @@ class e107
public static function url($plugin='',$key, $row=array(), $options = array())
{
/* TODO backward compat - core keys. */
/*
if($plugin == 'user')
/* backward compat - core keys. ie. news/xxx/xxx user/xxx/xxx etc, */
$legacy = array('news','page','search','user','download','gallery');
if(strpos($plugin,'/')!==false)
{
switch($key)
$tmp = explode("/",$plugin,2);
if(in_array($tmp[0], $legacy))
{
case "profile":
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
return self::getUrl()->create('user/profile/view', $uparams);
break;
case "settings":
// code
break;
return self::getUrl()->create($plugin, $key, $row);
}
}
*/
// shorthand - for internal use.
$plugin = $tmp[0];
$row = $key;
$key = $tmp[1];
}
$tmp = e107::getAddonConfig('e_url');
$tp = e107::getParser();

View 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;
}
}

View File

@@ -13,7 +13,7 @@
<link url='admin_download.php?mirror' description='' icon='images/downloads_32.png' iconSmall=''>DOWLAN_128</link>
</adminLinks>
<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>
<mainPrefs>
<pref name="download_php"></pref>

View File

@@ -23,6 +23,7 @@ $sublink_type['forum']['url'] = "{e_PLUGIN}forum/forum_viewforum.php?#";
$sublink_type['forum']['fieldid'] = 'forum_id';
$sublink_type['forum']['fieldname'] = 'forum_name';
$sublink_type['forum']['fielddiz'] = 'forum_description';
$sublink_type['forum']['sef'] = 'forum/forum';
?>

View 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;
}
}

View File

@@ -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>
</adminLinks>
<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>
<mainPrefs>
</mainPrefs>

View File

@@ -1234,6 +1234,10 @@ li.rssRow > div {
.tab-content #plugin,
.tab-content #theme { padding-top:20px }
.alert-warning pre { color: white }
/*
body { background-color: rgb(68, 68, 68); }