diff --git a/admin/event.php b/admin/event.php index 0c4debd..07b39d1 100644 --- a/admin/event.php +++ b/admin/event.php @@ -200,21 +200,19 @@ $eventObj->setVar('register_sendermail', Request::getString('register_sendermail')); $eventObj->setVar('register_sendername', Request::getString('register_sendername')); $eventObj->setVar('register_signature', Request::getString('register_signature')); - } else { - if ($evId > 0) { - //reset previous values - $eventObj->setVar('register_to', 0); - $eventObj->setVar('register_max', 0); - $eventObj->setVar('register_listwait', 0); - $eventObj->setVar('register_autoaccept', 0); - $eventObj->setVar('register_notify', ''); - $eventObj->setVar('register_sendermail', ''); - $eventObj->setVar('register_sendername', ''); - $eventObj->setVar('register_signature', ''); - $registrationHandler->cleanupRegistrations($evId); - $questionHandler->cleanupQuestions($evId); - $answerHandler->cleanupAnswers($evId); - } + } else if ($evId > 0) { + //reset previous values + $eventObj->setVar('register_to', 0); + $eventObj->setVar('register_max', 0); + $eventObj->setVar('register_listwait', 0); + $eventObj->setVar('register_autoaccept', 0); + $eventObj->setVar('register_notify', ''); + $eventObj->setVar('register_sendermail', ''); + $eventObj->setVar('register_sendername', ''); + $eventObj->setVar('register_signature', ''); + $registrationHandler->cleanupRegistrations($evId); + $questionHandler->cleanupQuestions($evId); + $answerHandler->cleanupAnswers($evId); } } $eventObj->setVar('status', Request::getInt('status')); @@ -228,12 +226,10 @@ $newEvId = $eventObj->getNewInsertedId(); if ('' !== $uploaderErrors) { \redirect_header('event.php?op=edit&id=' . $evId, 5, $uploaderErrors); + } else if ($continueAddtionals) { + \redirect_header('question.php?op=edit&evid=' . $newEvId, 2, \_MA_WGEVENTS_FORM_OK); } else { - if ($continueAddtionals) { - \redirect_header('question.php?op=edit&evid=' . $newEvId, 2, \_MA_WGEVENTS_FORM_OK); - } else { - \redirect_header('event.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); - } + \redirect_header('event.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); } } // Get Form diff --git a/admin/field.php b/admin/field.php index 1982f31..b79df7b 100644 --- a/admin/field.php +++ b/admin/field.php @@ -192,12 +192,10 @@ $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { if (!$GLOBALS['xoopsSecurity']->check()) { - //\redirect_header('field.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); + \redirect_header('field.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); } - if ($fieldHandler->getCount() > 0) { - if (!$fieldHandler->deleteAll()) { - $GLOBALS['xoopsTpl']->assign('error', $fieldHandler->getHtmlErrors()); - } + if (($fieldHandler->getCount() > 0) && !$fieldHandler->deleteAll()) { + $GLOBALS['xoopsTpl']->assign('error', $fieldHandler->getHtmlErrors()); } $items = BuildDefaultSet(); $uid = $GLOBALS['xoopsUser']->uid(); diff --git a/admin/menu.php b/admin/menu.php index 61a546f..7864a53 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -81,19 +81,17 @@ 'icon' => 'assets/icons/32/logs.png', ]; -if (is_object($helper->getModule()) && null !== $helper->getConfig()) { - if ((bool)$helper->getConfig('use_history')) { - $adminmenu[] = [ - 'title' => \_MI_WGEVENTS_ADMENU11, - 'link' => 'admin/registrationshist.php', - 'icon' => 'assets/icons/32/registrationshist.png', - ]; - $adminmenu[] = [ - 'title' => \_MI_WGEVENTS_ADMENU12, - 'link' => 'admin/answershist.php', - 'icon' => 'assets/icons/32/answershist.png', - ]; - } +if (is_object($helper->getModule()) && null !== $helper->getConfig() && (bool)$helper->getConfig('use_history')) { + $adminmenu[] = [ + 'title' => \_MI_WGEVENTS_ADMENU11, + 'link' => 'admin/registrationshist.php', + 'icon' => 'assets/icons/32/registrationshist.png', + ]; + $adminmenu[] = [ + 'title' => \_MI_WGEVENTS_ADMENU12, + 'link' => 'admin/answershist.php', + 'icon' => 'assets/icons/32/answershist.png', + ]; } $adminmenu[] = [ 'title' => \_MI_WGEVENTS_ADMENU14, diff --git a/blocks/calendar.php b/blocks/calendar.php index f1177bf..c1b8c81 100644 --- a/blocks/calendar.php +++ b/blocks/calendar.php @@ -139,8 +139,8 @@ function b_wgevents_calendar_show($options) $GLOBALS['xoopsTpl']->assign('wgevents_upload_eventlogos_url', \WGEVENTS_UPLOAD_EVENTLOGOS_URL . '/'); - $block = ['dummy']; //create dummy return in order to show block - return $block; + //create dummy return in order to show block + return ['dummy']; } diff --git a/calendar.php b/calendar.php index c61677f..4883db9 100644 --- a/calendar.php +++ b/calendar.php @@ -44,9 +44,9 @@ //request $op = Request::getCmd('op', 'list'); -$filterFrom = Request::getInt('filterFrom', 0); -$filterTo = Request::getInt('filterTo', 0); -$filterCat = Request::getInt('filterCat', 0); +$filterFrom = Request::getInt('filterFrom'); +$filterTo = Request::getInt('filterTo'); +$filterCat = Request::getInt('filterCat'); $filterSort = 'datefrom-ASC'; if (0 == $filterFrom) { $filterFrom = $dayStart; diff --git a/class/Account.php b/class/Account.php index d5de108..977189e 100644 --- a/class/Account.php +++ b/class/Account.php @@ -37,7 +37,7 @@ */ class Account extends \XoopsObject { - public $helper = null; + public $helper; public $db; //Constructor @@ -75,7 +75,7 @@ public function getForm($action = false) $action = $_SERVER['REQUEST_URI']; } - $title = $this->isNew() ? sprintf(_AM_WGEVENTS_ACCOUNT_ADD) : sprintf(_AM_WGEVENTS_ACCOUNT_EDIT); + $title = $this->isNew() ? _AM_WGEVENTS_ACCOUNT_ADD : _AM_WGEVENTS_ACCOUNT_EDIT; require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new \XoopsThemeForm($title, 'accounts_form', $action, 'post', true); diff --git a/class/AccountHandler.php b/class/AccountHandler.php index 3886330..372c42e 100644 --- a/class/AccountHandler.php +++ b/class/AccountHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Answer.php b/class/Answer.php index 00ac4e6..4858146 100644 --- a/class/Answer.php +++ b/class/Answer.php @@ -94,7 +94,7 @@ public function getForm($action = false) } $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; // Title - $title = $this->isNew() ? \sprintf(\_MA_WGEVENTS_ANSWER_ADD) : \sprintf(\_MA_WGEVENTS_ANSWER_EDIT); + $title = $this->isNew() ? \_MA_WGEVENTS_ANSWER_ADD : \_MA_WGEVENTS_ANSWER_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); diff --git a/class/AnswerHandler.php b/class/AnswerHandler.php index 9f33464..3267d04 100644 --- a/class/AnswerHandler.php +++ b/class/AnswerHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/AnswerhistHandler.php b/class/AnswerhistHandler.php index dde0de2..f7756ee 100644 --- a/class/AnswerhistHandler.php +++ b/class/AnswerhistHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Category.php b/class/Category.php index d831c5f..fdd5e1b 100644 --- a/class/Category.php +++ b/class/Category.php @@ -100,9 +100,9 @@ public function getForm($action = false) if (!$action) { $action = $_SERVER['REQUEST_URI']; } - $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; + $isAdmin = \is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); // Title - $title = $this->isNew() ? \sprintf(\_AM_WGEVENTS_CATEGORY_ADD) : \sprintf(\_AM_WGEVENTS_CATEGORY_EDIT); + $title = $this->isNew() ? \_AM_WGEVENTS_CATEGORY_ADD : \_AM_WGEVENTS_CATEGORY_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index 95c0712..e7aae1e 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Common/MigrateHelper.php b/class/Common/MigrateHelper.php index 89c15e7..4cd4c0a 100644 --- a/class/Common/MigrateHelper.php +++ b/class/Common/MigrateHelper.php @@ -99,33 +99,31 @@ public function createSchemaFromSqlfile(): bool $tables[$tableName]['options'] = ''; $tables[$tableName]['columns'] = []; $tables[$tableName]['keys'] = []; - } else { - if (false == $skip) { - if (')' === \mb_strtoupper(\substr($line, 0, 1))) { - // end of table definition - // get options - $this->getOptions($line, $options); - $tables[$tableName]['options'] = $options; - } elseif ('ENGINE' === \mb_strtoupper(\substr($line, 0, 6))) { - $this->getOptions($line, $options); - $tables[$tableName]['options'] = $options; - } elseif ('DEFAULT CHARSET ' === \mb_strtoupper(\substr($line, 0, 16))) { - $this->getOptions($line, $options); - $tables[$tableName]['options'] = $options; - } else { - // get keys and fields - switch (\mb_strtoupper(\substr($line, 0, 3))) { - case 'KEY': - case 'PRI': - case 'UNI': - $tables[$tableName]['keys'][] = $this->getKey($line); - break; - case 'else': - default: - $columns = $this->getColumns($line); - $tables[$tableName]['columns'][] = $columns; - break; - } + } else if (false == $skip) { + if (')' === \mb_strtoupper(\substr($line, 0, 1))) { + // end of table definition + // get options + $this->getOptions($line, $options); + $tables[$tableName]['options'] = $options; + } elseif ('ENGINE' === \mb_strtoupper(\substr($line, 0, 6))) { + $this->getOptions($line, $options); + $tables[$tableName]['options'] = $options; + } elseif ('DEFAULT CHARSET ' === \mb_strtoupper(\substr($line, 0, 16))) { + $this->getOptions($line, $options); + $tables[$tableName]['options'] = $options; + } else { + // get keys and fields + switch (\mb_strtoupper(\substr($line, 0, 3))) { + case 'KEY': + case 'PRI': + case 'UNI': + $tables[$tableName]['keys'][] = $this->getKey($line); + break; + case 'else': + default: + $columns = $this->getColumns($line); + $tables[$tableName]['columns'][] = $columns; + break; } } } @@ -163,7 +161,7 @@ public function createSchemaFromSqlfile(): bool } // create new file and write schema array into this file - $myfile = \fopen($this->fileYaml, "w"); + $myfile = \fopen($this->fileYaml, 'wb'); if (false == $myfile || null === $myfile) { \xoops_error('Error: Unable to open sql file!'); return false; @@ -260,7 +258,7 @@ private function getKey (string $line) if (\strpos($line, 'RIMARY') > 0) { $key['PRIMARY'] = []; - $fields = \substr($line, 13, \strlen($line) - 13); + $fields = \substr($line, 13); $key['PRIMARY']['columns'] = \str_replace(['`', '),', ')'], '', $fields); $key['PRIMARY']['unique'] = 'true'; } else { diff --git a/class/Event.php b/class/Event.php index 57e714a..2caa313 100644 --- a/class/Event.php +++ b/class/Event.php @@ -140,7 +140,7 @@ public function getForm($action = false) $imgInfo = 'img-info'; // Title - $title = $this->isNew() ? \sprintf(\_MA_WGEVENTS_EVENT_ADD) : \sprintf(\_MA_WGEVENTS_EVENT_EDIT); + $title = $this->isNew() ? \_MA_WGEVENTS_EVENT_ADD : \_MA_WGEVENTS_EVENT_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'formEvent', $action, 'post', true); @@ -337,17 +337,15 @@ public function getForm($action = false) $form->addElement(new \XoopsFormHidden('status', $evStatus)); $form->addElement(new \XoopsFormHidden('datecreated_int', $evDatecreated)); $form->addElement(new \XoopsFormHidden('submitter', $evSubmitter)); - if (!$this->isNew()) { - if ($permEventsApprove) { - $evStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $evStatus); - $evStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE); - $evStatusSelect->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); - $evStatusSelect->addOption(Constants::STATUS_SUBMITTED, \_MA_WGEVENTS_STATUS_SUBMITTED); - $evStatusSelect->addOption(Constants::STATUS_APPROVED, \_MA_WGEVENTS_STATUS_APPROVED); - $form->addElement($evStatusSelect, true); - $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_DATECREATED, \formatTimestamp($evDatecreated, 's'))); - $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_SUBMITTER, \XoopsUser::getUnameFromId($evSubmitter))); - } + if (!$this->isNew() && $permEventsApprove) { + $evStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $evStatus); + $evStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE); + $evStatusSelect->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); + $evStatusSelect->addOption(Constants::STATUS_SUBMITTED, \_MA_WGEVENTS_STATUS_SUBMITTED); + $evStatusSelect->addOption(Constants::STATUS_APPROVED, \_MA_WGEVENTS_STATUS_APPROVED); + $form->addElement($evStatusSelect, true); + $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_DATECREATED, \formatTimestamp($evDatecreated, 's'))); + $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_SUBMITTER, \XoopsUser::getUnameFromId($evSubmitter))); } } if (!$this->isNew()) { diff --git a/class/EventHandler.php b/class/EventHandler.php index 8b42da3..be7f1de 100644 --- a/class/EventHandler.php +++ b/class/EventHandler.php @@ -56,13 +56,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** @@ -155,15 +155,11 @@ public function getFormEventSelect($action = false) /** * @public function to get events for given params * - * @param int $uid : select by/exclude given uid - * @param int $start - * @param int $limit - * @param int $from : filter date created from (timestamp) - * @param int $to : filter date created to (timestamp) - * @param bool $mygroups : show events of all groups of current user - * @param bool $excludeuid : exclude given uid from result - * @param int $groupid : filter by given group id - * @param int $catid : filter by given cat id + * @param int $start + * @param int $limit + * @param int $from : filter date created from (timestamp) + * @param int $to : filter date created to (timestamp) + * @param int $catid : filter by given cat id * @param string $sortBy * @param string $orderBy * @return array @@ -253,7 +249,7 @@ public function getEventsCompare($versionOld, $versionNew) /** * get email recipients for noticiations * @param $registerNotify - * @return string + * @return array|false|string[] */ public function getRecipientsNotify($registerNotify) { diff --git a/class/Field.php b/class/Field.php index 64a4c08..e2adc87 100644 --- a/class/Field.php +++ b/class/Field.php @@ -110,7 +110,7 @@ public function getForm($action = false) } $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; // Title - $title = $this->isNew() ? \sprintf(\_AM_WGEVENTS_FIELD_ADD) : \sprintf(\_AM_WGEVENTS_FIELD_EDIT); + $title = $this->isNew() ? \_AM_WGEVENTS_FIELD_ADD : \_AM_WGEVENTS_FIELD_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); diff --git a/class/FieldHandler.php b/class/FieldHandler.php index 58f6f94..f4885f0 100644 --- a/class/FieldHandler.php +++ b/class/FieldHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Forms/FormInline.php b/class/Forms/FormInline.php index f5425b4..33acb51 100644 --- a/class/Forms/FormInline.php +++ b/class/Forms/FormInline.php @@ -45,12 +45,10 @@ public function render() foreach ($this->getElements() as $ele) { if (!$ele->isHidden()) { $ret .= '' . $ele->getCaption() . ' ' . $ele->render() . " \n"; + } else if ('linebreak' == $ele->getName()) { + $ret .= "
\n"; } else { - if ('linebreak' == $ele->getName()) { - $ret .= "
\n"; - } else { - $ret .= $ele->render() . "\n"; - } + $ret .= $ele->render() . "\n"; } } $ret .= "\n"; diff --git a/class/Log.php b/class/Log.php index 2352c14..bb91d28 100644 --- a/class/Log.php +++ b/class/Log.php @@ -90,7 +90,7 @@ public function getForm($action = false) } $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; // Title - $title = $this->isNew() ? \sprintf(\_AM_WGEVENTS_ADD_LOG) : \sprintf(\_AM_WGEVENTS_EDIT_LOG); + $title = $this->isNew() ? \_AM_WGEVENTS_ADD_LOG : \_AM_WGEVENTS_EDIT_LOG; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); diff --git a/class/LogHandler.php b/class/LogHandler.php index 2335611..c30b84a 100644 --- a/class/LogHandler.php +++ b/class/LogHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index d47df60..d71bb46 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -230,11 +230,7 @@ public function getPermEventsEdit($evSubmitter, $evStatus) } $currentuid = $xoopsUser->uid(); } - if ($this->getPermEventsSubmit() && $currentuid == $evSubmitter) { - return true; - } - - return false; + return $this->getPermEventsSubmit() && $currentuid == $evSubmitter; } /** @@ -269,7 +265,8 @@ public function getPermQuestionsAdmin($evSubmitter, $evStatus) * @public function getPermRegistrationsApprove * returns right for approve registrations * - User must have perm edit the event (owner or approver) - * @param null + * @param $evSubmitter + * @param $evStatus * @return bool */ public function getPermRegistrationsApprove($evSubmitter, $evStatus) @@ -346,11 +343,7 @@ public function getPermRegistrationsView($regIp, $regSubmitter) return true; } $ipCurrent = $_SERVER['REMOTE_ADDR']; - if ($regIp == $ipCurrent) { - return true; - } - - return false; + return $regIp == $ipCurrent; } /** @@ -386,11 +379,7 @@ public function getPermTextblocksEdit($tbSubmitter) } $currentuid = $xoopsUser->uid(); } - if ($this->getPermTextblocksSubmit() && $currentuid == $tbSubmitter) { - return true; - } - - return false; + return $this->getPermTextblocksSubmit() && $currentuid == $tbSubmitter; } /** @@ -415,11 +404,7 @@ public function getPermTextblocksAdmin($tbSubmitter) } $currentuid = $xoopsUser->uid(); } - if ($this->getPermTextblocksSubmit() && $currentuid == $tbSubmitter) { - return true; - } - - return false; + return $this->getPermTextblocksSubmit() && $currentuid == $tbSubmitter; } diff --git a/class/Question.php b/class/Question.php index b7a15a6..3067427 100644 --- a/class/Question.php +++ b/class/Question.php @@ -101,9 +101,9 @@ public function getForm($action = false) if (!$action) { $action = $_SERVER['REQUEST_URI']; } - $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; + $isAdmin = \is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); // Title - $title = $this->isNew() ? \sprintf(\_MA_WGEVENTS_QUESTION_ADD) : \sprintf(\_MA_WGEVENTS_QUESTION_EDIT); + $title = $this->isNew() ? \_MA_WGEVENTS_QUESTION_ADD : \_MA_WGEVENTS_QUESTION_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'formQuestion', $action, 'post', true); diff --git a/class/QuestionHandler.php b/class/QuestionHandler.php index dc40271..76c101b 100644 --- a/class/QuestionHandler.php +++ b/class/QuestionHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Registration.php b/class/Registration.php index 414a241..b1dab49 100644 --- a/class/Registration.php +++ b/class/Registration.php @@ -112,11 +112,11 @@ public function getForm($action = false, $test = false) if (!$action) { $action = $_SERVER['REQUEST_URI']; } - $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; + $isAdmin = \is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); $answersExist = true; // Title if ($this->isNew()) { - $title = $test ? \sprintf(\_MA_WGEVENTS_QUESTIONS_PREVIEW) : \sprintf(\_MA_WGEVENTS_REGISTRATION_ADD); + $title = $test ? \_MA_WGEVENTS_QUESTIONS_PREVIEW : \_MA_WGEVENTS_REGISTRATION_ADD; $answersExist = false; } else { $title =\_MA_WGEVENTS_REGISTRATION_EDIT; @@ -350,12 +350,9 @@ public function getValuesRegistrations($keys = null, $format = null, $maxDepth = $ret = $this->getValues($keys, $format, $maxDepth); $eventHandler = $helper->getHandler('Event'); $eventObj = $eventHandler->get($this->getVar('evid')); - $ret['eventname'] = $eventObj->getVar('name'); - $ret['salutation_text'] = Utility::getSalutationText($this->getVar('salutation')); - $ret['status_text'] = Utility::getStatusText($this->getVar('status')); - if ((int)$this->getVar('listwait') > 0) { - $ret['listwait_text'] = '(' . \_MA_WGEVENTS_REGISTRATION_LISTWAIT . ')'; - } + $ret['eventname'] = $eventObj->getVar('name'); + $ret['salutation_text'] = Utility::getSalutationText($this->getVar('salutation')); + $ret['status_text'] = Utility::getStatusText($this->getVar('status')); $ret['financial_text'] = Utility::getFinancialText($this->getVar('financial')); $ret['listwait_text'] = (int)$this->getVar('listwait') > 0 ? \_YES : \_NO; $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 'm'); diff --git a/class/RegistrationHandler.php b/class/RegistrationHandler.php index 2f5efef..dba83f9 100644 --- a/class/RegistrationHandler.php +++ b/class/RegistrationHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/RegistrationhistHandler.php b/class/RegistrationhistHandler.php index 91c95bd..8166416 100644 --- a/class/RegistrationhistHandler.php +++ b/class/RegistrationhistHandler.php @@ -55,13 +55,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/class/Textblock.php b/class/Textblock.php index ef34f4b..e288e53 100644 --- a/class/Textblock.php +++ b/class/Textblock.php @@ -96,9 +96,9 @@ public function getForm($action = false) if (!$action) { $action = $_SERVER['REQUEST_URI']; } - $isAdmin = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; + $isAdmin = \is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); // Title - $title = $this->isNew() ? \sprintf(\_MA_WGEVENTS_TEXTBLOCK_ADD) : \sprintf(\_MA_WGEVENTS_TEXTBLOCK_EDIT); + $title = $this->isNew() ? \_MA_WGEVENTS_TEXTBLOCK_ADD : \_MA_WGEVENTS_TEXTBLOCK_EDIT; // Get Theme Form \xoops_load('XoopsFormLoader'); $form = new \XoopsThemeForm($title, 'formTextblock', $action, 'post', true); diff --git a/class/TextblockHandler.php b/class/TextblockHandler.php index 1db02b8..5b0c57b 100644 --- a/class/TextblockHandler.php +++ b/class/TextblockHandler.php @@ -54,13 +54,13 @@ public function create($isNew = true) /** * retrieve a field * - * @param int $i field id + * @param int $id field id * @param null fields * @return \XoopsObject|null reference to the {@link Get} object */ - public function get($i = null, $fields = null) + public function get($id = null, $fields = null) { - return parent::get($i, $fields); + return parent::get($id, $fields); } /** diff --git a/event.php b/event.php index b3cd3ab..796779e 100644 --- a/event.php +++ b/event.php @@ -156,12 +156,10 @@ $proportion = $numberRegCurr / $registerMax; if ($proportion >= 1) { $events[$i]['regcurrent'] = \_MA_WGEVENTS_REGISTRATIONS_FULL; + } else if (0 == $numberRegCurr) { + $events[$i]['regcurrent'] = \_MA_WGEVENTS_REGISTRATIONS_NBCURR_0; } else { - if (0 == $numberRegCurr) { - $events[$i]['regcurrent'] = \_MA_WGEVENTS_REGISTRATIONS_NBCURR_0; - } else { - $events[$i]['regcurrent'] = \sprintf(\_MA_WGEVENTS_REGISTRATIONS_NBCURR_INDEX, $numberRegCurr, $registerMax); - } + $events[$i]['regcurrent'] = \sprintf(\_MA_WGEVENTS_REGISTRATIONS_NBCURR_INDEX, $numberRegCurr, $registerMax); } $events[$i]['regcurrent_text'] = $events[$i]['regcurrent']; $events[$i]['regcurrent_tip'] = true; @@ -174,10 +172,8 @@ $events[$i]['regcurrent_tip'] = false; } $events[$i]['regpercentage'] = (int)($proportion * 100); - } else { - if ('show' == $op) { - $events[$i]['regcurrent'] = $numberRegCurr; - } + } else if ('show' == $op) { + $events[$i]['regcurrent'] = $numberRegCurr; } $events[$i]['regenabled'] = $permEdit || (\time() >= $events[$i]['register_from'] && \time() <= $events[$i]['register_to']); $events[$i]['locked'] = (Constants::STATUS_LOCKED == $events[$i]['status']); @@ -419,30 +415,28 @@ // redirect after insert if ('' !== $uploaderErrors) { \redirect_header('event.php?op=edit&id=' . $newEvId, 5, $uploaderErrors); - } else { - if ($evRegisterUse) { - // check whether there are already question infos - $crQuestion = new \CriteriaCompo(); - $crQuestion->add(new \Criteria('evid', $newEvId)); - if ($evId > 0) { - \redirect_header('event.php?op=show&id=' . $evId . '&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); - } else { - if ($questionHandler->getCount($crQuestion) > 0) { - // set of questions already existing - \redirect_header('question.php?op=list&evid=' . $newEvId, 2, \_MA_WGEVENTS_FORM_OK); - } else { - // redirect to question.php in order to add default set of questions - \redirect_header('question.php?op=newset&evid=' . $newEvId, 0, \_MA_WGEVENTS_FORM_OK); - } - } + } else if ($evRegisterUse) { + // check whether there are already question infos + $crQuestion = new \CriteriaCompo(); + $crQuestion->add(new \Criteria('evid', $newEvId)); + if ($evId > 0) { + \redirect_header('event.php?op=show&id=' . $evId . '&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); } else { - if ($evId > 0) { - $registrationHandler->cleanupRegistrations($evId); - $questionHandler->cleanupQuestions($evId); - $answerHandler->cleanupAnswers($evId); + if ($questionHandler->getCount($crQuestion) > 0) { + // set of questions already existing + \redirect_header('question.php?op=list&evid=' . $newEvId, 2, \_MA_WGEVENTS_FORM_OK); + } else { + // redirect to question.php in order to add default set of questions + \redirect_header('question.php?op=newset&evid=' . $newEvId, 0, \_MA_WGEVENTS_FORM_OK); } - \redirect_header('event.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); } + } else { + if ($evId > 0) { + $registrationHandler->cleanupRegistrations($evId); + $questionHandler->cleanupQuestions($evId); + $answerHandler->cleanupAnswers($evId); + } + \redirect_header('event.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); } } // Get Form Error diff --git a/extras/themes/xswatch4_wge/modules/wgsitenotice/blocks/wgsitenotice_block_cookie_reg.tpl b/extras/themes/xswatch4_wge/modules/wgsitenotice/blocks/wgsitenotice_block_cookie_reg.tpl index 8690c32..766b497 100644 --- a/extras/themes/xswatch4_wge/modules/wgsitenotice/blocks/wgsitenotice_block_cookie_reg.tpl +++ b/extras/themes/xswatch4_wge/modules/wgsitenotice/blocks/wgsitenotice_block_cookie_reg.tpl @@ -31,10 +31,7 @@ text-decoration:none; padding:3px; } - #container-cookies-reg a:hover {text-decoration:underline;} - #container-cookies-reg div {padding:10px; padding-right:80px;} - #container-cookies-reg-text {padding-right:10px;} - #cookies-reg-closer { + #container-cookies-reg a:hover, { color: #777; font: 14px/100% arial, sans-serif; position: absolute; diff --git a/extras/themes/xswatch4_wge/style.css b/extras/themes/xswatch4_wge/style.css index 0672901..c13e58a 100644 --- a/extras/themes/xswatch4_wge/style.css +++ b/extras/themes/xswatch4_wge/style.css @@ -108,7 +108,7 @@ a.navbar-brand.xlogo { .xoops-banner { position: relative; - top: 0px; + top: 0; } .xoops-banner * { @@ -1373,7 +1373,7 @@ img.avatar { } #xo-pagenav a:last-child { - margin-left: 0px; + margin-left: 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; } diff --git a/include/functions.php b/include/functions.php index e9a29c0..907db48 100644 --- a/include/functions.php +++ b/include/functions.php @@ -204,6 +204,5 @@ function wgevents_Filter($url, $type = '') { $url .= \htmlentities($url, ENT_COMPAT, 'utf-8'); $url .= \preg_replace('`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\1", $url); $url .= \preg_replace([$regular_expression, '`[-]+`'], '-', $url); - $url = ('' == $url) ? $type : \strtolower(\trim($url, '-')); - return $url; + return ('' == $url) ? $type : \strtolower(\trim($url, '-')); } \ No newline at end of file diff --git a/include/update.php b/include/update.php index 2fb63b2..8b57dfe 100644 --- a/include/update.php +++ b/include/update.php @@ -45,7 +45,7 @@ function xoops_module_update_wgevents($module, $prev_version = null) //delete olf file \unlink(\XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/preloads/index.php'); //create html file - $myfile = \fopen(\XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/preloads/index.html', "w"); + $myfile = \fopen(\XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/preloads/index.html', 'wb'); \fwrite($myfile, ''); \fclose($myfile); } @@ -100,7 +100,6 @@ function xoops_module_update_wgevents($module, $prev_version = null) */ function wgevents_check_db($module) { - $ret = true; //insert here code for database check /* @@ -138,5 +137,5 @@ function wgevents_check_db($module) } } */ - return $ret; + return true; } diff --git a/output.php b/output.php index bcb820a..4a232f7 100644 --- a/output.php +++ b/output.php @@ -36,7 +36,7 @@ // Permission if (!$permissionsHandler->getPermGlobalView()) { - \redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0); } $op = Request::getCmd('op', 'none'); @@ -63,7 +63,7 @@ case 'csv': case 'xlsx': $eventname = \preg_replace('/[^a-zA-Z0-9]/', '', (string)$eventObj->getVar('name')); - $filename = \date('Ymd_H_i_s_', \time()) . \_MA_WGEVENTS_REGISTRATIONS . '_' . $eventname . '.' . $outType; + $filename = \date('Ymd_H_i_s_') . \_MA_WGEVENTS_REGISTRATIONS . '_' . $eventname . '.' . $outType; $eventFee = (float)$eventObj->getVar('fee'); $eventRegisterMax = (int)$eventObj->getVar('register_max'); @@ -201,7 +201,5 @@ function cleanOutputXlsx ($text) { //replace line breaks by blank space $cleanText = \str_replace(['
', '

'], ' ', $text); //replace html code by clean char - $cleanText = \html_entity_decode($cleanText); - - return $cleanText; + return \html_entity_decode($cleanText); } diff --git a/testdata/index.php b/testdata/index.php index 4b1907c..6987f27 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -46,7 +46,7 @@ loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK'), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); xoops_cp_footer(); } break; diff --git a/verification.php b/verification.php index 8213a0d..a93e47c 100644 --- a/verification.php +++ b/verification.php @@ -49,12 +49,10 @@ $regId = $verifKeyArray[0]; $registrationObj = $registrationHandler->get($regId); $eventName = $eventHandler->get($registrationObj->getVar('evid'))->getVar('name'); -if ($regId > 0 && \is_object($registrationObj)) { - if (WGEVENTS_URL == (string)$verifKeyArray[1] && - (int)$registrationObj->getVar('evid') == (int)$verifKeyArray[2] && - (string)$registrationObj->getVar('email') == (string)$verifKeyArray[3] && - (string)$registrationObj->getVar('verifkey') == (string)$verifKeyArray[4] - ) { +if ($regId > 0 && \is_object($registrationObj) && WGEVENTS_URL == (string)$verifKeyArray[1] && + (int)$registrationObj->getVar('evid') == (int)$verifKeyArray[2] && + (string)$registrationObj->getVar('email') == (string)$verifKeyArray[3] && + (string)$registrationObj->getVar('verifkey') == (string)$verifKeyArray[4]) { $registrationhistHandler->createHistory($registrationObj, 'update'); $registrationObj->setVar('status', Constants::STATUS_VERIFIED); $registrationObj->setVar('datecreated', \time()); @@ -64,9 +62,6 @@ $GLOBALS['xoopsTpl']->assign('verif_error', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_ERROR, $eventName)); } } else { - $GLOBALS['xoopsTpl']->assign('verif_error', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_ERROR, $eventName)); - } -} else { $GLOBALS['xoopsTpl']->assign('verif_error', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_ERROR, $eventName)); }