Skip to content

Commit

Permalink
Fixed DataFilter class namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
MekDrop authored and ImpressBot committed Oct 26, 2021
1 parent e4c04e5 commit ef8f4ff
Show file tree
Hide file tree
Showing 44 changed files with 577 additions and 492 deletions.
4 changes: 2 additions & 2 deletions core/Models/ConfigItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ public function getConfValueForOutput() {
*/
public function setConfValueForInput($value, $force_slash = false) {
if ($this->conf_formtype == 'textarea' && $this->conf_valuetype !== 'array') {
$value = icms_core_DataFilter::checkVar($value, 'html', 'input');
$value = DataFilter::checkVar($value, 'html', 'input');
} elseif ($this->conf_formtype == 'textsarea' && $this->conf_valuetype !== 'array') {
$value = icms_core_DataFilter::checkVar($value, 'text', 'input');
$value = DataFilter::checkVar($value, 'text', 'input');
} elseif ($this->conf_formtype == 'password') {
$value = filter_var($value, FILTER_SANITIZE_URL);
} else {
Expand Down
50 changes: 26 additions & 24 deletions edituser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
/**
* Generates form and validation for editing users
*
* @copyright http://www.xoops.org/ The Xoops Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @package Member
* @subpackage Users
* @since Xoops
* @author skalpa <psk@psykaos.net>
* @copyright http://www.xoops.org/ The Xoops Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @package Member
* @subpackage Users
* @since Xoops
* @author skalpa <psk@psykaos.net>
*/

use ImpressCMS\Core\DataFilter;

$xoopsOption['pagetype'] = 'user';
if (icms_get_module_status('profile') && file_exists(ICMS_MODULES_PATH . '/profile/edituser.php')) {
header('Location: ' . ICMS_MODULES_URL . '/profile/edituser.php');
Expand Down Expand Up @@ -94,11 +96,11 @@
);

if (!empty($_GET)) {
$clean_GET = icms_core_DataFilter::checkVarArray($_GET, $filter_get, false);
$clean_GET = DataFilter::checkVarArray($_GET, $filter_get, false);
extract($clean_GET);
}
if (!empty($_POST)) {
$clean_POST = icms_core_DataFilter::checkVarArray($_POST, $filter_post, false);
$clean_POST = DataFilter::checkVarArray($_POST, $filter_post, false);
extract($clean_POST);
}

Expand All @@ -116,17 +118,17 @@

if ($icmsConfigUser['allow_chgmail'] == 1) {
if (!empty($email)) {
$email = icms_core_DataFilter::stripSlashesGPC(trim($email));
$email = DataFilter::stripSlashesGPC(trim($email));
}

if ($email == '' || !icms_core_DataFilter::checkVar($email, 'email', 0, 1)) {
if ($email == '' || !DataFilter::checkVar($email, 'email', 0, 1)) {
$errors[] = _US_INVALIDMAIL;
}

$count = 0;
if ($email) {
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE email = %s',
icms::$xoopsDB->prefix('users'), icms::$xoopsDB->quoteString(addslashes($email)));
icms::$xoopsDB->prefix('users'), icms::$xoopsDB->quoteString(addslashes($email)));
$result = icms::$xoopsDB->query($sql);
list($count) = icms::$xoopsDB->fetchRow($result);
if ($count > 1) {
Expand All @@ -137,7 +139,7 @@

if ($icmsConfigUser['allow_chguname'] == 1) {
if (!empty($uname)) {
$uname = icms_core_DataFilter::stripSlashesGPC(trim($uname));
$uname = DataFilter::stripSlashesGPC(trim($uname));
}

if ($uname == '') {
Expand Down Expand Up @@ -171,9 +173,9 @@
}

if (!empty($password)) {
$password = icms_core_DataFilter::stripSlashesGPC(trim($password));
$password = DataFilter::stripSlashesGPC(trim($password));
$oldpass = !empty($old_password)
? icms_core_DataFilter::stripSlashesGPC(trim($old_password))
? DataFilter::stripSlashesGPC(trim($old_password))
: '';

$member_handler = icms::handler('icms_member');
Expand All @@ -187,15 +189,15 @@
}

if (!empty($vpass)) {
$vpass = icms_core_DataFilter::stripSlashesGPC(trim($vpass));
$vpass = DataFilter::stripSlashesGPC(trim($vpass));
}

if ($password != $vpass) {
$errors[] = _US_PASSNOTSAME;
}

if ($password == $username
|| $password == icms_core_DataFilter::utf8_strrev($username, true)
|| $password == DataFilter::utf8_strrev($username, true)
|| strripos($password, $username) === true
) {
$errors[] = _US_BADPWD;
Expand Down Expand Up @@ -224,10 +226,10 @@
$edituser->user_from = $user_from;
if ($icmsConfigUser['allwshow_sig'] == 1) {
if ($icmsConfigUser['allow_htsig'] == 0) {
$signature = strip_tags(icms_core_DataFilter::checkVar($user_sig, 'text', 'input'));
$edituser->user_sig = icms_core_DataFilter::icms_substr($signature, 0, (int) $icmsConfigUser['sig_max_length']);
$signature = strip_tags(DataFilter::checkVar($user_sig, 'text', 'input'));
$edituser->user_sig = DataFilter::icms_substr($signature, 0, (int)$icmsConfigUser['sig_max_length']);
} else {
$signature = icms_core_DataFilter::checkVar($user_sig, 'html', 'input');
$signature = DataFilter::checkVar($user_sig, 'html', 'input');
$edituser->user_sig = $signature;
}
}
Expand All @@ -240,14 +242,14 @@
$edituser->setVar('pass', $pass, true);
}

$attachsig = !empty($attachsig)?1:0;
$attachsig = !empty($attachsig) ? 1 : 0;
$edituser->attachsig = $attachsig;
$edituser->timezone_offset = $timezone_offset;
$edituser->uorder = $uorder;
$edituser->umode = $umode;
$edituser->notify_method = $notify_method;
$edituser->notify_mode = $notify_mode;
$edituser->bio = icms_core_DataFilter::icms_substr($bio, 0, 255);
$edituser->bio = DataFilter::icms_substr($bio, 0, 255);
$edituser->user_occ = $user_occ;
$edituser->user_intrest = $user_intrest;
$edituser->user_mailok = $user_mailok;
Expand Down Expand Up @@ -539,10 +541,10 @@

$avt_handler = icms::handler('icms_data_avatar');
if (!empty($user_avatar)) {
$user_avatar = icms_core_DataFilter::addSlashes(trim($user_avatar));
$user_avatar = DataFilter::addSlashes(trim($user_avatar));
$criteria_avatar = new icms_db_criteria_Compo(new icms_db_criteria_Item('avatar_file', $user_avatar));
$criteria_avatar->add(new icms_db_criteria_Item('avatar_type', "S"));
$avatars = & $avt_handler->getObjects($criteria_avatar);
$avatars = &$avt_handler->getObjects($criteria_avatar);
if (!is_array($avatars) || !count($avatars)) {
$user_avatar = 'blank.gif';
}
Expand Down
9 changes: 5 additions & 4 deletions include/checklogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* @since XOOPS
*/

use ImpressCMS\Core\DataFilter;
use ImpressCMS\Core\Facades\Member;

icms_loadLanguageFile('core', 'user');
Expand Down Expand Up @@ -81,15 +82,15 @@
$member_handler = icms::handler('icms_member');

icms_loadLanguageFile('core', 'auth');
$icmsAuth = & icms_auth_Factory::getAuthConnection(icms_core_DataFilter::addSlashes($uname));
$icmsAuth = &icms_auth_Factory::getAuthConnection(DataFilter::addSlashes($uname));

$uname4sql = addslashes(icms_core_DataFilter::stripSlashesGPC($uname));
$pass4sql = icms_core_DataFilter::stripSlashesGPC($pass);
$uname4sql = addslashes(DataFilter::stripSlashesGPC($uname));
$pass4sql = DataFilter::stripSlashesGPC($pass);


/* Check to see if being access by a user - if not, attempt to authenticate */
if (empty($user) || !is_object($user)) {
$user = & $icmsAuth->authenticate($uname4sql, $pass4sql);
$user = &$icmsAuth->authenticate($uname4sql, $pass4sql);
}

/* User exists: check to see if the user has been activated.
Expand Down
20 changes: 11 additions & 9 deletions include/comment_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
/**
* The comment form extra include file
*
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
*/

use ImpressCMS\Core\DataFilter;

if (!is_object($icmsModule)) {
exit();
}
Expand Down Expand Up @@ -127,9 +129,9 @@
foreach ($comment_config['extraParams'] as $extra_param) {
// This routine is included from forms accessed via both GET and POST
if (isset($_POST[$extra_param])) {
$hidden_value = icms_core_DataFilter::stripSlashesGPC($_POST[$extra_param]);
$hidden_value = DataFilter::stripSlashesGPC($_POST[$extra_param]);
} elseif (isset($_GET[$extra_param])) {
$hidden_value = icms_core_DataFilter::stripSlashesGPC($_GET[$extra_param]);
$hidden_value = DataFilter::stripSlashesGPC($_GET[$extra_param]);
} else {
$hidden_value = '';
}
Expand Down
23 changes: 13 additions & 10 deletions include/comment_new.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@
/**
* The new comment include file
*
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package Administration
* @subpackage Comments
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package Administration
* @subpackage Comments
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
*/

use ImpressCMS\Core\DataFilter;

include_once ICMS_INCLUDE_PATH . '/comment_constants.php';
if (('system' != $icmsModule->dirname && XOOPS_COMMENT_APPROVENONE == $icmsModuleConfig['com_rule'])
|| (!is_object(icms::$user) && !$icmsModuleConfig['com_anonpost'])
Expand All @@ -58,9 +61,9 @@
//themecenterposts($com_replytitle, $com_replytext);
echo '<table cellpadding="4" cellspacing="1" width="98%" class="outer"><tr><td class="head">' . $com_replytitle . '</td></tr><tr><td><br />' . $com_replytext . '<br /></td></tr></table>';
}
$com_title = icms_core_DataFilter::htmlSpecialChars($com_replytitle);
$com_title = DataFilter::htmlSpecialChars($com_replytitle);
if (!preg_match("/^(Re|" . _CM_RE . "):/i", $com_title)) {
$com_title = _CM_RE . ": " . icms_core_DataFilter::icms_substr($com_title, 0, 56);
$com_title = _CM_RE . ": " . DataFilter::icms_substr($com_title, 0, 56);
}
} else {
$com_title = '';
Expand Down
54 changes: 28 additions & 26 deletions include/comment_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@
/**
* The post a comment include file
*
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
*/

use ImpressCMS\Core\DataFilter;

if (!is_object($icmsModule)) {
exit();
}
icms_loadLanguageFile('core', 'comment');
include_once ICMS_INCLUDE_PATH . '/comment_constants.php';
if ('system' == $icmsModule->dirname) {
$com_id = isset($_POST['com_id'])?(int) $_POST['com_id']:0;
$com_id = isset($_POST['com_id']) ? (int)$_POST['com_id'] : 0;
if (empty($com_id)) {
exit();
}
Expand Down Expand Up @@ -121,7 +123,7 @@
break;
case "preview":
$doimage = 1;
$com_title = icms_core_DataFilter::htmlSpecialChars(icms_core_DataFilter::stripSlashesGPC($_POST['com_title']));
$com_title = DataFilter::htmlSpecialChars(DataFilter::stripSlashesGPC($_POST['com_title']));
if ($dohtml != 0) {
if (is_object(icms::$user)) {
if (!icms::$user->isAdmin($com_modid)) {
Expand All @@ -134,9 +136,9 @@
$dohtml = 0;
}
}
$p_comment = icms_core_DataFilter::checkVar($_POST['com_text'], 'html', 'input');
$noname = isset($noname)?(int) $noname:0;
$com_text = icms_core_DataFilter::htmlSpecialChars(icms_core_DataFilter::stripSlashesGPC($_POST['com_text']));
$p_comment = DataFilter::checkVar($_POST['com_text'], 'html', 'input');
$noname = isset($noname) ? (int)$noname : 0;
$com_text = DataFilter::htmlSpecialChars(DataFilter::stripSlashesGPC($_POST['com_text']));
if ($icmsModule->dirname != 'system') {
include ICMS_ROOT_PATH . '/header.php';
//themecenterposts($com_title, $p_comment);
Expand Down Expand Up @@ -278,23 +280,23 @@
$comment->com_status = XOOPS_COMMENT_PENDING;
// RMV-NOTIFY
$notify_event = 'comment_submit';
break;
break;
}
}
$comment->com_uid = $uid;
}
$comment->com_uid = $uid;
}

$com_title = icms_core_DataFilter::icms_trim($_POST['com_title']);
$com_title = ($com_title == '')? _NOTITLE : $com_title;
$comment->com_title = $com_title;
$comment->com_text = $_POST['com_text'];
$comment->dohtml = $dohtml;
$comment->dosmiley = $dosmiley;
$comment->doxcode = $doxcode;
$comment->doimage = $doimage;
$comment->dobr = $dobr;
$comment->com_icon = $com_icon;
$comment->com_modified = time();
$com_title = DataFilter::icms_trim($_POST['com_title']);
$com_title = ($com_title == '') ? _NOTITLE : $com_title;
$comment->com_title = $com_title;
$comment->com_text = $_POST['com_text'];
$comment->dohtml = $dohtml;
$comment->dosmiley = $dosmiley;
$comment->doxcode = $doxcode;
$comment->doimage = $doimage;
$comment->dobr = $dobr;
$comment->com_icon = $com_icon;
$comment->com_modified = time();
$comment->com_modid = $com_modid;
if (isset($extra_params)) {
$comment->com_exparams = $extra_params;
Expand Down
20 changes: 11 additions & 9 deletions include/comment_reply.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@
/**
* The commentreply include file
*
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license LICENSE.txt
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author modified by UnderDog <underdog@impresscms.org>
*/

use ImpressCMS\Core\DataFilter;

if (!is_object($icmsModule)) {
exit();
}

include_once ICMS_INCLUDE_PATH . '/comment_constants.php';
if (('system' != $icmsModule->dirname
&& XOOPS_COMMENT_APPROVENONE == $icmsModuleConfig['com_rule'])
&& XOOPS_COMMENT_APPROVENONE == $icmsModuleConfig['com_rule'])
|| (!is_object(icms::$user) && !$icmsModuleConfig['com_anonpost'])
|| !is_object($icmsModule)) {
redirect_header(ICMS_URL . '/user.php', 1, _NOPERM);
Expand Down Expand Up @@ -77,7 +79,7 @@
$r_text = _CM_POSTER . ': <strong>' . $r_name . '</strong>&nbsp;&nbsp;' . _CM_POSTED . ': <strong>' . formatTimestamp($comment->com_created) . '</strong><br /><br />' . $comment->com_text;
$com_title = $comment->getVar('com_title', 'E');
if (!preg_match("/^(Re|" . _CM_RE . "):/i", $com_title)) {
$com_title = _CM_RE . ": " . icms_core_DataFilter::icms_substr($com_title, 0, 56);
$com_title = _CM_RE . ": " . DataFilter::icms_substr($com_title, 0, 56);
}
$com_pid = $com_id;
$com_text = '';
Expand Down
Loading

0 comments on commit ef8f4ff

Please sign in to comment.