mirror of
https://github.com/e107inc/e107.git
synced 2025-07-09 17:16:20 +02:00
introducing JS Manager handler - work in progress
This commit is contained in:
@ -55,6 +55,13 @@
|
|||||||
<core name='displaysql'>0</core>
|
<core name='displaysql'>0</core>
|
||||||
<core name='displaythemeinfo'>0</core>
|
<core name='displaythemeinfo'>0</core>
|
||||||
<core name='download_email'>0</core>
|
<core name='download_email'>0</core>
|
||||||
|
<core name='e_jslib_core'><![CDATA[array (
|
||||||
|
'prototype/prototype.js' => 'all',
|
||||||
|
'scriptaculous/scriptaculous.js' => 'all',
|
||||||
|
'scriptaculous/effects.js' => 'all',
|
||||||
|
'e107.js.php' => 'all',
|
||||||
|
)]]></core>
|
||||||
|
<core name='e_jslib_plugin'><![CDATA[array ()]]></core>
|
||||||
<core name='email_notify'>0</core>
|
<core name='email_notify'>0</core>
|
||||||
<core name='email_text'></core>
|
<core name='email_text'></core>
|
||||||
<core name='emotepack'>default</core>
|
<core name='emotepack'>default</core>
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
* Text processing and parsing functions
|
* Text processing and parsing functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
||||||
* $Revision: 1.62 $
|
* $Revision: 1.63 $
|
||||||
* $Date: 2009-09-12 18:20:23 $
|
* $Date: 2009-09-28 19:17:58 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1293,12 +1293,20 @@ class e_parse
|
|||||||
return $matches[1];
|
return $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and substitute e107 constants in passed URL
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @param string $mode 0-folders, 1-relative, 2-absolute, 3-full (with domain), 4-absolute & relative (combination of 1,2,3)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
function createConstants($url, $mode=0)
|
function createConstants($url, $mode=0)
|
||||||
{
|
{
|
||||||
//FIXME - create constants for absolute paths and site URL's
|
//FIXME - create constants for absolute paths and site URL's
|
||||||
if($mode == 0) // folder name only.
|
|
||||||
{
|
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
switch($mode)
|
||||||
|
{
|
||||||
|
case 0: // folder name only.
|
||||||
$tmp = array(
|
$tmp = array(
|
||||||
'{e_IMAGE}' => $e107->getFolder('images'),
|
'{e_IMAGE}' => $e107->getFolder('images'),
|
||||||
'{e_PLUGIN}' => $e107->getFolder('plugins'),
|
'{e_PLUGIN}' => $e107->getFolder('plugins'),
|
||||||
@ -1308,9 +1316,9 @@ class e_parse
|
|||||||
'{e_ADMIN}' => $e107->getFolder('admin'),
|
'{e_ADMIN}' => $e107->getFolder('admin'),
|
||||||
'{e_HANDLER}' => $e107->getFolder('handlers')
|
'{e_HANDLER}' => $e107->getFolder('handlers')
|
||||||
);
|
);
|
||||||
}
|
break;
|
||||||
elseif($mode == 1) // relative path
|
|
||||||
{
|
case 1: // relative path only
|
||||||
$tmp = array(
|
$tmp = array(
|
||||||
'{e_IMAGE}' => e_IMAGE,
|
'{e_IMAGE}' => e_IMAGE,
|
||||||
'{e_PLUGIN}' => e_PLUGIN,
|
'{e_PLUGIN}' => e_PLUGIN,
|
||||||
@ -1320,7 +1328,44 @@ class e_parse
|
|||||||
'{e_ADMIN}' => e_ADMIN,
|
'{e_ADMIN}' => e_ADMIN,
|
||||||
'{e_HANDLER}' => e_HANDLER
|
'{e_HANDLER}' => e_HANDLER
|
||||||
);
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // absolute path only
|
||||||
|
$tmp = array(
|
||||||
|
'{e_IMAGE}' => e_IMAGE_ABS,
|
||||||
|
'{e_PLUGIN}' => e_PLUGIN_ABS,
|
||||||
|
'{e_FILE}' => e_FILE_ABS,
|
||||||
|
'{e_THEME}' => e_THEME_ABS,
|
||||||
|
'{e_DOWNLOAD}' => e_DOWNLOAD_ABS,
|
||||||
|
'{e_ADMIN}' => e_ADMIN_ABS,
|
||||||
|
'{e_HANDLER}' => e_HANDLER_ABS
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // full path (e.g http://domain.com/e107_images/)
|
||||||
|
$tmp = array(
|
||||||
|
'{e_IMAGE}' => SITEURL.$e107->getFolder('images'),
|
||||||
|
'{e_PLUGIN}' => SITEURL.$e107->getFolder('plugins'),
|
||||||
|
'{e_FILE}' => SITEURL.$e107->getFolder('files'),
|
||||||
|
'{e_THEME}' => SITEURL.$e107->getFolder('themes'),
|
||||||
|
'{e_DOWNLOAD}' => SITEURL.$e107->getFolder('downloads'),
|
||||||
|
'{e_ADMIN}' => SITEURL.$e107->getFolder('admin'),
|
||||||
|
'{e_HANDLER}' => SITEURL.$e107->getFolder('handlers')
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // absolute & relative paths
|
||||||
|
$url = $this->replaceConstants($url, 3);
|
||||||
|
$url = $this->replaceConstants($url, 2);
|
||||||
|
$url = $this->replaceConstants($url, 1);
|
||||||
|
return $url;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$tmp = array();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($tmp as $key=>$val)
|
foreach($tmp as $key=>$val)
|
||||||
{
|
{
|
||||||
$len = strlen($val);
|
$len = strlen($val);
|
||||||
|
428
e107_handlers/js_manager.php
Normal file
428
e107_handlers/js_manager.php
Normal file
@ -0,0 +1,428 @@
|
|||||||
|
<?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://gnu.org).
|
||||||
|
*
|
||||||
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_manager.php,v $
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
* $Date: 2009-09-28 19:17:59 $
|
||||||
|
* $Author: secretr $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
global $pref, $eplug_admin, $THEME_JSLIB, $THEME_CORE_JSLIB;
|
||||||
|
|
||||||
|
class e_js_manager
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Core JS library files, loaded via e_jslib.php
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_e_jslib_core = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin JS library files, loaded via e_jslib.php
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_e_jslib_plugin = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS files array - loaded in page header
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_runtime_header = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS code array - loaded in page header
|
||||||
|
* after all registered JS header files
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_runtime_header_src = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS files array - loaded in page footer
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_runtime_footer = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS code array - loaded in page footer
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_runtime_footer_src = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All registered JS files
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_js_all = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime location
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_in_admin = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance
|
||||||
|
* Allow class extends - override {@link getInstance()}
|
||||||
|
*
|
||||||
|
* @var e_js_manager
|
||||||
|
*/
|
||||||
|
protected static $_instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* Use {@link getInstance()}, direct instantiating
|
||||||
|
* is not possible for signleton objects
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloning is not allowed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private function __clone()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get singleton instance
|
||||||
|
*
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if(null == self::$_instance)
|
||||||
|
{
|
||||||
|
self::$_instance = new self();
|
||||||
|
}
|
||||||
|
return self::$_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get and parse core preference values
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function _init()
|
||||||
|
{
|
||||||
|
$core_list = e107::getPref('e_jslib_core');
|
||||||
|
if(!$core_list)
|
||||||
|
{
|
||||||
|
$core_list = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Core JS library file(s) for inclusion from e_jslib routine
|
||||||
|
*
|
||||||
|
* @param string|array $file_path relative to e107_files/jslib/ folder or array in format path - runtime location
|
||||||
|
* @param string $runtime_location where should be JS used
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function coreLib($file_path, $runtime_location = 'front')
|
||||||
|
{
|
||||||
|
$this->addJs('core', $file_path, $runtime_location);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Core JS library file(s) for inclusion from e_jslib routine
|
||||||
|
*
|
||||||
|
* @param string $plugname
|
||||||
|
* @param string|array $file_path relative to e107_plugins/myplug/jslib/ folder or array in format path - runtime location
|
||||||
|
* @param string $runtime_location admin|front|all - where should be JS used
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function pluginLib($plugname, $file_path, $runtime_location = 'front')
|
||||||
|
{
|
||||||
|
$this->addJs('plugin', array($plugname, $file_path), $runtime_location);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add JS file(s) for inclusion in site header
|
||||||
|
*
|
||||||
|
* @param string|array $file_path path shortcodes usage is prefered
|
||||||
|
* @param integer $zone 1-5 (see header.php)
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function headerFile($file_path, $zone = 5)
|
||||||
|
{
|
||||||
|
$this->addJs('header', $file_path, $zone);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add JS file(s) for inclusion in site footer
|
||||||
|
*
|
||||||
|
* @param string|array $file_path path shortcodes usage is prefered
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function footerFile($file_path)
|
||||||
|
{
|
||||||
|
$this->addJs('footer', $file_path);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add JS file(s) for inclusion in site header
|
||||||
|
*
|
||||||
|
* @param string|array $js_content path shortcodes usage is prefered
|
||||||
|
* @param integer $zone 1-5 (see header.php)
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function headerInline($js_content, $zone = 5)
|
||||||
|
{
|
||||||
|
$this->addJs('header_inline', $js_content, $zone);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add JS file(s) for inclusion in site footer
|
||||||
|
*
|
||||||
|
* @param string|array $js_content path shortcodes usage is prefered
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function footerInline($js_content)
|
||||||
|
{
|
||||||
|
$this->addJs('footer_inline', $js_content);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require JS file(s). Access could be changed to private soon so don't use this
|
||||||
|
* directly. Use corresponding proxy methods instead
|
||||||
|
*
|
||||||
|
* @see requirePluginLib()
|
||||||
|
* @see requireCoreLib()
|
||||||
|
* @param string $type core|plugin - jslib.php, header|footer|header_inline|footer_inline - runtime
|
||||||
|
* @param string|array $file_path
|
||||||
|
* @param string|integer $runtime_location admin|front|all (jslib), 0-5 (runtime inclusion)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public function addJs($type, $file_path, $runtime_location = '')
|
||||||
|
{
|
||||||
|
if(is_array($file_path))
|
||||||
|
{
|
||||||
|
foreach ($file_path as $fp => $loc)
|
||||||
|
{
|
||||||
|
$this->requireLib($type, $fp, $loc);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$runtime = false;
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'core':
|
||||||
|
$file_path = '{e_FILE}jslib/'.trim($file_path, '/');
|
||||||
|
$registry = &$this->_e_jslib_core;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'plugin':
|
||||||
|
$file_path = '{e_PLUGIN}jslib/'.$file_path[0].'/'.trim($file_path[1], '/');
|
||||||
|
$registry = &$this->_e_jslib_plugin;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'header':
|
||||||
|
$file_path = $tp->createConstants($file_path, 4);
|
||||||
|
$zone = intval($runtime_location);
|
||||||
|
if($zone > 5 || $zone < 1)
|
||||||
|
{
|
||||||
|
$zone = 5;
|
||||||
|
}
|
||||||
|
if(!isset($this->_runtime_header[$zone]))
|
||||||
|
{
|
||||||
|
$this->_runtime_header[$zone] = array();
|
||||||
|
}
|
||||||
|
$registry = &$this->_runtime_header[$zone];
|
||||||
|
$runtime = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'footer':
|
||||||
|
$file_path = $tp->createConstants($file_path, 4);
|
||||||
|
$registry = &$this->_runtime_footer_src;
|
||||||
|
$runtime = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'header_inline':
|
||||||
|
$file_path = $tp->createConstants($file_path, 4);
|
||||||
|
$zone = intval($runtime_location);
|
||||||
|
if($zone > 5 || $zone < 1)
|
||||||
|
{
|
||||||
|
$zone = 5;
|
||||||
|
}
|
||||||
|
if(!isset($this->_runtime_header_src[$zone]))
|
||||||
|
{
|
||||||
|
$this->_runtime_header_src[$zone] = array();
|
||||||
|
}
|
||||||
|
$registry = &$this->_runtime_header_src[$zone];
|
||||||
|
$runtime = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'footer_inline':
|
||||||
|
$file_path = $tp->createConstants($file_path, 4);
|
||||||
|
$registry = &$this->_runtime_footer;
|
||||||
|
$runtime = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return $this;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array($file_path, $this->_js_all) || (!$runtime && $runtime_location != 'all' && $runtime_location != $this->getCurrentLocation()))
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
$this->_js_all[] = $file_path;
|
||||||
|
$registry[] = $file_path;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render registered JS
|
||||||
|
*
|
||||||
|
* @param string $what core|plugin|header|footer|header_inline|footer_inline
|
||||||
|
* @param integer $zone 1-5 - only needed when in 'header' and 'header_inline' render mode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public function renderJs($what, $zone = 5)
|
||||||
|
{
|
||||||
|
switch($what)
|
||||||
|
{
|
||||||
|
case 'core':
|
||||||
|
$this->renderFile($this->_e_jslib_core);
|
||||||
|
$this->_e_jslib_core = array();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'plugin':
|
||||||
|
$this->renderFile($this->_e_jslib_plugin);
|
||||||
|
$this->_e_jslib_plugin = array();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'header':
|
||||||
|
$this->renderFile(varsettrue($this->_runtime_header[$zone], array()));
|
||||||
|
unset($this->_runtime_header[$zone]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'footer':
|
||||||
|
$this->renderInline($this->_runtime_footer);
|
||||||
|
$this->_runtime_footer = array();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'header_inline':
|
||||||
|
$this->renderInline(varsettrue($this->_runtime_header_src[$zone], array()));
|
||||||
|
unset($this->_runtime_header_src[$zone]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'footer_inline':
|
||||||
|
$this->renderInline($this->_runtime_footer_src);
|
||||||
|
$this->_runtime_footer_src = array();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render JS file array
|
||||||
|
* TODO - option to output <script src='$path'>
|
||||||
|
*
|
||||||
|
* @param array $file_path_array
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public function renderFile($file_path_array)
|
||||||
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
echo "\n\n";
|
||||||
|
foreach ($file_path_array as $path)
|
||||||
|
{
|
||||||
|
if (substr($path, - 4) == '.php')
|
||||||
|
{
|
||||||
|
include_once($tp->replaceConstants($text, ''));
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo file_get_contents($tp->replaceConstants($text, ''));
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render JS source array
|
||||||
|
* @param object $js_content_array
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public function renderInline($js_content_array)
|
||||||
|
{
|
||||||
|
if(empty($js_content_array))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
echo "\n\n";
|
||||||
|
echo '<script type="text/javascript">';
|
||||||
|
foreach ($file_path_array as $js_content)
|
||||||
|
{
|
||||||
|
echo $js_content;
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
echo '</script>';
|
||||||
|
echo "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if currently running in
|
||||||
|
* administration area.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isInAdmin()
|
||||||
|
{
|
||||||
|
return $this->_in_admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set current script location
|
||||||
|
*
|
||||||
|
* @param object $is true - back-end, false - front-end
|
||||||
|
* @return e_js_manager
|
||||||
|
*/
|
||||||
|
public function setInAdmin($is)
|
||||||
|
{
|
||||||
|
$this->_in_admin = (boolean) $is;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current location as a string (admin|front)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrentLocation()
|
||||||
|
{
|
||||||
|
return ($this->isInAdmin() ? 'admin' : 'front');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -7,8 +7,8 @@
|
|||||||
* GNU General Public License (http://gnu.org).
|
* GNU General Public License (http://gnu.org).
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/jslib_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/jslib_handler.php,v $
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
* $Date: 2008-11-21 16:24:48 $
|
* $Date: 2009-09-28 19:17:58 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -45,11 +45,11 @@ class e_jslib
|
|||||||
header('Content-type: text/javascript', TRUE);
|
header('Content-type: text/javascript', TRUE);
|
||||||
|
|
||||||
//array - uses the same format as $core_jslib
|
//array - uses the same format as $core_jslib
|
||||||
if (! varset($THEME_CORE_JSLIB) || ! is_array($THEME_CORE_JSLIB))
|
if (!isset($THEME_CORE_JSLIB) || ! is_array($THEME_CORE_JSLIB))
|
||||||
$THEME_CORE_JSLIB = array();
|
$THEME_CORE_JSLIB = array();
|
||||||
|
|
||||||
//array - uses the same format as $core_jslib
|
//array - uses the same format as $core_jslib
|
||||||
if (! varset($THEME_JSLIB) || ! is_array($THEME_JSLIB))
|
if (!isset($THEME_JSLIB) || ! is_array($THEME_JSLIB))
|
||||||
$THEME_JSLIB = array();
|
$THEME_JSLIB = array();
|
||||||
|
|
||||||
//available values - admin,front,all,none
|
//available values - admin,front,all,none
|
||||||
@ -61,7 +61,7 @@ class e_jslib
|
|||||||
//'jslib/core/decorate.js' => 'all'
|
//'jslib/core/decorate.js' => 'all'
|
||||||
);
|
);
|
||||||
|
|
||||||
$core_jslib = array_merge($core_jslib, $THEME_CORE_JSLIB, varsettrue($pref['e_jslib']['core'], array()));
|
$core_jslib = array_merge($core_jslib, $THEME_CORE_JSLIB, varsettrue($pref['e_jslib_core'], array()));
|
||||||
$where_now = $eplug_admin ? 'admin' : 'front';
|
$where_now = $eplug_admin ? 'admin' : 'front';
|
||||||
|
|
||||||
//1. Core libs - prototype + scriptaculous effects
|
//1. Core libs - prototype + scriptaculous effects
|
||||||
|
39
index.php
39
index.php
@ -1,24 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
* e107 website system
|
||||||
| e107 website system
|
*
|
||||||
|
|
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||||
| Copyright (C) 2001-2009 e107 Inc
|
* Released under the terms and conditions of the
|
||||||
| http://e107.org
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
|
*
|
||||||
|
|
* News frontend
|
||||||
| Released under the terms and conditions of the
|
*
|
||||||
| GNU General Public License (http://gnu.org).
|
* $Source: /cvs_backup/e107_0.8/index.php,v $
|
||||||
|
|
* $Revision: 1.7 $
|
||||||
| $Source: /cvs_backup/e107_0.8/index.php,v $
|
* $Date: 2009-09-28 19:17:59 $
|
||||||
| $Revision: 1.6 $
|
* $Author: secretr $
|
||||||
| $Date: 2009-07-14 05:31:57 $
|
|
||||||
| $Author: e107coders $
|
|
||||||
|
|
||||||
Mods for prioritised system
|
|
||||||
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once ('class2.php');
|
require_once ('class2.php');
|
||||||
@ -28,7 +21,6 @@ if (file_exists('index_include.php'))
|
|||||||
include ('index_include.php');
|
include ('index_include.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$query = (e_QUERY && e_QUERY != '' && !$_GET['elan']) ? '?'.e_QUERY : '';
|
$query = (e_QUERY && e_QUERY != '' && !$_GET['elan']) ? '?'.e_QUERY : '';
|
||||||
$location = '';
|
$location = '';
|
||||||
|
|
||||||
@ -38,10 +30,8 @@ if ($pref['membersonly_enabled'] && !USER)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$class_list = explode(',', USERCLASS_LIST);
|
$class_list = explode(',', USERCLASS_LIST);
|
||||||
|
|
||||||
|
|
||||||
if (isset($pref['frontpage']['all']) && $pref['frontpage']['all'])
|
if (isset($pref['frontpage']['all']) && $pref['frontpage']['all'])
|
||||||
{ // 0.7 method
|
{ // 0.7 method
|
||||||
$location = ((strpos($pref['frontpage']['all'], 'http') === FALSE) ? e_BASE : '').$pref['frontpage']['all'].$query;
|
$location = ((strpos($pref['frontpage']['all'], 'http') === FALSE) ? e_BASE : '').$pref['frontpage']['all'].$query;
|
||||||
@ -66,7 +56,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$location)
|
if (!$location)
|
||||||
{ // Try and use the 'old' method (this bit can go later)
|
{ // Try and use the 'old' method (this bit can go later)
|
||||||
if (ADMIN)
|
if (ADMIN)
|
||||||
@ -93,8 +82,8 @@ if (!$location)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trim($location)) $location = 'news.php';
|
if (!trim($location))
|
||||||
|
$location = 'news.php';
|
||||||
|
|
||||||
list($page, $str) = explode("?", $location."?"); // required to prevent infinite looping when queries are used on index.php.
|
list($page, $str) = explode("?", $location."?"); // required to prevent infinite looping when queries are used on index.php.
|
||||||
if ($page == "index.php") // Welcome Message is the front-page.
|
if ($page == "index.php") // Welcome Message is the front-page.
|
||||||
|
Reference in New Issue
Block a user