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' => "",
'deleteimg' => "",
'online' => "",
- 'offline' => "",
-);
+ '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 '';
// 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 "" . _AM_PUBLISHER_ITEMCATEGORY_ID . "";
- echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . "";
- echo " | " . _CO_PUBLISHER_WEIGHT . "";
- echo " | " . _AM_PUBLISHER_ACTION . "";
- echo " |
";
- $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0);
+ echo '';
+ echo "" . _AM_PUBLISHER_ITEMCATEGORY_ID . '';
+ echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . '';
+ echo " | " . _CO_PUBLISHER_WEIGHT . '';
+ echo " | " . _AM_PUBLISHER_ACTION . '';
+ 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 "" . _AM_PUBLISHER_NOCAT . " | ";
- echo "
";
+ echo '';
+ echo "" . _AM_PUBLISHER_NOCAT . ' | ';
+ echo '
';
$categoryid = '0';
}
echo "
\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 '';
$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 "" . _AM_PUBLISHER_ITEMID . "";
- echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . "";
- echo " | " . _AM_PUBLISHER_TITLE . "";
- echo " | " . _AM_PUBLISHER_CREATED . "";
- echo " | " . _AM_PUBLISHER_ACTION . "";
- echo " |
";
+ echo '';
+ echo "" . _AM_PUBLISHER_ITEMID . '';
+ echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . '';
+ echo " | " . _AM_PUBLISHER_TITLE . '';
+ echo " | " . _AM_PUBLISHER_CREATED . '';
+ echo " | " . _AM_PUBLISHER_ACTION . '';
+ echo ' |
';
if ($totalitems > 0) {
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
- $categoryObj = $itemsObj[$i]->category();
+ $categoryObj = $itemsObj[$i]->getCategory();
$approve = " ";
$clone = '';
$delete = "";
- $modify = "";
+ $modify = '';
- echo "";
- echo "" . $itemsObj[$i]->itemid() . " | ";
- echo "" . $categoryObj->getCategoryLink() . " | ";
- echo "" . $itemsObj[$i]->title() . " | ";
- echo "" . $itemsObj[$i]->datesub() . " | ";
+ echo '
';
+ echo "" . $itemsObj[$i]->itemid() . ' | ';
+ echo "" . $categoryObj->getCategoryLink() . ' | ';
+ echo "itemid() . "'>" . $itemsObj[$i]->getTitle() . ' | ';
+ echo "" . $itemsObj[$i]->getDatesub() . ' | ';
echo " $approve $clone $modify $delete | ";
- echo "
";
+ echo '';
}
} else {
$itemid = 0;
- echo "";
- echo "" . _AM_PUBLISHER_NOITEMS_SUBMITTED . " | ";
- echo "
";
+ echo '';
+ echo "" . _AM_PUBLISHER_NOITEMS_SUBMITTED . ' | ';
+ echo '
';
}
echo "
\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 "" . _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 " |
";
+ 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 ' |
';
if ($totalitems > 0) {
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
- $categoryObj = $itemsObj[$i]->category();
+ $categoryObj = $itemsObj[$i]->getCategory();
$modify = "";
$delete = "";
$clone = "";
- echo "";
- echo "" . $itemsObj[$i]->itemid() . " | ";
- echo "" . $categoryObj->getCategoryLink() . " | ";
- echo "" . $itemsObj[$i]->getItemLink() . " | ";
- echo "" . $itemsObj[$i]->counter() . " | ";
- echo "" . $itemsObj[$i]->datesub() . " | ";
+ echo '
';
+ echo "" . $itemsObj[$i]->itemid() . ' | ';
+ echo "" . $categoryObj->getCategoryLink() . ' | ';
+ echo "" . $itemsObj[$i]->getItemLink() . ' | ';
+ echo "" . $itemsObj[$i]->counter() . ' | ';
+ echo "" . $itemsObj[$i]->getDatesub() . ' | ';
echo " $clone $modify $delete | ";
- echo "
";
+ echo '';
}
} else {
$itemid = 0;
- echo "";
- echo "" . _AM_PUBLISHER_NOITEMS . " | ";
- echo "
";
+ echo '';
+ echo "" . _AM_PUBLISHER_NOITEMS . ' | ';
+ echo '
';
}
echo "
\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 "" . _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 " |
";
+ 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 ' |
';
if ($totalitems > 0) {
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
- $categoryObj = $itemsObj[$i]->category();
+ $categoryObj = $itemsObj[$i]->getCategory();
$modify = "";
$delete = "";
$clone = "";
- echo "";
- echo "" . $itemsObj[$i]->itemid() . " | ";
- echo "" . $categoryObj->getCategoryLink() . " | ";
- echo "" . $itemsObj[$i]->getItemLink() . " | ";
- echo "" . $itemsObj[$i]->counter() . " | ";
- echo "" . $itemsObj[$i]->datesub() . " | ";
+ echo '
';
+ echo "" . $itemsObj[$i]->itemid() . ' | ';
+ echo "" . $categoryObj->getCategoryLink() . ' | ';
+ echo "" . $itemsObj[$i]->getItemLink() . ' | ';
+ echo "" . $itemsObj[$i]->counter() . ' | ';
+ echo "" . $itemsObj[$i]->getDatesub() . ' | ';
echo " $clone $modify $delete | ";
- echo "
";
+ echo '';
}
} else {
$itemid = 0;
- echo "";
- echo "" . _AM_PUBLISHER_NOITEMS_OFFLINE . " | ";
- echo "
";
+ echo '';
+ echo "" . _AM_PUBLISHER_NOITEMS_OFFLINE . ' | ';
+ echo '
';
}
echo "
\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 "" . _AM_PUBLISHER_ITEMID . "";
- echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . "";
- echo " | " . _AM_PUBLISHER_TITLE . "";
- echo " | " . _AM_PUBLISHER_CREATED . "";
- echo " | " . _AM_PUBLISHER_ACTION . "";
- echo " |
";
-
- if ($totalitems > 0) {
+ echo '';
+ echo "" . _AM_PUBLISHER_ITEMID . '';
+ echo " | " . _AM_PUBLISHER_ITEMCATEGORYNAME . '';
+ echo " | " . _AM_PUBLISHER_TITLE . '';
+ echo " | " . _AM_PUBLISHER_CREATED . '';
+ echo " | " . _AM_PUBLISHER_ACTION . '';
+ echo ' |
';
+
+ if ($totalitems > 0) {
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
- $categoryObj = $itemsObj[$i]->category();
+ $categoryObj = $itemsObj[$i]->getCategory();
$modify = "";
$delete = "";
$clone = "";
- echo "";
- echo "" . $itemsObj[$i]->itemid() . " | ";
- echo "" . $categoryObj->getCategoryLink() . " | ";
- echo "" . $itemsObj[$i]->getItemLink() . " | ";
- echo "" . $itemsObj[$i]->datesub() . " | ";
+ echo '
';
+ echo "" . $itemsObj[$i]->itemid() . ' | ';
+ echo "" . $categoryObj->getCategoryLink() . ' | ';
+ echo "" . $itemsObj[$i]->getItemLink() . ' | ';
+ echo "" . $itemsObj[$i]->getDatesub() . ' | ';
echo " $clone $modify $delete | ";
- echo "
";
+ echo '';
}
} else {
$itemid = 0;
- echo "";
- echo "" . _AM_PUBLISHER_NOITEMS_REJECTED . " | ";
- echo "
";
+ echo '';
+ echo "" . _AM_PUBLISHER_NOITEMS_REJECTED . ' | ';
+ echo '
';
}
echo "
\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 '';
}
} 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 '';
// 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 "" . _AM_PUBLISHER_TOTALCAT . " | " . $totalcategories . " | ";
-echo "" . _AM_PUBLISHER_TOTALSUBMITTED . " | " . $totalsubmitted . " | ";
-echo "" . _AM_PUBLISHER_TOTALPUBLISHED . " | " . $totalpublished . " | ";
-echo "" . _AM_PUBLISHER_TOTAL_OFFLINE . " | " . $totaloffline . " | ";
-echo "
";
-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 '';
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 "
- " . _AM_PUBLISHER_SHOWING . " " . $caption . " |
+ " . _AM_PUBLISHER_SHOWING . ' ' . $caption . " |
" . _AM_PUBLISHER_SELECT_SORT . "
- " . _AM_PUBLISHER_SELECT_STATUS . " :
+ ' . _AM_PUBLISHER_SELECT_STATUS . " :
|
\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 '';
// end of add form
// Find new mimetypes table
echo "";
+ 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 '';
// 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 "" . _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_admin') . "&limit=" . $limit . "&start=" . $start . "'>
+ getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'>
" . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "
|
- getVar('mime_user') . "&limit=" . $limit . "&start=" . $start . "'>
+ 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 "";
- 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 '';
} 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 '';
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_admin') . "&limit=" . $limit . "&start=" . $start . "'>
+ getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'>
" . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "
|
- getVar('mime_user') . "&limit=" . $limit . "&start=" . $start . "'>
+ 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 "";
} 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 "" . $nav->renderNav() . "
";
+ echo '';
+ echo "" . $nav->renderNav() . '
';
}
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 '';
// 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']
- =
- "categoryid() . "'>" . $item->getCategoryName() . ": " . $item->title() . "";
+ $story = array();
+ $htmltitle = '';
+ $story['title'] = "categoryid() . "'>" . $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('');
// src="javascript:false; was added
// because it possibly removes ie6 prompt
// "This page contains both secure and nonsecure items"
// Anyway, it doesn't do any harm.
iframe.setAttribute('id', id);
-
+
iframe.style.display = 'none';
document.body.appendChild(iframe);
-
+
return iframe;
},
/**
@@ -512,24 +514,24 @@
* @param {Element} iframe Where to submit
* @return {Element} form
*/
- _createForm: function(iframe){
+ _createForm: function (iframe) {
var settings = this._settings;
-
+
// We can't use the following code in IE6
// var form = document.createElement('form');
// form.setAttribute('method', 'post');
// form.setAttribute('enctype', 'multipart/form-data');
// Because in this case file won't be attached to request
var form = toElement('');
-
+
form.setAttribute('action', settings.action);
- form.setAttribute('target', iframe.name);
+ form.setAttribute('target', iframe.name);
form.style.display = 'none';
document.body.appendChild(form);
-
+
// Create hidden input element for each data key
for (var prop in settings.data) {
- if (settings.data.hasOwnProperty(prop)){
+ if (settings.data.hasOwnProperty(prop)) {
var el = document.createElement("input");
el.setAttribute('type', 'hidden');
el.setAttribute('name', prop);
@@ -542,42 +544,42 @@
/**
* Gets response from iframe and fires onComplete event when ready
* @param iframe
- * @param file Filename to use in onComplete callback
+ * @param file Filename to use in onComplete callback
*/
- _getResponse : function(iframe, file){
+ _getResponse: function (iframe, file) {
// getting response
- var toDeleteFlag = false, self = this, settings = this._settings;
-
- addEvent(iframe, 'load', function(){
-
+ var toDeleteFlag = false, self = this, settings = this._settings;
+
+ addEvent(iframe, 'load', function () {
+
if (// For Safari
- iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
+ iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
// For FF, IE
- iframe.src == "javascript:'';"){
- // First time around, do not delete.
- // We reload to blank page, so that reloading main page
- // does not re-submit the post.
-
- if (toDeleteFlag) {
- // Fix busy state in FF3
- setTimeout(function(){
- removeNode(iframe);
- }, 0);
- }
-
- return;
+ iframe.src == "javascript:'';") {
+ // First time around, do not delete.
+ // We reload to blank page, so that reloading main page
+ // does not re-submit the post.
+
+ if (toDeleteFlag) {
+ // Fix busy state in FF3
+ setTimeout(function () {
+ removeNode(iframe);
+ }, 0);
+ }
+
+ return;
}
-
+
var doc = iframe.contentDocument ? iframe.contentDocument : window.frames[iframe.id].document;
-
+
// fixing Opera 9.26,10.00
if (doc.readyState && doc.readyState != 'complete') {
- // Opera fires load event multiple times
- // Even when the DOM is not ready yet
- // this fix should not affect other browsers
- return;
+ // Opera fires load event multiple times
+ // Even when the DOM is not ready yet
+ // this fix should not affect other browsers
+ return;
}
-
+
// fixing Opera 9.64
if (doc.body && doc.body.innerHTML == "false") {
// In Opera 9.64 event was fired second time
@@ -585,16 +587,16 @@
// to server response approx. after 1 sec
return;
}
-
+
var response;
-
+
if (doc.XMLDocument) {
// response is a xml document Internet Explorer property
response = doc.XMLDocument;
- } else if (doc.body){
+ } else if (doc.body) {
// response is html document or plain text
response = doc.body.innerHTML;
-
+
if (settings.responseType && settings.responseType.toLowerCase() == 'json') {
// If the document was sent as 'application/javascript' or
// 'text/javascript', then the browser wraps the text in a
@@ -605,7 +607,7 @@
if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE') {
response = doc.body.firstChild.firstChild.nodeValue;
}
-
+
if (response) {
response = eval("(" + response + ")");
} else {
@@ -616,55 +618,57 @@
// response is a xml document
response = doc;
}
-
+
settings.onComplete.call(self, file, response);
-
+
// Reload blank page, so that reloading main page
// does not re-submit the post. Also, remember to
// delete the frame
toDeleteFlag = true;
-
+
// Fix IE mixed content issue
iframe.src = "javascript:'';";
- });
- },
+ });
+ },
/**
* Upload file contained in this._input
*/
- submit: function(){
+ submit: function () {
var self = this, settings = this._settings;
-
- if ( ! this._input || this._input.value === ''){
- return;
+
+ if (!this._input || this._input.value === '') {
+ return;
}
-
+
var file = fileFromPath(this._input.value);
-
+
// user returned false to cancel upload
- if (false === settings.onSubmit.call(this, file, getExt(file))){
- this._clearInput();
+ if (false === settings.onSubmit.call(this, file, getExt(file))) {
+ this._clearInput();
return;
}
-
+
// sending request
var iframe = this._createIframe();
var form = this._createForm(iframe);
-
+
// assuming following structure
// div -> input type='file'
- removeNode(this._input.parentNode);
+ removeNode(this._input.parentNode);
removeClass(self._button, self._settings.hoverClass);
-
+
form.appendChild(this._input);
-
+
form.submit();
// request set, clean up
- removeNode(form); form = null;
- removeNode(this._input); this._input = null;
-
+ removeNode(form);
+ form = null;
+ removeNode(this._input);
+ this._input = null;
+
// Get response from iframe and fire onComplete event when ready
- this._getResponse(iframe, file);
+ this._getResponse(iframe, file);
// get ready for next request
this._createInput();
diff --git a/publisher/assets/js/behavior.js b/publisher/assets/js/behavior.js
index 851c4464..10e0ef12 100644
--- a/publisher/assets/js/behavior.js
+++ b/publisher/assets/js/behavior.js
@@ -1,254 +1,268 @@
/*
- Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
- of Simon Willison (see comments by Simon below).
-
- Description:
-
- Uses css selectors to apply javascript behaviours to enable
- unobtrusive javascript in html documents.
-
- Usage:
-
- var myrules = {
- 'b.someclass' : function(element){
- element.onclick = function(){
- alert(this.innerHTML);
- }
- },
- '#someid u' : function(element){
- element.onmouseover = function(){
- this.innerHTML = "BLAH!";
- }
- }
- };
-
- Behaviour.register(myrules);
-
- // Call Behaviour.apply() to re-apply the rules (if you
- // update the dom, etc).
-
- License:
-
- This file is entirely BSD licensed.
-
- More information:
-
- http://ripcord.co.nz/behaviour/
-
-*/
+ Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
+ of Simon Willison (see comments by Simon below).
+
+ Description:
+
+ Uses css selectors to apply javascript behaviours to enable
+ unobtrusive javascript in html documents.
+
+ Usage:
+
+ var myrules = {
+ 'b.someclass' : function(element){
+ element.onclick = function(){
+ alert(this.innerHTML);
+ }
+ },
+ '#someid u' : function(element){
+ element.onmouseover = function(){
+ this.innerHTML = "BLAH!";
+ }
+ }
+ };
+
+ Behaviour.register(myrules);
+
+ // Call Behaviour.apply() to re-apply the rules (if you
+ // update the dom, etc).
+
+ License:
+
+ This file is entirely BSD licensed.
+
+ More information:
+
+ http://ripcord.co.nz/behaviour/
+
+ */
var Behaviour = {
- list : new Array,
-
- register : function(sheet){
- Behaviour.list.push(sheet);
- },
-
- start : function(){
- Behaviour.addLoadEvent(function(){
- Behaviour.apply();
- });
- },
-
- apply : function(){
- for (h=0;sheet=Behaviour.list[h];h++){
- for (selector in sheet){
- list = document.getElementsBySelector(selector);
-
- if (!list){
- continue;
- }
-
- for (i=0;element=list[i];i++){
- sheet[selector](element);
- }
- }
- }
- },
-
- addLoadEvent : function(func){
- var oldonload = window.onload;
-
- if (typeof window.onload != 'function') {
- window.onload = func;
- } else {
- window.onload = function() {
- oldonload();
- func();
- }
- }
- }
+ list: new Array,
+
+ register: function (sheet) {
+ Behaviour.list.push(sheet);
+ },
+
+ start: function () {
+ Behaviour.addLoadEvent(function () {
+ Behaviour.apply();
+ });
+ },
+
+ apply: function () {
+ for (h = 0; sheet = Behaviour.list[h]; h++) {
+ for (selector in sheet) {
+ list = document.getElementsBySelector(selector);
+
+ if (!list) {
+ continue;
+ }
+
+ for (i = 0; element = list[i]; i++) {
+ sheet[selector](element);
+ }
+ }
+ }
+ },
+
+ addLoadEvent: function (func) {
+ var oldonload = window.onload;
+
+ if (typeof window.onload != 'function') {
+ window.onload = func;
+ } else {
+ window.onload = function () {
+ oldonload();
+ func();
+ }
+ }
+ }
};
Behaviour.start();
/*
- The following code is Copyright (C) Simon Willison 2004.
-
- document.getElementsBySelector(selector)
- - returns an array of element objects from the current document
- matching the CSS selector. Selectors can contain element names,
- class names and ids and can be nested. For example:
-
- elements = document.getElementsBySelect('div#main p a.external')
-
- Will return an array of all 'a' elements with 'external' in their
- class attribute that are contained inside 'p' elements that are
- contained inside the 'div' element which has id="main"
-
- New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
- See http://www.w3.org/TR/css3-selectors/#attribute-selectors
-
- Version 0.4 - Simon Willison, March 25th 2003
- -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
- -- Opera 7 fails
-*/
+ The following code is Copyright (C) Simon Willison 2004.
+
+ document.getElementsBySelector(selector)
+ - returns an array of element objects from the current document
+ matching the CSS selector. Selectors can contain element names,
+ class names and ids and can be nested. For example:
+
+ elements = document.getElementsBySelect('div#main p a.external')
+
+ Will return an array of all 'a' elements with 'external' in their
+ class attribute that are contained inside 'p' elements that are
+ contained inside the 'div' element which has id="main"
+
+ New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
+ See http://www.w3.org/TR/css3-selectors/#attribute-selectors
+
+ Version 0.4 - Simon Willison, March 25th 2003
+ -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
+ -- Opera 7 fails
+ */
function getAllChildren(e) {
- // Returns all children of element. Workaround required for IE5/Windows. Ugh.
- return e.all ? e.all : e.getElementsByTagName('*');
+ // Returns all children of element. Workaround required for IE5/Windows. Ugh.
+ return e.all ? e.all : e.getElementsByTagName('*');
}
-document.getElementsBySelector = function(selector) {
- // Attempt to fail gracefully in lesser browsers
- if (!document.getElementsByTagName) {
- return new Array();
- }
- // Split selector in to tokens
- var tokens = selector.split(' ');
- var currentContext = new Array(document);
- for (var i = 0; i < tokens.length; i++) {
- token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');
- if (token.indexOf('#') > -1) {
- // Token is an ID selector
- var bits = token.split('#');
- var tagName = bits[0];
- var id = bits[1];
- var element = document.getElementById(id);
- if (tagName && element.nodeName.toLowerCase() != tagName) {
- // tag with that ID not found, return false
+document.getElementsBySelector = function (selector) {
+ // Attempt to fail gracefully in lesser browsers
+ if (!document.getElementsByTagName) {
return new Array();
- }
- // Set currentContext to contain just this element
- currentContext = new Array(element);
- continue; // Skip to next token
}
- if (token.indexOf('.') > -1) {
- // Token contains a class selector
- var bits = token.split('.');
- var tagName = bits[0];
- var className = bits[1];
- if (!tagName) {
- tagName = '*';
- }
- // Get elements matching tag, filter them for class selector
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- elements = currentContext[h].getElementsByTagName(tagName);
- }
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
+ // Split selector in to tokens
+ var tokens = selector.split(' ');
+ var currentContext = new Array(document);
+ for (var i = 0; i < tokens.length; i++) {
+ token = tokens[i].replace(/^\s+/, '').replace(/\s+$/, '');
+ if (token.indexOf('#') > -1) {
+ // Token is an ID selector
+ var bits = token.split('#');
+ var tagName = bits[0];
+ var id = bits[1];
+ var element = document.getElementById(id);
+ if (tagName && element.nodeName.toLowerCase() != tagName) {
+ // tag with that ID not found, return false
+ return new Array();
+ }
+ // Set currentContext to contain just this element
+ currentContext = new Array(element);
+ continue; // Skip to next token
}
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
- currentContext[currentContextIndex++] = found[k];
+ if (token.indexOf('.') > -1) {
+ // Token contains a class selector
+ var bits = token.split('.');
+ var tagName = bits[0];
+ var className = bits[1];
+ if (!tagName) {
+ tagName = '*';
+ }
+ // Get elements matching tag, filter them for class selector
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements;
+ if (tagName == '*') {
+ elements = getAllChildren(currentContext[h]);
+ } else {
+ elements = currentContext[h].getElementsByTagName(tagName);
+ }
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ for (var k = 0; k < found.length; k++) {
+ if (found[k].className && found[k].className.match(new RegExp('\\b' + className + '\\b'))) {
+ currentContext[currentContextIndex++] = found[k];
+ }
+ }
+ continue; // Skip to next token
}
- }
- continue; // Skip to next token
- }
- // Code to deal with attribute selectors
- if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
- var tagName = RegExp.$1;
- var attrName = RegExp.$2;
- var attrOperator = RegExp.$3;
- var attrValue = RegExp.$4;
- if (!tagName) {
- tagName = '*';
- }
- // Grab all of the tagName elements within current context
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- elements = currentContext[h].getElementsByTagName(tagName);
+ // Code to deal with attribute selectors
+ if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
+ var tagName = RegExp.$1;
+ var attrName = RegExp.$2;
+ var attrOperator = RegExp.$3;
+ var attrValue = RegExp.$4;
+ if (!tagName) {
+ tagName = '*';
+ }
+ // Grab all of the tagName elements within current context
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements;
+ if (tagName == '*') {
+ elements = getAllChildren(currentContext[h]);
+ } else {
+ elements = currentContext[h].getElementsByTagName(tagName);
+ }
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ var checkFunction; // This function will be used to filter the elements
+ switch (attrOperator) {
+ case '=': // Equality
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName) == attrValue);
+ };
+ break;
+ case '~': // Match one of space seperated words
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName).match(new RegExp('\\b' + attrValue + '\\b')));
+ };
+ break;
+ case '|': // Match start with value followed by optional hyphen
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName).match(new RegExp('^' + attrValue + '-?')));
+ };
+ break;
+ case '^': // Match starts with value
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName).indexOf(attrValue) == 0);
+ };
+ break;
+ case '$': // Match ends with value - fails with "Warning" in Opera 7
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length);
+ };
+ break;
+ case '*': // Match ends with value
+ checkFunction = function (e) {
+ return (e.getAttribute(attrName).indexOf(attrValue) > -1);
+ };
+ break;
+ default :
+ // Just test for existence of attribute
+ checkFunction = function (e) {
+ return e.getAttribute(attrName);
+ };
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ for (var k = 0; k < found.length; k++) {
+ if (checkFunction(found[k])) {
+ currentContext[currentContextIndex++] = found[k];
+ }
+ }
+ // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
+ continue; // Skip to next token
}
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
+
+ if (!currentContext[0]) {
+ return;
}
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- var checkFunction; // This function will be used to filter the elements
- switch (attrOperator) {
- case '=': // Equality
- checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
- break;
- case '~': // Match one of space seperated words
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
- break;
- case '|': // Match start with value followed by optional hyphen
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
- break;
- case '^': // Match starts with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
- break;
- case '$': // Match ends with value - fails with "Warning" in Opera 7
- checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
- break;
- case '*': // Match ends with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
- break;
- default :
- // Just test for existence of attribute
- checkFunction = function(e) { return e.getAttribute(attrName); };
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (checkFunction(found[k])) {
- currentContext[currentContextIndex++] = found[k];
+
+ // If we get here, token is JUST an element (not a class or ID selector)
+ tagName = token;
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements = currentContext[h].getElementsByTagName(tagName);
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
}
- }
- // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
- continue; // Skip to next token
- }
-
- if (!currentContext[0]){
- return;
- }
-
- // If we get here, token is JUST an element (not a class or ID selector)
- tagName = token;
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements = currentContext[h].getElementsByTagName(tagName);
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
+ currentContext = found;
}
- currentContext = found;
- }
- return currentContext;
+ return currentContext;
};
/* That revolting regular expression explained
-/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
- \---/ \---/\-------------/ \-------/
- | | | |
- | | | The value
- | | ~,|,^,$,* or =
- | Attribute
- Tag
-*/
+ /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
+ \---/ \---/\-------------/ \-------/
+ | | | |
+ | | | The value
+ | | ~,|,^,$,* or =
+ | Attribute
+ Tag
+ */
diff --git a/publisher/assets/js/cookies.js b/publisher/assets/js/cookies.js
index 6328af24..45d6e525 100644
--- a/publisher/assets/js/cookies.js
+++ b/publisher/assets/js/cookies.js
@@ -15,9 +15,8 @@
* [secure] Boolean value indicating if the cookie transmission requires a
* secure transmission
*/
-function setCookie(name, value, expires, path, domain, secure)
-{
- document.cookie= name + "=" + escape(value) +
+function setCookie(name, value, expires, path, domain, secure) {
+ document.cookie = name + "=" + encodeURIComponent(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
@@ -32,26 +31,22 @@ function setCookie(name, value, expires, path, domain, secure)
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
-function getCookie(name)
-{
+function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
- if (begin == -1)
- {
+ if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
- else
- {
+ else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
- if (end == -1)
- {
+ if (end == -1) {
end = dc.length;
}
- return unescape(dc.substring(begin + prefix.length, end));
+ return decodeURIComponent(dc.substring(begin + prefix.length, end));
}
/**
@@ -61,11 +56,9 @@ function getCookie(name)
* [path] path of the cookie (must be same as path used to create cookie)
* [domain] domain of the cookie (must be same as domain used to create cookie)
*/
-function deleteCookie(name, path, domain)
-{
- if (getCookie(name))
- {
- document.cookie = name + "=" +
+function deleteCookie(name, path, domain) {
+ if (getCookie(name)) {
+ document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
diff --git a/publisher/assets/js/funcs.js b/publisher/assets/js/funcs.js
index d7fdf1ee..543abf3d 100644
--- a/publisher/assets/js/funcs.js
+++ b/publisher/assets/js/funcs.js
@@ -1,14 +1,13 @@
-function selectAll(formObj, fieldname, isInverse)
-{
+function selectAll(formObj, fieldname, isInverse) {
if (fieldname.length == 0) {
- for (var i=0;i < formObj.length;i++) {
+ for (var i = 0; i < formObj.length; i++) {
fldObj = formObj.elements[i];
if (fldObj.type == 'checkbox') {
fldObj.checked = isInverse;
}
}
} else {
- for (var i=0; i < formObj.length;i++) {
+ for (var i = 0; i < formObj.length; i++) {
fldObj = formObj.elements[i];
if (fldObj.type == 'checkbox') {
if (fldObj.name.indexOf(fieldname) > -1) {
@@ -21,146 +20,149 @@ function selectAll(formObj, fieldname, isInverse)
function publisherPageWrap(id, page) {
- var revisedMessage;
- var textareaDom = xoopsGetElementById(id);
- xoopsInsertText(textareaDom, page);
- textareaDom.focus();
+ var revisedMessage;
+ var textareaDom = xoopsGetElementById(id);
+ xoopsInsertText(textareaDom, page);
+ textareaDom.focus();
}
function addSelectedItemsToParent() {
- self.opener.addToParentList(window.document.forms[0].destList);
- window.close();
+ self.opener.addToParentList(window.document.forms[0].destList);
+ window.close();
}
// Fill the selcted item list with the items already present in parent.
function fillInitialDestList() {
- var destList = window.document.forms[0].destList;
- var srcList = self.opener.window.document.forms[0].elements['moderators[]'];
- for (var count = destList.options.length - 1; count >= 0; count--) {
- destList.options[count] = null;
- }
- for(var i = 0; i < srcList.options.length; i++) {
- if (srcList.options[i] != null)
- destList.options[i] = new Option(srcList.options[i].text);
- }
+ var destList = window.document.forms[0].destList;
+ var srcList = self.opener.window.document.forms[0].elements['moderators[]'];
+ for (var count = destList.options.length - 1; count >= 0; count--) {
+ destList.options[count] = null;
+ }
+ for (var i = 0; i < srcList.options.length; i++) {
+ if (srcList.options[i] != null)
+ destList.options[i] = new Option(srcList.options[i].text);
+ }
}
// Add the selected items from the source to destination list
function addSrcToDestList() {
- destList = window.document.forms[0].destList;
- srcList = window.document.forms[0].srcList;
- var len = destList.length;
- for(var i = 0; i < srcList.length; i++) {
- if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
- //Check if this value already exist in the destList or not
- //if not then add it otherwise do not add it.
- var found = false;
- for(var count = 0; count < len; count++) {
- if (destList.options[count] != null) {
- if (srcList.options[i].text == destList.options[count].text) {
- found = true;
- break;
- }
- }
- }
- if (found != true) {
- destList.options[len] = new Option(srcList.options[i].text);
- len++;
- }
- }
- }
+ destList = window.document.forms[0].destList;
+ srcList = window.document.forms[0].srcList;
+ var len = destList.length;
+ for (var i = 0; i < srcList.length; i++) {
+ if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
+ //Check if this value already exist in the destList or not
+ //if not then add it otherwise do not add it.
+ var found = false;
+ for (var count = 0; count < len; count++) {
+ if (destList.options[count] != null) {
+ if (srcList.options[i].text == destList.options[count].text) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found != true) {
+ destList.options[len] = new Option(srcList.options[i].text);
+ len++;
+ }
+ }
+ }
}
// Deletes from the destination list.
function deleteFromDestList() {
- var destList = window.document.forms[0].destList;
- var len = destList.options.length;
- for(var i = (len-1); i >= 0; i--) {
- if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
- destList.options[i] = null;
- }
- }
+ var destList = window.document.forms[0].destList;
+ var len = destList.options.length;
+ for (var i = (len - 1); i >= 0; i--) {
+ if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
+ destList.options[i] = null;
+ }
+ }
}
function small_window(myurl, w, h) {
- // La ventana se llama "Add_from_Src_to_Dest"
- var newWindow;
- LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
- TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
- newWindow = window.open(myurl, "Add_from_Src_to_Dest", 'left='+LeftPosition+',top='+TopPosition+',width='+w+', height='+h+',scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no');
+ // La ventana se llama "Add_from_Src_to_Dest"
+ var newWindow;
+ LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
+ TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
+ newWindow = window.open(myurl, "Add_from_Src_to_Dest", 'left=' + LeftPosition + ',top=' + TopPosition + ',width=' + w + ', height=' + h + ',scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no');
}
// Adds the list of selected items selected in the child
// window to its list. It is called by child window to do so.
function addToParentList(sourceList) {
- destinationList = window.document.forms[0].elements['moderators[]'];
- for(var count = destinationList.options.length - 1; count >= 0; count--) {
- destinationList.options[count] = null;
- }
- for(var i = 0; i < sourceList.options.length; i++) {
- if (sourceList.options[i] != null)
- destinationList.options[i] = new Option(sourceList.options[i].text, sourceList.options[i].value );
- }
+ destinationList = window.document.forms[0].elements['moderators[]'];
+ for (var count = destinationList.options.length - 1; count >= 0; count--) {
+ destinationList.options[count] = null;
+ }
+ for (var i = 0; i < sourceList.options.length; i++) {
+ if (sourceList.options[i] != null)
+ destinationList.options[i] = new Option(sourceList.options[i].text, sourceList.options[i].value);
+ }
}
// Marks all the items as selected for the submit button.
function selectList(sourceList) {
- sourceList = window.document.forms[0].elements['moderators[]'];
- for(var i = 0; i < sourceList.options.length; i++) {
- if (sourceList.options[i] != null)
- sourceList.options[i].selected = true;
- }
- return true;
+ sourceList = window.document.forms[0].elements['moderators[]'];
+ for (var i = 0; i < sourceList.options.length; i++) {
+ if (sourceList.options[i] != null)
+ sourceList.options[i].selected = true;
+ }
+ return true;
}
// Deletes the selected items of supplied list.
function deleteSelectedItemsFromList(sourceList) {
- var maxCnt = sourceList.options.length;
- for(var i = maxCnt - 1; i >= 0; i--) {
- if ((sourceList.options[i] != null) && (sourceList.options[i].selected == true)) {
- sourceList.options[i] = null;
- }
- }
+ var maxCnt = sourceList.options.length;
+ for (var i = maxCnt - 1; i >= 0; i--) {
+ if ((sourceList.options[i] != null) && (sourceList.options[i].selected == true)) {
+ sourceList.options[i] = null;
+ }
+ }
}
-function goto_URL(object)
-{
- window.location.href = object.options[object.selectedIndex].value;
+function goto_URL(object) {
+ window.location.href = object.options[object.selectedIndex].value;
}
-function toggle(id)
-{
- if (document.getElementById) { obj = document.getElementById(id); }
- if (document.all) { obj = document.all[id]; }
- if (document.layers) { obj = document.layers[id]; }
- if (obj) {
- if (obj.style.display == "none") {
- obj.style.display = "";
- } else {
- obj.style.display = "none";
- }
- }
-
- var expDays = 365;
- var exp = new Date();
- exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
-
- setCookie(window.location.pathname+"_publisher_collaps_" + obj.id , obj.style.display, exp);
-
- return false;
+function toggle(id) {
+ if (document.getElementById) {
+ obj = document.getElementById(id);
+ }
+ if (document.all) {
+ obj = document.all[id];
+ }
+ if (document.layers) {
+ obj = document.layers[id];
+ }
+ if (obj) {
+ if (obj.style.display == "none") {
+ obj.style.display = "";
+ } else {
+ obj.style.display = "none";
+ }
+ }
+
+ var expDays = 365;
+ var exp = new Date();
+ exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
+
+ setCookie(window.location.pathname + "_publisher_collaps_" + obj.id, obj.style.display, exp);
+
+ return false;
}
var iconClose = new Image();
-iconClose.src = '../assets/images/links/close12.gif';
+iconClose.src = '../images/links/close12.gif';
var iconOpen = new Image();
-iconOpen.src = '../assets/images/links/open12.gif';
-
-function toggleIcon ( iconName )
-{
- if ( document.images[iconName].src == window.iconOpen.src ) {
- document.images[iconName].src = window.iconClose.src;
- } else if ( document.images[iconName].src == window.iconClose.src ) {
- document.images[iconName].src = window.iconOpen.src;
- }
+iconOpen.src = '../images/links/open12.gif';
+
+function toggleIcon(iconName) {
+ if (document.images[iconName].src == window.iconOpen.src) {
+ document.images[iconName].src = window.iconClose.src;
+ } else if (document.images[iconName].src == window.iconClose.src) {
+ document.images[iconName].src = window.iconOpen.src;
+ }
}
diff --git a/publisher/assets/js/index.html b/publisher/assets/js/index.html
index 990cbd60..2c5cdd3f 100644
--- a/publisher/assets/js/index.html
+++ b/publisher/assets/js/index.html
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/publisher/assets/js/jquery.easing.js b/publisher/assets/js/jquery.easing.js
index ef743210..bd6cac11 100644
--- a/publisher/assets/js/jquery.easing.js
+++ b/publisher/assets/js/jquery.easing.js
@@ -33,143 +33,164 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
-*/
+ */
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
-jQuery.extend( jQuery.easing,
-{
- def: 'easeOutQuad',
- swing: function (x, t, b, c, d) {
- //alert(jQuery.easing.default);
- return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
- },
- easeInQuad: function (x, t, b, c, d) {
- return c*(t/=d)*t + b;
- },
- easeOutQuad: function (x, t, b, c, d) {
- return -c *(t/=d)*(t-2) + b;
- },
- easeInOutQuad: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t + b;
- return -c/2 * ((--t)*(t-2) - 1) + b;
- },
- easeInCubic: function (x, t, b, c, d) {
- return c*(t/=d)*t*t + b;
- },
- easeOutCubic: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t + 1) + b;
- },
- easeInOutCubic: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t + b;
- return c/2*((t-=2)*t*t + 2) + b;
- },
- easeInQuart: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t + b;
- },
- easeOutQuart: function (x, t, b, c, d) {
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
- },
- easeInOutQuart: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
- },
- easeInQuint: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t*t + b;
- },
- easeOutQuint: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t*t*t + 1) + b;
- },
- easeInOutQuint: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
- return c/2*((t-=2)*t*t*t*t + 2) + b;
- },
- easeInSine: function (x, t, b, c, d) {
- return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
- },
- easeOutSine: function (x, t, b, c, d) {
- return c * Math.sin(t/d * (Math.PI/2)) + b;
- },
- easeInOutSine: function (x, t, b, c, d) {
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
- },
- easeInExpo: function (x, t, b, c, d) {
- return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
- },
- easeOutExpo: function (x, t, b, c, d) {
- return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
- },
- easeInOutExpo: function (x, t, b, c, d) {
- if (t==0) return b;
- if (t==d) return b+c;
- if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
- return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
- },
- easeInCirc: function (x, t, b, c, d) {
- return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
- },
- easeOutCirc: function (x, t, b, c, d) {
- return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
- },
- easeInOutCirc: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
- },
- easeInElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- },
- easeOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
- },
- easeInOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
- },
- easeInBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*(t/=d)*t*((s+1)*t - s) + b;
- },
- easeOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
- },
- easeInOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
- },
- easeInBounce: function (x, t, b, c, d) {
- return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
- },
- easeOutBounce: function (x, t, b, c, d) {
- if ((t/=d) < (1/2.75)) {
- return c*(7.5625*t*t) + b;
- } else if (t < (2/2.75)) {
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
- } else if (t < (2.5/2.75)) {
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
- } else {
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
- }
- },
- easeInOutBounce: function (x, t, b, c, d) {
- if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
- return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
- }
-});
+jQuery.extend(jQuery.easing,
+ {
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert(jQuery.easing.default);
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c * (t /= d) * t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c * (t /= d) * (t - 2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t /= d / 2) < 1) return c / 2 * t * t + b;
+ return -c / 2 * ((--t) * (t - 2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c * (t /= d) * t * t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c * ((t = t / d - 1) * t * t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
+ return c / 2 * ((t -= 2) * t * t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c * (t /= d) * t * t * t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t = t / d - 1) * t * t * t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
+ return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c * (t /= d) * t * t * t * t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
+ return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t / d * (Math.PI / 2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t == 0) return b;
+ if (t == d) return b + c;
+ if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
+ return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s = 1.70158;
+ var p = 0;
+ var a = c;
+ if (t == 0) return b;
+ if ((t /= d) == 1) return b + c;
+ if (!p) p = d * .3;
+ if (a < Math.abs(c)) {
+ a = c;
+ var s = p / 4;
+ }
+ else var s = p / (2 * Math.PI) * Math.asin(c / a);
+ return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s = 1.70158;
+ var p = 0;
+ var a = c;
+ if (t == 0) return b;
+ if ((t /= d) == 1) return b + c;
+ if (!p) p = d * .3;
+ if (a < Math.abs(c)) {
+ a = c;
+ var s = p / 4;
+ }
+ else var s = p / (2 * Math.PI) * Math.asin(c / a);
+ return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s = 1.70158;
+ var p = 0;
+ var a = c;
+ if (t == 0) return b;
+ if ((t /= d / 2) == 2) return b + c;
+ if (!p) p = d * (.3 * 1.5);
+ if (a < Math.abs(c)) {
+ a = c;
+ var s = p / 4;
+ }
+ else var s = p / (2 * Math.PI) * Math.asin(c / a);
+ if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
+ return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c * (t /= d) * t * ((s + 1) * t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
+ return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t /= d) < (1 / 2.75)) {
+ return c * (7.5625 * t * t) + b;
+ } else if (t < (2 / 2.75)) {
+ return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
+ } else if (t < (2.5 / 2.75)) {
+ return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
+ } else {
+ return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
+ return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
+ }
+ });
/*
*
@@ -202,4 +223,4 @@ jQuery.extend( jQuery.easing,
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
- */
\ No newline at end of file
+ */
diff --git a/publisher/assets/js/jquery.popeye-2.1.js b/publisher/assets/js/jquery.popeye-2.1.js
index b3961ada..4922bfe3 100644
--- a/publisher/assets/js/jquery.popeye-2.1.js
+++ b/publisher/assets/js/jquery.popeye-2.1.js
@@ -4,14 +4,14 @@
* converts a HTML image list in image gallery with inline enlargement
*
* Copyright (C) 2008 - 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
* (at your option) any later version.
*
*/
-
+
(function ($) {
@@ -22,11 +22,12 @@
//
////////////////////////////////////////////////////////////////////////////
$.fn.popeye = function (options) {
-
+ 'use strict';
+
// build main options before element iteration
//----------------------------------------------------------------------
var opts = $.extend({}, $.fn.popeye.defaults, options);
-
+
////////////////////////////////////////////////////////////////////////////////
//
// firebug console output
@@ -34,12 +35,12 @@
// @param type String the message type [info | warn] (optional)
//
////////////////////////////////////////////////////////////////////////////////
- function debug(text,type) {
+ function debug(text, type) {
if (window.console && window.console.log && opts.debug) {
- if(type == 'info' && window.console.info) {
+ if (type === 'info' && window.console.info) {
window.console.info(text);
}
- else if(type == 'warn' && window.console.warn) {
+ else if (type === 'warn' && window.console.warn) {
window.console.warn(text);
}
else {
@@ -47,663 +48,666 @@
}
}
}
-
+
// let's go!
//----------------------------------------------------------------------
- return this.each(function(){
-
- // first thing to do: make ppy html visible
+ return this.each(function () {
+
+ // first thing to do: make ppy html visible
$(this).addClass('ppy-active');
-
+
// cache object
- var $self = $(this),
-
+ var $self = $(this),
+
// images
- img = $self.find('.ppy-imglist > li > a > img'),
- a = $self.find('.ppy-imglist > li > a'),
- tot = img.length,
-
+ img = $self.find('.ppy-imglist > li > a > img'),
+ a = $self.find('.ppy-imglist > li > a'),
+ tot = img.length,
+
// single image mode
- singleImageMode = (tot == 1) ? true : false,
-
+ singleImageMode = (tot === 1) ,
+
// flag for moueover check
- ismouseover = false,
-
+ ismouseover = false,
+
// start in compact mode
- enlarged = false,
-
+ enlarged = false,
+
// counter vars
- cur = 0, // array index of currently displayed image
-
+ cur = 0, // array index of currently displayed image
+
// extra classes
- eclass = 'ppy-expanded', //class to be applied to enlarged popeye-box
- lclass = 'ppy-loading', //class to be applied to stage while loading image
- sclass = 'ppy-single-image', //class to be applied to popeye-box if there's only one image to display
-
+ eclass = 'ppy-expanded', //class to be applied to enlarged popeye-box
+ lclass = 'ppy-loading', //class to be applied to stage while loading image
+ sclass = 'ppy-single-image', //class to be applied to popeye-box if there's only one image to display
+
// html nodes
- ppyPlaceholder = $(''),
- ppyStageWrap = $(''),
- ppyCaptionWrap = $(''),
- ppyOuter = $self.find('.ppy-outer'),
- ppyStage = $self.find('.ppy-stage'),
- ppyNav = $self.find('.ppy-nav'),
- ppyPrev = $self.find('.ppy-prev'),
- ppyNext = $self.find('.ppy-next'),
- ppySwitchEnlarge = $self.find('.ppy-switch-enlarge'),
- ppySwitchCompact = $self.find('.ppy-switch-compact').addClass('ppy-hidden'),
- ppyPlay = $self.find('.ppy-play'),
- ppyPause = $self.find('.ppy-pause').addClass('ppy-hidden'),
- ppyCaption = $self.find('.ppy-caption'),
- ppyText = $self.find('.ppy-text'),
- ppyCounter = $self.find('.ppy-counter'),
- ppyCurrent = $self.find('.ppy-current'),
- ppyTotal = $self.find('.ppy-total'),
-
+ ppyPlaceholder = $(''),
+ ppyStageWrap = $(''),
+ ppyCaptionWrap = $(''),
+ ppyOuter = $self.find('.ppy-outer'),
+ ppyStage = $self.find('.ppy-stage'),
+ ppyNav = $self.find('.ppy-nav'),
+ ppyPrev = $self.find('.ppy-prev'),
+ ppyNext = $self.find('.ppy-next'),
+ ppySwitchEnlarge = $self.find('.ppy-switch-enlarge'),
+ ppySwitchCompact = $self.find('.ppy-switch-compact').addClass('ppy-hidden'),
+ ppyPlay = $self.find('.ppy-play'),
+ ppyPause = $self.find('.ppy-pause').addClass('ppy-hidden'),
+ ppyCaption = $self.find('.ppy-caption'),
+ ppyText = $self.find('.ppy-text'),
+ ppyCounter = $self.find('.ppy-counter'),
+ ppyCurrent = $self.find('.ppy-current'),
+ ppyTotal = $self.find('.ppy-total'),
+
// css objects
- cssSelf = {
- position: 'absolute',
- width: 'auto',
- height: 'auto',
- margin: 0,
- top: 0,
- left: (opts.direction == 'right') ? 0 : 'auto',
- right: (opts.direction == 'left') ? 0 : 'auto'
- },
- cssStage = {
- height: ppyStage.height(),
- width: ppyStage.width()
- },
- cssCaption = {
- height: ppyCaption.height()
- },
- cssPlaceholder = {
- 'height': (opts.caption == 'hover' || false) ? ppyOuter.outerHeight() : $self.outerHeight(),
- 'width': (opts.caption == 'hover' || false) ? ppyOuter.outerWidth() : $self.outerWidth(),
- 'float': $self.css('float'),
- 'margin-top': $self.css('margin-top'),
- 'margin-right': $self.css('margin-right'),
- 'margin-bottom': $self.css('margin-bottom'),
- 'margin-left': $self.css('margin-left')
- };
-
- // make caption array from caption element or alt tag
+ cssSelf = {
+ position: 'absolute',
+ width: 'auto',
+ height: 'auto',
+ margin: 0,
+ top: 0,
+ left: (opts.direction === 'right') ? 0 : 'auto',
+ right: (opts.direction === 'left') ? 0 : 'auto'
+ },
+ cssStage = {
+ height: ppyStage.height(),
+ width: ppyStage.width()
+ },
+ cssCaption = {
+ height: ppyCaption.height()
+ },
+ cssPlaceholder = {
+ 'height': (opts.caption === 'hover' || false) ? ppyOuter.outerHeight() : $self.outerHeight(),
+ 'width': (opts.caption === 'hover' || false) ? ppyOuter.outerWidth() : $self.outerWidth(),
+ 'float': $self.css('float'),
+ 'margin-top': $self.css('margin-top'),
+ 'margin-right': $self.css('margin-right'),
+ 'margin-bottom': $self.css('margin-bottom'),
+ 'margin-left': $self.css('margin-left')
+ };
+
+ // make caption array from caption element or alt tag
var cap = [];
- for(var i=0; i 0 ? extcap.html() : img[i].alt;
+ cap[i] = extcap.length > 0 ? extcap.html() : img[i].alt;
}
-
+
// check for html errors
- if( !ppyStage.length || !ppyNav.length || !ppyOuter.length ) {
- debug('$.fn.popeye: Incorrect HTML structure','warn');
+ if (!ppyStage.length || !ppyNav.length || !ppyOuter.length) {
+ debug('$.fn.popeye: Incorrect HTML structure', 'warn');
}
-
+
// check for images
- else if( tot === 0 ) {
- debug('$.fn.popeye: No images found','warn');
+ else if (tot === 0) {
+ debug('$.fn.popeye: No images found', 'warn');
}
- // no errors, setup done!
+ // no errors, setup done!
//------------------------------------------------------------------
else {
singleImageMode ? debug('$.fn.popeye -> SingleImageMode started') : debug('$.fn.popeye -> ' + tot + ' thumbnails found.');
init();
}
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.showThumb
- // show thumbnail
- // @param i Int the index of the thumbnail to show (optional)
- // @param transition Bool show transition between images (optional)
- //
- ////////////////////////////////////////////////////////////////////
- function showThumb(i, transition) {
-
- // optional parameters
- transition = transition || false;
- i = i || cur;
-
- // set selected thumb as background image of stage
- var cssStageImage = {
- backgroundImage: 'url(' + img[i].src + ')'
- };
- // bogus animation css for IE
- var cssTemp = {
- height: '+=0'
- };
-
- // if we are in enlarged mode, return to thumb mode
- if(enlarged) {
-
- hideCaption();
-
- // fade image out and compact stage with transition
- ppyStage.fadeTo((opts.duration/2),0).animate( cssStage, {
- queue: false,
- duration: opts.duration,
- easing: opts.easing,
- complete: function() {
-
- enlarged = false;
- debug('$.fn.showThumb: Entering COMPACT MODE','info');
-
- // remove extra styling and reset z-index
- $self.removeClass(eclass);
- $self.css('z-index','').parent().css('z-index','');
-
- // switch buttons
- ppySwitchEnlarge.removeClass('ppy-hidden');
- ppySwitchCompact.addClass('ppy-hidden');
-
- // recursive function call
- showThumb();
-
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.showThumb
+ // show thumbnail
+ // @param i Int the index of the thumbnail to show (optional)
+ // @param transition Bool show transition between images (optional)
+ //
+ ////////////////////////////////////////////////////////////////////
+ function showThumb(i, transition) {
+
+ // optional parameters
+ transition = transition || false;
+ i = i || cur;
+
+ // set selected thumb as background image of stage
+ var cssStageImage = {
+ backgroundImage: 'url(' + img[i].src + ')'
+ };
+ // bogus animation css for IE
+ var cssTemp = {
+ height: '+=0'
+ };
+
+ // if we are in enlarged mode, return to thumb mode
+ if (enlarged) {
+
+ hideCaption();
+
+ // fade image out and compact stage with transition
+ ppyStage.fadeTo((opts.duration / 2), 0).animate(cssStage, {
+ queue: false,
+ duration: opts.duration,
+ easing: opts.easing,
+ complete: function () {
+
+ enlarged = false;
+ debug('$.fn.showThumb: Entering COMPACT MODE', 'info');
+
+ // remove extra styling and reset z-index
+ $self.removeClass(eclass);
+ $self.css('z-index', '').parent().css('z-index', '');
+
+ // switch buttons
+ ppySwitchEnlarge.removeClass('ppy-hidden');
+ ppySwitchCompact.addClass('ppy-hidden');
+
+ // recursive function call
+ showThumb();
+
+ // fade the stage back in
+ $(this).fadeTo((opts.duration / 2), 1);
+ }
+ });
+ }
+ else {
+
+ // if we navigate from one image to the next, fade out the stage
+ if (transition) {
+
+ // fade out image so that background shines through
+ // background can contain loading gfx
+ ppyStageWrap.addClass(lclass);
+ ppyStage.fadeTo((opts.duration / 2), 0);
+
+ // once thumb has loadded...
+ var thumbPreloader = new Image();
+ thumbPreloader.onload = function () {
+ debug('$.fn.popeye.showThumb: Thumbnail ' + i + ' loaded', 'info');
+
+ // remove loading indicator
+ ppyStageWrap.removeClass(lclass);
+
+ // add all upcoming animations to the queue so that
+ // they won't start when the preolader has loaded but when the fadeOut has finished
+ ppyStage.animate(cssTemp, 1, 'linear', function () {
+
+ // set the new image
+ ppyStage.css(cssStageImage);
// fade the stage back in
- $(this).fadeTo((opts.duration/2),1);
- }
- });
- }
- else {
-
- // if we navigate from one image to the next, fade out the stage
- if(transition) {
-
- // fade out image so that background shines through
- // background can contain loading gfx
- ppyStageWrap.addClass(lclass);
- ppyStage.fadeTo((opts.duration/2), 0);
-
- // once thumb has loadded...
- var thumbPreloader = new Image();
- thumbPreloader.onload = function() {
- debug('$.fn.popeye.showThumb: Thumbnail ' + i + ' loaded', 'info');
-
- // remove loading indicator
- ppyStageWrap.removeClass(lclass);
-
- // add all upcoming animations to the queue so that
- // they won't start when the preolader has loaded but when the fadeOut has finished
- ppyStage.animate(cssTemp,1,'linear',function(){
-
- // set the new image
- ppyStage.css(cssStageImage);
- // fade the stage back in
- $(this).fadeTo((opts.duration/2),1);
-
- // update counter and caption
- if(opts.caption == 'hover' && ismouseover) {
- showCaption(cap[i]);
- }
- else if(opts.caption == 'permanent') {
- updateCaption(cap[i]);
- }
- updateCounter();
- });
-
- // fix IE animated gif bug
- thumbPreloader.onload = function(){};
+ $(this).fadeTo((opts.duration / 2), 1);
+
+ // update counter and caption
+ if (opts.caption === 'hover' && ismouseover) {
+ showCaption(cap[i]);
+ }
+ else if (opts.caption === 'permanent') {
+ updateCaption(cap[i]);
+ }
+ updateCounter();
+ });
+
+ // fix IE animated gif bug
+ thumbPreloader.onload = function () {
};
- // preload thumb
- thumbPreloader.src = img[i].src;
- }
-
- // or just drag the image to the stage
- else {
- ppyStage.css(cssStageImage);
- updateCounter();
-
- //if(ismouseover) {
- showCaption(cap[i], true);
- //}
- }
-
- // preload big image for instant availability
- var preloader = new Image();
-
- preloader.onload = function() {
- debug('$.fn.popeye.showThumb: Image ' + i + ' loaded','info');
- preloader.onload = function(){};
};
-
- preloader.src = a[i].href;
+ // preload thumb
+ thumbPreloader.src = img[i].src;
}
- }
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.showImage
- // show large image
- // @param i Int the index of the image to show (optional)
- //
- ////////////////////////////////////////////////////////////////////
- function showImage(i) {
-
- // optional parameter i
- i = i || cur;
-
- // fade out image so that background shines through
- // background can contain loading gfx
- ppyStageWrap.addClass(lclass);
- ppyStage.fadeTo((opts.duration/2), 0);
-
- // if there are multiple popeyes opened at the same time,
- // make sure the current one gets a higher z-index
- var allPpy = $('.' + eclass);
- allPpy.css('z-index',opts.zindex-1);
-
- //both ppy and placeholder (for IE7) need high z-index
- $self.css('z-index',opts.zindex).parent().css('z-index',opts.zindex);
-
- // once image has loadded...
+
+ // or just drag the image to the stage
+ else {
+ ppyStage.css(cssStageImage);
+ updateCounter();
+
+ //if(ismouseover) {
+ showCaption(cap[i], true);
+ //}
+ }
+
+ // preload big image for instant availability
var preloader = new Image();
- preloader.onload = function() {
-
- // remove loading class
- ppyStageWrap.removeClass(lclass);
-
- // set css
- var cssStageTo = {
- width: preloader.width,
- height: preloader.height
- };
- var cssStageIm = {
- backgroundImage: 'url(' + a[i].href + ')',
- backgroundPosition: 'left top'
+
+ preloader.onload = function () {
+ debug('$.fn.popeye.showThumb: Image ' + i + ' loaded', 'info');
+ preloader.onload = function () {
};
-
- hideCaption();
-
- // show transitional animation
- ppyStage.animate( cssStageTo, {
- queue: false,
- duration: opts.duration,
- easing: opts.easing,
- complete: function(){
-
- if(opts.navigation == 'hover' && ismouseover) {
- showNav();
- }
-
- enlarged = true;
- debug('$.fn.popeye.showImage: Entering ENLARGED MODE','info');
-
- // add extra class, expanded box can be styled accordingly
- $self.addClass(eclass);
-
- // switch buttons
- ppySwitchCompact.removeClass('ppy-hidden');
- ppySwitchEnlarge.addClass('ppy-hidden');
-
- updateCounter();
-
- // set new bg image and fade it in
- $(this).css(cssStageIm).fadeTo((opts.duration/2),1);
-
- // show caption
- showCaption(cap[i]);
-
- preloadNeighbours();
- }
- });
};
-
- // preload image
+
preloader.src = a[i].href;
-
- }
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.updateCounter
- // update image counter
- // @param i Int the index of the image (optional)
- //
- ////////////////////////////////////////////////////////////////////
- function updateCounter(i) {
-
- // optional parameter
- i = i || cur;
-
- ppyTotal.text(tot); // total images
- ppyCurrent.text(i + 1); // current image number
- debug('$.fn.popeye.updateCounter: Displaying image ' + (i + 1) + ' of ' + tot);
- }
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.preloadNeighbours
- // preload next and previos image
- // @param i Int the index of the current image (optional)
- //
- ////////////////////////////////////////////////////////////////////
- function preloadNeighbours(i) {
-
- // optional parameter
- i = i || cur;
-
- var preloaderNext = new Image();
- var preloaderPrev = new Image();
-
- var neighbour = i;
-
- // next image
- if( neighbour < ( tot - 1) ) {
- neighbour++;
- } else {
- neighbour = 0;
- }
- preloaderNext.src = a[neighbour].href;
-
- // previous image
- neighbour = i;
- if( neighbour <= 0 ) {
- neighbour = tot - 1;
- } else {
- neighbour--;
- }
- preloaderPrev.src = a[neighbour].href;
- }
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.showNav
- //
- ////////////////////////////////////////////////////////////////////
- function showNav() {
- ppyNav.stop().fadeTo(150,opts.opacity);
}
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.hideNav
- //
- ////////////////////////////////////////////////////////////////////
- function hideNav() {
- ppyNav.stop().fadeTo(150,0);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.showImage
+ // show large image
+ // @param i Int the index of the image to show (optional)
+ //
+ ////////////////////////////////////////////////////////////////////
+ function showImage(i) {
+
+ // optional parameter i
+ i = i || cur;
+
+ // fade out image so that background shines through
+ // background can contain loading gfx
+ ppyStageWrap.addClass(lclass);
+ ppyStage.fadeTo((opts.duration / 2), 0);
+
+ // if there are multiple popeyes opened at the same time,
+ // make sure the current one gets a higher z-index
+ var allPpy = $('.' + eclass);
+ allPpy.css('z-index', opts.zindex - 1);
+
+ //both ppy and placeholder (for IE7) need high z-index
+ $self.css('z-index', opts.zindex).parent().css('z-index', opts.zindex);
+
+ // once image has loadded...
+ var preloader = new Image();
+ preloader.onload = function () {
+
+ // remove loading class
+ ppyStageWrap.removeClass(lclass);
+
+ // set css
+ var cssStageTo = {
+ width: preloader.width,
+ height: preloader.height
+ };
+ var cssStageIm = {
+ backgroundImage: 'url(' + a[i].href + ')',
+ backgroundPosition: 'left top'
+ };
+
+ hideCaption();
+
+ // show transitional animation
+ ppyStage.animate(cssStageTo, {
+ queue: false,
+ duration: opts.duration,
+ easing: opts.easing,
+ complete: function () {
+
+ if (opts.navigation === 'hover' && ismouseover) {
+ showNav();
+ }
+
+ enlarged = true;
+ debug('$.fn.popeye.showImage: Entering ENLARGED MODE', 'info');
+
+ // add extra class, expanded box can be styled accordingly
+ $self.addClass(eclass);
+
+ // switch buttons
+ ppySwitchCompact.removeClass('ppy-hidden');
+ ppySwitchEnlarge.addClass('ppy-hidden');
+
+ updateCounter();
+
+ // set new bg image and fade it in
+ $(this).css(cssStageIm).fadeTo((opts.duration / 2), 1);
+
+ // show caption
+ showCaption(cap[i]);
+
+ preloadNeighbours();
+ }
+ });
+ };
+
+ // preload image
+ preloader.src = a[i].href;
+
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.updateCounter
+ // update image counter
+ // @param i Int the index of the image (optional)
+ //
+ ////////////////////////////////////////////////////////////////////
+ function updateCounter(i) {
+
+ // optional parameter
+ i = i || cur;
+
+ ppyTotal.text(tot); // total images
+ ppyCurrent.text(i + 1); // current image number
+ debug('$.fn.popeye.updateCounter: Displaying image ' + (i + 1) + ' of ' + tot);
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.preloadNeighbours
+ // preload next and previos image
+ // @param i Int the index of the current image (optional)
+ //
+ ////////////////////////////////////////////////////////////////////
+ function preloadNeighbours(i) {
+
+ // optional parameter
+ i = i || cur;
+
+ var preloaderNext = new Image();
+ var preloaderPrev = new Image();
+
+ var neighbour = i;
+
+ // next image
+ if (neighbour < ( tot - 1)) {
+ neighbour++;
+ } else {
+ neighbour = 0;
}
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.updateCaption
- // @param caption String the caption string
- //
- ////////////////////////////////////////////////////////////////////
- function updateCaption(caption) {
-
- if(opts.caption) {
- // update text box
- ppyText.html(caption);
- }
+ preloaderNext.src = a[neighbour].href;
+
+ // previous image
+ neighbour = i;
+ if (neighbour <= 0) {
+ neighbour = tot - 1;
+ } else {
+ neighbour--;
}
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.showCaption
- // @param caption String the caption string
- // @param force Boolean force caption display even if caption string is empty
- //
- ////////////////////////////////////////////////////////////////////
- function showCaption(caption,force) {
-
- // if caption string is not empty...
- if(caption && opts.caption) {
- updateCaption(caption);
-
- debug('$.fn.popeye.showCaption -> ppyCaptionWrap.outerHeight(true): ' + ppyCaptionWrap.outerHeight(true));
-
- // make caption box visible
- var cssTempCaption = {
- visibility: 'visible'
- };
- ppyCaption.css(cssTempCaption);
-
- if(opts.caption === 'permanent' && !enlarged) {
-
- // return to original caption height
- ppyCaption.css(cssCaption);
- }
- else {
-
- // or animate it to its childs height
- ppyCaption.animate({'height': ppyCaptionWrap.outerHeight(true)}, {
- queue: false,
- duration: 90,
- easing: opts.easing
- });
- }
- }
- // if there's no caption to show...
- else if(!caption && !force) {
- hideCaption();
- }
+ preloaderPrev.src = a[neighbour].href;
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.showNav
+ //
+ ////////////////////////////////////////////////////////////////////
+ function showNav() {
+ ppyNav.stop().fadeTo(150, opts.opacity);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.hideNav
+ //
+ ////////////////////////////////////////////////////////////////////
+ function hideNav() {
+ ppyNav.stop().fadeTo(150, 0);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.updateCaption
+ // @param caption String the caption string
+ //
+ ////////////////////////////////////////////////////////////////////
+ function updateCaption(caption) {
+
+ if (opts.caption) {
+ // update text box
+ ppyText.html(caption);
}
-
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.hideCaption
- //
- ////////////////////////////////////////////////////////////////////
- function hideCaption() {
-
- // css to hide caption but allow its inner text box to expand to content height
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.showCaption
+ // @param caption String the caption string
+ // @param force Boolean force caption display even if caption string is empty
+ //
+ ////////////////////////////////////////////////////////////////////
+ function showCaption(caption, force) {
+
+ // if caption string is not empty...
+ if (caption && opts.caption) {
+ updateCaption(caption);
+
+ debug('$.fn.popeye.showCaption -> ppyCaptionWrap.outerHeight(true): ' + ppyCaptionWrap.outerHeight(true));
+
+ // make caption box visible
var cssTempCaption = {
- visibility: 'hidden',
- overflow: 'hidden'
+ visibility: 'visible'
};
-
- // slide up caption box and hide it when done
- ppyCaption.animate( {'height': '0px'}, {
- queue: false,
- duration: 90,
- easing: opts.easing,
- complete: function() {
- ppyCaption.css(cssTempCaption);
- }
- });
- }
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.previous
- // show previous image
- //
- ////////////////////////////////////////////////////////////////////
- function previous() {
- if( cur <= 0 ) {
- cur = tot - 1;
- } else {
- cur--;
- }
- if(enlarged) {
- showImage(cur);
+ ppyCaption.css(cssTempCaption);
+
+ if (opts.caption === 'permanent' && !enlarged) {
+
+ // return to original caption height
+ ppyCaption.css(cssCaption);
}
else {
- showThumb(cur, true);
+
+ // or animate it to its childs height
+ ppyCaption.animate({'height': ppyCaptionWrap.outerHeight(true)}, {
+ queue: false,
+ duration: 90,
+ easing: opts.easing
+ });
}
- return cur;
}
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.next
- // show next image
- //
- ////////////////////////////////////////////////////////////////////
- function next() {
- if( cur < ( tot - 1) ) {
- cur++;
- } else {
- cur = 0;
- }
- if(enlarged) {
- showImage(cur);
- }
- else {
- showThumb(cur, true);
- }
- return cur;
+ // if there's no caption to show...
+ else if (!caption && !force) {
+ hideCaption();
}
-
- ////////////////////////////////////////////////////////////////////
- //
- // $.fn.popeye.init
- // setup of popeye DOM and events
- //
- ////////////////////////////////////////////////////////////////////
- function init() {
-
- // popeye dom setup
- //--------------------------------------------------------------
-
- // add css
- ppyPlaceholder.css(cssPlaceholder);
- $self.css(cssSelf);
-
- // wrap popeye in placeholder
- $self.wrap(ppyPlaceholder);
-
- // wrap stage in container for extra styling (e.g. loading gfx)
- ppyStageWrap = ppyStage.wrap(ppyStageWrap).parent();
-
- // wrap caption contents in wrapper (can't use wrap() here...)
- ppyCaptionWrap = ppyCaption.wrapInner(ppyCaptionWrap).children().eq(0);
-
- // display first image
- showThumb();
-
- // add event handlers
- //--------------------------------------------------------------
- // hover behaviour for navigation
- if(opts.navigation == 'hover') {
- hideNav();
- $self.hover(
- function(){
- showNav();
- },
- function(){
- hideNav();
- }
- );
- ppyNav.hover(
- function(){
- showNav();
- },
- function(){
- hideNav();
- }
- );
- }
- if(!singleImageMode) {
-
- // previous image button
- ppyPrev.click(function(e){
- e.stopPropagation();
- previous();
- });
-
- // next image button
- ppyNext.click(function(e){
- e.stopPropagation();
- next();
- });
-
- }
- else {
- $self.addClass(sclass);
- ppyPrev.remove();
- ppyNext.remove();
- ppyPlay.remove();
- ppyPause.remove();
- ppyCounter.remove();
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.hideCaption
+ //
+ ////////////////////////////////////////////////////////////////////
+ function hideCaption() {
+
+ // css to hide caption but allow its inner text box to expand to content height
+ var cssTempCaption = {
+ visibility: 'hidden',
+ overflow: 'hidden'
+ };
+
+ // slide up caption box and hide it when done
+ ppyCaption.animate({'height': '0px'}, {
+ queue: false,
+ duration: 90,
+ easing: opts.easing,
+ complete: function () {
+ ppyCaption.css(cssTempCaption);
}
-
- // hover behaviour for caption
- if(opts.caption == 'hover') {
- hideCaption();
- $self.hover(
- function(){
- showCaption(cap[cur]);
- },
- function(){
- hideCaption(true);
- }
- );
- }
-
- // enlarge image button
- ppySwitchEnlarge.click(function(e){
- e.stopPropagation();
- showImage();
- return false;
- });
-
- // compact image button
- ppySwitchCompact.click(function(e){
- e.stopPropagation();
- showThumb(cur);
- return false;
- });
-
- ppyStage.click(function(){
- if(enlarged) {
- showThumb(cur);
+ });
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.previous
+ // show previous image
+ //
+ ////////////////////////////////////////////////////////////////////
+ function previous() {
+ if (cur <= 0) {
+ cur = tot - 1;
+ } else {
+ cur--;
+ }
+ if (enlarged) {
+ showImage(cur);
+ }
+ else {
+ showThumb(cur, true);
+ }
+ return cur;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.next
+ // show next image
+ //
+ ////////////////////////////////////////////////////////////////////
+ function next() {
+ if (cur < ( tot - 1)) {
+ cur++;
+ } else {
+ cur = 0;
+ }
+ if (enlarged) {
+ showImage(cur);
+ }
+ else {
+ showThumb(cur, true);
+ }
+ return cur;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //
+ // $.fn.popeye.init
+ // setup of popeye DOM and events
+ //
+ ////////////////////////////////////////////////////////////////////
+ function init() {
+
+ // popeye dom setup
+ //--------------------------------------------------------------
+
+ // add css
+ ppyPlaceholder.css(cssPlaceholder);
+ $self.css(cssSelf);
+
+ // wrap popeye in placeholder
+ $self.wrap(ppyPlaceholder);
+
+ // wrap stage in container for extra styling (e.g. loading gfx)
+ ppyStageWrap = ppyStage.wrap(ppyStageWrap).parent();
+
+ // wrap caption contents in wrapper (can't use wrap() here...)
+ ppyCaptionWrap = ppyCaption.wrapInner(ppyCaptionWrap).children().eq(0);
+
+ // display first image
+ showThumb();
+
+ // add event handlers
+ //--------------------------------------------------------------
+ // hover behaviour for navigation
+ if (opts.navigation == 'hover') {
+ hideNav();
+ $self.hover(
+ function () {
+ showNav();
+ },
+ function () {
+ hideNav();
}
- else {
- showImage();
+ );
+ ppyNav.hover(
+ function () {
+ showNav();
+ },
+ function () {
+ hideNav();
}
-
- });
-
- //play button
- ppyPlay.click(function(e){
+ );
+ }
+ if (!singleImageMode) {
+
+ // previous image button
+ ppyPrev.click(function (e) {
e.stopPropagation();
-
- // switch buttons
- ppyPause.removeClass('ppy-hidden');
- ppyPlay.addClass('ppy-hidden');
-
- // initiate Slideshow
- slideshow = window.setInterval( function(){
- next();
- }, opts.slidespeed);
- return false;
+ previous();
});
-
- //pause button
- ppyPause.click(function(e){
+
+ // next image button
+ ppyNext.click(function (e) {
e.stopPropagation();
-
- // switch buttons
- ppyPlay.removeClass('ppy-hidden');
- ppyPause.addClass('ppy-hidden');
-
- // stop Slideshow
- window.clearInterval(slideshow);
- return false;
- });
-
- // mouseover flag
- $self.mouseenter(function(){
- ismouseover = true;
- }).mouseleave(function(){
- ismouseover = false;
+ next();
});
-
- // start autoslide
- if(opts.autoslide) {
- ppyPlay.trigger('click');
+
+ }
+ else {
+ $self.addClass(sclass);
+ ppyPrev.remove();
+ ppyNext.remove();
+ ppyPlay.remove();
+ ppyPause.remove();
+ ppyCounter.remove();
+ }
+
+ // hover behaviour for caption
+ if (opts.caption === 'hover') {
+ hideCaption();
+ $self.hover(
+ function () {
+ showCaption(cap[cur]);
+ },
+ function () {
+ hideCaption(true);
+ }
+ );
+ }
+
+ // enlarge image button
+ ppySwitchEnlarge.click(function (e) {
+ e.stopPropagation();
+ showImage();
+ return false;
+ });
+
+ // compact image button
+ ppySwitchCompact.click(function (e) {
+ e.stopPropagation();
+ showThumb(cur);
+ return false;
+ });
+
+ ppyStage.click(function () {
+ if (enlarged) {
+ showThumb(cur);
+ }
+ else {
+ showImage();
}
+ });
+
+ //play button
+ ppyPlay.click(function (e) {
+ e.stopPropagation();
+
+ // switch buttons
+ ppyPause.removeClass('ppy-hidden');
+ ppyPlay.addClass('ppy-hidden');
+
+ // initiate Slideshow
+ var slideshow;
+ slideshow = window.setInterval(function () {
+ next();
+ }, opts.slidespeed);
+ return false;
+ });
+
+ //pause button
+ ppyPause.click(function (e) {
+ e.stopPropagation();
+
+ // switch buttons
+ ppyPlay.removeClass('ppy-hidden');
+ ppyPause.addClass('ppy-hidden');
+
+ // stop Slideshow
+ window.clearInterval(slideshow);
+ return false;
+ });
+
+ // mouseover flag
+ $self.mouseenter(function () {
+ ismouseover = true;
+ }).mouseleave(function () {
+ ismouseover = false;
+ });
+
+ // start autoslide
+ if (opts.autoslide) {
+ ppyPlay.trigger('click');
}
+
+ }
});
};
-
+
////////////////////////////////////////////////////////////////////////////
//
// $.fn.popeye.defaults
@@ -711,26 +715,26 @@
//
////////////////////////////////////////////////////////////////////////////
$.fn.popeye.defaults = {
-
+
navigation: 'hover', //visibility of navigation - can be 'permanent' or 'hover'
- caption: 'hover', //visibility of caption, based on image title - can be false, 'permanent' or 'hover'
-
- zindex: 10000, //z-index of the expanded popeye-box. enter a z-index that works well with your site and doesn't overlay your site's navigational elements like dropdowns
-
- direction: 'right', //direction that popeye-box opens, can be 'left' or 'right'
- duration: 240, //duration of transitional effect when enlarging or closing the box
- opacity: 0.8, //opacity of navigational overlay (only applicable if 'navigation' is set to 'hover'
- easing: 'swing', //easing type, can be 'swing', 'linear' or any of jQuery Easing Plugin types (Plugin required)
-
+ caption: 'hover', //visibility of caption, based on image title - can be false, 'permanent' or 'hover'
+
+ zindex: 10000, //z-index of the expanded popeye-box. enter a z-index that works well with your site and doesn't overlay your site's navigational elements like dropdowns
+
+ direction: 'right', //direction that popeye-box opens, can be 'left' or 'right'
+ duration: 240, //duration of transitional effect when enlarging or closing the box
+ opacity: 0.8, //opacity of navigational overlay (only applicable if 'navigation' is set to 'hover'
+ easing: 'swing', //easing type, can be 'swing', 'linear' or any of jQuery Easing Plugin types (Plugin required)
+
slidespeed: 2000, //timespan that one image is shown in a slideshow
- autoslide: false, //should the slideshow start automatically?
-
- debug: false //turn on console output (slows down IE8!)
+ autoslide: false, //should the slideshow start automatically?
+
+ debug: false
};
-
+
// end of closure, bind to jQuery Object
-})(jQuery);
+})(jQuery);
////////////////////////////////////////////////////////////////////////////////
diff --git a/publisher/assets/js/publisher.js b/publisher/assets/js/publisher.js
index c710be27..cf025649 100644
--- a/publisher/assets/js/publisher.js
+++ b/publisher/assets/js/publisher.js
@@ -1,6 +1,6 @@
var $publisher = jQuery.noConflict();
-$publisher(document).ready(function() {
+$publisher(document).ready(function () {
//Functions to execute on page load
if ($publisher.isFunction($publisher.fn.tabs)) {
$publisher("#tabs").tabs();
@@ -38,4 +38,4 @@ function publisher_updateSelectOption(fromMenuId, toMenuId) {
index++;
}
}
-}
\ No newline at end of file
+}
diff --git a/publisher/assets/js/rating.js b/publisher/assets/js/rating.js
index e225fce2..33d00834 100644
--- a/publisher/assets/js/rating.js
+++ b/publisher/assets/js/rating.js
@@ -1,118 +1,121 @@
/*
-Page: rating.js
-Created: Aug 2006
-Last Mod: Mar 11 2007
-Handles actions and requests for rating bars.
----------------------------------------------------------
-ryan masuga, masugadesign.com
-ryan@masugadesign.com
-Licensed under a Creative Commons Attribution 3.0 License.
-http://creativecommons.org/licenses/by/3.0/
-See readme.txt for full credit details.
---------------------------------------------------------- */
+ Page: rating.js
+ Created: Aug 2006
+ Last Mod: Mar 11 2007
+ Handles actions and requests for rating bars.
+ ---------------------------------------------------------
+ ryan masuga, masugadesign.com
+ ryan@masugadesign.com
+ Licensed under a Creative Commons Attribution 3.0 License.
+ http://creativecommons.org/licenses/by/3.0/
+ See readme.txt for full credit details.
+ --------------------------------------------------------- */
var xmlhttp;
- /*@cc_on @*/
- /*@if (@_jscript_version >= 5)
- try {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
- } catch (e) {
- try {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
- } catch (E) {
- xmlhttp=false
- }
- }
- @else
- xmlhttp=false
- @end @*/
- if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
- try {
- xmlhttp = new XMLHttpRequest();
- } catch (e) {
- xmlhttp=false
- }
- }
- function myXMLHttpRequest() {
- var xmlhttplocal;
- try {
- xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
- } catch (e) {
- try {
- xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
- } catch (E) {
- xmlhttplocal=false;
- }
- }
+/*@cc_on @*/
+/*@if (@_jscript_version >= 5)
+ try {
+ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
+ } catch (e) {
+ try {
+ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
+ } catch (E) {
+ xmlhttp=false
+ }
+ }
+ @else
+ xmlhttp=false
+ @end @*/
+if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
+ try {
+ xmlhttp = new XMLHttpRequest();
+ } catch (e) {
+ xmlhttp = false
+ }
+}
+function myXMLHttpRequest() {
+ var xmlhttplocal;
+ try {
+ xmlhttplocal = new ActiveXObject("Msxml2.XMLHTTP")
+ } catch (e) {
+ try {
+ xmlhttplocal = new ActiveXObject("Microsoft.XMLHTTP")
+ } catch (E) {
+ xmlhttplocal = false;
+ }
+ }
- if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') {
- try {
- var xmlhttplocal = new XMLHttpRequest();
- } catch (e) {
- var xmlhttplocal=false;
- alert('couldn\'t create xmlhttp object');
- }
- }
- return(xmlhttplocal);
+ if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
+ try {
+ var xmlhttplocal = new XMLHttpRequest();
+ } catch (e) {
+ var xmlhttplocal = false;
+ alert('couldn\'t create xmlhttp object');
+ }
+ }
+ return (xmlhttplocal);
}
function sndReq(itemid, rating) {
- changeText( 'unit_long'+itemid, '');
- xmlhttp.open('get', 'include/ajax_rating.php?itemid='+itemid+'&rating='+rating);
+ changeText('unit_long' + itemid, '');
+ xmlhttp.open('get', 'include/ajax_rating.php?itemid=' + itemid + '&rating=' + rating);
xmlhttp.onreadystatechange = handleResponse;
xmlhttp.send(null);
}
function handleResponse() {
- if(xmlhttp.readyState == 4){
- if (xmlhttp.status == 200){
+ if (xmlhttp.readyState == 4) {
+ if (xmlhttp.status == 200) {
- var response = xmlhttp.responseText;
- var update = new Array();
+ var response = xmlhttp.responseText;
+ var update = new Array();
- if(response.indexOf('|') != -1) {
- update = response.split('|');
- changeText(update[0], update[1]);
+ if (response.indexOf('|') != -1) {
+ update = response.split('|');
+ changeText(update[0], update[1]);
+ }
}
- }
}
}
-function changeText( div2show, text ) {
+function changeText(div2show, text) {
// Detect Browser
var IE = (document.all) ? 1 : 0;
var DOM = 0;
- if (parseInt(navigator.appVersion) >=5) {DOM=1}
+ if (parseInt(navigator.appVersion) >= 5) {
+ DOM = 1
+ }
// Grab the content from the requested "div" and show it in the "publisher_container"
if (DOM) {
var viewer = document.getElementById(div2show);
viewer.innerHTML = text;
- } else if(IE) {
+ } else if (IE) {
document.all[div2show].innerHTML = text;
}
}
/* =============================================================== */
var ratingAction = {
- 'a.rater' : function(element){
- element.onclick = function(){
+ 'a.rater': function (element) {
+ element.onclick = function () {
- var parameterString = this.href.replace(/.*\?(.*)/, "$1");
- var parameterTokens = parameterString.split("&");
- var parameterList = new Array();
+ var parameterString = this.href.replace(/.*\?(.*)/, "$1");
+ var parameterTokens = parameterString.split("&");
+ var parameterList = new Array();
- for (j = 0; j < parameterTokens.length; j++) {
- var parameterName = parameterTokens[j].replace(/(.*)=.*/, "$1");
- var parameterValue = parameterTokens[j].replace(/.*=(.*)/, "$1");
- parameterList[parameterName] = parameterValue;
- }
- var theItemid = parameterList['itemid'];
- var theRating = parameterList['rating'];
+ for (j = 0; j < parameterTokens.length; j++) {
+ var parameterName = parameterTokens[j].replace(/(.*)=.*/, "$1");
+ var parameterValue = parameterTokens[j].replace(/.*=(.*)/, "$1");
+ parameterList[parameterName] = parameterValue;
+ }
+ var theItemid = parameterList['itemid'];
+ var theRating = parameterList['rating'];
- sndReq(theItemid,theRating); return false;
- }
- }
+ sndReq(theItemid, theRating);
+ return false;
+ }
+ }
- };
+};
Behaviour.register(ratingAction);
diff --git a/publisher/assets/js/script.easing.js b/publisher/assets/js/script.easing.js
index 396214a9..a94ce2f3 100644
--- a/publisher/assets/js/script.easing.js
+++ b/publisher/assets/js/script.easing.js
@@ -10,309 +10,324 @@
* Requires: 1.2.2+
*/
-(function($) {
+(function ($) {
-var types = ['DOMMouseScroll', 'mousewheel'];
+ var types = ['DOMMouseScroll', 'mousewheel'];
-$.event.special.mousewheel = {
- setup: function() {
- if ( this.addEventListener )
- for ( var i=types.length; i; )
- this.addEventListener( types[--i], handler, false );
- else
- this.onmousewheel = handler;
- },
+ $.event.special.mousewheel = {
+ setup: function () {
+ if (this.addEventListener)
+ for (var i = types.length; i;)
+ this.addEventListener(types[--i], handler, false);
+ else
+ this.onmousewheel = handler;
+ },
- teardown: function() {
- if ( this.removeEventListener )
- for ( var i=types.length; i; )
- this.removeEventListener( types[--i], handler, false );
- else
- this.onmousewheel = null;
- }
-};
+ teardown: function () {
+ if (this.removeEventListener)
+ for (var i = types.length; i;)
+ this.removeEventListener(types[--i], handler, false);
+ else
+ this.onmousewheel = null;
+ }
+ };
-$.fn.extend({
- mousewheel: function(fn) {
- return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
- },
+ $.fn.extend({
+ mousewheel: function (fn) {
+ return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
+ },
- unmousewheel: function(fn) {
- return this.unbind("mousewheel", fn);
- }
-});
+ unmousewheel: function (fn) {
+ return this.unbind("mousewheel", fn);
+ }
+ });
-function handler(event) {
- var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
+ function handler(event) {
+ var args = [].slice.call(arguments, 1), delta = 0, returnValue = true;
- event = $.event.fix(event || window.event);
- event.type = "mousewheel";
+ event = $.event.fix(event || window.event);
+ event.type = "mousewheel";
- if ( event.wheelDelta ) delta = event.wheelDelta/120;
- if ( event.detail ) delta = -event.detail/3;
+ if (event.wheelDelta) delta = event.wheelDelta / 120;
+ if (event.detail) delta = -event.detail / 3;
- // Add events and delta to the front of the arguments
- args.unshift(event, delta);
+ // Add events and delta to the front of the arguments
+ args.unshift(event, delta);
- return $.event.handle.apply(this, args);
-}
+ return $.event.handle.apply(this, args);
+ }
})(jQuery);
/**
- * @version $Id: $Revision
- * @package jquery
- * @subpackage lofslidernews
- * @copyright Copyright (C) JAN 2010 LandOfCoder.com <@emai:landofcoder@gmail.com>. All rights reserved.
+ * @version $Id: $Revision
+ * @package jquery
+ * @subpackage lofslidernews
+ * @copyright Copyright (C) JAN 2010 LandOfCoder.com <@emai:landofcoder@gmail.com>. All rights reserved.
* @website http://landofcoder.com
- * @license This plugin is dual-licensed under the GNU General Public License and the MIT License
+ * @license This plugin is dual-licensed under the GNU General Public License and the MIT License
*/
// JavaScript Document
-(function($) {
- $.fn.lofJSidernews = function( settings ) {
- return this.each(function() {
- // get instance of the lofSiderNew.
- new $.lofSidernews( this, settings );
- });
- };
- $.lofSidernews = function( obj, settings ){
- this.settings = {
- direction : '',
- mainItemSelector : 'li',
- navInnerSelector : 'ul',
- navSelector : 'li' ,
- navigatorEvent : 'click',
- wapperSelector: '.lof-main-wapper',
- interval : 4000,
- auto : true, // whether to automatic play the slideshow
- maxItemDisplay : 3,
- startItem : 0,
- navPosition : 'vertical',
- navigatorHeight : 100,
- navigatorWidth : 210,
- duration : 600,
- navItemsSelector : '.lof-navigator li',
- navOuterSelector : '.lof-navigator-outer' ,
- isPreloaded : true,
- easing : 'easeInOutQuad'
- };
- $.extend( this.settings, settings ||{} );
- this.nextNo = null;
- this.previousNo = null;
- this.maxWidth = this.settings.mainWidth || 600;
- this.wrapper = $( obj ).find( this.settings.wapperSelector );
- this.slides = this.wrapper.find( this.settings.mainItemSelector );
- if( !this.wrapper.length || !this.slides.length ) return ;
- // set width of wapper
- if( this.settings.maxItemDisplay > this.slides.length ){
- this.settings.maxItemDisplay = this.slides.length;
- }
- this.currentNo = isNaN(this.settings.startItem)||this.settings.startItem > this.slides.length?0:this.settings.startItem;
- this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector );
- this.navigatorItems = $( obj ).find( this.settings.navItemsSelector ) ;
- this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector );
+(function ($) {
+ $.fn.lofJSidernews = function (settings) {
+ return this.each(function () {
+ // get instance of the lofSiderNew.
+ new $.lofSidernews(this, settings);
+ });
+ };
+ $.lofSidernews = function (obj, settings) {
+ this.settings = {
+ direction: '',
+ mainItemSelector: 'li',
+ navInnerSelector: 'ul',
+ navSelector: 'li',
+ navigatorEvent: 'click',
+ wapperSelector: '.lof-main-wapper',
+ interval: 4000,
+ auto: true, // whether to automatic play the slideshow
+ maxItemDisplay: 3,
+ startItem: 0,
+ navPosition: 'vertical',
+ navigatorHeight: 100,
+ navigatorWidth: 210,
+ duration: 600,
+ navItemsSelector: '.lof-navigator li',
+ navOuterSelector: '.lof-navigator-outer',
+ isPreloaded: true,
+ easing: 'easeInOutQuad'
+ };
+ $.extend(this.settings, settings || {});
+ this.nextNo = null;
+ this.previousNo = null;
+ this.maxWidth = this.settings.mainWidth || 600;
+ this.wrapper = $(obj).find(this.settings.wapperSelector);
+ this.slides = this.wrapper.find(this.settings.mainItemSelector);
+ if (!this.wrapper.length || !this.slides.length) return;
+ // set width of wapper
+ if (this.settings.maxItemDisplay > this.slides.length) {
+ this.settings.maxItemDisplay = this.slides.length;
+ }
+ this.currentNo = isNaN(this.settings.startItem) || this.settings.startItem > this.slides.length ? 0 : this.settings.startItem;
+ this.navigatorOuter = $(obj).find(this.settings.navOuterSelector);
+ this.navigatorItems = $(obj).find(this.settings.navItemsSelector);
+ this.navigatorInner = this.navigatorOuter.find(this.settings.navInnerSelector);
- if( this.settings.navPosition == 'horizontal' ){
- this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth );
- this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth );
- this.navigatorOuter.height( this.settings.navigatorHeight );
+ if (this.settings.navPosition == 'horizontal') {
+ this.navigatorInner.width(this.slides.length * this.settings.navigatorWidth);
+ this.navigatorOuter.width(this.settings.maxItemDisplay * this.settings.navigatorWidth);
+ this.navigatorOuter.height(this.settings.navigatorHeight);
- } else {
- this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight );
+ } else {
+ this.navigatorInner.height(this.slides.length * this.settings.navigatorHeight);
- this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight );
- this.navigatorOuter.width( this.settings.navigatorWidth );
- }
- this.navigratorStep = this.__getPositionMode( this.settings.navPosition );
- this.directionMode = this.__getDirectionMode();
+ this.navigatorOuter.height(this.settings.maxItemDisplay * this.settings.navigatorHeight);
+ this.navigatorOuter.width(this.settings.navigatorWidth);
+ }
+ this.navigratorStep = this.__getPositionMode(this.settings.navPosition);
+ this.directionMode = this.__getDirectionMode();
- if( this.settings.direction == 'opacity') {
- this.wrapper.addClass( 'lof-opacity' );
- $(this.slides).css('opacity',0).eq(this.currentNo).css('opacity',1);
- } else {
- this.wrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':( this.maxWidth ) * this.slides.length } );
- }
+ if (this.settings.direction == 'opacity') {
+ this.wrapper.addClass('lof-opacity');
+ $(this.slides).css('opacity', 0).eq(this.currentNo).css('opacity', 1);
+ } else {
+ this.wrapper.css({'left': '-' + this.currentNo * this.maxSize + 'px', 'width': ( this.maxWidth ) * this.slides.length});
+ }
- if( this.settings.isPreloaded ) {
- this.preLoadImage( this.onComplete );
- } else {
- this.onComplete();
- }
+ if (this.settings.isPreloaded) {
+ this.preLoadImage(this.onComplete);
+ } else {
+ this.onComplete();
+ }
- };
- $.lofSidernews.fn = $.lofSidernews.prototype;
- $.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend;
+ };
+ $.lofSidernews.fn = $.lofSidernews.prototype;
+ $.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend;
- $.lofSidernews.fn.extend({
+ $.lofSidernews.fn.extend({
- startUp:function( obj, wrapper ) {
- seft = this;
+ startUp: function (obj, wrapper) {
+ seft = this;
- this.navigatorItems.each( function(index, item ){
- $(item).click( function(){
- seft.jumping( index, true );
- seft.setNavActive( index, item );
- } );
- $(item).css( {'height': seft.settings.navigatorHeight, 'width': seft.settings.navigatorWidth} );
- });
- this.registerWheelHandler( this.navigatorOuter, this );
- this.setNavActive(this.currentNo );
+ this.navigatorItems.each(function (index, item) {
+ $(item).click(function () {
+ seft.jumping(index, true);
+ seft.setNavActive(index, item);
+ });
+ $(item).css({'height': seft.settings.navigatorHeight, 'width': seft.settings.navigatorWidth});
+ });
+ this.registerWheelHandler(this.navigatorOuter, this);
+ this.setNavActive(this.currentNo);
- if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){
- this.registerButtonsControl( 'click', this.settings.buttons, this );
+ if (this.settings.buttons && typeof (this.settings.buttons) == "object") {
+ this.registerButtonsControl('click', this.settings.buttons, this);
- }
- if( this.settings.auto )
- this.play( this.settings.interval,'next', true );
+ }
+ if (this.settings.auto)
+ this.play(this.settings.interval, 'next', true);
- return this;
- },
- onComplete:function(){
- setTimeout( function(){ $('.preload').fadeOut( 900 ); }, 400 ); this.startUp( );
- },
- preLoadImage:function( callback ){
- var self = this;
- var images = this.wrapper.find( 'img' );
+ return this;
+ },
+ onComplete: function () {
+ setTimeout(function () {
+ $('.preload').fadeOut(900);
+ }, 400);
+ this.startUp();
+ },
+ preLoadImage: function (callback) {
+ var self = this;
+ var images = this.wrapper.find('img');
- var count = 0;
- images.each( function(index,image){
- if( !image.complete ){
- image.onload =function(){
- count++;
- if( count >= images.length ){
- self.onComplete();
- }
- };
- image.onerror =function(){
- count++;
- if( count >= images.length ){
- self.onComplete();
- }
- }
- }else {
- count++;
- if( count >= images.length ){
- self.onComplete();
- }
- }
- } );
- },
- navivationAnimate:function( currentIndex ) {
- if (currentIndex <= this.settings.startItem
- || currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) {
- this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2;
- if (this.settings.startItem < 0) this.settings.startItem = 0;
- if (this.settings.startItem >this.slides.length-this.settings.maxItemDisplay) {
- this.settings.startItem = this.slides.length-this.settings.maxItemDisplay;
- }
- }
- this.navigatorInner.stop().animate( eval('({'+this.navigratorStep[0]+':-'+this.settings.startItem*this.navigratorStep[1]+'})'),
- {duration:500, easing:'easeInOutQuad'} );
- },
- setNavActive:function( index, item ){
- if( (this.navigatorItems) ){
- this.navigatorItems.removeClass( 'active' );
- $(this.navigatorItems.get(index)).addClass( 'active' );
- this.navivationAnimate( this.currentNo );
- }
- },
- __getPositionMode:function( position ){
- if( position == 'horizontal' ){
- return ['left', this.settings.navigatorWidth];
- }
- return ['top', this.settings.navigatorHeight];
- },
- __getDirectionMode:function(){
- switch( this.settings.direction ){
- case 'opacity': this.maxSize=0; return ['opacity','opacity'];
- default: this.maxSize=this.maxWidth; return ['left','width'];
- }
- },
- registerWheelHandler:function( element, obj ){
- element.bind('mousewheel', function(event, delta ) {
- var dir = delta > 0 ? 'Up' : 'Down',
- vel = Math.abs(delta);
- if( delta > 0 ){
- obj.previous( true );
- } else {
- obj.next( true );
- }
- return false;
- });
- },
- registerButtonsControl:function( eventHandler, objects, self ){
- for( var action in objects ){
- switch (action.toString() ){
- case 'next':
- objects[action].click( function() { self.next( true) } );
- break;
- case 'previous':
- objects[action].click( function() { self.previous( true) } );
- break;
- }
- }
- return this;
- },
- onProcessing:function( manual, start, end ){
- this.previousNo = this.currentNo + (this.currentNo>0 ? -1 : this.slides.length-1);
- this.nextNo = this.currentNo + (this.currentNo < this.slides.length-1 ? 1 : 1- this.slides.length);
- return this;
- },
- finishFx:function( manual ){
- if( manual ) this.stop();
- if( manual && this.settings.auto ){
- this.play( this.settings.interval,'next', true );
- }
- this.setNavActive( this.currentNo );
- },
- getObjectDirection:function( start, end ){
- return eval("({'"+this.directionMode[0]+"':-"+(this.currentNo*start)+"})");
- },
- fxStart:function( index, obj, currentObj ){
- if( this.settings.direction == 'opacity' ) {
- $(this.slides).stop().animate({opacity:0}, {duration: this.settings.duration, easing:this.settings.easing} );
- $(this.slides).eq(index).stop().animate( {opacity:1}, {duration: this.settings.duration, easing:this.settings.easing} );
- }else {
- this.wrapper.stop().animate( obj, {duration: this.settings.duration, easing:this.settings.easing} );
- }
- return this;
- },
- jumping:function( no, manual ){
- this.stop();
- if( this.currentNo == no ) return;
- var obj = eval("({'"+this.directionMode[0]+"':-"+(this.maxSize*no)+"})");
- this.onProcessing( null, manual, 0, this.maxSize )
- .fxStart( no, obj, this )
- .finishFx( manual );
- this.currentNo = no;
- },
- next:function( manual , item){
+ var count = 0;
+ images.each(function (index, image) {
+ if (!image.complete) {
+ image.onload = function () {
+ count++;
+ if (count >= images.length) {
+ self.onComplete();
+ }
+ };
+ image.onerror = function () {
+ count++;
+ if (count >= images.length) {
+ self.onComplete();
+ }
+ }
+ } else {
+ count++;
+ if (count >= images.length) {
+ self.onComplete();
+ }
+ }
+ });
+ },
+ navivationAnimate: function (currentIndex) {
+ if (currentIndex <= this.settings.startItem
+ || currentIndex - this.settings.startItem >= this.settings.maxItemDisplay - 1) {
+ this.settings.startItem = currentIndex - this.settings.maxItemDisplay + 2;
+ if (this.settings.startItem < 0) this.settings.startItem = 0;
+ if (this.settings.startItem > this.slides.length - this.settings.maxItemDisplay) {
+ this.settings.startItem = this.slides.length - this.settings.maxItemDisplay;
+ }
+ }
+ this.navigatorInner.stop().animate(eval('({' + this.navigratorStep[0] + ':-' + this.settings.startItem * this.navigratorStep[1] + '})'),
+ {duration: 500, easing: 'easeInOutQuad'});
+ },
+ setNavActive: function (index, item) {
+ if ((this.navigatorItems)) {
+ this.navigatorItems.removeClass('active');
+ $(this.navigatorItems.get(index)).addClass('active');
+ this.navivationAnimate(this.currentNo);
+ }
+ },
+ __getPositionMode: function (position) {
+ if (position == 'horizontal') {
+ return ['left', this.settings.navigatorWidth];
+ }
+ return ['top', this.settings.navigatorHeight];
+ },
+ __getDirectionMode: function () {
+ switch (this.settings.direction) {
+ case 'opacity':
+ this.maxSize = 0;
+ return ['opacity', 'opacity'];
+ default:
+ this.maxSize = this.maxWidth;
+ return ['left', 'width'];
+ }
+ },
+ registerWheelHandler: function (element, obj) {
+ element.bind('mousewheel', function (event, delta) {
+ var dir = delta > 0 ? 'Up' : 'Down',
+ vel = Math.abs(delta);
+ if (delta > 0) {
+ obj.previous(true);
+ } else {
+ obj.next(true);
+ }
+ return false;
+ });
+ },
+ registerButtonsControl: function (eventHandler, objects, self) {
+ for (var action in objects) {
+ switch (action.toString()) {
+ case 'next':
+ objects[action].click(function () {
+ self.next(true)
+ });
+ break;
+ case 'previous':
+ objects[action].click(function () {
+ self.previous(true)
+ });
+ break;
+ }
+ }
+ return this;
+ },
+ onProcessing: function (manual, start, end) {
+ this.previousNo = this.currentNo + (this.currentNo > 0 ? -1 : this.slides.length - 1);
+ this.nextNo = this.currentNo + (this.currentNo < this.slides.length - 1 ? 1 : 1 - this.slides.length);
+ return this;
+ },
+ finishFx: function (manual) {
+ if (manual) this.stop();
+ if (manual && this.settings.auto) {
+ this.play(this.settings.interval, 'next', true);
+ }
+ this.setNavActive(this.currentNo);
+ },
+ getObjectDirection: function (start, end) {
+ return eval("({'" + this.directionMode[0] + "':-" + (this.currentNo * start) + "})");
+ },
+ fxStart: function (index, obj, currentObj) {
+ if (this.settings.direction == 'opacity') {
+ $(this.slides).stop().animate({opacity: 0}, {duration: this.settings.duration, easing: this.settings.easing});
+ $(this.slides).eq(index).stop().animate({opacity: 1}, {duration: this.settings.duration, easing: this.settings.easing});
+ } else {
+ this.wrapper.stop().animate(obj, {duration: this.settings.duration, easing: this.settings.easing});
+ }
+ return this;
+ },
+ jumping: function (no, manual) {
+ this.stop();
+ if (this.currentNo == no) return;
+ var obj = eval("({'" + this.directionMode[0] + "':-" + (this.maxSize * no) + "})");
+ this.onProcessing(null, manual, 0, this.maxSize)
+ .fxStart(no, obj, this)
+ .finishFx(manual);
+ this.currentNo = no;
+ },
+ next: function (manual, item) {
- this.currentNo += (this.currentNo < this.slides.length-1) ? 1 : (1 - this.slides.length);
- this.onProcessing( item, manual, 0, this.maxSize )
- .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
- .finishFx( manual );
- },
- previous:function( manual, item ){
- this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1;
- this.onProcessing( item, manual )
- .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
- .finishFx( manual );
- },
- play:function( delay, direction, wait ){
- this.stop();
- if(!wait){ this[direction](false); }
- var self = this;
- this.isRun = setTimeout(function() { self[direction](true); }, delay);
- },
- stop:function(){
- if (this.isRun === null) return;
- clearTimeout(this.isRun);
+ this.currentNo += (this.currentNo < this.slides.length - 1) ? 1 : (1 - this.slides.length);
+ this.onProcessing(item, manual, 0, this.maxSize)
+ .fxStart(this.currentNo, this.getObjectDirection(this.maxSize), this)
+ .finishFx(manual);
+ },
+ previous: function (manual, item) {
+ this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1;
+ this.onProcessing(item, manual)
+ .fxStart(this.currentNo, this.getObjectDirection(this.maxSize), this)
+ .finishFx(manual);
+ },
+ play: function (delay, direction, wait) {
+ this.stop();
+ if (!wait) {
+ this[direction](false);
+ }
+ var self = this;
+ this.isRun = setTimeout(function () {
+ self[direction](true);
+ }, delay);
+ },
+ stop: function () {
+ if (this.isRun === null) return;
+ clearTimeout(this.isRun);
this.isRun = null;
- }
- })
+ }
+ })
})(jQuery);
diff --git a/publisher/author_items.php b/publisher/author_items.php
index 96c75aa1..0e356743 100644
--- a/publisher/author_items.php
+++ b/publisher/author_items.php
@@ -22,21 +22,21 @@
include_once __DIR__ . '/header.php';
$uid = XoopsRequest::getInt('uid', 0, 'GET');
-if (empty($uid)) {
+if (0 == $uid) {
redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
-// exit();
+ // exit();
}
-$member_handler = xoops_gethandler('member');
-$thisuser = $member_handler->getUser($uid);
+$memberHandler =& xoops_getHandler('member');
+$thisuser = $memberHandler->getUser($uid);
if (!is_object($thisuser)) {
redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
-// exit();
+ // exit();
}
if (!$publisher->getConfig('perm_author_items')) {
redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
-//mb exit();
+ //mb exit();
}
$myts = MyTextSanitizer::getInstance();
@@ -48,7 +48,7 @@
$criteria = new CriteriaCompo(new Criteria('datesub', time(), '<='));
$criteria->add(new Criteria('uid', $uid));
-$items = $publisher->getHandler('item')->getItems($limit = 0, $start = 0, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, 'datesub', 'DESC', '', true, $criteria);
+$items =& $publisher->getHandler('item')->getItems($limit = 0, $start = 0, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, 'datesub', 'DESC', '', true, $criteria);
unset($criteria);
$count = count($items);
@@ -70,17 +70,16 @@
'count_items' => 0,
'count_hits' => 0,
'title' => $item->getCategoryName(),
- 'link' => $item->getCategoryLink()
- );
+ 'link' => $item->getCategoryLink());
}
$categories[$catid]['count_items']++;
$categories[$catid]['count_hits'] += $item->counter();
$categories[$catid]['items'][] = array(
- 'title' => $item->title(),
+ 'title' => $item->getTitle(),
'hits' => $item->counter(),
'link' => $item->getItemLink(),
- 'published' => $item->datesub(),
+ 'published' => $item->getDatesub(),
'rating' => $item->rating());
}
}
diff --git a/publisher/backend.php b/publisher/backend.php
index a64239f4..378416ce 100644
--- a/publisher/backend.php
+++ b/publisher/backend.php
@@ -21,7 +21,7 @@
*/
include_once __DIR__ . '/header.php';
-xoops_load('XoopsLocal');
+//xoops_load('XoopsLocal'); //mb
error_reporting(0);
$GLOBALS['xoopsLogger']->activated = false;
@@ -34,7 +34,7 @@
$categoryid = XoopsRequest::getInt('categoryid', -1, 'GET');
if ($categoryid != -1) {
- $categoryObj = $publisher->getHandler('category')->get($categoryid);
+ $categoryObj =& $publisher->getHandler('category')->get($categoryid);
}
header('Content-Type:text/xml; charset=' . _CHARSET);
@@ -54,12 +54,13 @@
$tpl->assign('channel_title', htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES));
$tpl->assign('channel_link', PUBLISHER_URL);
$tpl->assign('channel_desc', htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES));
- $tpl->assign('channel_lastbuild', XoopsLocal::formatTimestamp(time(), 'rss'));
+ //mb $tpl->assign('channel_lastbuild', XoopsLocal::formatTimestamp(time(), 'rss'));
+ $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
$tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail']);
$tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail']);
if ($categoryid != -1) {
- $channel_category .= " > " . $categoryObj->name();
+ $channel_category .= ' > ' . $categoryObj->name();
}
$tpl->assign('channel_category', htmlspecialchars($channel_category));
@@ -77,18 +78,19 @@
}
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
- $sarray = $publisher->getHandler('item')->getAllPublished(10, 0, $categoryid);
+ $sarray =& $publisher->getHandler('item')->getAllPublished(10, 0, $categoryid);
if (is_array($sarray)) {
$count = $sarray;
foreach ($sarray as $item) {
- $tpl->append('items',
- array('title' => htmlspecialchars($item->title(), ENT_QUOTES),
- 'link' => $item->getItemUrl(),
- 'guid' => $item->getItemUrl(),
- 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
- 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES)));
+ $tpl->append('items', array(
+ 'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES),
+ 'link' => $item->getItemUrl(),
+ 'guid' => $item->getItemUrl(),
+ //mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
+ 'pubdate' => formatTimestamp($this->getVar('datesub', $format), 'rss'),
+ 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES)));
}
- unset($item);
+// unset($item);
}
}
$tpl->display('db:publisher_rss.tpl');
diff --git a/publisher/blocks/category_items_sel.php b/publisher/blocks/category_items_sel.php
index 8767eb16..19de01c2 100644
--- a/publisher/blocks/category_items_sel.php
+++ b/publisher/blocks/category_items_sel.php
@@ -30,13 +30,13 @@
*/
function publisher_category_items_sel_show($options)
{
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$block = array();
- $categories = $publisher->getHandler('category')->getCategories(0, 0, -1);
+ $categories =& $publisher->getHandler('category')->getCategories(0, 0, -1);
- if (count($categories) == 0) {
+ if (count($categories) === 0) {
return $block;
}
@@ -49,20 +49,24 @@ function publisher_category_items_sel_show($options)
// creating the ITEM objects that belong to the selected category
$block['categories'] = array();
foreach ($categories as $catID => $catObj) {
- if (!in_array(0, $selectedcatids) && !in_array($catID, $selectedcatids)) continue;
+ if (!in_array(0, $selectedcatids) && !in_array($catID, $selectedcatids)) {
+ continue;
+ }
$criteria = new Criteria('categoryid', $catID);
- $items = $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
+ $items =& $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
unset($criteria);
- if (count($items) == 0) continue;
+ if (count($items) === 0) {
+ continue;
+ }
$item['title'] = $catObj->name();
$item['itemurl'] = 'none';
$block['categories'][$catID]['items'][] = $item;
foreach ($items as $itemObj) {
- $item['title'] = $itemObj->title(isset($options[3]) ? $options[3] : 0);
+ $item['title'] = $itemObj->getTitle(isset($options[3]) ? $options[3] : 0);
$item['itemurl'] = $itemObj->getItemUrl();
$block['categories'][$catID]['items'][] = $item;
}
@@ -71,7 +75,9 @@ function publisher_category_items_sel_show($options)
unset($items, $categories, $itemObj, $catID, $catObj);
- if (count($block['categories']) == 0) return $block;
+ if (count($block['categories']) === 0) {
+ return $block;
+ }
return $block;
}
@@ -93,8 +99,7 @@ function publisher_category_items_sel_edit($options)
$orderEle->addOptionArray(array(
'datesub' => _MB_PUBLISHER_DATE,
'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- ));
+ 'weight' => _MB_PUBLISHER_WEIGHT));
$dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
$charsEle = new XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]);
diff --git a/publisher/blocks/date_to_date.php b/publisher/blocks/date_to_date.php
index a33c1d8f..5558eaad 100644
--- a/publisher/blocks/date_to_date.php
+++ b/publisher/blocks/date_to_date.php
@@ -32,7 +32,7 @@
function publisher_date_to_date_show($options)
{
$myts = MyTextSanitizer::getInstance();
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$block = array();
@@ -43,22 +43,20 @@ function publisher_date_to_date_show($options)
$criteria->setOrder('DESC');
// creating the ITEM objects that belong to the selected category
- $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
+ $itemsObj =& $publisher->getHandler('item')->getObjects($criteria);
$totalItems = count($itemsObj);
if ($itemsObj) {
for ($i = 0; $i < $totalItems; ++$i) {
-
$newItems['itemid'] = $itemsObj[$i]->itemid();
- $newItems['title'] = $itemsObj[$i]->title();
+ $newItems['title'] = $itemsObj[$i]->getTitle();
$newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
$newItems['categoryid'] = $itemsObj[$i]->categoryid();
- $newItems['date'] = $itemsObj[$i]->datesub();
- $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
+ $newItems['date'] = $itemsObj[$i]->getDatesub();
+ $newItems['poster'] = $itemsObj[$i]->getLinkedPosterName();
$newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
$newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
-
- $block['items'][] = $newItems;
+ $block['items'][] = $newItems;
}
$block['lang_title'] = _MB_PUBLISHER_ITEMS;
@@ -66,7 +64,7 @@ function publisher_date_to_date_show($options)
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
$modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
- $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
+ $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $modulename;
$block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
}
@@ -82,13 +80,14 @@ function publisher_date_to_date_edit($options)
{
include_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
xoops_load('XoopsFormLoader');
- xoops_load('XoopsFormCalendar');
+ xoops_load('XoopsFormTextDateSelect');
$form = new PublisherBlockForm();
- $fromEle = new XoopsFormCalendar(_MB_PUBLISHER_FROM, 'options[0]', 15, strtotime($options[0]));
- $fromEle->setNocolspan();
- $untilEle = new XoopsFormCalendar(_MB_PUBLISHER_UNTIL, 'options[1]', 15, strtotime($options[1]));
- $untilEle->setNocolspan();
+ $fromEle = new XoopsFormTextDateSelect(_MB_PUBLISHER_FROM, 'options[0]', 15, strtotime($options[0]));
+ // $fromEle->setNocolspan();
+ $untilEle = new XoopsFormTextDateSelect(_MB_PUBLISHER_UNTIL, 'options[1]', 15, isset($options[1]) ? strtotime($options[1]) : '');
+ // $untilEle->setNocolspan();
+
$form->addElement($fromEle);
$form->addElement($untilEle);
diff --git a/publisher/blocks/items_columns.php b/publisher/blocks/items_columns.php
index e7304031..48a181e1 100644
--- a/publisher/blocks/items_columns.php
+++ b/publisher/blocks/items_columns.php
@@ -33,60 +33,60 @@
*/
function publisher_items_columns_show($options)
{
-// global $xoTheme;
- $publisher = PublisherPublisher::getInstance();
+ // global $xoTheme;
+ $publisher =& PublisherPublisher::getInstance();
//Column Settings
- $opt_num_columns = isset($options[0]) ? (int)($options[0]) : '2';
- $sel_categories = isset($options[1]) ? explode(',', $options[1]) : array();
- $opt_cat_items = (int)($options[2]);
- $opt_cat_truncate = isset($options[3]) ? (int)($options[3]) : '0';
+ $optNumColumns = isset($options[0]) ? (int)($options[0]) : '2';
+ $selCategories = isset($options[1]) ? explode(',', $options[1]) : array();
+ $optCatItems = (int)($options[2]);
+ $optCatTruncate = isset($options[3]) ? (int)($options[3]) : '0';
$block = array();
$block['lang_reads'] = _MB_PUBLISHER_READS;
$block['lang_comments'] = _MB_PUBLISHER_COMMENTS;
$block['lang_readmore'] = _MB_PUBLISHER_READMORE;
- $sel_categories_obj = array();
+ $selCategoriesObj = array();
//get permited categories only once
- $categories_obj = $publisher->getHandler('category')->getCategories(0, 0, -1);
+ $categoriesObj =& $publisher->getHandler('category')->getCategories(0, 0, -1);
//if not selected 'all', let's get the selected ones
- if (!in_array(0, $sel_categories)) {
- foreach ($categories_obj as $key => $value) {
- if (in_array($key, $sel_categories)) {
- $sel_categories_obj[$key] = $value;
+ if (!in_array(0, $selCategories)) {
+ foreach ($categoriesObj as $key => $value) {
+ if (in_array($key, $selCategories)) {
+ $selCategoriesObj[$key] = $value;
}
}
} else {
- $sel_categories_obj = $categories_obj;
+ $selCategoriesObj =& $categoriesObj;
}
unset($key, $value);
- $ccount = count($sel_categories_obj);
+ $ccount = count($selCategoriesObj);
- if ($ccount == 0) {
+ if ($ccount === 0) {
return false;
}
- if ($ccount < $opt_num_columns) {
- $opt_num_columns = $ccount;
+ if ($ccount < $optNumColumns) {
+ $optNumColumns = $ccount;
}
$k = 0;
$columns = array();
- foreach ($sel_categories_obj as $categoryId => $mainitemCatObj) {
- $categoryItemsObj = $publisher->getHandler('item')->getAllPublished($opt_cat_items, 0, $categoryId);
+ foreach ($selCategoriesObj as $categoryId => $mainitemCatObj) {
+ $categoryItemsObj =& $publisher->getHandler('item')->getAllPublished($optCatItems, 0, $categoryId);
$scount = count($categoryItemsObj);
if ($scount > 0 && is_array($categoryItemsObj)) {
reset($categoryItemsObj);
//First Item
list($itemid, $thisitem) = each($categoryItemsObj);
- $mainitem['item_title'] = $thisitem->title();
- $mainitem['item_cleantitle'] = strip_tags($thisitem->title());
+ $mainitem['item_title'] = $thisitem->getTitle();
+ $mainitem['item_cleantitle'] = strip_tags($thisitem->getTitle());
$mainitem['item_link'] = $thisitem->itemid();
$mainitem['itemurl'] = $thisitem->getItemUrl();
$mainImage = $thisitem->getMainImage();
@@ -97,31 +97,30 @@ function publisher_items_columns_show($options)
$mainitem['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=100';
}
- $mainitem['item_summary'] = $thisitem->getBlockSummary($opt_cat_truncate);
+ $mainitem['item_summary'] = $thisitem->getBlockSummary($optCatTruncate);
$mainitem['item_cat_name'] = $mainitemCatObj->name();
- $mainitem['item_cat_description'] = $mainitemCatObj->description() != '' ? $mainitemCatObj->description() : $mainitemCatObj->name();
+ $mainitem['item_cat_description'] = $mainitemCatObj->description() !== '' ? $mainitemCatObj->description() : $mainitemCatObj->name();
$mainitem['item_cat_link'] = $mainitemCatObj->getCategoryLink();
$mainitem['categoryurl'] = $mainitemCatObj->getCategoryUrl();
//The Rest
if ($scount > 1) {
while ((list($itemid, $thisitem) = each($categoryItemsObj)) !== false) {
- $subitem['title'] = $thisitem->title();
- $subitem['cleantitle'] = strip_tags($thisitem->title());
+ $subitem['title'] = $thisitem->getTitle();
+ $subitem['cleantitle'] = strip_tags($thisitem->getTitle());
$subitem['link'] = $thisitem->getItemLink();
$subitem['itemurl'] = $thisitem->getItemUrl();
- $subitem['summary'] = $thisitem->getBlockSummary($opt_cat_truncate);
+ $subitem['summary'] = $thisitem->getBlockSummary($optCatTruncate);
$mainitem['subitem'][] = $subitem;
unset($subitem);
}
}
$columns[$k][] = $mainitem;
- unset($thisitem);
- unset($mainitem);
+ unset($thisitem, $mainitem);
++$k;
- if ($k == $opt_num_columns) {
+ if ($k == $optNumColumns) {
$k = 0;
}
}
@@ -130,7 +129,7 @@ function publisher_items_columns_show($options)
$block['template'] = $options[4];
$block['columns'] = $columns;
- $block['columnwidth'] = (int)(100 / $opt_num_columns);
+ $block['columnwidth'] = (int)(100 / $optNumColumns);
$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css');
@@ -156,8 +155,7 @@ function publisher_items_columns_edit($options)
'2' => 2,
'3' => 3,
'4' => 4,
- '5' => 5,
- ));
+ '5' => 5));
$catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisherCreateCategorySelect($options[1], 0, true, 'options[1]'));
$cItemsEle = new XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]);
$truncateEle = new XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[3]', 4, 255, $options[3]);
@@ -165,8 +163,7 @@ function publisher_items_columns_edit($options)
$tempEle = new XoopsFormSelect(_MB_PUBLISHER_TEMPLATE, 'options[4]', $options[4]);
$tempEle->addOptionArray(array(
'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL,
- 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED
- ));
+ 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED));
$form->addElement($colEle);
$form->addElement($catEle);
diff --git a/publisher/blocks/items_menu.php b/publisher/blocks/items_menu.php
index 9f6f31d9..1d176785 100644
--- a/publisher/blocks/items_menu.php
+++ b/publisher/blocks/items_menu.php
@@ -33,19 +33,19 @@ function publisher_items_menu_show($options)
{
$block = array();
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
// Getting all top cats
- $block_categoriesObj = $publisher->getHandler('category')->getCategories(0, 0, 0);
+ $blockCategoriesObj =& $publisher->getHandler('category')->getCategories(0, 0, 0);
- if (count($block_categoriesObj) == 0) {
+ if (count($blockCategoriesObj) == 0) {
return $block;
}
// Are we in Publisher ?
$block['inModule'] = (isset($GLOBALS['xoopsModule']) && $GLOBALS['xoopsModule']->getVar('dirname') == $publisher->getModule()->getVar('dirname'));
- $catlink_class = 'menuMain';
+ $catLinkClass = 'menuMain';
$categoryid = 0;
@@ -57,13 +57,13 @@ function publisher_items_menu_show($options)
// if we are in a category, then the $categoryObj is already defined in publisher/category.php
global $categoryObj;
$block['currentcat'] = $categoryObj->getCategoryLink('menuTop');
- $catlink_class = 'menuSub';
+ $catLinkClass = 'menuSub';
}
}
- foreach ($block_categoriesObj as $catid => $block_categoryObj) {
+ foreach ($blockCategoriesObj as $catid => $blockCategoryObj) {
if ($catid != $categoryid) {
- $block['categories'][$catid]['categoryLink'] = $block_categoryObj->getCategoryLink($catlink_class);
+ $block['categories'][$catid]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass);
}
}
@@ -87,8 +87,7 @@ function publisher_items_menu_edit($options)
$orderEle->addOptionArray(array(
'datesub' => _MB_PUBLISHER_DATE,
'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- ));
+ 'weight' => _MB_PUBLISHER_WEIGHT));
$dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
$form->addElement($catEle);
diff --git a/publisher/blocks/items_new.php b/publisher/blocks/items_new.php
index 2b2a2f05..b0d36339 100644
--- a/publisher/blocks/items_new.php
+++ b/publisher/blocks/items_new.php
@@ -31,7 +31,7 @@
*/
function publisher_items_new_show($options)
{
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$selectedcatids = explode(',', $options[0]);
@@ -55,17 +55,17 @@ function publisher_items_new_show($options)
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
+ $itemsObj =& $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
$totalitems = count($itemsObj);
- if ($itemsObj) {
+ if ($itemsObj && $totalitems > 1) {
for ($i = 0; $i < $totalitems; ++$i) {
$item = array();
$item['link'] = $itemsObj[$i]->getItemLink(false, isset($options[4]) ? $options[4] : 65);
$item['id'] = $itemsObj[$i]->itemid();
- $item['poster'] = $itemsObj[$i]->posterName(); // for make poster name linked, use linkedPosterName() instead of posterName()
+ $item['poster'] = $itemsObj[$i]->posterName(); // for make poster name linked, use getLinkedPosterName() instead of posterName()
- if ($image == 'article') {
+ if ('article' === $image) {
$item['image'] = XOOPS_URL . '/uploads/blank.gif';
$item['image_name'] = '';
$images = $itemsObj[$i]->getImages();
@@ -78,10 +78,10 @@ function publisher_items_new_show($options)
}
$item['image_name'] = $images['main']->getVar('image_nicename');
}
- } elseif ($image == 'category') {
+ } elseif ('category' === $image) {
$item['image'] = $itemsObj[$i]->getCategoryImagePath();
$item['image_name'] = $itemsObj[$i]->getCategoryName();
- } elseif ($image == 'avatar') {
+ } elseif ('avatar' === $image) {
if ($itemsObj[$i]->uid() == '0') {
$item['image'] = XOOPS_URL . '/uploads/blank.gif';
$images = $itemsObj[$i]->getImages();
@@ -104,14 +104,20 @@ function publisher_items_new_show($options)
$item['image_name'] = $itemsObj[$i]->posterName();
}
- $item['title'] = $itemsObj[$i]->title();
+ $item['title'] = $itemsObj[$i]->getTitle();
- if ($sort == "datesub") {
- $item['new'] = $itemsObj[$i]->datesub();
- } elseif ($sort == "counter") {
+ if ('datesub' === $sort) {
+ $item['new'] = $itemsObj[$i]->getDatesub();
+ } elseif ('counter' === $sort) {
$item['new'] = $itemsObj[$i]->counter();
- } elseif ($sort == "weight") {
+ } elseif ('weight' === $sort) {
$item['new'] = $itemsObj[$i]->weight();
+ } elseif ('rating' === $sort) {
+ $item['new'] = $itemsObj[$i]->rating();
+ } elseif ('votes' === $sort) {
+ $item['new'] = $itemsObj[$i]->votes();
+ } elseif ('comments' === $sort) {
+ $item['new'] = $itemsObj[$i]->comments();
}
$block['newitems'][] = $item;
@@ -138,10 +144,12 @@ function publisher_items_new_edit($options)
$catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisherCreateCategorySelect($options[0], 0, true, 'options[0]'));
$orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
$orderEle->addOptionArray(array(
- 'datesub' => _MB_PUBLISHER_DATE,
- 'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- ));
+ 'datesub' => _MB_PUBLISHER_DATE,
+ 'counter' => _MB_PUBLISHER_HITS,
+ 'weight' => _MB_PUBLISHER_WEIGHT,
+ 'rating' => _MI_PUBLISHER_ORDERBY_RATING,
+ 'votes' => _MI_PUBLISHER_ORDERBY_VOTES,
+ 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS));
$showEle = new XoopsFormRadioYN(_MB_PUBLISHER_ORDER_SHOW, 'options[2]', $options[2]);
$dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[3]', 10, 255, $options[3]);
@@ -152,8 +160,7 @@ function publisher_items_new_edit($options)
'none' => _NONE,
'article' => _MB_PUBLISHER_IMAGE_ARTICLE,
'category' => _MB_PUBLISHER_IMAGE_CATEGORY,
- 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR,
- ));
+ 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR));
$form->addElement($catEle);
$form->addElement($orderEle);
diff --git a/publisher/blocks/items_random_item.php b/publisher/blocks/items_random_item.php
index 820d4aa8..df49d281 100644
--- a/publisher/blocks/items_random_item.php
+++ b/publisher/blocks/items_random_item.php
@@ -32,9 +32,9 @@
function publisher_items_random_item_show($options)
{
$block = array();
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
// creating the ITEM object
- $itemsObj = $publisher->getHandler('item')->getRandomItem('', array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED));
+ $itemsObj =& $publisher->getHandler('item')->getRandomItem('', array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED));
if (!is_object($itemsObj)) {
return $block;
diff --git a/publisher/blocks/items_recent.php b/publisher/blocks/items_recent.php
index 00925958..bcb88172 100644
--- a/publisher/blocks/items_recent.php
+++ b/publisher/blocks/items_recent.php
@@ -31,7 +31,7 @@
*/
function publisher_items_recent_show($options)
{
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$myts = MyTextSanitizer::getInstance();
$block = array();
@@ -56,18 +56,18 @@ function publisher_items_recent_show($options)
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
+ $itemsObj =& $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
$totalItems = count($itemsObj);
- if ($itemsObj) {
+ if ($itemsObj && $totalItems > 1) {
for ($i = 0; $i < $totalItems; ++$i) {
$newItems['itemid'] = $itemsObj[$i]->itemid();
- $newItems['title'] = $itemsObj[$i]->title();
+ $newItems['title'] = $itemsObj[$i]->getTitle();
$newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
$newItems['categoryid'] = $itemsObj[$i]->categoryid();
- $newItems['date'] = $itemsObj[$i]->datesub();
- $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
+ $newItems['date'] = $itemsObj[$i]->getDatesub();
+ $newItems['poster'] = $itemsObj[$i]->getLinkedPosterName();
$newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
$newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
@@ -79,7 +79,7 @@ function publisher_items_recent_show($options)
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
$modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
- $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
+ $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $modulename;
}
return $block;
@@ -102,8 +102,7 @@ function publisher_items_recent_edit($options)
$orderEle->addOptionArray(array(
'datesub' => _MB_PUBLISHER_DATE,
'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- ));
+ 'weight' => _MB_PUBLISHER_WEIGHT));
$dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
$charsEle = new XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]);
diff --git a/publisher/blocks/items_spot.php b/publisher/blocks/items_spot.php
index 608bcbab..52a25851 100644
--- a/publisher/blocks/items_spot.php
+++ b/publisher/blocks/items_spot.php
@@ -29,45 +29,45 @@
*/
function publisher_items_spot_show($options)
{
-// global $xoTheme;
- $publisher = PublisherPublisher::getInstance();
- $opt_display_last = $options[0];
- $opt_items_count = $options[1];
- $opt_categoryid = $options[2];
- $sel_items = isset($options[3]) ? explode(',', $options[3]) : '';
- $opt_display_poster = $options[4];
- $opt_display_comment = $options[5];
- $opt_display_type = $options[6];
- $opt_truncate = (int)($options[7]);
- $opt_catimage = $options[8];
- if ($opt_categoryid == 0) {
- $opt_categoryid = -1;
+ // global $xoTheme;
+ $publisher =& PublisherPublisher::getInstance();
+ $optDisplayLast = $options[0];
+ $optItemsCount = $options[1];
+ $optCategoryId = $options[2];
+ $selItems = isset($options[3]) ? explode(',', $options[3]) : '';
+ $optDisplayPoster = $options[4];
+ $optDisplayComment = $options[5];
+ $optDisplayType = $options[6];
+ $optTruncate = (int)($options[7]);
+ $optCatImage = $options[8];
+ if ($optCategoryId == 0) {
+ $optCategoryId = -1;
}
$block = array();
- if ($opt_display_last == 1) {
- $itemsObj = $publisher->getHandler('item')->getAllPublished($opt_items_count, 0, $opt_categoryid, $sort = 'datesub', $order = 'DESC', 'summary');
+ if ($optDisplayLast == 1) {
+ $itemsObj =& $publisher->getHandler('item')->getAllPublished($optItemsCount, 0, $optCategoryId, $sort = 'datesub', $order = 'DESC', 'summary');
$i = 1;
$itemsCount = count($itemsObj);
if ($itemsObj) {
- if ($opt_categoryid != -1 && $opt_catimage) {
- $cat = $publisher->getHandler('category')->get($opt_categoryid);
+ if ($optCategoryId != -1 && $optCatImage) {
+ $cat =& $publisher->getHandler('category')->get($optCategoryId);
$category['name'] = $cat->name();
$category['categoryurl'] = $cat->getCategoryUrl();
- if ($cat->image() != 'blank.png') {
- $category['image_path'] = publisherGetImageDir('category', false) . $cat->image();
+ if ($cat->getImage() !== 'blank.png') {
+ $category['image_path'] = publisherGetImageDir('category', false) . $cat->getImage();
} else {
$category['image_path'] = '';
}
$block['category'] = $category;
}
foreach ($itemsObj as $key => $thisitem) {
- $item = $thisitem->toArraySimple('default', 0, $opt_truncate);
+ $item = $thisitem->toArraySimple('default', 0, $optTruncate);
if ($i < $itemsCount) {
$item['showline'] = true;
} else {
$item['showline'] = false;
}
- if ($opt_truncate > 0) {
+ if ($optTruncate > 0) {
$block['truncate'] = true;
}
$block['items'][] = $item;
@@ -76,20 +76,20 @@ function publisher_items_spot_show($options)
}
} else {
$i = 1;
- $itemsCount = count($sel_items);
- foreach ($sel_items as $item_id) {
- $itemObj = $publisher->getHandler('item')->get($item_id);
+ $itemsCount = count($selItems);
+ foreach ($selItems as $itemId) {
+ $itemObj =& $publisher->getHandler('item')->get($itemId);
if (!$itemObj->notLoaded()) {
$item = $itemObj->toArraySimple();
- $item['who_when'] = sprintf(_MB_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->datesub());
+ $item['who_when'] = sprintf(_MB_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->getDatesub());
if ($i < $itemsCount) {
$item['showline'] = true;
} else {
$item['showline'] = false;
}
- if ($opt_truncate > 0) {
+ if ($optTruncate > 0) {
$block['truncate'] = true;
- $item['summary'] = publisherTruncateTagSafe($item['summary'], $opt_truncate);
+ $item['summary'] = publisherTruncateTagSafe($item['summary'], $optTruncate);
}
$block['items'][] = $item;
++$i;
@@ -102,11 +102,11 @@ function publisher_items_spot_show($options)
$block['lang_reads'] = _MB_PUBLISHER_READS;
$block['lang_comments'] = _MB_PUBLISHER_COMMENTS;
$block['lang_readmore'] = _MB_PUBLISHER_READMORE;
- $block['display_whowhen_link'] = $opt_display_poster;
- $block['display_comment_link'] = $opt_display_comment;
- $block['display_type'] = $opt_display_type;
+ $block['display_whowhen_link'] = $optDisplayPoster;
+ $block['display_comment_link'] = $optDisplayComment;
+ $block['display_type'] = $optDisplayType;
- $block["publisher_url"] = PUBLISHER_URL;
+ $block['moduleUrl'] = PUBLISHER_URL;
$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css');
return $block;
@@ -125,27 +125,26 @@ function publisher_items_spot_edit($options)
$autoEle = new XoopsFormRadioYN(_MB_PUBLISHER_AUTO_LAST_ITEMS, 'options[0]', $options[0]);
$countEle = new XoopsFormText(_MB_PUBLISHER_LAST_ITEMS_COUNT, 'options[1]', 2, 255, $options[1]);
$catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisherCreateCategorySelect($options[2], 0, true, 'options[2]'));
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$criteria = new CriteriaCompo();
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
- $itemsObj = $publisher->getHandler('item')->getList($criteria);
+ $itemsObj =& $publisher->getHandler('item')->getList($criteria);
$keys = array_keys($itemsObj);
unset($criteria);
if (empty($options[3]) || ($options[3] == 0)) {
- $sel_items = isset($keys[0]) ? $keys[0] : 0;
+ $selItems = isset($keys[0]) ? $keys[0] : 0;
} else {
- $sel_items = explode(',', $options[3]);
+ $selItems = explode(',', $options[3]);
}
- $itemEle = new XoopsFormSelect(_MB_PUBLISHER_SELECT_ITEMS, 'options[3]', $sel_items, 10, true);
+ $itemEle = new XoopsFormSelect(_MB_PUBLISHER_SELECT_ITEMS, 'options[3]', $selItems, 10, true);
$itemEle->addOptionArray($itemsObj);
$whoEle = new XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_WHO_AND_WHEN, 'options[4]', $options[4]);
$comEle = new XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENTS, 'options[5]', $options[5]);
$typeEle = new XoopsFormSelect(_MB_PUBLISHER_DISPLAY_TYPE, 'options[6]', $options[6]);
$typeEle->addOptionArray(array(
'block' => _MB_PUBLISHER_DISPLAY_TYPE_BLOCK,
- 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET,
- ));
+ 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET));
$truncateEle = new XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[7]', 4, 255, $options[7]);
$imageEle = new XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_CATIMAGE, 'options[8]', $options[8]);
$form->addElement($autoEle);
diff --git a/publisher/blocks/latest_files.php b/publisher/blocks/latest_files.php
index 3c5416d6..f50b25a6 100644
--- a/publisher/blocks/latest_files.php
+++ b/publisher/blocks/latest_files.php
@@ -31,7 +31,7 @@
*/
function publisher_latest_files_show($options)
{
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
/**
* $options[0] : Category
* $options[1] : Sort order - datesub | counter
@@ -47,15 +47,15 @@ function publisher_latest_files_show($options)
$directDownload = $options[3];
// creating the files objects
- $filesObj = $publisher->getHandler('file')->getAllFiles(0, PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order, explode(',', $options[0]));
+ $filesObj =& $publisher->getHandler('file')->getAllFiles(0, PublisherConstantsInterface::PUBLISHER_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order, explode(',', $options[0]));
foreach ($filesObj as $fileObj) {
$aFile = array();
$aFile['link'] = $directDownload ? $fileObj->getFileLink() : $fileObj->getItemLink();
- if ($sort == "datesub") {
- $aFile['new'] = $fileObj->datesub();
- } elseif ($sort == "counter") {
+ if ($sort === 'datesub') {
+ $aFile['new'] = $fileObj->getDatesub();
+ } elseif ($sort === 'counter') {
$aFile['new'] = $fileObj->counter();
- } elseif ($sort == "weight") {
+ } elseif ($sort === 'weight') {
$aFile['new'] = $fileObj->weight();
}
$block['files'][] = $aFile;
@@ -81,8 +81,7 @@ function publisher_latest_files_edit($options)
$orderEle->addOptionArray(array(
'datesub' => _MB_PUBLISHER_DATE,
'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- ));
+ 'weight' => _MB_PUBLISHER_WEIGHT));
$dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
$directEle = new XoopsFormRadioYN(_MB_PUBLISHER_DIRECTDOWNLOAD, 'options[3]', $options[3]);
diff --git a/publisher/blocks/latest_news.php b/publisher/blocks/latest_news.php
index fa3dd458..9cda76cd 100644
--- a/publisher/blocks/latest_news.php
+++ b/publisher/blocks/latest_news.php
@@ -35,21 +35,21 @@ function publisher_latest_news_show($options)
$block = array();
xoops_loadLanguage('main', 'publisher');
- $publisher = PublisherPublisher::getInstance();
+ $publisher =& PublisherPublisher::getInstance();
$start = $options[0]; // You can show articles from specified range
$limit = $options[1];
- $column_count = $options[2];
+ $columnCount = $options[2];
$letters = $options[3];
- $selected_stories = $options[4];
+ $selectedStories = $options[4];
$sort = $options[9];
$order = publisherGetOrderBy($sort);
- $imgwidth = $options[11];
- $imgheight = $options[12];
+ $imgWidth = $options[11];
+ $imgHeight = $options[12];
$border = $options[13];
$bordercolor = $options[14];
- $block['spec']['columnwidth'] = (int)(1 / $column_count * 100);
+ $block['spec']['columnwidth'] = (int)(1 / $columnCount * 100);
$allcats = false;
if (!isset($options[29])) {
@@ -67,13 +67,13 @@ function publisher_latest_news_show($options)
}
// Use specific ITEMS
- if ($selected_stories != 0) {
+ if ($selectedStories != 0) {
unset($criteria); //removes category option
$criteria = new CriteriaCompo();
- $criteria->add(new Criteria('itemid', '(' . $selected_stories . ')', 'IN'));
+ $criteria->add(new Criteria('itemid', '(' . $selectedStories . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, 'itemid');
+ $itemsObj =& $publisher->getHandler('item')->getItems($limit, $start, array(PublisherConstantsInterface::PUBLISHER_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, 'itemid');
$scount = count($itemsObj);
@@ -93,45 +93,45 @@ function publisher_latest_news_show($options)
if (!function_exists('imagecreatetruecolor')) {
$item['item_image'] = $mainImage['image_path'];
} else {
- $item['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=' . $imgwidth; // No $imgheight for autoheight option
+ $item['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=' . $imgWidth; // No $imgHeight for autoheight option
}
$item['text'] = $itemObj->getBlockSummary($letters);
$item = $itemObj->getMainImage($item); //returns an array
- $ls_height = '';
+ $lsHeight = '';
if ($options[12] != 0) {
- $ls_height = 'height="' . $imgheight . '" ';
+ $lsHeight = 'height="' . $imgHeight . '" ';
} // set height = 0 in block option for auto height
- if ($options[15] == 'LEFT') {
- $imgposition = "float: left";
- $ls_margin = '-right';
+ if ($options[15] === 'LEFT') {
+ $imgPosition = 'float: left';
+ $lsMargin = '-right';
}
- if ($options[15] == 'CENTER') {
- $imgposition = "text-align:center";
- $ls_margin = '';
+ if ($options[15] === 'CENTER') {
+ $imgPosition = 'text-align:center';
+ $lsMargin = '';
}
- if ($options[15] == 'RIGHT') {
- $imgposition = "float: right";
- $ls_margin = '-left';
+ if ($options[15] === 'RIGHT') {
+ $imgPosition = 'float: right';
+ $lsMargin = '-left';
}
//Image
if ($options[10] == 1 && $item['image_path'] != '') {
- $startdiv = '';
+ $startdiv = '';
$image = $startdiv . 'isAdmin(-1)) {
- $item['admin'] = " ";
- $item['admin'] .= "";
+ $item['admin'] = "itemid() . "'> ";
+ $item['admin'] .= "itemid() . "'>";
} else {
$item['admin'] = '';
}
@@ -160,7 +160,7 @@ function publisher_latest_news_show($options)
$item['posttime'] = '';
if ($options[20] == 1) {
- $item['posttime'] = _ON . ' ' . $itemObj->datesub();
+ $item['posttime'] = _ON . ' ' . $itemObj->getDatesub();
}
$item['topic_title'] = '';
@@ -195,14 +195,13 @@ function publisher_latest_news_show($options)
$item['print'] = '';
if ($options[24] == 1) {
- $item['print'] = 'itemid(), $itemObj->short_url()) . '" rel="nofollow"> ';
+ $item['print'] = ' ';
}
$item['pdf'] = '';
if ($publisher->getConfig('display_pdf')) {
if ($options[25] == 1) {
- $item['pdf'] = " ";
+ $item['pdf'] = "itemid() . "' rel='nofollow'> ";
}
}
$item['email'] = '';
@@ -238,7 +237,7 @@ function publisher_latest_news_show($options)
$columns[$k][] = $item;
++$k;
- if ($k == $column_count) {
+ if ($k == $columnCount) {
$k = 0;
}
}
@@ -264,13 +263,13 @@ function publisher_latest_news_edit($options)
$form = "";
$form .= $tabletag3 . _MB_PUBLISHER_GENERALCONFIG . $tabletag4; // General Options
$form .= $tabletag1 . _MB_PUBLISHER_FIRST . $tabletag2;
- $form .= " " . _MB_PUBLISHER_ITEMS . "";
+ $form .= " " . _MB_PUBLISHER_ITEMS . '';
$form .= $tabletag1 . _MB_PUBLISHER_DISP . $tabletag2;
- $form .= " " . _MB_PUBLISHER_ITEMS . "";
+ $form .= " " . _MB_PUBLISHER_ITEMS . '';
$form .= $tabletag1 . _MB_PUBLISHER_COLUMNS . $tabletag2;
- $form .= " " . _MB_PUBLISHER_COLUMN . "";
+ $form .= " " . _MB_PUBLISHER_COLUMN . '';
$form .= $tabletag1 . _MB_PUBLISHER_TEXTLENGTH . $tabletag2;
- $form .= " " . _MB_PUBLISHER_LETTER . "";
+ $form .= " " . _MB_PUBLISHER_LETTER . '';
$form .= $tabletag1 . _MB_PUBLISHER_SELECTEDSTORIES . $tabletag2;
$form .= "";
$form .= $tabletag1 . _MB_PUBLISHER_SCROLL . $tabletag2;
@@ -291,62 +290,62 @@ function publisher_latest_news_edit($options)
}
$form .= ">{$value}";
}
- $form .= "";
+ $form .= '';
$form .= $tabletag1 . _MB_PUBLISHER_ORDER . $tabletag2;
$form .= "";
+ $form .= '';
$form .= $tabletag3 . _MB_PUBLISHER_PHOTOSCONFIG . $tabletag4; // Photos Options
$form .= $tabletag1 . _MB_PUBLISHER_IMGDISPLAY . $tabletag2;
$form .= publisher_mk_chkbox($options, 10);
$form .= $tabletag1 . _MB_PUBLISHER_IMGWIDTH . $tabletag2;
- $form .= " " . _MB_PUBLISHER_PIXEL . "";
+ $form .= " " . _MB_PUBLISHER_PIXEL . '';
$form .= $tabletag1 . _MB_PUBLISHER_IMGHEIGHT . $tabletag2;
- $form .= " " . _MB_PUBLISHER_PIXEL . "";
+ $form .= " " . _MB_PUBLISHER_PIXEL . '';
$form .= $tabletag1 . _MB_PUBLISHER_BORDER . $tabletag2;
- $form .= " " . _MB_PUBLISHER_PIXEL . "";
+ $form .= " " . _MB_PUBLISHER_PIXEL . '';
$form .= $tabletag1 . _MB_PUBLISHER_BORDERCOLOR . $tabletag2;
$form .= "";
$form .= $tabletag1 . _MB_PUBLISHER_IMGPOSITION . $tabletag2;
$form .= "";
+ $form .= '';
$form .= $tabletag3 . _MB_PUBLISHER_LINKSCONFIG . $tabletag4; // Links Options
$form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_TOPICLINK . $tabletag2;
@@ -386,7 +385,7 @@ function publisher_latest_news_edit($options)
}
$form .= ">{$value}";
}
- $form .= "";
+ $form .= '';
//Select Which Categories To Show
$form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4; // Topics Options
@@ -394,7 +393,7 @@ function publisher_latest_news_edit($options)
$form .= publisherCreateCategorySelect($options[29], 0, true, 'options[29]');
$form .= '';
- $form .= "
";
+ $form .= '';
return $form;
}
@@ -407,16 +406,16 @@ function publisher_latest_news_edit($options)
*/
function publisher_mk_chkbox($options, $number)
{
- $chk = "";
+ $chk = '';
if ($options[$number] == 1) {
$chk = " checked='checked'";
}
- $chkbox = " " . _YES . " ";
- $chk = "";
+ $chkbox = " ' . _YES . ' ';
+ $chk = '';
if ($options[$number] == 0) {
$chk = " checked='checked'";
}
- $chkbox .= " " . _NO . "";
+ $chkbox .= " ' . _NO . '';
return $chkbox;
}
@@ -429,21 +428,21 @@ function publisher_mk_chkbox($options, $number)
*/
function publisher_mk_select($options, $number)
{
- $slc = "";
+ $slc = '';
if ($options[$number] == 2) {
$slc = " checked='checked'";
}
- $select = " " . _LEFT . " ";
- $slc = "";
+ $select = " ' . _LEFT . ' ';
+ $slc = '';
if ($options[$number] == 1) {
$slc = " checked='checked'";
}
- $select = " " . _CENTER . " ";
- $slc = "";
+ $select = " ' . _CENTER . ' ';
+ $slc = '';
if ($options[$number] == 0) {
$slc = " checked='checked'";
}
- $select .= " " . _RIGHT . "";
+ $select .= " ' . _RIGHT . '';
return $select;
}
diff --git a/publisher/blocks/search.php b/publisher/blocks/search.php
index c342114a..52c941e3 100644
--- a/publisher/blocks/search.php
+++ b/publisher/blocks/search.php
@@ -29,10 +29,11 @@
*
* @return array
*/
-function publisher_search_show($options) {
+function publisher_search_show($options)
+{
$block = array();
- $publisher = PublisherPublisher::getInstance();
- $categories = $publisher->getHandler('category')->getCategoriesForSearch();
+ $publisher =& PublisherPublisher::getInstance();
+ $categories =& $publisher->getHandler('category')->getCategoriesForSearch();
if (count($categories) == 0) {
return $block;
}
@@ -41,131 +42,131 @@ function publisher_search_show($options) {
$andor = XoopsRequest::getString('andor', XoopsRequest::getString('andor', '', 'GET'), 'POST');
$username = XoopsRequest::getString('uname', XoopsRequest::getString('uname', null, 'GET'), 'POST');
-// $searchin = isset($_POST["searchin"]) ? $_POST["searchin"] : (isset($_GET["searchin"]) ? explode("|", $_GET["searchin"]) : array());
-// $searchin = XoopsRequest::getArray('searchin', (explode("|", XoopsRequest::getString('searchin', array(), 'GET'))), 'POST');
+ // $searchin = isset($_POST["searchin"]) ? $_POST["searchin"] : (isset($_GET["searchin"]) ? explode("|", $_GET["searchin"]) : array());
+ // $searchin = XoopsRequest::getArray('searchin', (explode("|", XoopsRequest::getString('searchin', array(), 'GET'))), 'POST');
$searchin = XoopsRequest::getArray('searchin', '', 'POST');
if (!isset($searchin)) {
$searchin = XoopsRequest::getString('searchin', array(), 'GET');
- $searchin = isset($searchin) ? explode("|", $searchin) : array();
+ $searchin = isset($searchin) ? explode('|', $searchin) : array();
}
- $sortby = XoopsRequest::getString('sortby', XoopsRequest::getString('sortby', null, 'GET'), 'POST');
- $term = XoopsRequest::getString('term', XoopsRequest::getString('term', '', 'GET'));
+ $sortby = XoopsRequest::getString('sortby', XoopsRequest::getString('sortby', null, 'GET'), 'POST');
+ $term = XoopsRequest::getString('term', XoopsRequest::getString('term', '', 'GET'));
//mb TODO simplify next lines with category
- $category = XoopsRequest::getArray('category', array(), 'POST') ? XoopsRequest::getArray('category', array(), 'POST') : (XoopsRequest::getArray('category', null, 'GET'));
- if (empty($category) || (is_array($category) && in_array("all", $category))) {
+ $category = XoopsRequest::getArray('category', array(), 'POST') ?: (XoopsRequest::getArray('category', null, 'GET'));
+ if (empty($category) || (is_array($category) && in_array('all', $category))) {
$category = array();
} else {
- $category = (!is_array($category)) ? explode(",", $category) : $category;
- $category = array_map("intval", $category);
+ $category = (!is_array($category)) ? explode(',', $category) : $category;
+ $category = array_map('intval', $category);
}
- $andor = (in_array(strtoupper($andor), array("OR", "AND", "EXACT"))) ? strtoupper($andor) : "OR";
- $sortby = (in_array(strtolower($sortby), array("itemid", "datesub", "title", "categoryid"))) ? strtolower($sortby) : "itemid";
+ $andor = (in_array(strtoupper($andor), array('OR', 'AND', 'EXACT'))) ? strtoupper($andor) : 'OR';
+ $sortby = (in_array(strtolower($sortby), array('itemid', 'datesub', 'title', 'categoryid'))) ? strtolower($sortby) : 'itemid';
/* type */
- $type_select = "";
+ $typeSelect .= '>' . _SR_EXACT . '';
+ $typeSelect .= '';
/* category */
- $select_category = "";
+ $categorySelect .= '';
/* scope */
- $searchin_select = "";
- $searchin_select .= "";
- $sortby_select .= "