|
From: <al...@us...> - 2013-06-22 19:20:28
|
Revision: 11747
http://sourceforge.net/p/xoops/svn/11747
Author: alain91
Date: 2013-06-22 19:20:25 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
Integration of patches from xoops 2.6.0 bug tracker
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/admin.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/captcha/xoopscaptcha.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/template.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopslists.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopssecurity.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/checklogin.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/formdhtmltextarea_preview.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/block.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/tplfile.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/modules/system/admin.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops/Auth/Factory.php
XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops.php
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/admin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/admin.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/admin.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -96,7 +96,7 @@
$count = count($_items);
for ($i = 0; $i < $count; $i++) {
$_items[$i]['title'] = XoopsLocale::convert_encoding($_items[$i]['title'], XoopsLocale::getCharset(), 'UTF-8');
- $_items[$i]['description'] = XoopsLocale::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8');
+ $_items[$i]['description'] = XoopsLocale::convert_encoding($_items[$i]['description'], XoopsLocale::getCharset(), 'UTF-8');
$items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i];
}
} else {
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/captcha/xoopscaptcha.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/captcha/xoopscaptcha.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/captcha/xoopscaptcha.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -494,12 +494,13 @@
*/
public function loadConfig($name = '')
{
- if (!is_object($this->handler))
- $this->config = array();
- else
+ if (is_object($this->handler)) {
$this->config = empty($name)
? $this->handler->config
: array_merge($this->handler->config, $this->handler->loadConfig($name));
+ } else {
+ $this->config = array();
+ }
}
/**
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/template.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/template.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/template.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -71,20 +71,16 @@
if (!function_exists('smarty_function_eval')) {
require_once SMARTY_DIR . '/plugins/function.eval.php';
}
- if (isset($vars)) {
- $oldVars = $this->_tpl_vars;
- $this->assign($vars);
- $out = smarty_function_eval(
- array('var' => $tplSource), $this
- );
- $this->_tpl_vars = $oldVars;
+ $oldVars = $this->_tpl_vars;
+ if (isset($vars)) $this->assign($vars);
+ $out = smarty_function_eval(array('var' => $tplSource), $this);
+ $this->_tpl_vars = $oldVars;
- return $out;
- }
-
- return smarty_function_eval(
- array('var' => $tplSource), $this
- );
+ if ($display) {
+ echo $out;
+ return;
+ }
+ return $out;
}
/**
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopslists.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopslists.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopslists.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -189,7 +189,7 @@
$filelist = array();
if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
- if (preg_match('/(\.gif|\.jpg|\.png|\.swf)$/i', $file)) {
+ if (preg_match('/\.(gif|jpg|png|swf)$/i', $file)) {
$file = $prefix . $file;
$filelist[$file] = $file;
}
@@ -217,7 +217,7 @@
$filelist = array();
if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
- if ((preg_match('/(\.htm|\.html|\.xhtml)$/i', $file) && !is_dir($file))) {
+ if ((preg_match('/\.(htm|html|xhtml)$/i', $file) && !is_dir($file))) {
$file = $prefix . $file;
$filelist[$file] = $prefix . $file;
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopssecurity.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopssecurity.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/class/xoopssecurity.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -81,7 +81,9 @@
$log = array();
$token = ($token !== false) ? $token : (isset($_REQUEST[$name . '_REQUEST']) ? $_REQUEST[$name . '_REQUEST'] : '');
if (empty($token) || empty($_SESSION[$name . '_SESSION'])) {
- $log[] = array('Token Validation', 'No valid token found in request/session');
+ $str = 'No valid token found in request/session';
+ $this->setErrors($str);
+ $log[] = array('Token Validation', $str);
} else {
$token_data =& $_SESSION[$name . '_SESSION'];
foreach (array_keys($token_data) as $i) {
@@ -94,14 +96,16 @@
$log[] = array('Token Validation', 'Valid token found');
$ret = true;
} else {
- $str = 'Valid token expired';
+ $str = 'Valid token expired ' . $token;
$this->setErrors($str);
$log[] = array('Token Validation', $str);
}
}
}
if (!$ret) {
- $log[] = array('Token Validation', 'No valid token found');
+ $str = 'No valid token found';
+ $this->setErrors($str);
+ $log[] = array('Token Validation', $str);
}
$this->garbageCollection($name);
}
@@ -123,13 +127,13 @@
/**
* Check whether a token value is expired or not
*
- * @param string $token
+ * @param string $token_data
*
* @return bool
*/
- public function filterToken($token)
+ public function filterToken($token_data)
{
- return (!empty($token['expire']) && $token['expire'] >= time());
+ return (!empty($token_data['expire']) && $token_data['expire'] >= time());
}
/**
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/checklogin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/checklogin.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/checklogin.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -62,7 +62,8 @@
$_SESSION['xoopsUserId'] = $user->getVar('uid');
$_SESSION['xoopsUserGroups'] = $user->getGroups();
$user_theme = $user->getVar('theme');
- if (in_array($user_theme, $xoops->getConfig('theme_set_allowed'))) {
+ $theme_set_allowed = $xoops->getConfig('theme_set_allowed');
+ if (empty($theme_set_allowed) OR in_array($user_theme, $theme_set_allowed)) {
$_SESSION['xoopsUserTheme'] = $user_theme;
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/formdhtmltextarea_preview.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/formdhtmltextarea_preview.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/include/formdhtmltextarea_preview.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -40,7 +40,8 @@
}
if (! headers_sent()) {
- header('Content-Type:text/html; charset=ISO-8859-1');
+ $charset = (is_callable() ? XoopsLocale::getCharset() : 'UTF-8');
+ header('Content-Type:text/html; charset='.$charset);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: private, no-cache');
header('Pragma: no-cache');
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/block.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/block.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/block.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -334,11 +334,17 @@
if (XoopsLoad::fileExists(XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file'))) {
$xoops->loadLanguage('blocks', $this->getVar('dirname'));
include_once XOOPS_ROOT_PATH . '/modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file');
- $options = explode('|', $this->getVar('options'));
- $edit_form = $edit_func($options);
- if (!$edit_form) {
- return false;
- }
+
+ if (function_exists($edit_func)) {
+ // execute the function
+ $options = explode('|', $this->getVar('options'));
+ $edit_form = $edit_func($options);
+ if (!$edit_form) {
+ return false;
+ }
+ } else {
+ return false;
+ }
return $edit_form;
} else {
@@ -583,9 +589,9 @@
$where_query = " WHERE isactive=" . $isactive;
if (isset($side)) {
// get both sides in sidebox? (some themes need this)
- if ($side == 2) {
+ if ($side == XOOPS_SIDEBLOCK_BOTH) {
$side = "(side=0 OR side=1)";
- } elseif ($side == 6) {
+ } elseif ($side == XOOPS_CENTERBLOCK_ALL) {
$side = "(side=3 OR side=4 OR side=5 OR side=7 OR side=8 OR side=9)";
} else {
$side = "side=" . $side;
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/tplfile.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/tplfile.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/kernel/tplfile.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -387,7 +387,7 @@
public function getModuleTplCount($tplset)
{
$ret = array();
- $sql = "SELECT tpl_module, COUNT(tpl_id) AS count FROM " . $this->db->prefix('tplfile') . " WHERE tpl_tplset='" . $this->db->quoteString($tplset) . "' GROUP BY tpl_module";
+ $sql = "SELECT tpl_module, COUNT(tpl_id) AS count FROM " . $this->db->prefix('tplfile') . " WHERE tpl_tplset=" . $this->db->quoteString($tplset) . " GROUP BY tpl_module";
$result = $this->db->query($sql);
if (!$result) {
return $ret;
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/modules/system/admin.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/modules/system/admin.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/modules/system/admin.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -147,13 +147,17 @@
}
switch ($directory) {
case 'groups':
- $groups_Handler = $xoops->getHandlerGroup();
- $groups = $groups_Handler->getCount();
+ $groups_handler = $xoops->getHandlerGroup();
+ $groups = 0;
+ if (is_object($groups_handler))
+ $groups = $groups_handler->getCount();
$menu['infos'] = sprintf(SystemLocale::F_GROUPS_SPAN, $groups);
break;
case 'users':
$member_handler = $xoops->getHandlerUser();
- $member = $member_handler->getCount();
+ $member = 0;
+ if (is_object($member_handler))
+ $member = $member_handler->getCount();
$menu['infos'] = sprintf(SystemLocale::F_USERS_SPAN, $member);
break;
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops/Auth/Factory.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops/Auth/Factory.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops/Auth/Factory.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -55,7 +55,7 @@
$xoops_auth_method = $authConfig['auth_method'];
}
// Verify if uname allow to bypass LDAP auth
- if (in_array($uname, $authConfig['ldap_users_bypass'])) {
+ if (!empty($authConfig['ldap_users_bypass']) AND in_array($uname, $authConfig['ldap_users_bypass'])) {
$xoops_auth_method = 'xoops';
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops.php 2013-06-22 18:57:31 UTC (rev 11746)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/htdocs_psr/xoops_lib/Xoops.php 2013-06-22 19:20:25 UTC (rev 11747)
@@ -221,8 +221,14 @@
if (!$this->isAdminSide) {
$xoopsThemeFactory = null;
$xoopsThemeFactory = new XoopsThemeFactory();
- $xoopsThemeFactory->allowedThemes = $this->getConfig('theme_set_allowed');
- $xoopsThemeFactory->defaultTheme = $this->getConfig('theme_set');
+ $theme_set_allowed = $this->getConfig('theme_set_allowed');
+ if (!empty($theme_set_allowed) AND is_array($theme_set_allowed)) {
+ $xoopsThemeFactory->allowedThemes = $theme_set_allowed;
+ }
+ $theme_set = $this->getConfig('theme_set');
+ if (!empty($theme_set) AND is_string($theme_set)) {
+ $xoopsThemeFactory->defaultTheme = $theme_set;
+ }
$this->setTheme($xoopsThemeFactory->createInstance(array('contentTemplate' => $this->tpl_name)));
} else {
$adminThemeFactory = new XoopsAdminThemeFactory();
@@ -396,12 +402,18 @@
*/
public function themeSelect()
{
- if (!empty($_POST['xoops_theme_select']) && in_array($_POST['xoops_theme_select'], $this->getConfig('theme_set_allowed'))) {
- $this->setConfig('theme_set', $_POST['xoops_theme_select']);
- $_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select'];
+ if (!empty($_POST['xoops_theme_select'])) {
+ $theme_set_allowed = $this->getConfig('theme_set_allowed');
+ if (empty($theme_set_allowed) OR in_array($_POST['xoops_theme_select'], $theme_set_allowed)) {
+ $this->setConfig('theme_set', $_POST['xoops_theme_select']);
+ $_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select'];
+ }
} else {
- if (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $this->getConfig('theme_set_allowed'))) {
- $this->setConfig('theme_set', $_SESSION['xoopsUserTheme']);
+ if (!empty($_SESSION['xoopsUserTheme'])) {
+ $theme_set_allowed = $this->getConfig('theme_set_allowed');
+ if (empty($theme_set_allowed) OR in_array($_SESSION['xoopsUserTheme'], $theme_set_allowed)) {
+ $this->setConfig('theme_set', $_SESSION['xoopsUserTheme']);
+ }
}
}
}
|