Skip to content

Commit

Permalink
1.05 Beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Feb 20, 2017
1 parent b374bbb commit 6e5b1bf
Show file tree
Hide file tree
Showing 85 changed files with 3,447 additions and 2,287 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
*~
\#*
*.bak
.idea/

tests/_output/*
.idea/
tests/_output/*
18 changes: 5 additions & 13 deletions admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@
* @author Mage, Mamba
*/

include_once __DIR__ . '/admin_header.php';

require_once __DIR__ . '/admin_header.php';
xoops_cp_header();

$aboutAdmin = new ModuleAdmin();

echo $aboutAdmin->addNavigation(basename(__FILE__));
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);

// if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
// echo 'I am at least PHP version 5.4.0, my version: ' . PHP_VERSION . "\n";
// } else {
// echo 'I am using PHP lower than 5.4, my version: ' . PHP_VERSION . "\n";
// }
$adminObject->displayNavigation(basename(__FILE__));
\Xmf\Module\Admin::setPaypal('6KJ7RW5DR3VTJ');
$adminObject->displayAbout(false);

include_once __DIR__ . '/admin_footer.php';
require_once __DIR__ . '/admin_footer.php';
12 changes: 8 additions & 4 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
* @author XOOPS Development Team
*/

global $xoopsModule;
$pathIcon32 = XOOPS_URL . '/' . $xoopsModule->getInfo('sysIcons32');
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);

echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n"
. " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
echo "<div class='adminfooter'>\n"
. " <div style='text-align: center;'>\n"
. " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
. " </div>\n"
. ' '
. _AM_MODULEADMIN_ADMIN_FOOTER
. "\n"
. '</div>';

xoops_cp_footer();
42 changes: 27 additions & 15 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,32 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
include_once $GLOBALS['xoops']->path('www/include/cp_functions.php');
include_once $GLOBALS['xoops']->path('www/include/cp_header.php');
include_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
include_once __DIR__ . '/../../../include/cp_header.php';
//include_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');

xoops_load('XoopsRequest');
//require_once __DIR__ . '/../include/common.php';

include_once dirname(__DIR__) . '/include/config.php';
require __DIR__ . '/../class/utility.php';
include_once __DIR__ . '/../include/config.php';

//xoops_loadLanguage('admin', PUBLISHER_DIRNAME);
xoops_loadLanguage('modinfo', PUBLISHER_DIRNAME);
if (!isset($moduleDirName)) {
$moduleDirName = basename(dirname(__DIR__));
}

if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
} else {
$moduleHelper = Xmf\Module\Helper::getHelper('system');
}
$adminObject = \Xmf\Module\Admin::getInstance();

$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');

// Load language files
$moduleHelper->loadLanguage('admin');
$moduleHelper->loadLanguage('modinfo');
$moduleHelper->loadLanguage('main');

$imagearray = array(
'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />",
Expand All @@ -37,12 +52,9 @@
'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />"
);

include_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
//ModuleAdmin::loadLanguage();
/*
$myts = MyTextSanitizer::getInstance();

if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
include_once(XOOPS_ROOT_PATH."/class/template.php");
$xoopsTpl = new XoopsTpl();
} */
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
include_once $GLOBALS['xoops']->path('class/template.php');
$xoopsTpl = new XoopsTpl();
}
44 changes: 22 additions & 22 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

include_once __DIR__ . '/admin_header.php';
require_once __DIR__ . '/admin_header.php';

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

Expand Down Expand Up @@ -55,8 +55,8 @@
$nb_subcats += XoopsRequest::getInt('nb_sub_yet', 4, 'POST');
//end of fx2024 code

publisherCpHeader();
PublisherUtilities::editCategory(true, $categoryid, $nb_subcats);
PublisherUtility::cpHeader();
PublisherUtility::editCategory(true, $categoryid, $nb_subcats);
break;

case 'addcategory':
Expand All @@ -81,14 +81,14 @@
$max_size = $publisher->getConfig('maximum_filesize');
$max_imgwidth = $publisher->getConfig('maximum_image_width');
$max_imgheight = $publisher->getConfig('maximum_image_height');
$allowed_mimetypes = publisherGetAllowedImagesTypes();
$allowed_mimetypes = PublisherUtility::getAllowedImagesTypes();
if (($temp['tmp_name'] == '') || !is_readable($temp['tmp_name'])) {
redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR);
// exit();
}

xoops_load('XoopsMediaUploader');
$uploader = new XoopsMediaUploader(publisherGetImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
$uploader = new XoopsMediaUploader(PublisherUtility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
if ($uploader->fetchMedia($filename) && $uploader->upload()) {
$categoryObj->setVar('image', $uploader->getSavedFileName());
} else {
Expand Down Expand Up @@ -129,17 +129,17 @@
}

if (!$categoryObj->store()) {
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors()));
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . PublisherUtility::formatErrors($categoryObj->getErrors()));
// exit;
}
// TODO : put this function in the category class
publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
publisherSaveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
publisherSaveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
PublisherUtility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
PublisherUtility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
PublisherUtility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');

//Added by fx2024
$parentCat = $categoryObj->categoryid();
$sizeof = count(XoopsRequest::getString('scname', '', 'POST'));
$sizeof = count(XoopsRequest::getArray('scname', array(), 'POST'));
for ($i = 0; $i < $sizeof; ++$i) {
$temp = XoopsRequest::getArray('scname', array(), 'POST');
if ($temp[$i] != '') {
Expand All @@ -149,13 +149,13 @@
$categoryObj->setVar('parentid', $parentCat);

if (!$categoryObj->store()) {
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors()));
// exit;
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . PublisherUtility::formatErrors($categoryObj->getErrors()));
// exit;
}
// TODO : put this function in the category class
publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
publisherSaveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
publisherSaveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
PublisherUtility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
PublisherUtility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
PublisherUtility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
}
}
//end of fx2024 code
Expand All @@ -177,8 +177,8 @@
$categoryObj->setVar('parentid', $parentCat);
}

publisherCpHeader();
PublisherUtilities::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
PublisherUtility::cpHeader();
PublisherUtility::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
exit();
break;
//end of fx2024 code
Expand All @@ -189,7 +189,7 @@
break;
case 'default':
default:
publisherCpHeader();
PublisherUtility::cpHeader();
//publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES);

echo "<br>\n";
Expand All @@ -201,7 +201,7 @@
// Creating the objects for top categories
$categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0);

publisherOpenCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);
PublisherUtility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);

echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
echo '<tr>';
Expand All @@ -213,7 +213,7 @@
$totalCategories = $publisher->getHandler('category')->getCategoriesCount(0);
if (count($categoriesObj) > 0) {
foreach ($categoriesObj as $key => $thiscat) {
PublisherUtilities::displayCategory($thiscat);
PublisherUtility::displayCategory($thiscat);
}
unset($key, $thiscat);
} else {
Expand All @@ -227,10 +227,10 @@
$pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
echo '<br>';
publisherCloseCollapsableBar('createdcategories', 'createdcategoriesicon');
PublisherUtility::closeCollapsableBar('createdcategories', 'createdcategoriesicon');
echo '<br>';
//editcat(false);
break;
}

include_once __DIR__ . '/admin_footer.php';
require_once __DIR__ . '/admin_footer.php';
14 changes: 7 additions & 7 deletions admin/clone.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* @author trabis <[email protected]>
*/

include_once __DIR__ . '/admin_header.php';
require_once __DIR__ . '/admin_header.php';

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

if ('submit' === XoopsRequest::getString('op', '', 'POST')) {
if (!$GLOBALS['xoopsSecurity']->check()) {
Expand Down Expand Up @@ -76,9 +76,9 @@
}

// End of collapsable bar
publisherCloseCollapsableBar('clone', 'cloneicon');
PublisherUtility::closeCollapsableBar('clone', 'cloneicon');

include_once __DIR__ . '/admin_footer.php';
require_once __DIR__ . '/admin_footer.php';

// work around for PHP < 5.0.x
/*
Expand Down Expand Up @@ -164,7 +164,7 @@ public static function createLogo($dirname)
// unset($func);
}

if (!file_exists($imageBase = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logo_module.png'))
if (!file_exists($imageBase = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png'))
|| !file_exists($font = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/VeraBd.ttf'))
) {
return false;
Expand All @@ -189,7 +189,7 @@ public static function createLogo($dirname)
//imagefill($imageModule, 0, 0, $white);
//imagecolortransparent($imageModule, $white);

imagepng($imageModule, $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logo_module.png'));
imagepng($imageModule, $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png'));
imagedestroy($imageModule);

return true;
Expand Down
24 changes: 12 additions & 12 deletions admin/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

include_once __DIR__ . '/admin_header.php';
require_once __DIR__ . '/admin_header.php';

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

Expand All @@ -45,37 +45,37 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
echo "<br>\n";
echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . '</span>';
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_EDITING_DSC . '</span>';
publisherOpenCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
PublisherUtility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
} else {
// there's no parameter, so we're adding an item
$fileObj = $publisher->getHandler('file')->create();
$fileObj->setVar('itemid', $itemid);
echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . '</span>';
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_ADDING_DSC . '</span>';
publisherOpenCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
PublisherUtility::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
}

// FILES UPLOAD FORM
$uploadForm = $fileObj->getForm();
$uploadForm->display();

if ($fileid != 0) {
publisherCloseCollapsableBar('editfile', 'editfileicon');
PublisherUtility::closeCollapsableBar('editfile', 'editfileicon');
} else {
publisherCloseCollapsableBar('addfile', 'addfileicon');
PublisherUtility::closeCollapsableBar('addfile', 'addfileicon');
}
}

$false = false;
/* -- Available operations -- */
switch ($op) {
case 'uploadfile':
publisherUploadFile(false, true, $false);
PublisherUtility::uploadFile(false, true, $false);
exit;
break;

case 'uploadanother':
publisherUploadFile(true, true, $false);
PublisherUtility::uploadFile(true, true, $false);
exit;
break;

Expand All @@ -87,7 +87,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
// exit();
}

publisherCpHeader();
PublisherUtility::cpHeader();
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');

publisher_editFile(true, $fileid, $itemid);
Expand All @@ -110,7 +110,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

// Storing the file
if (!$fileObj->store()) {
redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisherFormatErrors($fileObj->getErrors()));
redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . PublisherUtility::formatErrors($fileObj->getErrors()));
// exit;
}

Expand Down Expand Up @@ -139,7 +139,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
// no confirm: show deletion condition
$fileid = XoopsRequest::getInt('fileid', 0, 'GET');

publisherCpHeader();
PublisherUtility::cpHeader();
xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php',
_AM_PUBLISHER_DELETETHISFILE . ' <br>' . $fileObj->name() . ' <br> <br>', _AM_PUBLISHER_DELETE);
xoops_cp_footer();
Expand All @@ -150,8 +150,8 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

case 'default':
default:
publisherCpHeader();
PublisherUtility::cpHeader();
//publisher_adminMenu(2, _AM_PUBLISHER_ITEMS);
break;
}
include_once __DIR__ . '/admin_footer.php';
require_once __DIR__ . '/admin_footer.php';
Loading

0 comments on commit 6e5b1bf

Please sign in to comment.