Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cebe3e2
$icmsModule transform to icms::$module
fiammybe Dec 1, 2022
055ffee
add missing index files
fiammybe Dec 1, 2022
210e34c
update version info
fiammybe Dec 1, 2022
8550d0e
update readme
fiammybe Dec 1, 2022
de5d30b
add deploy action
fiammybe May 7, 2024
61abfc2
no src folder yet
fiammybe May 7, 2024
beee27e
move sourcecode to src folder
fiammybe May 7, 2024
04318df
moving to src
fiammybe May 7, 2024
aa01c1f
moving to src, 3
fiammybe May 7, 2024
0a2ec20
moving to src. images
fiammybe May 7, 2024
8d470d8
github actions now pushes from src folder
fiammybe May 7, 2024
c259227
icms_version constants added
fiammybe May 7, 2024
968d0b7
Create index.html
fiammybe May 7, 2024
9e81a8e
re-adding admin folder
fiammybe May 7, 2024
805e580
add block, class
fiammybe May 7, 2024
ad63a80
Create index.html
fiammybe May 7, 2024
6737518
Create index.html
fiammybe May 7, 2024
d6f7d4b
Add default imageset
fiammybe May 7, 2024
af7e0bc
upload templates
fiammybe May 7, 2024
a6c4fd9
upload include folder
fiammybe May 7, 2024
dd6d761
cleanup $icmsModule
fiammybe May 7, 2024
3575ff8
cleanup old $icmsModule
fiammybe May 8, 2024
a5a912a
cleanup old $icmsModule
fiammybe May 8, 2024
7ed3fe4
cleanup old $icmsModule
fiammybe May 8, 2024
f2e8b8f
cleanup old $icmsModule
fiammybe May 8, 2024
1950a0b
Update Crowdin configuration file
fiammybe May 14, 2024
03b97e8
Merge branch 'iForumModule:master' into master
fiammybe May 15, 2024
46af0a5
replace old xoopsDB global with icms::$db
fiammybe May 17, 2024
d8e28d0
oops, this should be icms::$xoopsDB instead
fiammybe May 17, 2024
99d37de
Merge branch 'iForumModule:master' into icms2-fixes-db
fiammybe May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions src/class/online.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,26 @@ function write($uid, $uname, $time, $forum, $ip, $forumtopic)
$uid = (int)$uid;
if ($uid > 0)
{
$sql = "SELECT COUNT(*) FROM " . $GLOBALS["xoopsDB"]->prefix('bb_online') . " WHERE online_uid=" . $uid;
$sql = "SELECT COUNT(*) FROM " . icms::$xoopsDB->prefix('bb_online') . " WHERE online_uid=" . $uid;
}
else
{
$sql = "SELECT COUNT(*) FROM " . $GLOBALS["xoopsDB"]->prefix('bb_online') . " WHERE online_uid=" . $uid . " AND online_ip='" . $ip . "'";
$sql = "SELECT COUNT(*) FROM " . icms::$xoopsDB->prefix('bb_online') . " WHERE online_uid=" . $uid . " AND online_ip='" . $ip . "'";
}
list($count) = $GLOBALS["xoopsDB"]->fetchRow($GLOBALS["xoopsDB"]->queryF($sql));
list($count) = icms::$xoopsDB->fetchRow(icms::$xoopsDB->queryF($sql));
if ($count > 0)
{
$sql = "UPDATE " . $GLOBALS["xoopsDB"]->prefix('bb_online') . " SET online_updated= '" . $time . "', online_forum = '" . $forum . "', online_topic = '" . $forumtopic . "' WHERE online_uid = " . $uid;
$sql = "UPDATE " . icms::$xoopsDB->prefix('bb_online') . " SET online_updated= '" . $time . "', online_forum = '" . $forum . "', online_topic = '" . $forumtopic . "' WHERE online_uid = " . $uid;
if ($uid == 0)
{
$sql .= " AND online_ip='" . $ip . "'";
}
}
else
{
$sql = sprintf("INSERT INTO %s (online_uid, online_uname, online_updated, online_ip, online_forum, online_topic) VALUES (%u, %s, %u, %s, %u, %u)", $GLOBALS["xoopsDB"]->prefix('bb_online'), $uid, $GLOBALS["xoopsDB"]->quoteString($uname), $time, $GLOBALS["xoopsDB"]->quoteString($ip), $forum, $forumtopic);
$sql = sprintf("INSERT INTO %s (online_uid, online_uname, online_updated, online_ip, online_forum, online_topic) VALUES (%u, %s, %u, %s, %u, %u)", icms::$xoopsDB->prefix('bb_online'), $uid, icms::$xoopsDB->quoteString($uname), $time, icms::$xoopsDB->quoteString($ip), $forum, $forumtopic);
}
if (!$GLOBALS["xoopsDB"]->queryF($sql))
if (!icms::$xoopsDB->queryF($sql))
{
iforum_message("can not update online info: ".$sql);
return false;
Expand All @@ -186,9 +186,9 @@ function write($uid, $uname, $time, $forum, $ip, $forumtopic)
/* for MySQL 4.1+ */
if ($mysql_version >= "4.1"):

$sql = "DELETE FROM ".$GLOBALS["xoopsDB"]->prefix('bb_online'). " WHERE". " ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ".$GLOBALS["xoopsDB"]->prefix('online')." WHERE online_module =".icms::$module->getVar('mid')." ) )". " OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ".$GLOBALS["xoopsDB"]->prefix('online')." WHERE online_module =".icms::$module->getVar('mid')." AND online_uid = 0 ) )";
$sql = "DELETE FROM ".icms::$xoopsDB->prefix('bb_online'). " WHERE". " ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ".icms::$xoopsDB->prefix('online')." WHERE online_module =".icms::$module->getVar('mid')." ) )". " OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ".icms::$xoopsDB->prefix('online')." WHERE online_module =".icms::$module->getVar('mid')." AND online_uid = 0 ) )";

if ($result = $GLOBALS["xoopsDB"]->queryF($sql))
if ($result = icms::$xoopsDB->queryF($sql))
{
return true;
}
Expand All @@ -200,10 +200,10 @@ function write($uid, $uname, $time, $forum, $ip, $forumtopic)


else:
$sql = "DELETE ".$GLOBALS["xoopsDB"]->prefix('bb_online')." FROM ".$GLOBALS["xoopsDB"]->prefix('bb_online'). " LEFT JOIN ".$GLOBALS["xoopsDB"]->prefix('online')." AS aa ". " ON ".$GLOBALS["xoopsDB"]->prefix('bb_online').".online_uid = aa.online_uid WHERE ".$GLOBALS["xoopsDB"]->prefix('bb_online').".online_uid > 0 AND aa.online_uid IS NULL";
$result = $GLOBALS["xoopsDB"]->queryF($sql);
$sql = "DELETE ".$GLOBALS["xoopsDB"]->prefix('bb_online')." FROM ".$GLOBALS["xoopsDB"]->prefix('bb_online'). " LEFT JOIN ".$GLOBALS["xoopsDB"]->prefix('online')." AS aa ". " ON ".$GLOBALS["xoopsDB"]->prefix('bb_online').".online_ip = aa.online_ip WHERE ".$GLOBALS["xoopsDB"]->prefix('bb_online').".online_uid = 0 AND aa.online_ip IS NULL";
$result = $GLOBALS["xoopsDB"]->queryF($sql);
$sql = "DELETE ".icms::$xoopsDB->prefix('bb_online')." FROM ".icms::$xoopsDB->prefix('bb_online'). " LEFT JOIN ".icms::$xoopsDB->prefix('online')." AS aa ". " ON ".icms::$xoopsDB->prefix('bb_online').".online_uid = aa.online_uid WHERE ".icms::$xoopsDB->prefix('bb_online').".online_uid > 0 AND aa.online_uid IS NULL";
$result = icms::$xoopsDB->queryF($sql);
$sql = "DELETE ".icms::$xoopsDB->prefix('bb_online')." FROM ".icms::$xoopsDB->prefix('bb_online'). " LEFT JOIN ".icms::$xoopsDB->prefix('online')." AS aa ". " ON ".icms::$xoopsDB->prefix('bb_online').".online_ip = aa.online_ip WHERE ".icms::$xoopsDB->prefix('bb_online').".online_uid = 0 AND aa.online_ip IS NULL";
$result = icms::$xoopsDB->queryF($sql);
return true;
endif;
}
Expand All @@ -217,8 +217,8 @@ function write($uid, $uname, $time, $forum, $ip, $forumtopic)
*/
function gc($expire)
{
$sql = "DELETE FROM ".$GLOBALS["xoopsDB"]->prefix('bb_online')." WHERE online_updated < ".(time() - intval($expire));
$GLOBALS["xoopsDB"]->queryF($sql);
$sql = "DELETE FROM ".icms::$xoopsDB->prefix('bb_online')." WHERE online_updated < ".(time() - intval($expire));
icms::$xoopsDB->queryF($sql);

$online_handler = icms::handler('icms_core_Online');
$online_handler->gc($expire);
Expand All @@ -234,19 +234,19 @@ function &getAll($criteria = null)
{
$ret = array();
$limit = $start = 0;
$sql = 'SELECT * FROM ' . $GLOBALS["xoopsDB"]->prefix('bb_online');
$sql = 'SELECT * FROM ' . icms::$xoopsDB->prefix('bb_online');
if (is_object($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element'))
{
$sql .= ' ' . $criteria->renderWhere();
$limit = $criteria->getLimit();
$start = $criteria->getStart();
}
$result = $GLOBALS["xoopsDB"]->query($sql, $limit, $start);
$result = icms::$xoopsDB->query($sql, $limit, $start);
if (!$result)
{
return false;
}
while ($myrow = $GLOBALS["xoopsDB"]->fetchArray($result))
while ($myrow = icms::$xoopsDB->fetchArray($result))
{
$ret[] = $myrow;
if ($myrow["online_uid"] > 0 )
Expand All @@ -269,18 +269,18 @@ function checkStatus($uids)
}
else
{
$sql = 'SELECT online_uid FROM ' . $GLOBALS["xoopsDB"]->prefix('bb_online');
$sql = 'SELECT online_uid FROM ' . icms::$xoopsDB->prefix('bb_online');
if (!empty($uids))
{
$sql .= ' WHERE online_uid IN ('.implode(", ", array_map("intval", $uids)).')';
}

$result = $GLOBALS["xoopsDB"]->query($sql);
$result = icms::$xoopsDB->query($sql);
if (!$result)
{
return false;
}
while (list($uid) = $GLOBALS["xoopsDB"]->fetchRow($result))
while (list($uid) = icms::$xoopsDB->fetchRow($result))
{
$online_users[] = $uid;
}
Expand All @@ -302,16 +302,16 @@ function checkStatus($uids)
*/
function getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS["xoopsDB"]->prefix('bb_online');
$sql = 'SELECT COUNT(*) FROM ' . icms::$xoopsDB->prefix('bb_online');
if (is_object($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element'))
{
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $GLOBALS["xoopsDB"]->query($sql))
if (!$result = icms::$xoopsDB->query($sql))
{
return false;
}
list($ret) = $GLOBALS["xoopsDB"]->fetchRow($result);
list($ret) = icms::$xoopsDB->fetchRow($result);
return $ret;
}
}
4 changes: 2 additions & 2 deletions src/class/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function saveAttachment()
$attachment_save = base64_encode(serialize($this->attachment_array));
else $attachment_save = '';
$this->setVar('attachment', $attachment_save);
$sql = "UPDATE " . $GLOBALS["xoopsDB"]->prefix("bb_posts") . " SET attachment=" . $GLOBALS["xoopsDB"]->quoteString($attachment_save) . " WHERE post_id = " . $this->getVar('post_id');
if (!$result = $GLOBALS["xoopsDB"]->queryF($sql))
$sql = "UPDATE " . icms::$xoopsDB->prefix("bb_posts") . " SET attachment=" . icms::$xoopsDB->quoteString($attachment_save) . " WHERE post_id = " . $this->getVar('post_id');
if (!$result = icms::$xoopsDB->queryF($sql))
{
iforum_message("save attachment error: ". $sql);
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/class/topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function __construct()

function incrementCounter()
{
$sql = 'UPDATE ' . $GLOBALS["xoopsDB"]->prefix('bb_topics') . ' SET topic_views = topic_views + 1 WHERE topic_id =' . $this->getVar('topic_id');
$GLOBALS["xoopsDB"]->queryF($sql);
$sql = 'UPDATE ' . icms::$xoopsDB->prefix('bb_topics') . ' SET topic_views = topic_views + 1 WHERE topic_id =' . $this->getVar('topic_id');
icms::$xoopsDB->queryF($sql);
}
}

Expand Down