mirror of
https://github.com/e107inc/e107.git
synced 2025-05-03 10:49:12 +02:00
Begin addition of url class and implementation
This commit is contained in:
parent
a4a9f60780
commit
b4ee6786c6
16
class2.php
16
class2.php
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
| $Revision: 1.70 $
|
||||
| $Date: 2008-11-21 11:08:53 $
|
||||
| $Author: secretr $
|
||||
| $Revision: 1.71 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
//
|
||||
@ -177,11 +177,13 @@ if(!isset($ADMIN_DIRECTORY))
|
||||
}
|
||||
|
||||
//
|
||||
// clever stuff that figures out where the paths are on the fly.. no more need fo hard-coded e_HTTP :)
|
||||
// clever stuff that figures out where the paths are on the fly.. no more need for hard-coded e_HTTP :)
|
||||
//
|
||||
e107_require_once(realpath(dirname(__FILE__).'/'.$HANDLERS_DIRECTORY).'/e107_class.php');
|
||||
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY');
|
||||
$e107 = new e107($e107_paths, realpath(dirname(__FILE__)));
|
||||
$e107 = e107::getInstance();
|
||||
$e107->_init($e107_paths, realpath(dirname(__FILE__)));
|
||||
//$e107 = new e107($e107_paths, realpath(dirname(__FILE__)));
|
||||
|
||||
$inArray = array("'", ";", "/**/", "/UNION/", "/SELECT/", "AS ");
|
||||
if (strpos($_SERVER['PHP_SELF'], "trackback") === false) {
|
||||
@ -218,8 +220,12 @@ if (preg_match("#\[(.*?)](.*)#", $_SERVER['QUERY_STRING'], $matches)) {
|
||||
// Start the parser; use it to grab the full query string
|
||||
//
|
||||
|
||||
e107_require_once(e_HANDLER.'e107Url.php');
|
||||
$e107->url = new eURL;
|
||||
|
||||
e107_require_once(e_HANDLER.'e_parse_class.php');
|
||||
$tp = new e_parse;
|
||||
$e107->tp = &$tp;
|
||||
|
||||
//define("e_QUERY", $matches[2]);
|
||||
//define("e_QUERY", $_SERVER['QUERY_STRING']);
|
||||
|
17
e107_files/shortcode/url.sc
Executable file
17
e107_files/shortcode/url.sc
Executable file
@ -0,0 +1,17 @@
|
||||
// $Id: url.sc,v 1.1 2008-11-24 18:06:03 mcfly_e107 Exp $
|
||||
$e107 = e107::getInstance();
|
||||
list($part, $section, $type, $parms) = explode('::', $parm, 4);
|
||||
if(strpos('=', $parms) !== false)
|
||||
{
|
||||
parse_str($parms, $p);
|
||||
}
|
||||
else
|
||||
{
|
||||
$p[$parms] = 1;
|
||||
}
|
||||
$e107->url->core = ($part == 'core');
|
||||
if($e107->url->createURL($section, $type, $p))
|
||||
{
|
||||
return $e107->url->link;
|
||||
}
|
||||
return 'Failed';
|
66
e107_handlers/e107Url.php
Executable file
66
e107_handlers/e107Url.php
Executable file
@ -0,0 +1,66 @@
|
||||
<?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.1 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
class eURL
|
||||
{
|
||||
|
||||
var $core = false;
|
||||
var $link = '';
|
||||
|
||||
function createURL($section, $urlType, $urlItems)
|
||||
{
|
||||
if(!is_array($urlItems))
|
||||
{
|
||||
$urlItems = array($urlItems => 1);
|
||||
}
|
||||
$functionName = 'url_'.$section.'_'.$urlType;
|
||||
if(!function_exists($functionName))
|
||||
{
|
||||
$fileName = ($this->core ? e_FILE."url/custom/base/{$section}/{$urlType}.php" : e_FILE."url/custom/plugins/{$section}/{$urlType}.php");
|
||||
if(is_readable($fileName))
|
||||
{
|
||||
include_once($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = ($this->core ? e_FILE."url/base/{$section}/{$urlType}.php" : e_PLUGIN."{$section}/url/{$urlType}.php");
|
||||
if(is_readable($fileName))
|
||||
{
|
||||
include_once($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!function_exists($functionName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->link = call_user_func($functionName, $urlItems))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||
| $Revision: 1.21 $
|
||||
| $Date: 2008-11-23 20:26:23 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.22 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -34,6 +34,7 @@ class e107
|
||||
var $relative_base_path;
|
||||
var $_ip_cache;
|
||||
var $_host_name_cache;
|
||||
|
||||
/**
|
||||
* e107 class constructor
|
||||
*
|
||||
@ -42,12 +43,38 @@ class e107
|
||||
* @return e107
|
||||
*/
|
||||
function e107($e107_paths, $e107_root_path)
|
||||
{
|
||||
if(!defsettrue('e107_php4_check'))
|
||||
{
|
||||
echo ('Fatal error! You are not allowed to direct instantinate an object for singleton class! Please use e107::getInstance()');
|
||||
exit();
|
||||
}
|
||||
$this->_init($e107_paths, $e107_root_path);
|
||||
}
|
||||
|
||||
function _init($e107_paths, $e107_root_path)
|
||||
{
|
||||
$this->e107_dirs = $e107_paths;
|
||||
$this->set_paths();
|
||||
$this->file_path = $this->fix_windows_paths($e107_root_path)."/";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get instance - php4 singleton implementation
|
||||
*
|
||||
* @return singleton object
|
||||
*/
|
||||
function &getInstance()
|
||||
{
|
||||
static $instance = array();//it's array because of an odd PHP 4 bug
|
||||
|
||||
if(!$instance)
|
||||
{
|
||||
define('e107_php4_check', true);
|
||||
$instance[0] = new e107();
|
||||
}
|
||||
return $instance[0];
|
||||
}
|
||||
|
||||
function set_base_path()
|
||||
{
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_shortcodes.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2007-09-22 17:41:20 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -350,10 +350,15 @@ if($pm_info['pm_to'] == USERID)
|
||||
SC_END
|
||||
|
||||
SC_BEGIN SEND_PM_LINK
|
||||
$e107 = e107::getInstance();
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if($pm_outbox['outbox']['filled'] < 100)
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?send'>".PM_SEND_LINK."</a>";
|
||||
$e107->url->core = false;
|
||||
if($e107->url->createUrl('pm','main','send'))
|
||||
{
|
||||
return "<a href='{$e107->url->link}'>".PM_SEND_LINK."</a>";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
SC_END
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-07-28 20:16:14 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-11-24 18:06:03 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -47,14 +47,14 @@ $sc_style['NEWPM_ANIMATE']['post'] = "</a>";
|
||||
if(!isset($pm_menu_template))
|
||||
{
|
||||
$pm_menu_template = "
|
||||
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".PM_INBOX_ICON."</a>
|
||||
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".LAN_PM_25."</a>
|
||||
<a href='{URL=plugin::pm::main::box=inbox}'>".PM_INBOX_ICON."</a>
|
||||
<a href='{URL=plugin::pm::main::box=inbox}'>".LAN_PM_25."</a>
|
||||
{NEWPM_ANIMATE}
|
||||
<br />
|
||||
{INBOX_TOTAL} ".LAN_PM_36.", {INBOX_UNREAD} ".LAN_PM_37." {INBOX_FILLED}
|
||||
<br />
|
||||
<a href='".e_PLUGIN_ABS."pm/pm.php?outbox'>".PM_OUTBOX_ICON."</a>
|
||||
<a href='".e_PLUGIN_ABS."pm/pm.php?outbox'>".LAN_PM_26."</a><br />
|
||||
<a href='{URL=plugin::pm::main::box=outbox}'>".PM_OUTBOX_ICON."</a>
|
||||
<a href='{URL=plugin::pm::main::box=outbox}'>".LAN_PM_26."</a><br />
|
||||
{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
|
||||
{SEND_PM_LINK}
|
||||
";
|
||||
|
15
e107_plugins/pm/url/main.php
Executable file
15
e107_plugins/pm/url/main.php
Executable file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
function url_pm_main($parms)
|
||||
{
|
||||
if(isset($parms['box']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?{$parms['box']}";
|
||||
}
|
||||
|
||||
if(isset($parms['send']))
|
||||
{
|
||||
return e_PLUGIN_ABS."pm/pm.php?send";
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user