Skip to content

Commit

Permalink
Synchronizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Apr 20, 2023
1 parent 0e84132 commit 329d2aa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
1 change: 0 additions & 1 deletion blocks/multipoll.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function xoopspollBlockMultiShow(array $options): array
$block['dispVotes'] = $thisModuleConfig['disp_vote_nums'];
$block['thisModuleDir'] = 'xoopspoll';
$block['asList'] = $options[0];
$pollOptionArray = [];
$optionHandler = Helper::getInstance()->getHandler('Option');
$logHandler = Helper::getInstance()->getHandler('Log');

Expand Down
15 changes: 9 additions & 6 deletions class/Common/Blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function deleteBlock(int $bid): void
\xoops_loadLanguage('admin/blocksadmin', 'system');
\xoops_loadLanguage('admin/groups', 'system');

$myblock = new \XoopsBlock($bid);
// $myblock = new \XoopsBlock($bid);

$sql = \sprintf('DELETE FROM %s WHERE bid = %u', $this->db->prefix('newblocks'), $bid);
$result = $this->db->queryF($sql);
Expand Down Expand Up @@ -335,7 +335,8 @@ public function cloneBlock(int $bid)
// $form = new Blockform();
// $form->render();

echo $this->render($block);
$output = $this->render($block);
echo $output;
// xoops_cp_footer();
// require_once __DIR__ . '/admin_footer.php';
// exit();
Expand Down Expand Up @@ -408,8 +409,9 @@ public function isBlockCloned(int $bid, string $bside, string $bweight, string $
/** @var \XoopsTplfileHandler $tplfileHandler */
$tplfileHandler = \xoops_getHandler('tplfile');
$configHandler = xoops_getHandler('config');
/** @var \XoopsConfigHandler $xoopsConfig */
$xoopsConfig = $configHandler->getConfigsByCat(XOOPS_CONF);
$btemplate = $tplfileHandler->find($xoopsConfig['template_set'], 'block', (string)$bid);
$btemplate = $tplfileHandler->find($xoopsConfig['template_set'], 'block', (string)$bid);
if (\count($btemplate) > 0) {
$tplclone = $btemplate[0]->xoopsClone();
$tplclone->setVar('tpl_id', 0);
Expand Down Expand Up @@ -506,7 +508,8 @@ public function editBlock(int $bid): void
];
echo '<a href="blocksadmin.php">' . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . \_AM_SYSTEM_BLOCKS_EDITBLOCK . '<br><br>';

echo $this->render($block);
$output = $this->render($block);
echo $output;
}

/**
Expand Down Expand Up @@ -578,7 +581,7 @@ public function updateBlock(int $bid, string $btitle, string $bside, string $bwe
* @param array $oldside
* @param array $oldweight
* @param array $oldvisible
* @param array $oldgroups
// * @param array $oldgroups
* @param array $oldbcachetime
* @param array $oldbmodule
* @param array $title
Expand All @@ -595,7 +598,7 @@ public function orderBlock(
array $oldside,
array $oldweight,
array $oldvisible,
array $oldgroups,
// array $oldgroups,
array $oldbcachetime,
array $oldbmodule,
array $title,
Expand Down
18 changes: 9 additions & 9 deletions class/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
*/
class Log extends \XoopsObject
{
private int $log_id;
private int $poll_id;
private int $option_id;
private string $ip;
private int $user_id;
private int $time;
public int $log_id;
public int $poll_id;
public int $option_id;
public string $ip;
public int $user_id;
public int $time;

// class Log extends \XoopsObject {
// var $db;
Expand All @@ -70,9 +70,9 @@ public function __construct(int $id = null)
$this->initVar('ip', \XOBJ_DTYPE_OTHER, null);
$this->initVar('user_id', \XOBJ_DTYPE_INT, 0);
$this->initVar('time', \XOBJ_DTYPE_INT, null);
if (!empty($id) && \is_array($id)) {
$this->assignVars($id);
}
// if (!empty($id) && \is_array($id)) {
// $this->assignVars($id);
// }
}

/**
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
if ($pollObj->isAllowedToVote()) {
$thisVoter = (!empty($GLOBALS['xoopsUser'])
&& ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) ? $GLOBALS['xoopsUser']->getVar('uid') : null;
$votedThisPoll = $logHandler->hasVoted($pollId, xoops_getenv('REMOTE_ADDR'), $thisVoter);
$votedThisPoll = $logHandler->hasVoted($pollId, xoops_getenv('REMOTE_ADDR'), (int)$thisVoter);
if (!$votedThisPoll) {
/* user that hasn't voted before in this poll or module preferences allow it */
$voteTime = time();
Expand Down
7 changes: 5 additions & 2 deletions language/english/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
*/

/**
* @copyright XOOPS Project (https://xoops.org)
* @copyright XOOPS Project (https://xoops.org)/
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @since
* @author XOOPS Development Team
*/

Expand All @@ -35,7 +36,6 @@
define('_AM_ALLMODULEPAGES', 'Groups');
define('_AM_SYSTEMLEVEL', '_AM_SYSTEMLEVEL');
define('_AM_ADMINBLOCK', '_AM_ADMINBLOCK');
define('_AM_DBUPDATED', 'Database updated');

define('_AM_BLOCKTAG1', '%s will print %s');
define('_AM_ADDBLOCK', 'Add Block');
Expand All @@ -45,3 +45,6 @@
define('_AM_MODULECANT', 'This block cannot be deleted directly! If you wish to disable this block, deactivate the module.');

define('_AM_RUSUREDEL', 'Are you sure, you want to delete this block?');

define('_AM_DBUPDATED', 'Database updated');
define('_AM_BLOCK_EDIT_ID_ERROR', 'Missing ID of the block to Edit');

0 comments on commit 329d2aa

Please sign in to comment.