diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 5445defff..7985ebeb5 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -1752,13 +1752,13 @@ class news_form_ui extends e_admin_form_ui } } - - $text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]), array('media' => 'news+', 'video' => 1, 'legacyPath' => '{e_IMAGE}newspost_images')); + $text = "
$e107->getMySQLConfig('prefix');
*
- * @param string $for prefix|server|user|password|defaultdb - leave blank for full array.
+ * @param string $for prefix|server|user|password|defaultdb - leave blank for full array.
* @return string or array
*/
public static function getMySQLConfig($for='')
{
$key = 'mySQL'.$for;
$self = self::getInstance();
-
+
if($for == '')
{
return $self->e107_config_mysql_info;
}
-
+
return (isset($self->e107_config_mysql_info[$key]) ? $self->e107_config_mysql_info[$key] : '');
}
-
+
/**
- * Return a unique path based on database used. ie. multi-site support from single install.
+ * Return a unique path based on database used. ie. multi-site support from single install.
*
* @return string
- * @author
+ * @author
*/
function getSitePath()
{
@@ -998,17 +998,17 @@ class e107
*/
public static function getConfig($name = 'core', $load = true, $refresh=false)
{
-
- if(isset(self::$_plug_config_arr[$name])) //FIXME Load pluginPref Object instead - Not quite working with calendar_menu.
+
+ if(isset(self::$_plug_config_arr[$name])) //FIXME Load pluginPref Object instead - Not quite working with calendar_menu.
{
return self::getPlugConfig($name);
}
-
- if(!isset(self::$_core_config_arr[$name]) || ($refresh == true)) // required by update_routines to clear out earlier values.
+
+ if(!isset(self::$_core_config_arr[$name]) || ($refresh == true)) // required by update_routines to clear out earlier values.
{
- e107_require_once(e_HANDLER.'pref_class.php');
- self::$_core_config_arr[$name] = new e_core_pref($name, $load);
-
+ e107_require_once(e_HANDLER.'pref_class.php');
+ self::$_core_config_arr[$name] = new e_core_pref($name, $load);
+
if($name === 'core') // prevent loop between pref and cache handlers.
{
self::getCache()->UserCacheActive = self::getPref('cachestatus');
@@ -1210,11 +1210,11 @@ class e107
return !empty($tprefs) ? $tprefs : $default;
}
-
+
/**
* Set current theme preference. $pref_name is parsed,
* so that $pref_name = 'x/y/z' will set value pref_data[x][y][z]
- *
+ *
* @param string|array $pref_name
* @param mixed $pref_value
* @return e_pref
@@ -1265,7 +1265,7 @@ class e107
/**
* Retrieve text parser singleton object
*
- * @return object e_parse
+ * @return e_parse
*/
public static function getParser()
{
@@ -1275,22 +1275,22 @@ class e107
/**
* Retrieve sc parser singleton object
*
- * @return object e_parse_shortcode
+ * @return e_parse_shortcode
*/
public static function getScParser()
{
return self::getSingleton('e_parse_shortcode', true);
}
-
-
+
+
/**
* Retrieve secure_image singleton object
*
- * @return object secure_image
+ * @return secure_image
*/
public static function getSecureImg()
{
- return self::getSingleton('secure_image', true); // more flexible.
+ return self::getSingleton('secure_image', true); // more flexible.
// return self::getObject('secure_image');
}
@@ -1300,19 +1300,19 @@ class e107
* Override is possible only if class is not already instantiated by shortcode parser
*
* myplugin/shortcodes/batch/my_shortcodes.php
* e107::getScObject('my', 'myplugin');
- *
+ *
* // news override - plugin_myplugin_news_shortcodes extends news_shortcodes -> myplugin/shortcodes/batch/news_shortcodes.php
* e107::getScObject('news', 'myplugin', true);
- *
+ *
* // news override - plugin_myplugin_mynews_shortcodes extends news_shortcodes -> myplugin/shortcodes/batch/mynews_shortcodes.php
* e107::getScObject('news', 'myplugin', 'mynews');
*
@@ -1333,7 +1333,7 @@ class e107
* $instance_id
*
* @param string $instance_id
- * @return object e_db_mysql
+ * @return e_db_mysql
*/
public static function getDb($instance_id = '')
{
@@ -1343,7 +1343,7 @@ class e107
/**
* Retrieve cache singleton object
*
- * @return object ecache
+ * @return ecache
*/
public static function getCache()
{
@@ -1353,7 +1353,7 @@ class e107
/**
* Retrieve bbcode singleton object
*
- * @return object e_bbcode
+ * @return e_bbcode
*/
public static function getBB()
{
@@ -1363,7 +1363,7 @@ class e107
/**
* Retrieve user-session singleton object
*
- * @return object UserHandler
+ * @return UserHandler
*/
public static function getUserSession()
{
@@ -1374,7 +1374,7 @@ class e107
* Retrieve core session singleton object(s)
*
* @param null $namespace
- * @return object e_core_session
+ * @return e_core_session
*/
public static function getSession($namespace = null)
{
@@ -1391,18 +1391,18 @@ class e107
/**
* Retrieve redirection singleton object
*
- * @return object redirection
+ * @return redirection
*/
public static function getRedirect()
{
return self::getSingleton('redirection', true);
}
-
-
+
+
/**
* Retrieve rater singleton object
*
- * @return object rater
+ * @return rater
*/
public static function getRate()
{
@@ -1412,7 +1412,7 @@ class e107
/**
* Retrieve sitelinks singleton object
*
- * @return object sitelinks
+ * @return sitelinks
*/
public static function getSitelinks()
{
@@ -1423,7 +1423,7 @@ class e107
/**
* Retrieve render singleton object
*
- * @return object e107table
+ * @return e107table
*/
public static function getRender()
{
@@ -1433,7 +1433,7 @@ class e107
/**
* Retrieve e107Email singleton object
*
- * @return object e107Email
+ * @return e107Email
*/
public static function getEmail($overrides=null)
{
@@ -1444,7 +1444,7 @@ class e107
/**
* Retrieve e107Email mail mailer object.
*
- * @return object e107MailManager
+ * @return e107MailManager
*/
public static function getBulkEmail()
{
@@ -1454,7 +1454,7 @@ class e107
/**
* Retrieve event singleton object
*
- * @return object e107_event
+ * @return e107_event
*/
public static function getEvent()
{
@@ -1464,7 +1464,7 @@ class e107
/**
* Retrieve array storage singleton object
*
- * @return object e_array
+ * @return e_array
*/
public static function getArrayStorage()
{
@@ -1474,7 +1474,7 @@ class e107
/**
* Retrieve menu handler singleton object
*
- * @return object e_menu
+ * @return e_menu
*/
public static function getMenu()
{
@@ -1484,7 +1484,7 @@ class e107
/**
* Retrieve e_theme singleton object
- * @return object e_theme
+ * @return e_theme
*/
public static function getTheme($themedir='front', $clearCache=false)
{
@@ -1524,7 +1524,7 @@ class e107
/**
* Retrieve URL singleton object
*
- * @return object eURL
+ * @return eURL
*/
public static function getUrl()
{
@@ -1535,7 +1535,7 @@ class e107
* Retrieve file handler singleton or new fresh object
*
* @param boolean $singleton default true
- * @return object e_file
+ * @return e_file
*/
public static function getFile($singleton = false)
{
@@ -1551,7 +1551,7 @@ class e107
*
* @param boolean $singleton default false
* @param boolean $tabindex passed to e_form when initialized as an object (not singleton)
- * @return object e_form
+ * @return e_form
*/
public static function getForm($singleton = false, $tabindex = false)
{
@@ -1565,7 +1565,7 @@ class e107
/**
* Retrieve admin log singleton object
* @Deprecated - use e107::getLog();
- * @return object e_admin_log
+ * @return e_admin_log
*/
public static function getAdminLog()
{
@@ -1575,7 +1575,7 @@ class e107
/**
* Retrieve admin log singleton object
*
- * @return object e_admin_log
+ * @return e_admin_log
*/
public static function getLog()
{
@@ -1585,17 +1585,17 @@ class e107
/**
* Retrieve date handler singleton object
*
- * @return object convert
+ * @return convert
*/
public static function getDateConvert()
{
return self::getSingleton('e_date', true);
}
-
+
/**
- * Retrieve date handler singleton object - preferred method.
+ * Retrieve date handler singleton object - preferred method.
*
- * @return object convert
+ * @return convert
*/
public static function getDate()
{
@@ -1604,9 +1604,9 @@ class e107
/**
- * Retrieve date handler singleton object - preferred method.
+ * Retrieve date handler singleton object - preferred method.
*
- * @return object e107_db_debug
+ * @return e107_db_debug
*/
public static function getDebug() //XXX Discuss - possible with current setup?
{
@@ -1616,7 +1616,7 @@ class e107
/**
* Retrieve notify handler singleton object
*
- * @return object notify
+ * @return notify
*/
public static function getNotify()
{
@@ -1627,7 +1627,7 @@ class e107
/**
* Retrieve override handler singleton object
*
- * @return object override
+ * @return override
*/
public static function getOverride()
{
@@ -1639,7 +1639,7 @@ class e107
/**
* Retrieve Language handler singleton object
*
- * @return object language
+ * @return language
*/
public static function getLanguage()
{
@@ -1649,7 +1649,7 @@ class e107
/**
* Retrieve IP/ban handler singleton object
*
- * @return object eIPHandler
+ * @return eIPHandler
*/
public static function getIPHandler()
{
@@ -1659,7 +1659,7 @@ class e107
/**
* Retrieve Xml handler singleton or new instance object
* @param mixed $singleton false - new instance, true - singleton from default registry location, 'string' - registry path
- * @return object xmlClass
+ * @return xmlClass
*/
public static function getXml($singleton = true)
{
@@ -1669,7 +1669,7 @@ class e107
}
return self::getObject('xmlClass', null, true);
}
-
+
/**
* Retrieve HybridAuth object
*
@@ -1692,7 +1692,7 @@ class e107
/**
* Retrieve userclass singleton object
*
- * @return object user_class
+ * @return user_class
*/
public static function getUserClass()
{
@@ -1705,7 +1705,7 @@ class e107
* @param integer $user_id target user
* @param boolean $checkIfCurrent if tru user_id will be compared to current user, if there is a match
* current user object will be returned
- * @return object e_system_user
+ * @return e_system_user
*/
public static function getSystemUser($user_id, $checkIfCurrent = true)
{
@@ -1713,9 +1713,9 @@ class e107
{
return self::getUser();
}
-
+
if(!$user_id) return self::getObject('e_system_user');
-
+
$user = self::getRegistry('core/e107/user/'.$user_id);
if(null === $user)
{
@@ -1727,28 +1727,28 @@ class e107
/**
* Simple replacement for deprecated get_user_data(). e107::user();
- * @param $uid integer user_id or leave empty for currently logged in user.
- * @return array|bool of user data
+ * @param $uid integer user_id or leave empty for currently logged in user.
+ * @return array of user data
*/
public static function user($uid=null)
{
$uid = intval($uid);
-
+
if(empty($uid)){ return false; }
-
+
$user = self::getSystemUser($uid, true);
$var = array();
if($user)
{
$var = $user->getUserData();
}
-
+
return $var;
}
/**
- * Return a string containg exported array data. - preferred.
+ * Return a string containg exported array data. - preferred.
*
* @param array $ArrayData array to be stored
* @param bool|string $mode true = var_export with addedslashes, false = var_export (default), 'json' = json encoded
@@ -1758,26 +1758,26 @@ class e107
{
if(empty($ArrayData))
{
- return array();
- }
-
+ return array();
+ }
+
return self::getArrayStorage()->serialize($ArrayData, $mode);
}
-
+
/**
* Returns an array from stored array data.
*
* @param string $ArrayData
* @return array stored data
*/
- public static function unserialize($ArrayData)
+ public static function unserialize($ArrayData)
{
if(empty($ArrayData))
{
- return array();
- }
-
- return self::getArrayStorage()->unserialize($ArrayData);
+ return array();
+ }
+
+ return self::getArrayStorage()->unserialize($ArrayData);
}
@@ -1817,7 +1817,7 @@ class e107
* Retrieve user model object.
*
* @param integer $user_id target user
- * @return object e_user_extended_structure_tree
+ * @return e_user_extended_structure_tree
*/
public static function getUserStructure()
{
@@ -1826,7 +1826,7 @@ class e107
/**
* Retrieve User Extended handler singleton object
- * @return object e107_user_extended
+ * @return e107_user_extended
*/
public static function getUserExt()
{
@@ -1835,7 +1835,7 @@ class e107
/**
* Retrieve User Perms (admin perms) handler singleton object
- * @return object e_userperms
+ * @return e_userperms
*/
public static function getUserPerms()
{
@@ -1844,16 +1844,16 @@ class e107
/**
* Retrieve online users handler singleton object
- * @return object e_ranks
+ * @return e_ranks
*/
public static function getRank()
{
return self::getSingleton('e_ranks', true);
}
-
+
/**
* Retrieve plugin handler singleton object
- * @return object e107plugin
+ * @return e107plugin
*/
public static function getPlugin()
{
@@ -1864,7 +1864,7 @@ class e107
/**
* Retrieve plugin class singleton object
- * @return object e_plugin
+ * @return e_plugin
*/
public static function getPlug()
{
@@ -1873,7 +1873,7 @@ class e107
/**
* Retrieve online users handler singleton object
- * @return object e_online
+ * @return e_online
*/
public static function getOnline()
{
@@ -1883,7 +1883,7 @@ class e107
/**
* Retrieve chart handler singleton object
- * @return object e_chart
+ * @return e_chart
*/
public static function getChart()
{
@@ -1893,7 +1893,7 @@ class e107
/**
* Retrieve comments handler singleton object
- * @return object comment
+ * @return comment
*/
public static function getComment()
{
@@ -1902,7 +1902,7 @@ class e107
/**
* Retrieve comments handler singleton object
- * @return object e_customfields
+ * @return e_customfields
*/
public static function getCustomFields()
{
@@ -1911,16 +1911,16 @@ class e107
/**
* Retrieve Media handler singleton object
- * @return object e_media
+ * @return e_media
*/
public static function getMedia()
{
return self::getSingleton('e_media', true);
}
-
+
/**
* Retrieve Navigation Menu handler singleton object
- * @return object e_navigation
+ * @return e_navigation
*/
public static function getNav()
{
@@ -1929,7 +1929,7 @@ class e107
/**
* Retrieve message handler singleton
- * @return object eMessage
+ * @return eMessage
*/
public static function getMessage()
{
@@ -1946,7 +1946,7 @@ class e107
/**
* Retrieve ajax singleton object
*
- * @return object e_ajax_class
+ * @return e_ajax_class
*/
public static function getAjax()
{
@@ -1956,7 +1956,7 @@ class e107
/**
* Retrieve Library Manager singleton object (internal use only. Use e107::library())
*
- * @return object e_library_manager
+ * @return e_library_manager
*/
public static function getLibrary()
{
@@ -2085,7 +2085,7 @@ class e107
* @param string $type core|theme|footer|inline|footer-inline|url or any existing plugin_name
* @param string $data depends on the type - path/url or inline js source
* @param integer $zone [optional] leave it null for default zone
- * @param string $dep dependence : null | prototype | jquery
+ * @param string $dep dependence : null | prototype | jquery
*/
public static function js($type, $data, $dep = null, $zone = null, $pre = '', $post = '')
{
@@ -2096,8 +2096,8 @@ class e107
$jshandler = self::getJs();
$jshandler->setDependency($dep);
-
- switch ($type)
+
+ switch ($type)
{
case 'settings':
$jshandler->jsSettings($data);
@@ -2109,41 +2109,41 @@ class e107
else $jshandler->requireCoreLib($data);
break;
- case 'bootstrap': //TODO Eventually add own method and render for bootstrap.
+ case 'bootstrap': //TODO Eventually add own method and render for bootstrap.
if(null !== $zone) $jshandler->requireCoreLib('bootstrap/js/'.$data, $zone);
else $jshandler->requireCoreLib('bootstrap/js/'.$data);
break;
-
+
case 'theme':
// data is e.g. 'jslib/mytheme.js'
if(null !== $zone) $jshandler->headerTheme($data, $zone, $pre, $post);
else $jshandler->footerTheme($data, 5, $pre, $post);
break;
-
+
case 'inline':
// data is JS source (without script tags)
if(null !== $zone) $jshandler->headerInline($data, $zone);
else $jshandler->headerInline($data);
break;
-
+
case 'footer-inline':
// data is JS source (without script tags)
if(null !== $zone) $jshandler->footerInline($data, $zone);
else $jshandler->footerInline($data);
break;
-
+
case 'url':
// data is e.g. 'http://cdn.somesite.com/some.js'
if(null !== $zone) $jshandler->headerFile($data, $zone, $pre, $post);
else $jshandler->headerFile($data, 5, $pre, $post);
break;
-
+
case 'footer':
// data is e.g. '{e_PLUGIN}myplugin/jslib/myplug.js'
if(null !== $zone) $jshandler->footerFile($data, $zone, $pre, $post);
else $jshandler->footerFile($data, 5, $pre, $post);
break;
-
+
// $type is plugin name
default:
// data is e.g. 'jslib/myplug.js'
@@ -2185,14 +2185,14 @@ class e107
if((strpos($data,'bootstrap.css')!==false || strpos($data,'bootstrap.min.css')!==false) && !defined("BOOTSTRAP")) // detect bootstrap is enabled. - used in nextprev.sc and forum currently.
{
- define("BOOTSTRAP", true);
+ define("BOOTSTRAP", true);
}
if(self::$_css_enabled === false)
{
return null;
}
-
+
$jshandler = self::getJs();
$jshandler->setDependency($dep);
@@ -2200,34 +2200,34 @@ class e107
{
$type = 'url';
}
-
- switch ($type)
+
+ switch ($type)
{
case 'core':
// data is path relative to e_FILE/jslib/
$jshandler->coreCSS($data, $media, $preComment, $postComment);
break;
-
+
case 'bootstrap':
// data is path relative to e_FILE/jslib/
$jshandler->coreCSS('bootstrap/css/'.$data, $media, $preComment, $postComment);
- break;
-
+ break;
+
case 'theme':
// data is path relative to current theme
$jshandler->themeCSS($data, $media, $preComment, $postComment);
break;
-
+
case 'inline':
// data is CSS source (without style tags)
$jshandler->inlineCSS($data, $media);
break;
-
+
case 'url':
// data is e.g. 'http://cdn.somesite.com/some.css'
$jshandler->otherCSS($data, $media, $preComment, $postComment);
break;
-
+
// $type is plugin name
default:
// data is e.g. 'css/myplug.css'
@@ -2328,7 +2328,7 @@ class e107
* Retrieve JS Helper object
*
* @param boolean|string $singleton if true return singleton, if string return singleton object, use string as namespace, default false
- * @return object e_jshelper
+ * @return e_jshelper
*/
public static function getJshelper($singleton = false)
{
@@ -2354,7 +2354,7 @@ class e107
{
$response->addMetaDescription($content); //Cam: TBD
}
-
+
if($name === 'keywords')
{
$response->addMetaKeywords($content); //Cam: TBD
@@ -2379,7 +2379,7 @@ class e107
/**
* Retrieves class Object for specific plugin's addon such as e_url.php, e_cron.php, e_sitelink.php
* FIXME override from e.g. core/override/addons/
- *
+ *
* @param string $pluginName e.g. faq, page
* @param string $addonName eg. e_cron, e_url, e_module
* @param mixed $className [optional] true - use default name, false - no object is returned (include only), any string will be used as class name
@@ -2388,7 +2388,7 @@ class e107
public static function getAddon($pluginName, $addonName, $className = true)
{
$filename = $addonName; // e.g. 'e_cron';
-
+
// fixme, temporary adding 's' to className, should be core fixed, better naming
if(true === $className) $className = $pluginName.'_'.substr($addonName, 2); // remove 'e_'
@@ -2402,7 +2402,7 @@ class e107
{
if(!isset($elist[$pluginName])) return null;
}
-
+
// TODO override check comes here
$path = e_PLUGIN.$pluginName.'/'.$filename.'.php';
// e.g. include e_module, e_meta etc
@@ -2412,7 +2412,7 @@ class e107
{
include_once($path);
}
-
+
if(!class_exists($className, false))
{
return null;
@@ -2440,7 +2440,7 @@ class e107
}
$elist = self::getPref($filename.'_list');
-
+
if(!empty($elist))
{
foreach(array_keys($elist) as $key)
@@ -2479,17 +2479,17 @@ class e107
if(is_object($class_name) || class_exists($class_name))
{
-
+
if(is_object($class_name))
{
$obj = $class_name;
$class_name = get_class($obj);
}
- else
+ else
{
- $obj = new $class_name;
+ $obj = new $class_name;
}
-
+
if(method_exists($obj, $method_name))
{
if(E107_DBG_INCLUDES)
@@ -2664,27 +2664,27 @@ class e107
{
$id = str_replace('..', '', $id); //simple security, '/' is allowed
$curTheme = self::getThemeInfo($override, 'rel');
-
- $override_path = $override ? $curTheme.'templates/'.$id.'_template.php' : null;
- $legacy_override_path = $override ? $curTheme.$id.'_template.php' : null;
+
+ $override_path = $override ? $curTheme.'templates/'.$id.'_template.php' : null;
+ $legacy_override_path = $override ? $curTheme.$id.'_template.php' : null;
$legacy_core_path = e_THEME.'templates/'.$id.'_template.php';
$core_path = e_CORE.'templates/'.$id.'_template.php';
-
- if($override_path && is_readable($override_path)) // v2 override template.
+
+ if($override_path && is_readable($override_path)) // v2 override template.
{
return $override_path;
}
- elseif($legacy_override_path && is_readable($legacy_override_path)) //v1 override template.
+ elseif($legacy_override_path && is_readable($legacy_override_path)) //v1 override template.
{
return $legacy_override_path;
}
- elseif(is_readable($legacy_core_path)) //v1 core template.
+ elseif(is_readable($legacy_core_path)) //v1 core template.
{
// return $legacy_core_path; // just asking for trouble.
}
- return $core_path;
+ return $core_path;
}
/**
@@ -2736,7 +2736,7 @@ class e107
*
* @param string $id - file prefix, e.g. user for user_template.php
* @param string|null $key
- * @param mixed $override see {@link getThemeInfo()} true/false, front or admin.
+ * @param mixed $override see {@link getThemeInfo()} true/false, front or admin.
* @param boolean $merge merge theme with core templates, default is false
* @param boolean $info retrieve template info only
* @return string|array
@@ -2748,18 +2748,18 @@ class e107
$id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
- ### Attempt to fix merge issues; in case we override - template array not found in theme,
+ ### Attempt to fix merge issues; in case we override - template array not found in theme,
### so we need to continue and merge with core templates
if($merge && $override && empty($ret))
{
$ret = array();
}
-
+
if((!$merge && !$override) || is_string($ret))
{
return $ret;
}
-
+
// merge
$reg_path = 'core/e107/templates/'.$id;
$path = self::coreTemplatePath($id, false);
@@ -2808,12 +2808,12 @@ class e107
}
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : '');
$path = self::templatePath($plug_name, $id, $override);
-
+
if(ADMIN && E107_DBG_INCLUDES)
{
self::getMessage()->addDebug( "Attempting to load Template File: ".$path );
}
-
+
$id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
@@ -2842,19 +2842,19 @@ class e107
return (is_array($ret_plug) ? array_merge($ret_plug, $ret) : $ret);
}
-
+
/**
* Register sc_style registry
* @param string $templateId e.g. 'contact/form' or 'contact' for all contact template wrappers
- * @param string $scName [optional] shortcode name - if provided, wrapper (string) for the corresponding code will be returned
+ * @param string $scName [optional] shortcode name - if provided, wrapper (string) for the corresponding code will be returned
* @return array|string
*/
public static function templateWrapper($templateId, $scName = null)
{
if(!$templateId) return array();
-
+
list($templateId, $templateKey) = explode('/', $templateId, 2);
-
+
$wrapperRegPath = 'templates/wrapper/'.$templateId;
$wrapper = self::getRegistry($wrapperRegPath);
@@ -2874,7 +2874,7 @@ class e107
if($templateKey) $wrapper = (isset($wrapper[$templateKey]) ? $wrapper[$templateKey] : array());
}
- if(null !== $scName)
+ if(null !== $scName)
{
$scName = strtoupper($scName);
return isset($wrapper[$scName]) ? $wrapper[$scName] : '';
@@ -2882,7 +2882,7 @@ class e107
return $wrapper;
}
-
+
/**
* Retrieve/set sc_style array (global shortcode wrapper)
* @param array $set template defined $sc_style, will be merged with current registry content
@@ -2896,7 +2896,7 @@ class e107
{
self::setRegistry('shortcodes/sc_style', array_merge($_sc_style, $set));
}
-
+
return $_sc_style;
}
@@ -2911,7 +2911,7 @@ class e107
* @param boolean $merge
* @return array
*/
- public static function getTemplateInfo($plug_name = null, $id=null, $key = null, $override = true, $merge = false)
+ public static function getTemplateInfo($plug_name = null, $id, $key = null, $override = true, $merge = false)
{
if($plug_name)
{
@@ -3009,19 +3009,19 @@ class e107
$var = strtoupper($id).'_TEMPLATE';
$regPathInfo = $reg_path.'/info';
$var_info = strtoupper($id).'_INFO';
-
+
$wrapper = strtoupper($id).'_WRAPPER'; // see contact_template.php
$wrapperRegPath = 'templates/wrapper/'.$id;
- // Use: list($pre,$post) = explode("{---}",$text,2);
-
- $tp = self::getParser(); // BC FIx - avoid breaking old templates due to missing globals.
+ // Use: list($pre,$post) = explode("{---}",$text,2);
+
+ $tp = self::getParser(); // BC FIx - avoid breaking old templates due to missing globals.
if(null === self::getRegistry($regPath))
{
(deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path));
self::setRegistry($regPath, (isset($$var) ? $$var : array()));
-
+
// sc_style not a global anymore and uppercase
// Fix template merge issue - no-wrapper sent to avoid sc wrappers confusions
@@ -3058,7 +3058,7 @@ class e107
{
return $ret;
}
-
+
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : false);
}
@@ -3077,7 +3077,7 @@ class e107
{
return false;
}
-
+
$path = str_replace(e_LANGUAGE, 'English', $path);
@@ -3088,14 +3088,14 @@ class e107
return false;
}
}
-
+
$adminLanguage = self::getPref('adminlanguage');
-
+
if(e_ADMIN_AREA && vartrue($adminLanguage))
{
- $path = str_replace(e_LANGUAGE, $adminLanguage, $path);
+ $path = str_replace(e_LANGUAGE, $adminLanguage, $path);
}
-
+
$ret = ($force) ? include($path) : include_once($path);
return (isset($ret)) ? $ret : "";
}
@@ -3146,7 +3146,7 @@ class e107
*
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage]_front.php
* e107::plugLan('myplug');
- *
+ *
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage]_admin.php
* e107::plugLan('myplug', true);
*
@@ -3174,7 +3174,7 @@ class e107
{
$fname = e_LANGUAGE.($flat ? '_' : '/').preg_replace('#[^\w/]#', '', trim($fname, '/'));
}
- elseif($fname === true) // admin file.
+ elseif($fname === true) // admin file.
{
//$fname = "admin/".e_LANGUAGE;
$fname = e_LANGUAGE."_admin";
@@ -3187,24 +3187,24 @@ class e107
if($flat === true) // support for alt_auth/languages/English/English_log.php etc.
{
- $path = e_PLUGIN.$plugin.'/languages/'.e_LANGUAGE.'/'.$fname.'.php';
- }
+ $path = e_PLUGIN.$plugin.'/languages/'.e_LANGUAGE.'/'.$fname.'.php';
+ }
else
{
- $path = e_PLUGIN.$plugin.'/languages/'.$fname.'.php';
+ $path = e_PLUGIN.$plugin.'/languages/'.$fname.'.php';
}
-
+
if(deftrue('E107_DBG_INCLUDES'))
{
self::getMessage()->addDebug("Attempting to Load: ".$path);
- }
-
-
+ }
+
+
self::setRegistry($cstring, true);
return self::includeLan($path, false);
}
-
+
/**
* Simplify importing of theme Language files (following e107 plugin structure standards).
* All inputs are sanitized.
@@ -3222,7 +3222,7 @@ class e107
*
* // import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage]/admin/lan.php
* e107::themeLan('admin/lan');
- *
+ *
* // import defeinitions from /e107_themes/some_theme/languages/[CurrentLanguage].php
* e107::themeLan('', 'some_theme');
*
@@ -3236,7 +3236,7 @@ class e107
{
if(null === $theme) $theme = THEME.'languages/';
else $theme = e_THEME.preg_replace('#[^\w/]#', '', $theme).'/languages/';
-
+
$cstring = 'themelan/'.$theme.$fname.($flat ? '_1' : '_0');
if(self::getRegistry($cstring)) return;
@@ -3244,11 +3244,11 @@ class e107
else $fname = e_LANGUAGE;
$path = $theme.$fname.'.php';
-
+
if(deftrue('E107_DBG_INCLUDES'))
{
self::getMessage()->addDebug("Attempting to Load: ".$path);
- }
+ }
self::setRegistry($cstring, true);
@@ -3258,7 +3258,7 @@ class e107
/**
- * PREFERRED Generic Language File Loading Function for use by theme and plugin developers.
+ * PREFERRED Generic Language File Loading Function for use by theme and plugin developers.
* Language-file equivalent to e107::js, e107::meta and e107::css
*
* FIXME disallow themes and plugins named 'core' and 'theme'
@@ -3289,15 +3289,15 @@ class e107
case 'core' :
self::coreLan($fname, $options);
break;
-
+
case 'theme' :
self::themeLan($fname, null, $options);
break;
default :
self::plugLan($type, $fname, $options);
break;
- }
-
+ }
+
}
@@ -3310,22 +3310,22 @@ class e107
*/
public static function pref($type = 'core', $pname = null, $default = null)
{
-
+
switch ($type)
{
case 'core' :
return self::getPref($pname, $default);
break;
-
+
case 'theme' :
- return self::getThemePref($pname, $default);
+ return self::getThemePref($pname, $default);
break;
-
- default:
+
+ default:
return self::getPlugPref($type, $pname, $default);
break;
- }
-
+ }
+
}
/**
@@ -3568,20 +3568,20 @@ class e107
/**
* Retrieve error page handler.
*
- * @return object error_page
+ * @return error_page
*/
public static function getError()
{
return self::getSingleton('error_page', true);
}
-
+
/**
* Parses an array into a valid, rawurlencoded query string. This differs from http_build_query() as we need to
* rawurlencode() (instead of urlencode()) all query parameters.
* @param array $query The query parameter array to be processed, e.g. $_GET.
* @param string $parent Internal use only. Used to build the $query array key for nested items.
- * @return string A rawurlencoded string which can be used as or appended to the URL query string.
+ * @return array A rawurlencoded string which can be used as or appended to the URL query string.
*/
public static function httpBuildQuery(array $query, $parent = '')
{
@@ -3612,13 +3612,7 @@ class e107
}
- /**
- * @param $js
- * @param array $options
- * @return bool|null|string
- * @throws Exception
- */
- public static function minify($js, $options=array())
+ public static function minify($js,$options=array())
{
if(empty($js))
{
@@ -3717,13 +3711,13 @@ class e107
$aLangPref = self::getPref('adminlanguage');
$adminLan = vartrue($aLangPref, e_LANGUAGE);
-
- $searchPath[1] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'_admin_'.$unitName.'.php';
- $searchPath[2] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'/'.'admin_'.$unitName.'.php';
+
+ $searchPath[1] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'_admin_'.$unitName.'.php';
+ $searchPath[2] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'/'.'admin_'.$unitName.'.php';
$searchPath[3] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'/admin/'.$adminLan.'.php';
- $searchPath[4] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'/'.$adminLan.'_admin.php'; // Preferred.
- $searchPath[5] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'_admin.php'; // consistent with English_global.php, English_log.php etc.
-
+ $searchPath[4] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'/'.$adminLan.'_admin.php'; // Preferred.
+ $searchPath[5] = e_PLUGIN.$unitName.'/languages/'.$adminLan.'_admin.php'; // consistent with English_global.php, English_log.php etc.
+
break;
case 'theme' :
$searchPath[1] = e_THEME.$unitName.'/languages/'.e_LANGUAGE.'_'.$unitName.'.php';
@@ -3786,7 +3780,7 @@ class e107
}
else
{
- define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
+ define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
}
unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something...
@@ -3865,7 +3859,7 @@ class e107
{
return '';
}
-
+
if (is_array($input))
{
return array_walk($input, array('self', 'filter_request'), $type);
@@ -3878,7 +3872,7 @@ class e107
{
$input = preg_replace("/(\[code\])(.*?)(\[\/code\])/is","",$input);
}
-
+
$regex = "/(base64_decode|chr|php_uname|fwrite|fopen|fputs|passthru|popen|proc_open|shell_exec|exec|proc_nice|proc_terminate|proc_get_status|proc_close|pfsockopen|apache_child_terminate|posix_kill|posix_mkfifo|posix_setpgid|posix_setsid|posix_setuid|phpinfo) *?\((.*) ?\;?/i";
if(preg_match($regex,$input))
{
@@ -3921,9 +3915,9 @@ class e107
{
echo "Bad Request: ".__METHOD__." : ". __LINE__;
}
- exit();
+ exit();
}
-
+
$regex = "/(wget |curl -o |lwp-download|onmouse)/i";
if(preg_match($regex,$input))
{
@@ -3934,7 +3928,7 @@ class e107
}
exit();
}
-
+
}
if($type === '_GET') // Basic XSS check.
@@ -3950,18 +3944,18 @@ class e107
}
}
-
+
if($type == "_SERVER")
{
if(($key == "QUERY_STRING") && (
- strpos(strtolower($input),"../../")!==FALSE
+ strpos(strtolower($input),"../../")!==FALSE
|| stripos($input,"php:")!==FALSE
|| stripos($input,"data:")!==FALSE
|| stripos($input,"%3cscript")!==FALSE
))
{
-
+
header('HTTP/1.0 400 Bad Request', true, 400);
if(deftrue('e_DEBUG'))
{
@@ -3983,7 +3977,7 @@ class e107
}
exit();
}
-
+
if(($key == "HTTP_USER_AGENT") && strpos($input,"libwww-perl")!==FALSE)
{
header('HTTP/1.0 400 Bad Request', true, 400);
@@ -3991,12 +3985,12 @@ class e107
{
echo "Bad Request: ".__METHOD__." : ". __LINE__;
}
- exit();
+ exit();
}
-
-
+
+
}
-
+
if(strpos(str_replace('.', '', $input), '22250738585072011') !== FALSE) // php-bug 53632
{
header('HTTP/1.0 400 Bad Request', true, 400);
@@ -4005,8 +3999,8 @@ class e107
echo "Bad Request: ".__METHOD__." : ". __LINE__;
}
exit();
- }
-
+ }
+
if($base64 != true)
{
self::filter_request(base64_decode($input),$key,$type,true);
@@ -4087,7 +4081,7 @@ class e107
define("e_DOMAIN", $domain);
define("e_SUBDOMAIN", ($subdomain) ? $subdomain : false);
-
+
define('e_UC_PUBLIC', 0);
define('e_UC_MAINADMIN', 250);
define('e_UC_READONLY', 251);
@@ -4113,7 +4107,7 @@ class e107
}
$ret = e_BASE.$this->e107_dirs[$dir.'_DIRECTORY'];
-
+
return $ret;
}
@@ -4298,21 +4292,21 @@ class e107
// XXX DISCUSSS - e_JS_ABS, e_CSS_ABS etc is not following the naming standards but they're more usable.
// Example: e_JS_ABS vs e_WEB_JS_ABS
-
- //XXX Absolute is assumed.
+
+ //XXX Absolute is assumed.
define('e_WEB_ABS', $this->get_override_http('WEB'));
define('e_JS_ABS', $this->get_override_http('WEB_JS'));
define('e_CSS_ABS', $this->get_override_http('WEB_CSS'));
// define('e_PACK_ABS', $this->get_override_http('WEB_PACKS'));
define('e_WEB_IMAGE_ABS', $this->get_override_http('WEB_IMAGES'));
-
- define('e_JS', $this->get_override_http('WEB_JS')); // ABS Alias
- define('e_CSS', $this->get_override_http('WEB_CSS')); // ABS Alias
-
+
+ define('e_JS', $this->get_override_http('WEB_JS')); // ABS Alias
+ define('e_CSS', $this->get_override_http('WEB_CSS')); // ABS Alias
+
define('e_AVATAR', $this->get_override_rel('AVATARS'));
define('e_AVATAR_UPLOAD', $this->get_override_rel('AVATARS_UPLOAD'));
define('e_AVATAR_DEFAULT', $this->get_override_rel('AVATARS_DEFAULT'));
-
+
define('e_AVATAR_ABS', $this->get_override_http('AVATARS'));
define('e_AVATAR_UPLOAD_ABS', $this->get_override_http('AVATARS_UPLOAD'));
define('e_AVATAR_DEFAULT_ABS', $this->get_override_http('AVATARS_DEFAULT'));
@@ -4321,9 +4315,9 @@ class e107
{
define('e_CACHE_IMAGE_ABS', $this->get_override_http('CACHE_IMAGE'));
}
-
+
// Special
-
+
define('e_BOOTSTRAP', e_WEB."bootstrap/");
return $this;
@@ -4378,7 +4372,7 @@ class e107
$eSelf = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME'];
$_self = $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$eSelf;
-
+
// START New - request uri/url detection, XSS protection
// TODO - move it to a separate method
@@ -4431,10 +4425,10 @@ class e107
$tmp = explode('?', e_REQUEST_URL);
$requestSelf = array_shift($tmp);
-
+
if(substr($requestSelf,-4) !== '.php' && substr($requestSelf,-1) !== '/')
{
- $requestSelf .= '/'; // Always include a trailing slash on SEF Urls so that e_REQUEST_SELF."?".e_QUERY doesn't break.
+ $requestSelf .= '/'; // Always include a trailing slash on SEF Urls so that e_REQUEST_SELF."?".e_QUERY doesn't break.
}
// the last anti-XSS measure, XHTML compliant URL to be used in forms instead e_SELF
@@ -4541,10 +4535,10 @@ class e107
// login/signup
define('e_SIGNUP', SITEURL.(file_exists(e_BASE.'customsignup.php') ? 'customsignup.php' : 'signup.php'));
-
+
if(!defined('e_LOGIN'))
{
- define('e_LOGIN', SITEURL.(file_exists(e_BASE.'customlogin.php') ? 'customlogin.php' : 'login.php'));
+ define('e_LOGIN', SITEURL.(file_exists(e_BASE.'customlogin.php') ? 'customlogin.php' : 'login.php'));
}
return $this;
@@ -4570,7 +4564,7 @@ class e107
}
}
- $eMENUQry = str_replace(array('%5B','%5D'),array('[',']'),$_SERVER['QUERY_STRING']); //FIX for urlencoded QUERY_STRING without breaking the '+' used by debug.
+ $eMENUQry = str_replace(array('%5B','%5D'),array('[',']'),$_SERVER['QUERY_STRING']); //FIX for urlencoded QUERY_STRING without breaking the '+' used by debug.
if (strpos($eMENUQry, ']') && preg_match('#\[(.*?)](.*)#', $eMENUQry, $matches))
{
define('e_MENU', $matches[1]);
@@ -4583,21 +4577,21 @@ class e107
}
if ($no_cbrace) $e_QUERY = str_replace(array('{', '}', '%7B', '%7b', '%7D', '%7d'), '', rawurldecode($e_QUERY));
-
+
// $e_QUERY = htmlentities(self::getParser()->post_toForm($e_QUERY)); //@see https://github.com/e107inc/e107/issues/719
- $e_QUERY = htmlspecialchars(self::getParser()->post_toForm($e_QUERY));
-
+ $e_QUERY = htmlspecialchars(self::getParser()->post_toForm($e_QUERY));
+
// e_QUERY SHOULD NOT BE DEFINED IF IN SNIGLE ENTRY MODE OR ALL URLS WILL BE BROKEN - it's defined later within the the router
if(!deftrue("e_SINGLE_ENTRY"))
{
define('e_QUERY', filter_var($e_QUERY, FILTER_SANITIZE_URL));
- $_SERVER['QUERY_STRING'] = e_QUERY;
+ $_SERVER['QUERY_STRING'] = e_QUERY;
}
else
{
// define('e_QUERY', ''); // breaks news sef-urls and possibly others. Moved to index.php.
}
-
+
define('e_TBQS', $_SERVER['QUERY_STRING']);
}
diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php
index 2304fb4ab..a6fb7f2e8 100644
--- a/e107_handlers/form_handler.php
+++ b/e107_handlers/form_handler.php
@@ -5871,6 +5871,8 @@ class e_form
$label = varset($parms['label'], 'LAN_EDIT');
$max = varset($parms['max'],5);
+ $ret .= "