publisherSaveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
             publisherSaveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
         }
     }
     //end of fx2024 code
     redirect_header($redirect_to, 2, $redirect_msg);
     //        exit();
     break;
     //Added by fx2024
 //Added by fx2024
 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->setVar('name', XoopsRequest::getString('name', '', 'POST'));
     $categoryObj->setVar('description', XoopsRequest::getString('description', '', 'POST'));
     $categoryObj->setVar('weight', XoopsRequest::getInt('weight', 0, 'POST'));
     if (isset($parentCat)) {
         $categoryObj->setVar('parentid', $parentCat);
     }
     publisherCpHeader();
     PublisherUtilities::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
     exit;
     break;
     //end of fx2024 code
 //end of fx2024 code
 case 'cancel':
     redirect_header('category.php', 1, sprintf(_AM_PUBLISHER_BACK2IDX, ''));
     //        exit();
     break;
 case 'default':
Exemple #2
0
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * wgTeams module for xoops
 *
 * @copyright       The XOOPS Project (http://xoops.org)
 * @license         GPL 2.0 or later
 * @package         wgteams
 * @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);
 * @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');
Exemple #4
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);
            }
/*
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();
}
Exemple #6
0
     $edituser->setVar('user_icq', XoopsRequest::getString('user_icq', ''));
     $edituser->setVar('user_from', XoopsRequest::getString('user_from', ''));
     $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;
 }
 * 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       (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) {
$modversion['configcat']['seo'] = array('name' => _MI_PUBLISHER_CONFCAT_SEO, 'description' => _MI_PUBLISHER_CONFCAT_SEO_DSC);
$modversion['configcat']['indexcat'] = array('name' => _MI_PUBLISHER_CONFCAT_INDEXCAT, 'description' => _MI_PUBLISHER_CONFCAT_INDEXCAT_DSC);
$modversion['configcat']['index'] = array('name' => _MI_PUBLISHER_CONFCAT_INDEX, 'description' => _MI_PUBLISHER_CONFCAT_INDEX_DSC);
$modversion['configcat']['category'] = array('name' => _MI_PUBLISHER_CONFCAT_CATEGORY, 'description' => _MI_PUBLISHER_CONFCAT_CATEGORY_DSC);
$modversion['configcat']['item'] = array('name' => _MI_PUBLISHER_CONFCAT_ITEM, 'description' => _MI_PUBLISHER_CONFCAT_ITEM_DSC);
$modversion['configcat']['print'] = array('name' => _MI_PUBLISHER_CONFCAT_PRINT, 'description' => _MI_PUBLISHER_CONFCAT_PRINT_DSC);
$modversion['configcat']['search'] = array('name' => _MI_PUBLISHER_CONFCAT_SEARCH, 'description' => _MI_PUBLISHER_CONFCAT_SEARCH_DSC);
$modversion['configcat']['submit'] = array('name' => _MI_PUBLISHER_CONFCAT_SUBMIT, 'description' => _MI_PUBLISHER_CONFCAT_SUBMIT_DSC);
$modversion['configcat']['permissions'] = array('name' => _MI_PUBLISHER_CONFCAT_PERMISSIONS, 'description' => _MI_PUBLISHER_CONFCAT_PERMISSIONS_DSC);
$modversion['configcat']['format'] = array('name' => _MI_PUBLISHER_CONFCAT_FORMAT, 'description' => _MI_PUBLISHER_CONFCAT_FORMAT_DSC);
//mb
$modversion['configcat']['group_header'] = array('name' => _MI_PUBLISHER_CONFCAT_FORMAT, 'description' => _MI_PUBLISHER_CONFCAT_FORMAT_DSC);
// Config Settings (only for modules that need config settings generated automatically)
################### SEO ####################
//$isModuleAction = (!empty($_POST['fct']) && 'modulesadmin' == $_POST['fct']) ? true : false;
$isModuleAction = 'modulesadmin' === XoopsRequest::getString('fct', '', 'POST');
//if ($isModuleAction && (in_array(php_sapi_name(), array('apache', 'apache2handler', 'cgi-fcgi')))) {
//    _MI_PUBLISHER_URL_REWRITE_HTACCESS => 'htaccess'
//}
// group header
$modversion['config'][] = array('name' => 'extrasystems_configs', 'title' => '_MI_PUBLISHER_CONFCAT_SEO', 'description' => '_MI_PUBLISHER_CONFCAT_SEO_DSC', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'odd', 'category' => 'group_header');
$modversion['config'][] = array('name' => 'seo_url_rewrite', 'title' => '_MI_PUBLISHER_URL_REWRITE', 'description' => '_MI_PUBLISHER_URL_REWRITE_DSC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'none', 'options' => array_merge(array(_MI_PUBLISHER_URL_REWRITE_NONE => 'none'), array(_MI_PUBLISHER_URL_REWRITE_PATHINFO => 'path-info'), $isModuleAction && in_array(php_sapi_name(), array('apache', 'apache2handler', 'cgi-fcgi')) ? array(_MI_PUBLISHER_URL_REWRITE_HTACCESS => 'htaccess') : array()), 'category' => 'seo');
$modversion['config'][] = array('name' => 'seo_module_name', 'title' => '_MI_PUBLISHER_SEOMODNAME', 'description' => '_MI_PUBLISHER_SEOMODNAMEDSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => $modversion['dirname'], 'category' => 'seo');
$modversion['config'][] = array('name' => 'seo_meta_keywords', 'title' => '_MI_PUBLISHER_SEO_METAKEYWORDS', 'description' => '_MI_PUBLISHER_SEO_METAKEYWORDS_DSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '', 'category' => 'seo');
################### INDEX PAGE ####################
// group header
$modversion['config'][] = array('name' => 'extrasystems_configs', 'title' => ' _MI_PUBLISHER_CONFCAT_INDEXCAT', 'description' => ' _MI_PUBLISHER_CONFCAT_INDEXCAT_DSC', 'formtype' => 'line_break', 'valuetype' => 'textbox', 'default' => 'even', 'category' => 'group_header');
$modversion['config'][] = array('name' => 'index_title_and_welcome', 'title' => '_MI_PUBLISHER_WELCOME', 'description' => '_MI_PUBLISHER_WELCOMEDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'index');
$modversion['config'][] = array('name' => 'index_welcome_msg', 'title' => '_MI_PUBLISHER_INDEXMSG', 'description' => '_MI_PUBLISHER_INDEXMSGDSC', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => _MI_PUBLISHER_INDEXMSGDEF, 'category' => 'index');
$modversion['config'][] = array('name' => 'index_display_last_items', 'title' => '_MI_PUBLISHER_LASTITEMS', 'description' => '_MI_PUBLISHER_LASTITEMSDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'index');
$modversion['config'][] = array('name' => 'index_footer', 'title' => '_MI_PUBLISHER_INDEXFOOTER', 'description' => '_MI_PUBLISHER_INDEXFOOTERDSC', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => '', 'category' => 'index');
Exemple #9
0
         redirect_header($itemObj->getItemUrl(), 2, $redirect_msg);
     }
     redirect_header('index.php', 2, $redirect_msg);
     //        exit();
     break;
 case 'add':
 default:
     $xoopsOption['template_main'] = 'publisher_submit.tpl';
     include_once $GLOBALS['xoops']->path('header.php');
     $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js');
     //        $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery-migrate-1.2.1.js');
     $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/publisher.js');
     include_once PUBLISHER_ROOT_PATH . '/footer.php';
     //mb        $itemObj->setVarsFromRequest();
     $xoopsTpl->assign('module_home', publisherModuleHome());
     if ('clone' === XoopsRequest::getString('op', '', 'GET')) {
         $xoopsTpl->assign('categoryPath', _CO_PUBLISHER_CLONE);
         $xoopsTpl->assign('langIntroTitle', _CO_PUBLISHER_CLONE);
     } elseif ($itemId) {
         $xoopsTpl->assign('categoryPath', _MD_PUBLISHER_EDIT_ARTICLE);
         $xoopsTpl->assign('langIntroTitle', _MD_PUBLISHER_EDIT_ARTICLE);
         $xoopsTpl->assign('langIntroText', '');
     } else {
         $xoopsTpl->assign('categoryPath', _MD_PUBLISHER_SUB_SNEWNAME);
         $xoopsTpl->assign('langIntroTitle', sprintf(_MD_PUBLISHER_SUB_SNEWNAME, ucwords($publisher->getModule()->name())));
         $xoopsTpl->assign('langIntroText', $publisher->getConfig('submit_intro_msg'));
     }
     $sform = $itemObj->getForm($formtitle, true);
     $sform->assign($xoopsTpl);
     include_once $GLOBALS['xoops']->path('footer.php');
     break;
Exemple #10
0
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @version         $Id: clone.php 10374 2012-12-12 23:39:48Z trabis $
 */
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 (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header('clone.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
        //        exit();
    }
    //    $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();
    }
    // Check wether the cloned module exists or not
    if ($clone && is_dir($GLOBALS['xoops']->path('modules/' . $clone))) {
        redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone));
    }
    $patterns = array(strtolower(PUBLISHER_DIRNAME) => strtolower($clone), strtoupper(PUBLISHER_DIRNAME) => strtoupper($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 = '';
Exemple #11
0
 /**
  * The name says it all
  */
 public function setVarsFromRequest()
 {
     //Required fields
     //        if (!empty($categoryid = XoopsRequest::getInt('categoryid', 0, 'POST'))) {
     //            $this->setVar('categoryid', $categoryid);}
     $this->setVar('categoryid', XoopsRequest::getInt('categoryid', 0, 'POST'));
     $this->setVar('title', XoopsRequest::getString('title', '', 'POST'));
     $this->setVar('body', XoopsRequest::getText('body', '', 'POST'));
     //Not required fields
     $this->setVar('summary', XoopsRequest::getText('summary', '', 'POST'));
     $this->setVar('subtitle', XoopsRequest::getString('subtitle', '', 'POST'));
     $this->setVar('item_tag', XoopsRequest::getString('item_tag', '', 'POST'));
     if ($imageFeatured = XoopsRequest::getString('image_featured', '', 'POST')) {
         $imageItem = XoopsRequest::getArray('image_item', array(), 'POST');
         //            $imageFeatured = XoopsRequest::getString('image_featured', '', 'POST');
         //Todo: get a better image class for xoops!
         //Image hack
         $imageItemIds = array();
         $sql = 'SELECT image_id, image_name FROM ' . $GLOBALS['xoopsDB']->prefix('image');
         $result = $GLOBALS['xoopsDB']->query($sql, 0, 0);
         while (($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) !== false) {
             $imageName = $myrow['image_name'];
             $id = $myrow['image_id'];
             if ($imageName == $imageFeatured) {
                 $this->setVar('image', $id);
             }
             if (in_array($imageName, $imageItem)) {
                 $imageItemIds[] = $id;
             }
         }
         $this->setVar('images', implode('|', $imageItemIds));
     }
     if ($authorAlias = XoopsRequest::getString('author_alias', '', 'POST')) {
         $this->setVar('author_alias', $authorAlias);
         if ($this->getVar('author_alias') !== '') {
             $this->setVar('uid', 0);
         }
     }
     //mb TODO check on version
     if ($datesub = XoopsRequest::getString('datesub', '', 'POST')) {
         //            if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
         //                $this->setVar('datesub', strtotime(XoopsRequest::getArray('datesub', array(), 'POST')['date']) + XoopsRequest::getArray('datesub', array(), 'POST')['time']);
         //            } else {
         $resDate = XoopsRequest::getArray('datesub', array(), 'POST');
         $resTime = XoopsRequest::getArray('datesub', array(), 'POST');
         //            $this->setVar('datesub', strtotime($resDate['date']) + $resTime['time']);
         $localTimestamp = strtotime($resDate['date']) + $resTime['time'];
         // get user Timezone offset and use it to find out the Timezone, needed for PHP DataTime
         $userTimeoffset = $GLOBALS['xoopsUser']->getVar('timezone_offset');
         $tz = timezone_name_from_abbr(null, $userTimeoffset * 3600);
         if ($tz === false) {
             $tz = timezone_name_from_abbr(null, $userTimeoffset * 3600, false);
         }
         $userTimezone = new DateTimeZone($tz);
         $gmtTimezone = new DateTimeZone('GMT');
         $myDateTime = new DateTime('now', $gmtTimezone);
         $offset = $userTimezone->getOffset($myDateTime);
         $gmtTimestamp = $localTimestamp - $offset;
         $this->setVar('datesub', $gmtTimestamp);
         //            }
     } elseif ($this->isNew()) {
         $this->setVar('datesub', time());
     }
     $this->setVar('short_url', XoopsRequest::getString('item_short_url', '', 'POST'));
     $this->setVar('meta_keywords', XoopsRequest::getString('item_meta_keywords', '', 'POST'));
     $this->setVar('meta_description', XoopsRequest::getString('item_meta_description', '', 'POST'));
     $this->setVar('weight', XoopsRequest::getInt('weight', 0, 'POST'));
     if ($this->isNew()) {
         $this->setVar('uid', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0);
         $this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments'));
         $this->setVar('status', $this->publisher->getConfig('submit_status'));
         $this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml'));
         $this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley'));
         $this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode'));
         $this->setVar('doimage', $this->publisher->getConfig('submit_doimage'));
         $this->setVar('dobr', $this->publisher->getConfig('submit_dobr'));
     } else {
         $this->setVar('uid', XoopsRequest::getInt('uid', 0, 'POST'));
         $this->setVar('cancomment', XoopsRequest::getInt('allowcomments', 1, 'POST'));
         $this->setVar('status', XoopsRequest::getInt('status', 1, 'POST'));
         $this->setVar('dohtml', XoopsRequest::getInt('dohtml', 1, 'POST'));
         $this->setVar('dosmiley', XoopsRequest::getInt('dosmiley', 1, 'POST'));
         $this->setVar('doxcode', XoopsRequest::getInt('doxcode', 1, 'POST'));
         $this->setVar('doimage', XoopsRequest::getInt('doimage', 1, 'POST'));
         $this->setVar('dobr', XoopsRequest::getInt('dolinebreak', 1, 'POST'));
     }
     $this->setVar('notifypub', XoopsRequest::getString('notify', '', 'POST'));
 }
Exemple #12
0
/**
 * @param $options
 *
 * @return array
 */
function publisher_search_show($options)
{
    $block = array();
    $publisher =& PublisherPublisher::getInstance();
    $categories =& $publisher->getHandler('category')->getCategoriesForSearch();
    if (count($categories) == 0) {
        return $block;
    }
    xoops_loadLanguage('search');
    $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 = XoopsRequest::getArray('searchin', '', 'POST');
    if (!isset($searchin)) {
        $searchin = XoopsRequest::getString('searchin', array(), 'GET');
        $searchin = isset($searchin) ? explode('|', $searchin) : array();
    }
    $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', 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);
    }
    $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 */
    $typeSelect = "<select name=\"andor\">";
    $typeSelect .= "<option value=\"OR\"";
    if ('OR' === $andor) {
        $typeSelect .= " selected=\"selected\"";
    }
    $typeSelect .= '>' . _SR_ANY . '</option>';
    $typeSelect .= "<option value=\"AND\"";
    if ('AND' === $andor) {
        $typeSelect .= " selected=\"selected\"";
    }
    $typeSelect .= '>' . _SR_ALL . '</option>';
    $typeSelect .= "<option value=\"EXACT\"";
    if ('exact' === $andor) {
        $typeSelect .= " selected=\"selected\"";
    }
    $typeSelect .= '>' . _SR_EXACT . '</option>';
    $typeSelect .= '</select>';
    /* category */
    $categorySelect = "<select name=\"category[]\" size=\"5\" multiple=\"multiple\" width=\"150\" style=\"width:150px;\">";
    $categorySelect .= "<option value=\"all\"";
    if (empty($category) || count($category) == 0) {
        $categorySelect .= "selected=\"selected\"";
    }
    $categorySelect .= '>' . _ALL . '</option>';
    foreach ($categories as $id => $cat) {
        $categorySelect .= "<option value=\"" . $id . "\"";
        if (in_array($id, $category)) {
            $categorySelect .= "selected=\"selected\"";
        }
        $categorySelect .= '>' . $cat . '</option>';
    }
    unset($id, $cat);
    $categorySelect .= '</select>';
    /* scope */
    $searchSelect = '';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"title\"";
    if (is_array($searchin) && in_array('title', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _CO_PUBLISHER_TITLE . '&nbsp;&nbsp;';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"subtitle\"";
    if (is_array($searchin) && in_array('subtitle', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _CO_PUBLISHER_SUBTITLE . '&nbsp;&nbsp;';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"summary\"";
    if (is_array($searchin) && in_array('summary', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _CO_PUBLISHER_SUMMARY . '&nbsp;&nbsp;';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
    if (is_array($searchin) && in_array('body', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _CO_PUBLISHER_BODY . '&nbsp;&nbsp;';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"keywords\"";
    if (is_array($searchin) && in_array('meta_keywords', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _CO_PUBLISHER_ITEM_META_KEYWORDS . '&nbsp;&nbsp;';
    $searchSelect .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
    if (empty($searchin) || is_array($searchin) && in_array('all', $searchin)) {
        $searchSelect .= ' checked';
    }
    $searchSelect .= ' />' . _ALL . '&nbsp;&nbsp;';
    /* sortby */
    $sortbySelect = "<select name=\"sortby\">";
    $sortbySelect .= "<option value=\"itemid\"";
    if ('itemid' === $sortby || empty($sortby)) {
        $sortbySelect .= " selected=\"selected\"";
    }
    $sortbySelect .= '>' . _NONE . '</option>';
    $sortbySelect .= "<option value=\"datesub\"";
    if ('datesub' === $sortby) {
        $sortbySelect .= " selected=\"selected\"";
    }
    $sortbySelect .= '>' . _CO_PUBLISHER_DATESUB . '</option>';
    $sortbySelect .= "<option value=\"title\"";
    if ('title' === $sortby) {
        $sortbySelect .= " selected=\"selected\"";
    }
    $sortbySelect .= '>' . _CO_PUBLISHER_TITLE . '</option>';
    $sortbySelect .= "<option value=\"categoryid\"";
    if ('categoryid' === $sortby) {
        $sortbySelect .= " selected=\"selected\"";
    }
    $sortbySelect .= '>' . _CO_PUBLISHER_CATEGORY . '</option>';
    $sortbySelect .= '</select>';
    $block['typeSelect'] = $typeSelect;
    $block['searchSelect'] = $searchSelect;
    $block['categorySelect'] = $categorySelect;
    $block['sortbySelect'] = $sortbySelect;
    $block['search_term'] = $term;
    $block['search_user'] = $username;
    $block['moduleUrl'] = PUBLISHER_URL;
    return $block;
}
Exemple #13
0
     $fileObj->setVar('description', XoopsRequest::getString('description', '', 'POST'));
     $fileObj->setVar('status', XoopsRequest::getInt('status', 0, 'POST'));
     // Storing the file
     if (!$fileObj->store()) {
         redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisherFormatErrors($fileObj->getErrors()));
         //            exit;
     }
     redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS);
     //        exit();
     break;
 case 'del':
     $fileid = XoopsRequest::getInt('fileid', 0, 'POST');
     $fileid = XoopsRequest::getInt('fileid', $fileid, 'GET');
     $fileObj =& $publisher->getHandler('file')->get($fileid);
     $confirm = XoopsRequest::getInt('confirm', 0, 'POST');
     $title = XoopsRequest::getString('title', '', 'POST');
     if ($confirm) {
         if (!$publisher->getHandler('file')->delete($fileObj)) {
             redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
             //                exit;
         }
         redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name()));
         //            exit();
     } else {
         // no confirm: show deletion condition
         $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 . ' <br />' . $fileObj->name() . ' <br /> <br />', _AM_PUBLISHER_DELETE);
         xoops_cp_footer();
     }
     exit;
Exemple #14
0
 public function createElements()
 {
     include_once dirname(dirname(__DIR__)) . '/include/common.php';
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $myTree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid');
     $catSelect = $myTree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
     $this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $catSelect));
     // Name
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     // EDITOR
     $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $gpermHandler =& $this->publisher->getHandler('groupperm');
     $moduleId = $this->publisher->getModule()->mid();
     $allowedEditors = publisherGetEditors($gpermHandler->getItemIds('editors', $groups, $moduleId));
     $nohtml = false;
     if (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 = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $this->publisher->getConfig('submit_editor') : $editor;
         $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
         $this->addElement($formEditor);
     } else {
         $editor = $this->publisher->getConfig('submit_editor');
     }
     $editorConfigs = array();
     $editorConfigs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
     $editorConfigs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
     $editorConfigs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? '100%' : $this->publisher->getConfig('submit_editor_width');
     $editorConfigs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? '400px' : $this->publisher->getConfig('submit_editor_height');
     $editorConfigs['name'] = 'header';
     $editorConfigs['value'] = $this->targetObject->header('e');
     $textHeader = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editorConfigs, $nohtml, $onfailure = null);
     $textHeader->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($textHeader);
     // IMAGE
     $imageArray = XoopsLists::getImgListAsArray(publisherGetImageDir('category'));
     $imageSelect = new XoopsFormSelect('', 'image', $this->targetObject->getImage());
     //$imageSelect -> addOption ('-1', '---------------');
     $imageSelect->addOptionArray($imageArray);
     $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $imageTray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $imageTray->addElement($imageSelect);
     $imageTray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisherGetImageDir('category', false) . $this->targetObject->getImage() . "' name='image3' id='image3' alt='' />"));
     $imageTray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($imageTray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $fileBox = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size);
     $fileBox->setExtra("size ='45'");
     $fileBox->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($fileBox);
     // Short url
     $textShortUrl = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
     $textShortUrl->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($textShortUrl);
     // Meta Keywords
     $textMetaKeywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
     $textMetaKeywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($textMetaKeywords);
     // Meta Description
     $textMetaDescription = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
     $textMetaDescription->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($textMetaDescription);
     // Weight
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new XoopsFormText('Custom template', 'template', 50, 255, $this->targetObject->template('e')), false);
     // READ PERMISSIONS
     $readPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_READ, '');
     $selectAllReadCheckbox = new XoopsFormCheckBox('', "adminbox", 1);
     $selectAllReadCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllReadCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox\" , \"groupsRead[]\");' ");
     $selectAllReadCheckbox->setClass('xo-checkall');
     $readPermissionsTray->addElement($selectAllReadCheckbox);
     $groupsReadCheckbox = new XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsReadCheckbox->addOption($group_id, $group_name);
     }
     $readPermissionsTray->addElement($groupsReadCheckbox);
     $this->addElement($readPermissionsTray);
     // SUBMIT PERMISSIONS
     $submitPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, '');
     $submitPermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     $selectAllSubmitCheckbox = new XoopsFormCheckBox('', "adminbox2", 1);
     $selectAllSubmitCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllSubmitCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox2\" , \"groupsSubmit[]\");' ");
     $selectAllSubmitCheckbox->setClass('xo-checkall');
     $submitPermissionsTray->addElement($selectAllSubmitCheckbox);
     $groupsSubmitCheckbox = new XoopsFormCheckBox('', 'groupsSubmit[]', $this->targetObject->getGroupsSubmit());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsSubmitCheckbox->addOption($group_id, $group_name);
     }
     $submitPermissionsTray->addElement($groupsSubmitCheckbox);
     $this->addElement($submitPermissionsTray);
     // MODERATION PERMISSIONS
     $moderatePermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, '');
     $moderatePermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     $selectAllModerateCheckbox = new XoopsFormCheckBox('', "adminbox3", 1);
     $selectAllModerateCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllModerateCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox3\" , \"groupsModeration[]\");' ");
     $selectAllModerateCheckbox->setClass('xo-checkall');
     $moderatePermissionsTray->addElement($selectAllModerateCheckbox);
     $groupsModerationCheckbox = new XoopsFormCheckBox('', 'groupsModeration[]', $this->targetObject->getGroupsModeration());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsModerationCheckbox->addOption($group_id, $group_name);
     }
     $moderatePermissionsTray->addElement($groupsModerationCheckbox);
     $this->addElement($moderatePermissionsTray);
     $moderator = new XoopsFormSelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $this->targetObject->moderator('e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     //SUBCATEGORY
     $catTray = new XoopsFormElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->subCatsCount; ++$i) {
         $subname = '';
         if ($i < (($scname = XoopsRequest::getArray('scname', array(), 'POST')) ? count($scname) : 0)) {
             $temp = XoopsRequest::getArray('scname', array(), 'POST');
             $subname = ($scname = XoopsRequest::getArray('scname', '', 'POST')) ? $temp[$i] : '';
         }
         $catTray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new XoopsFormText('', 'nb_subcats', 3, 2);
     $l = new XoopsFormLabel('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new XoopsFormButton('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$this->targetObject->categoryid()) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new XoopsFormElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $catTray->addElement($r);
     $this->addElement($catTray);
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }
Exemple #15
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;
    }
Exemple #16
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();
 */
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) {
Exemple #18
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;
     }
 }
            $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']);
/**
 * @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;
}
Exemple #21
0
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id: item.php 10661 2013-01-04 19:22:48Z trabis $
 */
include_once __DIR__ . '/admin_header.php';
$itemid = XoopsRequest::getInt('itemid', XoopsRequest::getInt('itemid', 0, 'POST'), 'GET');
$op = $itemid > 0 || XoopsRequest::getString('editor', '', 'POST') ? 'mod' : '';
//$op     = XoopsRequest::getString('op', $op, 'GET');
$op = XoopsRequest::getString('op', XoopsRequest::getString('op', $op, 'POST'), 'GET');
//if (!empty(XoopsRequest::getString('additem', '', 'POST'))) {
//    $op = 'additem';
//} elseif (!empty(XoopsRequest::getString('del', '', 'POST'))) {
//    $op = 'del';
//}
$op = XoopsRequest::getString('additem', '', 'POST') ? 'additem' : (XoopsRequest::getString('del', '', 'POST') ? 'del' : $op);
// Where shall we start ?
$submittedstartitem = XoopsRequest::getInt('submittedstartitem', XoopsRequest::getInt('submittedstartitem', 0, 'GET'), 'POST');
$publishedstartitem = XoopsRequest::getInt('publishedstartitem', XoopsRequest::getInt('publishedstartitem', 0, 'GET'), 'POST');
$offlinestartitem = XoopsRequest::getInt('offlinestartitem', XoopsRequest::getInt('offlinestartitem', 0, 'GET'), 'POST');
$rejectedstartitem = XoopsRequest::getInt('rejectedstartitem', XoopsRequest::getInt('submittedstartitem', 0, 'GET'), 'POST');
switch ($op) {
    case 'clone':
        if ($itemid == 0) {
            $totalcategories =& $publisher->getHandler('category')->getCategoriesCount(-1);
            if ($totalcategories == 0) {
                redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM);
                //                exit();
            }
        }
        publisherCpHeader();
Exemple #22
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;
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
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;
        }
Exemple #24
0
 if ($op === 'submit') {
     $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')) {
Exemple #25
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) {
Exemple #26
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 = '';
                $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})";
            }
            $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br />', $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');
            ob_start();
            $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);
            $form->addElement($parent_cat_sel);
            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('news_version', '', 'POST')));
            $form->display();
        }
    }
    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;
Exemple #28
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;
 public static function updateMimeValue()
 {
     $mimeId = 0;
     $publisher =& PublisherPublisher::getInstance();
     $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);
     } else {
         $mimeId = XoopsRequest::getInt('id', 0, 'GET');
     }
     $mimeTypeObj =& $publisher->getHandler('mimetype')->get($mimeId);
     if ('' !== ($mimeAdmin = XoopsRequest::getString('mime_admin', '', 'GET'))) {
         //            $mimeAdmin = XoopsRequest::getInt('mime_admin', 0, 'GET');
         $mimeAdmin = self::changeMimeValue($mimeAdmin);
         $mimeTypeObj->setVar('mime_admin', $mimeAdmin);
     }
     if ('' !== ($mimeUser = XoopsRequest::getString('mime_user', '', 'GET'))) {
         //            $mimeUser = XoopsRequest::getInt('mime_user', 0, 'GET');
         $mimeUser = self::changeMimeValue($mimeUser);
         $mimeTypeObj->setVar('mime_user', $mimeUser);
     }
     if ($publisher->getHandler('mimetype')->insert($mimeTypeObj, 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);
     }
 }
Exemple #30
0
     break;
 case 'modify':
     $fileid = XoopsRequest::getInt('fileid', 0, 'POST');
     // Creating the file object
     if ($fileid != 0) {
         $fileObj =& $publisher->getHandler('file')->get($fileid);
     } else {
         redirect_header('index.php', 1, _NOPERM);
         //            exit();
     }
     // Putting the values in the file object
     $fileObj->setVar('name', XoopsRequest::getString('name'));
     $fileObj->setVar('description', XoopsRequest::getString('description'));
     $fileObj->setVar('status', XoopsRequest::getInt('file_status', 0, 'GET'));
     // attach file if any
     if (XoopsRequest::getString('item_upload_file', '', 'FILES') != '') {
         $oldfile = $fileObj->getFilePath();
         // Get available mimetypes for file uploading
         $allowed_mimetypes =& $publisher->getHandler('mimetype')->getArrayByType();
         // TODO : display the available mimetypes to the user
         $errors = array();
         //            if ($publisher->getConfig('perm_upload') && is_uploaded_file(XoopsRequest::getArray('item_upload_file', array(), 'FILES')['tmp_name'])) {
         $temp = XoopsRequest::getArray('item_upload_file', array(), 'FILES');
         if ($publisher->getConfig('perm_upload') && is_uploaded_file($temp['tmp_name'])) {
             if ($fileObj->checkUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                 if ($fileObj->storeUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                     unlink($oldfile);
                 }
             }
         }
     }