Skip to content

Commit

Permalink
camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Jul 6, 2020
1 parent cfe332d commit e54f1bd
Show file tree
Hide file tree
Showing 48 changed files with 487 additions and 472 deletions.
42 changes: 21 additions & 21 deletions admin/blockform.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
if (isset($block['name'])) {
$form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_NAME, $block['name']));
}
$side_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_TYPE, 'bside', $block['side']);
$side_select->addOptionArray(
$sideSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_TYPE, 'bside', $block['side']);
$sideSelect->addOptionArray(
[
0 => _AM_SYSTEM_BLOCKS_SBLEFT,
1 => _AM_SYSTEM_BLOCKS_SBRIGHT,
Expand All @@ -37,35 +37,35 @@
9 => _AM_SYSTEM_BLOCKS_CBBOTTOM,
]
);
$form->addElement($side_select);
$form->addElement($sideSelect);
$form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight']));
$form->addElement(new \XoopsFormRadioYN(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible']));
$mod_select = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true);
$moduleSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true);
/** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
$criteria = new \CriteriaCompo(new \Criteria('hasmain', 1));
$criteria->add(new \Criteria('isactive', 1));
$module_list = $moduleHandler->getList($criteria);
$module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE;
$module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES;
ksort($module_list);
$mod_select->addOptionArray($module_list);
$form->addElement($mod_select);
$moduleList = $moduleHandler->getList($criteria);
$moduleList[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE;
$moduleList[0] = _AM_SYSTEM_BLOCKS_ALLPAGES;
ksort($moduleList);
$moduleSelect->addOptionArray($moduleList);
$form->addElement($moduleSelect);
$form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'TITLE'), 'btitle', 50, 255, $block['title']), false);
if ($block['is_custom']) {
$textarea = new \XoopsFormDhtmlTextArea(_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70);
$textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">' . _AM_SYSTEM_BLOCKS_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>');
$form->addElement($textarea, true);
$ctype_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']);
$ctype_select->addOptionArray(
$ctypeSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']);
$ctypeSelect->addOptionArray(
[
'H' => _AM_SYSTEM_BLOCKS_HTML,
'P' => _AM_SYSTEM_BLOCKS_PHP,
'S' => _AM_SYSTEM_BLOCKS_AFWSMILE,
'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE,
]
);
$form->addElement($ctype_select);
$form->addElement($ctypeSelect);
} else {
if ('' !== $block['template']) {
/** @var \XoopsTplfileHandler $tplfileHandler */
Expand All @@ -84,8 +84,8 @@
$form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_OPTIONS, $block['edit_form']));
}
}
$cache_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']);
$cache_select->addOptionArray(
$cacheSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']);
$cacheSelect->addOptionArray(
[
'0' => _NOCACHE,
'30' => sprintf(_SECONDS, 30),
Expand All @@ -100,7 +100,7 @@
'2592000' => _MONTH,
]
);
$form->addElement($cache_select);
$form->addElement($cacheSelect);

/** @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
Expand All @@ -120,11 +120,11 @@

//Submit buttons
$buttonTray = new \XoopsFormElementTray('', '');
$submit_button = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit');
$buttonTray->addElement($submit_button);
$submitButton = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit');
$buttonTray->addElement($submitButton);

$cancel_button = new \XoopsFormButton('', '', _CANCEL, 'button');
$cancel_button->setExtra('onclick="history.go(-1)"');
$buttonTray->addElement($cancel_button);
$cancelButton = new \XoopsFormButton('', '', _CANCEL, 'button');
$cancelButton->setExtra('onclick="history.go(-1)"');
$buttonTray->addElement($cancelButton);

$form->addElement($buttonTray);
44 changes: 22 additions & 22 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ function listBlocks()
$groups = $memberHandler->getGroups();
$criteria = new \CriteriaCompo(new \Criteria('hasmain', 1));
$criteria->add(new \Criteria('isactive', 1));
$module_list = $moduleHandler->getList($criteria);
$module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE;
$module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES;
ksort($module_list);
$moduleList = $moduleHandler->getList($criteria);
$moduleList[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE;
$moduleList[0] = _AM_SYSTEM_BLOCKS_ALLPAGES;
ksort($moduleList);
echo "
<h4 style='text-align:left;'>" . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . '</h4>';
// $moduleHandler = xoops_getHandler('module');
Expand Down Expand Up @@ -111,8 +111,8 @@ function listBlocks()
. constant('CO_' . $moduleDirNameUpper . '_' . 'ACTION')
. '</th></tr>
';
$block_arr = \XoopsBlock::getByModule($xoopsModule->mid());
$block_count = count($block_arr);
$blockArray = \XoopsBlock::getByModule($xoopsModule->mid());
$blockCount = count($blockArray);
$class = 'even';
$cachetimes = [
'0' => _NOCACHE,
Expand All @@ -127,21 +127,21 @@ function listBlocks()
'604800' => _WEEK,
'2592000' => _MONTH,
];
foreach ($block_arr as $i) {
$groups_perms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid'));
foreach ($blockArray as $i) {
$groupsPerms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid'));
$sql = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . $i->getVar('bid');
$result = $db->query($sql);
$modules = [];
while (false !== ($row = $db->fetchArray($result))) {
$modules[] = (int)$row['module_id'];
}

$cachetime_options = '';
foreach ($cachetimes as $cachetime => $cachetime_name) {
$cachetimeOptions = '';
foreach ($cachetimes as $cachetime => $cachetimeName) {
if ($i->getVar('bcachetime') == $cachetime) {
$cachetime_options .= "<option value='$cachetime' selected='selected'>$cachetime_name</option>\n";
$cachetimeOptions .= "<option value='$cachetime' selected='selected'>$cachetimeName</option>\n";
} else {
$cachetime_options .= "<option value='$cachetime'>$cachetime_name</option>\n";
$cachetimeOptions .= "<option value='$cachetime'>$cachetimeName</option>\n";
}
}

Expand Down Expand Up @@ -240,19 +240,19 @@ function listBlocks()
. '</td>';

echo "<td class='$class' align='center'><select size='5' name='bmodule[" . $i->getVar('bid') . "][]' id='bmodule[" . $i->getVar('bid') . "][]' multiple='multiple'>";
foreach ($module_list as $k => $v) {
foreach ($moduleList as $k => $v) {
echo "<option value='$k'" . (in_array($k, $modules, true) ? " selected='selected'" : '') . ">$v</option>";
}
echo '</select></td>';

echo "<td class='$class' align='center'><select size='5' name='groups[" . $i->getVar('bid') . "][]' id='groups[" . $i->getVar('bid') . "][]' multiple='multiple'>";
foreach ($groups as $grp) {
echo "<option value='" . $grp->getVar('groupid') . "' " . (in_array($grp->getVar('groupid'), $groups_perms, true) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>';
echo "<option value='" . $grp->getVar('groupid') . "' " . (in_array($grp->getVar('groupid'), $groupsPerms, true) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>';
}
echo '</select></td>';

// Cache lifetime
echo '<td class="' . $class . '" align="center"> <select name="bcachetime[' . $i->getVar('bid') . ']" size="1">' . $cachetime_options . '</select>
echo '<td class="' . $class . '" align="center"> <select name="bcachetime[' . $i->getVar('bid') . ']" size="1">' . $cachetimeOptions . '</select>
</td>';

// Actions
Expand Down Expand Up @@ -313,7 +313,7 @@ function cloneBlock($bid)
while (false !== ($row = $db->fetchArray($result))) {
$modules[] = (int)$row['module_id'];
}
$is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
$isCustom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
$block = [
'title' => $myblock->getVar('title') . ' Clone',
'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'),
Expand All @@ -323,7 +323,7 @@ function cloneBlock($bid)
'visible' => $myblock->getVar('visible'),
'content' => $myblock->getVar('content', 'N'),
'modules' => $modules,
'is_custom' => $is_custom,
'is_custom' => $isCustom,
'ctype' => $myblock->getVar('c_type'),
'bcachetime' => $myblock->getVar('bcachetime'),
'op' => 'clone_ok',
Expand Down Expand Up @@ -456,7 +456,7 @@ function editBlock($bid)
while (false !== ($row = $db->fetchArray($result))) {
$modules[] = (int)$row['module_id'];
}
$is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
$isCustom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
$block = [
'title' => $myblock->getVar('title'),
'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'),
Expand All @@ -466,7 +466,7 @@ function editBlock($bid)
'visible' => $myblock->getVar('visible'),
'content' => $myblock->getVar('content', 'N'),
'modules' => $modules,
'is_custom' => $is_custom,
'is_custom' => $isCustom,
'ctype' => $myblock->getVar('c_type'),
'bcachetime' => $myblock->getVar('bcachetime'),
'op' => 'edit_ok',
Expand Down Expand Up @@ -506,10 +506,10 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b
$myblock->setVar('bcachetime', $bcachetime);
//update block options
if (isset($options)) {
$options_count = count($options);
if ($options_count > 0) {
$optionsCount = count($options);
if ($optionsCount > 0) {
//Convert array values to comma-separated
for ($i = 0; $i < $options_count; ++$i) {
for ($i = 0; $i < $optionsCount; ++$i) {
if (is_array($options[$i])) {
$options[$i] = implode(',', $options[$i]);
}
Expand Down
46 changes: 23 additions & 23 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@

// Where do we start ?
$startcategory = Request::getInt('startcategory', 0, 'GET');
$categoryid = Request::getInt('categoryid', null);
$categoryId = Request::getInt('categoryid', null);

switch ($op) {
case 'del':
$categoryObj = $helper->getHandler('Category')->get($categoryid);
$categoryObj = $helper->getHandler('Category')->get($categoryId);
$confirm = Request::getString('confirm', '', 'POST');
$name = Request::getString('name', '', 'POST');
if ($confirm) {
Expand All @@ -52,43 +52,43 @@
break;
case 'mod':
//Added by fx2024
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST');
$nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST');
$numberSubcats = Request::getInt('nb_subcats', 0, 'POST');
$numberSubcats += Request::getInt('nb_sub_yet', 4, 'POST');
//end of fx2024 code

Utility::cpHeader();
Utility::editCategory(true, $categoryid, $nb_subcats);
Utility::editCategory(true, $categoryId, $numberSubcats);
break;
case 'addcategory':
global $modify;

$parentid = Request::getInt('parentid');
if (0 != $categoryid) {
$categoryObj = $helper->getHandler('Category')->get($categoryid);
if (0 != $categoryId) {
$categoryObj = $helper->getHandler('Category')->get($categoryId);
} else {
$categoryObj = $helper->getHandler('Category')->create();
}

// Uploading the image, if any
// Retreive the filename to be uploaded
$temp = Request::getArray('image_file', '', 'FILES');
$image_file = $temp['name'];
if ($image_file) {
$imageFile = $temp['name'];
if ($imageFile) {
// $filename = Request::getArray('xoops_upload_file', array(), 'POST')[0];
$temp2 = Request::getArray('xoops_upload_file', [], 'POST');
$filename = $temp2[0];
if ($filename) {
// TODO : implement publisher mimetype management
$max_size = $helper->getConfig('maximum_filesize');
$max_imgwidth = $helper->getConfig('maximum_image_width');
$max_imgheight = $helper->getConfig('maximum_image_height');
$allowed_mimetypes = Utility::getAllowedImagesTypes();
$maxSize = $helper->getConfig('maximum_filesize');
$maxImageWidth = $helper->getConfig('maximum_image_width');
$maxImageHeight = $helper->getConfig('maximum_image_height');
$allowedMimetypes = Utility::getAllowedImagesTypes();
if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) {
redirect_header('<script>javascript:history.go(-1)</script>', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR);
}

xoops_load('XoopsMediaUploader');
$uploader = new \XoopsMediaUploader(Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
$uploader = new \XoopsMediaUploader(Utility::getImageDir('category'), $allowedMimetypes, $maxSize, $maxImageWidth, $maxImageHeight);
if ($uploader->fetchMedia($filename) && $uploader->upload()) {
$categoryObj->setVar('image', $uploader->getSavedFileName());
} else {
Expand Down Expand Up @@ -120,11 +120,11 @@
$categoryObj->setVar('header', Request::getText('header', '', 'POST'));

if ($categoryObj->isNew()) {
$redirect_msg = _AM_PUBLISHER_CATCREATED;
$redirect_to = 'category.php?op=mod';
$redirectMsg = _AM_PUBLISHER_CATCREATED;
$redirectTo = 'category.php?op=mod';
} else {
$redirect_msg = _AM_PUBLISHER_COLMODIFIED;
$redirect_to = 'category.php';
$redirectMsg = _AM_PUBLISHER_COLMODIFIED;
$redirectTo = 'category.php';
}

if (!$categoryObj->store()) {
Expand Down Expand Up @@ -156,13 +156,13 @@
}
}
//end of fx2024 code
redirect_header($redirect_to, 2, $redirect_msg);
redirect_header($redirectTo, 2, $redirectMsg);
break;
//Added by fx2024

case 'addsubcats':
$categoryid = 0;
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');
$categoryId = 0;
$numberSubcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');

$categoryObj = $helper->getHandler('Category')->create();
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));
Expand All @@ -173,7 +173,7 @@
}

Utility::cpHeader();
Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
Utility::editCategory(true, $categoryId, $numberSubcats, $categoryObj);
exit();
break;
//end of fx2024 code
Expand Down Expand Up @@ -214,7 +214,7 @@
echo '<tr>';
echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . '</td>';
echo '</tr>';
$categoryid = '0';
$categoryId = '0';
}
echo "</table>\n";
require_once $GLOBALS['xoops']->path('class/pagenav.php');
Expand Down
8 changes: 4 additions & 4 deletions admin/feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@

$your_name = Request::getString('your_name', '');
$your_site = Request::getString('your_site', '');
$your_mail = Request::getString('your_mail', '');
$yourMail = Request::getString('your_mail', '');
$fb_type = Request::getString('fb_type', '');
$fb_content = Request::getText('fb_content', '');
$fb_content = str_replace(["\r\n", "\n", "\r"], '<br>', $fb_content); //clean line break from dhtmltextarea

$title = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname');
$body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '<br>';
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '<br>';
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $yourMail . '<br>';
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '<br>';
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '<br><br>';
$body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':<br>';
$body .= $fb_content;
$xoopsMailer = xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail'));
$xoopsMailer->setFromEmail($your_mail);
$xoopsMailer->setFromEmail($yourMail);
$xoopsMailer->setFromName($your_name);
$xoopsMailer->setSubject($title);
$xoopsMailer->multimailer->isHTML(true);
Expand All @@ -85,7 +85,7 @@

// show form with content again
$feedback->name = $your_name;
$feedback->email = $your_mail;
$feedback->email = $yourMail;
$feedback->site = $your_site;
$feedback->type = $fb_type;
$feedback->content = $fb_content;
Expand Down
Loading

0 comments on commit e54f1bd

Please sign in to comment.