Skip to content

Commit

Permalink
Request
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Feb 20, 2017
1 parent b88dd48 commit da9c5e3
Show file tree
Hide file tree
Showing 43 changed files with 371 additions and 283 deletions.
72 changes: 37 additions & 35 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,24 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

use \Xmf\Request;

require_once __DIR__ . '/admin_header.php';

$op = XoopsRequest::getString('op', XoopsRequest::getString('op', '', 'POST'), 'GET');
$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');

$op = XoopsRequest::getString('editor', '', 'POST') ? 'mod' : $op;
$op = XoopsRequest::getString('addcategory', '', 'POST') ? 'addcategory' : $op;
$op = Request::getString('editor', '', 'POST') ? 'mod' : $op;
$op = Request::getString('addcategory', '', 'POST') ? 'addcategory' : $op;

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

switch ($op) {
case 'del':
$categoryObj = $publisher->getHandler('category')->get($categoryid);
$confirm = XoopsRequest::getInt('confirm', '', 'POST');
$name = XoopsRequest::getString('name', '', 'POST');
$confirm = Request::getInt('confirm', '', 'POST');
$name = Request::getString('name', '', 'POST');
if ($confirm) {
if (!$publisher->getHandler('category')->delete($categoryObj)) {
redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR);
Expand All @@ -51,8 +53,8 @@

case 'mod':
//Added by fx2024
$nb_subcats = XoopsRequest::getInt('nb_subcats', 0, 'POST');
$nb_subcats += XoopsRequest::getInt('nb_sub_yet', 4, 'POST');
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST');
$nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST');
//end of fx2024 code

PublisherUtility::cpHeader();
Expand All @@ -62,7 +64,7 @@
case 'addcategory':
global $modify;

$parentid = XoopsRequest::getInt('parentid');
$parentid = Request::getInt('parentid');

if ($categoryid != 0) {
$categoryObj = $publisher->getHandler('category')->get($categoryid);
Expand All @@ -72,10 +74,10 @@

// Uploading the image, if any
// Retreive the filename to be uploaded
$temp = XoopsRequest::getArray('image_file', '', 'FILES');
$temp = Request::getArray('image_file', '', 'FILES');
if ($image_file = $temp['name']) {
// $filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0];
$temp2 = XoopsRequest::getArray('xoops_upload_file', array(), 'POST');
// $filename = Request::getArray('xoops_upload_file', array(), 'POST')[0];
$temp2 = Request::getArray('xoops_upload_file', array(), 'POST');
if ($filename = $temp2[0]) {
// TODO : implement publisher mimetype management
$max_size = $publisher->getConfig('maximum_filesize');
Expand All @@ -97,28 +99,28 @@
}
}
} else {
$categoryObj->setVar('image', XoopsRequest::getString('image', '', 'POST'));
$categoryObj->setVar('image', Request::getString('image', '', 'POST'));
}
$categoryObj->setVar('parentid', XoopsRequest::getInt('parentid', 0, 'POST'));
$categoryObj->setVar('parentid', Request::getInt('parentid', 0, 'POST'));

$applyall = XoopsRequest::getInt('applyall', 0, 'POST');
$categoryObj->setVar('weight', XoopsRequest::getInt('weight', 1, 'POST'));
$applyall = Request::getInt('applyall', 0, 'POST');
$categoryObj->setVar('weight', Request::getInt('weight', 1, 'POST'));

// Groups and permissions
$grpread = XoopsRequest::getArray('groupsRead', array(), 'POST');
$grpsubmit = XoopsRequest::getArray('groupsSubmit', array(), 'POST');
$grpmoderation = XoopsRequest::getArray('groupsModeration', array(), 'POST');
$grpread = Request::getArray('groupsRead', array(), 'POST');
$grpsubmit = Request::getArray('groupsSubmit', array(), 'POST');
$grpmoderation = Request::getArray('groupsModeration', array(), 'POST');

$categoryObj->setVar('name', XoopsRequest::getString('name', '', 'POST'));
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));

//Added by skalpa: custom template support
$categoryObj->setVar('template', XoopsRequest::getString('template', '', 'POST'));
$categoryObj->setVar('meta_description', XoopsRequest::getString('meta_description', '', 'POST'));
$categoryObj->setVar('meta_keywords', XoopsRequest::getString('meta_keywords', '', 'POST'));
$categoryObj->setVar('short_url', XoopsRequest::getString('short_url', '', 'POST'));
$categoryObj->setVar('moderator', XoopsRequest::getInt('moderator', 0, 'POST'));
$categoryObj->setVar('description', XoopsRequest::getString('description', '', 'POST'));
$categoryObj->setVar('header', XoopsRequest::getText('header', '', 'POST'));
$categoryObj->setVar('template', Request::getString('template', '', 'POST'));
$categoryObj->setVar('meta_description', Request::getString('meta_description', '', 'POST'));
$categoryObj->setVar('meta_keywords', Request::getString('meta_keywords', '', 'POST'));
$categoryObj->setVar('short_url', Request::getString('short_url', '', 'POST'));
$categoryObj->setVar('moderator', Request::getInt('moderator', 0, 'POST'));
$categoryObj->setVar('description', Request::getString('description', '', 'POST'));
$categoryObj->setVar('header', Request::getText('header', '', 'POST'));

if ($categoryObj->isNew()) {
$redirect_msg = _AM_PUBLISHER_CATCREATED;
Expand All @@ -139,12 +141,12 @@

//Added by fx2024
$parentCat = $categoryObj->categoryid();
$sizeof = count(XoopsRequest::getArray('scname', array(), 'POST'));
$sizeof = count(Request::getArray('scname', array(), 'POST'));
for ($i = 0; $i < $sizeof; ++$i) {
$temp = XoopsRequest::getArray('scname', array(), 'POST');
$temp = Request::getArray('scname', array(), 'POST');
if ($temp[$i] != '') {
$categoryObj = $publisher->getHandler('category')->create();
$temp2 = XoopsRequest::getArray('scname', array(), 'POST');
$temp2 = Request::getArray('scname', array(), 'POST');
$categoryObj->setVar('name', $temp2[$i]);
$categoryObj->setVar('parentid', $parentCat);

Expand All @@ -167,12 +169,12 @@

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

$categoryObj = $publisher->getHandler('category')->create();
$categoryObj->setVar('name', XoopsRequest::getString('name', '', 'POST'));
$categoryObj->setVar('description', XoopsRequest::getString('description', '', 'POST'));
$categoryObj->setVar('weight', XoopsRequest::getInt('weight', 0, 'POST'));
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));
$categoryObj->setVar('description', Request::getString('description', '', 'POST'));
$categoryObj->setVar('weight', Request::getInt('weight', 0, 'POST'));
if (isset($parentCat)) {
$categoryObj->setVar('parentid', $parentCat);
}
Expand Down
6 changes: 4 additions & 2 deletions admin/clone.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@
* @author trabis <[email protected]>
*/

use \Xmf\Request;

require_once __DIR__ . '/admin_header.php';

PublisherUtility::cpHeader();
//publisher_adminMenu(-1, _AM_PUBLISHER_CLONE);
PublisherUtility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC);

if ('submit' === XoopsRequest::getString('op', '', 'POST')) {
if ('submit' === Request::getString('op', '', 'POST')) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header('clone.php', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
// exit();
}

// $clone = $_POST['clone'];
$clone = XoopsRequest::getString('clone', '', 'POST');
$clone = Request::getString('clone', '', 'POST');

//check if name is valid
if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) {
Expand Down
26 changes: 14 additions & 12 deletions admin/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

use \Xmf\Request;

require_once __DIR__ . '/admin_header.php';

$op = XoopsRequest::getString('op');
$op = Request::getString('op');

/**
* @param bool $showmenu
Expand Down Expand Up @@ -80,8 +82,8 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
break;

case 'mod':
$fileid = XoopsRequest::getInt('fileid', 0, 'GET');
$itemid = XoopsRequest::getInt('itemid', 0, 'GET');
$fileid = Request::getInt('fileid', 0, 'GET');
$itemid = Request::getInt('itemid', 0, 'GET');
if (($fileid == 0) && ($itemid == 0)) {
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_NOITEMSELECTED);
// exit();
Expand All @@ -94,7 +96,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
break;

case 'modify':
$fileid = XoopsRequest::getInt('fileid', 0, 'POST');
$fileid = Request::getInt('fileid', 0, 'POST');

// Creating the file object
if ($fileid != 0) {
Expand All @@ -104,9 +106,9 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
}

// Putting the values in the file object
$fileObj->setVar('name', XoopsRequest::getString('name', '', 'POST'));
$fileObj->setVar('description', XoopsRequest::getString('description', '', 'POST'));
$fileObj->setVar('status', XoopsRequest::getInt('status', 0, 'POST'));
$fileObj->setVar('name', Request::getString('name', '', 'POST'));
$fileObj->setVar('description', Request::getString('description', '', 'POST'));
$fileObj->setVar('status', Request::getInt('status', 0, 'POST'));

// Storing the file
if (!$fileObj->store()) {
Expand All @@ -119,13 +121,13 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
break;

case 'del':
$fileid = XoopsRequest::getInt('fileid', 0, 'POST');
$fileid = XoopsRequest::getInt('fileid', $fileid, 'GET');
$fileid = Request::getInt('fileid', 0, 'POST');
$fileid = Request::getInt('fileid', $fileid, 'GET');

$fileObj = $publisher->getHandler('file')->get($fileid);

$confirm = XoopsRequest::getInt('confirm', 0, 'POST');
$title = XoopsRequest::getString('title', '', 'POST');
$confirm = Request::getInt('confirm', 0, 'POST');
$title = Request::getString('title', '', 'POST');

if ($confirm) {
if (!$publisher->getHandler('file')->delete($fileObj)) {
Expand All @@ -137,7 +139,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
// exit();
} else {
// no confirm: show deletion condition
$fileid = XoopsRequest::getInt('fileid', 0, 'GET');
$fileid = Request::getInt('fileid', 0, 'GET');

PublisherUtility::cpHeader();
xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php',
Expand Down
6 changes: 4 additions & 2 deletions admin/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

use \Xmf\Request;

require_once __DIR__ . '/admin_header.php';

$op = XoopsRequest::getString('op', XoopsRequest::getString('op', 'none', 'GET'), 'POST');
$op = Request::getString('op', Request::getString('op', 'none', 'GET'), 'POST');

switch ($op) {
case 'importExecute':
$importfile = XoopsRequest::getString('importfile', 'nonselected', 'POST');
$importfile = Request::getString('importfile', 'nonselected', 'POST');
$importfile_path = $GLOBALS['xoops']->path('modules/' . $publisher->getModule()->dirname() . '/admin/import/' . $importfile . '.php');
include_once $importfile_path;
break;
Expand Down
10 changes: 6 additions & 4 deletions admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
* @author Marius Scurtescu <[email protected]>
*/

use \Xmf\Request;

include_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();

$importFromModuleName = 'AMS ' . XoopsRequest::getString('ams_version', '', 'POST');
$importFromModuleName = 'AMS ' . Request::getString('ams_version', '', 'POST');

$scriptname = 'ams.php';

$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start';
$op = ('go' === Request::getString('op', '', 'POST')) ? 'go' : 'start';

if ($op === 'start') {
xoops_load('XoopsFormLoader');
Expand Down Expand Up @@ -152,7 +154,7 @@
$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('ams_version', '', 'POST')));
$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('ams_version', '', 'POST')));

$form->display();
}
Expand All @@ -177,7 +179,7 @@
$cnt_imported_cat = 0;
$cnt_imported_articles = 0;

$parentId = XoopsRequest::getInt('parent_category', 0, 'POST');
$parentId = Request::getInt('parent_category', 0, 'POST');

$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics');

Expand Down
8 changes: 5 additions & 3 deletions admin/import/cjaycontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
* @author Marius Scurtescu <[email protected]>
*/

use \Xmf\Request;

include_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();

$importFromModuleName = 'cjaycontent ' . XoopsRequest::getString('cjaycontent_version', '', 'POST');
$importFromModuleName = 'cjaycontent ' . Request::getString('cjaycontent_version', '', 'POST');

$scriptname = 'cjaycontent.php';

$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start';
$op = ('go' === Request::getString('op', '', 'POST')) ? 'go' : 'start';

/**
* @param $src
Expand Down Expand Up @@ -74,7 +76,7 @@
$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('cjaycontent_version', '', 'POST')));
$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('cjaycontent_version', '', 'POST')));

$form->display();
}
Expand Down
10 changes: 6 additions & 4 deletions admin/import/fmcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
* @author ZySpec <[email protected]>
*/

use \Xmf\Request;

include_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();

$importFromModuleName = 'FmContent ' . XoopsRequest::getString('fmcontent_version', '', 'POST');
$importFromModuleName = 'FmContent ' . Request::getString('fmcontent_version', '', 'POST');

$scriptname = 'fmcontent.php';

$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start';
$op = ('go' === Request::getString('op', '', 'POST')) ? 'go' : 'start';

if ('start' === $op) {
xoops_load('XoopsFormLoader');
Expand Down Expand Up @@ -118,7 +120,7 @@
$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('news_version', '', 'POST')));
$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('news_version', '', 'POST')));

$form->display();
}
Expand All @@ -142,7 +144,7 @@
$cnt_imported_cat = 0;
$cnt_imported_articles = 0;

$parentId = XoopsRequest::getInt('parent_category', 0, 'POST');
$parentId = Request::getInt('parent_category', 0, 'POST');

// get all FmContent Content items without a category (content_topic=0)
$fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent');
Expand Down
10 changes: 6 additions & 4 deletions admin/import/news.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
* @author Marius Scurtescu <[email protected]>
*/

use \Xmf\Request;

include_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();

$importFromModuleName = 'News ' . XoopsRequest::getString('news_version', '', 'POST');
$importFromModuleName = 'News ' . Request::getString('news_version', '', 'POST');

$scriptname = 'news.php';

$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start';
$op = ('go' === Request::getString('op', '', 'POST')) ? 'go' : 'start';

if ($op === 'start') {
xoops_load('XoopsFormLoader');
Expand Down Expand Up @@ -89,7 +91,7 @@
$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('news_version', '', 'POST')));
$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('news_version', '', 'POST')));

$form->display();
}
Expand All @@ -113,7 +115,7 @@
$cnt_imported_cat = 0;
$cnt_imported_articles = 0;

$parentId = XoopsRequest::getInt('parent_category', 0, 'POST');
$parentId = Request::getInt('parent_category', 0, 'POST');

$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('news_topics');

Expand Down
Loading

0 comments on commit da9c5e3

Please sign in to comment.