Example #1
0
/**
 * @param $options
 *
 * @return array
 */
function publisher_items_menu_show($options)
{
    $block = array();
    $publisher =& PublisherPublisher::getInstance();
    // Getting all top cats
    $blockCategoriesObj =& $publisher->getHandler('category')->getCategories(0, 0, 0);
    if (count($blockCategoriesObj) == 0) {
        return $block;
    }
    // Are we in Publisher ?
    $block['inModule'] = isset($GLOBALS['xoopsModule']) && $GLOBALS['xoopsModule']->getVar('dirname') == $publisher->getModule()->getVar('dirname');
    $catLinkClass = 'menuMain';
    $categoryid = 0;
    if ($block['inModule']) {
        // Are we in a category and if yes, in which one ?
        $categoryid = XoopsRequest::getInt('categoryid', 0, 'GET');
        if ($categoryid != 0) {
            // if we are in a category, then the $categoryObj is already defined in publisher/category.php
            global $categoryObj;
            $block['currentcat'] = $categoryObj->getCategoryLink('menuTop');
            $catLinkClass = 'menuSub';
        }
    }
    foreach ($blockCategoriesObj as $catid => $blockCategoryObj) {
        if ($catid != $categoryid) {
            $block['categories'][$catid]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass);
        }
    }
    return $block;
}
Example #2
0
 /**
  * @param        $property
  * @param string $default
  *
  * @return string
  */
 protected function param($property, $default = '')
 {
     if (isset($_GET[$property])) {
         return XoopsRequest::getString($property, '', 'GET');
     } else {
         return $default;
     }
 }
Example #3
0
 /**
  * Clean up an array of variables.
  *
  * @param mixed  $var  The input variable.
  * @param int    $mask Filter bit mask. See {@link XoopsRequest::cleanVar()}
  * @param string $type The variable type. See {@link XoopsFilterInput::clean()}.
  *
  * @return string
  */
 private static function cleanVars($var, $mask = 0, $type = null)
 {
     if (is_string($var)) {
         $var = XoopsRequest::cleanVar($var, $mask, $type);
     } else {
         foreach ($var as $key => &$value) {
             $value = XoopsRequest::cleanVars($value, $mask, $type);
         }
     }
     return $var;
 }
Example #4
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: item.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once __DIR__ . '/header.php';
$itemId = XoopsRequest::getInt('itemid', 0, 'GET');
$itemPageId = XoopsRequest::getInt('page', -1, 'GET');
if ($itemId == 0) {
    redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
    //    exit();
}
// Creating the item object for the selected item
$itemObj = $publisher->getHandler('item')->get($itemId);
// if the selected item was not found, exit
if (!$itemObj) {
    redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
    //    exit();
}
$xoopsOption['template_main'] = 'publisher_item.tpl';
include_once $GLOBALS['xoops']->path('header.php');
$xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js');
//$xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery-migrate-1.2.1.js');
        }
    }
    publisherCloseCollapsableBar('newsimport', 'newsimporticon');
    xoops_cp_footer();
}
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');
    $moduleObj = $moduleHandler->getByDirname('smartsection');
    $smartsection_module_id = $moduleObj->getVar('mid');
    $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');
    $resultCat = $GLOBALS['xoopsDB']->query($sql);
    $newCatArray = array();
    $newArticleArray = array();
    $oldToNew = array();
    while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) {
        $newCat = array();
        $newCat['oldid'] = $arrCat['categoryid'];
        $newCat['oldpid'] = $arrCat['parentid'];
        $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']));
Example #6
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: import.php 12825 2014-10-31 02:42:34Z zyspec $
 */
include_once __DIR__ . '/admin_header.php';
$op = XoopsRequest::getString('op', XoopsRequest::getString('op', 'none', 'GET'), 'POST');
switch ($op) {
    case 'importExecute':
        $importfile = XoopsRequest::getString('importfile', 'nonselected', 'POST');
        $importfile_path = $GLOBALS['xoops']->path('modules/' . $publisher->getModule()->dirname() . '/admin/import/' . $importfile . '.php');
        include_once $importfile_path;
        break;
    case 'default':
    default:
        $importfile = 'none';
        publisherCpHeader();
        //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
        publisherOpenCollapsableBar('import', 'importicon', _AM_PUBLISHER_IMPORT_TITLE, _AM_PUBLISHER_IMPORT_INFO);
        xoops_load('XoopsFormLoader');
        $moduleHandler =& xoops_getHandler('module');
        // WF-Section
        /*$wfs_version = 0;
          $moduleObj = $moduleHandler->getByDirname('wfsection');
          if ($moduleObj) {
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: pw_delete_file.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once __DIR__ . '/admin_header.php';
if ('delfileok' === XoopsRequest::getString('op', '', 'POST')) {
    $dir = publisherGetUploadDir(true, 'content');
    $filename = XoopsRequest::getString('address', '', 'POST');
    if (file_exists($dir . '/' . $filename)) {
        unlink($dir . '/' . $filename);
    }
    redirect_header(XoopsRequest::getString('backto', '', 'POST'), 2, _AM_PUBLISHER_FDELETED);
} else {
    xoops_cp_header();
    xoops_confirm(array('backto' => XoopsRequest::getString('backto', '', 'POST'), 'address' => XoopsRequest::getString('address', '', 'POST'), 'op' => 'delfileok'), 'pw_delete_file.php', _AM_PUBLISHER_RUSUREDELF, _YES);
    xoops_cp_footer();
}
// Check user rights
if (is_object($xoopsUser)) {
    $admintest = 0;
    $xoopsModule =& XoopsModule::getByDirname(basename(__DIR__));
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL, 3, _NOPERM);
        exit;
    }
    $admintest = 1;
} else {
    redirect_header(XOOPS_URL, 3, _NOPERM);
    exit;
}
// XOOPS Class
include_once $GLOBALS['xoops']->path('/class/pagenav.php');
include_once $GLOBALS['xoops']->path('/class/template.php');
include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
include_once $GLOBALS['xoops']->path('/class/xoopslists.php');
include_once $GLOBALS['xoops']->path('/class/xoopsrequest.php');
if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
    $GLOBALS['xoopsTpl'] = new XoopsTpl();
}
// System Presets
xoops_loadLanguage('admin', basename(__DIR__));
include_once $GLOBALS['xoops']->path('/modules/' . basename(__DIR__) . '/common.php');
include_once $GLOBALS['xoops']->path('/modules/' . basename(__DIR__) . '/constants.php');
// Get request variable
$op = XoopsRequest::getVar('op', 'dashboard', 'GET');
$fct = XoopsRequest::getVar('fct', 'confirm', 'GET');
$key = XoopsRequest::getVar('key', md5(NULL), 'GET');
$myts =& MyTextSanitizer::getInstance();
Example #9
0
                     if (in_array($extension_verif, $extensions)) {
                         echo "<li class=\"file ext_{$ext}\"><a href=\"#\" onclick=\"tpls_edit_file('" . htmlentities($_REQUEST['dir'] . $file) . "', '" . htmlentities($_REQUEST['dir']) . "', '" . htmlentities($file) . "', '" . $ext . "');\" rel=\"tpls_edit_file('" . htmlentities($_REQUEST['dir'] . $file) . "', '" . htmlentities($_REQUEST['dir']) . "', '" . htmlentities($file) . "', '" . $ext . "');\">" . htmlentities($file) . '</a></li>';
                     } else {
                         //echo "<li class=\"file ext_$ext\">" . htmlentities($file) . "</li>";
                     }
                 }
             }
             echo '</ul>';
         }
     }
     break;
     // Edit File
 // Edit File
 case 'tpls_edit_file':
     $clean_file = XoopsRequest::getString('file', '');
     $clean_path_file = XoopsRequest::getString('path_file', '');
     $path_file = realpath(XOOPS_ROOT_PATH . '/themes' . trim($clean_path_file));
     $path_file = str_replace('\\', '/', $path_file);
     //Button restore
     $restore = '';
     if (file_exists($path_file . '.back')) {
         $restore = '<button class="ui-corner-all tooltip" type="button" onclick="tpls_restore(\'' . $path_file . '\')" value="' . _AM_SYSTEM_TEMPLATES_RESTORE . '" title="' . _AM_SYSTEM_TEMPLATES_RESTORE . '">
                         <img src="' . system_AdminIcons('revert.png') . '" alt="' . _AM_SYSTEM_TEMPLATES_RESTORE . '" />
                     </button>';
     }
     xoops_load('XoopsFile');
     XoopsFile::load('file');
     $file = XoopsFile::getHandler('file', $path_file);
     $content = $file->read();
     if (empty($content)) {
         echo _AM_SYSTEM_TEMPLATES_EMPTY_FILE;
Example #10
0
        break;
    case PublisherConstants::PUBLISHER_STATUS_OFFLINE:
        $selectedtxt3 = "selected='selected'";
        $caption = _CO_PUBLISHER_OFFLINE;
        $cond = ' WHERE status = ' . PublisherConstants::PUBLISHER_STATUS_OFFLINE . ' ';
        $status_explaination = _AM_PUBLISHER_OFFLINE_EXP;
        break;
    case PublisherConstants::PUBLISHER_STATUS_REJECTED:
        $selectedtxt4 = "selected='selected'";
        $caption = _CO_PUBLISHER_REJECTED;
        $cond = ' WHERE status = ' . PublisherConstants::PUBLISHER_STATUS_REJECTED . ' ';
        $status_explaination = _AM_PUBLISHER_REJECTED_ITEM_EXP;
        break;
}
/* -- Code to show selected terms -- */
echo "<form name='pick' id='pick' action='" . XoopsRequest::getString('PHP_SELF', '', 'SERVER') . "' method='POST' style='margin: 0;'>";
echo "\n    <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'>\n        <tr>\n            <td><span style='font-weight: bold; font-variant: small-caps;'>" . _AM_PUBLISHER_SHOWING . ' ' . $caption . "</span></td>\n            <td align='right'>" . _AM_PUBLISHER_SELECT_SORT . "\n                <select name='sortsel' onchange='submit()'>\n                    <option value='itemid' {$sorttxtitemid}>" . _AM_PUBLISHER_ID . "</option>\n                    <option value='title' {$sorttxttitle}>" . _AM_PUBLISHER_TITLE . "</option>\n                    <option value='datesub' {$sorttxtcreated}>" . _AM_PUBLISHER_CREATED . "</option>\n                    <option value='weight' {$sorttxtweight}>" . _CO_PUBLISHER_WEIGHT . "</option>\n\n                    <option value='counter' {$sorttxthits}>" . _AM_PUBLISHER_HITS . "</option>\n                    <option value='rating' {$sorttxtrating}>" . _AM_PUBLISHER_RATE . "</option>\n                    <option value='votes' {$sorttxtvotes}>" . _AM_PUBLISHER_VOTES . "</option>\n                    <option value='comments' {$sorttxtcomments}>" . _AM_PUBLISHER_COMMENTS_COUNT . "</option>\n\n                </select>\n                <select name='ordersel' onchange='submit()'>\n                    <option value='ASC' {$ordertxtasc}>" . _AM_PUBLISHER_ASC . "</option>\n                    <option value='DESC' {$ordertxtdesc}>" . _AM_PUBLISHER_DESC . '</option>
                </select>
            ' . _AM_PUBLISHER_SELECT_STATUS . " :\n                <select name='statussel' onchange='submit()'>\n                    <option value='0' {$selectedtxt0}>" . _AM_PUBLISHER_ALL . " [{$totalitems}]</option>\n                    <option value='1' {$selectedtxt1}>" . _CO_PUBLISHER_SUBMITTED . " [{$totalsubmitted}]</option>\n                    <option value='2' {$selectedtxt2}>" . _CO_PUBLISHER_PUBLISHED . " [{$totalpublished}]</option>\n                    <option value='3' {$selectedtxt3}>" . _CO_PUBLISHER_OFFLINE . " [{$totaloffline}]</option>\n                    <option value='4' {$selectedtxt4}>" . _CO_PUBLISHER_REJECTED . " [{$totalrejected}]</option>\n                </select>\n            </td>\n        </tr>\n    </table>\n    </form>";
// Get number of entries in the selected state
$statusSelected = $statussel == 0 ? -1 : $statussel;
$numrows =& $publisher->getHandler('item')->getItemsCount(-1, $statusSelected);
// creating the Q&As objects
$itemsObj =& $publisher->getHandler('item')->getItems($publisher->getConfig('idxcat_perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel);
$totalItemsOnPage = count($itemsObj);
PublisherUtilities::buildTableItemTitleRow();
if ($numrows > 0) {
    for ($i = 0; $i < $totalItemsOnPage; ++$i) {
        // Creating the category object to which this item is linked
        $categoryObj = $itemsObj[$i]->getCategory();
        $approve = '';
Example #11
0
     $res = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('users') . ' WHERE uid=' . XoopsRequest::getInt('to_userid', 0, 'POST') . '');
     list($count) = $xoopsDB->fetchRow($res);
     if ($count != 1) {
         echo '<br><br><div><h4>' . _PM_USERNOEXIST . '<br>';
         echo _PM_PLZTRYAGAIN . '</h4><br>';
         echo "[ <a href='javascript:history.go(-1)' title=''>" . _PM_GOBACK . '</a> ]</div>';
     } else {
         $pm_handler = xoops_getHandler('privmessage');
         $pm = $pm_handler->create();
         $msg_image = XoopsRequest::getCmd('icon', null, 'POST');
         if (in_array($msg_image, $subject_icons)) {
             $pm->setVar('msg_image', $msg_image);
         }
         $pm->setVar('subject', XoopsRequest::getString('subject', null, 'POST'));
         $pm->setVar('msg_text', XoopsRequest::getString('message', null, 'POST'));
         $pm->setVar('to_userid', XoopsRequest::getInt('to_userid', 0, 'POST'));
         $pm->setVar('from_userid', $xoopsUser->getVar('uid'));
         if (!$pm_handler->insert($pm)) {
             echo $pm->getHtmlErrors();
             echo "<br><a href='javascript:history.go(-1)' title=''>" . _PM_GOBACK . '</a>';
         } else {
             echo "<br><br><div style='text-align:center;'><h4>" . _PM_MESSAGEPOSTED . "</h4><br><a href=\"javascript:window.opener.location='" . XOOPS_URL . "/viewpmsg.php';window.close();\" title=\"\">" . _PM_CLICKHERE . "</a><br><br><a href=\"javascript:window.close();\" title=\"\">" . _PM_ORCLOSEWINDOW . '</a></div>';
         }
     }
 } elseif ($reply == 1 || $send == 1 || $send2 == 1) {
     include_once $GLOBALS['xoops']->path('include/xoopscodes.php');
     if ($reply == 1) {
         $pm_handler = xoops_getHandler('privmessage');
         $pm = $pm_handler->get($msg_id);
         if ($pm->getVar('to_userid') == $xoopsUser->getVar('uid')) {
             $pm_uname = XoopsUser::getUnameFromId($pm->getVar('from_userid'));
Example #12
0
    /*
    Sample URL for path-info
    http://localhost/modules/publisher/seo.php/item.2/can-i-turn-the-ads-off.html
    */
    $data = explode('/', XoopsRequest::getString('PATH_INFO', '', 'SERVER'));
    $seoParts = explode('.', $data[1]);
    $seoOp = $seoParts[0];
    $seoArg = $seoParts[1];
    // for multi-argument modules, where itemid and catid both are required.
    // $seoArg = substr($data[1], strlen($seoOp) + 1);
}
$seoMap = array('category' => 'category.php', 'item' => 'item.php', 'print' => 'print.php');
if (!empty($seoOp) && isset($seoMap[$seoOp])) {
    // module specific dispatching logic, other module must implement as
    // per their requirements.
    $url_arr = explode('/modules/', XoopsRequest::getString('PHP_SELF', '', 'SERVER'));
    $newUrl = $url_arr[0] . '/modules/' . PUBLISHER_DIRNAME . '/' . $seoMap[$seoOp];
    $_ENV['PHP_SELF'] = $newUrl;
    $_SERVER['SCRIPT_NAME'] = $newUrl;
    $_SERVER['PHP_SELF'] = $newUrl;
    switch ($seoOp) {
        case 'category':
            $_SERVER['REQUEST_URI'] = $newUrl . '?categoryid=' . $seoArg;
            $_GET['categoryid'] = $seoArg;
            $_REQUEST['categoryid'] = $seoArg;
            break;
        case 'item':
        case 'print':
        default:
            $_SERVER['REQUEST_URI'] = $newUrl . '?itemid=' . $seoArg;
            $_GET['itemid'] = $seoArg;
Example #13
0
/**
 * @param  bool        $another
 * @param  bool        $withRedirect
 * @param              $itemObj
 * @return bool|string
 */
function publisherUploadFile($another = false, $withRedirect = true, &$itemObj)
{
    include_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
    //    global $publisherIsAdmin;
    $publisher =& PublisherPublisher::getInstance();
    $itemId = XoopsRequest::getInt('itemid', 0, 'POST');
    $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0;
    $session =& PublisherSession::getInstance();
    $session->set('publisher_file_filename', XoopsRequest::getString('item_file_name', '', 'POST'));
    $session->set('publisher_file_description', XoopsRequest::getString('item_file_description', '', 'POST'));
    $session->set('publisher_file_status', XoopsRequest::getInt('item_file_status', 1, 'POST'));
    $session->set('publisher_file_uid', $uid);
    $session->set('publisher_file_itemid', $itemId);
    if (!is_object($itemObj)) {
        $itemObj =& $publisher->getHandler('item')->get($itemId);
    }
    $fileObj =& $publisher->getHandler('file')->create();
    $fileObj->setVar('name', XoopsRequest::getString('item_file_name', '', 'POST'));
    $fileObj->setVar('description', XoopsRequest::getString('item_file_description', '', 'POST'));
    $fileObj->setVar('status', XoopsRequest::getInt('item_file_status', 1, 'POST'));
    $fileObj->setVar('uid', $uid);
    $fileObj->setVar('itemid', $itemObj->getVar('itemid'));
    $fileObj->setVar('datesub', time());
    // Get available mimetypes for file uploading
    $allowedMimetypes =& $publisher->getHandler('mimetype')->getArrayByType();
    // TODO : display the available mimetypes to the user
    $errors = array();
    if ($publisher->getConfig('perm_upload') && is_uploaded_file($_FILES['item_upload_file']['tmp_name'])) {
        if (!($ret = $fileObj->checkUpload('item_upload_file', $allowedMimetypes, $errors))) {
            $errorstxt = implode('<br />', $errors);
            $message = sprintf(_CO_PUBLISHER_MESSAGE_FILE_ERROR, $errorstxt);
            if ($withRedirect) {
                redirect_header('file.php?op=mod&itemid=' . $itemId, 5, $message);
            } else {
                return $message;
            }
        }
    }
    // Storing the file
    if (!$fileObj->store($allowedMimetypes)) {
        //        if ($withRedirect) {
        //            redirect_header("file.php?op=mod&itemid=" . $fileObj->itemid(), 3, _CO_PUBLISHER_FILEUPLOAD_ERROR . publisherFormatErrors($fileObj->getErrors()));
        //            exit;
        //        }
        try {
            if ($withRedirect) {
                throw new Exception(_CO_PUBLISHER_FILEUPLOAD_ERROR . publisherFormatErrors($fileObj->getErrors()));
            }
        } catch (Exception $e) {
            redirect_header('file.php?op=mod&itemid=' . $fileObj->itemid(), 3, _CO_PUBLISHER_FILEUPLOAD_ERROR . publisherFormatErrors($fileObj->getErrors()));
        }
        //    } else {
        //        return _CO_PUBLISHER_FILEUPLOAD_ERROR . publisherFormatErrors($fileObj->getErrors());
    }
    if ($withRedirect) {
        $redirectPage = $another ? 'file.php' : 'item.php';
        redirect_header($redirectPage . '?op=mod&itemid=' . $fileObj->itemid(), 2, _CO_PUBLISHER_FILEUPLOAD_SUCCESS);
    } else {
        return true;
    }
    return null;
}
Example #14
0
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @version         $Id: author_items.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once __DIR__ . '/header.php';
$uid = XoopsRequest::getInt('uid', 0, 'GET');
if (0 == $uid) {
    redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
    //   exit();
}
$memberHandler =& xoops_getHandler('member');
$thisuser = $memberHandler->getUser($uid);
if (!is_object($thisuser)) {
    redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
    //    exit();
}
if (!$publisher->getConfig('perm_author_items')) {
    redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
    //mb    exit();
}
$myts = MyTextSanitizer::getInstance();
Example #15
0
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'));
    list($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result);
    if ($totalArticles == 0) {
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $totalArticles) . '</span>';
    } else {
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . '</span>';
        $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}");
        ob_end_clean();
        $form->addElement(new XoopsFormHidden('op', 'go'));
        $form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
        $form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('cjaycontent_version', '', 'POST')));
        $form->display();
    }
    //    }
    publisherCloseCollapsableBar('cjaycontentimport', 'cjaycontentimporticon');
    xoops_cp_footer();
}
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');
    $moduleObj = $moduleHandler->getByDirname('cjaycontent');
    $cjaycontent_module_id = $moduleObj->getVar('mid');
    $gpermHandler =& xoops_getHandler('groupperm');
Example #16
0
/**
 * @param bool $showmenu
 * @param int  $itemid
 * @param bool $clone
 */
function publisher_editItem($showmenu = false, $itemid = 0, $clone = false)
{
    $publisher =& PublisherPublisher::getInstance();
    global $publisherCurrentPage;
    xoops_load('XoopsFormLoader');
    $formTpl = new XoopsTpl();
    //publisher_submit.html
    // 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);
        if (!$itemObj) {
            redirect_header('item.php', 1, _AM_PUBLISHER_NOITEMSELECTED);
            //            exit();
        }
        if ($clone) {
            $itemObj->setNew();
            $itemObj->setVar('itemid', 0);
            $itemObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_NOTSET);
            $itemObj->setVar('datesub', time());
        }
        switch ($itemObj->status()) {
            case PublisherConstants::PUBLISHER_STATUS_SUBMITTED:
                $breadcrumbAction1 = _CO_PUBLISHER_SUBMITTED;
                $breadcrumbAction2 = _AM_PUBLISHER_APPROVING;
                $pageTitle = _AM_PUBLISHER_SUBMITTED_TITLE;
                $pageInfo = _AM_PUBLISHER_SUBMITTED_INFO;
                $buttonCaption = _AM_PUBLISHER_APPROVE;
                $newStatus = PublisherConstants::PUBLISHER_STATUS_PUBLISHED;
                break;
            case PublisherConstants::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 = PublisherConstants::PUBLISHER_STATUS_PUBLISHED;
                break;
            case PublisherConstants::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 = PublisherConstants::PUBLISHER_STATUS_OFFLINE;
                break;
            case PublisherConstants::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 = PublisherConstants::PUBLISHER_STATUS_REJECTED;
                break;
            case PublisherConstants::PUBLISHER_STATUS_NOTSET:
                // Then it's a clone...
                $breadcrumbAction1 = _AM_PUBLISHER_ITEMS;
                $breadcrumbAction2 = _AM_PUBLISHER_CLONE_NEW;
                $buttonCaption = _AM_PUBLISHER_CREATE;
                $newStatus = PublisherConstants::PUBLISHER_STATUS_PUBLISHED;
                $pageTitle = _AM_PUBLISHER_ITEM_DUPLICATING;
                $pageInfo = _AM_PUBLISHER_ITEM_DUPLICATING_DSC;
                break;
            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 = PublisherConstants::PUBLISHER_STATUS_PUBLISHED;
                break;
        }
        $categoryObj = $itemObj->getCategory();
        if ($showmenu) {
            //publisher_adminMenu(2, $breadcrumbAction1 . " > " . $breadcrumbAction2);
        }
        echo "<br />\n";
        publisherOpenCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo);
        if ($clone) {
            echo "<form><div style=\"margin-bottom: 10px;\">";
            echo "<input type='button' name='button' onclick=\"location='item.php?op=clone&itemid=" . $itemObj->itemid() . "'\" value='" . _AM_PUBLISHER_CLONE_ITEM . "'>&nbsp;&nbsp;";
            echo '</div></form>';
        }
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $publisher->getHandler('item')->create();
        $itemObj->setVarsFromRequest();
        $categoryObj =& $publisher->getHandler('category')->create();
        $breadcrumbAction1 = _AM_PUBLISHER_ITEMS;
        $breadcrumbAction2 = _AM_PUBLISHER_CREATINGNEW;
        $buttonCaption = _AM_PUBLISHER_CREATE;
        $newStatus = PublisherConstants::PUBLISHER_STATUS_PUBLISHED;
        if ($showmenu) {
            //publisher_adminMenu(2, $breadcrumbAction1 . " > " . $breadcrumbAction2);
        }
        $categoryObj->setVar('categoryid', XoopsRequest::getInt('categoryid', 0, 'GET'));
        publisherOpenCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC);
    }
    $sform = $itemObj->getForm(_AM_PUBLISHER_ITEMS);
    $sform->assign($formTpl);
    $formTpl->display('db:publisher_submit.tpl');
    publisherCloseCollapsableBar('edititemtable', 'edititemicon');
    publisherOpenCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
    $dir = publisherGetUploadDir(true, 'content');
    if (false !== strpos(decoct(fileperms($dir)), '755')) {
        echo "<span style='color:#ff0000;'><h4>" . _AM_PUBLISHER_PERMERROR . '</h4></span>';
    }
    // Upload File
    echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
    echo "<table cellspacing='1' width='100%' class='outer'>";
    echo "<tr><th colspan='2'>" . _AM_PUBLISHER_UPLOAD_FILE . '</th></tr>';
    echo "<tr valign='top' align='left'><td class='head'>" . _AM_PUBLISHER_SEARCH_PW . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
    echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_PUBLISHER_UPLOAD . "' /></td></tr>";
    echo "<input type='hidden' name='backto' value='{$publisherCurrentPage}'/>";
    echo '</table>';
    echo '</form>';
    // Delete File
    $form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php');
    $pWrapSelect = new XoopsFormSelect(publisherGetUploadDir(true, 'content'), 'address');
    $folder = dir($dir);
    while (($file = $folder->read()) !== false) {
        if ($file !== '.' && $file !== '..') {
            $pWrapSelect->addOption($file, $file);
        }
    }
    $folder->close();
    $form->addElement($pWrapSelect);
    $delfile = 'delfile';
    $form->addElement(new XoopsFormHidden('op', $delfile));
    $submit = new XoopsFormButton('', 'submit', _AM_PUBLISHER_BUTTON_DELETE, 'submit');
    $form->addElement($submit);
    $form->addElement(new XoopsFormHidden('backto', $publisherCurrentPage));
    $form->display();
    publisherCloseCollapsableBar('pagewraptable', 'pagewrapicon');
}
Example #17
0
$andor = XoopsRequest::getString('andor', '', 'POST');
$start = XoopsRequest::getInt('start', 0, 'POST');
$category = XoopsRequest::getArray('category', array(), 'POST');
$username = XoopsRequest::getString('uname', '', 'POST');
$searchin = XoopsRequest::getArray('searchin', array(), 'POST');
$sortby = XoopsRequest::getString('sortby', '', 'POST');
$term = XoopsRequest::getString('term', '', 'POST');
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);
}
$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';
if ($term && XoopsRequest::getString('submit', '', 'POST')) {
    $next_search['category'] = implode(',', $category);
    $next_search['andor'] = $andor;
    $next_search['term'] = $term;
    $query = trim($term);
    if ($andor !== 'EXACT') {
        $ignored_queries = array();
        // holds kewords that are shorter than allowed minmum length
        $temp_queries = preg_split("/[\\s,]+/", $query);
        foreach ($temp_queries as $q) {
            $q = trim($q);
            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
                $queries[] = $myts->addSlashes($q);
            } else {
                $ignored_queries[] = $myts->addSlashes($q);
            }
Example #18
0
 /**
  * @param bool $showmenu
  * @param int  $categoryId
  * @param int  $nbSubCats
  * @param null $categoryObj
  */
 public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null)
 {
     $publisher =& PublisherPublisher::getInstance();
     // if there is a parameter, and the id exists, retrieve data: we're editing a category
     if ($categoryId != 0) {
         // Creating the category object for the selected category
         $categoryObj =& $publisher->getHandler('category')->get($categoryId);
         if ($categoryObj->notLoaded()) {
             redirect_header('category.php', 1, _AM_PUBLISHER_NOCOLTOEDIT);
             //            exit();
         }
     } else {
         if (!$categoryObj) {
             $categoryObj =& $publisher->getHandler('category')->create();
         }
     }
     if ($categoryId != 0) {
         if ($showmenu) {
             //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING);
         }
         echo "<br />\n";
         publisherOpenCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO);
     } else {
         if ($showmenu) {
             //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW);
         }
         publisherOpenCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO);
     }
     $sform = $categoryObj->getForm($nbSubCats);
     $sform->display();
     if (!$categoryId) {
         publisherCloseCollapsableBar('createtable', 'createtableicon');
     } else {
         publisherCloseCollapsableBar('edittable', 'edittableicon');
     }
     //Added by fx2024
     if ($categoryId) {
         $selCat = $categoryId;
         publisherOpenCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC);
         // Get the total number of sub-categories
         $categoriesObj =& $publisher->getHandler('category')->get($selCat);
         $totalsubs =& $publisher->getHandler('category')->getCategoriesCount($selCat);
         // creating the categories objects that are published
         $subcatsObj =& $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid());
         $totalSCOnPage = count($subcatsObj);
         echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
         echo '<tr>';
         echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . '</strong></td>';
         echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . '</strong></td>';
         echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . '</strong></td>';
         echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
         echo '</tr>';
         if ($totalsubs > 0) {
             foreach ($subcatsObj as $subcat) {
                 $modify = "<a href='category.php?op=mod&amp;categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>";
                 $delete = "<a href='category.php?op=del&amp;categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>";
                 echo '<tr>';
                 echo "<td class='head' align='left'>" . $subcat->categoryid() . '</td>';
                 echo "<td class='even' align='left'><a href='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . '/category.php?categoryid=' . $subcat->categoryid() . '&amp;parentid=' . $subcat->parentid() . "'>" . $subcat->name() . '</a></td>';
                 echo "<td class='even' align='left'>" . $subcat->description() . '</td>';
                 echo "<td class='even' align='right'> {$modify} {$delete} </td>";
                 echo '</tr>';
             }
             //                unset($subcat);
         } else {
             echo '<tr>';
             echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . '</td>';
             echo '</tr>';
         }
         echo "</table>\n";
         echo "<br />\n";
         publisherCloseCollapsableBar('subcatstable', 'subcatsicon');
         publisherOpenCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC);
         $startitem = XoopsRequest::getInt('startitem');
         // Get the total number of published ITEMS
         $totalitems =& $publisher->getHandler('item')->getItemsCount($selCat, array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED));
         // creating the items objects that are published
         $itemsObj =& $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $selCat);
         $totalitemsOnPage = count($itemsObj);
         $allcats =& $publisher->getHandler('category')->getObjects(null, true);
         echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
         echo '<tr>';
         echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . '</strong></td>';
         echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . '</strong></td>';
         echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . '</strong></td>';
         echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . '</strong></td>';
         echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
         echo '</tr>';
         if ($totalitems > 0) {
             for ($i = 0; $i < $totalitemsOnPage; ++$i) {
                 $categoryObj = $allcats[$itemsObj[$i]->categoryid()];
                 $modify = "<a href='item.php?op=mod&amp;itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>";
                 $delete = "<a href='item.php?op=del&amp;itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>";
                 echo '<tr>';
                 echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
                 echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>';
                 echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . '</td>';
                 echo "<td class='even' align='center'>" . $itemsObj[$i]->getDatesub('s') . '</td>';
                 echo "<td class='even' align='center'> {$modify} {$delete} </td>";
                 echo '</tr>';
             }
         } else {
             $itemid = -1;
             echo '<tr>';
             echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . '</td>';
             echo '</tr>';
         }
         echo "</table>\n";
         echo "<br />\n";
         $parentid = XoopsRequest::getInt('parentid', 0, 'GET');
         $pagenavExtraArgs = "op=mod&categoryid={$selCat}&parentid={$parentid}";
         xoops_load('XoopsPageNav');
         $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenavExtraArgs);
         echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
         echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $selCat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'>&nbsp;&nbsp;";
         echo '</div>';
     }
     //end of fx2024 code
 }
Example #19
0
error_reporting(0);
include dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
include_once __DIR__ . '/common.php';
$GLOBALS['xoopsLogger']->activated = false;
xoops_loadLanguage('common', basename(dirname(__DIR__)));
if (!is_object($GLOBALS['xoopsUser'])) {
    $group = array(XOOPS_GROUP_ANONYMOUS);
} else {
    $group = $GLOBALS['xoopsUser']->getGroups();
}
$filename = basename($_FILES['publisher_upload_file']['name']);
$image_nicename = XoopsRequest::getString('image_nicename', '', 'POST');
if ($image_nicename == '' || $image_nicename == _CO_PUBLISHER_IMAGE_NICENAME) {
    $image_nicename = $filename;
}
$imgcat_id = XoopsRequest::getInt('imgcat_id', 0, 'POST');
$imgcatHandler =& xoops_getHandler('imagecategory');
$imgcat = $imgcatHandler->get($imgcat_id);
$error = false;
if (!is_object($imgcat)) {
    $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
} else {
    $imgcatpermHandler =& xoops_getHandler('groupperm');
    if (is_object($GLOBALS['xoopsUser'])) {
        if (!$imgcatpermHandler->checkRight('imgcat_write', $imgcat_id, $GLOBALS['xoopsUser']->getGroups())) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
        }
    } else {
        if (!$imgcatpermHandler->checkRight('imgcat_write', $imgcat_id, XOOPS_GROUP_ANONYMOUS)) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NOPERM;
        }
Example #20
0
    /**
     * @param $obj
     *
     * @return $this
     */
    public function createElements($obj)
    {
        $publisher =& PublisherPublisher::getInstance();
        $allowedEditors = publisherGetEditors($publisher->getHandler('permission')->getGrantedItems('editors'));
        if (!is_object($GLOBALS['xoopsUser'])) {
            $group = array(XOOPS_GROUP_ANONYMOUS);
        } else {
            $group = $GLOBALS['xoopsUser']->getGroups();
        }
        $this->setExtra('enctype="multipart/form-data"');
        $this->startTab(_CO_PUBLISHER_TAB_MAIN);
        // Category
        $categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
        $categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
        $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit());
        $this->addElement($categoryFormSelect);
        // ITEM TITLE
        $this->addElement(new XoopsFormText(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
        // SUBTITLE
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUBTITLE)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
        }
        // SHORT URL
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_SHORT_URL)) {
            $textShortUrl = new XoopsFormText(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e'));
            $textShortUrl->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
            $this->addElement($textShortUrl);
        }
        // TAGS
        if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) {
            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
            $textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
            $this->addElement($textTags);
        }
        // SELECT EDITOR
        $nohtml = !$obj->dohtml();
        if (count($allowedEditors) === 1) {
            $editor = $allowedEditors[0];
        } elseif (count($allowedEditors) > 0) {
            $editor = XoopsRequest::getString('editor', '', 'POST');
            if (!empty($editor)) {
                publisherSetCookieVar('publisher_editor', $editor);
            } else {
                $editor = publisherGetCookieVar('publisher_editor');
                if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                    //                    $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile
                    $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                    // Need set through user profile
                }
            }
            $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $publisher->getConfig('submit_editor') : $editor;
            $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
            $this->addElement($formEditor);
        } else {
            $editor = $publisher->getConfig('submit_editor');
        }
        $editorConfigs = array();
        $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
        $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
        $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width');
        $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height');
        // SUMMARY
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) {
            // Description
            //$summaryText = new XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60);
            $editorConfigs['name'] = 'summary';
            $editorConfigs['value'] = $obj->getVar('summary', 'e');
            $summaryText = new XoopsFormEditor(_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null);
            $summaryText->setDescription(_CO_PUBLISHER_SUMMARY_DSC);
            $this->addElement($summaryText);
        }
        // BODY
        $editorConfigs['name'] = 'body';
        $editorConfigs['value'] = $obj->getVar('body', 'e');
        $bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null);
        $bodyText->setDescription(_CO_PUBLISHER_BODY_DSC);
        $this->addElement($bodyText);
        // VARIOUS OPTIONS
        if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) {
                $html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
                $this->addElement($html_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) {
                $smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
                $this->addElement($smiley_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) {
                $xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO);
                $this->addElement($xcode_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) {
                $image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO);
                $this->addElement($image_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
                $linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO);
                $this->addElement($linebreak_radio);
            }
        }
        // Available pages to wrap
        if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
            $wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content'));
            $availableWrapPagesText = array();
            foreach ($wrapPages as $page) {
                $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
            }
            $availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText));
            $availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
            $this->addElement($availableWrapPages);
        }
        // Uid
        /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
            the method users::getobjects encounters a memory error
            */
        // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
        if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) {
            $uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false);
            $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC);
            $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC';
            $result = $obj->db->query($sql);
            $usersArray = array();
            $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous'];
            while (($myrow = $obj->db->fetchArray($result)) !== false) {
                $usersArray[$myrow['uid']] = $myrow['uname'];
            }
            $uidSelect->addOptionArray($usersArray);
            $this->addElement($uidSelect);
        }
        /* else {
           $hidden = new XoopsFormHidden('uid', $obj->uid());
           $this->addElement($hidden);
           unset($hidden);
           }*/
        // Author ALias
        if ($this->isGranted(PublisherConstants::PUBLISHER_AUTHOR_ALIAS)) {
            $element = new XoopsFormText(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
            $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
            $this->addElement($element);
            unset($element);
        }
        // STATUS
        if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) {
            $options = array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
            $statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
            $statusSelect->addOptionArray($options);
            $statusSelect->setDescription(_CO_PUBLISHER_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
        }
        // Datesub
        if ($this->isGranted(PublisherConstants::PUBLISHER_DATESUB)) {
            if ($obj->isNew()) {
                $datesub = time();
            } else {
                $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
            }
            $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            // $datesub_datetime = new XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
            $this->addElement($datesub_datetime);
        }
        // NOTIFY ON PUBLISH
        if ($this->isGranted(PublisherConstants::PUBLISHER_NOTIFY)) {
            $notify_radio = new XoopsFormRadioYN(_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO);
            $this->addElement($notify_radio);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) {
            $this->startTab(_CO_PUBLISHER_TAB_IMAGES);
        }
        // IMAGE
        if ($this->isGranted(PublisherConstants::PUBLISHER_IMAGE_ITEM)) {
            $objimages = $obj->getImages();
            $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array();
            $mergedimages = array_merge($mainarray, $objimages['others']);
            $objimage_array = array();
            foreach ($mergedimages as $imageObj) {
                $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $catids = array_keys($catlist);
            $imageObjs = array();
            if (!empty($catids)) {
                $imageHandler =& xoops_getHandler('image');
                $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN'));
                $criteria->add(new Criteria('image_display', 1));
                $criteria->setSort('image_nicename');
                $criteria->setOrder('ASC');
                $imageObjs = $imageHandler->getObjects($criteria, true);
                unset($criteria);
            }
            $image_array = array();
            foreach ($imageObjs as $imageObj) {
                $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $image_array = array_diff($image_array, $objimage_array);
            $imageSelect = new XoopsFormSelect('', 'image_notused', '', 5);
            $imageSelect->addOptionArray($image_array);
            $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'");
            unset($image_array);
            $imageSelect2 = new XoopsFormSelect('', 'image_item', '', 5, true);
            $imageSelect2->addOptionArray($objimage_array);
            $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $buttonadd = new XoopsFormButton('', 'buttonadd', _CO_PUBLISHER_ADD);
            $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $buttonremove = new XoopsFormButton('', 'buttonremove', _CO_PUBLISHER_REMOVE);
            $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $opentable = new XoopsFormLabel('', '<table><tr><td>');
            $addcol = new XoopsFormLabel('', '</td><td>');
            $addbreak = new XoopsFormLabel('', '<br />');
            $closetable = new XoopsFormLabel('', '</td></tr></table>');
            $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js');
            $js_data = new XoopsFormLabel('', '
<script type= "text/javascript">/*<![CDATA[*/
$publisher(document).ready(function () {
    var button = $publisher("#publisher_upload_button"), interval;
    new AjaxUpload(button,{
        action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons
        responseType: "text/html",
        name: "publisher_upload_file",
        onSubmit : function (file, ext) {
            // change button text, when user selects file
            $publisher("#publisher_upload_message").html(" ");
            button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'/>"); this.setData({
                "image_nicename": $publisher("#image_nicename").val(),
                "imgcat_id" : $publisher("#imgcat_id").val()
            });
            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();
            interval = window.setInterval(function () {
            }, 200);
        },
        onComplete: function (file, response) {
            button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '");
            window.clearInterval(interval);
            // enable upload button
            this.enable();
            // add file to the list
            var result = eval(response);
            if ("success" == result[0]) {
                 $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>");
                 publisher_updateSelectOption(\'image_item\', \'image_featured\');
                 showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\')
            } else {
                 $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>");
            }
        }
    });
});
/*]]>*/</script>
');
            $messages = new XoopsFormLabel('', "<div id='publisher_upload_message'></div>");
            $button = new XoopsFormLabel('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>');
            $nicename = new XoopsFormText('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME);
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $imagecat = new XoopsFormSelect('', 'imgcat_id', '', 1);
            $imagecat->addOptionArray($catlist);
            $imageUploadTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, '');
            $imageUploadTray->addElement($js_data);
            $imageUploadTray->addElement($messages);
            $imageUploadTray->addElement($opentable);
            $imageUploadTray->addElement($imagecat);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($nicename);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($button);
            $imageUploadTray->addElement($closetable);
            $this->addElement($imageUploadTray);
            $imageTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_ITEMS, '');
            $imageTray->addElement($opentable);
            $imageTray->addElement($imageSelect);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonadd);
            $imageTray->addElement($addcol);
            $imageTray->addElement($imageSelect2);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonremove);
            $imageTray->addElement($closetable);
            $imageTray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC);
            $this->addElement($imageTray);
            $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : '';
            $imageforpath = $imagename != '' ? $imagename : 'blank.gif';
            $imageSelect3 = new XoopsFormSelect(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1);
            $imageSelect3->addOptionArray($objimage_array);
            $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $imageSelect3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC);
            $this->addElement($imageSelect3);
            $image_preview = new XoopsFormLabel(_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt='' />");
            $this->addElement($image_preview);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) {
            $this->startTab(_CO_PUBLISHER_TAB_FILES);
        }
        // File upload UPLOAD
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_UPLOAD_FILE)) {
            // NAME
            $nameText = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, '');
            $nameText->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
            $this->addElement($nameText);
            unset($nameText);
            // DESCRIPTION
            $descriptionText = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', '');
            $descriptionText->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
            $this->addElement($descriptionText);
            unset($descriptionText);
            $statusSelect = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1);
            //1 - active
            $statusSelect->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
            $fileBox = new XoopsFormFile(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0);
            $fileBox->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC);
            $fileBox->setExtra("size ='50'");
            $this->addElement($fileBox);
            unset($fileBox);
            if (!$obj->isNew()) {
                $filesObj =& $publisher->getHandler('file')->getAllFiles($obj->itemid());
                if (count($filesObj) > 0) {
                    $table = '';
                    $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
                    $table .= '<tr>';
                    $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>";
                    $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>';
                    $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>';
                    $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
                    $table .= '</tr>';
                    foreach ($filesObj as $fileObj) {
                        $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
                        $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
                        if ($fileObj->status() == 0) {
                            $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>";
                        } else {
                            $not_visible = '';
                        }
                        $table .= '<tr>';
                        $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>';
                        $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>';
                        $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>';
                        $table .= "<td class='even' align='center'>" . $fileObj->counter() . '';
                        $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>';
                        $table .= "<td class='even' align='center'> {$modify} {$delete} </td>";
                        $table .= '</tr>';
                    }
                    $table .= '</table>';
                    $files_box = new XoopsFormLabel(_CO_PUBLISHER_FILES_LINKED, $table);
                    $this->addElement($files_box);
                    unset($files_box, $filesObj, $fileObj);
                }
            }
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) {
            $this->startTab(_CO_PUBLISHER_TAB_OTHERS);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_META);
        // Meta Keywords
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_KEYWORDS)) {
            $text_meta_keywords = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60);
            $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC);
            $this->addElement($text_meta_keywords);
        }
        // Meta Description
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_DESCRIPTION)) {
            $text_meta_description = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60);
            $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC);
            $this->addElement($text_meta_description);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS);
        // COMMENTS
        if ($this->isGranted(PublisherConstants::PUBLISHER_ALLOWCOMMENTS)) {
            $addcomments_radio = new XoopsFormRadioYN(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO);
            $this->addElement($addcomments_radio);
        }
        // WEIGHT
        if ($this->isGranted(PublisherConstants::PUBLISHER_WEIGHT)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight()));
        }
        $this->endTabs();
        //COMMON TO ALL TABS
        $button_tray = new XoopsFormElementTray('', '');
        if (!$obj->isNew()) {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _SUBMIT, 'submit'));
            //orclone
        } else {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _CO_PUBLISHER_CREATE, 'submit'));
            $button_tray->addElement(new XoopsFormButton('', '', _CO_PUBLISHER_CLEAR, 'reset'));
        }
        $button_tray->addElement(new XoopsFormButton('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit'));
        $butt_cancel = new XoopsFormButton('', '', _CO_PUBLISHER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $this->addElement($button_tray);
        $hidden = new XoopsFormHidden('itemid', $obj->itemid());
        $this->addElement($hidden);
        unset($hidden);
        return $this;
    }
Example #21
0
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @subpackage      Comments
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @version         $Id: comment_new.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
include_once __DIR__ . '/include/common.php';
$com_itemid = XoopsRequest::getInt('com_itemid', 0, 'GET');
if ($com_itemid > 0) {
    $itemObj =& $publisher->getHandler('item')->get($com_itemid);
    $com_replytext = _POSTEDBY . '&nbsp;<strong>' . $itemObj->getLinkedPosterName() . '</strong>&nbsp;' . _DATE . '&nbsp;<strong>' . $itemObj->dateSub() . '</strong><br /><br />' . $itemObj->summary();
    $bodytext = $itemObj->body();
    if ($bodytext != '') {
        $com_replytext .= '<br /><br />' . $bodytext . '';
    }
    $com_replytitle = $itemObj->getTitle();
    include_once $GLOBALS['xoops']->path('include/comment_new.php');
}
Example #22
0
<?php

/**
 * File : makefile.pdf for publisher
 * For tcpdf_for_xoops 2.01 and higher
 * Created by montuy337513 / philodenelle - http://www.chg-web.org
 **/
error_reporting(0);
include_once __DIR__ . '/header.php';
$itemid = XoopsRequest::getInt('itemid', 0, 'GET');
$item_page_id = XoopsRequest::getInt('page', -1, 'GET');
if ($itemid == 0) {
    redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
}
if (!is_file(XOOPS_PATH . '/vendor/tcpdf/tcpdf.php')) {
    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/viewtopic.php?topic_id=' . $itemid, 3, 'TCPF for Xoops not installed in ./xoops_lib/vendor/');
}
// Creating the item object for the selected item
$itemObj =& $publisher->getHandler('item')->get($itemid);
// if the selected item was not found, exit
if (!$itemObj) {
    redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the category object that holds the selected item
$categoryObj =& $publisher->getHandler('category')->get($itemObj->categoryid());
// Check user permissions to access that category of the selected item
if (!$itemObj->accessGranted()) {
    redirect_header('javascript:history.go(-1)', 1, _NOPERM);
}
xoops_loadLanguage('main', PUBLISHER_DIRNAME);
$dateformat = $itemObj->getDatesub();
Example #23
0
 * @since           1.0
 * @min_xoops       2.5.7
 * @author          Goffy - Wedega.com - Email:<*****@*****.**> - Website:<http://wedega.com>
 * @version         $Id: 1.0 infofields.php 1 Sun 2015/12/27 23:18:00Z Goffy - Wedega $
 */
include __DIR__ . '/header.php';
// It recovered the value of argument op in URL$
$op = XoopsRequest::getString('op', 'list');
// Request infofield_id
$addField_id = XoopsRequest::getInt('infofield_id', 0);
// Switch options
switch ($op) {
    case 'list':
    default:
        $start = XoopsRequest::getInt('start', 0);
        $limit = XoopsRequest::getInt('limit', $wgteams->getConfig('adminpager'));
        $templateMain = 'wgteams_admin_infofields.tpl';
        $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation('infofields.php'));
        $adminMenu->addItemButton(_AM_WGTEAMS_INFOFIELD_ADD, 'infofields.php?op=new', 'add');
        $GLOBALS['xoopsTpl']->assign('buttons', $adminMenu->renderButton());
        $infofieldsCount = $infofieldsHandler->getCountInfofields();
        $infofieldsAll = $infofieldsHandler->getAllInfofields($start, $limit);
        $GLOBALS['xoopsTpl']->assign('infofields_count', $infofieldsCount);
        $GLOBALS['xoopsTpl']->assign('wgteams_url', WGTEAMS_URL);
        $GLOBALS['xoopsTpl']->assign('wgteams_upload_url', WGTEAMS_UPLOAD_URL);
        // Table view
        if ($infofieldsCount > 0) {
            foreach (array_keys($infofieldsAll) as $i) {
                $infofield = $infofieldsAll[$i]->getValuesInfofields();
                $GLOBALS['xoopsTpl']->append('infofields_list', $infofield);
                unset($infofield);
Example #24
0
 */
include_once __DIR__ . '/admin_header.php';
$module =& $publisher->getModule();
$mod = $module->mid();
$modname = $module->name();
xoops_loadLanguage('admin', 'system');
xoops_loadLanguage('admin/preferences', 'system');
$op = 'showmod';
if (isset($_POST)) {
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
}
unset($k, $v);
$op = XoopsRequest::getString('op', $op, 'GET');
$configcat = XoopsRequest::getString('configcat', '', 'GET');
if ($op === 'showmod') {
    $configHandler =& xoops_getHandler('config');
    $config = $configHandler->getConfigs(new Criteria('conf_modid', $mod));
    $count = count($config);
    if ($count < 1) {
        redirect_header($module->getInfo('adminindex'), 1);
    }
    $xv_configs = $module->getInfo('config');
    $config_cats = $module->getInfo('configcat');
    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;
    xoops_loadLanguage('modinfo', $module->getVar('dirname'));
    if ($module->getVar('hascomments') == 1) {
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: pw_upload_file.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once __DIR__ . '/admin_header.php';
$errors = array();
if (publisher_pagewrap_upload($errors)) {
    redirect_header(XoopsRequest::getString('backto', '', 'POST'), 2, _AM_PUBLISHER_FILEUPLOAD_SUCCESS);
} else {
    $errorstxt = implode('<br />', $errors);
    $message = sprintf(_CO_PUBLISHER_MESSAGE_FILE_ERROR, $errorstxt);
    redirect_header(XoopsRequest::getString('backto', '', 'POST'), 5, $message);
}
/**
 * @param $errors
 *
 * @return bool
 */
function publisher_pagewrap_upload(&$errors)
{
    //    include_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
    xoops_load('XoopsMediaUploader');
    $publisher =& PublisherPublisher::getInstance();
    $postField = 'fileupload';
    $maxFileSize = $publisher->getConfig('maximum_filesize');
    $maxImageWidth = $publisher->getConfig('maximum_image_width');
    $maxImageHeight = $publisher->getConfig('maximum_image_height');
Example #26
0
        $edituser->setVar('user_sig', xoops_substr(XoopsRequest::getString('user_sig', ''), 0, 255));
        $edituser->setVar('user_viewemail', XoopsRequest::getBool('user_viewemail', 0));
        $edituser->setVar('user_aim', XoopsRequest::getString('user_aim', ''));
        $edituser->setVar('user_yim', XoopsRequest::getString('user_yim', ''));
        $edituser->setVar('user_msnm', XoopsRequest::getString('user_msnm', ''));
        $edituser->setVar('attachsig', XoopsRequest::getBool('attachsig', 0));
        $edituser->setVar('timezone_offset', XoopsRequest::getFloat('timezone_offset', 0.0));
        $edituser->setVar('uorder', XoopsRequest::getInt('uorder', 0));
        $edituser->setVar('umode', XoopsRequest::getString('umode', 'flat'));
        $edituser->setVar('notify_method', XoopsRequest::getInt('notify_method', 1));
        $edituser->setVar('notify_mode', XoopsRequest::getInt('notify_mode', 1));
        $edituser->setVar('bio', substr(XoopsRequest::getString('bio', ''), 0, 255));
        $edituser->setVar('user_occ', XoopsRequest::getString('user_occ', ''));
        $edituser->setVar('user_intrest', XoopsRequest::getString('user_intrest', ''));
        $edituser->setVar('user_mailok', XoopsRequest::getBool('user_mailok', 0));
        if (XoopsRequest::getBool('usecookie')) {
            setcookie($xoopsConfig['usercookie'], $xoopsUser->getVar('uname'), time() + 31536000, '/', XOOPS_COOKIE_DOMAIN);
        } else {
            setcookie($xoopsConfig['usercookie']);
        }
        if (!$member_handler->insertUser($edituser)) {
            include $GLOBALS['xoops']->path('header.php');
            echo $edituser->getHtmlErrors();
            include $GLOBALS['xoops']->path('footer.php');
        } else {
            redirect_header('userinfo.php?uid=' . $uid, 1, _US_PROFUPDATED);
        }
        exit;
    }
}
if ($op === 'editprofile') {
Example #27
0
 public static function clearEditSession()
 {
     $mimeid = XoopsRequest::getInt('id', '', 'GET');
     self::clearEditSessionVars($mimeid);
     header('Location: ' . publisherMakeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'edit', 'id' => $mimeid), false));
 }
Example #28
0
            $form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('wfs_version', '', 'POST')));
            $form->display();
        }
    }
    publisherCloseCollapsableBar('wfsectionimport', 'wfsectionimporticon');
    xoops_cp_footer();
}
if ($op === 'go') {
    publisherCpHeader();
    //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
    publisherOpenCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT);
    $cnt_imported_cat = 0;
    $cnt_imported_articles = 0;
    $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') {
        $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}";
    //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();
        $newCat = array();
        $newCat['oldid'] = $arrCat['id'];
        $newCat['oldpid'] = $arrCat['pid'];
        $categoryObj->setVar('parentid', $arrCat['pid']);
Example #29
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
 * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package             core
 * @since               2.0.0
 */
defined('XOOPS_ROOT_PATH') || exit('Restricted access');
xoops_loadLanguage('user');
// from $_POST we use keys: uname, pass, rememberme, xoops_redirect
XoopsLoad::load('XoopsRequest');
$uname = XoopsRequest::getString('uname', '', 'POST');
$pass = XoopsRequest::getString('pass', '', 'POST');
$rememberme = XoopsRequest::getString('rememberme', '', 'POST');
$redirect = XoopsRequest::getUrl('xoops_redirect', '', 'POST');
if ($uname == '' || $pass == '') {
    redirect_header(XOOPS_URL . '/user.php', 1, _US_INCORRECTLOGIN);
}
$member_handler = xoops_getHandler('member');
$myts = MyTextSanitizer::getInstance();
include_once $GLOBALS['xoops']->path('class/auth/authfactory.php');
xoops_loadLanguage('auth');
$xoopsAuth = XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname));
$user = $xoopsAuth->authenticate($uname, $pass);
if (false !== $user) {
    if (0 == $user->getVar('level')) {
        redirect_header(XOOPS_URL . '/index.php', 5, _US_NOACTTPADM);
    }
    if ($xoopsConfig['closesite'] == 1) {
        $allowed = false;
Example #30
0
 include_once $GLOBALS['xoops']->path('class/template.php');
 $GLOBALS['xoopsTpl'] = new XoopsTpl();
 include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
 $pmform = new XoopsForm('', 'pmform', 'pmlite.php', 'post', true);
 if ($reply == 1) {
     $subject = $pm->getVar('subject', 'E');
     if (!preg_match('/^' . _RE . '/i', $subject)) {
         $subject = _RE . ' ' . $subject;
     }
     $GLOBALS['xoopsTpl']->assign('to_username', $pm_uname);
     $pmform->addElement(new XoopsFormHidden('to_userid', $pm->getVar('from_userid')));
 } elseif ($sendmod == 1) {
     $GLOBALS['xoopsTpl']->assign('to_username', XoopsUser::getUnameFromId(XoopsRequest::getInt('to_userid', 0, 'POST')));
     $pmform->addElement(new XoopsFormHidden('to_userid', XoopsRequest::getInt('to_userid', 0, 'POST')));
     $subject = $myts->htmlSpecialChars(XoopsRequest::getString('subject', '', 'POST'));
     $message = $myts->htmlSpecialChars(XoopsRequest::getString('message', '', 'POST'));
 } else {
     if ($send2 == 1) {
         $GLOBALS['xoopsTpl']->assign('to_username', XoopsUser::getUnameFromId($to_userid, false));
         $pmform->addElement(new XoopsFormHidden('to_userid', $to_userid));
     } else {
         $to_username = new XoopsFormSelectUser('', 'to_userid');
         $GLOBALS['xoopsTpl']->assign('to_username', $to_username->render());
     }
     $subject = '';
     $message = '';
 }
 $pmform->addElement(new XoopsFormText('', 'subject', 30, 100, $subject), true);
 $msg_image = '';
 $icons_radio = new XoopsFormRadio(_MESSAGEICON, 'msg_image', $msg_image);
 //$subject_icons = XoopsLists::getSubjectsList();