diff --git a/README.md b/README.md index 3380b9ae..22799486 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -publisher -========= +#Publisher [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE) Publishing module for XOOPS for static/HTML content and articles stored and provided in a hierarchical manner diff --git a/publisher/admin/about.php b/publisher/admin/about.php index c5dc06dd..e7ac56b6 100644 --- a/publisher/admin/about.php +++ b/publisher/admin/about.php @@ -27,7 +27,7 @@ $aboutAdmin = new ModuleAdmin(); echo $aboutAdmin->addNavigation('about.php'); -echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); +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"; @@ -35,5 +35,4 @@ // echo 'I am using PHP lower than 5.4, my version: ' . PHP_VERSION . "\n"; // } - xoops_cp_footer(); diff --git a/publisher/admin/admin_header.php b/publisher/admin/admin_header.php index 574150b3..08e48c27 100644 --- a/publisher/admin/admin_header.php +++ b/publisher/admin/admin_header.php @@ -30,8 +30,7 @@ 'editimg' => "" . _AM_PUBLISHER_ICO_EDIT . "", 'deleteimg' => "" . _AM_PUBLISHER_ICO_DELETE . "", 'online' => "" . _AM_PUBLISHER_ICO_ONLINE . "", - 'offline' => "" . _AM_PUBLISHER_ICO_OFFLINE . "", -); + 'offline' => "" . _AM_PUBLISHER_ICO_OFFLINE . ""); include_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); /* diff --git a/publisher/admin/category.php b/publisher/admin/category.php index 1163fa89..7da0dfe2 100644 --- a/publisher/admin/category.php +++ b/publisher/admin/category.php @@ -21,7 +21,7 @@ include_once __DIR__ . '/admin_header.php'; -$op = XoopsRequest::getString('op', '', 'GET'); +$op = XoopsRequest::getString('op', (XoopsRequest::getString('op', '', 'POST')), 'GET'); $op = (XoopsRequest::getString('editor', '', 'POST')) ? 'mod' : $op; $op = (XoopsRequest::getString('addcategory', '', 'POST')) ? 'addcategory' : $op; @@ -31,18 +31,17 @@ $categoryid = XoopsRequest::getInt('categoryid'); switch ($op) { - - case "del": - $categoryObj = $publisher->getHandler('category')->get($categoryid); + case 'del': + $categoryObj =& $publisher->getHandler('category')->get($categoryid); $confirm = XoopsRequest::getInt('confirm', '', 'POST'); $name = XoopsRequest::getString('name', '', 'POST'); if ($confirm) { if (!$publisher->getHandler('category')->delete($categoryObj)) { - redirect_header("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); -// exit(); + redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR); + // exit(); } - redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); -// exit(); + redirect_header('category.php', 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); + // exit(); } else { xoops_cp_header(); xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'.

" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); @@ -50,41 +49,43 @@ } break; - case "mod": + case 'mod': //Added by fx2024 $nb_subcats = XoopsRequest::getInt('nb_subcats', 0, 'POST'); - $nb_subcats = $nb_subcats + (XoopsRequest::getInt('nb_sub_yet', 4, 'POST')); + $nb_subcats += (XoopsRequest::getInt('nb_sub_yet', 4, 'POST')); //end of fx2024 code publisherCpHeader(); PublisherUtilities::editCategory(true, $categoryid, $nb_subcats); break; - case "addcategory": + case 'addcategory': global $modify; $parentid = XoopsRequest::getInt('parentid'); if ($categoryid != 0) { - $categoryObj = $publisher->getHandler('category')->get($categoryid); + $categoryObj =& $publisher->getHandler('category')->get($categoryid); } else { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); } // Uploading the image, if any // Retreive the filename to be uploaded - if ($image_file = XoopsRequest::getArray('image_file', '', 'FILES')['name']) { -// $filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0]; - if ($filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0]) { + $temp = XoopsRequest::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'); + if ($filename = $temp2[0]) { // TODO : implement publisher mimetype management $max_size = $publisher->getConfig('maximum_filesize'); $max_imgwidth = $publisher->getConfig('maximum_image_width'); $max_imgheight = $publisher->getConfig('maximum_image_height'); $allowed_mimetypes = publisherGetAllowedImagesTypes(); - - if (!($tmp_name = (XoopsRequest::getArray('filename', array(), 'FILES')['tmp_name'])) || !is_readable($tmp_name)) { + $temp3 = XoopsRequest::getArray('filename', array(), 'FILES'); + if (!is_readable($tmp_name) || !($tmp_name = $temp3['tmp_name'])) { redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); -// exit(); + // exit(); } xoops_load('XoopsMediaUploader'); @@ -93,11 +94,11 @@ $categoryObj->setVar('image', $uploader->getSavedFileName()); } else { redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); -// exit(); + // exit(); } } } else { - $categoryObj->setVar('image', XoopsRequest::getString('image', '', 'POST')); + $categoryObj->setVar('image', XoopsRequest::getString('image', '', 'POST')); } $categoryObj->setVar('parentid', (XoopsRequest::getInt('parentid', 0, 'POST'))); @@ -129,8 +130,8 @@ } if (!$categoryObj->store()) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors())); -// exit; + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors())); + // exit; } // TODO : put this function in the category class publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); @@ -141,14 +142,16 @@ $parentCat = $categoryObj->categoryid(); $sizeof = count(XoopsRequest::getString('scname', '', 'POST')); for ($i = 0; $i < $sizeof; ++$i) { - if (XoopsRequest::getArray('scname', array(), 'POST')[$i] != '') { - $categoryObj = $publisher->getHandler('category')->create(); - $categoryObj->setVar('name', XoopsRequest::getArray('scname', array(), 'POST')[$i]); + $temp = XoopsRequest::getArray('scname', array(), 'POST'); + if ($temp[$i] != '') { + $categoryObj =& $publisher->getHandler('category')->create(); + $temp2 = XoopsRequest::getArray('scname', array(), 'POST'); + $categoryObj->setVar('name', $temp2[$i]); $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 . publisherFormatErrors($categoryObj->getErrors())); + // exit; } // TODO : put this function in the category class publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); @@ -158,16 +161,16 @@ } //end of fx2024 code redirect_header($redirect_to, 2, $redirect_msg); -// exit(); + // exit(); break; //Added by fx2024 - case "addsubcats": + case 'addsubcats': $categoryid = 0; $nb_subcats = XoopsRequest::getInt('nb_subcats', 0, 'POST') + XoopsRequest::getInt('nb_sub_yet', 0, 'POST'); - $categoryObj = $publisher->getHandler('category')->create(); + $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')); @@ -181,11 +184,11 @@ break; //end of fx2024 code - case "cancel": - redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); -// exit(); + case 'cancel': + redirect_header('category.php', 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); + // exit(); break; - case "default": + case 'default': default: publisherCpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); @@ -194,39 +197,39 @@ echo "
"; echo "  "; //echo "  "; - echo "
"; + echo ''; // Creating the objects for top categories - $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); + $categoriesObj =& $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); publisherOpenCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo ""; - echo ""; - echo ""; - $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0); + echo ''; + echo "'; + $totalCategories =& $publisher->getHandler('category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { PublisherUtilities::displayCategory($thiscat); } unset($key, $thiscat); } else { - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; $categoryid = '0'; } echo "
" . _AM_PUBLISHER_ITEMCATEGORY_ID . ""; - echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ""; - echo "" . _CO_PUBLISHER_WEIGHT . ""; - echo "" . _AM_PUBLISHER_ACTION . ""; - echo "
" . _AM_PUBLISHER_ITEMCATEGORY_ID . ''; + echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ''; + echo "" . _CO_PUBLISHER_WEIGHT . ''; + echo "" . _AM_PUBLISHER_ACTION . ''; + echo '
" . _AM_PUBLISHER_NOCAT . "
" . _AM_PUBLISHER_NOCAT . '
\n"; include_once $GLOBALS['xoops']->path('class/pagenav.php'); $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '
' . $pagenav->renderNav() . '
'; - echo "
"; + echo '
'; publisherCloseCollapsableBar('createdcategories', 'createdcategoriesicon'); - echo "
"; + echo '
'; //editcat(false); break; } diff --git a/publisher/admin/clone.php b/publisher/admin/clone.php index acdedba1..f939a58a 100644 --- a/publisher/admin/clone.php +++ b/publisher/admin/clone.php @@ -18,25 +18,25 @@ * @version $Id: clone.php 10374 2012-12-12 23:39:48Z trabis $ */ -include_once __DIR__ . "/admin_header.php"; +include_once __DIR__ . '/admin_header.php'; publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); publisherOpenCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); -if ('submit' == XoopsRequest::getString('op', '', 'POST')) { +if ('submit' === XoopsRequest::getString('op', '', 'POST')) { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header('clone.php', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); -// exit(); + // exit(); } -// $clone = $_POST['clone']; + // $clone = $_POST['clone']; $clone = XoopsRequest::getString('clone', '', 'POST'); //check if name is valid if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); -// exit(); + // exit(); } // Check wether the cloned module exists or not @@ -47,17 +47,16 @@ $patterns = array( strtolower(PUBLISHER_DIRNAME) => strtolower($clone), strtoupper(PUBLISHER_DIRNAME) => strtoupper($clone), - ucfirst(strtolower(PUBLISHER_DIRNAME)) => ucfirst(strtolower($clone)) - ); + ucfirst(strtolower(PUBLISHER_DIRNAME)) => ucfirst(strtolower($clone))); $patKeys = array_keys($patterns); $patValues = array_values($patterns); PublisherClone::cloneFileFolder(PUBLISHER_ROOT_PATH); $logocreated = PublisherClone::createLogo(strtolower($clone)); - $msg = ""; + $msg = ''; if (is_dir($GLOBALS['xoops']->path('modules/' . strtolower($clone)))) { - $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "" . ucfirst(strtolower($clone)) . "") . "
\n"; + $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "" . ucfirst(strtolower($clone)) . '') . "
\n"; if (!$logocreated) { $msg .= _AM_PUBLISHER_CLONE_IMAGEFAIL; } @@ -100,14 +99,14 @@ function file_put_contents($filename, $data, $file_append = false) class PublisherClone { -// recursive clonning script + // recursive clonning script /** * @param $path */ public static function cloneFileFolder($path) { - global $patKeys; - global $patValues; + global $patKeys; + global $patValues; $newPath = str_replace($patKeys[0], $patValues[0], $path); @@ -118,7 +117,7 @@ public static function cloneFileFolder($path) // check all files in dir, and process it if ($handle == opendir($path)) { while (($file = readdir($handle)) !== false) { - if ($file != '.' && $file != '..' && $file != '.svn') { + if ($file !== '.' && $file !== '..' && $file !== '.svn') { self::cloneFileFolder("{$path}/{$file}"); } } @@ -144,38 +143,38 @@ public static function cloneFileFolder($path) */ public static function createLogo($dirname) { - if (!extension_loaded("gd")) { + if (!extension_loaded('gd')) { return false; } else { - $required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox"); - foreach ($required_functions as $func) { + $requiredFunctions = array('imagecreatetruecolor', 'imagecolorallocate', 'imagefilledrectangle', 'imagejpeg', 'imagedestroy', 'imageftbbox'); + foreach ($requiredFunctions as $func) { if (!function_exists($func)) { return false; } } - unset($func); +// unset($func); } - if (!file_exists($imageBase = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png")) || !file_exists($font = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/VeraBd.ttf"))) { + if (!file_exists($imageBase = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/module_logo.png')) || !file_exists($font = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/VeraBd.ttf'))) { return false; } $imageModule = imagecreatefrompng($imageBase); //Erase old text - $grey_color = imagecolorallocate($imageModule, 237, 237, 237); - imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color); + $greyColor = imagecolorallocate($imageModule, 237, 237, 237); + imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor); // Write text - $text_color = imagecolorallocate($imageModule, 0, 0, 0); - $space_to_border = (80 - strlen($dirname) * 6.5) / 2; - imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array()); + $textColor = imagecolorallocate($imageModule, 0, 0, 0); + $spaceToBorder = (80 - strlen($dirname) * 6.5) / 2; + imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, ucfirst($dirname), array()); // Set transparency color $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); imagefill($imageModule, 0, 0, $white); imagecolortransparent($imageModule, $white); - imagepng($imageModule, $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png")); + imagepng($imageModule, $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/module_logo.png')); imagedestroy($imageModule); return true; diff --git a/publisher/admin/file.php b/publisher/admin/file.php index 18d81a98..1bea04ff 100644 --- a/publisher/admin/file.php +++ b/publisher/admin/file.php @@ -25,22 +25,22 @@ /** * @param bool $showmenu - * @param int $fileid - * @param int $itemid + * @param int $fileid + * @param int $itemid */ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); // if there is a parameter, and the id exists, retrieve data: we're editing a file if ($fileid != 0) { // Creating the File object - $fileObj = $publisher->getHandler('file')->get($fileid); + $fileObj =& $publisher->getHandler('file')->get($fileid); if ($fileObj->notLoaded()) { - redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); -// exit(); + redirect_header('javascript:history.go(-1)', 1, _AM_PUBLISHER_NOFILESELECTED); + // exit(); } if ($showmenu) { @@ -48,24 +48,24 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) } echo "
\n"; - echo "" . _AM_PUBLISHER_FILE_EDITING . ""; - echo "" . _AM_PUBLISHER_FILE_EDITING_DSC . ""; + echo "" . _AM_PUBLISHER_FILE_EDITING . ''; + echo "" . _AM_PUBLISHER_FILE_EDITING_DSC . ''; publisherOpenCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item - $fileObj = $publisher->getHandler('file')->create(); + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVar('itemid', $itemid); if ($showmenu) { //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_FILE_ADD); } - echo "" . _AM_PUBLISHER_FILE_ADDING . ""; - echo "" . _AM_PUBLISHER_FILE_ADDING_DSC . ""; + echo "" . _AM_PUBLISHER_FILE_ADDING . ''; + echo "" . _AM_PUBLISHER_FILE_ADDING_DSC . ''; publisherOpenCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM - $files_form = $fileObj->getForm(); - $files_form->display(); + $uploadForm = $fileObj->getForm(); + $uploadForm->display(); if ($fileid != 0) { publisherCloseCollapsableBar('editfile', 'editfileicon'); @@ -78,22 +78,22 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) $false = false; /* -- Available operations -- */ switch ($op) { - case "uploadfile"; + case 'uploadfile': publisherUploadFile(false, true, $false); exit; break; - case "uploadanother"; + case 'uploadanother': publisherUploadFile(true, true, $false); exit; break; - case "mod": + case 'mod': $fileid = XoopsRequest::getInt('fileid', 0, 'GET'); $itemid = XoopsRequest::getInt('itemid', 0, 'GET'); if (($fileid == 0) && ($itemid == 0)) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); -// exit(); + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_NOITEMSELECTED); + // exit(); } publisherCpHeader(); @@ -102,14 +102,14 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) publisher_editFile(true, $fileid, $itemid); break; - case "modify": + case 'modify': $fileid = XoopsRequest::getInt('fileid', 0, 'POST'); // Creating the file object if ($fileid != 0) { - $fileObj = $publisher->getHandler('file')->get($fileid); + $fileObj =& $publisher->getHandler('file')->get($fileid); } else { - $fileObj = $publisher->getHandler('file')->create(); + $fileObj =& $publisher->getHandler('file')->create(); } // Putting the values in the file object @@ -120,19 +120,18 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // Storing the file if (!$fileObj->store()) { redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisherFormatErrors($fileObj->getErrors())); -// exit; + // exit; } redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS); -// exit(); + // exit(); break; - case "del": - + case 'del': $fileid = XoopsRequest::getInt('fileid', 0, 'POST'); $fileid = XoopsRequest::getInt('fileid', $fileid, 'GET'); - $fileObj = $publisher->getHandler('file')->get($fileid); + $fileObj =& $publisher->getHandler('file')->get($fileid); $confirm = XoopsRequest::getInt('confirm', 0, 'POST'); $title = XoopsRequest::getString('title', '', 'POST'); @@ -140,24 +139,24 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) if ($confirm) { if (!$publisher->getHandler('file')->delete($fileObj)) { redirect_header('item.php', 2, _AM_PUBLISHER_FILE_DELETE_ERROR); -// exit; + // exit; } redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name())); -// exit(); + // exit(); } else { // no confirm: show deletion condition - $fileid = XoopsRequest::getInt('fileid', 0, 'GET'); + $fileid = XoopsRequest::getInt('fileid', 0, 'GET'); publisherCpHeader(); - xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php', _AM_PUBLISHER_DELETETHISFILE . "
" . $fileObj->name() . "

", _AM_PUBLISHER_DELETE); + xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php', _AM_PUBLISHER_DELETETHISFILE . '
' . $fileObj->name() . '

', _AM_PUBLISHER_DELETE); xoops_cp_footer(); } exit(); break; - case "default": + case 'default': default: publisherCpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); diff --git a/publisher/admin/import.php b/publisher/admin/import.php index 40d9ef7b..f94a31b6 100644 --- a/publisher/admin/import.php +++ b/publisher/admin/import.php @@ -19,22 +19,19 @@ * @version $Id: import.php 12825 2014-10-31 02:42:34Z zyspec $ */ -include_once __DIR__ . "/admin_header.php"; +include_once __DIR__ . '/admin_header.php'; $op = XoopsRequest::getString('op', XoopsRequest::getString('op', 'none', 'GET'), 'POST'); switch ($op) { - - case "importExecute": - + case 'importExecute': $importfile = XoopsRequest::getString('importfile', 'nonselected', 'POST'); - $importfile_path = $GLOBALS['xoops']->path("modules/" . $publisher->getModule()->dirname() . "/admin/import/" . $importfile . ".php"); + $importfile_path = $GLOBALS['xoops']->path('modules/' . $publisher->getModule()->dirname() . '/admin/import/' . $importfile . '.php'); include_once $importfile_path; break; - case "default": + case 'default': default: - $importfile = 'none'; publisherCpHeader(); @@ -44,7 +41,7 @@ xoops_load('XoopsFormLoader'); - $moduleHandler = xoops_gethandler('module'); + $moduleHandler =& xoops_getHandler('module'); // WF-Section /*$wfs_version = 0; @@ -63,7 +60,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["news"] = "News " . $from_module_version; + $importfile_select_array['news'] = 'News ' . $from_module_version; $news_version = $from_module_version; } } @@ -74,7 +71,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["xnews"] = "xNews " . $from_module_version; + $importfile_select_array['xnews'] = 'xNews ' . $from_module_version; $xnews_version = $from_module_version; } } @@ -85,7 +82,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["ams"] = "AMS " . $from_module_version; + $importfile_select_array['ams'] = 'AMS ' . $from_module_version; $ams_version = $from_module_version; } } @@ -96,7 +93,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["smartsection"] = "Smartsection " . $from_module_version; + $importfile_select_array['smartsection'] = 'Smartsection ' . $from_module_version; $smartsection_version = $from_module_version; } } @@ -107,7 +104,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["cjaycontent"] = "C-Jay Content " . $from_module_version; + $importfile_select_array['cjaycontent'] = 'C-Jay Content ' . $from_module_version; $cjaycontent_version = $from_module_version; } } @@ -118,7 +115,7 @@ if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { - $importfile_select_array["fmcontent"] = "FmContent " . $from_module_version; + $importfile_select_array['fmcontent'] = 'FmContent ' . $from_module_version; $fmcontent_version = $from_module_version; } } @@ -135,7 +132,7 @@ } */ if (isset($importfile_select_array) && count($importfile_select_array) > 0) { - $sform = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF')); + $sform = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, 'op', xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // Partners to import @@ -170,7 +167,7 @@ $sform->display(); unset($hidden); } else { - echo "" . _AM_PUBLISHER_IMPORT_NO_MODULE . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_MODULE . ''; } // End of collapsable bar diff --git a/publisher/admin/import/ams.php b/publisher/admin/import/ams.php index d3376160..996e4da4 100644 --- a/publisher/admin/import/ams.php +++ b/publisher/admin/import/ams.php @@ -23,52 +23,52 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "xNews " . XoopsRequest::getString('ams_version', '', 'POST'); +$importFromModuleName = 'AMS ' . XoopsRequest::getString('ams_version', '', 'POST'); -$scriptname = "ams.php"; +$scriptname = 'ams.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("ams_topics")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("nw_stories")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_stories')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; - $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); + $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . '/import/$scriptname'); -//---------- mb ------------------ -// add "publisher" category to "imagecategory" table + //---------- mb ------------------ + // add 'publisher' category to 'imagecategory' table -// if (!$GLOBALS['xoopsSecurity']->check()) { -// redirect_header('admin.php?fct=images', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); -// } + // if (!$GLOBALS['xoopsSecurity']->check()) { + // redirect_header('admin.php?fct=images', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); + // } - $imageCategoryHandler =& xoops_gethandler('imagecategory'); + $imageCategoryHandler =& xoops_getHandler('imagecategory'); $imagecategory =& $imageCategoryHandler->create(); -// $imagecategory->setVar('imgcat_name', $imgcat_name); + // $imagecategory->setVar('imgcat_name', $imgcat_name); $imagecategory->setVar('imgcat_name', PUBLISHER_DIRNAME); //$imgcat_name); $imagecategory->setVar('imgcat_maxsize', $GLOBALS['xoopsModuleConfig']['maximum_filesize']); //$imgcat_maxsize); $imagecategory->setVar('imgcat_maxwidth', $GLOBALS['xoopsModuleConfig']['maximum_image_width']);//$imgcat_maxwidth); $imagecategory->setVar('imgcat_maxheight', $GLOBALS['xoopsModuleConfig']['maximum_image_height']);//$imgcat_maxheight); -// $imgcat_display = empty($imgcat_display) ? 0 : 1; + // $imgcat_display = empty($imgcat_display) ? 0 : 1; $imagecategory->setVar('imgcat_display', 1);//$imgcat_display); $imagecategory->setVar('imgcat_weight', 0);//$imgcat_weight); $imagecategory->setVar('imgcat_storetype', 'file');//$imgcat_storetype); @@ -77,48 +77,48 @@ $imageCategoryHandler->insert($imagecategory); // exit(); } catch (Exception $e) { - echo "Caught exception: : couldn't insert Image Category " . $e->getMessage() . "n"; + echo 'Caught exception: couldn not insert Image Category' . $e->getMessage() . 'n'; } $newid = $imagecategory->getVar('imgcat_id'); - $imagecategoryperm_handler =& xoops_gethandler('groupperm'); + $imagecategorypermHandler =& xoops_getHandler('groupperm'); if (!isset($readgroup)) { $readgroup = array(); } if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { - array_push($readgroup, XOOPS_GROUP_ADMIN); + $readgroup[] = XOOPS_GROUP_ADMIN; } foreach ($readgroup as $rgroup) { - $imagecategoryperm =& $imagecategoryperm_handler->create(); + $imagecategoryperm =& $imagecategorypermHandler->create(); $imagecategoryperm->setVar('gperm_groupid', $rgroup); $imagecategoryperm->setVar('gperm_itemid', $newid); $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); $imagecategoryperm->setVar('gperm_modid', 1); - $imagecategoryperm_handler->insert($imagecategoryperm); + $imagecategorypermHandler->insert($imagecategoryperm); unset($imagecategoryperm); } - unset($rgroup); + // unset($rgroup); if (!isset($writegroup)) { $writegroup = array(); } if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { - array_push($writegroup, XOOPS_GROUP_ADMIN); + $writegroup[] = XOOPS_GROUP_ADMIN; } foreach ($writegroup as $wgroup) { - $imagecategoryperm =& $imagecategoryperm_handler->create(); + $imagecategoryperm =& $imagecategorypermHandler->create(); $imagecategoryperm->setVar('gperm_groupid', $wgroup); $imagecategoryperm->setVar('gperm_itemid', $newid); $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); $imagecategoryperm->setVar('gperm_modid', 1); - $imagecategoryperm_handler->insert($imagecategoryperm); + $imagecategorypermHandler->insert($imagecategoryperm); unset($imagecategoryperm); } - unset($wgroup); + // unset($wgroup); -//---------- mb ------------------ + //---------- mb ------------------ // Categories to be imported - $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $GLOBALS['xoopsDB']->prefix("ams_topics") . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("nw_stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid"; + $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); @@ -128,14 +128,14 @@ $cat_cbox_options[$cid] = "$cat_title ($art_count)"; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -155,57 +155,57 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - include_once (dirname(dirname(__DIR__))) . '/include/common.php'; + include_once(dirname(dirname(__DIR__))) . '/include/common.php'; publisherOpenCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleHandler = xoops_gethandler('module'); - $moduleObj = $moduleHandler->getByDirname('ams'); - $ams_module_id = $moduleObj->getVar('mid'); + $moduleHandler =& xoops_getHandler('module'); + $moduleObj = $moduleHandler->getByDirname('ams'); + $ams_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_cat = 0; $cnt_imported_articles = 0; $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('ams_topics'); + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics'); $resultCat = $GLOBALS['xoopsDB']->query($sql); $newCatArray = array(); $newArticleArray = array(); - $imageCategoryHandler =& xoops_gethandler('imagecategory'); -// $criteria = new criteriaCombo; + $imageCategoryHandler =& xoops_getHandler('imagecategory'); + // $criteria = new criteriaCombo; -// get the total number of subcats for this category -// $criteria = new CriteriaCompo(); -// $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '=')); -// $childCount = (int)($mylinksCatHandler->getCount($criteria)); + // get the total number of subcats for this category + // $criteria = new CriteriaCompo(); + // $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '=')); + // $childCount = (int)($mylinksCatHandler->getCount($criteria)); $criteria = new Criteria('imgcat_name', PUBLISHER_DIRNAME); $imageCategoryId = $imageCategoryHandler->getObjects($criteria); -// $criteria = new CriteriaCompo(); -// $criteria->add(new Criteria("imagecategory", PUBLISHER_DIRNAME, "=")); + // $criteria = new CriteriaCompo(); + // $criteria->add(new Criteria('imagecategory', PUBLISHER_DIRNAME, '=')); -// $newid = $imageCategoryId->getVar('imgcat_id'); + // $newid = $imageCategoryId->getVar('imgcat_id'); $newid = $imageCategoryId[0]->vars['imgcat_id']['value']; -// $newid = $imageCategoryId[0]->vars['imgcat_id']; + // $newid = $imageCategoryId[0]->vars['imgcat_id']; -// $select_form = new XoopsFormSelect("", $name_current, array(), 1); -// $select_form->addOption("", _SELECT); -// $select_form->addOptionArray($writer_handler->getList($criteria)); + // $select_form = new XoopsFormSelect('', $name_current, array(), 1); + // $select_form->addOption('', _SELECT); + // $select_form->addOptionArray($writerHandler->getList($criteria)); -// $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('imagecategory') . " WHERE imgcat_name=" . PUBLISHER_DIRNAME; -// $resultImageCategory = $GLOBALS['xoopsDB']->query($sql); -// -// -// $newid = $resultImageCategory->getVar('imgcat_id'); + // $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . ' WHERE imgcat_name=' . PUBLISHER_DIRNAME; + // $resultImageCategory = $GLOBALS['xoopsDB']->query($sql); + // + // + // $newid = $resultImageCategory->getVar('imgcat_id'); $oldToNew = array(); while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) { @@ -213,25 +213,25 @@ $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); $categoryObj->setVar('image', $arrCat['topic_imgurl']); $categoryObj->setVar('weight', $arrCat['weight']); $categoryObj->setVar('name', $arrCat['topic_title']); -// $categoryObj->setVar('description', $arrCat['topic_description']); + // $categoryObj->setVar('description', $arrCat['topic_description']); $categoryObj->setVar('moderator', 1); // Category image: copying to Publisher category uploads - if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { - if (copy($GLOBALS['xoops']->path("uploads/AMS/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']))) { + if (($arrCat['topic_imgurl'] !== 'blank.gif') && ($arrCat['topic_imgurl'] !== '')) { + if (copy($GLOBALS['xoops']->path('uploads/AMS/topics/' . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path('uploads/' . PUBLISHER_DIRNAME . '/images/category/' . $arrCat['topic_imgurl']))) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); -//======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder + //======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder /* - $imageHandler =& xoops_gethandler('image'); + $imageHandler =& xoops_getHandler('image'); $image =& $imageHandler->create(); $image->setVar('image_name', $arrCat['topic_imgurl']);//'images/' . $uploader->getSavedFileName()); $image->setVar('image_nicename', substr($arrCat['topic_imgurl'],-13)); //$image_nicename); @@ -247,26 +247,26 @@ */ -//============================ + //============================ } } if (!$publisher->getHandler('category')->insert($categoryObj)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '
'; continue; } //copy all images to Image Manager - $src = $GLOBALS['xoops']->path("uploads/AMS/topics/"); - $dst = $GLOBALS['xoops']->path("uploads"); + $src = $GLOBALS['xoops']->path('uploads/AMS/topics/'); + $dst = $GLOBALS['xoops']->path('uploads'); PublisherUtilities::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) - $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("image") . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`) + $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('image') . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`) SELECT s.picture, RIGHT(s.picture,13) AS nicename, @@ -274,7 +274,7 @@ 1 AS image_display, 0 AS image_weight, c.imgcat_id - FROM " . $GLOBALS['xoopsDB']->prefix("ams_article") . " s, " . $GLOBALS['xoopsDB']->prefix("imagecategory") . " c + FROM " . $GLOBALS['xoopsDB']->prefix('ams_article') . ' s, ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . " c WHERE s.picture <> '' AND c.imgcat_name = '" . PUBLISHER_DIRNAME . "'"; @@ -283,13 +283,13 @@ $newCat['newid'] = $categoryObj->categoryid(); ++$cnt_imported_cat; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . '
'; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('ams_article') . " WHERE topicid=" . $arrCat['topic_id']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_article') . ' WHERE topicid=' . $arrCat['topic_id']; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); @@ -303,20 +303,20 @@ $itemObj->setVar('weight', 0); $itemObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED); -// $itemObj->setVar('dobr', !$arrArticle['dobr']); -// $itemObj->setVar('item_tag', $arrArticle['tags']); + // $itemObj->setVar('dobr', !$arrArticle['dobr']); + // $itemObj->setVar('item_tag', $arrArticle['tags']); $itemObj->setVar('notifypub', $arrArticle['notifypub']); -//-------- image + //-------- image - $img_handler =& xoops_gethandler('image'); + $imgHandler =& xoops_getHandler('image'); -// $criteria = new Criteria('image_name', $arrArticle['picture']); - $imageId = $img_handler->getObjects($criteria); + // $criteria = new Criteria('image_name', $arrArticle['picture']); + $imageId = $imgHandler->getObjects($criteria); $newImageId = $imageId[0]->vars['image_id']['value']; $itemObj->setVar('image', $newImageId); $itemObj->setVar('images', $newImageId); -//-------------- + //-------------- $itemObj->setVar('rating', $arrArticle['rating']); $itemObj->setVar('votes', $arrArticle['votes']); @@ -327,30 +327,30 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path('modules/wfsection/html/' .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { - $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); - echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; + if (copy($pagewrap_filename, $GLOBALS['xoops']->path('uploads/publisher/content/' . $arrArticle['htmlpage']))) { + $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']'); + echo sprintf('    ' . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . '
'; } } } */ if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['storyid'] . ' ' . $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['storyid'] . ' ' . $arrArticle['title']) . '
'; continue; } else { -//-------------------------------------------- + //-------------------------------------------- // Linkes files - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("ams_article_files") . " WHERE storyid=" . $arrArticle['storyid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_article_files') . ' WHERE storyid=' . $arrArticle['storyid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("uploads/AMS/attached/" . $arrFile['downloadname']); + $filename = $GLOBALS['xoops']->path('uploads/AMS/attached/' . $arrFile['downloadname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { - $fileObj = $publisher->getHandler('file')->create(); + if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) { + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['filerealname']); $fileObj->setVar('description', $arrFile['filerealname']); $fileObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE); @@ -363,32 +363,32 @@ $fileObj->setVar('short_url', $arrFile['filerealname']); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } } } -//------------------------ + //------------------------ $newArticleArray[$arrArticle['storyid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('nw_view', $arrCat['topic_id'], $ams_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $ams_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('nw_submit', $arrCat['topic_id'], $ams_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $ams_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); - $groupsIds = $gperm_handler->getGroupIds('nw_approve', $arrCat['topic_id'], $ams_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $ams_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through category to change the parentID to the new parentID @@ -407,12 +407,12 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $ams_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -420,18 +420,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); + // unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('amsimportgo', 'amsimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/cjaycontent.php b/publisher/admin/import/cjaycontent.php index e70af6f8..e4f3425d 100644 --- a/publisher/admin/import/cjaycontent.php +++ b/publisher/admin/import/cjaycontent.php @@ -23,11 +23,11 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "cjaycontent " . XoopsRequest::getString('cjaycontent_version', '', 'POST'); +$importFromModuleName = 'cjaycontent ' . XoopsRequest::getString('cjaycontent_version', '', 'POST'); -$scriptname = "cjaycontent.php"; +$scriptname = 'cjaycontent.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; /** * @param $src @@ -49,35 +49,20 @@ // closedir($dir); //} -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisherOpenCollapsableBar( - 'cjaycontentimport', - 'cjaycontentimporticon', - sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), - _AM_PUBLISHER_IMPORT_INFO - ); - - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("cjaycontent")); + publisherOpenCollapsableBar('cjaycontentimport', 'cjaycontentimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('cjaycontent')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf( - _AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, - $importFromModuleName, - $totalArticles - ) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf( - _AM_PUBLISHER_IMPORT_MODULE_FOUND, - $importFromModuleName, - $totalArticles, - $totalCat - ) - . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); @@ -90,28 +75,23 @@ $form->display(); } -// } + // } publisherCloseCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - include_once (dirname(dirname(__DIR__))) . '/include/common.php'; - publisherOpenCollapsableBar( - 'cjaycontentimportgo', - 'cjaycontentimportgoicon', - sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), - _AM_PUBLISHER_IMPORT_RESULT - ); - - $moduleHandler = xoops_gethandler('module'); + include_once(dirname(dirname(__DIR__))) . '/include/common.php'; + publisherOpenCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('cjaycontent'); $cjaycontent_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_articles = 0; @@ -119,39 +99,39 @@ $oldToNew = array(); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('cjaycontent'); + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('cjaycontent'); $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('itemid', $arrArticle['id']); -// $itemObj->setVar('categoryid', $categoryObj->categoryid()); + // $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); $itemObj->setVar('uid', $arrArticle['submitter']); $itemObj->setVar('summary', $arrArticle['comment']); $itemObj->setVar('body', $arrArticle['content']); $itemObj->setVar('counter', $arrArticle['hits']); $itemObj->setVar('datesub', $arrArticle['date']); -// $itemObj->setVar('dohtml', !$arrArticle['nohtml']); -// $itemObj->setVar('dosmiley', !$arrArticle['nosmiley']); + // $itemObj->setVar('dohtml', !$arrArticle['nohtml']); + // $itemObj->setVar('dosmiley', !$arrArticle['nosmiley']); $itemObj->setVar('weight', $arrArticle['weight']); $itemObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED); -// $itemObj->setVar('dobr', !$arrArticle['dobr']); -// $itemObj->setVar('item_tag', $arrArticle['tags']); -// $itemObj->setVar('notifypub', $arrArticle['notifypub']); + // $itemObj->setVar('dobr', !$arrArticle['dobr']); + // $itemObj->setVar('item_tag', $arrArticle['tags']); + // $itemObj->setVar('notifypub', $arrArticle['notifypub']); $itemObj->setVar('image', $arrArticle['image']); -// $itemObj->setVar('rating', $arrArticle['rating']); -// $itemObj->setVar('votes', $arrArticle['votes']); -// $itemObj->setVar('comments', $arrArticle['comments']); -// $itemObj->setVar('meta_keywords', $arrArticle['keywords']); -// $itemObj->setVar('meta_description', $arrArticle['description']); + // $itemObj->setVar('rating', $arrArticle['rating']); + // $itemObj->setVar('votes', $arrArticle['votes']); + // $itemObj->setVar('comments', $arrArticle['comments']); + // $itemObj->setVar('meta_keywords', $arrArticle['keywords']); + // $itemObj->setVar('meta_description', $arrArticle['description']); /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); @@ -162,24 +142,24 @@ */ if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . '
'; continue; } else { $newArticleArray[$arrArticle['id']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } - echo "
"; + echo '
'; -// Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + // Looping through the comments to link them to the new articles and module + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $cjaycontent_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -187,18 +167,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); +// unset($comment); - echo "

Done.
"; + echo '

Done.
'; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/fmcontent.php b/publisher/admin/import/fmcontent.php index edd8476a..d392206c 100644 --- a/publisher/admin/import/fmcontent.php +++ b/publisher/admin/import/fmcontent.php @@ -24,42 +24,42 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "FmContent " . XoopsRequest::getString('fmcontent_version', '', 'POST'); +$importFromModuleName = 'FmContent ' . XoopsRequest::getString('fmcontent_version', '', 'POST'); -$scriptname = "fmcontent.php"; +$scriptname = 'fmcontent.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ('start' == $op) { +if ('start' === $op) { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $moduleHandler = xoops_gethandler('module'); - $moduleObj = $moduleHandler->getByDirname('fmcontent'); - $fm_module_id = $moduleObj->getVar('mid'); + $moduleHandler =& xoops_getHandler('module'); + $moduleObj = $moduleHandler->getByDirname('fmcontent'); + $fm_module_id = $moduleObj->getVar('mid'); - $fmTopicHdlr =& xoops_getmodulehandler('topic', 'fmcontent'); + $fmTopicHdlr =& xoops_getModuleHandler('topic', 'fmcontent'); $fmTopicCount = $fmTopicHdlr->getCount(new Criteria('topic_modid', $fm_module_id)); if (empty($fmTopicCount)) { - echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { include_once $GLOBALS['xoops']->path('www/class/xoopstree.php'); - $fmContentHdlr =& xoops_getmodulehandler('page', 'fmcontent'); + $fmContentHdlr =& xoops_getModuleHandler('page', 'fmcontent'); $fmContentCount = $fmContentHdlr->getCount(new Criteria('content_modid', $fm_module_id)); if (empty($fmContentCount)) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . ''; } else { /* echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, $fmTopicCount) . ""; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); */ // Categories to be imported - $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.content_id) FROM " . $GLOBALS['xoopsDB']->prefix("fmcontent_topic") . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("fmcontent_content") . " AS art ON ((cat.topic_id=art.content_topic) AND (cat.topic_modid=art.content_modid)) WHERE cat.topic_modid={$fm_module_id} GROUP BY art.content_topic"; + $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.content_id) FROM ' . $GLOBALS['xoopsDB']->prefix('fmcontent_topic') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('fmcontent_content') . " AS art ON ((cat.topic_id=art.content_topic) AND (cat.topic_modid=art.content_modid)) WHERE cat.topic_modid={$fm_module_id} GROUP BY art.content_topic"; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); @@ -78,16 +78,16 @@ } natcasesort($cat_cbox_options); //put them in "alphabetical" order - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($cat_cbox_options)) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($cat_cbox_options)) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category xoops_load('tree'); - $categoryHdlr = $publisher->getHandler('category'); + $categoryHdlr =& $publisher->getHandler('category'); $catObjs = $categoryHdlr->getAll(); $myObjTree = new XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $catSelBox = $myObjTree->makeSelBox('parent_category', 'name', '-', 0, true); @@ -117,16 +117,16 @@ xoops_cp_footer(); } -if ('go' == $op) { +if ('go' === $op) { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleHandler = xoops_gethandler('module'); - $moduleObj = $moduleHandler->getByDirname('fmcontent'); - $fm_module_id = $moduleObj->getVar('mid'); + $moduleHandler =& xoops_getHandler('module'); + $moduleObj = $moduleHandler->getByDirname('fmcontent'); + $fm_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -134,7 +134,7 @@ $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); // get all FmContent Content items without a category (content_topic=0) - $fmContentHdlr =& xoops_getmodulehandler('page', 'fmcontent'); + $fmContentHdlr =& xoops_getModuleHandler('page', 'fmcontent'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('content_modid', $fm_module_id)); @@ -145,64 +145,65 @@ ++$cnt_imported_cat; //count category if there was content to import // create Publsher category to hold FmContent Content items with no Topic (content_topic=0) - $categoryObj = $publisher->getHandler('category')->create(); - $categoryObj->setVars(array('parentid' => $parentId, - 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, - 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, - 'image' => '', - 'total' => 0, - 'weight' => 1, - 'created' => time(), - 'moderator', $GLOBALS['xoopsUser']->getVar('uid')) - ); + $categoryObj =& $publisher->getHandler('category')->create(); + $categoryObj->setVars(array( + 'parentid' => $parentId, + 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, + 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, + 'image' => '', + 'total' => 0, + 'weight' => 1, + 'created' => time(), + 'moderator', + $GLOBALS['xoopsUser']->getVar('uid'))); $categoryObj->store(); - $fmTopicHdlr =& xoops_getmodulehandler('topic', 'fmcontent'); + $fmTopicHdlr =& xoops_getModuleHandler('topic', 'fmcontent'); // insert articles for this category foreach ($fmContentObjs as $thisFmContentObj) { - $itemObj = $publisher->getHandler('item')->create(); - $itemObj->setVars(array('categoryid' => $categoryObj->categoryid(), - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => ($thisFmContentObj->getVar('content_status')) ? PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED : PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE, - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc')) - ); + $itemObj =& $publisher->getHandler('item')->create(); + $itemObj->setVars(array( + 'categoryid' => $categoryObj->categoryid(), + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => ($thisFmContentObj->getVar('content_status')) ? PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED : PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE, + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'))); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { - $itemObj->setVars(array('images' => 1, - 'image' => $thisFmContentObj->getVar('content_img')) - ); + $itemObj->setVars(array( + 'images' => 1, + 'image' => $thisFmContentObj->getVar('content_img'))); } if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $thisFmContentObj->getVar('title')) . "
\n"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $thisFmContentObj->getVar('title')) . '
\n'; continue; } else { $newArticleArray[$thisFmContentObj->getVar('storyid')] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
\n"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
\n'; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); + $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); + $groupsIds = $gpermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); unset($fmContentObjs, $itemObj, $categoryObj, $thisFmContentObj); @@ -218,21 +219,21 @@ // first create FmContent Topics as Publisher Categories foreach ($fmTopicObjs as $thisFmTopicObj) { - $CatIds = array('oldid' => $thisFmTopicObj->getVar('topic_id'), - 'oldpid' => $thisFmTopicObj->getVar('topic_pid') - ); + $CatIds = array( + 'oldid' => $thisFmTopicObj->getVar('topic_id'), + 'oldpid' => $thisFmTopicObj->getVar('topic_pid')); - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); - $categoryObj->setVars(array('parentid' => $thisFmTopicObj->getVar('topic_pid'), - 'weight' => $thisFmTopicObj->getVar('topic_weight'), - 'name' => $thisFmTopicObj->getVar('topic_title'), - 'description' => $thisFmTopicObj->getVar('topic_desc')) - ); + $categoryObj->setVars(array( + 'parentid' => $thisFmTopicObj->getVar('topic_pid'), + 'weight' => $thisFmTopicObj->getVar('topic_weight'), + 'name' => $thisFmTopicObj->getVar('topic_title'), + 'description' => $thisFmTopicObj->getVar('topic_desc'))); // Category image - if (('blank.gif' != $thisFmTopicObj->getVar('topic_img')) && ('' != $thisFmTopicObj->getVar('topic_img'))) { - if (copy($GLOBALS['xoops']->path("www/uploads/fmcontent/img/" . $thisFmTopicObj->getVar('topic_img')), $GLOBALS['xoops']->path("www/uploads/publisher/images/category/" . $thisFmTopicObj->getVar('topic_img')))) { + if (('blank.gif' !== $thisFmTopicObj->getVar('topic_img')) && ('' !== $thisFmTopicObj->getVar('topic_img'))) { + if (copy($GLOBALS['xoops']->path('www/uploads/fmcontent/img/' . $thisFmTopicObj->getVar('topic_img')), $GLOBALS['xoops']->path('www/uploads/publisher/images/category/' . $thisFmTopicObj->getVar('topic_img')))) { $categoryObj->setVar('image', $thisFmTopicObj->getVar('topic_img')); } } @@ -254,27 +255,27 @@ // insert articles for this category foreach ($fmContentObjs as $thisFmContentObj) { - $itemObj = $publisher->getHandler('item')->create(); - $itemObj->setVars(array('categoryid' => $CatIds['newid'], - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => ($thisFmContentObj->getVar('content_status')) ? PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED : PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE, - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc')) - ); + $itemObj =& $publisher->getHandler('item')->create(); + $itemObj->setVars(array( + 'categoryid' => $CatIds['newid'], + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => ($thisFmContentObj->getVar('content_status')) ? PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED : PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE, + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'))); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { $itemObj->setVar('images', 1); @@ -282,26 +283,26 @@ } if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $thisFmContentObj->getVar('title')) . "
\n"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $thisFmContentObj->getVar('title')) . "
\n"; continue; } else { $newArticleArray[$thisFmContentObj->getVar('storyid')] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
\n"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . "
\n"; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); + $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); + $groupsIds = $gpermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$CatIds['oldid']] = $CatIds; unset($CatIds, $thisFmContentObj); echo "
\n"; } - unset($thisFmTopicObj); + // unset($thisFmTopicObj); // Looping through cat to change the parentid to the new parentid foreach ($newCatArray as $oldid => $CatIds) { @@ -319,8 +320,8 @@ $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $fm_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -328,18 +329,15 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
\n"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
\n"; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
\n"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
\n"; } } - unset($comment); + // unset($comment); - echo "

" . _AM_PUBLISHER_IMPORT_DONE . "
\n" - . "" . sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
\n" - . "" . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
\n" - . "
\n" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
\n"; + echo '

' . _AM_PUBLISHER_IMPORT_DONE . "
\n" . '' . sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
\n" . '' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
\n" . "
\n" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
\n"; publisherCloseCollapsableBar('fmimportgo', 'fmimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/news.php b/publisher/admin/import/news.php index e98b0fc7..8e24b2b4 100644 --- a/publisher/admin/import/news.php +++ b/publisher/admin/import/news.php @@ -23,56 +23,56 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "News " . XoopsRequest::getString('news_version', '', 'POST'); +$importFromModuleName = 'News ' . XoopsRequest::getString('news_version', '', 'POST'); -$scriptname = "news.php"; +$scriptname = 'news.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("topics")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('topics')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("stories")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('stories')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; - $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); + $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . '/import/$scriptname'); // Categories to be imported - $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $GLOBALS['xoopsDB']->prefix("topics") . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid"; + $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); while ((list ($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) !== false) { $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + $cat_cbox_options[$cid] = '$cat_title ($art_count)'; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -92,23 +92,23 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleHandler = xoops_gethandler('module'); + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('news'); $news_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_cat = 0; $cnt_imported_articles = 0; $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('topics'); + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('topics'); $resultCat = $GLOBALS['xoopsDB']->query($sql); @@ -117,12 +117,11 @@ $oldToNew = array(); while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) { - $newCat = array(); $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); $categoryObj->setVar('weight', 0); @@ -130,27 +129,27 @@ $categoryObj->setVar('description', $arrCat['topic_description']); // Category image - if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { - if (copy($GLOBALS['xoops']->path("modules/news/assets/images/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("uploads/publisher/images/category/" . $arrCat['topic_imgurl']))) { + if (($arrCat['topic_imgurl'] !== 'blank.gif') && ($arrCat['topic_imgurl'] !== '')) { + if (copy($GLOBALS['xoops']->path('modules/news/assets/images/topics/' . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path('uploads/publisher/images/category/' . $arrCat['topic_imgurl']))) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); } } if (!$publisher->getHandler('category')->insert($categoryObj)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '
'; continue; } $newCat['newid'] = $categoryObj->categoryid(); ++$cnt_imported_cat; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ""; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ''; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('stories') . " WHERE topicid=" . $arrCat['topic_id']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('stories') . ' WHERE topicid=' . $arrCat['topic_id']; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); @@ -173,31 +172,31 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path('modules/wfsection/html/' .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { - $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); - echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; + if (copy($pagewrap_filename, $GLOBALS['xoops']->path('uploads/publisher/content/' . $arrArticle['htmlpage']))) { + $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']'); + echo sprintf('    ' . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . '
'; } } } */ if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . '
'; continue; } else { /* // Linkes files - $sql = "SELECT * FROM ".$GLOBALS['xoopsDB']->prefix("wfs_files")." WHERE articleid=" . $arrArticle['articleid']; + $sql = 'SELECT * FROM '.$GLOBALS['xoopsDB']->prefix('wfs_files').' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query ($sql); $allowed_mimetypes = ''; while ($arrFile = $GLOBALS['xoopsDB']->fetchArray ($resultFiles)) { - $filename = $GLOBALS['xoops']->path("modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path('modules/wfsection/cache/uploaded/' . $arrFile['filerealname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { - $fileObj = $publisher_file_handler->create(); + if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) { + $fileObj = $publisher_fileHandler->create(); $fileObj->setVar('name', $arrFile['fileshowname']); $fileObj->setVar('description', $arrFile['filedescript']); $fileObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE); @@ -209,27 +208,27 @@ $fileObj->setVar('filename', $arrFile['filerealname']); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } } } */ $newArticleArray[$arrArticle['storyid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); + $groupsIds = $gpermHandler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); + $groupsIds = $gpermHandler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through cat to change the parentid to the new parentid @@ -248,12 +247,12 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -261,18 +260,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); + // unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/smartsection.php b/publisher/admin/import/smartsection.php index 9c2a6245..a9134d2d 100644 --- a/publisher/admin/import/smartsection.php +++ b/publisher/admin/import/smartsection.php @@ -23,39 +23,39 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "Smartsection " . XoopsRequest::getString('smartsection_version', '', 'POST'); +$importFromModuleName = 'Smartsection ' . XoopsRequest::getString('smartsection_version', '', 'POST'); -$scriptname = "smartsection.php"; +$scriptname = 'smartsection.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("smartsection_categories")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix('smartsection_items')); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_items')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}"); // Categories to be imported - $sql = "SELECT cat.categoryid, cat.parentid, cat.name, COUNT(art.itemid) FROM " . $GLOBALS['xoopsDB']->prefix('smartsection_categories') . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix('smartsection_items') . " AS art ON cat.categoryid=art.categoryid GROUP BY art.categoryid"; + $sql = 'SELECT cat.categoryid, cat.parentid, cat.name, COUNT(art.itemid) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('smartsection_items') . ' AS art ON cat.categoryid=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); @@ -65,14 +65,14 @@ $cat_cbox_options[$cid] = "$cat_title ($art_count)"; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -92,23 +92,23 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleHandler = xoops_gethandler('module'); + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('smartsection'); $smartsection_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_cat = 0; $cnt_imported_articles = 0; $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('smartsection_categories'); + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories'); $resultCat = $GLOBALS['xoopsDB']->query($sql); @@ -121,18 +121,18 @@ $newCat['oldid'] = $arrCat['categoryid']; $newCat['oldpid'] = $arrCat['parentid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $categoryObj->setVars($arrCat); $categoryObj->setVar('categoryid', 0); // Copy category image - if (($arrCat['image'] != 'blank.gif') && ($arrCat['image'] != '')) { - copy($GLOBALS['xoops']->path("uploads/smartsection/images/category/" . $arrCat['image']), $GLOBALS['xoops']->path("uploads/publisher/images/category/" . $arrCat['image'])); + if (($arrCat['image'] !== 'blank.gif') && ($arrCat['image'] !== '')) { + copy($GLOBALS['xoops']->path('uploads/smartsection/images/category/' . $arrCat['image']), $GLOBALS['xoops']->path('uploads/publisher/images/category/' . $arrCat['image'])); } if (!$publisher->getHandler('category')->insert($categoryObj)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['name']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['name']) . '
'; continue; } @@ -141,12 +141,12 @@ echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ""; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('smartsection_items') . " WHERE categoryid=" . $arrCat['categoryid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_items') . ' WHERE categoryid=' . $arrCat['categoryid']; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVars($arrArticle); $itemObj->setVar('itemid', 0); @@ -158,7 +158,7 @@ // TODO: copy contents folder /* if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); @@ -169,44 +169,43 @@ */ if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . '
'; continue; } else { - // Linkes files - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("smartsection_files") . " WHERE itemid=" . $arrArticle['itemid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_files') . ' WHERE itemid=' . $arrArticle['itemid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = null; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("uploads/smartsection/" . $arrFile['filename']); + $filename = $GLOBALS['xoops']->path('uploads/smartsection/' . $arrFile['filename']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filename']))) { - $fileObj = $publisher->getHandler('file')->create(); + if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filename']))) { + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVars($arrFile); $fileObj->setVar('fileid', 0); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filename']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filename']) . '
'; } } } } $newArticleArray[$arrArticle['itemid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); + $groupsIds = $gpermHandler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); + $groupsIds = $gpermHandler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through cat to change the parentid to the new parentid @@ -225,12 +224,12 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $smartsection_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -238,18 +237,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); +// unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/wfsection.php b/publisher/admin/import/wfsection.php index 113c96b6..ea818cdf 100644 --- a/publisher/admin/import/wfsection.php +++ b/publisher/admin/import/wfsection.php @@ -23,39 +23,39 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "WF-Section " . XoopsRequest::getString('wfs_version', '', 'POST'); +$importFromModuleName = 'WF-Section ' . XoopsRequest::getString('wfs_version', '', 'POST'); -$scriptname = "wfsection.php"; +$scriptname = 'wfsection.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("wfs_category")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NOCATSELECTED . ""; + echo "" . _AM_PUBLISHER_IMPORT_NOCATSELECTED . ''; } else { - include_once $GLOBALS['xoops']->path("class/xoopstree.php"); + include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("wfs_article")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_article')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); // Categories to be imported - $sql = "SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM " . $GLOBALS['xoopsDB']->prefix("wfs_category") . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("wfs_article") . " AS art ON cat.id=art.categoryid GROUP BY art.categoryid"; + $sql = 'SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wfs_article') . ' AS art ON cat.id=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_values = array(); $cat_cbox_options = array(); @@ -63,14 +63,14 @@ $cat_title = $myts->displayTarea($cat_title); $cat_cbox_options[$cid] = "$cat_title ($art_count)"; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // SmartFAQ parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -90,7 +90,7 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); @@ -100,19 +100,19 @@ $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); //added to support 2.0.7 - if (XoopsRequest::getString('from_module_version', '', 'POST') == '2.07' || XoopsRequest::getString('from_module_version', '', 'POST') == '2.06') { + if (XoopsRequest::getString('from_module_version', '', 'POST') === '2.07' || XoopsRequest::getString('from_module_version', '', 'POST') === '2.06') { $orders = 'weight'; } else { $orders = 'orders'; } //$sql = "SELECT * FROM ".$GLOBALS['xoopsDB']->prefix("wfs_category")." ORDER by orders"; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("wfs_category") . " ORDER by $orders"; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category') . " ORDER by $orders"; //end added to support 2.0.7 $resultCat = $GLOBALS['xoopsDB']->query($sql); $newCatArray = array(); while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $newCat = array(); @@ -124,20 +124,20 @@ //$categoryObj->setVar ('weight', $arrCat['orders']); $categoryObj->setVar('weight', $arrCat[$orders]); //added to support 2.0.7 - $categoryObj->setGroupsRead(explode(" ", trim($arrCat['groupid']))); - $categoryObj->setGroupsSubmit(explode(" ", trim($arrCat['editaccess']))); + $categoryObj->setGroupsRead(explode(' ', trim($arrCat['groupid']))); + $categoryObj->setGroupsSubmit(explode(' ', trim($arrCat['editaccess']))); $categoryObj->setVar('name', $arrCat['title']); $categoryObj->setVar('description', $arrCat['description']); // Category image - if (($arrCat['imgurl'] != 'blank.gif') && ($arrCat['imgurl'])) { - if (copy($GLOBALS['xoops']->path("modules/wfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { + if (($arrCat['imgurl'] !== 'blank.gif') && ($arrCat['imgurl'])) { + if (copy($GLOBALS['xoops']->path('modules/wfsection/images/category/' . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . '/images/category/' . $arrCat['imgurl'])) { $categoryObj->setVar('image', $arrCat['imgurl']); } } if (!$categoryObj->store(false)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['title']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['title']) . '
'; continue; } @@ -148,13 +148,13 @@ ++$cnt_imported_cat; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ""; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ''; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("wfs_article") . " WHERE categoryid=" . $arrCat['id'] . " ORDER BY weight"; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_article') . ' WHERE categoryid=' . $arrCat['id'] . ' ORDER BY weight'; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); @@ -168,33 +168,33 @@ $itemObj->setVar('dobr', $arrArticle['nobreaks']); $itemObj->setVar('weight', $arrArticle['weight']); $itemObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED); - $itemObj->setGroupsRead(explode(" ", trim($arrArticle['groupid']))); + $itemObj->setGroupsRead(explode(' ', trim($arrArticle['groupid']))); // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" . $arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path('modules/wfsection/html/' . $arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . "/content/" . $arrArticle['htmlpage'])) { - $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); - echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; + if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . '/content/' . $arrArticle['htmlpage'])) { + $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']'); + echo sprintf('    ' . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . '
'; } } } if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . '
'; continue; } else { // Linkes files - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("wfs_files") . " WHERE articleid=" . $arrArticle['articleid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_files') . ' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path('modules/wfsection/cache/uploaded/' . $arrFile['filerealname']); if (file_exists($filename)) { - if (copy($filename, PUBLISHER_UPLOAD_PATH . "/" . $arrFile['filerealname'])) { - $fileObj = $publisher->getHandler('file')->create(); + if (copy($filename, PUBLISHER_UPLOAD_PATH . '/' . $arrFile['filerealname'])) { + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['fileshowname']); $fileObj->setVar('description', $arrFile['filedescript']); $fileObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE); @@ -206,20 +206,20 @@ $fileObj->setVar('filename', $arrFile['filerealname']); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } } } $newArticleArray[$arrArticle['articleid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through cat to change the pid to the new pid foreach ($newCatArray as $oldid => $newCat) { @@ -237,16 +237,16 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - $moduleHandler = xoops_gethandler('module'); + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('wfsection'); $news_module_id = $moduleObj->getVar('mid'); $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -254,18 +254,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); +// unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/xfsection.php b/publisher/admin/import/xfsection.php index 4a0939b4..c800b689 100644 --- a/publisher/admin/import/xfsection.php +++ b/publisher/admin/import/xfsection.php @@ -23,39 +23,39 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "XF-Section " . XoopsRequest::getString('xfs_version', '', 'POST'); +$importFromModuleName = 'XF-Section ' . XoopsRequest::getString('xfs_version', '', 'POST'); -$scriptname = "xfsection.php"; +$scriptname = 'xfsection.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ($op === 'start') { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('xfsectionimport', 'xfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("xfs_category")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NOCATSELECTED . ""; + echo "" . _AM_PUBLISHER_IMPORT_NOCATSELECTED . ''; } else { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("xfs_article")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_article')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); // Categories to be imported - $sql = "SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM " . $GLOBALS['xoopsDB']->prefix("xfs_category") . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("xfs_article") . " AS art ON cat.id=art.categoryid GROUP BY art.categoryid"; + $sql = 'SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('xfs_article') . ' AS art ON cat.id=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_values = array(); $cat_cbox_options = array(); @@ -63,14 +63,14 @@ $cat_title = $myts->displayTarea($cat_title); $cat_cbox_options[$cid] = "$cat_title ($art_count)"; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // SmartFAQ parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -90,7 +90,7 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); @@ -100,13 +100,13 @@ $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("xfs_category") . " ORDER by orders"; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category') . ' ORDER by orders'; $resultCat = $GLOBALS['xoopsDB']->query($sql); $newCatArray = array(); while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $newCat = array(); @@ -116,20 +116,20 @@ $categoryObj->setVar('parentid', $arrCat['pid']); $categoryObj->setVar('weight', $arrCat['orders']); - $categoryObj->setGroupsRead(explode(" ", trim($arrCat['groupid']))); - $categoryObj->setGroupsSubmit(explode(" ", trim($arrCat['editaccess']))); + $categoryObj->setGroupsRead(explode(' ', trim($arrCat['groupid']))); + $categoryObj->setGroupsSubmit(explode(' ', trim($arrCat['editaccess']))); $categoryObj->setVar('name', $arrCat['title']); $categoryObj->setVar('description', $arrCat['description']); // Category image - if (($arrCat['imgurl'] != 'blank.gif') && ($arrCat['imgurl'])) { - if (copy($GLOBALS['xoops']->path("modules/xfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { + if (($arrCat['imgurl'] !== 'blank.gif') && ($arrCat['imgurl'])) { + if (copy($GLOBALS['xoops']->path('modules/xfsection/images/category/' . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . '/images/category/' . $arrCat['imgurl'])) { $categoryObj->setVar('image', $arrCat['imgurl']); } } if (!$categoryObj->store(false)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['title']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['title']) . '
'; continue; } @@ -142,11 +142,11 @@ echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . ""; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("xfs_article") . " WHERE categoryid=" . $arrCat['id'] . " ORDER BY weight"; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_article') . ' WHERE categoryid=' . $arrCat['id'] . ' ORDER BY weight'; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); @@ -159,7 +159,7 @@ $itemObj->setVar('dohtml', !$arrArticle['nohtml']); $itemObj->setVar('dosmiley', !$arrArticle['nosmiley']); $itemObj->setVar('dobr', !$arrArticle['nobr']); - $itemObj->setGroupsRead(explode(" ", trim($arrArticle['groupid']))); + $itemObj->setGroupsRead(explode(' ', trim($arrArticle['groupid']))); // status $status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; @@ -170,29 +170,29 @@ // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/xfsection/html/" . $arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path('modules/xfsection/html/' . $arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . "/content/" . $arrArticle['htmlpage'])) { - $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); - echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; + if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . '/content/' . $arrArticle['htmlpage'])) { + $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']'); + echo sprintf('    ' . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . '
'; } } } if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['title']) . '
'; continue; } else { // Linkes files - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("xfs_files") . " WHERE articleid=" . $arrArticle['articleid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_files') . ' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("modules/xfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path('modules/xfsection/cache/uploaded/' . $arrFile['filerealname']); if (file_exists($filename)) { - if (copy($filename, PUBLISHER_UPLOAD_PATH . "/" . $arrFile['filerealname'])) { - $fileObj = $publisher->getHandler('file')->create(); + if (copy($filename, PUBLISHER_UPLOAD_PATH . '/' . $arrFile['filerealname'])) { + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['fileshowname']); $fileObj->setVar('description', $arrFile['filedescript']); $fileObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE); @@ -204,20 +204,20 @@ $fileObj->setVar('filename', $arrFile['filerealname']); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } } } $newArticleArray[$arrArticle['articleid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through cat to change the pid to the new pid foreach ($newCatArray as $oldid => $newCat) { @@ -235,16 +235,16 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - $moduleHandler = xoops_gethandler('module'); + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('xfsection'); $news_module_id = $moduleObj->getVar('mid'); $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -252,18 +252,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); +// unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/import/xnews.php b/publisher/admin/import/xnews.php index 7cc8cf0a..a68f17c7 100644 --- a/publisher/admin/import/xnews.php +++ b/publisher/admin/import/xnews.php @@ -23,57 +23,45 @@ include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "xNews " . XoopsRequest::getString('xnews_version', '', 'POST'); +$importFromModuleName = 'xNews ' . XoopsRequest::getString('xnews_version', '', 'POST'); -$scriptname = "xnews.php"; +$scriptname = 'xnews.php'; -$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; +$op = ('go' === XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if ($op == 'start') { +if ('start' === $op) { xoops_load('XoopsFormLoader'); publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisherOpenCollapsableBar( - 'xnewsimport', - 'xnewsimporticon', - sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), - _AM_PUBLISHER_IMPORT_INFO - ); - - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("nw_topics")); + publisherOpenCollapsableBar('xnewsimport', 'xnewsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics')); list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { - echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ""; + echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("nw_stories")); + $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_stories')); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalArticles == 0) { - echo "" . sprintf( - _AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, - $importFromModuleName, - $totalArticles) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . ''; } else { - echo "" . sprintf( - _AM_PUBLISHER_IMPORT_MODULE_FOUND, - $importFromModuleName, - $totalArticles, - $totalCat) . ""; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . ''; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); //---------- mb ------------------ - // add "publisher" category to "imagecategory" table + // add 'publisher' category to 'imagecategory' table // if (!$GLOBALS['xoopsSecurity']->check()) { // redirect_header('admin.php?fct=images', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); // } - $imageCategoryHandler =& xoops_gethandler('imagecategory'); + $imageCategoryHandler =& xoops_getHandler('imagecategory'); $imagecategory =& $imageCategoryHandler->create(); // $imagecategory->setVar('imgcat_name', $imgcat_name); $imagecategory->setVar('imgcat_name', PUBLISHER_DIRNAME); //$imgcat_name); @@ -89,50 +77,49 @@ $imageCategoryHandler->insert($imagecategory); // exit(); } catch (Exception $e) { - echo "Caught exception: : couldn't insert Image Category " . $e->getMessage() . "n"; + echo "Caught exception: : couldn't insert Image Category " . $e->getMessage() . 'n'; } $newid = $imagecategory->getVar('imgcat_id'); - $imagecategoryperm_handler =& xoops_gethandler('groupperm'); + $imagecategorypermHandler =& xoops_getHandler('groupperm'); if (!isset($readgroup)) { $readgroup = array(); } if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { - array_push($readgroup, XOOPS_GROUP_ADMIN); + $readgroup[] = XOOPS_GROUP_ADMIN; } foreach ($readgroup as $rgroup) { - $imagecategoryperm =& $imagecategoryperm_handler->create(); + $imagecategoryperm =& $imagecategorypermHandler->create(); $imagecategoryperm->setVar('gperm_groupid', $rgroup); $imagecategoryperm->setVar('gperm_itemid', $newid); $imagecategoryperm->setVar('gperm_name', 'imgcat_read'); $imagecategoryperm->setVar('gperm_modid', 1); - $imagecategoryperm_handler->insert($imagecategoryperm); + $imagecategorypermHandler->insert($imagecategoryperm); unset($imagecategoryperm); } - unset($rgroup); + // unset($rgroup); if (!isset($writegroup)) { $writegroup = array(); } if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { - array_push($writegroup, XOOPS_GROUP_ADMIN); + $writegroup[] = XOOPS_GROUP_ADMIN; } foreach ($writegroup as $wgroup) { - $imagecategoryperm =& $imagecategoryperm_handler->create(); + $imagecategoryperm =& $imagecategorypermHandler->create(); $imagecategoryperm->setVar('gperm_groupid', $wgroup); $imagecategoryperm->setVar('gperm_itemid', $newid); $imagecategoryperm->setVar('gperm_name', 'imgcat_write'); $imagecategoryperm->setVar('gperm_modid', 1); - $imagecategoryperm_handler->insert($imagecategoryperm); + $imagecategorypermHandler->insert($imagecategoryperm); unset($imagecategoryperm); } - unset($wgroup); + // unset($wgroup); //---------- mb ------------------ // Categories to be imported - $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $GLOBALS['xoopsDB']->prefix("nw_topics") - . " AS cat INNER JOIN " . $GLOBALS['xoopsDB']->prefix("nw_stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid"; + $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_options = array(); @@ -142,14 +129,14 @@ $cat_cbox_options[$cid] = "$cat_title ($art_count)"; } - $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("
", $cat_cbox_options)); + $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid'); ob_start(); - $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); + $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category'); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); @@ -169,36 +156,31 @@ xoops_cp_footer(); } -if ($op == 'go') { +if ($op === 'go') { publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - include_once (dirname(dirname(__DIR__))) . '/include/common.php'; - publisherOpenCollapsableBar( - 'xnewsimportgo', - 'xnewsimportgoicon', - sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), - _AM_PUBLISHER_IMPORT_RESULT - ); - - $moduleHandler = xoops_gethandler('module'); + include_once(dirname(dirname(__DIR__))) . '/include/common.php'; + publisherOpenCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + + $moduleHandler =& xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('xnews'); $xnews_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gpermHandler =& xoops_getHandler('groupperm'); $cnt_imported_cat = 0; $cnt_imported_articles = 0; $parentId = XoopsRequest::getInt('parent_category', 0, 'POST'); - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('nw_topics'); + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics'); $resultCat = $GLOBALS['xoopsDB']->query($sql); $newCatArray = array(); $newArticleArray = array(); - $imageCategoryHandler =& xoops_gethandler('imagecategory'); + $imageCategoryHandler =& xoops_getHandler('imagecategory'); // $criteria = new criteriaCombo; // get the total number of subcats for this category @@ -210,17 +192,17 @@ $imageCategoryId = $imageCategoryHandler->getObjects($criteria); // $criteria = new CriteriaCompo(); - // $criteria->add(new Criteria("imagecategory", PUBLISHER_DIRNAME, "=")); + // $criteria->add(new Criteria('imagecategory', PUBLISHER_DIRNAME, '=')); // $newid = $imageCategoryId->getVar('imgcat_id'); $newid = $imageCategoryId[0]->vars['imgcat_id']['value']; // $newid = $imageCategoryId[0]->vars['imgcat_id']; - // $select_form = new XoopsFormSelect("", $name_current, array(), 1); - // $select_form->addOption("", _SELECT); - // $select_form->addOptionArray($writer_handler->getList($criteria)); + // $select_form = new XoopsFormSelect('', $name_current, array(), 1); + // $select_form->addOption('', _SELECT); + // $select_form->addOptionArray($writerHandler->getList($criteria)); - // $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('imagecategory') . " WHERE imgcat_name=" . PUBLISHER_DIRNAME; + // $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . ' WHERE imgcat_name=' . PUBLISHER_DIRNAME; // $resultImageCategory = $GLOBALS['xoopsDB']->query($sql); // // @@ -232,7 +214,7 @@ $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj =& $publisher->getHandler('category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); $categoryObj->setVar('image', $arrCat['topic_imgurl']); @@ -242,20 +224,16 @@ $categoryObj->setVar('moderator', 1); // Category image: copying to Publisher category uploads - if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { - if (copy( - $GLOBALS['xoops']->path("uploads/xnews/topics/" . $arrCat['topic_imgurl']), - $GLOBALS['xoops']->path("uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']) - ) - ) { + if (($arrCat['topic_imgurl'] !== 'blank.gif') && ($arrCat['topic_imgurl'] !== '')) { + if (copy($GLOBALS['xoops']->path('uploads/xnews/topics/' . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path('uploads/' . PUBLISHER_DIRNAME . '/images/category/' . $arrCat['topic_imgurl']))) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); //======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder /* - $image_handler =& xoops_gethandler('image'); - $image =& $image_handler->create(); + $imageHandler =& xoops_getHandler('image'); + $image =& $imageHandler->create(); $image->setVar('image_name', $arrCat['topic_imgurl']);//'images/' . $uploader->getSavedFileName()); $image->setVar('image_nicename', substr($arrCat['topic_imgurl'],-13)); //$image_nicename); $image->setVar('image_mimetype', 'image/'. substr($arrCat['topic_imgurl'],-3));//$uploader->getMediaType()); @@ -264,7 +242,7 @@ $image->setVar('image_display', 1); //$image_display); $image->setVar('image_weight', 0);//$image_weight); $image->setVar('imgcat_id', $newid );//$imgcat_id); - if (!$image_handler->insert($image)) { + if (!$imageHandler->insert($image)) { $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); } @@ -276,18 +254,18 @@ } if (!$publisher->getHandler('category')->insert($categoryObj)) { - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '
'; continue; } //copy all images to Image Manager - $src = $GLOBALS['xoops']->path("uploads/xnews/topics/"); - $dst = $GLOBALS['xoops']->path("uploads"); + $src = $GLOBALS['xoops']->path('uploads/xnews/topics/'); + $dst = $GLOBALS['xoops']->path('uploads'); PublisherUtilities::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) - $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("image") . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`) + $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('image') . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`) SELECT s.picture, RIGHT(s.picture,13) AS nicename, @@ -295,7 +273,7 @@ 1 AS image_display, 0 AS image_weight, c.imgcat_id - FROM " . $GLOBALS['xoopsDB']->prefix("nw_stories") . " s, " . $GLOBALS['xoopsDB']->prefix("imagecategory") . " c + FROM " . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' s, ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . " c WHERE s.picture <> '' AND c.imgcat_name = '" . PUBLISHER_DIRNAME . "'"; @@ -304,13 +282,13 @@ $newCat['newid'] = $categoryObj->categoryid(); ++$cnt_imported_cat; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . "
"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . '
'; - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('nw_stories') . " WHERE topicid=" . $arrCat['topic_id']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' WHERE topicid=' . $arrCat['topic_id']; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); @@ -329,10 +307,10 @@ $itemObj->setVar('notifypub', $arrArticle['notifypub']); //-------- image - $img_handler =& xoops_gethandler('image'); + $imgHandler =& xoops_getHandler('image'); $criteria = new Criteria('image_name', $arrArticle['picture']); - $imageId = $img_handler->getObjects($criteria); + $imageId = $imgHandler->getObjects($criteria); $newImageId = $imageId[0]->vars['image_id']['value']; $itemObj->setVar('image', $newImageId); $itemObj->setVar('images', $newImageId); @@ -348,30 +326,30 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path('modules/wfsection/html/' .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { - $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); - echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; + if (copy($pagewrap_filename, $GLOBALS['xoops']->path('uploads/publisher/content/' . $arrArticle['htmlpage']))) { + $itemObj->setVar('body', '[pagewrap=' . $arrArticle['htmlpage'] . ']'); + echo sprintf('    ' . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . '
'; } } } */ if (!$itemObj->store()) { - echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['storyid'] . ' ' . $arrArticle['title']) . "
"; + echo sprintf(' ' . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['storyid'] . ' ' . $arrArticle['title']) . '
'; continue; } else { //-------------------------------------------- // Linkes files - $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("nw_stories_files") . " WHERE storyid=" . $arrArticle['storyid']; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('nw_stories_files') . ' WHERE storyid=' . $arrArticle['storyid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("uploads/xnews/attached/" . $arrFile['downloadname']); + $filename = $GLOBALS['xoops']->path('uploads/xnews/attached/' . $arrFile['downloadname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { - $fileObj = $publisher->getHandler('file')->create(); + if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) { + $fileObj =& $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['filerealname']); $fileObj->setVar('description', $arrFile['filerealname']); $fileObj->setVar('status', PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE); @@ -384,7 +362,7 @@ $fileObj->setVar('short_url', $arrFile['filerealname']); if ($fileObj->store($allowed_mimetypes, true, false)) { - echo "    " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "
"; + echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } } @@ -393,23 +371,23 @@ //------------------------ $newArticleArray[$arrArticle['storyid']] = $itemObj->itemid(); - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->getTitle()) . '
'; ++$cnt_imported_articles; } } // Saving category permissions - $groupsIds = $gperm_handler->getGroupIds('nw_view', $arrCat['topic_id'], $xnews_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $xnews_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); - $groupsIds = $gperm_handler->getGroupIds('nw_submit', $arrCat['topic_id'], $xnews_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $xnews_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); - $groupsIds = $gperm_handler->getGroupIds('nw_approve', $arrCat['topic_id'], $xnews_module_id); + $groupsIds = $gpermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $xnews_module_id); publisherSaveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); - echo "
"; + echo '
'; } // Looping through category to change the parentID to the new parentID @@ -428,12 +406,12 @@ unset($oldid, $newCat); // Looping through the comments to link them to the new articles and module - echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; + echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; $publisher_module_id = $publisher->getModule()->mid(); - $commentHandler = xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + $commentHandler =& xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $xnews_module_id)); $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { @@ -441,18 +419,18 @@ $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); if (!$commentHandler->insert($comment)) { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . '
'; } else { - echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; + echo '  ' . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . '
'; } } - unset($comment); + // unset($comment); - echo "

Done.
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "
"; - echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "
"; - echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
"; + echo '

Done.
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . '
'; + echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; + echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; publisherCloseCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); xoops_cp_footer(); diff --git a/publisher/admin/item.php b/publisher/admin/item.php index 760dd8ea..ee05286b 100644 --- a/publisher/admin/item.php +++ b/publisher/admin/item.php @@ -22,16 +22,17 @@ include_once __DIR__ . '/admin_header.php'; -$itemid = XoopsRequest::getInt('itemid', (XoopsRequest::getInt('itemid', 0, 'POST')), 'GET') ; +$itemid = XoopsRequest::getInt('itemid', (XoopsRequest::getInt('itemid', 0, 'POST')), 'GET'); $op = ($itemid > 0 || (XoopsRequest::getString('editor', '', 'POST'))) ? 'mod' : ''; $op = XoopsRequest::getString('op', $op, 'GET'); //if (!empty(XoopsRequest::getString('additem', '', 'POST'))) { -// $op = 'additem'; +// $op0 = 'additem'; //} elseif (!empty(XoopsRequest::getString('del', '', 'POST'))) { -// $op = 'del'; +// $op0 = 'del'; //} + $op = (XoopsRequest::getString('additem', '', 'POST')) ? 'additem' : ((XoopsRequest::getString('del', '', 'POST')) ? 'del' : $op); // Where shall we start ? @@ -41,24 +42,24 @@ $rejectedstartitem = XoopsRequest::getInt('rejectedstartitem', (XoopsRequest::getInt('submittedstartitem', 0, 'GET')), 'POST'); switch ($op) { - case "clone": + case 'clone': if ($itemid == 0) { - $totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1); + $totalcategories =& $publisher->getHandler('category')->getCategoriesCount(-1); if ($totalcategories == 0) { - redirect_header("category.php?op=mod", 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); -// exit(); + redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); + // exit(); } } publisherCpHeader(); publisher_editItem(true, $itemid, true); break; - case "mod": + case 'mod': if ($itemid == 0) { - $totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1); + $totalcategories =& $publisher->getHandler('category')->getCategoriesCount(-1); if ($totalcategories == 0) { - redirect_header("category.php?op=mod", 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); -// exit(); + redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); + // exit(); } } @@ -66,21 +67,21 @@ publisher_editItem(true, $itemid); break; - case "additem": - $redirect_msg = ''; + case 'additem': + $redirect_msg = $error_msg = ''; // Creating the item object if ($itemid != 0) { - $itemObj = $publisher->getHandler('item')->get($itemid); + $itemObj =& $publisher->getHandler('item')->get($itemid); } else { - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); } $itemObj->setVarsFromRequest(); $old_status = $itemObj->status(); - $new_status = XoopsRequest::getInt('status', PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED); //_PUBLISHER_STATUS_NOTSET; + $newStatus = XoopsRequest::getInt('status', PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED); //_PUBLISHER_STATUS_NOTSET; - switch ($new_status) { + switch ($newStatus) { case PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED: if (($old_status == PublisherConstantsInterface::PUBLISHER_STATUS_NOTSET)) { $error_msg = _AM_PUBLISHER_ITEMNOTUPDATED; @@ -93,7 +94,7 @@ case PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED: if (($old_status == PublisherConstantsInterface::PUBLISHER_STATUS_NOTSET) || ($old_status == PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED)) { $redirect_msg = _AM_PUBLISHER_SUBMITTED_APPROVE_SUCCESS; - $notifToDo = array(PublisherConstantsInterface::PUBLISHER_NOT_ITEM_PUBLISHED); + $notifToDo = array(PublisherConstantsInterface::PUBLISHER_NOTIFY_ITEM_PUBLISHED); } else { $redirect_msg = _AM_PUBLISHER_PUBLISHED_MOD_SUCCESS; } @@ -118,20 +119,20 @@ $redirect_msg = _AM_PUBLISHER_ITEM_REJECTED; break; } - $itemObj->setVar('status', $new_status); + $itemObj->setVar('status', $newStatus); // Storing the item if (!$itemObj->store()) { - redirect_header("javascript:history.go(-1)", 3, $error_msg . publisherFormatErrors($itemObj->getErrors())); -// exit; + redirect_header('javascript:history.go(-1)', 3, $error_msg . publisherFormatErrors($itemObj->getErrors())); + // exit; } // attach file if any - if (($item_upload_file = XoopsRequest::getArray('item_upload_file', '', 'FILES')) && $item_upload_file['name'] !== "") { + if (($item_upload_file = XoopsRequest::getArray('item_upload_file', '', 'FILES')) && $item_upload_file['name'] !== '') { $file_upload_result = publisherUploadFile(false, false, $itemObj); if ($file_upload_result !== true) { - redirect_header("javascript:history.go(-1)", 3, $file_upload_result); -// exit; + redirect_header('javascript:history.go(-1)', 3, $file_upload_result); + // exit; } } @@ -140,30 +141,30 @@ $itemObj->sendNotifications($notifToDo); } - redirect_header("item.php", 2, $redirect_msg); + redirect_header('item.php', 2, $redirect_msg); break; - case "del": - $itemObj = $publisher->getHandler('item')->get($itemid); + case 'del': + $itemObj =& $publisher->getHandler('item')->get($itemid); $confirm = XoopsRequest::getInt('confirm', '', 'POST'); if ($confirm) { if (!$publisher->getHandler('item')->delete($itemObj)) { - redirect_header("item.php", 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . publisherFormatErrors($itemObj->getErrors())); -// exit(); + redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . publisherFormatErrors($itemObj->getErrors())); + // exit(); } - redirect_header("item.php", 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->title())); -// exit(); + redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->getTitle())); + // exit(); } else { xoops_cp_header(); - xoops_confirm(array('op' => 'del', 'itemid' => $itemObj->itemid(), 'confirm' => 1, 'name' => $itemObj->title()), 'item.php', _AM_PUBLISHER_DELETETHISITEM . "
'" . $itemObj->title() . "'.

", _AM_PUBLISHER_DELETE); + xoops_confirm(array('op' => 'del', 'itemid' => $itemObj->itemid(), 'confirm' => 1, 'name' => $itemObj->getTitle()), 'item.php', _AM_PUBLISHER_DELETETHISITEM . "
'" . $itemObj->getTitle() . "'.

", _AM_PUBLISHER_DELETE); xoops_cp_footer(); } exit(); break; - case "default": + case 'default': default: publisherCpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); @@ -172,7 +173,7 @@ echo "
\n"; echo "
"; echo "  "; - echo "
"; + echo ''; $orderBy = 'datesub'; $ascOrDesc = 'DESC'; @@ -181,42 +182,42 @@ publisherOpenCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of submitted ITEM - $totalitems = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED)); + $totalitems =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED)); - $itemsObj = $publisher->getHandler('item')->getAllSubmitted($publisher->getConfig('idxcat_perpage'), $submittedstartitem, -1, $orderBy, $ascOrDesc); + $itemsObj =& $publisher->getHandler('item')->getAllSubmitted($publisher->getConfig('idxcat_perpage'), $submittedstartitem, -1, $orderBy, $ascOrDesc); $totalItemsOnPage = count($itemsObj); echo ""; - echo ""; - echo ""; + echo ''; + echo "'; if ($totalitems > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { - $categoryObj = $itemsObj[$i]->category(); + $categoryObj = $itemsObj[$i]->getCategory(); $approve = "" . _AM_PUBLISHER_SUBMISSION_MODERATE . " "; $clone = ''; $delete = "" . _AM_PUBLISHER_DELETEITEM . ""; - $modify = ""; + $modify = ''; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo "'; + echo "'; echo ""; - echo ""; + echo ''; } } else { $itemid = 0; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; } echo "
" . _AM_PUBLISHER_ITEMID . ""; - echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ""; - echo "" . _AM_PUBLISHER_TITLE . ""; - echo "" . _AM_PUBLISHER_CREATED . ""; - echo "" . _AM_PUBLISHER_ACTION . ""; - echo "
" . _AM_PUBLISHER_ITEMID . ''; + echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ''; + echo "" . _AM_PUBLISHER_TITLE . ''; + echo "" . _AM_PUBLISHER_CREATED . ''; + echo "" . _AM_PUBLISHER_ACTION . ''; + echo '
" . $itemsObj[$i]->itemid() . "" . $categoryObj->getCategoryLink() . "" . $itemsObj[$i]->title() . "" . $itemsObj[$i]->datesub() . "
" . $itemsObj[$i]->itemid() . '" . $categoryObj->getCategoryLink() . '" . $itemsObj[$i]->getTitle() . '" . $itemsObj[$i]->getDatesub() . ' $approve $clone $modify $delete
" . _AM_PUBLISHER_NOITEMS_SUBMITTED . "
" . _AM_PUBLISHER_NOITEMS_SUBMITTED . '
\n"; echo "
\n"; @@ -230,43 +231,43 @@ publisherOpenCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC); // Get the total number of published ITEM - $totalitems = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED)); + $totalitems =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED)); - $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $publishedstartitem, -1, $orderBy, $ascOrDesc); + $itemsObj =& $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $publishedstartitem, -1, $orderBy, $ascOrDesc); $totalItemsOnPage = count($itemsObj); echo ""; - echo ""; - echo ""; + echo ''; + echo "'; if ($totalitems > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { - $categoryObj = $itemsObj[$i]->category(); + $categoryObj = $itemsObj[$i]->getCategory(); $modify = "" . _AM_PUBLISHER_EDITITEM . ""; $delete = "" . _AM_PUBLISHER_DELETEITEM . ""; $clone = "" . _AM_PUBLISHER_CLONE_ITEM . ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo "'; + echo "'; + echo "'; echo ""; - echo ""; + echo ''; } } else { $itemid = 0; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; } echo "
" . _AM_PUBLISHER_ITEMID . ""; - echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ""; - echo "" . _AM_PUBLISHER_TITLE . ""; - echo "" . _AM_PUBLISHER_ITEM_VIEWS . ""; - echo "" . _AM_PUBLISHER_CREATED . ""; - echo "" . _AM_PUBLISHER_ACTION . ""; - echo "
" . _AM_PUBLISHER_ITEMID . ''; + echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ''; + echo "" . _AM_PUBLISHER_TITLE . ''; + echo "" . _AM_PUBLISHER_ITEM_VIEWS . ''; + echo "" . _AM_PUBLISHER_CREATED . ''; + echo "" . _AM_PUBLISHER_ACTION . ''; + echo '
" . $itemsObj[$i]->itemid() . "" . $categoryObj->getCategoryLink() . "" . $itemsObj[$i]->getItemLink() . "" . $itemsObj[$i]->counter() . "" . $itemsObj[$i]->datesub() . "
" . $itemsObj[$i]->itemid() . '" . $categoryObj->getCategoryLink() . '" . $itemsObj[$i]->getItemLink() . '" . $itemsObj[$i]->counter() . '" . $itemsObj[$i]->getDatesub() . ' $clone $modify $delete
" . _AM_PUBLISHER_NOITEMS . "
" . _AM_PUBLISHER_NOITEMS . '
\n"; echo "
\n"; @@ -277,45 +278,45 @@ publisherCloseCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); // Display Offline articles - publisherOpenCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . " " . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); + publisherOpenCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); - $totalitems = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE)); + $totalitems =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE)); - $itemsObj = $publisher->getHandler('item')->getAllOffline($publisher->getConfig('idxcat_perpage'), $offlinestartitem, -1, $orderBy, $ascOrDesc); + $itemsObj =& $publisher->getHandler('item')->getAllOffline($publisher->getConfig('idxcat_perpage'), $offlinestartitem, -1, $orderBy, $ascOrDesc); $totalItemsOnPage = count($itemsObj); echo ""; - echo ""; - echo ""; + echo ''; + echo "'; if ($totalitems > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { - $categoryObj = $itemsObj[$i]->category(); + $categoryObj = $itemsObj[$i]->getCategory(); $modify = "" . _AM_PUBLISHER_EDITITEM . ""; $delete = "" . _AM_PUBLISHER_DELETEITEM . ""; $clone = "" . _AM_PUBLISHER_CLONE_ITEM . ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo "'; + echo "'; + echo "'; echo ""; - echo ""; + echo ''; } } else { $itemid = 0; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; } echo "
" . _AM_PUBLISHER_ITEMID . ""; - echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ""; - echo "" . _AM_PUBLISHER_TITLE . ""; - echo "" . _AM_PUBLISHER_ITEM_VIEWS . ""; - echo "" . _AM_PUBLISHER_CREATED . ""; - echo "" . _AM_PUBLISHER_ACTION . ""; - echo "
" . _AM_PUBLISHER_ITEMID . ''; + echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ''; + echo "" . _AM_PUBLISHER_TITLE . ''; + echo "" . _AM_PUBLISHER_ITEM_VIEWS . ''; + echo "" . _AM_PUBLISHER_CREATED . ''; + echo "" . _AM_PUBLISHER_ACTION . ''; + echo '
" . $itemsObj[$i]->itemid() . "" . $categoryObj->getCategoryLink() . "" . $itemsObj[$i]->getItemLink() . "" . $itemsObj[$i]->counter() . "" . $itemsObj[$i]->datesub() . "
" . $itemsObj[$i]->itemid() . '" . $categoryObj->getCategoryLink() . '" . $itemsObj[$i]->getItemLink() . '" . $itemsObj[$i]->counter() . '" . $itemsObj[$i]->getDatesub() . ' $clone $modify $delete
" . _AM_PUBLISHER_NOITEMS_OFFLINE . "
" . _AM_PUBLISHER_NOITEMS_OFFLINE . '
\n"; echo "
\n"; @@ -329,41 +330,41 @@ publisherOpenCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of Rejected ITEM - $totalitems = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED)); - $itemsObj = $publisher->getHandler('item')->getAllRejected($publisher->getConfig('idxcat_perpage'), $rejectedstartitem, -1, $orderBy, $ascOrDesc); + $totalitems =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED)); + $itemsObj =& $publisher->getHandler('item')->getAllRejected($publisher->getConfig('idxcat_perpage'), $rejectedstartitem, -1, $orderBy, $ascOrDesc); $totalItemsOnPage = count($itemsObj); echo ""; - echo ""; - echo ""; - - if ($totalitems > 0) { + echo ''; + echo "'; + + if ($totalitems > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { - $categoryObj = $itemsObj[$i]->category(); + $categoryObj = $itemsObj[$i]->getCategory(); $modify = "" . _AM_PUBLISHER_EDITITEM . ""; $delete = "" . _AM_PUBLISHER_DELETEITEM . ""; $clone = "" . _AM_PUBLISHER_CLONE_ITEM . ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo "'; + echo "'; echo ""; - echo ""; + echo ''; } } else { $itemid = 0; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; } echo "
" . _AM_PUBLISHER_ITEMID . ""; - echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ""; - echo "" . _AM_PUBLISHER_TITLE . ""; - echo "" . _AM_PUBLISHER_CREATED . ""; - echo "" . _AM_PUBLISHER_ACTION . ""; - echo "
" . _AM_PUBLISHER_ITEMID . ''; + echo "" . _AM_PUBLISHER_ITEMCATEGORYNAME . ''; + echo "" . _AM_PUBLISHER_TITLE . ''; + echo "" . _AM_PUBLISHER_CREATED . ''; + echo "" . _AM_PUBLISHER_ACTION . ''; + echo '
" . $itemsObj[$i]->itemid() . "" . $categoryObj->getCategoryLink() . "" . $itemsObj[$i]->getItemLink() . "" . $itemsObj[$i]->datesub() . "
" . $itemsObj[$i]->itemid() . '" . $categoryObj->getCategoryLink() . '" . $itemsObj[$i]->getItemLink() . '" . $itemsObj[$i]->getDatesub() . ' $clone $modify $delete
" . _AM_PUBLISHER_NOITEMS_REJECTED . "
" . _AM_PUBLISHER_NOITEMS_REJECTED . '
\n"; echo "
\n"; @@ -378,13 +379,13 @@ /** * @param bool $showmenu - * @param int $itemid + * @param int $itemid * @param bool $clone */ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) { - $publisher = PublisherPublisher::getInstance(); - global $publisher_current_page; + $publisher =& PublisherPublisher::getInstance(); + global $publisherCurrentPage; xoops_load('XoopsFormLoader'); @@ -394,13 +395,12 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) // if there is a parameter, and the id exists, retrieve data: we're editing a item if ($itemid != 0) { - // Creating the ITEM object - $itemObj = $publisher->getHandler('item')->get($itemid); + $itemObj =& $publisher->getHandler('item')->get($itemid); if (!$itemObj) { - redirect_header("item.php", 1, _AM_PUBLISHER_NOITEMSELECTED); -// exit(); + redirect_header('item.php', 1, _AM_PUBLISHER_NOITEMSELECTED); + // exit(); } if ($clone) { @@ -411,92 +411,91 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) } switch ($itemObj->status()) { - case PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED: - $breadcrumb_action1 = _CO_PUBLISHER_SUBMITTED; - $breadcrumb_action2 = _AM_PUBLISHER_APPROVING; - $page_title = _AM_PUBLISHER_SUBMITTED_TITLE; - $page_info = _AM_PUBLISHER_SUBMITTED_INFO; - $button_caption = _AM_PUBLISHER_APPROVE; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; + $breadcrumbAction1 = _CO_PUBLISHER_SUBMITTED; + $breadcrumbAction2 = _AM_PUBLISHER_APPROVING; + $pageTitle = _AM_PUBLISHER_SUBMITTED_TITLE; + $pageInfo = _AM_PUBLISHER_SUBMITTED_INFO; + $buttonCaption = _AM_PUBLISHER_APPROVE; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; break; case PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED: - $breadcrumb_action1 = _CO_PUBLISHER_PUBLISHED; - $breadcrumb_action2 = _AM_PUBLISHER_EDITING; - $page_title = _AM_PUBLISHER_PUBLISHEDEDITING; - $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; - $button_caption = _AM_PUBLISHER_MODIFY; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; + $breadcrumbAction1 = _CO_PUBLISHER_PUBLISHED; + $breadcrumbAction2 = _AM_PUBLISHER_EDITING; + $pageTitle = _AM_PUBLISHER_PUBLISHEDEDITING; + $pageInfo = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; + $buttonCaption = _AM_PUBLISHER_MODIFY; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; break; case PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE: - $breadcrumb_action1 = _CO_PUBLISHER_OFFLINE; - $breadcrumb_action2 = _AM_PUBLISHER_EDITING; - $page_title = _AM_PUBLISHER_OFFLINEEDITING; - $page_info = _AM_PUBLISHER_OFFLINEEDITING_INFO; - $button_caption = _AM_PUBLISHER_MODIFY; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE; + $breadcrumbAction1 = _CO_PUBLISHER_OFFLINE; + $breadcrumbAction2 = _AM_PUBLISHER_EDITING; + $pageTitle = _AM_PUBLISHER_OFFLINEEDITING; + $pageInfo = _AM_PUBLISHER_OFFLINEEDITING_INFO; + $buttonCaption = _AM_PUBLISHER_MODIFY; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE; break; case PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED: - $breadcrumb_action1 = _CO_PUBLISHER_REJECTED; - $breadcrumb_action2 = _AM_PUBLISHER_REJECTED; - $page_title = _AM_PUBLISHER_REJECTED_EDIT; - $page_info = _AM_PUBLISHER_REJECTED_EDIT_INFO; - $button_caption = _AM_PUBLISHER_MODIFY; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED; + $breadcrumbAction1 = _CO_PUBLISHER_REJECTED; + $breadcrumbAction2 = _AM_PUBLISHER_REJECTED; + $pageTitle = _AM_PUBLISHER_REJECTED_EDIT; + $pageInfo = _AM_PUBLISHER_REJECTED_EDIT_INFO; + $buttonCaption = _AM_PUBLISHER_MODIFY; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED; break; case PublisherConstantsInterface::PUBLISHER_STATUS_NOTSET: // Then it's a clone... - $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; - $breadcrumb_action2 = _AM_PUBLISHER_CLONE_NEW; - $button_caption = _AM_PUBLISHER_CREATE; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; - $page_title = _AM_PUBLISHER_ITEM_DUPLICATING; - $page_info = _AM_PUBLISHER_ITEM_DUPLICATING_DSC; + $breadcrumbAction1 = _AM_PUBLISHER_ITEMS; + $breadcrumbAction2 = _AM_PUBLISHER_CLONE_NEW; + $buttonCaption = _AM_PUBLISHER_CREATE; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; + $pageTitle = _AM_PUBLISHER_ITEM_DUPLICATING; + $pageInfo = _AM_PUBLISHER_ITEM_DUPLICATING_DSC; break; - case "default" : - default : - $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; - $breadcrumb_action2 = _AM_PUBLISHER_EDITING; - $page_title = _AM_PUBLISHER_PUBLISHEDEDITING; - $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; - $button_caption = _AM_PUBLISHER_MODIFY; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; + case 'default': + default: + $breadcrumbAction1 = _AM_PUBLISHER_ITEMS; + $breadcrumbAction2 = _AM_PUBLISHER_EDITING; + $pageTitle = _AM_PUBLISHER_PUBLISHEDEDITING; + $pageInfo = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; + $buttonCaption = _AM_PUBLISHER_MODIFY; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; break; } - $categoryObj = $itemObj->category(); + $categoryObj = $itemObj->getCategory(); if ($showmenu) { - //publisher_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); + //publisher_adminMenu(2, $breadcrumbAction1 . " > " . $breadcrumbAction2); } echo "
\n"; - publisherOpenCollapsableBar('edititemtable', 'edititemicon', $page_title, $page_info); + publisherOpenCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo); if ($clone) { echo "
"; echo "itemid() . "'\" value='" . _AM_PUBLISHER_CLONE_ITEM . "'>  "; - echo "
"; + echo ''; } } else { // there's no parameter, so we're adding an item - $itemObj = $publisher->getHandler('item')->create(); + $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVarsFromRequest(); - $categoryObj = $publisher->getHandler('category')->create(); - $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; - $breadcrumb_action2 = _AM_PUBLISHER_CREATINGNEW; - $button_caption = _AM_PUBLISHER_CREATE; - $new_status = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; + $categoryObj =& $publisher->getHandler('category')->create(); + $breadcrumbAction1 = _AM_PUBLISHER_ITEMS; + $breadcrumbAction2 = _AM_PUBLISHER_CREATINGNEW; + $buttonCaption = _AM_PUBLISHER_CREATE; + $newStatus = PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED; if ($showmenu) { - //publisher_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); + //publisher_adminMenu(2, $breadcrumbAction1 . " > " . $breadcrumbAction2); } $categoryObj->setVar('categoryid', XoopsRequest::getInt('categoryid', 0, 'GET')); @@ -505,6 +504,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) } $sform = $itemObj->getForm(_AM_PUBLISHER_ITEMS); + $sform->assign($formTpl); $formTpl->display('db:publisher_submit.tpl'); @@ -514,39 +514,39 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $dir = publisherGetUploadDir(true, 'content'); - if (!preg_match('/777/i', decoct(fileperms($dir)))) { - echo "

" . _AM_PUBLISHER_PERMERROR . "

"; + if (false !== strpos(decoct(fileperms($dir)), '755')) { + echo "

" . _AM_PUBLISHER_PERMERROR . '

'; } // Upload File echo "
"; echo ""; - echo ""; + echo "'; echo ""; echo ""; - echo ""; - echo "
" . _AM_PUBLISHER_UPLOAD_FILE . "
" . _AM_PUBLISHER_UPLOAD_FILE . '
" . _AM_PUBLISHER_SEARCH_PW . "
"; - echo "
"; + echo ""; + echo ''; + echo ''; // Delete File - $form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php"); + $form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); - $pWrap_select = new XoopsFormSelect(publisherGetUploadDir(true, 'content'), "address"); + $pWrapSelect = new XoopsFormSelect(publisherGetUploadDir(true, 'content'), 'address'); $folder = dir($dir); while (($file = $folder->read()) !== false) { - if ($file != "." && $file != "..") { - $pWrap_select->addOption($file, $file); + if ($file !== '.' && $file !== '..') { + $pWrapSelect->addOption($file, $file); } } $folder->close(); - $form->addElement($pWrap_select); + $form->addElement($pWrapSelect); - $delfile = "delfile"; + $delfile = 'delfile'; $form->addElement(new XoopsFormHidden('op', $delfile)); - $submit = new XoopsFormButton("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit"); + $submit = new XoopsFormButton('', 'submit', _AM_PUBLISHER_BUTTON_DELETE, 'submit'); $form->addElement($submit); - $form->addElement(new XoopsFormHidden('backto', $publisher_current_page)); + $form->addElement(new XoopsFormHidden('backto', $publisherCurrentPage)); $form->display(); publisherCloseCollapsableBar('pagewraptable', 'pagewrapicon'); diff --git a/publisher/admin/main.php b/publisher/admin/main.php index e3174bfb..029de11e 100644 --- a/publisher/admin/main.php +++ b/publisher/admin/main.php @@ -23,15 +23,15 @@ include_once $GLOBALS['xoops']->path('class/xoopslists.php'); include_once $GLOBALS['xoops']->path('class/pagenav.php'); -$itemid = XoopsRequest::getInt('itemid', 0, 'POST'); +$itemid = XoopsRequest::getInt('itemid', 0, 'POST'); -$pick = XoopsRequest::getInt('pick', XoopsRequest::getInt('pick', 0, 'GET'), 'POST'); +$pick = XoopsRequest::getInt('pick', XoopsRequest::getInt('pick', 0, 'GET'), 'POST'); $statussel = XoopsRequest::getInt('statussel', XoopsRequest::getInt('statussel', 0, 'GET'), 'POST'); -$sortsel = XoopsRequest::getString('sortsel', XoopsRequest::getString('sortsel', 'itemid', 'GET'), 'POST'); -$ordersel = XoopsRequest::getString('ordersel', XoopsRequest::getString('ordersel', 'DESC', 'GET'), 'POST'); +$sortsel = XoopsRequest::getString('sortsel', XoopsRequest::getString('sortsel', 'itemid', 'GET'), 'POST'); +$ordersel = XoopsRequest::getString('ordersel', XoopsRequest::getString('ordersel', 'DESC', 'GET'), 'POST'); $module_id = $publisher->getModule()->mid(); -$gperm_handler = xoops_gethandler('groupperm'); +$gpermHandler =& xoops_getHandler('groupperm'); $groups = ($GLOBALS['xoopsUser']) ? ($GLOBALS['xoopsUser']->getGroups()) : XOOPS_GROUP_ANONYMOUS; // Code for the page @@ -42,47 +42,42 @@ //publisher_adminMenu(0, _AM_PUBLISHER_INDEX); // Total ITEMs -- includes everything on the table -$totalitems = $publisher->getHandler('item')->getItemsCount(); +$totalitems =& $publisher->getHandler('item')->getItemsCount(); // Total categories -$totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1); +$totalcategories =& $publisher->getHandler('category')->getCategoriesCount(-1); // Total submitted ITEMs -$totalsubmitted = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED)); +$totalsubmitted =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED)); // Total published ITEMs -$totalpublished = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED)); +$totalpublished =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED)); // Total offline ITEMs -$totaloffline = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE)); +$totaloffline =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE)); // Total rejected -$totalrejected = $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED)); +$totalrejected =& $publisher->getHandler('item')->getItemsCount(-1, array(PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED)); // Check Path Configuration -if ((publisherGetPathStatus('root', true) < 0) || - (publisherGetPathStatus('images', true) < 0) || - (publisherGetPathStatus('images/category', true) < 0) || - (publisherGetPathStatus('images/item', true) < 0) || - (publisherGetPathStatus('content', true) < 0) -) { +if ((publisherGetPathStatus('root', true) < 0) || (publisherGetPathStatus('images', true) < 0) || (publisherGetPathStatus('images/category', true) < 0) || (publisherGetPathStatus('images/item', true) < 0) || (publisherGetPathStatus('content', true) < 0)) { PublisherUtilities::createDir(); } publisherOpenCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); -echo "
"; +echo '
'; echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
" . _AM_PUBLISHER_TOTALCAT . "" . $totalcategories . "" . _AM_PUBLISHER_TOTALSUBMITTED . "" . $totalsubmitted . "" . _AM_PUBLISHER_TOTALPUBLISHED . "" . $totalpublished . "" . _AM_PUBLISHER_TOTAL_OFFLINE . "" . $totaloffline . "
"; -echo "
"; +echo "" . _AM_PUBLISHER_TOTALCAT . "" . $totalcategories . ''; +echo "" . _AM_PUBLISHER_TOTALSUBMITTED . "" . $totalsubmitted . ''; +echo "" . _AM_PUBLISHER_TOTALPUBLISHED . "" . $totalpublished . ''; +echo "" . _AM_PUBLISHER_TOTAL_OFFLINE . "" . $totaloffline . ''; +echo ''; +echo '
'; echo "
"; echo "  "; echo "  "; -echo "
"; +echo ''; publisherCloseCollapsableBar('inventorytable', 'inventoryicon'); @@ -91,17 +86,22 @@ $showingtxt = ''; $selectedtxt = ''; -$cond = ""; +$cond = ''; $selectedtxt0 = ''; $selectedtxt1 = ''; $selectedtxt2 = ''; $selectedtxt3 = ''; $selectedtxt4 = ''; -$sorttxttitle = ""; -$sorttxtcreated = ""; -$sorttxtweight = ""; -$sorttxtitemid = ""; +$sorttxttitle = ''; +$sorttxtcreated = ''; +$sorttxtweight = ''; +$sorttxtitemid = ''; + +$sorttxthits = ''; +$sorttxtvotes = ''; +$sorttxtcomments = ''; +$sorttxtrating = ''; $ordertxtasc = ''; $ordertxtdesc = ''; @@ -119,7 +119,23 @@ $sorttxtweight = "selected='selected'"; break; - default : + case 'counter': + $sorttxthits = "selected='selected'"; + break; + + case 'rating': + $sorttxtrating = "selected='selected'"; + break; + + case 'votes': + $sorttxtvotes = "selected='selected'"; + break; + + case 'comments': + $sorttxtcomments = "selected='selected'"; + break; + + default: $sorttxtitemid = "selected='selected'"; break; } @@ -129,7 +145,7 @@ $ordertxtasc = "selected='selected'"; break; - default : + default: $ordertxtdesc = "selected='selected'"; break; } @@ -138,35 +154,35 @@ case PublisherConstantsInterface::PUBLISHER_STATUS_ALL: $selectedtxt0 = "selected='selected'"; $caption = _AM_PUBLISHER_ALL; - $cond = ""; + $cond = ''; $status_explaination = _AM_PUBLISHER_ALL_EXP; break; case PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED: $selectedtxt1 = "selected='selected'"; $caption = _CO_PUBLISHER_SUBMITTED; - $cond = " WHERE status = " . PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED . " "; + $cond = ' WHERE status = ' . PublisherConstantsInterface::PUBLISHER_STATUS_SUBMITTED . ' '; $status_explaination = _AM_PUBLISHER_SUBMITTED_EXP; break; case PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED: $selectedtxt2 = "selected='selected'"; $caption = _CO_PUBLISHER_PUBLISHED; - $cond = " WHERE status = " . PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED . " "; + $cond = ' WHERE status = ' . PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED . ' '; $status_explaination = _AM_PUBLISHER_PUBLISHED_EXP; break; case PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE: $selectedtxt3 = "selected='selected'"; $caption = _CO_PUBLISHER_OFFLINE; - $cond = " WHERE status = " . PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE . " "; + $cond = ' WHERE status = ' . PublisherConstantsInterface::PUBLISHER_STATUS_OFFLINE . ' '; $status_explaination = _AM_PUBLISHER_OFFLINE_EXP; break; case PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED: $selectedtxt4 = "selected='selected'"; $caption = _CO_PUBLISHER_REJECTED; - $cond = " WHERE status = " . PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED . " "; + $cond = ' WHERE status = ' . PublisherConstantsInterface::PUBLISHER_STATUS_REJECTED . ' '; $status_explaination = _AM_PUBLISHER_REJECTED_ITEM_EXP; break; } @@ -177,19 +193,25 @@ echo " - + "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo "'; + echo "'; + echo "'; + + echo "'; + echo "'; + echo "'; + echo "'; + echo "'; + + echo "'; + echo "'; + echo ''; } } else { // that is, $numrows = 0, there's no entries yet - echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ''; } echo "
" . _AM_PUBLISHER_SHOWING . " " . $caption . "" . _AM_PUBLISHER_SHOWING . ' ' . $caption . " " . _AM_PUBLISHER_SELECT_SORT . " - " . _AM_PUBLISHER_SELECT_STATUS . " : + ' . _AM_PUBLISHER_SELECT_STATUS . " :
" . $itemsObj[$i]->itemid() . "" . $categoryObj->getCategoryLink() . "" . $itemsObj[$i]->getItemLink() . "" . $itemsObj[$i]->datesub() . "" . $statustxt . " " . $approve . $clone . $modify . $delete . "
" . $itemsObj[$i]->itemid() . '" . $categoryObj->getCategoryLink() . '" . $itemsObj[$i]->getItemLink() . '" . $itemsObj[$i]->getDatesub() . '" . $itemsObj[$i]->weight() . '" . $itemsObj[$i]->counter() . '" . $itemsObj[$i]->rating() . '" . $itemsObj[$i]->votes() . '" . $itemsObj[$i]->comments() . '" . $statustxt . ' " . $approve . $clone . $modify . $delete . '
" . _AM_PUBLISHER_NOITEMSSEL . "
" . _AM_PUBLISHER_NOITEMSSEL . '
\n"; echo "$status_explaination"; diff --git a/publisher/admin/menu.php b/publisher/admin/menu.php index 40c20347..6d41aa9a 100644 --- a/publisher/admin/menu.php +++ b/publisher/admin/menu.php @@ -21,75 +21,80 @@ // defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined"); -$dirname = basename(dirname(__DIR__)); -$moduleHandler = xoops_gethandler('module'); -$module = $moduleHandler->getByDirname($dirname); -$pathIcon32 = $module->getInfo('icons32'); +$dirname = basename(dirname(__DIR__)); +$moduleHandler =& xoops_getHandler('module'); +$module = $moduleHandler->getByDirname($dirname); +$pathIcon32 = $module->getInfo('icons32'); include_once dirname(__DIR__) . '/include/config.php'; xoops_loadLanguage('admin', $dirname); -$i = 0; +$adminmenu = array( + array( + 'title' => _MI_PUBLISHER_ADMENU0, + 'link' => 'admin/index.php', + 'icon' => '../../' . $pathIcon32 . '/home.png'), -// Index -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU0; -$adminmenu[$i]['link'] = "admin/index.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/home.png'; -++$i; - -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU1; -$adminmenu[$i]['link'] = "admin/main.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/manage.png'; -++$i; + array( + 'title' => _MI_PUBLISHER_ADMENU1, + 'link' => 'admin/main.php', + 'icon' => '../../' . $pathIcon32 . '/manage.png'), // Category -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU2; -$adminmenu[$i]['link'] = "admin/category.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/category.png'; -++$i; + array( + 'title' => _MI_PUBLISHER_ADMENU2, + 'link' => 'admin/category.php', + 'icon' => '../../' . $pathIcon32 . '/category.png'), // Items -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU3; -$adminmenu[$i]['link'] = "admin/item.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/content.png'; -++$i; +array( + 'title' => _MI_PUBLISHER_ADMENU3, + 'link' => 'admin/item.php', + 'icon' => '../../' . $pathIcon32 . '/content.png'), // Permissions -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU4; -$adminmenu[$i]['link'] = "admin/permissions.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/permissions.png'; -++$i; + array( + 'title' => _MI_PUBLISHER_ADMENU4, + 'link' => 'admin/permissions.php', + 'icon' => '../../' . $pathIcon32 . '/permissions.png'), // Mimetypes -$adminmenu[$i]['title'] = _MI_PUBLISHER_ADMENU6; -$adminmenu[$i]['link'] = "admin/mimetypes.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/type.png'; -++$i; + array( + 'title' => _MI_PUBLISHER_ADMENU6, + 'link' => 'admin/mimetypes.php', + 'icon' => '../../' . $pathIcon32 . '/type.png'), // Preferences -$adminmenu[$i]['title'] = _PREFERENCES; -$adminmenu[$i]['link'] = "admin/preferences.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/administration.png'; -++$i; +// array( +// 'title' => _PREFERENCES, +// 'link' => 'admin/preferences.php', +// 'icon' => '../../' . $pathIcon32 . '/administration.png'), + /* -$adminmenu[$i]['title'] = _AM_PUBLISHER_COMMENTS; -$adminmenu[$i]['link'] = '../../modules/system/admin.php?fct=comments&module=' . $module->getVar('mid'); -$adminmenu[$i]["icon"] = './assets/images/icon32/folder_txt.png'; -++$i; + //Comments + array( + "title" => _AM_PUBLISHER_COMMENTS, + "link" => '../../modules/system/admin.php?fct=comments&module=' . $module->getVar('mid'), + "icon" => './assets/images/icon32/folder_txt.png'), */ -$adminmenu[$i]['title'] = _AM_PUBLISHER_IMPORT; -$adminmenu[$i]['link'] = "admin/import.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/download.png'; -++$i; - -$adminmenu[$i]['title'] = _AM_PUBLISHER_CLONE; -$adminmenu[$i]['link'] = "admin/clone.php"; -$adminmenu[$i]["icon"] = './assets/images/icon32/editcopy.png'; -++$i; - -$adminmenu[$i]['title'] = _AM_PUBLISHER_ABOUT; -$adminmenu[$i]['link'] = "admin/about.php"; -$adminmenu[$i]["icon"] = '../../' . $pathIcon32 . '/about.png'; -$GLOBALS['xoTheme']->addStylesheet("modules/" . $dirname . "/assets/css/style.css"); +//Import + array( + 'title' => _AM_PUBLISHER_IMPORT, + 'link' => 'admin/import.php', + 'icon' => '../../' . $pathIcon32 . '/download.png'), + +//Clone + array( + 'title' => _AM_PUBLISHER_CLONE, + 'link' => 'admin/clone.php', + 'icon' => './assets/images/icon32/editcopy.png'), + +//About +array( + 'title' => _AM_PUBLISHER_ABOUT, + 'link' => 'admin/about.php', + 'icon' => '../../' . $pathIcon32 . '/about.png')); + +$GLOBALS['xoTheme']->addStylesheet('modules/' . $dirname . '/assets/css/style.css'); diff --git a/publisher/admin/mimetypes.php b/publisher/admin/mimetypes.php index c0f35aff..1ce49ba1 100644 --- a/publisher/admin/mimetypes.php +++ b/publisher/admin/mimetypes.php @@ -35,11 +35,12 @@ $start = XoopsRequest::getInt('start', 0, 'GET'); $limit = XoopsRequest::getInt('limit', XoopsRequest::getInt('limit', 15, 'GET'), 'POST'); -$aSortBy = array('mime_id' => _AM_PUBLISHER_MIME_ID, - 'mime_name' => _AM_PUBLISHER_MIME_NAME, - 'mime_ext' => _AM_PUBLISHER_MIME_EXT, - 'mime_admin' => _AM_PUBLISHER_MIME_ADMIN, - 'mime_user' => _AM_PUBLISHER_MIME_USER); +$aSortBy = array( + 'mime_id' => _AM_PUBLISHER_MIME_ID, + 'mime_name' => _AM_PUBLISHER_MIME_NAME, + 'mime_ext' => _AM_PUBLISHER_MIME_EXT, + 'mime_admin' => _AM_PUBLISHER_MIME_ADMIN, + 'mime_user' => _AM_PUBLISHER_MIME_USER); $aOrderBy = array('ASC' => _AM_PUBLISHER_TEXT_ASCENDING, 'DESC' => _AM_PUBLISHER_TEXT_DESCENDING); $aLimitBy = array('10' => 10, '15' => 15, '20' => 20, '25' => 25, '50' => 50, '100' => 100); $aSearchBy = array('mime_id' => _AM_PUBLISHER_MIME_ID, 'mime_name' => _AM_PUBLISHER_MIME_NAME, 'mime_ext' => _AM_PUBLISHER_MIME_EXT); @@ -49,35 +50,35 @@ $op = XoopsRequest::getString('op', 'default', 'GET'); switch ($op) { - case "add": + case 'add': PublisherMimetypesUtilities::add(); break; - case "delete": + case 'delete': delete(); break; - case "edit": + case 'edit': PublisherMimetypesUtilities::edit(); break; - case "search": + case 'search': PublisherMimetypesUtilities::search(); break; - case "updateMimeValue": + case 'updateMimeValue': PublisherMimetypesUtilities::updateMimeValue(); break; - case "clearAddSession": + case 'clearAddSession': PublisherMimetypesUtilities::clearAddSession(); break; - case "clearEditSession": + case 'clearEditSession': PublisherMimetypesUtilities::clearEditSession(); break; - case "manage": + case 'manage': default: PublisherMimetypesUtilities::manage(); break; @@ -88,10 +89,9 @@ */ class PublisherMimetypesUtilities { - public static function add() { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); global $limit, $start; $error = array(); if (!(XoopsRequest::getString('add_mime', '', 'POST'))) { @@ -100,59 +100,59 @@ public static function add() publisherOpenCollapsableBar('mimemaddtable', 'mimeaddicon', _AM_PUBLISHER_MIME_ADD_TITLE); - $session = PublisherSession::getInstance(); - $mime_type = $session->get('publisher_addMime'); - $mime_errors = $session->get('publisher_addMimeErr'); + $session =& PublisherSession::getInstance(); + $mimeType = $session->get('publisher_addMime'); + $mimeErrors = $session->get('publisher_addMimeErr'); //Display any form errors - if (!$mime_errors === false) { - publisherRenderErrors($mime_errors, publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'clearAddSession'))); + if (!$mimeErrors === false) { + publisherRenderErrors($mimeErrors, publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'clearAddSession'))); } - if ($mime_type === false) { - $mime_ext = ''; - $mime_name = ''; - $mime_types = ''; - $mime_admin = 1; - $mime_user = 1; + if ($mimeType === false) { + $mimeExt = ''; + $mimeName = ''; + $mimeTypes = ''; + $mimeAdmin = 1; + $mimeUser = 1; } else { - $mime_ext = $mime_type['mime_ext']; - $mime_name = $mime_type['mime_name']; - $mime_types = $mime_type['mime_types']; - $mime_admin = $mime_type['mime_admin']; - $mime_user = $mime_type['mime_user']; + $mimeExt = $mimeType['mime_ext']; + $mimeName = $mimeType['mime_name']; + $mimeTypes = $mimeType['mime_types']; + $mimeAdmin = $mimeType['mime_admin']; + $mimeUser = $mimeType['mime_user']; } // Display add form echo "
"; echo ""; - echo ""; + echo "'; echo " - + "; echo " - + "; echo " - + "; echo " - "; + '; echo " - "; + '; echo ""; - echo "
" . _AM_PUBLISHER_MIME_CREATEF . "
" . _AM_PUBLISHER_MIME_CREATEF . '
" . _AM_PUBLISHER_MIME_EXTF . "
" . _AM_PUBLISHER_MIME_NAMEF . "
" . _AM_PUBLISHER_MIME_TYPEF . "
" . _AM_PUBLISHER_MIME_ADMINF . " "; - echo "" . _YES; - echo "" . _NO . " + echo "' . _YES; + echo "' . _NO . '
" . _AM_PUBLISHER_MIME_USERF . " "; - echo "" . _YES; - echo "" . _NO . " + echo "' . _YES; + echo "' . _NO . '
" . _AM_PUBLISHER_MIME_MANDATORY_FIELD . " @@ -160,112 +160,112 @@ public static function add()
"; + echo ''; // end of add form // Find new mimetypes table echo "
"; echo ""; - echo ""; + echo "'; echo ""; - echo "
" . _AM_PUBLISHER_MIME_FINDMIMETYPE . "
" . _AM_PUBLISHER_MIME_FINDMIMETYPE . '
"; + echo ''; publisherCloseCollapsableBar('mimeaddtable', 'mimeaddicon'); xoops_cp_footer(); } else { - $has_errors = false; - $mime_ext = XoopsRequest::getString('mime_ext', '', 'POST'); - $mime_name = XoopsRequest::getString('mime_name', '', 'POST'); - $mime_types = XoopsRequest::getText('mime_types', '', 'POST'); - $mime_admin = XoopsRequest::getInt('mime_admin', 0, 'POST'); - $mime_user = XoopsRequest::getInt('mime_user', 0, 'POST'); + $hasErrors = false; + $mimeExt = XoopsRequest::getString('mime_ext', '', 'POST'); + $mimeName = XoopsRequest::getString('mime_name', '', 'POST'); + $mimeTypes = XoopsRequest::getText('mime_types', '', 'POST'); + $mimeAdmin = XoopsRequest::getInt('mime_admin', 0, 'POST'); + $mimeUser = XoopsRequest::getInt('mime_user', 0, 'POST'); //Validate Mimetype entry - if (strlen(trim($mime_ext)) == 0) { - $has_errors = true; + if ('' === (trim($mimeExt))) { + $hasErrors = true; $error['mime_ext'][] = _AM_PUBLISHER_VALID_ERR_MIME_EXT; } - if (strlen(trim($mime_name)) == 0) { - $has_errors = true; + if ('' === (trim($mimeName))) { + $hasErrors = true; $error['mime_name'][] = _AM_PUBLISHER_VALID_ERR_MIME_NAME; } - if (strlen(trim($mime_types)) == 0) { - $has_errors = true; + if ('' === (trim($mimeTypes))) { + $hasErrors = true; $error['mime_types'][] = _AM_PUBLISHER_VALID_ERR_MIME_TYPES; } - if ($has_errors) { - $session = PublisherSession::getInstance(); + if ($hasErrors) { + $session =& PublisherSession::getInstance(); $mime = array(); - $mime['mime_ext'] = $mime_ext; - $mime['mime_name'] = $mime_name; - $mime['mime_types'] = $mime_types; - $mime['mime_admin'] = $mime_admin; - $mime['mime_user'] = $mime_user; + $mime['mime_ext'] = $mimeExt; + $mime['mime_name'] = $mimeName; + $mime['mime_types'] = $mimeTypes; + $mime['mime_admin'] = $mimeAdmin; + $mime['mime_user'] = $mimeUser; $session->set('publisher_addMime', $mime); $session->set('publisher_addMimeErr', $error); header('Location: ' . publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'add'), false)); } - $mimetype = $publisher->getHandler('mimetype')->create(); - $mimetype->setVar('mime_ext', $mime_ext); - $mimetype->setVar('mime_name', $mime_name); - $mimetype->setVar('mime_types', $mime_types); - $mimetype->setVar('mime_admin', $mime_admin); - $mimetype->setVar('mime_user', $mime_user); + $mimeType =& $publisher->getHandler('mimetype')->create(); + $mimeType->setVar('mime_ext', $mimeExt); + $mimeType->setVar('mime_name', $mimeName); + $mimeType->setVar('mime_types', $mimeTypes); + $mimeType->setVar('mime_admin', $mimeAdmin); + $mimeType->setVar('mime_user', $mimeUser); - if (!$publisher->getHandler('mimetype')->insert($mimetype)) { + if (!$publisher->getHandler('mimetype')->insert($mimeType)) { redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_ADD_MIME_ERROR); } else { self::clearAddSessionVars(); - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); } } } public static function delete() { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); global $start, $limit; - $mime_id = 0; + $mimeId = 0; if (0 == XoopsRequest::getInt('id', 0, 'GET')) { - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php", 3, _AM_PUBLISHER_MESSAGE_NO_ID); + redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, _AM_PUBLISHER_MESSAGE_NO_ID); } else { - $mime_id = XoopsRequest::getInt('id', 0, 'GET'); + $mimeId = XoopsRequest::getInt('id', 0, 'GET'); } - $mimetype = $publisher->getHandler('mimetype')->get($mime_id); // Retrieve mimetype object - if (!$publisher->getHandler('mimetype')->delete($mimetype, true)) { - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&id=$mime_id&limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); + $mimeType =& $publisher->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object + if (!$publisher->getHandler('mimetype')->delete($mimeType, true)) { + redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&id=$mimeId&limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); } else { - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); } } public static function edit() { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); global $start, $limit; - $mime_id = 0; + $mimeId = 0; $error = array(); - $has_errors = false; + $hasErrors = false; if (0 == XoopsRequest::getInt('id', 0, 'GET')) { - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php", 3, _AM_PUBLISHER_MESSAGE_NO_ID); + redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, _AM_PUBLISHER_MESSAGE_NO_ID); } else { - $mime_id = XoopsRequest::getInt('id', 0, 'GET'); + $mimeId = XoopsRequest::getInt('id', 0, 'GET'); } - $mimetype = $publisher->getHandler('mimetype')->get($mime_id); // Retrieve mimetype object + $mimeType =& $publisher->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object if (!(XoopsRequest::getString('edit_mime', '', 'POST'))) { - $session = PublisherSession::getInstance(); - $mime_type = $session->get("publisher_editMime_$mime_id"); - $mime_errors = $session->get("publisher_editMimeErr_$mime_id"); + $session =& PublisherSession::getInstance(); + $mimeType = $session->get('publisher_editMime_' . $mimeId); + $mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId); // Display header publisherCpHeader(); @@ -274,56 +274,56 @@ public static function edit() publisherOpenCollapsableBar('mimemedittable', 'mimeediticon', _AM_PUBLISHER_MIME_EDIT_TITLE); //Display any form errors - if (!$mime_errors === false) { - publisherRenderErrors($mime_errors, publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'clearEditSession', 'id' => $mime_id))); + if (!$mimeErrors === false) { + publisherRenderErrors($mimeErrors, publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'clearEditSession', 'id' => $mimeId))); } - if ($mime_type === false) { - $mime_ext = $mimetype->getVar('mime_ext'); - $mime_name = $mimetype->getVar('mime_name', 'e'); - $mime_types = $mimetype->getVar('mime_types', 'e'); - $mime_admin = $mimetype->getVar('mime_admin'); - $mime_user = $mimetype->getVar('mime_user'); + if ($mimeType === false) { + $mimeExt = $mimeType->getVar('mime_ext'); + $mimeName = $mimeType->getVar('mime_name', 'e'); + $mimeTypes = $mimeType->getVar('mime_types', 'e'); + $mimeAdmin = $mimeType->getVar('mime_admin'); + $mimeUser = $mimeType->getVar('mime_user'); } else { - $mime_ext = $mime_type['mime_ext']; - $mime_name = $mime_type['mime_name']; - $mime_types = $mime_type['mime_types']; - $mime_admin = $mime_type['mime_admin']; - $mime_user = $mime_type['mime_user']; + $mimeExt = $mimeType['mime_ext']; + $mimeName = $mimeType['mime_name']; + $mimeTypes = $mimeType['mime_types']; + $mimeAdmin = $mimeType['mime_admin']; + $mimeUser = $mimeType['mime_user']; } // Display edit form - echo "
"; + echo ""; echo ""; echo ""; echo ""; - echo ""; + echo "'; echo " - + "; echo " - + "; echo " - + "; echo " - "; + '; echo " - "; + '; echo ""; - echo "
" . _AM_PUBLISHER_MIME_MODIFYF . "
" . _AM_PUBLISHER_MIME_MODIFYF . '
" . _AM_PUBLISHER_MIME_EXTF . "
" . _AM_PUBLISHER_MIME_NAMEF . "
" . _AM_PUBLISHER_MIME_TYPEF . "
" . _AM_PUBLISHER_MIME_ADMINF . " - " . _YES . " - " . _NO . " + ' . _YES . " + ' . _NO . '
" . _AM_PUBLISHER_MIME_USERF . " - " . _YES . " - " . _NO . " + ' . _YES . " + ' . _NO . '
@@ -331,123 +331,123 @@ public static function edit()
"; + echo ''; // end of edit form publisherCloseCollapsableBar('mimeedittable', 'mimeediticon'); xoops_cp_footer(); } else { - $mime_admin = 0; - $mime_user = 0; + $mimeAdmin = 0; + $mimeUser = 0; if (1 == XoopsRequest::getInt('mime_admin', 0, 'POST')) { - $mime_admin = 1; + $mimeAdmin = 1; } if (1 == XoopsRequest::getInt('mime_user', 0, 'POST')) { - $mime_user = 1; + $mimeUser = 1; } //Validate Mimetype entry - if (strlen(XoopsRequest::getString('mime_ext', '', 'POST')) == 0) { - $has_errors = true; + if ('' === (XoopsRequest::getString('mime_ext', '', 'POST'))) { + $hasErrors = true; $error['mime_ext'][] = _AM_PUBLISHER_VALID_ERR_MIME_EXT; } - if (strlen(XoopsRequest::getString('mime_name', '', 'POST')) == 0) { - $has_errors = true; + if ('' === (XoopsRequest::getString('mime_name', '', 'POST'))) { + $hasErrors = true; $error['mime_name'][] = _AM_PUBLISHER_VALID_ERR_MIME_NAME; } - if (strlen(XoopsRequest::getString('mime_types', '', 'POST')) == 0) { - $has_errors = true; + if ('' === (XoopsRequest::getString('mime_types', '', 'POST'))) { + $hasErrors = true; $error['mime_types'][] = _AM_PUBLISHER_VALID_ERR_MIME_TYPES; } - if ($has_errors) { - $session = PublisherSession::getInstance(); + if ($hasErrors) { + $session =& PublisherSession::getInstance(); $mime = array(); $mime['mime_ext'] = XoopsRequest::getString('mime_ext', '', 'POST'); $mime['mime_name'] = XoopsRequest::getString('mime_name', '', 'POST'); $mime['mime_types'] = XoopsRequest::getText('mime_types', '', 'POST'); - $mime['mime_admin'] = $mime_admin; - $mime['mime_user'] = $mime_user; - $session->set('publisher_editMime_' . $mime_id, $mime); - $session->set('publisher_editMimeErr_' . $mime_id, $error); - header('Location: ' . publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'edit', 'id' => $mime_id), false)); + $mime['mime_admin'] = $mimeAdmin; + $mime['mime_user'] = $mimeUser; + $session->set('publisher_editMime_' . $mimeId, $mime); + $session->set('publisher_editMimeErr_' . $mimeId, $error); + header('Location: ' . publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'edit', 'id' => $mimeId), false)); } - $mimetype->setVar('mime_ext', XoopsRequest::getString('mime_ext', '', 'POST')); - $mimetype->setVar('mime_name', XoopsRequest::getString('mime_name', '', 'POST')); - $mimetype->setVar('mime_types', XoopsRequest::getText('mime_types', '', 'POST')); - $mimetype->setVar('mime_admin', $mime_admin); - $mimetype->setVar('mime_user', $mime_user); + $mimeType->setVar('mime_ext', XoopsRequest::getString('mime_ext', '', 'POST')); + $mimeType->setVar('mime_name', XoopsRequest::getString('mime_name', '', 'POST')); + $mimeType->setVar('mime_types', XoopsRequest::getText('mime_types', '', 'POST')); + $mimeType->setVar('mime_admin', $mimeAdmin); + $mimeType->setVar('mime_user', $mimeUser); - if (!$publisher->getHandler('mimetype')->insert($mimetype, true)) { - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&id=$mime_id", 3, _AM_PUBLISHER_MESSAGE_EDIT_MIME_ERROR); + if (!$publisher->getHandler('mimetype')->insert($mimeType, true)) { + redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&id=$mimeId", 3, _AM_PUBLISHER_MESSAGE_EDIT_MIME_ERROR); } else { - self::clearEditSessionVars($mime_id); - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); + self::clearEditSessionVars($mimeId); + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); } } } public static function manage() { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); global $imagearray, $start, $limit, $aSortBy, $aOrderBy, $aLimitBy, $aSearchBy; if ((XoopsRequest::getString('deleteMimes', '', 'POST'))) { - $aMimes = XoopsRequest::getArray('mimes', array(), "POST"); + $aMimes = XoopsRequest::getArray('mimes', array(), 'POST'); - $crit = new Criteria('mime_id', "(" . implode($aMimes, ',') . ")", "IN"); + $crit = new Criteria('mime_id', '(' . implode($aMimes, ',') . ')', 'IN'); if ($publisher->getHandler('mimetype')->deleteAll($crit)) { - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); } else { redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); } } if ((XoopsRequest::getString('add_mime', '', 'POST'))) { -// header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit"); + // header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit"); redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit", 3, _AM_PUBLISHER_MIME_CREATEF); -// exit(); + // exit(); } if ((XoopsRequest::getString('mime_search', '', 'POST'))) { -// header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search"); - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search", 3, _AM_PUBLISHER_MIME_SEARCH); -// exit(); + // header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search"); + redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php?op=search', 3, _AM_PUBLISHER_MIME_SEARCH); + // exit(); } publisherCpHeader(); ////publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); publisherOpenCollapsableBar('mimemanagetable', 'mimemanageicon', _AM_PUBLISHER_MIME_MANAGE_TITLE, _AM_PUBLISHER_MIME_INFOTEXT); - $crit = new CriteriaCompo(); + $crit = new CriteriaCompo(); $order = XoopsRequest::getString('order', 'ASC', 'POST'); - $sort = XoopsRequest::getString('sort', 'mime_ext', 'POST'); + $sort = XoopsRequest::getString('sort', 'mime_ext', 'POST'); $crit->setOrder($order); $crit->setStart($start); $crit->setLimit($limit); $crit->setSort($sort); - $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit); // Retrieve a list of all mimetypes - $mime_count = $publisher->getHandler('mimetype')->getCount(); - $nav = new XoopsPageNav($mime_count, $limit, $start, 'start', "op=manage&limit=$limit"); + $mimetypes =& $publisher->getHandler('mimetype')->getObjects($crit); // Retrieve a list of all mimetypes + $mimeCount =& $publisher->getHandler('mimetype')->getCount(); + $nav = new XoopsPageNav($mimeCount, $limit, $start, 'start', "op=manage&limit=$limit"); echo ""; echo ""; + echo '
"; echo "
"; - echo ""; - echo ""; - echo ""; + echo '
" . _AM_PUBLISHER_TEXT_SEARCH_BY . "
'; + echo ''; + echo "'; echo ""; - echo ""; + echo ''; + echo "'; echo ""; echo ""; - echo "
" . _AM_PUBLISHER_TEXT_SEARCH_BY . '" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . '
'; echo ""; echo "
"; @@ -459,18 +459,18 @@ public static function manage() echo ""; } unset($value, $text); - echo " + echo '     - " . _AM_PUBLISHER_TEXT_ORDER_BY . " + ' . _AM_PUBLISHER_TEXT_ORDER_BY . " + echo '     - " . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . " + ' . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . " "; - echo ""; - echo ""; - echo "" . _AM_PUBLISHER_MIME_MANAGE_TITLE . ""; + echo ''; + echo ''; + echo "" . _AM_PUBLISHER_MIME_MANAGE_TITLE . ''; echo " - " . _AM_PUBLISHER_MIME_ID . " - " . _AM_PUBLISHER_MIME_NAME . " + " . _AM_PUBLISHER_MIME_ID . ' + ' . _AM_PUBLISHER_MIME_NAME . " " . _AM_PUBLISHER_MIME_EXT . " " . _AM_PUBLISHER_MIME_ADMIN . " " . _AM_PUBLISHER_MIME_USER . " - " . _AM_PUBLISHER_MINDEX_ACTION . " - "; + " . _AM_PUBLISHER_MINDEX_ACTION . ' + '; foreach ($mimetypes as $mime) { echo " - " . $mime->getVar('mime_id') . " - " . $mime->getVar('mime_name') . " + " . $mime->getVar('mime_id') . ' + ' . $mime->getVar('mime_name') . " " . $mime->getVar('mime_ext') . " - + getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . " - + getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . " - " . $imagearray['editimg'] . " - " . $imagearray['deleteimg'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['editimg'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['deleteimg'] . ' - "; + '; } - unset($mime); +// unset($mime); echo " " . _AM_PUBLISHER_MIME_FINDMIMETYPE . " @@ -520,8 +520,8 @@ public static function manage() "; - echo ""; - echo "
" . $nav->renderNav() . "
"; + echo ''; + echo "
" . $nav->renderNav() . '
'; publisherCloseCollapsableBar('mimemanagetable', 'mimemanageicon'); @@ -530,28 +530,28 @@ public static function manage() public static function search() { - $publisher = PublisherPublisher::getInstance(); + $publisher =& PublisherPublisher::getInstance(); global $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy; if ((XoopsRequest::getString('deleteMimes', '', 'POST'))) { - $aMimes = XoopsRequest::getArray('mimes', array(), "POST"); + $aMimes = XoopsRequest::getArray('mimes', array(), 'POST'); - $crit = new Criteria('mime_id', "(" . implode($aMimes, ',') . ")", "IN"); + $crit = new Criteria('mime_id', '(' . implode($aMimes, ',') . ')', 'IN'); if ($publisher->getHandler('mimetype')->deleteAll($crit)) { - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); } else { redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); } } if ((XoopsRequest::getString('add_mime', '', 'POST'))) { -// header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit"); + // header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit"); redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit", 3, _AM_PUBLISHER_MIME_CREATEF); -// exit(); + // exit(); } - $order = XoopsRequest::getString('order', 'ASC', 'POST'); - $sort = XoopsRequest::getString('sort', 'mime_name', 'POST'); + $order = XoopsRequest::getString('order', 'ASC', 'POST'); + $sort = XoopsRequest::getString('sort', 'mime_name', 'POST'); publisherCpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); @@ -561,7 +561,7 @@ public static function search() if (!(XoopsRequest::getString('mime_search', '', 'POST'))) { echo ""; echo ""; - echo ""; + echo "'; echo " - "; + '; echo ""; - echo "
" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "
" . _AM_PUBLISHER_TEXT_SEARCH_MIME . '
" . _AM_PUBLISHER_TEXT_SEARCH_BY . " + echo '
" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . " @@ -582,39 +582,39 @@ public static function search()
"; + echo ''; } else { - $search_field = XoopsRequest::getString('search_by', '', 'POST'); - $search_text = XoopsRequest::getString('search_text', '', 'POST'); + $searchField = XoopsRequest::getString('search_by', '', 'POST'); + $searchText = XoopsRequest::getString('search_text', '', 'POST'); - $crit = new Criteria($search_field, "%$search_text%", 'LIKE'); + $crit = new Criteria($searchField, "%$searchText%", 'LIKE'); $crit->setSort($sort); $crit->setOrder($order); $crit->setLimit($limit); $crit->setStart($start); - $mime_count = $publisher->getHandler('mimetype')->getCount($crit); - $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit); - $nav = new XoopsPageNav($mime_count, $limit, $start, 'start', "op=search&limit=$limit&order=$order&sort=$sort&mime_search=1&search_by=$search_field&search_text=$search_text"); + $mimeCount =& $publisher->getHandler('mimetype')->getCount($crit); + $mimetypes =& $publisher->getHandler('mimetype')->getObjects($crit); + $nav = new XoopsPageNav($mimeCount, $limit, $start, 'start', "op=search&limit=$limit&order=$order&sort=$sort&mime_search=1&search_by=$searchField&search_text=$searchText"); // Display results echo ''; echo ""; echo ""; + echo '
"; echo "
"; - echo ""; - echo ""; - echo ""; + echo '
" . _AM_PUBLISHER_TEXT_SEARCH_BY . "
'; + echo ''; + echo "'; echo ""; - echo ""; - echo ""; + echo ''; + echo "'; + echo ""; echo ""; - echo "
" . _AM_PUBLISHER_TEXT_SEARCH_BY . '" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . '
'; echo ""; echo "
"; @@ -626,18 +626,18 @@ public static function search() echo ""; } unset($value, $text); - echo " + echo '     - " . _AM_PUBLISHER_TEXT_ORDER_BY . " + ' . _AM_PUBLISHER_TEXT_ORDER_BY . " + echo '     - " . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . " + ' . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . " - - + + "; - echo ""; - echo ""; + echo ''; + echo ''; if (count($mimetypes) > 0) { - echo "" . _AM_PUBLISHER_TEXT_SEARCH_MIME . ""; + echo "" . _AM_PUBLISHER_TEXT_SEARCH_MIME . ''; echo " - " . _AM_PUBLISHER_MIME_ID . " - " . _AM_PUBLISHER_MIME_NAME . " + " . _AM_PUBLISHER_MIME_ID . ' + ' . _AM_PUBLISHER_MIME_NAME . " " . _AM_PUBLISHER_MIME_EXT . " " . _AM_PUBLISHER_MIME_ADMIN . " " . _AM_PUBLISHER_MIME_USER . " - " . _AM_PUBLISHER_MINDEX_ACTION . " - "; + " . _AM_PUBLISHER_MINDEX_ACTION . ' + '; foreach ($mimetypes as $mime) { echo " - " . $mime->getVar('mime_id') . " - " . $mime->getVar('mime_name') . " + " . $mime->getVar('mime_id') . ' + ' . $mime->getVar('mime_name') . " " . $mime->getVar('mime_ext') . " - + getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . " - + getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . " - " . $imagearray['editimg'] . " - " . $imagearray['deleteimg'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['editimg'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['deleteimg'] . ' - "; + '; } - unset($mime); +// unset($mime); echo " " . _AM_PUBLISHER_MIME_FINDMIMETYPE . " @@ -692,13 +692,13 @@ public static function search() "; } else { - echo "" . _AM_PUBLISHER_TEXT_SEARCH_MIME . ""; + echo '' . _AM_PUBLISHER_TEXT_SEARCH_MIME . ''; echo " - " . _AM_PUBLISHER_TEXT_NO_RECORDS . " - "; + " . _AM_PUBLISHER_TEXT_NO_RECORDS . ' + '; } - echo ""; - echo ""; + echo ''; + echo "'; } publisherCloseCollapsableBar('mimesearchtable', 'mimesearchicon'); xoops_cp_footer(); @@ -706,56 +706,56 @@ public static function search() public static function updateMimeValue() { - $mime_id = 0; - $publisher = PublisherPublisher::getInstance(); + $mimeId = 0; + $publisher =& PublisherPublisher::getInstance(); - $limit = XoopsRequest::getInt('limit', 0, 'GET'); - $start = XoopsRequest::getInt('start', 0, 'GET'); + $limit = XoopsRequest::getInt('limit', 0, 'GET'); + $start = XoopsRequest::getInt('start', 0, 'GET'); if (!(XoopsRequest::getString('id', '', 'GET'))) { - redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php", 3, _AM_PUBLISHER_MESSAGE_NO_ID); + redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, _AM_PUBLISHER_MESSAGE_NO_ID); } else { - $mime_id = XoopsRequest::getInt('id', 0, 'GET'); + $mimeId = XoopsRequest::getInt('id', 0, 'GET'); } - $mimetype = $publisher->getHandler('mimetype')->get($mime_id); + $mimeType =& $publisher->getHandler('mimetype')->get($mimeId); - if (($mime_admin = XoopsRequest::getString('mime_admin', '', 'GET'))) { -// $mime_admin = XoopsRequest::getInt('mime_admin', 0, 'GET'); - $mime_admin = self::changeMimeValue($mime_admin); - $mimetype->setVar('mime_admin', $mime_admin); + if (($mimeAdmin = XoopsRequest::getString('mime_admin', '', 'GET'))) { + // $mimeAdmin = XoopsRequest::getInt('mime_admin', 0, 'GET'); + $mimeAdmin = self::changeMimeValue($mimeAdmin); + $mimeType->setVar('mime_admin', $mimeAdmin); } - if (($mime_user = XoopsRequest::getString('mime_user', '', 'GET'))) { -// $mime_user = XoopsRequest::getInt('mime_user', 0, 'GET'); - $mime_user = self::changeMimeValue($mime_user); - $mimetype->setVar('mime_user', $mime_user); + if (($mimeUser = XoopsRequest::getString('mime_user', '', 'GET'))) { + // $mimeUser = XoopsRequest::getInt('mime_user', 0, 'GET'); + $mimeUser = self::changeMimeValue($mimeUser); + $mimeType->setVar('mime_user', $mimeUser); } - if ($publisher->getHandler('mimetype')->insert($mimetype, true)) { - header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); + if ($publisher->getHandler('mimetype')->insert($mimeType, true)) { + header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); } else { redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3); } } /** - * @param $mime_value + * @param $mimeValue * * @return int */ - protected static function changeMimeValue($mime_value) + protected static function changeMimeValue($mimeValue) { - if ($mime_value == 1) { - $mime_value = 0; + if ($mimeValue == 1) { + $mimeValue = 0; } else { - $mime_value = 1; + $mimeValue = 1; } - return $mime_value; + return $mimeValue; } protected static function clearAddSessionVars() { - $session = PublisherSession::getInstance(); + $session =& PublisherSession::getInstance(); $session->del('publisher_addMime'); $session->del('publisher_addMimeErr'); } @@ -772,7 +772,7 @@ public static function clearAddSession() public static function clearEditSessionVars($id) { $id = (int)($id); - $session = PublisherSession::getInstance(); + $session =& PublisherSession::getInstance(); $session->del("publisher_editMime_$id"); $session->del("publisher_editMimeErr_$id"); } diff --git a/publisher/admin/pagewrap.php b/publisher/admin/pagewrap.php index 4fd09864..053e5c30 100644 --- a/publisher/admin/pagewrap.php +++ b/publisher/admin/pagewrap.php @@ -28,35 +28,35 @@ $dir = publisherGetUploadDir(true, 'content'); -if (!preg_match('/777/i', decoct(fileperms($dir)))) { - echo "

" . _AM_PUBLISHER_PERMERROR . "

"; +if (false !== strpos(decoct(fileperms($dir)), '777')) { + echo "

" . _AM_PUBLISHER_PERMERROR . '

'; } // Upload File echo ""; echo ""; -echo ""; +echo "'; echo ""; echo ""; -echo "
" . _AM_PUBLISHER_UPLOAD_FILE . "
" . _AM_PUBLISHER_UPLOAD_FILE . '
" . _AM_PUBLISHER_SEARCH . "
"; -echo "
"; +echo ''; +echo ''; // Delete File -$form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php"); +$form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); -$pWrap_select = new XoopsFormSelect(publisherGetUploadDir(true, 'content'), "address"); +$pWrapSelect = new XoopsFormSelect(publisherGetUploadDir(true, 'content'), 'address'); $folder = dir($dir); while ($file == $folder->read()) { - if ($file != "." && $file != "..") { - $pWrap_select->addOption($file, $file); + if ($file !== '.' && $file !== '..') { + $pWrapSelect->addOption($file, $file); } } $folder->close(); -$form->addElement($pWrap_select); +$form->addElement($pWrapSelect); -$delfile = "delfile"; +$delfile = 'delfile'; $form->addElement(new XoopsFormHidden('op', $delfile)); -$submit = new XoopsFormButton("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit"); +$submit = new XoopsFormButton('', 'submit', _AM_PUBLISHER_BUTTON_DELETE, 'submit'); $form->addElement($submit); $form->display(); diff --git a/publisher/admin/permissions.php b/publisher/admin/permissions.php index 32a354ce..6abca1cf 100644 --- a/publisher/admin/permissions.php +++ b/publisher/admin/permissions.php @@ -31,9 +31,9 @@ $block_view = array(); publisherOpenCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS); -$result_view = $GLOBALS['xoopsDB']->query("SELECT categoryid, name FROM " . $GLOBALS['xoopsDB']->prefix("publisher_categories") . " "); +$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix('publisher_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { - $form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "category_read", "", 'admin/permissions.php'); + $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'category_read', '', 'admin/permissions.php'); while (($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view)) !== false) { $form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name'])); } @@ -46,9 +46,9 @@ // Submit Categories permissions echo "
\n"; publisherOpenCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); -$result_view = $GLOBALS['xoopsDB']->query("SELECT categoryid, name FROM " . $GLOBALS['xoopsDB']->prefix("publisher_categories") . " "); +$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix('publisher_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { - $form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "item_submit", "", 'admin/permissions.php'); + $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'item_submit', '', 'admin/permissions.php'); while (($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view)) !== false) { $form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name'])); } @@ -61,9 +61,9 @@ // Moderators Categories permissions echo "
\n"; publisherOpenCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); -$result_view = $GLOBALS['xoopsDB']->query("SELECT categoryid, name FROM " . $GLOBALS['xoopsDB']->prefix("publisher_categories") . " "); +$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix('publisher_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { - $form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "category_moderation", "", 'admin/permissions.php'); + $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php'); while (($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view)) !== false) { $form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name'])); } @@ -101,9 +101,8 @@ PublisherConstantsInterface::PUBLISHER_DOLINEBREAK => _CO_PUBLISHER_DOLINEBREAK, PublisherConstantsInterface::PUBLISHER_NOTIFY => _AM_PUBLISHER_NOTIFY, PublisherConstantsInterface::PUBLISHER_SUBTITLE => _CO_PUBLISHER_SUBTITLE, - PublisherConstantsInterface::PUBLISHER_AUTHOR_ALIAS => _CO_PUBLISHER_AUTHOR_ALIAS -); -$form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "form_view", "", 'admin/permissions.php'); + PublisherConstantsInterface::PUBLISHER_AUTHOR_ALIAS => _CO_PUBLISHER_AUTHOR_ALIAS); +$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'form_view', '', 'admin/permissions.php'); foreach ($form_options as $key => $value) { $form_submit->addItem($key, $value); } @@ -115,7 +114,7 @@ echo "
\n"; publisherOpenCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); $editors = publisherGetEditors(); -$form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "editors", "", 'admin/permissions.php'); +$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'editors', '', 'admin/permissions.php'); foreach ($editors as $key => $value) { $form_submit->addItem($key, $value['title']); } @@ -128,9 +127,8 @@ publisherOpenCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC); $form_options = array( PublisherConstantsInterface::PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH, - PublisherConstantsInterface::PUBLISHER_RATE => _AM_PUBLISHER_RATE -); -$form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "global", "", 'admin/permissions.php'); + PublisherConstantsInterface::PUBLISHER_RATE => _AM_PUBLISHER_RATE); +$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'global', '', 'admin/permissions.php'); foreach ($form_options as $key => $value) { $form_submit->addItem($key, $value); } diff --git a/publisher/admin/preferences.php b/publisher/admin/preferences.php index 961bb957..5b2614e3 100644 --- a/publisher/admin/preferences.php +++ b/publisher/admin/preferences.php @@ -21,7 +21,7 @@ include_once __DIR__ . '/admin_header.php'; -$module = $publisher->getModule(); +$module =& $publisher->getModule(); $mod = $module->mid(); $modname = $module->name(); @@ -40,10 +40,10 @@ $configcat = XoopsRequest::getString('configcat', '', 'GET'); -if ($op == 'showmod') { - $config_handler = xoops_gethandler('config'); +if ($op === 'showmod') { + $configHandler =& xoops_getHandler('config'); - $config = $config_handler->getConfigs(new Criteria('conf_modid', $mod)); + $config = $configHandler->getConfigs(new Criteria('conf_modid', $mod)); $count = count($config); if ($count < 1) { redirect_header($module->getInfo('adminindex'), 1); @@ -52,9 +52,10 @@ $xv_configs = $module->getInfo('config'); $config_cats = $module->getInfo('configcat'); - if (!in_array('others', array_keys($config_cats))) { - $config_cats['others'] = array('name' => _MI_PUBLISHER_CONFCAT_OTHERS, - 'description' => _MI_PUBLISHER_CONFCAT_OTHERS_DSC); + if (!array_key_exists('others', $config_cats)) { + $config_cats['others'] = array( + 'name' => _MI_PUBLISHER_CONFCAT_OTHERS, + 'description' => _MI_PUBLISHER_CONFCAT_OTHERS_DSC); } $cat_others_used = false; @@ -70,10 +71,10 @@ xoops_load('XoopsFormLoader'); - foreach ($config_cats as $form_cat => $info) { - $$form_cat = new XoopsThemeForm($info['name'], 'pref_form_' . $form_cat, 'preferences.php', 'post', true); + foreach ($config_cats as $formCat => $info) { + $$formCat = new XoopsThemeForm($info['name'], 'pref_form_' . $formCat, 'preferences.php', 'post', true); } - unset($form_cat, $info); + unset($formCat, $info); for ($i = 0; $i < $count; ++$i) { foreach ($xv_configs as $xv_config) { @@ -82,12 +83,12 @@ } } - $form_cat = @$xv_config['category']; - $form_cat = isset($xv_config['category']) ? $xv_config['category'] : ''; + $formCat = @$xv_config['category']; + $formCat = isset($xv_config['category']) ? $xv_config['category'] : ''; unset($xv_config); - if (!in_array($form_cat, array_keys($config_cats))) { - $form_cat = 'others'; + if (!array_key_exists($formCat, $config_cats)) { + $formCat = 'others'; $cat_others_used = true; } @@ -95,7 +96,7 @@ switch ($config[$i]->getVar('conf_formtype')) { case 'textarea': $myts = MyTextSanitizer::getInstance(); - if ($config[$i]->getVar('conf_valuetype') == 'array') { + if ($config[$i]->getVar('conf_valuetype') === 'array') { // this is exceptional.. only when value type is arrayneed a smarter way for this $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); } else { @@ -104,7 +105,7 @@ break; case 'select': $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); + $options = $configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); $opcount = count($options); for ($j = 0; $j < $opcount; ++$j) { $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); @@ -114,7 +115,7 @@ break; case 'select_multi': $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); + $options = $configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); $opcount = count($options); for ($j = 0; $j < $opcount; ++$j) { $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); @@ -160,44 +161,43 @@ break; } $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); - $$form_cat->addElement($ele); - $$form_cat->addElement($hidden); - unset($ele); - unset($hidden); + $$formCat->addElement($ele); + $$formCat->addElement($hidden); + unset($ele, $hidden); } publisherCpHeader(); //publisher_adminMenu(5, _PREFERENCES); - foreach ($config_cats as $form_cat => $info) { - if ($form_cat == 'others' && !$cat_others_used) { + foreach ($config_cats as $formCat => $info) { + if ($formCat === 'others' && !$cat_others_used) { continue; } - $$form_cat->addElement(new XoopsFormHidden('op', 'save')); - $$form_cat->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); - publisherOpenCollapsableBar($form_cat . '_table', $form_cat . '_icon', $info['name'], $info['description']); - $$form_cat->display(); - publisherCloseCollapsableBar($form_cat . '_table', $form_cat . '_icon'); + $$formCat->addElement(new XoopsFormHidden('op', 'save')); + $$formCat->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); + publisherOpenCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); + $$formCat->display(); + publisherCloseCollapsableBar($formCat . '_table', $formCat . '_icon'); } - unset($form_cat, $info); + unset($formCat, $info); xoops_cp_footer(); exit(); } -if ($op == 'save') { +if ($op === 'save') { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header($module->getInfo('adminindex'), 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); } - $count = count($conf_ids); - $config_handler = xoops_gethandler('config'); + $count = count($confIds); + $configHandler =& xoops_getHandler('config'); if ($count > 0) { for ($i = 0; $i < $count; ++$i) { - $config = $config_handler->getConfig($conf_ids[$i]); - $new_value =& ${$config->getVar('conf_name')}; - if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { - $config->setConfValueForInput($new_value); - $config_handler->insertConfig($config); + $config = $configHandler->getConfig($confIds[$i]); + $newValue =& ${$config->getVar('conf_name')}; + if (is_array($newValue) || $newValue != $config->getVar('conf_value')) { + $config->setConfValueForInput($newValue); + $configHandler->insertConfig($config); } - unset($new_value); + unset($newValue); } } redirect_header('preferences.php', 2, _AM_DBUPDATED); diff --git a/publisher/admin/pw_delete_file.php b/publisher/admin/pw_delete_file.php index e621a3ce..df465e47 100644 --- a/publisher/admin/pw_delete_file.php +++ b/publisher/admin/pw_delete_file.php @@ -21,7 +21,7 @@ include_once __DIR__ . '/admin_header.php'; -if ('delfileok' == XoopsRequest::getString('op', '', 'POST')) { +if ('delfileok' === XoopsRequest::getString('op', '', 'POST')) { $dir = publisherGetUploadDir(true, 'content'); $filename = XoopsRequest::getString('address', '', 'POST'); if (file_exists($dir . '/' . $filename)) { diff --git a/publisher/admin/pw_upload_file.php b/publisher/admin/pw_upload_file.php index 9d3c91c2..69850721 100644 --- a/publisher/admin/pw_upload_file.php +++ b/publisher/admin/pw_upload_file.php @@ -38,22 +38,22 @@ */ function publisher_pagewrap_upload(&$errors) { -// include_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; + // include_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; xoops_load('XoopsMediaUploader'); - $publisher = PublisherPublisher::getInstance(); - $post_field = 'fileupload'; + $publisher =& PublisherPublisher::getInstance(); + $postField = 'fileupload'; - $max_size = $publisher->getConfig('maximum_filesize'); - $max_imgwidth = $publisher->getConfig('maximum_image_width'); - $max_imgheight = $publisher->getConfig('maximum_image_height'); + $maxFileSize = $publisher->getConfig('maximum_filesize'); + $maxImageWidth = $publisher->getConfig('maximum_image_width'); + $maxImageHeight = $publisher->getConfig('maximum_image_height'); if (!is_dir(publisherGetUploadDir(true, 'content'))) { mkdir(publisherGetUploadDir(true, 'content'), 0757); } - $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml'); - $uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); - if ($uploader->fetchMedia($post_field)) { + $allowedMimeTypes = array('text/html', 'text/plain', 'application/xhtml+xml'); + $uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); + if ($uploader->fetchMedia($postField)) { $uploader->setTargetFileName($uploader->getMediaName()); if ($uploader->upload()) { return true; diff --git a/publisher/archive.php b/publisher/archive.php index f2540538..0bb39276 100644 --- a/publisher/archive.php +++ b/publisher/archive.php @@ -30,17 +30,17 @@ include_once $GLOBALS['xoops']->path('header.php'); include_once PUBLISHER_ROOT_PATH . '/footer.php'; xoops_loadLanguage('calendar'); -xoops_load('XoopsLocal'); +//mb xoops_load('XoopsLocal'); $lastyear = 0; $lastmonth = 0; -$months_arr = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER); +$monthsArray = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER); $fromyear = XoopsRequest::getInt('year'); $frommonth = XoopsRequest::getInt('month'); $pgtitle = ''; if ($fromyear && $frommonth) { - $pgtitle = sprintf(" - %d - %d", $fromyear, $frommonth); + $pgtitle = sprintf(' - %d - %d', $fromyear, $frommonth); } $dateformat = $publisher->getConfig('format_date'); @@ -68,37 +68,38 @@ $criteria->setSort('datesub'); $criteria->setOrder('DESC'); //Get all articles dates as an array to save memory -$items = $publisher->getHandler('item')->getAll($criteria, array('datesub'), false); +$items =& $publisher->getHandler('item')->getAll($criteria, array('datesub'), false); $itemsCount = count($items); if (!($itemsCount > 0)) { redirect_header(XOOPS_URL, 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS); -//mb exit; + //mb exit; } else { $years = array(); $months = array(); $i = 0; foreach ($items as $item) { - $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); - if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $time, $datetime)) { - $this_year = (int)($datetime[1]); - $this_month = (int)($datetime[2]); + //mb $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); + $time = formatTimestamp($item['datesub'], 'mysql', $useroffset); + if (preg_match('/(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})/', $time, $datetime)) { + $thisYear = (int)($datetime[1]); + $thisMonth = (int)($datetime[2]); //first year if (empty($lastyear)) { - $lastyear = $this_year; + $lastyear = $thisYear; $articlesThisYear = 0; $articlesThisMonth = 0; } //first month of the year reset if ($lastmonth == 0) { - $lastmonth = $this_month; - $months[$lastmonth]['string'] = $months_arr[$lastmonth]; + $lastmonth = $thisMonth; + $months[$lastmonth]['string'] = $monthsArray[$lastmonth]; $months[$lastmonth]['number'] = $lastmonth; -// $months[$lastmonth]['articlesMonthCount'] = 1; + // $months[$lastmonth]['articlesMonthCount'] = 1; $articlesThisMonth = 0; } //new year - if ($lastyear != $this_year) { + if ($lastyear != $thisYear) { $years[$i]['number'] = $lastyear; $years[$i]['months'] = $months; @@ -106,18 +107,18 @@ $months = array(); $lastmonth = 0; - $lastyear = $this_year; + $lastyear = $thisYear; $articlesThisYear = 0; $articlesThisMonth = 0; ++$i; } //new month - if ($lastmonth != $this_month) { + if ($lastmonth != $thisMonth) { if ($articlesThisMonth > 0) { $months[$lastmonth]['articlesMonthCount'] = $articlesThisMonth; } - $lastmonth = $this_month; - $months[$lastmonth]['string'] = $months_arr[$lastmonth]; + $lastmonth = $thisMonth; + $months[$lastmonth]['string'] = $monthsArray[$lastmonth]; $months[$lastmonth]['number'] = $lastmonth; $months[$lastmonth]['articlesMonthCount'] = 1; $articlesThisMonth = 0; @@ -127,8 +128,8 @@ ++$articlesThisYear; } } - unset($item); - $years[$i]['number'] = $this_year; +// unset($item); + $years[$i]['number'] = $thisYear; $years[$i]['months'] = $months; $years[$i]['articlesYearCount'] = $articlesThisYear; @@ -140,7 +141,7 @@ if ($fromyear != 0 && $frommonth != 0) { $xoopsTpl->assign('show_articles', true); $xoopsTpl->assign('lang_articles', _MD_PUBLISHER_ITEM); - $xoopsTpl->assign('currentmonth', $months_arr[$frommonth]); + $xoopsTpl->assign('currentmonth', $monthsArray[$frommonth]); $xoopsTpl->assign('currentyear', $fromyear); $xoopsTpl->assign('lang_actions', _MD_PUBLISHER_ACTIONS); $xoopsTpl->assign('lang_date', _MD_PUBLISHER_DATE); @@ -154,13 +155,13 @@ $count = 0; - $itemhandler = $publisher->getHandler('item'); - $itemhandler->table_link = $GLOBALS['xoopsDB']->prefix('publisher_categories'); - $itemhandler->field_link = 'categoryid'; - $itemhandler->field_object = 'categoryid'; + $itemHandler =& $publisher->getHandler('item'); + $itemHandler->tableLink = $GLOBALS['xoopsDB']->prefix('publisher_categories'); + $itemHandler->fieldLink = 'categoryid'; + $itemHandler->fieldObject = 'categoryid'; // Categories for which user has access $categoriesGranted =& $publisher->getHandler('permission')->getGrantedItems('category_read'); - $grantedCategories = new Criteria('l.categoryid', "(" . implode(',', $categoriesGranted) . ")", 'IN'); + $grantedCategories = new Criteria('l.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); $criteria = new CriteriaCompo(); $criteria->add($grantedCategories, 'AND'); $criteria->add(new Criteria('o.status', 2), 'AND'); @@ -171,26 +172,22 @@ $criteria->setSort('o.datesub'); $criteria->setOrder('DESC'); $criteria->setLimit(3000); - $storyarray = $itemhandler->getByLink($criteria); //Query Efficiency? + $storyarray = $itemHandler->getByLink($criteria); //Query Efficiency? $count = count($storyarray); if (is_array($storyarray) && $count > 0) { foreach ($storyarray as $item) { - $story = array(); - $htmltitle = ''; - $story['title'] - = - "" . $item->getCategoryName() . ": " . $item->title() . ""; + $story = array(); + $htmltitle = ''; + $story['title'] = "" . $item->getCategoryName() . ": ' . $item->getTitle() . ''; $story['counter'] = $item->counter(); - $story['date'] = $item->datesub(); + $story['date'] = $item->getDatesub(); $story['print_link'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/print.php?itemid=' . $item->itemid(); - $story['mail_link'] = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' - . $item->getItemUrl(); + $story['mail_link'] = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $item->getItemUrl(); $xoopsTpl->append('stories', $story); } - unset($item); +// unset($item); } $xoopsTpl->assign('lang_printer', _MD_PUBLISHER_PRINTERFRIENDLY); $xoopsTpl->assign('lang_sendstory', _MD_PUBLISHER_SENDSTORY); diff --git a/publisher/assets/css/jquery.popeye.css b/publisher/assets/css/jquery.popeye.css index ba4066e6..f88a3f03 100644 --- a/publisher/assets/css/jquery.popeye.css +++ b/publisher/assets/css/jquery.popeye.css @@ -4,7 +4,7 @@ * Mandatory CSS classes for jQuery.popeye * * Copyright (C) 2011 Christoph Schuessler (schreib@herr-schuessler.de) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -12,26 +12,27 @@ * */ .ppy-outer { - display: none; + display: none; } + .ppy-active .ppy-outer { - display: block; + display: block; } + .ppy-stage { - background-repeat: no-repeat !important; - background-position: center center !important; - position: relative; + background: no-repeat center center !important; + position: relative; } .ppy-placeholder { - position: relative; + position: relative; } .ppy-caption, .ppy-captionwrap { - overflow: hidden; + overflow: hidden; } .ppy-hidden { - display: none !important; -} \ No newline at end of file + display: none !important; +} diff --git a/publisher/assets/css/jquery.popeye.style.css b/publisher/assets/css/jquery.popeye.style.css index fb774d3d..601b3289 100644 --- a/publisher/assets/css/jquery.popeye.style.css +++ b/publisher/assets/css/jquery.popeye.style.css @@ -4,7 +4,7 @@ * Example styles for jQuery.popeye * * Copyright (C) 2011 Christoph Schuessler (schreib@herr-schuessler.de) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -14,413 +14,409 @@ /* fallback styles for image list */ .ppy-imglist { - width: 100%; - display: block; - overflow: hidden; - + width: 100%; + display: block; + overflow: hidden; + } + .ppy-imglist li { - padding: 10px; - border: 1px solid #f0f0f0; - border-radius: 5px; - -moz-border-radius: 5px; - -khtml-border-radius: 5px; - -webkit-border-radius: 5px; - background: #fff; - list-style: none; - float: left; - display: block; - margin: 0 10px 10px 0; + padding: 10px; + border: 1px solid #f0f0f0; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + background: #fff; + list-style: none; + float: left; + display: block; + margin: 0 10px 10px 0; } + .ppy-imglist li a img { - display: block; - border: 0; + display: block; + border: 0; } + #ppy1 .ppy-extcaption { - width: 240px; - display: block; + width: 240px; + display: block; } + #ppy1 .ppy-imglist li { - width: 240px; - height: 270px; + width: 240px; + height: 270px; } + #ppy2 .ppy-imglist li, #ppy2 .ppy-imglist li a { - width: 160px; - height: 160px; - overflow: hidden; - display: block; + width: 160px; + height: 160px; + overflow: hidden; + display: block; } - - - /* popeye example 1 */ #ppy1.ppy-active { - width: 262px; - float: left; - margin: 0 20px 10px 0; + width: 262px; + float: left; + margin: 0 20px 10px 0; } #ppy1 .ppy-outer { - padding: 10px; - border: 1px solid #e1f1a1; - border-radius: 0 10px 10px 10px; - -moz-border-radius: 0 10px 10px 10px; - -webkit-border-radius: 0 10px 10px 10px; - background: #eff9c7; + padding: 10px; + border: 1px solid #e1f1a1; + border-radius: 0 10px 10px 10px; + -moz-border-radius: 0 10px 10px 10px; + -webkit-border-radius: 0 10px 10px 10px; + background: #eff9c7; } #ppy1 .ppy-stage { - width: 240px; - height: 173px; - border-radius: 0 5px 5px 5px; - -moz-border-radius: 0 5px 5px 5px; - -webkit-border-radius: 0 5px 5px 5px; - cursor: pointer; + width: 240px; + height: 173px; + border-radius: 0 5px 5px 5px; + -moz-border-radius: 0 5px 5px 5px; + -webkit-border-radius: 0 5px 5px 5px; + cursor: pointer; } #ppy1 .ppy-outer:hover, #ppy1.ppy-expanded .ppy-outer { - border: 1px solid #d5e68e; - box-shadow: 0 0 7px #ccc; - -moz-box-shadow: 0 0 7px #ccc; + border: 1px solid #d5e68e; + box-shadow: 0 0 7px #ccc; + -moz-box-shadow: 0 0 7px #ccc; -webkit-box-shadow: 0 0 7px #ccc; } #ppy1 .ppy-caption { - margin: 5px 0 0 0; - padding: 10px; - font-size: 0.9em; - line-height: 1.3em; - color: #809f21; - background: #eeffa8; - border-radius: 10px; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - box-shadow: 0 0 7px #ccc; - -moz-box-shadow: 0 0 7px #ccc; + margin: 5px 0 0 0; + padding: 10px; + font-size: 0.9em; + line-height: 1.3em; + color: #809f21; + background: #eeffa8; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + box-shadow: 0 0 7px #ccc; + -moz-box-shadow: 0 0 7px #ccc; -webkit-box-shadow: 0 0 7px #ccc; - visibility: hidden; /* prevent flash of content before popeye loads */ + visibility: hidden; /* prevent flash of content before popeye loads */ } #ppy1 .ppy-caption a { - color: #66bde9; + color: #66bde9; } + #ppy1 .ppy-caption a:hover { - text-decoration:underline; + text-decoration: underline; } #ppy1 .ppy-counter { - border-bottom: 1px solid #d5e68e; - color: #b8cf5a; - padding: 0 0 2px 0; - margin: 0 0 5px 0; - font-size: 0.9em; + border-bottom: 1px solid #d5e68e; + color: #b8cf5a; + padding: 0 0 2px 0; + margin: 0 0 5px 0; + font-size: 0.9em; } #ppy1 .ppy-stagewrap { - background: #0c3b3d; - border-radius: 0 5px 5px 5px; - -moz-border-radius: 0 5px 5px 5px; - -webkit-border-radius: 0 5px 5px 5px; + background: #0c3b3d; + border-radius: 0 5px 5px 5px; + -moz-border-radius: 0 5px 5px 5px; + -webkit-border-radius: 0 5px 5px 5px; } #ppy1 .ppy-loading { - background: #0c3b3d url(../images/popeye/loading1.gif) no-repeat center !important; + background: #0c3b3d url(../images/popeye/loading1.gif) no-repeat center !important; } #ppy1 .ppy-nav { - background: #0c3b3d; - background: -moz-linear-gradient(center bottom, rgb(12,59,61) 0%, rgb(58,131,133) 100%); - width: 104px; - height: 32px; - padding: 5px; - position: absolute; - top: 0; - left: 0; - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; + background: #0c3b3d; + background: -moz-linear-gradient(center bottom, #0c3b3d 0%, #3a8385 100%); + width: 104px; + height: 32px; + padding: 5px; + position: absolute; + top: 0; + left: 0; + border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; } #ppy1 .ppy-nav a { - display: block; - overflow: hidden; - text-indent: -900em; - height: 22px; - float: left; - padding: 5px; - border-radius: 5px; - -moz-border-radius: 5px; - -khtml-border-radius: 5px; - -webkit-border-radius: 5px; + display: block; + overflow: hidden; + text-indent: -900em; + height: 22px; + float: left; + padding: 5px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; } #ppy1 .ppy-prev { - width: 22px; - background: url(../images/popeye/prev3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/prev3.png) no-repeat center; } #ppy1 .ppy-next { - width: 22px; - background: url(../images/popeye/next3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/next3.png) no-repeat center; } #ppy1 .ppy-switch-enlarge { - width: 30px; - background: url(../images/popeye/enlarge3.png) no-repeat center; + width: 30px; + background: url(../images/popeye/enlarge3.png) no-repeat center; } #ppy1 .ppy-switch-compact { - width: 30px; - background: url(../images/popeye/compact3.png) no-repeat center; + width: 30px; + background: url(../images/popeye/compact3.png) no-repeat center; } #ppy1 .ppy-nav a:hover { - background-color: #a1c436; - cursor: pointer; + background-color: #a1c436; + cursor: pointer; } - /* popeye example 2 */ #ppy2.ppy-active { - width: 224px; - float: right; - margin: 0 0 10px 20px; + width: 224px; + float: right; + margin: 0 0 10px 20px; } #ppy2 .ppy-outer { - padding: 0 46px 0 0; - + padding: 0 46px 0 0; + } + #ppy2 .ppy-stagewrap { - padding: 7px; - border-radius: 5px 0 5px 5px; - -moz-border-radius: 5px 0 5px 5px; - -webkit-border-radius: 5px 0 5px 5px; - background: #c1eaff; - background: rgba(193,234,255,0.7); + padding: 7px; + border-radius: 5px 0 5px 5px; + -moz-border-radius: 5px 0 5px 5px; + -webkit-border-radius: 5px 0 5px 5px; + background: #c1eaff; } #ppy2 .ppy-stage { - width: 160px; - height: 160px; - border: 2px solid #fff; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - background-color: #777; - cursor: pointer; + width: 160px; + height: 160px; + border: 2px solid #fff; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + background-color: #777; + cursor: pointer; } #ppy2 .ppy-counter { - background: #fff; - color: #333; - padding: 0 5px; - font-size: 0.8em; - position: absolute; - bottom: 0; - right: 0; - opacity: 0.7; - border-radius: 5px 0 0 0; - -moz-border-radius: 5px 0 0 0; - -khtml-border-radius: 5px 0 0 0; - -webkit-border-radius: 5px 0 0 0; + background: #fff; + color: #333; + padding: 0 5px; + font-size: 0.8em; + position: absolute; + bottom: 0; + right: 0; + opacity: 0.7; + border-radius: 5px 0 0 0; + -moz-border-radius: 5px 0 0 0; + -webkit-border-radius: 5px 0 0 0; } #ppy2 .ppy-loading { - background-image: url(../images/popeye/loading2.gif); - background-repeat: no-repeat; - background-position:center; + background: url(../images/popeye/loading2.gif) no-repeat center; } #ppy2 .ppy-nav { - border-radius: 0 5px 5px 0; - -moz-border-radius: 0 5px 5px 0; - -webkit-border-radius: 0 5px 5px 0; - background: #76c6ee; - background: -webkit-gradient( - linear, - left top, - right bottom, - color-stop(0, rgb(118,198,238)), - color-stop(1, rgb(45,158,214)) + border-radius: 0 5px 5px 0; + -moz-border-radius: 0 5px 5px 0; + -webkit-border-radius: 0 5px 5px 0; + background: #76c6ee; + background: -webkit-gradient( + linear, + left top, + right bottom, + color-stop(0, #76c6ee), + color-stop(1, #2d9ed6) ); - background: -moz-linear-gradient( - left top, - rgb(118,198,238) 0%, - rgb(45,158,214) 100% + background: -moz-linear-gradient( + left top, + #76c6ee 0%, + #2d9ed6 100% ); - border-left: 1px solid #6ab1d5; - width: 45px; - position: absolute; - top: 4px; - right: 0; + border-left: 1px solid #6ab1d5; + width: 45px; + position: absolute; + top: 4px; + right: 0; } #ppy2 .nav-wrap { - padding: 5px 0; + padding: 5px 0; } #ppy2 .ppy-nav a { - display: block; - overflow: hidden; - text-indent: -900em; - height: 22px; - padding: 5px; - border-radius: 0 5px 5px 0; - -moz-border-radius: 0 5px 5px 0; - -webkit-border-radius: 0 5px 5px 0; - width: 30px; + display: block; + overflow: hidden; + text-indent: -900em; + height: 22px; + padding: 5px; + border-radius: 0 5px 5px 0; + -moz-border-radius: 0 5px 5px 0; + -webkit-border-radius: 0 5px 5px 0; + width: 30px; } #ppy2 .ppy-prev { - background: url(../images/popeye/prev3.png) no-repeat center; + background: url(../images/popeye/prev3.png) no-repeat center; } #ppy2 .ppy-next { - background: url(../images/popeye/next3.png) no-repeat center; + background: url(../images/popeye/next3.png) no-repeat center; } #ppy2 .ppy-switch-enlarge { - background: url(../images/popeye/enlarge4.png) no-repeat center; + background: url(../images/popeye/enlarge4.png) no-repeat center; } #ppy2 .ppy-switch-compact { - background: url(../images/popeye/compact4.png) no-repeat center; + background: url(../images/popeye/compact4.png) no-repeat center; } #ppy2 .ppy-nav a:hover { - background-color: #378eba; - cursor: pointer; - opacity: 0.8; + background-color: #378eba; + cursor: pointer; + opacity: 0.8; } - - /* popeye example 3 */ #ppy3.ppy-active { - width: 240px; - float: left; - margin: 0 20px 10px 0; + width: 240px; + float: left; + margin: 0 20px 10px 0; } #ppy3 .ppy-outer { } #ppy3 .ppy-stage { - width: 240px; - height: 180px; - overflow: hidden; - cursor: pointer; + width: 240px; + height: 180px; + overflow: hidden; + cursor: pointer; } #ppy3 .ppy-stagewrap { - background: #333; + background: #333; } #ppy3 .ppy-caption { - margin: 10px 0 0 0; - padding: 0 5px 3px 0; - font-size: 0.9em; - line-height: 1.3em; - color: #666; - height: 60px; - overflow: auto; - border-bottom: 1px solid #ddd; + margin: 10px 0 0 0; + padding: 0 5px 3px 0; + font-size: 0.9em; + line-height: 1.3em; + color: #666; + height: 60px; + overflow: auto; + border-bottom: 1px solid #ddd; } #ppy3.ppy-expanded .ppy-caption { - margin: 0; - padding: 10px; - color: #fff; - border-bottom: 1px solid #333; - background: #666; + margin: 0; + padding: 10px; + color: #fff; + border-bottom: 1px solid #333; + background: #666; } #ppy3 .ppy-counter { - background: #333; - color: #fff; - padding: 0 5px; - font-size: 0.8em; - position: absolute; - bottom: 0; - left: 0; - opacity: 0.7; + background: #333; + color: #fff; + padding: 0 5px; + font-size: 0.8em; + position: absolute; + bottom: 0; + left: 0; + opacity: 0.7; } #ppy3 .ppy-loading { - background: #333 url(../images/popeye/loading3.gif) no-repeat center !important; + background: #333 url(../images/popeye/loading3.gif) no-repeat center !important; } #ppy3 .ppy-nav { - background: #333; - background: rgba(51,51,51,0.7); - background: -webkit-gradient( - linear, - left bottom, - left top, - color-stop(0, rgba(51,51,51,1)), - color-stop(0.4, rgba(51,51,51,0.7)), - color-stop(0.6, rgba(51,51,51,0.7)), - color-stop(1, rgba(51,51,51,1)) + background: #333; + background: #333333; + background: -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0, #333333), + color-stop(0.4, #333333), + color-stop(0.6, #333333), + color-stop(1, #333333) ); - background: -moz-linear-gradient(center bottom, rgba(51,51,51,1) 0%, rgba(51,51,51,0.7) 40%, rgba(51,51,51,0.7) 60%, rgba(51,51,51,1) 100%); - width: 100%; - height: 100%; - text-align: center; + background: -moz-linear-gradient(center bottom, #333333 0%, #333333 40%, #333333 60%, #333333 100%); + width: 100%; + height: 100%; + text-align: center; } + #ppy3 .nav-wrap { - width: 104px; - height: 32px; - padding: 30% 0 0 0; - margin: 0 auto 0 auto; + width: 104px; + height: 32px; + padding: 30% 0 0 0; + margin: 0 auto 0 auto; } + #ppy3 .ppy-nav a { - display: block; - overflow: hidden; - text-indent: -900em; - height: 22px; - float: left; - padding: 5px; - border-radius: 5px; - -moz-border-radius: 5px; - -khtml-border-radius: 5px; - -webkit-border-radius: 5px; + display: block; + overflow: hidden; + text-indent: -900em; + height: 22px; + float: left; + padding: 5px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; } #ppy3 .ppy-prev { - width: 22px; - background: url(../images/popeye/prev3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/prev3.png) no-repeat center; } #ppy3 .ppy-next { - width: 22px; - background: url(../images/popeye/next3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/next3.png) no-repeat center; } #ppy3 .ppy-switch-enlarge { - width: 30px; - background: url(../images/popeye/enlarge3.png) no-repeat center; + width: 30px; + background: url(../images/popeye/enlarge3.png) no-repeat center; } #ppy3 .ppy-switch-compact { - width: 30px; - background: url(../images/popeye/compact3.png) no-repeat center; + width: 30px; + background: url(../images/popeye/compact3.png) no-repeat center; } #ppy3 .ppy-play { - width: 22px; - background: url(../images/popeye/play3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/play3.png) no-repeat center; } #ppy3 .ppy-pause { - width: 22px; - background: url(../images/popeye/pause3.png) no-repeat center; + width: 22px; + background: url(../images/popeye/pause3.png) no-repeat center; } #ppy3 .ppy-nav a:hover { - background-color: #333; - cursor: pointer; + background-color: #333; + cursor: pointer; } diff --git a/publisher/assets/css/publisher.css b/publisher/assets/css/publisher.css index d2ee3a4c..929128f7 100644 --- a/publisher/assets/css/publisher.css +++ b/publisher/assets/css/publisher.css @@ -5,214 +5,214 @@ * Licence: GNU */ .publisher_headertable { -border-bottom:1px solid; -width:100%; -margin:0 0 20px; -padding:0; + border-bottom: 1px solid; + width: 100%; + margin: 0 0 20px; + padding: 0; } .publisher_modulename { -font-size:0.9em; -text-align:left; -font-weight: bold; -padding-right:0.3em; -line-height:18px; + font-size: 0.9em; + text-align: left; + font-weight: bold; + padding-right: 0.3em; + line-height: 18px; } .publisher_breadcrumb { -font-size:0.9em; -line-height:18px; -width:100%; + font-size: 0.9em; + line-height: 18px; + width: 100%; } .publisher_infotitle { -margin-top:8px; -margin-bottom:8px; -font-size:250%; -line-height:250%; -font-weight: bold; -display:block; + margin-top: 8px; + margin-bottom: 8px; + font-size: 250%; + line-height: 250%; + font-weight: bold; + display: block; } .publisher_infotext { -margin-bottom:8px; -line-height:130%; -display:block; + margin-bottom: 8px; + line-height: 130%; + display: block; } .publisher_category_index_list { -padding-top:5px; -padding-bottom:5px; -border-bottom:1px solid; + padding-top: 5px; + padding-bottom: 5px; + border-bottom: 1px solid; } .publisher_categoryname { -padding-bottom:5px; -vertical-align:middle; -font-size:120%; -text-align:left; -font-weight: bold; -line-height:120%; -margin:0; + padding-bottom: 5px; + vertical-align: middle; + font-size: 120%; + text-align: left; + font-weight: bold; + line-height: 120%; + margin: 0; } .publisher_category_image { -float:left; -padding-right:5px; -display:block; + float: left; + padding-right: 5px; + display: block; } .publisher_category_header { -clear:both; -padding-top:10px; -padding-bottom:5px; + clear: both; + padding-top: 10px; + padding-bottom: 5px; } .publisher_subcats { -clear:both; -padding-top:5px; -font-size:90%; + clear: both; + padding-top: 5px; + font-size: 90%; } .publisher_subcats_info { -padding-bottom:5px; -font-weight:bold; + padding-bottom: 5px; + font-weight: bold; } .publisher_collaps_title { -margin-bottom:2px; -margin-top:5px; -font-size:130%; -line-height:130%; -font-weight:bold; -display:block; + margin-bottom: 2px; + margin-top: 5px; + font-size: 130%; + line-height: 130%; + font-weight: bold; + display: block; } .publisher_collaps_info { -display:block; -margin:3px 0 12px; + display: block; + margin: 3px 0 12px; } .publisher_item_head_cat { -text-align:right; -font-style:normal; -vertical-align:middle; -display:block; + text-align: right; + font-style: normal; + vertical-align: middle; + display: block; } .publisher_item_head_who { -padding-top:5px; -text-align:right; -font-style:normal; -vertical-align:middle; -display:block; + padding-top: 5px; + text-align: right; + font-style: normal; + vertical-align: middle; + display: block; } .publisher_item_image { -display:block; -padding:5px; + display: block; + padding: 5px; } .publisher_items_link { -width:50%; -vertical-align:middle; + width: 50%; + vertical-align: middle; } .publisher_items_list { -padding-top:10px; + padding-top: 10px; } .publisher_items_list_item { -padding-top:5px; -padding-bottom:5px; + padding-top: 5px; + padding-bottom: 5px; } .publisher_list { -font-size:16px; -padding:8px; + font-size: 16px; + padding: 8px; } .publisher_category_dsc { -font-size:small; -display:block; -margin:3px 0 10px; + font-size: small; + display: block; + margin: 3px 0 10px; } .publisher_adminlinks { -padding-top:15px; -padding-bottom:5px; -font-size:10px; -text-align:center; -line-height:18px; + padding-top: 15px; + padding-bottom: 5px; + font-size: 10px; + text-align: center; + line-height: 18px; } .publisher_itemFoot { -text-align:right; -border:1px solid gray; -padding:3px; + text-align: right; + border: 1px solid gray; + padding: 3px; } .publisher_pre_itemInfo { -padding-top:5px; + padding-top: 5px; } .publisher_modfooter { -text-align:center; -padding-top:6px; -font-size:9px; + text-align: center; + padding-top: 6px; + font-size: 9px; } .publisher_spotlight_readmore { -display:block; -width:100px; -height:20px; -background-color:#aaa; -color:#fff; -text-align:center; -padding-top:5px; + display: block; + width: 100px; + height: 20px; + background-color: #aaa; + color: #fff; + text-align: center; + padding-top: 5px; } .publisher_pagenav_top { -padding-top:5px; -font-size:10px; -text-align:left; + padding-top: 5px; + font-size: 10px; + text-align: left; } .publisher_pagenav_bottom { -padding-top:5px; -padding-bottom:5px; -font-size:10px; -text-align:center; + padding-top: 5px; + padding-bottom: 5px; + font-size: 10px; + text-align: center; } #publisher_rpublisher_feed { -padding-top:5px; -padding-bottom:10px; -text-align:center; + padding-top: 5px; + padding-bottom: 10px; + text-align: center; } #publisher_embeded_files { -text-align:center; -display:block; + text-align: center; + display: block; } .publisher_tree ul { -margin:0 0 0 6px; -padding:0; + margin: 0 0 0 6px; + padding: 0; } .publisher_tree ul li { -list-style-type:none; -margin:0 0 2px; -padding:0; + list-style-type: none; + margin: 0 0 2px; + padding: 0; } .publisher_tree ul li a { -display:block; -margin:0; -padding:0; + display: block; + margin: 0; + padding: 0; } .publisher_tree .publisher_tree_category { @@ -222,518 +222,523 @@ padding:0; .publisher_tree .publisher_tree_item { } + #publisher_container { -width:50%; -border:1px solid #CCC; -padding:20px; + width: 50%; + border: 1px solid #CCC; + padding: 20px; } .publisher_ratingblock { } + .publisher_loading { -height:30px; -background:url(../images/working.gif) 50% 50% no-repeat; -width:150px; + height: 30px; + background: url(../images/working.gif) 50% 50% no-repeat; + width: 150px; } .publisher_unit-rating { -list-style:none; -height:30px; -position:relative; -background:url(../images/starrating.gif) top left repeat-x; -margin:0; -padding:0; + list-style: none; + height: 30px; + position: relative; + background: url(../images/starrating.gif) top left repeat-x; + margin: 0; + padding: 0; } .publisher_unit-rating div { -text-indent:-90000px; -float:left; -overflow:hidden; -margin:0; -padding:0; + text-indent: -90000px; + float: left; + overflow: hidden; + margin: 0; + padding: 0; } .publisher_unit-rating div a { -outline:none; -display:block; -width:30px; -height:30px; -text-decoration:none; -text-indent:-9000px; -overflow:hidden; -z-index:20; -position:absolute; -padding:0; + outline: none; + display: block; + width: 30px; + height: 30px; + text-decoration: none; + text-indent: -9000px; + overflow: hidden; + z-index: 20; + position: absolute; + padding: 0; } .publisher_unit-rating div a:hover { -background:url(../images/starrating.gif) left center; -z-index:2; -left:0; + background: url(../images/starrating.gif) left center; + z-index: 2; + left: 0; } .publisher_unit-rating a.publisher_r1-unit { -left:0; + left: 0; } .publisher_unit-rating a.publisher_r1-unit:hover { -width:30px; + width: 30px; } .publisher_unit-rating a.publisher_r2-unit { -left:30px; + left: 30px; } .publisher_unit-rating a.publisher_r2-unit:hover { -width:60px; + width: 60px; } .publisher_unit-rating a.publisher_r3-unit { -left:60px; + left: 60px; } .publisher_unit-rating a.publisher_r3-unit:hover { -width:90px; + width: 90px; } .publisher_unit-rating a.publisher_r4-unit { -left:90px; + left: 90px; } .publisher_unit-rating a.publisher_r4-unit:hover { -width:120px; + width: 120px; } .publisher_unit-rating a.publisher_r5-unit { -left:120px; + left: 120px; } .publisher_unit-rating a.publisher_r5-unit:hover { -width:150px; + width: 150px; } .publisher_unit-rating a.publisher_r6-unit { -left:150px; + left: 150px; } .publisher_unit-rating a.publisher_r6-unit:hover { -width:180px; + width: 180px; } .publisher_unit-rating a.publisher_r7-unit { -left:180px; + left: 180px; } .publisher_unit-rating a.publisher_r7-unit:hover { -width:210px; + width: 210px; } .publisher_unit-rating a.publisher_r8-unit { -left:210px; + left: 210px; } .publisher_unit-rating a.publisher_r8-unit:hover { -width:240px; + width: 240px; } .publisher_unit-rating a.publisher_r9-unit { -left:240px; + left: 240px; } .publisher_unit-rating a.publisher_r9-unit:hover { -width:270px; + width: 270px; } .publisher_unit-rating a.publisher_r10-unit { -left:270px; + left: 270px; } .publisher_unit-rating a.publisher_r10-unit:hover { -width:300px; + width: 300px; } .publisher_unit-rating div.publisher_current-rating { -background:url(../images/starrating.gif) left bottom; -position:absolute; -height:30px; -display:block; -text-indent:-9000px; -z-index:1; -overflow:hidden; + background: url(../images/starrating.gif) left bottom; + position: absolute; + height: 30px; + display: block; + text-indent: -9000px; + z-index: 1; + overflow: hidden; } .publisher_voted { } + .publisher_thanks { -color:#36AA3D; + color: #36AA3D; } /*****columns block************/ -h2.publisher-title,h4.publisher-title { -line-height:1.1; -font-size:110%; -margin:0 0 5px; -padding:0; +h2.publisher-title, h4.publisher-title { + line-height: 1.1; + font-size: 110%; + margin: 0 0 5px; + padding: 0; } + h2.publisher-title a, h4.publisher-title a { } .publisher-left { -float:left; -overflow:hidden; + float: left; + overflow: hidden; } .publisher-box { -margin:10px; -padding:10px 0; + margin: 10px; + padding: 10px 0; } .publisher-left .publisher-box { -margin-left:10px; + margin-left: 10px; } div.publisher-section { -display:block; -margin-bottom:5px; -padding-bottom:5px; -font-size:92%; + display: block; + margin-bottom: 5px; + padding-bottom: 5px; + font-size: 92%; } div.publisher-section a { -background:url(../images/dot-grey.gif) repeat-x left center; -display:block; -text-transform:uppercase; -font-weight:bold; -font-size:110%; -letter-spacing:1px; -padding:0 2px 2px 0; + background: url(../images/dot-grey.gif) repeat-x left center; + display: block; + text-transform: uppercase; + font-weight: bold; + font-size: 110%; + letter-spacing: 1px; + padding: 0 2px 2px 0; } div.publisher-section a span { -border-left:4px solid; -background:url(../images/span-bg.gif); -padding:0 5px; + border-left: 4px solid; + background: url(../images/span-bg.gif); + padding: 0 5px; } -div.publisher-section a:hover,div.publisher-section a:active,div.publisher-section a:focus { -text-decoration:none; +div.publisher-section a:hover, div.publisher-section a:active, div.publisher-section a:focus { + text-decoration: none; } .publisher-box:hover div.publisher-section a span, .hover div.publisher-section a span { } + .publisher-more { -text-transform:uppercase; -display:block; -clear:both; -font-size:92%; -letter-spacing:1px; -margin:0 0 2px; + text-transform: uppercase; + display: block; + clear: both; + font-size: 92%; + letter-spacing: 1px; + margin: 0 0 2px; } ul.publisher-links { -font-size:92%; -margin:0; -padding:0; + font-size: 92%; + margin: 0; + padding: 0; } ul.publisher-links li { -list-style:none !important; -padding-left:10px; -background:url(../images/bullet.gif) no-repeat 1px 4px; + list-style: none !important; + padding-left: 10px; + background: url(../images/bullet.gif) no-repeat 1px 4px; } .publisher-content img { -background:#F3F3EB; -border:1px solid #CCC; -margin:0 8px 10px 0; -padding:4px; + background: #F3F3EB; + border: 1px solid #CCC; + margin: 0 8px 10px 0; + padding: 4px; } .publisher-clearfix:after { -clear:both; -display:block; -content:"."; -height:0; -visibility:hidden; + clear: both; + display: block; + content: "."; + height: 0; + visibility: hidden; } .clear { -clear:both; + clear: both; } /* --------------- Latestnews Slider 1 --------------- */ ul.pub_slideshow1 { -list-style:none !important; -height:200px; -overflow:hidden; -position:relative; -margin:0; -padding:0; + list-style: none !important; + height: 200px; + overflow: hidden; + position: relative; + margin: 0; + padding: 0; } ul.pub_slideshow1 li { -position:absolute; -left:0; -right:0; -list-style:none !important; + position: absolute; + left: 0; + right: 0; + list-style: none !important; } ul.pub_slideshow1 li.show { -z-index:500; + z-index: 500; } ul.pub_slideshow1 img { -border:none; + border: none; } #pub_slideshow1-caption { -height:70px; -position:absolute; -bottom:0; -left:0; -color:#fff; -background:#000; -z-index:500; + height: 70px; + position: absolute; + bottom: 0; + left: 0; + color: #fff; + background: #000; + z-index: 500; } #pub_slideshow1-caption .pub_slideshow1-caption-container { -z-index:1000; -padding:5px 10px; + z-index: 1000; + padding: 5px 10px; } #pub_slideshow1-caption h3 { -font-size:16px; -margin:0; -padding:0; + font-size: 16px; + margin: 0; + padding: 0; } #pub_slideshow1-caption p { -font-weight:normal !important; -margin:5px 0 0; -padding:0; + font-weight: normal !important; + margin: 5px 0 0; + padding: 0; } /* --------------- Latestnews Slider 2 --------------- */ .lof-slidecontent { -position:relative; -overflow:hidden; -border:#F4F4F4 solid 1px; -width:592px; -height:300px; + position: relative; + overflow: hidden; + border: #F4F4F4 solid 1px; + width: 592px; + height: 300px; } .lof-main-outer { -position:relative; -height:100%; -width:400px; -z-index:3; -overflow:hidden; + position: relative; + height: 100%; + width: 400px; + z-index: 3; + overflow: hidden; } ul.lof-main-wapper { -height:300px; -width:400px; -position:absolute; -overflow:hidden; -list-style:none !important; -margin:0; -padding:0; + height: 300px; + width: 400px; + position: absolute; + overflow: hidden; + list-style: none !important; + margin: 0; + padding: 0; } ul.lof-main-wapper li { -overflow:hidden; -height:100%; -width:400px; -float:left; -list-style:none !important; -margin:0; -padding:0; + overflow: hidden; + height: 100%; + width: 400px; + float: left; + list-style: none !important; + margin: 0; + padding: 0; } .lof-opacity li { -position:absolute; -top:0; -left:0; -float:inherit; -list-style:none !important; + position: absolute; + top: 0; + left: 0; + float: inherit; + list-style: none !important; } ul.lof-main-wapper li img { -width:400px; -padding:0; + width: 400px; + padding: 0; } ul.lof-navigator { -top:0; -position:absolute; -width:100%; -margin:0 !important; -padding:0 !important; + top: 0; + position: absolute; + width: 100%; + margin: 0 !important; + padding: 0 !important; } ul.lof-navigator li { -cursor:pointer; -list-style:none !important; -width:100%; -overflow:hidden; -margin:0 !important; -padding:0 !important; + cursor: pointer; + list-style: none !important; + width: 100%; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; } .lof-navigator-outer { -position:absolute; -right:0; -top:0; -z-index:100; -height:300px; -width:210px; -overflow:hidden; -color:#FFF; + position: absolute; + right: 0; + top: 0; + z-index: 100; + height: 300px; + width: 210px; + overflow: hidden; + color: #FFF; } .lof-navigator li.active { -background:url(../images/arrow-bg.png) no-repeat scroll left center; -color:#FFF; + background: url(../images/arrow-bg.png) no-repeat scroll left center; + color: #FFF; } .lof-navigator li:hover { } + .lof-navigator li h3 { -margin:0; -padding:15px 10px !important; + margin: 0; + padding: 15px 10px !important; } -.lof-navigator li h3 a{ -color:#FFF; -font-size:90%; + +.lof-navigator li h3 a { + color: #FFF; + font-size: 90%; } .lof-navigator li div { -background:url(../images/transparent_bg.png); -color:#FFF; -height:100%; -position:relative; -margin-left:15px; -padding-left:15px; -border-top:1px solid #E1E1E1; + background: url(../images/transparent_bg.png); + color: #FFF; + height: 100%; + position: relative; + margin-left: 15px; + padding-left: 15px; + border-top: 1px solid #E1E1E1; } .lof-navigator li.active div { -background:#941813 url(../images/grad-bg.png) repeat-x; -color:#FFF; + background: #941813 url(../images/grad-bg.png) repeat-x; + color: #FFF; } .lof-navigator li img { -height:60px; -width:60px; -float:left; -border:#C5C5C5 solid 1px; -margin:15px 15px 10px 0; -padding:3px; + height: 60px; + width: 60px; + float: left; + border: #C5C5C5 solid 1px; + margin: 15px 15px 10px 0; + padding: 3px; } .lof-navigator li.active img { -border:#6C8E5C solid 1px; + border: #6C8E5C solid 1px; } .lof-navigator li.active h3 { -color:#FFF; + color: #FFF; } #publisher_upload_button { -text-align:center; -font-weight:normal; -width:130px; -margin-top:3px; -border:1px solid #bbb; -background-color:#D3D2D6; -color:#405A80; -padding:3px; + text-align: center; + font-weight: normal; + width: 130px; + margin-top: 3px; + border: 1px solid #bbb; + background-color: #D3D2D6; + color: #405A80; + padding: 3px; } -.publisher_indexfooter,.publisher_itemfooter { -font-size:10px; -font-weight:bold; -text-align:center; -padding:10px; +.publisher_indexfooter, .publisher_itemfooter { + font-size: 10px; + font-weight: bold; + text-align: center; + padding: 10px; } -.publisher_tree ul li ul,.publisher_tree ul li ul li ul { -padding-left:6px; +.publisher_tree ul li ul, .publisher_tree ul li ul li ul { + padding-left: 6px; } .ppy-imglist li { - padding: 0; - border: 1px solid #f0f0f0; - border-radius: 0; - -moz-border-radius: 0; - -khtml-border-radius: 0; - -webkit-border-radius: 0; - background: #fff; - list-style: none; - float: left; - display: block; - margin: 0 0 0 0; + padding: 0; + border: 1px solid #f0f0f0; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + background: #fff; + list-style: none; + float: left; + display: block; + margin: 0 0 0 0; } #ppy1 .ppy-outer { - padding: 0; - border: 1px solid #dddddd; - border-radius: 0 5px 5px 0; - -moz-border-radius: 0 5px 5px 0; - -webkit-border-radius: 0 5px 5px 0; + padding: 0; + border: 1px solid #dddddd; + border-radius: 0 5px 5px 0; + -moz-border-radius: 0 5px 5px 0; + -webkit-border-radius: 0 5px 5px 0; background: #dddddd; } - - #ppy1 .ppy-outer:hover, #ppy1.ppy-expanded .ppy-outer { - border: 1px solid #bcbcbc; - box-shadow: 0 0 7px #ccc; - -moz-box-shadow: 0 0 7px #ccc; + border: 1px solid #bcbcbc; + box-shadow: 0 0 7px #ccc; + -moz-box-shadow: 0 0 7px #ccc; -webkit-box-shadow: 0 0 7px #ccc; } #ppy1 .ppy-caption a { - color: #66bde9; + color: #66bde9; } + #ppy1 .ppy-caption a:hover { - text-decoration:underline; + text-decoration: underline; } #ppy1 .ppy-caption { - margin: 0 0 0 0; - padding: 10px; - font-size: 0.9em; - line-height: 1em; + margin: 0 0 0 0; + padding: 10px; + font-size: 0.9em; + line-height: 1em; color: #020202; background: #dddddd; - border-radius: 10px; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - box-shadow: 0 0 7px #ccc; - -moz-box-shadow: 0 0 7px #ccc; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + box-shadow: 0 0 7px #ccc; + -moz-box-shadow: 0 0 7px #ccc; -webkit-box-shadow: 0 0 7px #ccc; - visibility: hidden; /* prevent flash of content before popeye loads */ + visibility: hidden; /* prevent flash of content before popeye loads */ } #ppy1 .ppy-counter { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #dddddd; color: #020202; - padding: 0 0 2px 0; - margin: 0 0 5px 0; - font-size: 0.9em; + padding: 0 0 2px 0; + margin: 0 0 5px 0; + font-size: 0.9em; } #ppy1 .ppy-stagewrap { background: #bcbcbc; - border-radius: 0 5px 5px 5px; - -moz-border-radius: 0 5px 5px 5px; - -webkit-border-radius: 0 5px 5px 5px; + border-radius: 0 5px 5px 5px; + -moz-border-radius: 0 5px 5px 5px; + -webkit-border-radius: 0 5px 5px 5px; } diff --git a/publisher/assets/index.html b/publisher/assets/index.html index 990cbd60..2c5cdd3f 100644 --- a/publisher/assets/index.html +++ b/publisher/assets/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/publisher/assets/js/ajaxupload.3.9.js b/publisher/assets/js/ajaxupload.3.9.js index 7e51768b..db619f2c 100644 --- a/publisher/assets/js/ajaxupload.3.9.js +++ b/publisher/assets/js/ajaxupload.3.9.js @@ -1,22 +1,22 @@ /** - * AJAX Upload ( http://valums.com/ajax-upload/ ) + * AJAX Upload ( http://valums.com/ajax-upload/ ) * Copyright (c) Andris Valums * Licensed under the MIT license ( http://valums.com/mit-license/ ) - * Thanks to Gary Haran, David Mark, Corey Burns and others for contributions + * Thanks to Gary Haran, David Mark, Corey Burns and others for contributions */ (function () { /* global window */ /* jslint browser: true, devel: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true */ - + /** * Wrapper for FireBug's console.log */ - function log(){ - if (typeof(console) != 'undefined' && typeof(console.log) == 'function'){ + function log() { + if (typeof(console) != 'undefined' && typeof(console.log) == 'function') { Array.prototype.unshift.call(arguments, '[Ajax Upload]'); - console.log( Array.prototype.join.call(arguments, ' ')); + console.log(Array.prototype.join.call(arguments, ' ')); } - } + } /** * Attaches event to a dom element. @@ -24,104 +24,104 @@ * @param type event name * @param fn callback This refers to the passed element */ - function addEvent(el, type, fn){ + function addEvent(el, type, fn) { if (el.addEventListener) { el.addEventListener(type, fn, false); } else if (el.attachEvent) { - el.attachEvent('on' + type, function(){ + el.attachEvent('on' + type, function () { fn.call(el); - }); - } else { + }); + } else { throw new Error('not supported or DOM not loaded'); } - } - + } + /** * Attaches resize event to a window, limiting * number of event fired. Fires only when encounteres * delay of 100 after series of events. - * + * * Some browsers fire event multiple times when resizing * http://www.quirksmode.org/dom/events/resize.html - * + * * @param fn callback This refers to the passed element */ - function addResizeEvent(fn){ + function addResizeEvent(fn) { var timeout; - - addEvent(window, 'resize', function(){ - if (timeout){ + + addEvent(window, 'resize', function () { + if (timeout) { clearTimeout(timeout); } - timeout = setTimeout(fn, 100); + timeout = setTimeout(fn, 100); }); - } - + } + // Needs more testing, will be rewriten for next version // getOffset function copied from jQuery lib (http://jquery.com/) - if (document.documentElement.getBoundingClientRect){ + if (document.documentElement.getBoundingClientRect) { // Get Offset using getBoundingClientRect // http://ejohn.org/blog/getboundingclientrect-is-awesome/ - var getOffset = function(el){ + var getOffset = function (el) { var box = el.getBoundingClientRect(); var doc = el.ownerDocument; var body = doc.body; var docElem = doc.documentElement; // for ie var clientTop = docElem.clientTop || body.clientTop || 0; var clientLeft = docElem.clientLeft || body.clientLeft || 0; - + // In Internet Explorer 7 getBoundingClientRect property is treated as physical, // while others are logical. Make all logical, like in IE8. - var zoom = 1; + var zoom = 1; if (body.getBoundingClientRect) { var bound = body.getBoundingClientRect(); zoom = (bound.right - bound.left) / body.clientWidth; } - + if (zoom > 1) { clientTop = 0; clientLeft = 0; } - + var top = box.top / zoom + (window.pageYOffset || docElem && docElem.scrollTop / zoom || body.scrollTop / zoom) - clientTop, left = box.left / zoom + (window.pageXOffset || docElem && docElem.scrollLeft / zoom || body.scrollLeft / zoom) - clientLeft; - + return { top: top, left: left }; - }; + }; } else { // Get offset adding all offsets - var getOffset = function(el){ + var getOffset = function (el) { var top = 0, left = 0; do { top += el.offsetTop || 0; left += el.offsetLeft || 0; el = el.offsetParent; } while (el); - + return { left: left, top: top }; }; } - + /** * Returns left, top, right and bottom properties describing the border-box, * in pixels, with the top-left relative to the body * @param {Element} el * @return {Object} Contains left, top, right,bottom */ - function getBox(el){ + function getBox(el) { var left, right, top, bottom; var offset = getOffset(el); left = offset.left; top = offset.top; - + right = left + el.offsetWidth; bottom = top + el.offsetHeight; - + return { left: left, right: right, @@ -129,108 +129,110 @@ bottom: bottom }; } - + /** * Helper that takes object literal * and add all properties to element.style * @param {Element} el * @param {Object} styles */ - function addStyles(el, styles){ + function addStyles(el, styles) { for (var name in styles) { if (styles.hasOwnProperty(name)) { el.style[name] = styles[name]; } } } - + /** * Function places an absolutely positioned * element on top of the specified element * copying position and dimentions. * @param {Element} from * @param {Element} to - */ - function copyLayout(from, to){ - var box = getBox(from); - + */ + function copyLayout(from, to) { + var box = getBox(from); + addStyles(to, { - position: 'absolute', - left : box.left + 'px', - top : box.top + 'px', - width : from.offsetWidth + 'px', - height : from.offsetHeight + 'px' - }); + position: 'absolute', + left: box.left + 'px', + top: box.top + 'px', + width: from.offsetWidth + 'px', + height: from.offsetHeight + 'px' + }); } /** - * Creates and returns element from html chunk - * Uses innerHTML to create an element - */ - var toElement = (function(){ + * Creates and returns element from html chunk + * Uses innerHTML to create an element + */ + var toElement = (function () { var div = document.createElement('div'); - return function(html){ + return function (html) { div.innerHTML = html; var el = div.firstChild; return div.removeChild(el); }; })(); - + /** * Function generates unique id - * @return unique id + * @return unique id */ - var getUID = (function(){ + var getUID = (function () { var id = 0; - return function(){ + return function () { return 'ValumsAjaxUpload' + id++; }; - })(); - + })(); + /** * Get file name from path * @param {String} file path to file * @return filename - */ - function fileFromPath(file){ + */ + function fileFromPath(file) { return file.replace(/.*(\/|\\)/, ""); } - + /** * Get file extension lowercase * @param {String} file name * @return file extenstion - */ - function getExt(file){ + */ + function getExt(file) { return (-1 !== file.indexOf('.')) ? file.replace(/.*[.]/, '') : ''; } - function hasClass(el, name){ - var re = new RegExp('\\b' + name + '\\b'); + function hasClass(el, name) { + var re = new RegExp('\\b' + name + '\\b'); return re.test(el.className); - } - function addClass(el, name){ - if ( ! hasClass(el, name)){ + } + + function addClass(el, name) { + if (!hasClass(el, name)) { el.className += ' ' + name; } - } - function removeClass(el, name){ - var re = new RegExp('\\b' + name + '\\b'); - el.className = el.className.replace(re, ''); } - - function removeNode(el){ + + function removeClass(el, name) { + var re = new RegExp('\\b' + name + '\\b'); + el.className = el.className.replace(re, ''); + } + + function removeNode(el) { el.parentNode.removeChild(el); } /** * Easy styling and uploading * @constructor - * @param button An element you want convert to + * @param button An element you want convert to * upload button. Tested dimentions up to 500x500px * @param {Object} options See defaults below. */ - window.AjaxUpload = function(button, options){ + window.AjaxUpload = function (button, options) { this._settings = { // Location of the server-side upload script action: 'upload.php', @@ -248,228 +250,228 @@ // Class applied to button when mouse is hovered hoverClass: 'hover', // Class applied to button when AU is disabled - disabledClass: 'disabled', + disabledClass: 'disabled', // When user selects a file, useful with autoSubmit disabled // You can return false to cancel upload - onChange: function(file, extension){ + onChange: function (file, extension) { }, // Callback to fire before file is uploaded // You can return false to cancel upload - onSubmit: function(file, extension){ + onSubmit: function (file, extension) { }, // Fired when file upload is completed // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE! - onComplete: function(file, response){ + onComplete: function (file, response) { } }; - + // Merge the users options with our defaults for (var i in options) { - if (options.hasOwnProperty(i)){ + if (options.hasOwnProperty(i)) { this._settings[i] = options[i]; } } - + // button isn't necessary a dom element - if (button.jquery){ + if (button.jquery) { // jQuery object was passed button = button[0]; } else if (typeof button == "string") { - if (/^#.*/.test(button)){ + if (/^#.*/.test(button)) { // If jQuery user passes #elementId don't break it - button = button.slice(1); + button = button.slice(1); } - + button = document.getElementById(button); } - - if ( ! button || button.nodeType !== 1){ - throw new Error("Please make sure that you're passing a valid element"); + + if (!button || button.nodeType !== 1) { + throw new Error("Please make sure that you're passing a valid element"); } - - if ( button.nodeName.toUpperCase() == 'A'){ + + if (button.nodeName.toUpperCase() == 'A') { // disable link - addEvent(button, 'click', function(e){ - if (e && e.preventDefault){ + addEvent(button, 'click', function (e) { + if (e && e.preventDefault) { e.preventDefault(); - } else if (window.event){ + } else if (window.event) { window.event.returnValue = false; } }); } - + // DOM element - this._button = button; + this._button = button; // DOM element this._input = null; // If disabled clicking on button won't do anything this._disabled = false; - + // if the button was disabled before refresh if will remain // disabled in FireFox, let's fix it - this.enable(); - + this.enable(); + this._rerouteClicks(); }; - + // assigning methods to our class AjaxUpload.prototype = { - setData: function(data){ + setData: function (data) { this._settings.data = data; }, - disable: function(){ + disable: function () { addClass(this._button, this._settings.disabledClass); this._disabled = true; - - var nodeName = this._button.nodeName.toUpperCase(); - if (nodeName == 'INPUT' || nodeName == 'BUTTON'){ + + var nodeName = this._button.nodeName.toUpperCase(); + if (nodeName == 'INPUT' || nodeName == 'BUTTON') { this._button.setAttribute('disabled', 'disabled'); - } - + } + // hide input - if (this._input){ + if (this._input) { // We use visibility instead of display to fix problem with Safari 4 // The problem is that the value of input doesn't change if it // has display none when user selects a file this._input.parentNode.style.visibility = 'hidden'; } }, - enable: function(){ + enable: function () { removeClass(this._button, this._settings.disabledClass); this._button.removeAttribute('disabled'); this._disabled = false; - + }, /** - * Creates invisible file input + * Creates invisible file input * that will hover above the button *
*/ - _createInput: function(){ + _createInput: function () { var self = this; - + var input = document.createElement("input"); input.setAttribute('type', 'file'); input.setAttribute('name', this._settings.name); - + addStyles(input, { - 'position' : 'absolute', + 'position': 'absolute', // in Opera only 'browse' button // is clickable and it is located at // the right side of the input - 'right' : 0, - 'margin' : 0, - 'padding' : 0, - 'fontSize' : '480px', - 'cursor' : 'pointer' - }); - - var div = document.createElement("div"); + 'right': 0, + 'margin': 0, + 'padding': 0, + 'fontSize': '480px', + 'cursor': 'pointer' + }); + + var div = document.createElement("div"); addStyles(div, { - 'display' : 'block', - 'position' : 'absolute', - 'overflow' : 'hidden', - 'margin' : 0, - 'padding' : 0, - 'opacity' : 0, + 'display': 'block', + 'position': 'absolute', + 'overflow': 'hidden', + 'margin': 0, + 'padding': 0, + 'opacity': 0, // Make sure browse button is in the right side // in Internet Explorer - 'direction' : 'ltr', + 'direction': 'ltr', //Max zIndex supported by Opera 9.0-9.2 'zIndex': 2147483583 }); - + // Make sure that element opacity exists. // Otherwise use IE filter - if ( div.style.opacity !== "0") { - if (typeof(div.filters) == 'undefined'){ + if (div.style.opacity !== "0") { + if (typeof(div.filters) == 'undefined') { throw new Error('Opacity not supported by the browser'); } div.style.filter = "alpha(opacity=0)"; - } - - addEvent(input, 'change', function(){ - - if ( ! input || input.value === ''){ - return; + } + + addEvent(input, 'change', function () { + + if (!input || input.value === '') { + return; } - + // Get filename from input, required // as some browsers have path instead of it var file = fileFromPath(input.value); - - if (false === self._settings.onChange.call(self, file, getExt(file))){ - self._clearInput(); + + if (false === self._settings.onChange.call(self, file, getExt(file))) { + self._clearInput(); return; } - + // Submit form when value is changed if (self._settings.autoSubmit) { self.submit(); } - }); + }); - addEvent(input, 'mouseover', function(){ + addEvent(input, 'mouseover', function () { addClass(self._button, self._settings.hoverClass); }); - - addEvent(input, 'mouseout', function(){ + + addEvent(input, 'mouseout', function () { removeClass(self._button, self._settings.hoverClass); - + // We use visibility instead of display to fix problem with Safari 4 // The problem is that the value of input doesn't change if it // has display none when user selects a file input.parentNode.style.visibility = 'hidden'; - }); - - div.appendChild(input); + }); + + div.appendChild(input); document.body.appendChild(div); - + this._input = input; }, - _clearInput : function(){ - if (!this._input){ + _clearInput: function () { + if (!this._input) { return; - } - + } + // this._input.value = ''; Doesn't work in IE6 removeNode(this._input.parentNode); - this._input = null; + this._input = null; this._createInput(); - + removeClass(this._button, this._settings.hoverClass); }, /** * Function makes sure that when user clicks upload button, * the this._input is clicked instead */ - _rerouteClicks: function(){ + _rerouteClicks: function () { var self = this; - + // IE will later display 'access denied' error // if you use using self._input.click() // other browsers just ignore click() - addEvent(self._button, 'mouseover', function(){ - if (self._disabled){ + addEvent(self._button, 'mouseover', function () { + if (self._disabled) { return; } - - if ( ! self._input){ - self._createInput(); + + if (!self._input) { + self._createInput(); } - - var div = self._input.parentNode; + + var div = self._input.parentNode; copyLayout(self._button, div); div.style.visibility = 'visible'; - + }); - - + + // commented because we now hide input on mouseleave /** - * When the window is resized the elements + * When the window is resized the elements * can be misaligned if button position depends * on window size */ @@ -478,33 +480,33 @@ // copyLayout(self._button, self._input.parentNode); // } //}); - + }, /** * Creates iframe with unique name * @return {Element} iframe */ - _createIframe: function(){ + _createIframe: function () { // We can't use getTime, because it sometimes return // same value in safari :( - var id = getUID(); - + var id = getUID(); + // We can't use following code as the name attribute // won't be properly registered in IE6, and new window // on form submit will open // var iframe = document.createElement('iframe'); // iframe.setAttribute('name', id); - + var iframe = toElement('