Skip to content

Commit ba8357b

Browse files
authored
Merge pull request #30 from ggoffy/master
implementation of rating system and new xoops_confirm/code cosmetics
2 parents 11d4efc + efb8df6 commit ba8357b

File tree

91 files changed

+1522
-520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1522
-520
lines changed

_TODO.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ I moved files, where I do not know whether they are still needed into folder _ar
99

1010
TODOs:
1111

12-
new xoops_confirm
1312

1413

15-
rate.php:
16-
this file currently is not rating
17-
1814

1915

2016
Permissions:

admin/addfiles.php

Lines changed: 0 additions & 144 deletions
This file was deleted.

admin/fields.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,7 @@
221221
exit;
222222
break;
223223
case 'delete':
224-
$tablesObj = $helper->getHandler('Tables')->get($fieldTid);
225-
if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
226-
if (!$GLOBALS['xoopsSecurity']->check()) {
227-
redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
228-
}
229-
if ($helper->getHandler('Tables')->delete($tablesObj)) {
230-
redirect_header('fields.php', 3, _AM_MODULEBUILDER_FORMDELOK);
231-
} else {
232-
echo $tablesObj->getHtmlErrors();
233-
}
234-
} else {
235-
xoops_confirm(['ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name')));
236-
}
224+
//delete is not needed as deletion is done by deleting whole table
237225
break;
238226
case 'display':
239227
$fieldsArray = ['parent', 'inlist', 'inform', 'admin', 'user', 'block', 'main', 'search', 'required'];

admin/modules.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@
190190
$GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors());
191191
}
192192
} else {
193-
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm();
194-
$xoopsconfirm->hiddens = ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'];
195-
$xoopsconfirm->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
196-
$xoopsconfirm->object = $modulesObj->getVar('mod_name');
193+
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
194+
['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'],
195+
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
196+
$modulesObj->getVar('mod_name')
197+
);
197198
$form = $xoopsconfirm->getFormXoopsConfirm();
198199
$GLOBALS['xoopsTpl']->assign('form', $form->render());
199200
}

admin/morefiles.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@
110110
$GLOBALS['xoopsTpl']->assign('form', $form->render());
111111
break;
112112
case 'edit':
113-
// Define main template
114-
// $templateMain = 'modulebuilder_morefiles.tpl';
115113
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
116114
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
117115
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'morefiles.php?op=new', 'add');
@@ -134,7 +132,13 @@
134132
$GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors());
135133
}
136134
} else {
137-
xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORM_SURE_DELETE, $morefilesObj->getVar('file_name')));
135+
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
136+
['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'],
137+
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
138+
$morefilesObj->getVar('file_name')
139+
);
140+
$form = $xoopsconfirm->getFormXoopsConfirm();
141+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
138142
}
139143
break;
140144
}

admin/settings.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@
170170
$GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors());
171171
}
172172
} else {
173-
xoops_confirm(['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $settingsObj->getVar('set_name')));
173+
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
174+
['ok' => 1, 'set_id' => $setId, 'op' => 'delete'],
175+
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
176+
$settingsObj->getVar('set_name')
177+
);
178+
$form = $xoopsconfirm->getFormXoopsConfirm();
179+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
174180
}
175181
break;
176182
case 'display':

admin/tables.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,13 @@
259259
$GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors());
260260
}
261261
} else {
262-
xoops_confirm(['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name')));
262+
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
263+
['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'],
264+
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
265+
$tablesObj->getVar('table_name')
266+
);
267+
$form = $xoopsconfirm->getFormXoopsConfirm();
268+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
263269
}
264270
break;
265271
case 'display':

class/Common/XoopsConfirm.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,28 @@
3030
/**
3131
* Class Object XoopsConfirm
3232
*/
33-
class XoopsConfirm extends \XoopsObject
33+
class XoopsConfirm
3434
{
35-
public $hiddens = [];
36-
public $action = '';
37-
public $title = '';
38-
public $label = '';
39-
public $object = '';
35+
private $hiddens = [];
36+
private $action = '';
37+
private $title = '';
38+
private $label = '';
39+
private $object = '';
4040

4141
/**
4242
* @public function constructor class
4343
*
4444
* @param null
4545
*/
46-
public function __construct()
46+
public function __construct($hiddens, $action, $object, $title = '', $label = '')
4747
{
48+
$this->hiddens = $hiddens;
49+
$this->action = $action;
50+
$this->object = $object;
51+
$this->title = $title;
52+
$this->label = $label;
4853
}
4954

50-
/**
51-
* @static function &getInstance
52-
*
53-
* @param null
54-
*/
55-
public static function getInstance()
56-
{
57-
static $instance = false;
58-
if (!$instance) {
59-
$instance = new self();
60-
}
61-
}
62-
63-
6455
/**
6556
* @public function getXoopsConfirm
6657
* @param bool $action
@@ -85,7 +76,7 @@ public function getFormXoopsConfirm()
8576
}
8677

8778
xoops_load('XoopsFormLoader');
88-
$form = new \XoopsThemeForm($this->title, 'form', $this->action, 'post', true);
79+
$form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true);
8980
$form->setExtra('enctype="multipart/form-data"');
9081
$form->addElement(new \XoopsFormLabel($this->label, $this->object));
9182
//hiddens

class/Files/Blocks/BlocksFiles.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
*/
3333
class BlocksFiles extends Files\CreateFile
3434
{
35-
/**
36-
* @var mixed
37-
*/
38-
private $axc = null;
3935

4036
/**
4137
* @var mixed
@@ -147,6 +143,12 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fie
147143
$critStatus .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t\t");
148144
}
149145

146+
$case1 = [];
147+
$case2 = [];
148+
$case3 = [];
149+
$case4 = [];
150+
$case5 = [];
151+
150152
$case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t");
151153
if ('' !== $fieldStatus) {
152154
$case1[] = $critStatus;

0 commit comments

Comments
 (0)