xoops / xoopscore Goto Github PK
View Code? Open in Web Editor NEWCore Framework for next version of XOOPS CMS: 2.6.0
Home Page: https://xoops.org
Core Framework for next version of XOOPS CMS: 2.6.0
Home Page: https://xoops.org
I found a minor bug in xoops_lib/Xoops/Core/Events
we need to add a method_exists test to insure the class is loaded.
public function triggerEvent($event_name, $args = array())
{
if ($this->checkAgain) {
$this->__construct();
}
$event_name = $this->toInternalEventName($event_name);
if (isset($this->eventListeners[$event_name])) {
foreach ($this->eventListeners[$event_name] as $event) {
if (method_exists($event[0],$event[1]))
call_user_func(array($event, $args));
}
}
}
diff --git a/htdocs/kernel/block.php b/htdocs/kernel/block.php
index c195cae..0db6de2 100644
--- a/htdocs/kernel/block.php
+++ b/htdocs/kernel/block.php
@@ -811,8 +811,8 @@ class XoopsBlockHandler extends XoopsPersistableObjectHandler
$qb->andWhere($eb->eq('b.visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
}
- $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, '
- . $db->prefix('block_module_link') . ' m';
+ $sql = 'SELECT b.* FROM ' . $this->db2->prefix('newblocks') . ' b, '
+ . $this->db2->prefix('block_module_link') . ' m';
$sql .= ' WHERE b.isactive=' . intval($isactive);
if (isset($visible)) {
$sql .= ' AND b.visible=' . intval($visible);
@@ -940,6 +940,9 @@ class XoopsBlockHandler extends XoopsPersistableObjectHandler
{
$ret = array();
if (isset($groupid)) {
+ $qb = $this->db2->createXoopsQueryBuilder();
+ $eb = $qb->expr();
+
$qb ->select('DISTINCT(gperm_itemid)')
->fromPrefix('group_permission', 'p')
->fromPrefix('groups', 'g')
public function formatURL($url)
{
if (!preg_match('/^(https?|ftps?|ed2k)\:\/\//i', $url)
}
Explanation :
the webmaster could configure a question and an human answer for the subscription
use the profile module :
Modify the file include/forms.php and search this line :
[code]
$elements[0][] = array('element' => new XoopsFormPassword(_US_VERIFYPASS, 'vpass', 35, 32, ''), 'required' => true);
$weights[0][] = 0;
[/code]
Add just after :
[code]
global $xoopsModuleConfig;
$elements[0][] = array('element' => new XoopsFormLabel(_QUESTION_ANTI_ROBOT, $xoopsModuleConfig['profile_questionn']));
$weights[0][] = 0;
$elements[0][] = array('element' => new XoopsFormText(_REPONSE_AU_QUESTION_ANTIBOT, 'question', 35, 32, ''), 'required' => true);
$weights[0][] = 0;
[/code]
Then modify the file register.php and search the line :
[code]
$vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC(trim($_POST['vpass']) ) : '';
[/code]
and add just after :
[code]
$question = isset($_POST['question']) ? $myts->stripSlashesGPC(trim($_POST['question']) ) : '';
global $xoopsModuleConfig;
if ( (isset($question)) && ($question != $xoopsModuleConfig['profile_reponse']) ) {
$stop .= _US_REPONSEAUQUESTIONESTFAUX . '
';
}
[/code]
Then modify the file xoops_version.php, add :
[code]
$modversion['config'][2]['name'] = 'profile_question';
$modversion['config'][2]['title'] = '_PROFILE_MI_PROFILE_QUESTION';
$modversion['config'][2]['description'] = '';
$modversion['config'][2]['formtype'] = 'textbox';
$modversion['config'][2]['valuetype'] = 'text';
$modversion['config'][2]['default'] = 'Where is the town Paris??';
$modversion['config'][3]['name'] = 'profile_reponse';
$modversion['config'][3]['title'] = '_PROFILE_MI_PROFILE_REPONSE';
$modversion['config'][3]['description'] = '';
$modversion['config'][3]['formtype'] = 'textbox';
$modversion['config'][3]['valuetype'] = 'text';
$modversion['config'][3]['default'] = 'France';
[/code]
in the file language/main.php, add :
[code]
define("_REPONSE_AU_QUESTION_ANTIBOT", "La reponse pour la question est:");
define("_US_REPONSEAUQUESTIONESTFAUX", "Votre reponse au question est faux. ressayez encore une fois");
define("_QUESTION_ANTI_ROBOT", "Question Anti Robots, Prouve que vous etes humain");
[/code]
Thanks to olivee, french xoopser (http://www.frxoops.org/modules/newbb/viewtopic.php?post_id=231287#forumpost231287)
public function test_insert()
{
$instance=new $this->myclass($this->conn);
$obj=new XoopsRanks();
$obj->setVar('rank_title','rank_title');
//$obj->cleanVars();
//$obj->setNew();
//$obj->setDirty();
$value=$instance->insert($obj);
$this->assertTrue($value>0);
}
doesn't work I have to add the 3 commented statements to make it works.
It is not simple for the developper.
Line 421 in \modules\system\class\module.php :
if (false === $gperm_handler->deleteByModule($module->getVar('mid'))) { $this->trace[] = '' . SystemLocale::E_GROUP_PERMISSIONS_NOT_DELETED . '';
generates "Group permissions were not deleted!" info, even if there were no permissions to delete in the first place.
Steps to reproduce:
Shouldn't we show it in red only where something failed?
Warning: include(/vendor/autoload.php): failed to open stream: No such file or directory in \class\xoopsload.php on line 518
The XOOPS_PATH is not yet defined
(delete, update, delete_all, update_all methods returns affected_rows in string format, could it be possible to convert it into an int ?
Direct usage of mysql statements replace by Doctrine statements.
--- a/htdocs/modules/protector/class/protector.php
+++ b/htdocs/modules/protector/class/protector.php
@@ -171,12 +171,13 @@ class Protector
return false;
}
- $result = @mysql_query("SELECT conf_name,conf_value FROM " . XOOPS_DB_PREFIX . "_config WHERE conf_title like '" . "_MI_PROTECTOR%'", $this->_conn);
- if (!$result || mysql_num_rows($result) < 5) {
+ $result = $this->_conn->executeQuery("SELECT conf_name,conf_value FROM " . XOOPS_DB_PREFIX . "_config WHERE conf_title like '" . "_MI_PROTECTOR%'");
+ if (!$result || $result->columnCount() < 5) {
return false;
}
$db_conf = array();
- while (list($key, $val) = mysql_fetch_row($result)) {
+ $rows = $result->fetch();
+ foreach ($rows as $key => $val) {
$db_conf[$key] = $val;
}
$db_conf_serialized = serialize($db_conf);
```php
--- a/htdocs/modules/protector/include/postcheck_functions.php
+++ b/htdocs/modules/protector/include/postcheck_functions.php
@@ -43,6 +43,7 @@ function protector_postcheck()
// configs writable check
if (@$_SERVER['REQUEST_URI'] == '/admin.php' && !is_writable(dirname(dirname(__FILE__)) . '/configs')) {
trigger_error('You should turn the directory ' . dirname(dirname(__FILE__)) . '/configs writable', E_USER_WARNING);
+ return false;
}
// Protector object
--- a/htdocs/xoops_lib/Xoops.php
+++ b/htdocs/xoops_lib/Xoops.php
@@ -444,11 +444,14 @@ class Xoops
*/
public function themeSelect()
{
- if (!empty($_POST['xoops_theme_select']) && in_array($_POST['xoops_theme_select'], $this->getConfig('theme_set_allowed'))) {
+ $theme_set_allowed = $this->getConfig('theme_set_allowed');
+ if (!is_array($theme_set_allowed))
+ $theme_set_allowed = array();
+ if (!empty($_POST['xoops_theme_select']) && 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'))) {
+ if (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $theme_set_allowed)) {
$this->setConfig('theme_set', $_SESSION['xoopsUserTheme']);
}
}
@@ -836,8 +836,7 @@ public function getHandler($name, $optional = false)
}
if (!isset($this->_kernelHandlers[$name])) {
trigger_error('Class <strong>' . $class . '</strong> does not exist<br />Handler Name: ' . $name, $optional ? E_USER_WARNING : E_USER_ERROR);
- }
- if (isset($this->_kernelHandlers[$name])) {
+ } else {
return $this->_kernelHandlers[$name];
}
return false;
@@ -1131,7 +1130,7 @@ public function simpleFooter()
*
* @return string
*/
- public function alert($type = 'info', $msg, $title = '/')
+ public function alert($msg, $type = 'info', $title = '/')
{
$alert_msg = '';
switch ($type) {
@@ -1168,11 +1167,14 @@ public function alert($type = 'info', $msg, $title = '/')
if ($title != '') {
$this->tpl()->assign('alert_title', $title);
}
+ /*
if (is_object($msg)) {
$msg = (array)$msg;
}
- if (is_array($msg)) {
- $alert_msg = implode("<br />", $msg);
+ */
+ if (is_array($msg) OR is_object($msg)) {
+ $alert_msg = print_r($msg, true);
+ $alert_msg = nl2br($alert_msg);
} else {
$alert_msg = $msg;;
}
@@ -1619,7 +1621,10 @@ public function addConfigs($configs, $dirname = 'system')
{
$dirname = trim(strtolower($dirname));
if (empty($dirname)) {
- $dirname = $this->isModule() ? $this->module->getVar('dirname') : 'system';
+ $moddirname = null;
+ if ($this->isModule())
+ $moddirname = $this->module->getVar('dirname');
+ $dirname = (!empty($moddirname)) ? $moddirname : 'system';
}
$this->_moduleConfigs[$dirname] = array_merge($this->_moduleConfigs[$dirname], (array)$configs);
Xoops_Cache::write("{$dirname}_configs", $this->_moduleConfigs[$dirname]);
explicit namespace required
line 39
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
--- a/htdocs/kernel/tplfile.php
+++ b/htdocs/kernel/tplfile.php
@@ -255,7 +255,8 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
$myrow = $result->fetch(\PDO::FETCH_ASSOC);
$tplfile->assignVar('tpl_source', $myrow['tpl_source']);
}
- return true;
+ $tpl = $tplfile->getVar('tpl_source');
+ return !empty($tpl);
}
/**
@@ -267,33 +268,24 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
public function insertTpl(XoopsTplfile &$tplfile)
{
if (!$tplfile->isDirty()) {
- return true;
+ return false;
}
if (!$tplfile->cleanVars(false)) {
return false;
}
- foreach ($tplfile->cleanVars as $k => $v) {
- ${$k} = $v;
- }
if ($tplfile->isNew()) {
+ $values = $tplfile->cleanVars;
$tpl_id = 0;
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->insertPrefix('tplfile', $values)) {
return false;
}
+
if (empty($tpl_id)) {
$tpl_id = $this->db2->lastInsertId();
}
+
if (isset($tpl_source) && $tpl_source != '') {
$values = array(
'tpl_id' => $tpl_id,
@@ -309,17 +301,10 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
}
$tplfile->assignVar('tpl_id', $tpl_id);
} else {
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $values = $tplfile->cleanVars;
+ $tpl_id = $tplfile->id();
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->updatePrefix('tplfile', $values, array('tpl_id' => $tpl_id))) {
return false;
}
@@ -329,7 +314,7 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
// 'tpl_id' => $tpl_id,
'tpl_source' => $tpl_source,
);
- if ($this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
+ if (!$this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
return false;
}
}
@@ -345,46 +330,35 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
public function forceUpdate(XoopsTplfile &$tplfile)
{
if (!$tplfile->isDirty()) {
- return true;
+ return false;
}
if (!$tplfile->cleanVars(false)) {
return false;
}
- foreach ($tplfile->cleanVars as $k => $v) {
- ${$k} = $v;
- }
+
if (!$tplfile->isNew()) {
- $tpl_id = 0;
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $values = $tplfile->cleanVars;
+ $tpl_id = $tplfile->id();
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->updatePrefix('tplfile', $values, array('tpl_id' => $tpl_id))) {
return false;
}
if (isset($tpl_source) && $tpl_source != '') {
- $tpl_id = 0;
$values = array(
// 'tpl_id' => $tpl_id,
'tpl_source' => $tpl_source,
);
- if ($this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
+ if (!$this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
return false;
}
}
return true;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -395,7 +369,7 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
*/
public function deleteTpl(XoopsTplfile &$tplfile)
{
- $tpl_id = $tplfile->getVar('tpl_id');
+ $tpl_id = $tplfile->id();
if (!$this->db2->deletePrefix('tplfile', array('tpl_id' => $tpl_id))) {
return false;
}
class XoopsModelJoint extends XoopsModelAbstract
{
public function getByLink(
CriteriaElement $criteria = null,
$fields = null,
$asObject = true,
$field_link = null,
$field_object = null
) {
[...]
$result = $this->handler->db2->executeQuery($sql); => $sql not defined?
[...]
--- a/htdocs/class/xoopsload.php
+++ b/htdocs/class/xoopsload.php
@@ -363,7 +363,7 @@ class XoopsLoad
'xoopsmemberhandler' => XOOPS_ROOT_PATH . '/kernel/member.php',
'xoopsmembership' => XOOPS_ROOT_PATH . '/kernel/membership.php',
'xoopsmembershiphandler' => XOOPS_ROOT_PATH . '/kernel/membership.php',
- 'xoopsmodelfactory' => XOOPS_ROOT_PATH . '/class/model/xoopsmodel.php',
+ //'xoopsmodelfactory' => XOOPS_ROOT_PATH . '/class/model/xoopsmodel.php',
'xoopsmoduleadmin' => XOOPS_ROOT_PATH . '/class/moduleadmin.php',
'xoopsmodule' => XOOPS_ROOT_PATH . '/kernel/module.php',
'xoopsmodulehandler' => XOOPS_ROOT_PATH . '/kernel/module.php',
--- a/htdocs/class/database/databasefactory.php
+++ b/htdocs/class/database/databasefactory.php
@@ -92,7 +92,7 @@ class XoopsDatabaseFactory
if (!isset($instance)) {
$config = new \Doctrine\DBAL\Configuration();
$config->setSQLLogger(new XoopsDebugStack());
- if (defined('XOOPS_DB_PARAMETERS')) {
+ if (defined('XOOPS_DB_PARAMETERS') AND $x = XOOPS_DB_PARAMETERS AND !empty($x)) {
$connectionParams = unserialize(XOOPS_DB_PARAMETERS);
$connectionParams['wrapperClass'] = 'XoopsConnection';
} else {
@@ -117,6 +117,7 @@ class XoopsDatabaseFactory
$connectionParams['driverOptions'] = $options;
}
}
+
$instance
= \Doctrine\DBAL\DriverManager::getConnection(
$connectionParams,
class Joint extends XoopsModelAbstract
line 104 has to be modified like
$qb ->select(array('o.*','l.*'));
quoteString no longer exists
line 226
$set[] = "o.{$key}=" . $this->handler->db2->quoteIdentifier($val);
I have troubles with one function used in common.php (session_status) but only defined in PHP 5.4.
Does Xoops requires PHP 5.4 at least or could we target php 5.3 also ?
--- a/htdocs/kernel/tplfile.php
+++ b/htdocs/kernel/tplfile.php
@@ -425,7 +425,8 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
->fromPrefix('tplfile', 'f')
->leftJoinPrefix('f', 'tplsource', 's', $eb->eq('s.tpl_id', 'f.tpl_id'));
}
- $criteria->renderQb($qb);
+ if (!empty($criteria))
+ $criteria->renderQb($qb);
$result = $qb->execute();
if (!$result) {
return $ret;
--- a/htdocs/xoops_lib/Xoops/Auth/Ldap.php
+++ b/htdocs/xoops_lib/Xoops/Auth/Ldap.php
@@ -206,6 +206,11 @@ class Xoops_Auth_Ldap extends Xoops_Auth
*/
public function __construct(XoopsConnection $dao = null)
{
+ if ( ! extension_loaded('ldap')) {
+ trigger_error(sprintf(XoopsLocale::F_EXTENSION_PHP_NOT_LOADED,'LDAP'), E_USER_ERROR);
+ return;
+ }
+
$xoops = Xoops::getInstance();
$this->_dao = $dao;
//Configuration options that are stored in the database
@@ -239,10 +244,6 @@ class Xoops_Auth_Ldap extends Xoops_Auth
public function authenticate($uname, $pwd = null)
{
$authenticated = false;
- if (!extension_loaded('ldap')) {
- $this->setErrors(0, XoopsLocale::E_EXTENSION_PHP_LDAP_NOT_LOADED);
- return $authenticated;
- }
$this->_ds = ldap_connect($this->ldap_server, $this->ldap_port);
if ($this->_ds) {
ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version);
--- a/htdocs/xoops_lib/Xoops/Auth/Provisioning.php
+++ b/htdocs/xoops_lib/Xoops/Auth/Provisioning.php
@@ -112,27 +112,45 @@ class Xoops_Auth_Provisioning
/**
* Launch the synchronisation process
*
- * @param $datas
+ * @param $data
* @param $uname
- * @param null $pwd
+ * @param null|$pwd
* @return bool|XoopsUser
*/
- public function sync($datas, $uname, $pwd = null)
+ public function sync($data, $uname, $pwd = null)
{
$xoopsUser = $this->getXoopsUser($uname);
if (!$xoopsUser) { // Xoops User Database not exists
if ($this->ldap_provisioning) {
- $xoopsUser = $this->add($datas, $uname, $pwd);
+ $xoopsUser = $this->add($data, $uname, $pwd);
} else {
$this->_auth_instance->setErrors(0, sprintf(XoopsLocale::EF_CORRESPONDING_USER_NOT_FOUND_IN_DATABASE, $uname));
}
} else { // Xoops User Database exists
if ($this->ldap_provisioning && $this->ldap_provisioning_upd) {
- $xoopsUser = $this->change($xoopsUser, $datas, $uname, $pwd);
+ $xoopsUser = $this->change($xoopsUser, $data, $uname, $pwd);
}
}
return $xoopsUser;
}
+
+ protected function setVarsMapping($object, $data)
+ {
+ $tab_mapping = explode('|', $this->ldap_field_mapping);
+ foreach ($tab_mapping as $mapping) {
+ $fields = explode('=', trim($mapping));
+ if (isset($fields[0]) AND ($field0 = trim($fields[0]))) {
+ if (isset($fields[1]) AND ($field1 = trim($fields[1]))) {
+ if (!empty($data[$field1][0])) {
+ $str = utf8_decode($data[$field1][0]);
+ }
+ } else {
+ $str = '';
+ }
+ $object->setVar($field0, $str);
+ }
+ }
+ }
/**
* Add a new user to the system
@@ -140,12 +158,12 @@ class Xoops_Auth_Provisioning
* @return bool
*/
/**
- * @param array $datas
+ * @param array $data
* @param string $uname
* @param string $pwd
* @return bool|XoopsUser
*/
- public function add($datas, $uname, $pwd = null)
+ public function add($data, $uname, $pwd = null)
{
$xoops = Xoops::getInstance();
$ret = false;
@@ -160,13 +178,8 @@ class Xoops_Auth_Provisioning
$newuser->setVar('theme', $this->theme_set);
$newuser->setVar('umode', $this->com_mode);
$newuser->setVar('uorder', $this->com_order);
- $tab_mapping = explode('|', $this->ldap_field_mapping);
- foreach ($tab_mapping as $mapping) {
- $fields = explode('=', trim($mapping));
- if ($fields[0] && $fields[1]) {
- $newuser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0]));
- }
- }
+ $this->setVarsMapping($newuser, $data);
+
if ($member_handler->insertUser($newuser)) {
foreach ($this->ldap_provisioning_group as $groupid) {
$member_handler->addUserToGroup($groupid, $newuser->getVar('uid'));
@@ -183,24 +196,19 @@ class Xoops_Auth_Provisioning
* Modify user information
*
* @param XoopsUser $xoopsUser
- * @param array $datas
+ * @param array $data
* @param string $uname
* @param string $pwd
* @return bool|XoopsUser
*/
- public function change(XoopsUser &$xoopsUser, $datas, $uname, $pwd = null)
+ public function change(XoopsUser &$xoopsUser, $data, $uname, $pwd = null)
{
$xoops = Xoops::getInstance();
$ret = false;
$member_handler = $xoops->getHandlerMember();
$xoopsUser->setVar('pass', password_hash(stripslashes($pwd), PASSWORD_DEFAULT));
- $tab_mapping = explode('|', $this->ldap_field_mapping);
- foreach ($tab_mapping as $mapping) {
- $fields = explode('=', trim($mapping));
- if ($fields[0] && $fields[1]) {
- $xoopsUser->setVar(trim($fields[0]), utf8_decode($datas[trim($fields[1])][0]));
- }
- }
+ $this->setVarsMapping($xoopsUser, $data);
+
if ($member_handler->insertUser($xoopsUser)) {
return $xoopsUser;
} else {
--- a/htdocs/xoops_lib/Xoops/Auth/Xoops.php
+++ b/htdocs/xoops_lib/Xoops/Auth/Xoops.php
@@ -38,7 +38,7 @@ class Xoops_Auth_Xoops extends Xoops_Auth
*
* @param XoopsConnection|null $dao
*/
- public function __construct(XoopsDatabase $dao = null)
+ public function __construct(XoopsConnection $dao = null)
{
$this->_dao = $dao;
$this->auth_method = 'xoops';
@@ -55,10 +55,13 @@ class Xoops_Auth_Xoops extends Xoops_Auth
{
$xoops = Xoops::getInstance();
$member_handler = $xoops->getHandlerMember();
- $user = $member_handler->loginUser($uname, $pwd);
- if ($user == false) {
- $this->setErrors(1, XoopsLocale::E_INCORRECT_LOGIN);
- }
+ $user = false;
+ if ($member_handler) {
+ $user = $member_handler->loginUser($uname, $pwd);
+ if ($user == false) {
+ $this->setErrors(1, XoopsLocale::E_INCORRECT_LOGIN);
+ }
+ }
return $user;
}
}
\ No newline at end of file
--- a/htdocs/locale/en_US/en_US.php
+++ b/htdocs/locale/en_US/en_US.php
@@ -449,6 +449,7 @@ class XoopsLocaleEn_US extends Xoops_Locale_Abstract
const F_WELCOME_TO = "Welcome to %s";
const F_YES_DELETE_ALL = "Yes, delete all %s";
const F_YOUR_ACCOUNT_AT = "Your account at %s";
+ const F_EXTENSION_PHP_NOT_LOADED = "PHP %s extension not loaded (verify your PHP configuration file php.ini)";
const GO_BACK = "Go back";
const GO_TO = "Go to";
const GO_TODAY = "Go today";
explicite namespace
line 146
$myts = \MyTextSanitizer::getInstance();
During my unit test I use the following statement :
$handler = new XoopsConfigItemHandler();
An error is raised because of the default null value for $db argument. In fact,$this->db2 is bind with null and after the error is when using methods of null object.
Could it be possible to initialize a default connection when $db argument is null ?
abstract class XoopsPersistableObjectHandler extends XoopsObjectHandler
{
protected function __construct(
\XoopsConnection $db = null,
$table = '',
$className = '',
$keyName = '',
$identifierName = ''
) {
parent::__construct($db);
$this->table = $this->db2->prefix($table); => error when db2 is null
$this->keyName = $keyName;
$this->className = $className;
if ($identifierName) {
$this->identifierName = $identifierName;
}
}
}
--- a/htdocs/kernel/tplfile.php
+++ b/htdocs/kernel/tplfile.php
@@ -255,7 +255,8 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
$myrow = $result->fetch(\PDO::FETCH_ASSOC);
$tplfile->assignVar('tpl_source', $myrow['tpl_source']);
}
- return true;
+ $tpl = $tplfile->getVar('tpl_source');
+ return !empty($tpl);
}
/**
@@ -267,33 +268,24 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
public function insertTpl(XoopsTplfile &$tplfile)
{
if (!$tplfile->isDirty()) {
- return true;
+ return false;
}
if (!$tplfile->cleanVars(false)) {
return false;
}
- foreach ($tplfile->cleanVars as $k => $v) {
- ${$k} = $v;
- }
if ($tplfile->isNew()) {
+ $values = $tplfile->cleanVars;
$tpl_id = 0;
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->insertPrefix('tplfile', $values)) {
return false;
}
+
if (empty($tpl_id)) {
$tpl_id = $this->db2->lastInsertId();
}
+
if (isset($tpl_source) && $tpl_source != '') {
$values = array(
'tpl_id' => $tpl_id,
@@ -309,17 +301,10 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
}
$tplfile->assignVar('tpl_id', $tpl_id);
} else {
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $values = $tplfile->cleanVars;
+ $tpl_id = $tplfile->id();
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->updatePrefix('tplfile', $values, array('tpl_id' => $tpl_id))) {
return false;
}
@@ -329,7 +314,7 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
// 'tpl_id' => $tpl_id,
'tpl_source' => $tpl_source,
);
- if ($this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
+ if (!$this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
return false;
}
}
@@ -345,46 +330,35 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
public function forceUpdate(XoopsTplfile &$tplfile)
{
if (!$tplfile->isDirty()) {
- return true;
+ return false;
}
if (!$tplfile->cleanVars(false)) {
return false;
}
- foreach ($tplfile->cleanVars as $k => $v) {
- ${$k} = $v;
- }
+
if (!$tplfile->isNew()) {
- $tpl_id = 0;
- $values = array(
- // 'tpl_id' => $tpl_id,
- 'tpl_module' => $tpl_module,
- 'tpl_refid' => $tpl_refid,
- 'tpl_tplset' => $tpl_tplset,
- 'tpl_file' => $tpl_file,
- 'tpl_desc' => $tpl_desc,
- 'tpl_lastmodified' => $tpl_lastmodified,
- 'tpl_lastimported' => $tpl_lastimported,
- 'tpl_type' => $tpl_type,
- );
+ $values = $tplfile->cleanVars;
+ $tpl_id = $tplfile->id();
+ $tpl_source = $tplfile->tpl_source();
+
if (!$this->db2->updatePrefix('tplfile', $values, array('tpl_id' => $tpl_id))) {
return false;
}
if (isset($tpl_source) && $tpl_source != '') {
- $tpl_id = 0;
$values = array(
// 'tpl_id' => $tpl_id,
'tpl_source' => $tpl_source,
);
- if ($this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
+ if (!$this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
return false;
}
}
return true;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -395,7 +369,7 @@ class XoopsTplfileHandler extends XoopsPersistableObjectHandler
*/
public function deleteTpl(XoopsTplfile &$tplfile)
{
- $tpl_id = $tplfile->getVar('tpl_id');
+ $tpl_id = $tplfile->id();
if (!$this->db2->deletePrefix('tplfile', array('tpl_id' => $tpl_id))) {
return false;
}
As all model scripts are now into /kernel/model/ this directory seems no longer required. I suppress this directory and doesn't see defects.
--- a/htdocs/class/xoopslists.php
+++ b/htdocs/class/xoopslists.php
@@ -126,7 +126,7 @@ class xoopslists
if (substr($dirname, -1) != '/') {
$dirname .= '/';
}
- if ($handle = opendir($dirname)) {
+ if (is_dir($dirname) AND $handle = opendir($dirname)) {
while ($file = readdir($handle)) {
if (substr($file, 0, 1) == '.' || in_array(strtolower($file), $ignored)) {
continue;
@@ -187,7 +187,7 @@ class xoopslists
public static function getImgListAsArray($dirname, $prefix = '')
{
$filelist = array();
- if ($handle = opendir($dirname)) {
+ if (is_dir($dirname) AND $handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
if (preg_match('/\.(gif|jpg|jpeg|png|swf)$/i', $file)) {
$file = $prefix . $file;
@@ -215,7 +215,7 @@ class xoopslists
public static function getHtmlListAsArray($dirname, $prefix = '')
{
$filelist = array();
- if ($handle = opendir($dirname)) {
+ if (is_dir($dirname) AND $handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
if ((preg_match('/\.(htm|html|xhtml)$/i', $file) && !is_dir($file))) {
$file = $prefix . $file;
Fatal error: Class 'LegacyLogger' not found in \modules\logger\preloads\core.php on line 108
XOOPS somehow cannot load the LegacyLogger.
It goes to line 83 in \class\xoopsload.php, but the legacylogger is set to "false", so it fails. See below:
Is it related to the comment that "//Load may fail if cache was erased" ?
Steps to reproduce:
go to Preferences for Logger, change status of "Display Legacy Logger", and save.
If the debug is not on, then is goes through, but if you set the debug on, then it generates the Fatal error.
I don't find a file where the class XoopsConfigItemOption is defined.
This class is an object use by kernel/configItem
--- a/htdocs/class/zipdownloader.php
+++ b/htdocs/class/zipdownloader.php
@@ -56,11 +56,14 @@ class XoopsZipDownloader extends XoopsDownloader
public function addFile($filepath, $newfilename = null)
{
// Read in the file's contents
- $fp = fopen($filepath, "r");
+ $fp = @fopen($filepath, "r");
+ if ($fp === false)
+ return false;
$data = fread($fp, filesize($filepath));
fclose($fp);
$filename = (isset($newfilename) && trim($newfilename) != '') ? trim($newfilename) : $filepath;
- $this->archiver->addFile($data, $filename, filemtime($filename));
+ $result = $this->archiver->addFile($data, $filename, filemtime($filename));
+ return $result;
}
/**
@@ -72,11 +75,14 @@ class XoopsZipDownloader extends XoopsDownloader
public function addBinaryFile($filepath, $newfilename = null)
{
// Read in the file's contents
- $fp = fopen($filepath, "rb");
+ $fp = @fopen($filepath, "rb");
+ if ($fp === false)
+ return false;
$data = fread($fp, filesize($filepath));
fclose($fp);
$filename = (isset($newfilename) && trim($newfilename) != '') ? trim($newfilename) : $filepath;
- $this->archiver->addFile($data, $filename, filemtime($filename));
+ $result = $this->archiver->addFile($data, $filename, filemtime($filename));
+ return $result;
}
/**
@@ -90,7 +96,8 @@ class XoopsZipDownloader extends XoopsDownloader
*/
public function addFileData(&$data, $filename, $time = 0)
{
- $this->archiver->addFile($data, $filename, $time);
+ $result = $this->archiver->addFile($data, $filename, $time);
+ return $result;
}
/**
@@ -104,7 +111,8 @@ class XoopsZipDownloader extends XoopsDownloader
*/
public function addBinaryFileData(&$data, $filename, $time = 0)
{
- $this->addFileData($data, $filename, $time);
+ $result = $this->addFileData($data, $filename, $time);
+ return $result;
}
/**
@@ -116,6 +124,8 @@ class XoopsZipDownloader extends XoopsDownloader
public function download($name, $gzip = true)
{
$this->_header($name . $this->ext);
- echo $this->archiver->file();
+ $result = $this->archiver->file();
+ if ($result !== false)
+ echo $result;
}
}
\ No newline at end of file
When I test the class xoops_lib/Xoops/Core/XoopsTpl.php I have an error,
class 'SmartyBC' not found in ...XoopsTpl.php line 37.
And I don't find any php script defining this class in all XoopsCore directories.
Where is SmartyBC class located ?
--- a/htdocs/class/database/connection.php
+++ b/htdocs/class/database/connection.php
@@ -161,17 +161,17 @@ class XoopsConnection extends \Doctrine\DBAL\Connection
*
* @param string $tableName The name of the table to update.
* @param array $data The data to update
- * @param array $identifier The update criteria.
+ * @param array $criteria The update criteria.
* An associative array containing column-value pairs.
* @param array $types Types of the merged $data and
- * $identifier arrays in that order.
+ * $criteria arrays in that order.
*
* @return integer The number of affected rows.
*/
- public function updatePrefix($tableName, array $data, array $identifier, array $types = array())
+ public function updatePrefix($tableName, array $data, array $criteria, array $types = array())
{
$tableName = $this->prefix($tableName);
- return $this->update($tableName, $data, $identifier, $types);
+ return $this->update($tableName, $data, $criteria, $types);
}
/**
@@ -180,16 +180,16 @@ class XoopsConnection extends \Doctrine\DBAL\Connection
* Adds prefix to the name of the table then passes to delete function.
*
* @param string $tableName The name of the table on which to delete.
- * @param array $identifier The deletion criteria.
+ * @param array $criteria The deletion criteria.
* An associative array containing column-value pairs.
*
* @return integer The number of affected rows.
*
*/
- public function deletePrefix($tableName, array $identifier)
+ public function deletePrefix($tableName, array $criteria)
{
$tableName = $this->prefix($tableName);
- return $this->delete($tableName, $identifier);
+ return $this->delete($tableName, $criteria);
}
/**
--- a/htdocs/class/userutility.php
+++ b/htdocs/class/userutility.php
@@ -103,6 +103,12 @@ class XoopsUserUtility
$email = $user->getVar('email', 'n');
}
+ $user = empty($user) ? null : trim($user);
+ $uname = empty($uname) ? null : trim($uname);
+ $email = empty($email) ? null : trim($email);
+ $pass = empty($pass) ? null : trim($pass);
+ $vpass = empty($vpass) ? null : trim($vpass);
+
$xoops->getConfigs();
$stop = '';
@@ -115,8 +121,9 @@ class XoopsUserUtility
}
// Check forbidden email address if current operator is not an administrator
if (!$xoops->userIsAdmin) {
- foreach ($xoops->getConfig('bad_emails') as $be) {
- if (!empty($be) && preg_match('/' . $be . '/i', $email)) {
+ $bad_emails = $xoops->getConfig('bad_emails');
+ if (!empty($bad_emails)) foreach ($bad_emails as $be) {
+ if (!empty($be) AND preg_match('/' . $be . '/i', $email)) {
$stop .= XoopsLocale::E_INVALID_EMAIL . '<br />';
break;
}
@@ -138,19 +145,22 @@ class XoopsUserUtility
$restriction = '/[\000-\040]/';
break;
}
- if (empty($uname) || preg_match($restriction, $uname)) {
+ if (empty($uname) OR preg_match($restriction, $uname)) {
$stop .= XoopsLocale::E_INVALID_USERNAME . '<br />';
}
// Check uname settings if current operator is not an administrator
if (!$xoops->userIsAdmin) {
- if (mb_strlen($uname) > $xoops->getConfig('maxuname')) {
- $stop .= sprintf(XoopsLocale::EF_USERNAME_MUST_BE_LESS_THAN, $xoops->getConfig('maxuname')) . '<br />';
+ $maxuname = $xoops->getConfig('maxuname');
+ if (!empty($maxuname) AND mb_strlen($uname) > $maxuname) {
+ $stop .= sprintf(XoopsLocale::EF_USERNAME_MUST_BE_LESS_THAN, $maxuname) . '<br />';
}
- if (mb_strlen($uname) < $xoops->getConfig('minuname')) {
- $stop .= sprintf(XoopsLocale::EF_USERNAME_MUST_BE_MORE_THAN, $xoops->getConfig('minuname')) . '<br />';
+ $minuname = $xoops->getConfig('minuname');
+ if (!empty($minuname) AND mb_strlen($uname) < $minuname) {
+ $stop .= sprintf(XoopsLocale::EF_USERNAME_MUST_BE_MORE_THAN, $minuname) . '<br />';
}
- foreach ($xoops->getConfig('bad_unames') as $bu) {
- if (!empty($bu) && preg_match('/' . $bu . '/i', $uname)) {
+ $bad_unames = $xoops->getConfig('bad_unames');
+ if (!empty($bad_unames)) foreach ($bad_unames as $bu) {
+ if (!empty($bu) AND preg_match('/' . $bu . '/i', $uname)) {
$stop .= XoopsLocale::E_NAME_IS_RESERVED . '<br />';
break;
}
@@ -181,18 +191,19 @@ class XoopsUserUtility
}
// If password is not set, skip password validation
- if ($pass === null && $vpass === null) {
+ if ($pass === null AND $vpass === null) {
return $stop;
}
- if (!isset($pass) || $pass == '' || !isset($vpass) || $vpass == '') {
+ if (empty($pass) OR empty($vpass)) {
$stop .= XoopsLocale::E_MUST_PROVIDE_PASSWORD . '<br />';
}
- if ((isset($pass)) && ($pass != $vpass)) {
+ if (isset($pass) AND isset($vpass) AND ($pass != $vpass)) {
$stop .= XoopsLocale::E_PASSWORDS_MUST_MATCH . '<br />';
} else {
- if (($pass != '') && (mb_strlen($pass) < $xoops->getConfig('minpass'))) {
- $stop .= sprintf(XoopsLocale::EF_PASSWORD_MUST_BE_GREATER_THAN, $xoops->getConfig('minpass')) . '<br />';
+ $minpass = $xoops->getConfig('minpass');
+ if (($pass != '') AND (!empty($minpass)) AND (mb_strlen($pass) < $minpass)) {
+ $stop .= sprintf(XoopsLocale::EF_PASSWORD_MUST_BE_GREATER_THAN, $minpass) . '<br />';
}
}
return $stop;
--- a/htdocs/kernel/block.php
+++ b/htdocs/kernel/block.php
@@ -605,20 +605,20 @@ class XoopsBlockHandler extends XoopsPersistableObjectHandler
$qb = $this->db2->createXoopsQueryBuilder();
$eb = $qb->expr();
- $qb ->fromPrefix('newblocks')
+ $qb ->fromPrefix('newblocks', null)
->where($eb->eq('isactive', $qb->createNamedParameter($isactive, \PDO::PARAM_INT)));
if (isset($side)) {
// get both sides in sidebox? (some themes need this)
if ($side == XOOPS_SIDEBLOCK_BOTH) {
- $qb->andWhere($eb->in('b.side', array(0,1)));
+ $qb->andWhere($eb->in('side', array(0,1)));
} elseif ($side == XOOPS_CENTERBLOCK_ALL) {
- $qb->andWhere($eb->in('b.side', array(3,4,5,7,8,9)));
+ $qb->andWhere($eb->in('side', array(3,4,5,7,8,9)));
} else {
- $qb->andWhere($eb->eq('b.side', $qb->createNamedParameter($side, \PDO::PARAM_INT)));
+ $qb->andWhere($eb->eq('side', $qb->createNamedParameter($side, \PDO::PARAM_INT)));
}
}
if (isset($visible)) {
- $qb->andWhere($eb->eq('b.visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
+ $qb->andWhere($eb->eq('visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
}
$qb->orderBy($orderby);
switch ($rettype) {
--- a/htdocs/class/tardownloader.php
+++ b/htdocs/class/tardownloader.php
@@ -45,7 +45,10 @@ class XoopsTarDownloader extends XoopsDownloader
*/
public function addFile($filepath, $newfilename = null)
{
- $this->archiver->addFile($filepath);
+ $result = $this->archiver->addFile($filepath);
+ if ($result === false) {
+ return false;
+ }
if (isset($newfilename)) {
// dirty, but no other way
for($i = 0; $i < $this->archiver->numFiles; $i ++) {
@@ -65,7 +68,10 @@ class XoopsTarDownloader extends XoopsDownloader
*/
public function addBinaryFile($filepath, $newfilename = null)
{
- $this->archiver->addFile($filepath, true);
+ $result = $this->archiver->addFile($filepath, true);
+ if ($result === false) {
+ return false;
+ }
if (isset($newfilename)) {
// dirty, but no other way
for($i = 0; $i < $this->archiver->numFiles; $i ++) {
@@ -87,11 +93,17 @@ class XoopsTarDownloader extends XoopsDownloader
public function addFileData(&$data, $filename, $time = 0)
{
$dummyfile = XOOPS_CACHE_PATH . '/dummy_' . time() . '.html';
- $fp = fopen($dummyfile, 'w');
+ $fp = @fopen($dummyfile, 'w');
+ if ($fp === false) {
+ return false;
+ }
fwrite($fp, $data);
fclose($fp);
- $this->archiver->addFile($dummyfile);
+ $result = $this->archiver->addFile($dummyfile);
unlink($dummyfile);
+ if ($result === false) {
+ return false;
+ }
// dirty, but no other way
for($i = 0; $i < $this->archiver->numFiles; $i ++) {
if ($this->archiver->files[$i]['name'] == $dummyfile) {
@@ -114,11 +126,17 @@ class XoopsTarDownloader extends XoopsDownloader
public function addBinaryFileData(&$data, $filename, $time = 0)
{
$dummyfile = XOOPS_CACHE_PATH . '/dummy_' . time() . '.html';
- $fp = fopen($dummyfile, 'wb');
+ $fp = @fopen($dummyfile, 'wb');
+ if ($fp === false) {
+ return false;
+ }
fwrite($fp, $data);
fclose($fp);
- $this->archiver->addFile($dummyfile, true);
+ $result = $this->archiver->addFile($dummyfile, true);
unlink($dummyfile);
+ if ($result === false) {
+ return false;
+ }
// dirty, but no other way
for($i = 0; $i < $this->archiver->numFiles; $i ++) {
if ($this->archiver->files[$i]['name'] == $dummyfile) {
@@ -140,6 +158,9 @@ class XoopsTarDownloader extends XoopsDownloader
public function download($name, $gzip = true)
{
$this->_header($name . $this->ext);
- echo $this->archiver->toTarOutput($name . $this->ext, $gzip);
+ $str = $this->archiver->toTarOutput($name . $this->ext, $gzip);
+ if ($str !== false) {
+ echo $str;
+ }
}
}
\ No newline at end of file
Fatal error: Call to a member function prefix() on a non-object in
C:\...\modules\system\admin\users\users.php on line 67
None All Errors (1) Deprecated (1) Queries (8) Blocks (0) Extra (2) Timers(5)
Errors
Notice: Undefined variable: xoopsDB in file /modules/system/admin/users/users.php line 67
why aren't handlers used here?
and in submitting a new user on local i get this
http://i.imgur.com/qpiY06W.png
Try first update and in case of 0 modification do an insert (no select first)
--- a/htdocs/kernel/online.php
+++ b/htdocs/kernel/online.php
@@ -132,41 +132,23 @@ class XoopsOnlineHandler extends XoopsPersistableObjectHandler
*/
public function write($uid, $uname, $time, $module, $ip)
{
-
- $qb = $this->db2->createXoopsQueryBuilder();
- $eb = $qb->expr();
-
- $qb ->select('COUNT(*)')
- ->fromPrefix('online', null)
- ->where($eb->eq('online_uid', ':uid'))
- ->setParameter(':uid', $uid, \PDO::PARAM_INT);
-
- if ($uid > 0) {
- $qb ->where($eb->eq('online_ip', ':ip'))
- ->setParameter(':ip', $ip, \PDO::PARAM_STR);
- }
-
- $result = $qb->execute();
- $count = $result->fetchColumn(0);
-
- if ($count > 0) {
- $identifier = array();
- $identifier['online_uid'] = $uid;
- if ($uid == 0) {
- $identifier['online_ip'] = $ip;
- }
- $rows = $this->db2->updatePrefix(
- 'online',
- array(
- 'online_uid' => $uid,
- 'online_uname' => $uname,
- 'online_updated' => $time,
- 'online_ip' => $ip,
- 'online_module' => $module,
- ),
- $identifier
- );
- } else {
+ $criteria = array();
+ $criteria['online_uid'] = $uid;
+ if ($uid == 0) {
+ $criteria['online_ip'] = $ip;
+ }
+ $rows = $this->db2->updatePrefix(
+ 'online',
+ array(
+ 'online_uname' => $uname,
+ 'online_updated' => $time,
+ 'online_module' => $module,
+ ),
+ $criteria
+ );
+ if ($rows === false)
+ return false;
+ if ($rows == 0) {
$rows = $this->db2->insertPrefix(
'online',
array(
@@ -178,6 +160,8 @@ class XoopsOnlineHandler extends XoopsPersistableObjectHandler
)
);
}
+ if ($rows === false)
+ return false;
return ($rows>0);
}
@@ -191,7 +175,7 @@ class XoopsOnlineHandler extends XoopsPersistableObjectHandler
public function destroy($uid)
{
$criteria = new Criteria('online_uid', intval($uid));
- if (!$this->deleteAll($criteria)) {
+ if (false === $this->deleteAll($criteria)) {
return false;
}
return true;
@@ -209,7 +193,7 @@ class XoopsOnlineHandler extends XoopsPersistableObjectHandler
public function gc($expire)
{
$criteria = new Criteria('online_updated', time() - intval($expire), '<');
- if (!$this->deleteAll($criteria)) {
+ if (false === $this->deleteAll($criteria)) {
return false;
}
return true;
Investigate inclusion of PHPIDS (See https://github.com/PHPIDS/PHPIDS) or a derivative as a suplement to current Protector module. See discussion in PR #93
this table is not created during the install process but there is still an configcategory.php file in kernel with 3 fields
--- a/htdocs/xoops_lib/Xoops/Core/Kernel/CriteriaCompo.php
+++ b/htdocs/xoops_lib/Xoops/Core/Kernel/CriteriaCompo.php
@@ -80,6 +80,8 @@ class CriteriaCompo extends CriteriaElement
{
$ret = '';
foreach ($this->criteriaElements as $i => $element) {
+ if (!is_object($element))
+ continue;
/* @var $element CriteriaElement */
if ($i == 0) {
$ret = $element->render();
@@ -87,10 +89,11 @@ class CriteriaCompo extends CriteriaElement
if (!$render = $element->render()) {
continue;
}
- $ret .= ' ' . $this->conditions[$i] . ' ' . $render;
+ $ret .= ' ' . $this->conditions[$i] . ' (' . $render . ')';
}
$ret = "({$ret})";
}
+ $ret = ($ret=='()') ? '(1)' : $ret;
return $ret;
}
--- a/htdocs/kernel/membership.php
+++ b/htdocs/kernel/membership.php
@@ -39,6 +39,37 @@ class XoopsMembership extends XoopsObject
$this->initVar('groupid', XOBJ_DTYPE_INT, null, false);
$this->initVar('uid', XOBJ_DTYPE_INT, null, false);
}
+
+ /**
+ * getter for id generic key
+ * @param string $format
+ * @return mixed
+ */
+ public function id($format = 'n')
+ {
+ return $this->linkid($format);
+ }
+
+ /**
+ * getter for linkid field
+ * @param string $format
+ * @return mixed
+ */
+ public function linkid($format = '')
+ {
+ return $this->getVar('linkid', $format);
+ }
+
+ /**
+ * getter for uid field
+ * @param string $format
+ * @return mixed
+ */
+ public function uid($format = '')
+ {
+ return $this->getVar('uid', $format);
+ }
+
}
/**
--- a/htdocs/kernel/online.php
+++ b/htdocs/kernel/online.php
@@ -43,6 +43,15 @@ class XoopsOnline extends XoopsObject
$this->initVar('online_module', XOBJ_DTYPE_INT, null, true);
$this->initVar('online_ip', XOBJ_DTYPE_TXTBOX, null, true);
}
+
+ /**
+ * @param string $format
+ * @return mixed
+ */
+ public function id($format = 'n')
+ {
+ return $this->online_uid($format);
+ }
/**
* @param string $format
--- a/htdocs/kernel/ranks.php
+++ b/htdocs/kernel/ranks.php
@@ -39,6 +39,77 @@ class XoopsRanks extends XoopsObject
$this->initVar('rank_special', XOBJ_DTYPE_INT, null, false, 1);
$this->initVar('rank_image', XOBJ_DTYPE_TXTBOX, null, false);
}
+
+ /**
+ * getter for id generic key
+ * @param string $format
+ * @return mixed
+ */
+ public function id($format = 'n')
+ {
+ return $this->rank_id($format);
+ }
+
+ /**
+ * getter for rank_id field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_id($format = '')
+ {
+ return $this->getVar('rank_id', $format);
+ }
+
+ /**
+ * getter for rank_title field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_title($format = '')
+ {
+ return $this->getVar('rank_title', $format);
+ }
+
+ /**
+ * getter for rank_min field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_min($format = '')
+ {
+ return $this->getVar('rank_min', $format);
+ }
+
+ /**
+ * getter for rank_max field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_max($format = '')
+ {
+ return $this->getVar('rank_max', $format);
+ }
+
+ /**
+ * getter for rank_special field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_special($format = '')
+ {
+ return $this->getVar('rank_special', $format);
+ }
+
+ /**
+ * getter for rank_image field
+ * @param string $format
+ * @return mixed
+ */
+ public function rank_image($format = '')
+ {
+ return $this->getVar('rank_image', $format);
+ }
+
}
class XoopsRanksHandler extends XoopsPersistableObjectHandler
$helper = Comments::getInstance();
cannot be assigned, since there is no access to the file where it is declared
Solution:
In Comments:
add after line 31 of: \modules\comments\include\install.php
XoopsLoad::loadFile($xoops->path('modules/comments/class/helper.php'));
The same for Notifications:
add this line in modules\notifications\include\install.php
XoopsLoad::loadFile($xoops->path('modules/notifications/class/helper.php'));
opened a separeted issue for this
all steps in installer go fine, till after the module selection
it gives the error
Fatal error: Call to a member function rowCount() on a non-object in
C:\...\class\database\mysqldatabase.php on line 206
after a refresh it gives the success message but background errors
Notice: Trying to get property of non-object in
C:\...\install\page_moduleinstaller.php on line 56
Notice: Trying to get property of non-object in
C:\...\install\page_moduleinstaller.php on line 56
Notice: Trying to get property of non-object in
C:\...\install\page_moduleinstaller.php on line 56
same goes with extentions install
Notice: Undefined variable: xoopsDB in
C:\...\modules\comments\include\install.php on line 24
Fatal error: Call to a member function prefix() on a non-object in
C:\...\modules\comments\include\install.php on line 24
but the refresh gives success without errors
@@ -117,6 +117,7 @@ public static function setClassName($registryClassName = 'Xoops_Registry')
}
self::$_registryClassName = $registryClassName;
+ return true;
}
/**
--- a/htdocs/class/userutility.php
+++ b/htdocs/class/userutility.php
@@ -71,6 +71,9 @@ class XoopsUserUtility
*/
static function validate()
{
+ if (!extension_loaded('mbstring')) {
+ return false;
+ }
$xoops = Xoops::getInstance();
$args = func_get_args();
$args_num = func_num_args();
--- a/htdocs/xoops_lib/Xoops/Cache/Abstract.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Abstract.php
@@ -57,6 +57,15 @@ abstract class Xoops_Cache_Abstract
* @var string
*/
protected $_groupPrefix = null;
+
+ public function __construct($extension = null)
+ {
+ if ($extension) {
+ if ( ! extension_loaded($extension)) {
+ trigger_error(sprintf(XoopsLocale::F_EXTENSION_PHP_NOT_LOADED, $extension), E_USER_ERROR);
+ }
+ }
+ }
/**
* Initialize the cache engine
@@ -176,7 +185,7 @@ abstract class Xoops_Cache_Abstract
*/
public function groups()
{
- return $this->settings['groups'];
+ return empty($this->settings['groups']) ? array() : $this->settings['groups'] ;
}
/**
@@ -207,7 +216,15 @@ abstract class Xoops_Cache_Abstract
$prefix = vsprintf($this->_groupPrefix, $this->groups());
}
+ if (is_object($key)) {
+ if ( ! method_exists($key,'__toString')) {
+ $key = get_class($key);
+ }
+ } elseif (is_array($key)) {
+ return false;
+ }
$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DIRECTORY_SEPARATOR, '/', '.'), '_', strval($key)))));
+ $key = preg_replace('/[\_]+/', '_', $key);
return $prefix . $key;
}
}
--- a/htdocs/xoops_lib/Xoops/Cache/Apc.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Apc.php
@@ -52,6 +52,11 @@ class Xoops_Cache_Apc extends Xoops_Cache_Abstract
* @var array
*/
protected $_compiledGroupNames = array();
+
+ public function __construct()
+ {
+ parent::__construct('apc');
+ }
/**
* Initialize the Cache Engine
--- a/htdocs/xoops_lib/Xoops/Cache/Memcache.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Memcache.php
@@ -71,6 +71,11 @@ class Xoops_Cache_Memcache extends Xoops_Cache_Abstract
* @var array
*/
public $settings = array();
+
+ public function __construct()
+ {
+ parent::__construct('memcache');
+ }
/**
* Initialize the Cache Engine
--- a/htdocs/xoops_lib/Xoops/Cache/Model.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Model.php
@@ -71,6 +71,14 @@ class Xoops_Cache_Model extends Xoops_Cache_Abstract
* @access private
*/
private $fields = array();
+
+ public function __construct()
+ {
+ $this->model = Xoops::getInstance()->getHandlerCachemodel();
+ if ( ! $this->model) {
+ trigger_error(sprintf(XoopsLocale::F_EXTENSION_PHP_NOT_LOADED,__CLASS__), E_USER_ERROR);
+ }
+ }
/**
* Initialize the Cache Engine
@@ -88,7 +96,6 @@ class Xoops_Cache_Model extends Xoops_Cache_Abstract
$defaults = array('fields' => array('cache_data', 'cache_expires'));
$this->settings = array_merge($defaults, $this->settings);
$this->fields = $this->settings['fields'];
- $this->model = Xoops::getInstance()->getHandlerCachemodel();
return true;
}
--- a/htdocs/xoops_lib/Xoops/Cache/Redis.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Redis.php
@@ -59,6 +59,11 @@ class Xoops_Cache_Redis extends Xoops_Cache_Abstract
* @var array
*/
public $settings = array();
+
+ public function __construct()
+ {
+ parent::__construct('redis');
+ }
/**
* Initialize the Cache Engine
@@ -71,9 +76,6 @@ class Xoops_Cache_Redis extends Xoops_Cache_Abstract
*/
public function init($settings = array())
{
- if (!class_exists('Redis')) {
- return false;
- }
parent::init(array_merge(array(
'engine' => 'Redis', 'prefix' => null, 'server' => '127.0.0.1', 'port' => 6379, 'timeout' => 0,
'persistent' => true
--- a/htdocs/xoops_lib/Xoops/Cache/Wincache.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Wincache.php
@@ -50,6 +50,11 @@ class Xoops_Cache_Wincache extends Xoops_Cache_Abstract
* @var array
**/
protected $_compiledGroupNames = array();
+
+ public function __construct()
+ {
+ parent::__construct('wincache');
+ }
/**
* Initialize the Cache Engine
--- a/htdocs/xoops_lib/Xoops/Cache/Xcache.php
+++ b/htdocs/xoops_lib/Xoops/Cache/Xcache.php
@@ -54,6 +54,11 @@ class Xoops_Cache_Xcache extends Xoops_Cache_Abstract
* @var array
*/
public $settings = array();
+
+ public function __construct()
+ {
+ parent::__construct('xcache');
+ }
/**
* Initialize the Cache Engine
Hello,
Instead of recreating categories or tags code in xoops why not create reusable code and database maybe in the sql have module name for what the categories system is for.
would also speed up development for other plugins.
I can also create concept if you like in xoops api
Doctrine\DBAL\DBALException: An exception occurred while executing 'SELECT * FROM xd9b_group_permission WHERE (gperm_name = ? AND gperm_modid = ? AND )' with params ["system_admin", "1"]:
SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de ')' à la ligne 1
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:91
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php:693
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\class\database\connection.php:216
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\vendor\doctrine\dbal\lib\Doctrine\DBAL\Query\QueryBuilder.php:204
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\Xoops\Core\Kernel\Model\Read.php:68
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\Xoops\Core\Kernel\Model\Read.php:111
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\xoops_lib\Xoops\Core\Kernel\XoopsPersistableObjectHandler.php:371
D:\MesApp\EasyPHP\www\XoopsCore\htdocs\kernel\groupperm.php:254
The array passed takes 3 items : 2 are criteria but the last is a criteriaCompo. May be the criteriaCompo is not handled properly
--- a/htdocs/xoops_lib/Xoops/Core/Kernel/XoopsModelFactory.php
+++ b/htdocs/xoops_lib/Xoops/Core/Kernel/XoopsModelFactory.php
@@ -72,7 +72,7 @@ class XoopsModelFactory
/* @var $handler XoopsModelAbstract */
$handler = clone (self::$handlers[$name]);
$handler->setHandler($oHandler);
- if (!empty($args) && is_array($args) && is_a($handler, 'XoopsModelAbstract')) {
+ if (!empty($args) && is_array($args) && is_a($handler, 'Xoops\Core\Kernel\XoopsModelAbstract')) {
$handler->setVars($args);
}
return $handler;
Originally, in XOOPS 2.5.x we had $force as false:
function delete(&$object, $force = false)
Now in the new one we have changed "false" to "true":
public function delete(XoopsObject $object, $force = true)
which makes it incompatible with existing modules.
Is this correct, i.e. do we need to update the modules, or will you reverse the function in Core?
in the Modules installation step, the Logger language file modinfo.php is included twice, in the background and as a module in the list:
Notice: Constant _MI_LOGGER_NAME already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 21
Notice: Constant _MI_LOGGER_DSC already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 22
Notice: Constant _MI_LOGGER_DEBUGMODE already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 24
Notice: Constant _MI_LOGGER_DEBUGMODE0 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 25
Notice: Constant _MI_LOGGER_DEBUGMODE1 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 26
Notice: Constant _MI_LOGGER_DEBUGMODE2 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 27
Notice: Constant _MI_LOGGER_DEBUGMODE3 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 28
Notice: Constant _MI_LOGGER_DEBUGLEVEL already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 30
Notice: Constant _MI_LOGGER_DEBUGLEVEL0 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 31
Notice: Constant _MI_LOGGER_DEBUGLEVEL1 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 32
Notice: Constant _MI_LOGGER_DEBUGLEVEL2 already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 33
Notice: Constant _MI_LOGGER_DEBUGPLUGIN already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 35
Notice: Constant _MI_LOGGER_DEBUGPLUGIN_LEGACY already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 36
Notice: Constant _MI_LOGGER_DEBUGPLUGIN_PQP already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 37
Notice: Constant _MI_LOGGER_DEBUGPLUGIN_FIREPHP already defined in C:\easyphp\data\localweb\scripts\xoops\260\modules\logger\language\english\modinfo.php on line 38
after submitting after both modules and extentions it gives
after modules
Fatal error: Call to a member function rowCount() on a non-object in
after modules
Fatal error: Call to a member function rowCount() on a non-object in C:\easyphp\data\localweb\scripts\xoops\260\class\database\mysqldatabase.php on line 206
-- refresh
Notice: Trying to get property of non-object in C:\easyphp\data\localweb\scripts\xoops\260\install\page_moduleinstaller.php on line 56
Notice: Trying to get property of non-object in C:\easyphp\data\localweb\scripts\xoops\260\install\page_moduleinstaller.php on line 56
after extentions
Notice: Undefined variable: xoopsDB in C:\easyphp\data\localweb\scripts\xoops\260\modules\avatars\include\install.php on line 26
Fatal error: Call to a member function prefix() on a non-object in C:\easyphp\data\localweb\scripts\xoops\260\modules\avatars\include\install.php on line 26
-- refresh gives no error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.