1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

eURL improvements & Administration area

This commit is contained in:
secretr 2008-12-02 00:32:30 +00:00
parent 6592bfad67
commit bac34fa23b
7 changed files with 407 additions and 110 deletions

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/ad_links.php,v $
| $Revision: 1.6 $
| $Date: 2008-11-14 06:01:06 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Admin Navigation
*
* $Source: /cvs_backup/e107_0.8/e107_admin/ad_links.php,v $
* $Revision: 1.7 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }
@ -194,6 +191,9 @@ if (!defined('E_16_SEARCH')) {
if (!defined('E_16_UPLOADS')) {
define('E_16_UPLOADS', "<img src='".e_IMAGE."admin_images/uploads_16.png' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />");
}
if (!defined('E_16_EURL')) {
define('E_16_EURL', "<img src='".e_IMAGE."admin_images/eurl_16.png' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />");
}
if (!defined('E_16_USER')) {
define('E_16_USER', "<img src='".e_IMAGE."admin_images/users_16.png' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />");
}
@ -321,6 +321,9 @@ if (!defined('E_32_SEARCH')) {
if (!defined('E_32_UPLOADS')) {
define('E_32_UPLOADS', "<img src='".e_IMAGE."admin_images/uploads_32.png' alt='' style='border:0px; width: 32px; height: 32px' />");
}
if (!defined('E_32_EURL')) {
define('E_32_EURL', "<img src='".e_IMAGE."admin_images/eurl_32.png' alt='' style='border:0px; width: 32px; height: 32px' />");
}
if (!defined('E_32_USER')) {
define('E_32_USER', "<img src='".e_IMAGE."admin_images/users_32.png' alt='' style='border:0px; width: 32px; height: 32px' />");
}
@ -398,6 +401,7 @@ $e_icon_array = array(
'theme_manage' => E_32_THEMEMANAGER,
'maintain' => E_32_MAINTAIN,
'upload' => E_32_UPLOADS,
'eurl' => E_32_EURL,
'userclass' => E_32_USERCLASS,
'user_extended' => E_32_USER_EXTENDED,
'users' => E_32_USER,
@ -476,6 +480,7 @@ $array_functions = array(
28 => array(e_ADMIN."users_extended.php", ADLAN_78, ADLAN_79, "4", 2, E_16_USER_EXTENDED, E_32_USER_EXTENDED),
29 => array(e_ADMIN."fileinspector.php", ADLAN_147, ADLAN_148, "Y", 4, E_16_INSPECT, E_32_INSPECT),
30 => array(e_ADMIN."notify.php", ADLAN_149, ADLAN_150, "O", 4, E_16_NOTIFY, E_32_NOTIFY),
31 => array(e_ADMIN."cron.php", ADLAN_157, ADLAN_158, "U", 4, E_16_CRON, E_32_CRON)
31 => array(e_ADMIN."cron.php", ADLAN_157, ADLAN_158, "U", 4, E_16_CRON, E_32_CRON),
32 => array(e_ADMIN."eurl.php", ADLAN_159, ADLAN_160, "L", 1, E_16_EURL, E_32_EURL)
);
?>

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/administrator.php,v $
| $Revision: 1.8 $
| $Date: 2008-11-14 06:01:06 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Administrators Management
*
* $Source: /cvs_backup/e107_0.8/e107_admin/administrator.php,v $
* $Revision: 1.9 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
require_once('../class2.php');
if (!getperms('3'))
@ -236,9 +233,9 @@ function edit_administrator($row)
$text .= checkb("I", $a_perms).ADMSLAN_40."<br />"; // Post links
// $text .= checkb("J", $a_perms).ADMSLAN_41."<br />"; // Post articles - NOW PLUGIN
// $text .= checkb("K", $a_perms).ADMSLAN_42."<br />"; // Post reviews - NOW PLUGIN
// $text .= checkb("L", $a_perms).ADMSLAN_43."<br />"; // Post content pages - NOW PLUGIN
$text .= checkb("L", $a_perms).ADMSLAN_43."<br />"; // Configure URLs
$text .= checkb("R", $a_perms).ADMSLAN_44."<br />"; // Post downloads
$text .= checkb("U", $a_perms).ADMSLAN_45."<br />"; // Post polls
$text .= checkb("U", $a_perms).ADMSLAN_45."<br />"; // Schedule Tasks
$text .= checkb("M", $a_perms).ADMSLAN_46."<br />"; // Welcome message
$text .= checkb("N", $a_perms).ADMSLAN_47."<br /><br />"; // Moderate submitted news

262
e107_admin/eurl.php Normal file
View File

@ -0,0 +1,262 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* URL Management
*
* $Source: /cvs_backup/e107_0.8/e107_admin/eurl.php,v $
* $Revision: 1.1 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
require_once('../class2.php');
/*if (!getperms('')) { FIXME
header('location:'.e_BASE.'index.php');
exit;
}*/
$e_sub_cat = 'eurl';
require_once(e_ADMIN.'auth.php');
$urlc = new admin_url_config();
if (isset($_POST['update']))
{
$res = $urlc->update();
$plug_message = $res ? LAN_UPDATED : ($res === 0 ? LAN_NO_CHANGE : LAN_UPDATED_FAILED);
$plug_message = "<div class='center clear'>".$plug_message."</div><br />";
}
//var_dump($pref['url_config'], $e107->url->getUrl('pm', 'main', array('f'=>'box', 'box'=>2)));
$urlc->renderPage();
require_once(e_ADMIN.'footer.php');
class admin_url_config {
var $_rs;
var $_plug;
var $_api;
function admin_url_config()
{
global $e107;
require_once(e_HANDLER.'plugin_class.php');
require_once(e_HANDLER.'file_class.php');
require_once(e_HANDLER.'form_handler.php');
$this->_rs = new form();
$this->_plug = new e107plugin();
$this->_fl = new e_file();
$this->_api = &$e107;
}
function renderPage() {
global $plug_message;
$text = "<div class='center'>
{$plug_message}
<form action='".e_SELF."' method='post' id='urlconfig-form'>
<table style='".ADMIN_WIDTH."' class='fborder admin-config'>
";
$text .= "
<tbody>
<tr>
<td colspan='2' class='forumheader'>Configure Core URLs</td>
</tr>";
$text .= $this->render_sections('core');
$text .= "
<tr>
<td colspan='2' class='forumheader'>Configure Plugin URLs</td>
</tr>";
$text .= $this->render_sections('plugin');
$text .= "
<tr>
<td colspan='2' class='forumheader tfoot center'>".$this->_rs->form_button('submit', 'update', LAN_UPDATE)."</td>
</tr>
</tbody>
</table>
</form>
</div>";
$this->_api->ns->tablerender('Manage Site URLs', $text);
}
function render_sections($id) {
if($id == 'core') {
$sections = $this->get_core_sections();
} else {
$sections = $this->_plug->getall(1);
}
$ret = '';
foreach ($sections as $section) {
if($id == 'core' && !is_readable(e_FILE.'e_url/core/'.$section['core_path'])) continue;
elseif($id == 'plugin' && !is_readable(e_PLUGIN.$section['plugin_path'].'/e_url')) continue;
$ret .= $this->render_section($id, $section);
}
return $ret;
}
function render_section($id, $section)
{
$this->normalize($id, $section); //var_dump($id, $section);
$text .= "
<tr>
<td class='forumheader3' style='width: 30%'>{$section['name']}</td>
<td class='forumheader3' style='width: 70%; white-space: nowrap'>
".$this->render_section_radio($id, $section)."
";
$text .= "
</td>
</tr>
";
return $text;
}
function render_section_radio($id, $section)
{
global $pref;
//DEFAULT
$checked_def = varset($pref['url_config'][$section['path']]) ? '' : ' checked="checked"';
$def = "
<input type='radio' id='{$section['path']}-default' name='cprofile[{$section['path']}]' value='0'{$checked_def} />
<label for='{$section['path']}-default'>Default</label>
";
//CUSTOM - CENTRAL REPOSITORY
$udefined_id = $id.'-custom:'.$section['path'];
$udefined_path = e_FILE."e_url/custom/{$id}/{$section['path']}/";
$need_save = false; $checked = false;
$custom = '';
if(is_readable($udefined_path))
{
//Search the central url config repository - one config to rull them all
if($pref['url_config'][$section['path']])
{
$pref['url_config'][$section['path']] = $udefined_id;
$need_save = true;
}
$checked = $pref['url_config'][$section['path']] == $udefined_id ? ' checked="checked"' : '';
$custom = "
<div class='clear'><!-- --></div>
<input type='radio' id='{$section['path']}-custom' name='cprofile[{$section['path']}]' value='{$udefined_id}'{$checked} />
<label for='{$section['path']}-custom'>User Defined Config</label>
<a href='#{$section['path']}-custom-info' class='e-expandit' title='Info'><img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='' /></a>
<div class='e-hideme' id='{$section['path']}-custom-info'>
<div class='indent'>
User defined URL configuration - overrides (disables) all custom configuration profiles.<br />
Remove the User defined configuration folder to enable the custom configuration profiles.<br />
<strong>Location:</strong> ".e_FILE_ABS."e_url/custom/{$id}/{$section['path']}/"."
</div>
</div>
";
}
//CUSTOM PROFILES - PLUGINS ONLY
$config_profiles = ''; $profile_id = '';
if($id == 'plugin')
$profile_path = e_PLUGIN."{$section['path']}/e_url/";
else
$profile_path = e_FILE."e_url/core/{$section['path']}/";
$config_profiles_array = $this->get_plug_profiles($profile_path);
//Search for custom url config released with the plugin
if($config_profiles_array)
{
foreach ($config_profiles_array as $config_profile) {
$profile_id = $id.'-profile:'.$config_profile;
$checked_profile = $pref['url_config'][$section['path']] == $profile_id ? ' checked="checked"' : '';
if($custom) $checked_profile = ' disabled="disabled"';
$config_profiles .= "
<div class='clear'><!-- --></div>
<input type='radio' id='{$section['path']}-profile-{$config_profile}' name='cprofile[{$section['path']}]' value='{$profile_id}'{$checked_profile} />
<label for='{$section['path']}-profile-{$config_profile}'>
Config Profile [{$config_profile}]
</label>
<a href='#{$section['path']}-profile-{$config_profile}-info' class='e-expandit' title='Info'><img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='' /></a>
<div class='e-hideme' id='{$section['path']}-profile-{$config_profile}-info'>
<div class='indent'>
Under Construction - profile.xml<br />
<strong>Location:</strong> ".str_replace(array(e_PLUGIN, e_FILE), array(e_PLUGIN_ABS, e_FILE_ABS), $profile_path)."{$config_profile}/
</div>
</div>
";
}
}
$this->render_shutdown($need_save);
return $def.$config_profiles.$custom;
}
function get_plug_profiles($path)
{
$ret = $this->_fl->get_dirs($path, '', array('CVS', '.svn'));
return $ret;
}
function render_shutdown($now)
{
global $pref;
if($now && !isset($_POST['update']))
{
save_prefs();
}
}
function get_core_sections()
{
$core_def = array(
'news' => array("core_name" => 'News', 'core_path' => 'news'),
'downloads' => array("core_name" => 'Downloads', 'core_path' => 'downloads')
);
return $core_def;
}
function normalize($id, &$section)
{
$tmp = $section;
foreach ($tmp as $k => $v)
{
$section[str_replace($id.'_', '', $k)] = $v;
unset($section[$k]);
}
}
function update()
{
global $pref;
$pref['url_config'] = $_POST['cprofile'];
return save_prefs();
}
}
function headerjs()
{
$js = "
<script type='text/javascript'>
</script>";
return $js;
}
?>

View File

@ -8,8 +8,8 @@
* e107 Javascript API
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
* $Revision: 1.11 $
* $Date: 2008-11-29 23:31:02 $
* $Revision: 1.12 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*
*/
@ -823,7 +823,9 @@ Object.extend(e107Helper, {
var expandthem = event.memo.element ? $(event.memo.element) : $$('body')[0];
expandthem.select('.e-expandit').invoke('observe', 'click', function(e) {
e.stop();
this.toggle(e.element(), {});
var element = e.findElement('a');
if(!element) element = e.element();
this.toggle(element, {});
}.bindAsEventListener(e107Helper));
},

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
| $Revision: 1.7 $
| $Date: 2008-11-26 21:00:23 $
| $Author: secretr $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* URL Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $
* $Revision: 1.8 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
class eURL
@ -28,7 +25,7 @@ class eURL
* @param string $section
* @param string $urlType
* @param string|array $urlItems
* @return string URL
* @return string URL or '#url-not-found' on error
*/
function getUrl($section, $urlType, $urlItems = array())
{
@ -37,7 +34,7 @@ class eURL
$urlItems = array($urlItems => 1);
}
$handlerId = $section . '/' . $urlType; if (!isset($this->_link_handlers[$handlerId]))
$handlerId = $section . '/' . $urlType;
if (!isset($this->_link_handlers[$handlerId]))
{
$this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType);
@ -50,29 +47,62 @@ class eURL
return '#url-not-found';
}
/**
* Parse Request string
*
* @param string $section
* @param string $urlType
* @param string $request
* @return mixed parsed url
*/
function parseUrl($section, $urlType, $request = '')
{
if (empty($request))
{
$request = e_QUERY;
}
$handlerId = $section . '/' . $urlType;
if (!isset($this->_link_handlers[$handlerId]))
{
$this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType);
}
return call_user_func('parse_'.$this->_link_handlers[$handlerId], $request);
}
function _initHandler($section, $urlType)
{
global $pref; //FIXME pref handler, $e107->prefs instance
$core = false;
if (strpos($section, ':') !== false)
if (strpos($section, ':') === false)
{
list($tmp, $section) = explode(':', $section, 2);
$core = ($tmp === 'core');
$section = 'plugin:'.$section;
}
elseif (isset($this->_link_handlers['plugin:'.$section]))
{
return $this->_link_handlers['plugin:'.$section];
}
$handlerId = $section . '/' . $urlType;
list($type, $section) = explode(':', $section, 2);
$handler = 'url_' . $section . '_' . $urlType;
// Check to see if custom code is active and exists
if (varsettrue($pref['url_config'][$section]))
{
// Search the central url config repository - one config to rull them all
$fileName = ($core ? e_FILE."url/custom/base/{$handlerId}.php" : e_FILE."url/custom/plugins/{$handlerId}.php");
$filePath = str_replace(
array(
'core-custom:',
'core-profile:',
'plugin-custom:',
'plugin-profile:'
),
array(
e_FILE.'e_url/custom/core/',
e_FILE.'e_url/core/'.$section.'/',
e_FILE.'e_url/custom/plugin/',
e_PLUGIN.$section.'/e_url/',
),
$pref['url_config'][$section]
);
$fileName = $filePath.'/'.$urlType.'.php';
var_dump('FileName: '.$fileName, $handler);
if (is_readable($fileName))
{
include_once ($fileName);
@ -81,22 +111,12 @@ class eURL
{
return $handler;
}
// Search for custom url config released with the plugin
if (!$core)
{
$fileName = e_PLUGIN."{$section}/url/custom/{$urlType}.php";
if (is_readable($fileName))
{
include_once ($fileName);
}
if (function_exists($handler))
{
return $handler;
}
}
}
// Search the default url config - the last station
$fileName = ($core ? e_FILE."url/base/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
//Search the default url config - the last station
$core = ($type === 'core');
$handlerId = $section . '/' . $urlType;
$fileName = ($core ? e_FILE."url/core/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
if (is_readable($fileName))
{
include_once ($fileName);
@ -111,17 +131,17 @@ class eURL
$e107->url->getCoreUser('user', array('id' => 10));
function __call($method, $arguments) {
if (strpos($method, "getCore") === 0)
{
$section = strtolower(substr($method, 7));
return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1]));
}
elseif (strpos($method, "get") === 0)
{
$section = strtolower(substr($method, 3));
return $this->getUrl($section, varset($arguments[0]), varset($arguments[1]));
}
return '';
if (strpos($method, "getCore") === 0)
{
$section = strtolower(substr($method, 7));
return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1]));
}
elseif (strpos($method, "get") === 0)
{
$section = strtolower(substr($method, 3));
return $this->getUrl($section, varset($arguments[0]), varset($arguments[1]));
}
return '';
}
*/
}

View File

@ -1,13 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_admin.php,v $
| $Revision: 1.9 $
| $Date: 2008-06-29 15:23:43 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Admin Language File
*
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_admin.php,v $
* $Revision: 1.10 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
define("ADLAN_0", "News");
define("ADLAN_1", "Add/edit/delete news items");
@ -181,6 +185,9 @@ define('ADLAN_156', 'Admin log, user audit, rolling log');
define("ADLAN_157", "Schedule Tasks");
define("ADLAN_158", "Cron Jobs and Automated Tasks");
define("ADLAN_159", "URL Configuration");
define("ADLAN_160", "Configure Site URLs");
define('ADLAN_CL_1', 'Settings');
define('ADLAN_CL_2', 'Users');
define('ADLAN_CL_3', 'Content');

View File

@ -1,13 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_administrator.php,v $
| $Revision: 1.4 $
| $Date: 2008-10-20 21:52:38 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Admin Language File
*
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_administrator.php,v $
* $Revision: 1.5 $
* $Date: 2008-12-02 00:32:30 $
* $Author: secretr $
*/
define("ADMSLAN_0", "New user/admin entry created for");
define("ADMSLAN_1", "now has admin status.");
@ -45,9 +49,9 @@ define("ADMSLAN_37", "Moderate comments");
// define("ADMSLAN_38", "Moderate/configure chatbox");
define("ADMSLAN_39", "Post news");
define("ADMSLAN_40", "Post links");
define("ADMSLAN_41", "Post articles");
define("ADMSLAN_42", "Post reviews");
define("ADMSLAN_43", "Post content pages");
//define("ADMSLAN_41", "Post articles"); - NOW PLUGIN
//define("ADMSLAN_42", "Post reviews"); - NOW PLUGIN
define("ADMSLAN_43", "Configure URLs");
define("ADMSLAN_44", "Post downloads");
define("ADMSLAN_45", "Schedule Tasks");
define("ADMSLAN_46", "Welcome message");