Ejemplo n.º 1
0
/**
 * @param $options
 * @return string
 */
function about_block_page_edit($options)
{
    xoops_loadLanguage('blocks', 'about');
    $page_handler = xoops_getModuleHandler('page', 'about');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('page_status', 1), 'AND');
    $criteria->add(new Criteria('page_type', 1));
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $fields = array('page_id', 'page_title', 'page_image');
    $pages = $page_handler->getAll($criteria, $fields, false);
    $page_title = '';
    foreach ($pages as $k => $v) {
        $page_title = '<a href="' . XOOPS_URL . '/modules/' . basename(dirname(__DIR__)) . '/index.php?page_id=' . $k . '" target="_blank">' . $v['page_title'] . '</a>';
        $options_page[$k] = empty($v['page_image']) ? $page_title : $page_title . '<img src="' . XOOPS_URL . '/modules/' . basename(dirname(__DIR__)) . '/assets/images/picture.png' . '" />';
    }
    include_once dirname(__DIR__) . '/include/xoopsformloader.php';
    $form = new XoopsBlockForm();
    $page_select = new XoopsFormRadio(_MB_ABOUT_BLOCKPAGE, 'options[0]', $options[0], '<br>');
    $page_select->addOptionArray($options_page);
    $form->addElement($page_select);
    $form->addElement(new XoopsFormText(_MB_ABOUT_TEXT_LENGTH, 'options[1]', 5, 5, $options[1]));
    $form->addElement(new XoopsFormText(_MB_ABOUT_VIEW_MORELINKTEXT, 'options[2]', 30, 50, $options[2]));
    $form->addElement(new XoopsFormRadioYN(_MB_ABOUT_DOTITLEIMAGE, 'options[3]', $options[3]));
    return $form->render();
}
Ejemplo n.º 2
0
 /**
  * @param bool $action
  *
  * @return XoopsThemeForm
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? sprintf(_AM_SYSTEM_BANNERS_ADDNWBNR) : sprintf(_AM_SYSTEM_BANNERS_EDITBNR);
     xoops_load('XoopsFormLoader');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $banner_client_Handler =& xoops_getModuleHandler('bannerclient', 'system');
     $client_select = new XoopsFormSelect(_AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid'));
     $client_select->addOptionArray($banner_client_Handler->getList());
     $form->addElement($client_select, true);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal')), true);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl')), false);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl')), false);
     $htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner');
     $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO));
     $form->addElement(new xoopsFormTextArea(_AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('bid', $this->getVar('bid')));
     }
     $form->addElement(new XoopsFormHidden('op', 'banner_save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     //$form->display();
     return $form;
 }
Ejemplo n.º 3
0
function smarty_function_xoInboxCount($params, &$smarty)
{
    global $xoopsUser;
    if (!isset($xoopsUser) || !is_object($xoopsUser)) {
        return;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = intval($_SESSION['xoops_inbox_count']);
    } else {
        $module_handler = xoops_gethandler('module');
        $pm_module = $module_handler->getByDirname('pm');
        if ($pm_module && $pm_module->getVar('isactive')) {
            $pm_handler =& xoops_getModuleHandler('message', 'pm');
        } else {
            $pm_handler =& xoops_gethandler('privmessage');
        }
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
        $count = intval($pm_handler->getCount($criteria));
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
Ejemplo n.º 4
0
 /**
  * Delete an object from the database
  * @see XoopsPersistableObjectHandler
  *
  * @param XoopsObject $obj
  * @param bool           $force
  *
  * @return bool
  */
 public function delete(XoopsObject $obj, $force = false)
 {
     if (parent::delete($obj, $force)) {
         $field_handler = xoops_getModuleHandler('field');
         return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')), $force);
     }
     return false;
 }
Ejemplo n.º 5
0
function profile_install_addField($name, $title, $description, $category, $type, $valuetype, $weight, $canedit, $options, $step_id, $length, $visible = true)
{
    global $module_id;
    $profilefield_handler = xoops_getModuleHandler('field', 'profile');
    $obj = $profilefield_handler->create();
    $obj->setVar('field_name', $name, true);
    $obj->setVar('field_moduleid', $module_id, true);
    $obj->setVar('field_show', 1);
    $obj->setVar('field_edit', $canedit ? 1 : 0);
    $obj->setVar('field_config', 0);
    $obj->setVar('field_title', strip_tags($title), true);
    $obj->setVar('field_description', strip_tags($description), true);
    $obj->setVar('field_type', $type, true);
    $obj->setVar('field_valuetype', $valuetype, true);
    $obj->setVar('field_options', $options, true);
    if ($canedit) {
        $obj->setVar('field_maxlength', $length, true);
    }
    $obj->setVar('field_weight', $weight, true);
    $obj->setVar('cat_id', $category, true);
    $obj->setVar('step_id', $step_id, true);
    $profilefield_handler->insert($obj);
    profile_install_setPermissions($obj->getVar('field_id'), $module_id, $canedit, $visible);
    return true;
    /*
    //$GLOBALS['xoopsDB']->query("INSERT INTO ".$GLOBALS['xoopsDB']->prefix("profile_field")." VALUES (0, {$category}, '{$type}', {$valuetype}, '{$name}', " . $GLOBALS['xoopsDB']->quote($title) . ", " . $GLOBALS['xoopsDB']->quote($description) . ", 0, {$length}, {$weight}, '', 1, {$canedit}, 1, 0, '" . serialize($options) . "', {$step_id})");
    $gperm_itemid = $obj->getVar('field_id');
    unset($obj);
    $gperm_modid = $module_id;
    $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("group_permission") .
        " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) " .
        " VALUES " .
        ($canedit ?
            " (" . XOOPS_GROUP_ADMIN . ", {$gperm_itemid}, {$gperm_modid}, 'profile_edit'), "
        : "" ) .
        ($canedit == 1 ?
            " (" . XOOPS_GROUP_USERS . ", {$gperm_itemid}, {$gperm_modid}, 'profile_edit'), "
        : "" ) .
        " (" . XOOPS_GROUP_ADMIN . ", {$gperm_itemid}, {$gperm_modid}, 'profile_search'), " .
        " (" . XOOPS_GROUP_USERS . ", {$gperm_itemid}, {$gperm_modid}, 'profile_search') " .
        " ";
    $GLOBALS['xoopsDB']->query($sql);
    
    if ( $visible ) {
        $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("profile_visibility") .
            " (field_id, user_group, profile_group) " .
            " VALUES " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_ADMIN . ", " . XOOPS_GROUP_ADMIN . "), " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_ADMIN . ", " . XOOPS_GROUP_USERS . "), " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_USERS . ", " . XOOPS_GROUP_ADMIN . "), " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_USERS . ", " . XOOPS_GROUP_USERS . "), " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_ANONYMOUS . ", " . XOOPS_GROUP_ADMIN . "), " .
            " ({$gperm_itemid}, " . XOOPS_GROUP_ANONYMOUS . ", " . XOOPS_GROUP_USERS . ")" .
            " ";
        $GLOBALS['xoopsDB']->query($sql);
    }
    */
}
Ejemplo n.º 6
0
function b_mypics_lastpictures_show($options)
{
    $criteria = new Criteria('id', 0, '>');
    $criteria->setSort('id');
    $criteria->setOrder('DESC');
    $criteria->setLimit($options[0]);
    $handler = xoops_getModuleHandler('image', 'mypics');
    $block = $handler->getLastPicturesForBlock($options[0]);
    return $block;
}
Ejemplo n.º 7
0
 function _getModuleMenus($module, $pid)
 {
     global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
     static $id = -1;
     $ret = array();
     //Sanitizing $module
     if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $module)) {
         return $ret;
     }
     $path = "modules/{$module}";
     $file = $GLOBALS['xoops']->path("{$path}/xoops_version.php");
     if (!file_exists($file)) {
         return $ret;
     }
     xoops_loadLanguage('modinfo', $module);
     $force = true;
     $overwrite = false;
     if ($force && (!is_object($xoopsModule) || $xoopsModule->getVar('dirname') != $module)) {
         $_xoopsModule = is_object($xoopsModule) ? $xoopsModule : $xoopsModule;
         $_xoopsModuleConfig = is_object($xoopsModuleConfig) ? $xoopsModuleConfig : $xoopsModuleConfig;
         $module_handler =& xoops_gethandler('module');
         $xoopsModule =& $module_handler->getByDirname($module);
         $GLOBALS['xoopsModule'] =& $xoopsModule;
         if (is_object($xoopsModule)) {
             $config_handler =& xoops_gethandler('config');
             $xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
             $GLOBALS['xoopsModuleConfig'] =& $xoopsModuleConfig;
         }
         $overwrite = true;
     }
     $modversion['sub'] = array();
     include $file;
     $handler = xoops_getModuleHandler('menu', 'mymenus');
     foreach ($modversion['sub'] as $menu) {
         $obj = $handler->create();
         $obj->setVar('title', $menu['name']);
         $obj->setVar('alt_title', $menu['name']);
         $obj->setVar('link', $GLOBALS['xoops']->url("{$path}/{$menu['url']}"));
         $obj->setVar('id', $id);
         $obj->setVar('pid', $pid);
         $ret[] = $obj->getValues();
         $id--;
     }
     if ($overwrite) {
         $xoopsModule =& $_xoopsModule;
         $GLOBALS['xoopsModule'] =& $xoopsModule;
         $xoopsModuleConfig =& $_xoopsModuleConfig;
         $GLOBALS['xoopsModuleConfig'] =& $xoopsModuleConfig;
     }
     return $ret;
 }
Ejemplo n.º 8
0
 /**
  * @param bool $action
  * @return XoopsThemeForm
  */
 public function getForm($action = false)
 {
     global $xoopsDB, $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT);
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     // Cat_pid
     include_once XOOPS_ROOT_PATH . '/class/tree.php';
     $categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
     $criteria = new CriteriaCompo();
     $categories = $categoriesHandler->getObjects($criteria);
     if ($categories) {
         $categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid');
         $cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false);
         $form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid));
     }
     // Cat_title
     $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true);
     // Cat_desc
     $form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true);
     // Cat_image
     $cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif';
     $uploadir = '/uploads/presenter/images/categories';
     $imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />');
     $imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir);
     $imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image);
     $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir);
     foreach ($image_array as $image) {
         $imageselect->addOption("{$image}", $image);
     }
     $imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'");
     $imgtray->addElement($imageselect);
     $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />"));
     $fileseltray = new XoopsFormElementTray('', '<br />');
     $fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize']));
     $fileseltray->addElement(new XoopsFormLabel(''));
     $imgtray->addElement($fileseltray);
     $form->addElement($imgtray);
     // Cat_weight
     $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false);
     // Cat_color
     //      $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
Ejemplo n.º 9
0
function subscribers_sendEmails()
{
    global $xoopsConfig;
    $thisConfigs =& subscribers_getModuleConfig();
    $emailsperpack = intval($thisConfigs['emailsperpack']);
    $timebpacks = intval($thisConfigs['timebpacks']);
    $fromname = trim($thisConfigs['fromname']);
    $fromemail = trim($thisConfigs['fromemail']);
    $fromname = $fromname != '' ? $fromname : $xoopsConfig['sitename'];
    $fromemail = $fromemail != '' ? $fromemail : $xoopsConfig['adminmail'];
    $now = time();
    $last = subscribers_getLastTime();
    if ($now - $last <= $timebpacks) {
        return false;
    }
    $this_handler =& xoops_getModuleHandler('waiting', 'subscribers');
    $criteria = new CriteriaCompo();
    $criteria->setSort('wt_priority DESC, wt_created');
    $criteria->setOrder('ASC');
    $criteria->setLimit($emailsperpack);
    $objs = $this_handler->getObjects($criteria);
    $count = count($objs);
    unset($criteria);
    if ($count == 0) {
        return false;
    }
    include_once XOOPS_ROOT_PATH . '/kernel/user.php';
    $obj_delete = array();
    foreach ($objs as $obj) {
        $xoopsMailer =& xoops_getMailer();
        $xoopsMailer->multimailer->ContentType = "text/html";
        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/subscribers/language/' . $xoopsConfig['language'] . '/mail_template/');
        $xoopsMailer->setTemplate('content.tpl');
        $xoopsMailer->setFromName($fromname);
        $xoopsMailer->setFromEmail($fromemail);
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails(array($obj->getVar('wt_toemail', 'n')));
        $xoopsMailer->setSubject($obj->getVar('wt_subject'), 'n');
        $xoopsMailer->assign('CONTENT', $obj->getVar('wt_body'));
        $key = md5($obj->getVar('wt_toemail', 'n') . XOOPS_ROOT_PATH);
        $xoopsMailer->assign("UNSUBSCRIBE_URL", XOOPS_URL . '/modules/subscribers/unsubscribe.php?email=' . $obj->getVar('wt_toemail', 'n') . '&key=' . $key);
        $xoopsMailer->send(false);
        unset($xoopsMailer);
        $obj_delete[] = $obj->getVar('wt_id');
    }
    $criteria = new Criteria('wt_id', '(' . implode(',', $obj_delete) . ')', 'IN');
    $this_handler->deleteAll($criteria, true);
    subscribers_setLastTime($now);
    return true;
}
Ejemplo n.º 10
0
function langDropdown()
{
    $content = '';
    $time = time();
    if (!isset($_SESSION['XoopsMLcontent']) && @$_SESSION['XoopsMLcontent_expire'] < $time) {
        include_once XOOPS_ROOT_PATH . '/kernel/module.php';
        $xlanguage = XoopsModule::getByDirname('xlanguage');
        if (is_object($xlanguage) && $xlanguage->getVar('isactive')) {
            include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php';
            include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php';
            $xlanguage_handler = xoops_getModuleHandler('language', 'xlanguage');
            $xlanguage_handler->loadConfig();
            $lang_list =& $xlanguage_handler->getAllList();
            $content .= '<select name="mlanguages" id="mlanguages">';
            $content .= '<option value="">{#xoopsmlcontent_dlg.sellang}</option>';
            if (is_array($lang_list) && count($lang_list) > 0) {
                foreach (array_keys($lang_list) as $lang_name) {
                    $lang =& $lang_list[$lang_name];
                    $content .= '<option value="' . $lang['base']->getVar('lang_code') . '">' . $lang['base']->getVar('lang_name') . '</option>';
                }
            }
            $content .= '</select>';
        } elseif (defined('EASIESTML_LANGS') && defined('EASIESTML_LANGNAMES')) {
            $easiestml_langs = explode(',', EASIESTML_LANGS);
            $langnames = explode(',', EASIESTML_LANGNAMES);
            $lang_options = '';
            $content .= '<select name="mlanguages" id="mlanguages">';
            $content .= '<option value="">{#xoopsmlcontent_dlg.sellang}</option>';
            foreach ($easiestml_langs as $l => $lang) {
                $content .= '<option value="' . $lang . '">' . $langnames[$l] . '</option>';
            }
            $content .= '</select>';
        } else {
            $content .= '<input type="text" name="mlanguages" />';
        }
        $_SESSION['XoopsMLcontent'] = $content;
        $_SESSION['XoopsMLcontent_expire'] = $time + 300;
    }
    echo $_SESSION['XoopsMLcontent'];
}
Ejemplo n.º 11
0
/** Get item fields: title, content, time, link, uid, uname, tags *
 *
 * @param $items
 */
function publisher_tag_iteminfo(&$items)
{
    $itemsId = array();
    foreach (array_keys($items) as $catId) {
        // Some handling here to build the link upon catid
        // if catid is not used, just skip it
        foreach (array_keys($items[$catId]) as $itemId) {
            // In article, the item_id is "art_id"
            $itemsId[] = (int) $itemId;
        }
    }
    $itemHandler =& xoops_getModuleHandler('item', 'publisher');
    $criteria = new Criteria('itemid', '(' . implode(', ', $itemsId) . ')', 'IN');
    $itemsObj = $itemHandler->getObjects($criteria, 'itemid');
    foreach (array_keys($items) as $catId) {
        foreach (array_keys($items[$catId]) as $itemId) {
            $itemObj = $itemsObj[$itemId];
            $items[$catId][$itemId] = array('title' => $itemObj->getVar('title'), 'uid' => $itemObj->getVar('uid'), 'link' => "item.php?itemid={$itemId}", 'time' => $itemObj->getVar('datesub'), 'tags' => tag_parse_tag($itemObj->getVar('item_tag', 'n')), 'content' => '');
        }
    }
    unset($itemsObj);
}
Ejemplo n.º 12
0
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GPL 2.0 or later
 * @package         presenter
 * @since           2.5.5
 * @author          XOOPS Development Team <*****@*****.**> - <http://xoops.org>
 * @version         $Id: 1.0 categories.php 11532 Wed 2013/08/28 4:00:27Z XOOPS Development Team $
 */
include_once __DIR__ . '/header.php';
$xoopsOption['template_main'] = 'presenter_categories.tpl';
include_once XOOPS_ROOT_PATH . '/header.php';
$start = presenter_CleanVars($_REQUEST, 'start', 0);
// Define Stylesheet
$xoTheme->addStylesheet($style);
// Get Handler
$categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
$nb_categories = $GLOBALS['xoopsModuleConfig']['userpager'];
$criteria = new CriteriaCompo();
$categories_count = $categoriesHandler->getCount($criteria);
$categories_arr = $categoriesHandler->getAll($criteria);
if ($categories_count > 0) {
    foreach (array_keys($categories_arr) as $i) {
        $cat['cat_id'] = $categories_arr[$i]->getVar('cat_id');
        $cat['cat_pid'] = $categories_arr[$i]->getVar('cat_pid');
        $cat['cat_title'] = $categories_arr[$i]->getVar('cat_title');
        $cat['cat_desc'] = strip_tags($categories_arr[$i]->getVar('cat_desc'));
        $cat['cat_image'] = $categories_arr[$i]->getVar('cat_image');
        $cat['cat_weight'] = $categories_arr[$i]->getVar('cat_weight');
        $cat['cat_color'] = $categories_arr[$i]->getVar('cat_color');
        $GLOBALS['xoopsTpl']->append('categories', $cat);
        $keywords[] = $categories_arr[$i]->getVar('cat_name');
Ejemplo n.º 13
0
/**
 * @param $step_d
 * @param $step_save
 */
function profile_stepsave_toggle($step_d, $step_save)
{
    $step_save = $step_save == 1 ? 0 : 1;
    $handler = xoops_getModuleHandler('regstep');
    $obj = $handler->get($_REQUEST['step_id']);
    $obj->setVar('step_save', $step_save);
    if ($handler->insert($obj, true)) {
        redirect_header('step.php', 1, _PROFILE_AM_SAVESTEP_TOGGLE_SUCCESS);
    } else {
        redirect_header('step.php', 1, _PROFILE_AM_SAVESTEP_TOGGLE_FAILED);
    }
}
Ejemplo n.º 14
0
 /**
  *  @static function initHandler
  *  @param string $name
  */
 public function initHandler($name)
 {
     $this->addLog('INIT ' . $name . ' HANDLER');
     $this->handler[$name . '_handler'] = xoops_getModuleHandler($name, $this->dirname);
 }
Ejemplo n.º 15
0
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          Taiwen Jiang <*****@*****.**>
 * @version         $Id: search.php 10374 2012-12-12 23:39:48Z trabis $
 */
include_once __DIR__ . '/header.php';
xoops_loadLanguage('search');
//Checking general permissions
$configHandler =& xoops_getHandler('config');
$xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
if (empty($xoopsConfigSearch['enable_search'])) {
    redirect_header(PUBLISHER_URL . '/index.php', 2, _NOPERM);
    //    exit();
}
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gpermHandler =& xoops_getModuleHandler('groupperm', PUBLISHER_DIRNAME);
$module_id = $publisher->getModule()->mid();
//Checking permissions
if (!$publisher->getConfig('perm_search') || !$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_SEARCH, $groups, $module_id)) {
    redirect_header(PUBLISHER_URL, 2, _NOPERM);
    //    exit();
}
$GLOBALS['xoopsConfig']['module_cache'][$module_id] = 0;
$xoopsOption['template_main'] = 'publisher_search.tpl';
include $GLOBALS['xoops']->path('header.php');
$module_info_search = $publisher->getModule()->getInfo('search');
include_once PUBLISHER_ROOT_PATH . '/' . $module_info_search['file'];
$limit = 10;
//$publisher->getConfig('idxcat_perpage');
$uid = 0;
$queries = array();
Ejemplo n.º 16
0
                        case 'images':
                            $imgcat_handler = xoops_getHandler('image');
                            $img = $imgcat_handler->getCount();
                            $menu['infos'] = sprintf(_AM_SYSTEM_IMG_INFO, $img);
                            break;
                        case 'smilies':
                            $smilies_Handler = xoops_getModuleHandler('smilies', 'system');
                            $smilies = $smilies_Handler->getCount();
                            $menu['infos'] = sprintf(_AM_SYSTEM_SMILIES_INFO, $smilies);
                            break;
                        case 'userrank':
                            $userrank_Handler = xoops_getModuleHandler('userrank', 'system');
                            $userrank = $userrank_Handler->getCount();
                            $menu['infos'] = sprintf(_AM_SYSTEM_RANKS_INFO, $userrank);
                            break;
                        case 'users':
                            $member_handler = xoops_getModuleHandler('users', 'system');
                            $member = $member_handler->getCount();
                            $menu['infos'] = sprintf(_AM_SYSTEM_USERS_INFO, $member);
                            break;
                    }
                }
                $xoopsTpl->append_by_ref('menu', $menu);
                unset($menu);
            }
            unset($modversion);
        }
    }
    unset($dirlist);
    xoops_cp_footer();
}
Ejemplo n.º 17
0
/**
 * @param $field_id
 * @param $field_required
 */
function profile_visible_toggle($field_id, $field_required)
{
    $field_required = $field_required == 1 ? 0 : 1;
    $this_handler = xoops_getModuleHandler('field', 'profile');
    $obj = $this_handler->get($field_id);
    $obj->setVar('field_required', $field_required);
    if ($this_handler->insert($obj, true)) {
        redirect_header('field.php', 1, _PROFILE_AM_REQUIRED_TOGGLE_SUCCESS);
    } else {
        redirect_header('field.php', 1, _PROFILE_AM_REQUIRED_TOGGLE_FAILED);
    }
}
Ejemplo n.º 18
0
 public function header()
 {
     global $xoops, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsOption, $xoTheme, $xoopsTpl;
     ob_start();
     xoops_loadLanguage('admin', 'system');
     xoops_loadLanguage('cpanel', 'system');
     xoops_loadLanguage('modinfo', 'system');
     $xoopsLogger = XoopsLogger::getInstance();
     $xoopsLogger->stopTime('Module init');
     $xoopsLogger->startTime('XOOPS output init');
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . _CHARSET);
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header('Cache-Control: post-check=0, pre-check=0', false);
         header('Pragma: no-cache');
     }
     require_once XOOPS_ROOT_PATH . '/class/template.php';
     require_once XOOPS_ROOT_PATH . '/class/theme.php';
     if (@$GLOBALS['xoopsOption']['template_main']) {
         if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
             $GLOBALS['xoopsOption']['template_main'] = 'db:' . $GLOBALS['xoopsOption']['template_main'];
         }
     }
     $adminThemeFactory = new xos_opal_AdminThemeFactory();
     $this->xoTheme =& $adminThemeFactory->createInstance(array('folderName' => $this->foldername, 'themesPath' => 'modules/system/themes', 'contentTemplate' => @$GLOBALS['xoopsOption']['template_main']));
     $this->xoTheme->loadLocalization('admin');
     $this->template =& $this->xoTheme->template;
     $GLOBALS['xoTheme'] =& $this->xoTheme;
     $GLOBALS['adminTpl'] =& $this->xoTheme->template;
     $xoopsLogger->stopTime('XOOPS output init');
     $xoopsLogger->startTime('Module display');
     $xoopsPreload = XoopsPreload::getInstance();
     $xoopsPreload->triggerEvent('system.class.gui.header');
     if (isset($xoopsModule) && $xoopsModule->getVar('dirname') === 'system') {
         $xoopsModule->loadAdminMenu();
         foreach (array_keys($xoopsModule->adminmenu) as $item) {
             $sys_menu[$item]['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->adminmenu[$item]['link'];
             $GLOBALS['xoopsTpl']->append_by_ref('sys_menu', $sys_menu);
             unset($sys_menu);
         }
     }
     // Module adminmenu
     if (isset($xoopsModule) && $xoopsModule->getVar('dirname') !== 'system') {
         if ($xoopsModule->getInfo('system_menu')) {
             $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/system/css/menu.css');
             $xoopsModule->loadAdminMenu();
             // Get menu tab handler
             $menu_handler = xoops_getModuleHandler('menu', 'system');
             // Define top navigation
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $xoopsModule->getVar('mid', 'e'), _AM_SYSTEM_PREF);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&amp;op=update&amp;module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UPDATE);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=list&amp;filter=1&amp;selgen=' . $xoopsModule->getVar('mid', 'e') . '&amp;selmod=-2&amp;selgrp=-1&amp;selvis=-1', _AM_SYSTEM_BLOCKS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=listtpl&amp;tplset=default&amp;moddir=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_TPLSETS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?module=' . $xoopsModule->getVar('mid', 'e') . '&amp;status=0&amp;limit=10&amp;fct=comments', _AM_SYSTEM_COMMENTS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&amp;op=uninstall&amp;module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UNINSTALL);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'e') . '/', _AM_SYSTEM_GOTOMODULE);
             // Define main tab navigation
             $i = 0;
             $current = $i;
             foreach ($xoopsModule->adminmenu as $menu) {
                 if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
                     $current = $i;
                 }
                 $menu_handler->addMenuTabs($menu['link'], $menu['title']);
                 ++$i;
             }
             if ($xoopsModule->getInfo('help')) {
                 if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoopsModule->getInfo('help')) !== false) {
                     $current = $i;
                 }
                 $menu_handler->addMenuTabs('../system/help.php?mid=' . $xoopsModule->getVar('mid', 's') . '&amp;' . $xoopsModule->getInfo('help'), _AM_SYSTEM_HELP);
             }
             // Display navigation tabs
             $GLOBALS['xoopsTpl']->assign('xo_system_menu', $menu_handler->render($current, false));
         }
     }
 }
Ejemplo n.º 19
0
$op_select->addOption('access', _PROFILE_AM_PROF_ACCESS);
$opform->addElement($op_select);
$opform->display();
$module_id = $GLOBALS['xoopsModule']->getVar('mid');
include_once $GLOBALS['xoops']->path('/class/xoopsform/grouppermform.php');
$form = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/permissions.php?op=' . $op, $anonymous);
if ($op === 'access') {
    $member_handler = xoops_getHandler('member');
    $glist = $member_handler->getGroupList();
    foreach (array_keys($glist) as $i) {
        if ($i != XOOPS_GROUP_ANONYMOUS) {
            $form->addItem($i, $glist[$i]);
        }
    }
} else {
    $profile_handler = xoops_getModuleHandler('profile');
    $fields = $profile_handler->loadFields();
    if ($op !== 'search') {
        foreach (array_keys($fields) as $i) {
            if ($restriction == '' || $fields[$i]->getVar($restriction)) {
                $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
            }
        }
    } else {
        $searchable_types = array('textbox', 'select', 'radio', 'yesno', 'date', 'datetime', 'timezone', 'language');
        foreach (array_keys($fields) as $i) {
            if (in_array($fields[$i]->getVar('field_type'), $searchable_types)) {
                $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
            }
        }
    }
Ejemplo n.º 20
0
 *
 * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
 * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package             profile
 * @since               2.3.0
 * @author              Jan Pedersen
 * @author              Taiwen Jiang <*****@*****.**>
 */
include_once __DIR__ . '/admin_header.php';
//there is no way to override current tabs when using system menu
//this dirty hack will have to do it
$_SERVER['REQUEST_URI'] = 'admin/permissions.php';
xoops_cp_header();
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'visibility';
$visibility_handler = xoops_getModuleHandler('visibility');
$field_handler = xoops_getModuleHandler('field');
$fields = $field_handler->getList();
if (isset($_REQUEST['submit'])) {
    $visibility = $visibility_handler->create();
    $visibility->setVar('field_id', $_REQUEST['field_id']);
    $visibility->setVar('user_group', $_REQUEST['ug']);
    $visibility->setVar('profile_group', $_REQUEST['pg']);
    $visibility_handler->insert($visibility, true);
    redirect_header('visibility.php', 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_PROF_VISIBLE));
}
if ($op === 'del') {
    $criteria = new CriteriaCompo(new Criteria('field_id', (int) $_REQUEST['field_id']));
    $criteria->add(new Criteria('user_group', (int) $_REQUEST['ug']));
    $criteria->add(new Criteria('profile_group', (int) $_REQUEST['pg']));
    $visibility_handler->deleteAll($criteria, true);
    redirect_header('visibility.php', 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_PROF_VISIBLE));
Ejemplo n.º 21
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         Shoutbox
 * @author          Alphalogic <*****@*****.**>
 * @author          tank <*****@*****.**>
 * @author          trabis <*****@*****.**>
 * @version         $Id: shoutboxRemove.php 0 2010-01-29 18:47:04Z trabis $
 */
if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) {
    exit;
}
$id = intval($_REQUEST['id']);
$handler = xoops_getModuleHandler('database', 'shoutbox');
// Request or confirmation?
if (!empty($_POST['confirm']) && $_POST['confirm'] == 'yes') {
    // Sanitize inputs
    $obj = $handler->get($id);
    if (is_object($obj) && $handler->delete($obj)) {
        redirect_header("index.php", 2, _AM_SH_REMOVE_SUCCES);
    } else {
        redirect_header("index.php", 4, _AM_SH_REMOVE_FAILURE);
    }
} else {
    xoops_cp_header();
    // Check or we got a shout
    if (!($obj = $handler->get($id))) {
        /**
         * Or we got none, or something really strange happend here...
Ejemplo n.º 22
0
<?php

/**
* $Id: customtag.php 159 2007-12-17 16:44:05Z malanciault $
* Module: SmartRental
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
function smart_customtag_initiate()
{
    global $xoopsTpl, $smartobject_customtag_handler;
    if (is_object($xoopsTpl)) {
        foreach ($smartobject_customtag_handler->objects as $k => $v) {
            $xoopsTpl->assign($k, $v->render());
        }
    }
}
if (!defined('SMARTOBJECT_URL')) {
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
}
smart_loadLanguageFile('smartobject', 'customtag');
include_once XOOPS_ROOT_PATH . "/modules/smartobject/include/functions.php";
include_once SMARTOBJECT_ROOT_PATH . "class/customtag.php";
$smartobject_customtag_handler = xoops_getModuleHandler('customtag', 'smartobject');
$smartobject_customTagsObj = $smartobject_customtag_handler->getCustomtagsByName();
Ejemplo n.º 23
0
 function eventCoreClassSmartyXoops_pluginsXoinboxcount($args)
 {
     $args[0] =& xoops_getModuleHandler('message', 'pm');
 }
Ejemplo n.º 24
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright::  The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license::    http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package::    Xoops
 * @module::     Xoops FAQ
 * @subpackage:: Xoops FAQ Admin
 * @since::      2.3.0
 * @author::     John Neill
 * @version::    $Id: $
 */
include 'admin_header.php';
xoops_cp_header();
$category_handler =& xoops_getModuleHandler('category');
$op = xoopsFaq_CleanVars($_REQUEST, 'op', 'default', 'string');
switch ($op) {
    case 'edit':
        //    xoops_cp_header();
        //xoopsFaq_AdminMenu(1);
        $index_admin = new ModuleAdmin();
        echo $index_admin->addNavigation('category.php');
        //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CATEGORY_HEADER, _AM_XOOPSFAQ_CATEGORY_EDIT_DSC, false);
        xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_EDIT_DSC, false);
        $category_id = xoopsFaq_CleanVars($_REQUEST, 'category_id', 0, 'int');
        $obj = 0 == $category_id ? $category_handler->create() : $category_handler->get($category_id);
        if (is_object($obj)) {
            $obj->displayForm();
        } else {
            $category_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTEDITCAT);
Ejemplo n.º 25
0
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu)                                          //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
// Check users rights
if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
    exit(_NOPERM);
}
// Parameters
$nb_group = xoops_getModuleOption('groups_pager', 'system');
// Get Action type
$op = system_CleanVars($_REQUEST, 'op', 'list', 'string');
// Get groups handler
$groups_Handler =& xoops_getModuleHandler("group", "system");
$member_handler =& xoops_gethandler('member');
// Define main template
$xoopsOption['template_main'] = 'system_groups.html';
// Call Header
xoops_cp_header();
$xoBreadCrumb->addLink(_AM_SYSTEM_GROUPS_NAV_MANAGER, system_adminVersion('groups', 'adminpath'));
switch ($op) {
    case 'list':
    default:
        // Define Stylesheet
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
        $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
        $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.tablesorter.js');
        $xoTheme->addScript('modules/system/js/admin.js');
        // Define Breadcrumb and tips
Ejemplo n.º 26
0
<?php

/**
 * $Id: adsense.php 159 2007-12-17 16:44:05Z malanciault $
 * Module: SmartRental
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
function smart_adsense_initiate_smartytags()
{
    global $xoopsTpl, $smartobject_adsense_handler;
    if (is_object($xoopsTpl)) {
        foreach ($smartobject_adsense_handler->objects as $k => $v) {
            $xoopsTpl->assign('adsense_' . $k, $v->render());
        }
    }
}
if (!defined('SMARTOBJECT_URL')) {
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
}
include_once XOOPS_ROOT_PATH . "/modules/smartobject/include/functions.php";
include_once SMARTOBJECT_ROOT_PATH . "class/adsense.php";
$smartobject_adsense_handler = xoops_getModuleHandler('adsense', 'smartobject');
$smartobject_adsensesObj = $smartobject_adsense_handler->getAdsensesByTag();
Ejemplo n.º 27
0
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
// Check users rights
if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
    exit(_NOPERM);
}
//  Check is active
if (!xoops_getModuleOption('active_banners', 'system')) {
    redirect_header('admin.php', 2, _AM_SYSTEM_NOTACTIVE);
}
// Parameters
$nb_aff = xoops_getModuleOption('banners_pager', 'system');
// Classes
$banner_Handler = xoops_getModuleHandler('banner', 'system');
$banner_finish_Handler = xoops_getModuleHandler('bannerfinish', 'system');
$banner_client_Handler = xoops_getModuleHandler('bannerclient', 'system');
// Get Action type
$op = system_CleanVars($_REQUEST, 'op', 'default', 'string');
// Define template
$GLOBALS['xoopsOption']['template_main'] = 'system_banners.tpl';
// Call header
xoops_cp_header();
// Define Stylesheet
$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
// Define scripts
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.tablesorter.js');
$xoTheme->addScript('modules/system/js/admin.js');
// Define Breadcrumb and tips
Ejemplo n.º 28
0
             if ($block->getVar('template') != '') {
                 $tplfile_handler = xoops_getHandler('tplfile');
                 $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block_id);
                 if (count($btemplate) > 0) {
                     $tplfile_handler->delete($btemplate[0]);
                 }
             }
             redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_BLOCKS_DBUPDATED);
         }
     } else {
         redirect_header('admin.php?fct=blocksadmin', 1, _AM_SYSTEM_DBERROR);
     }
     break;
 case 'clone':
     // Initialize blocks handler
     $block_handler = xoops_getModuleHandler('block');
     // Get avatar id
     $block_id = system_CleanVars($_REQUEST, 'bid', 0, 'int');
     if ($block_id > 0) {
         // Define main template
         $GLOBALS['xoopsOption']['template_main'] = 'system_blocks.tpl';
         // Call Header
         xoops_cp_header();
         // Define Stylesheet
         $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
         // Define Breadcrumb and tips
         $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_ADMIN, system_adminVersion('blocksadmin', 'adminpath'));
         $xoBreadCrumb->addLink(_AM_SYSTEM_BLOCKS_CLONEBLOCK);
         $xoBreadCrumb->render();
         $block = $block_handler->get($block_id);
         $blockform = $block->getForm('clone');
Ejemplo n.º 29
0
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @package         pm
 * @since           2.3.0
 * @author          Jan Pedersen
 * @author          Taiwen Jiang <*****@*****.**>
 * @version         $Id: readpmsg.php 12467 2014-04-23 22:44:13Z beckmi $
 */
include_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'mainfile.php';
if (!is_object($GLOBALS['xoopsUser'])) {
    redirect_header(XOOPS_URL, 3, _NOPERM);
    exit;
}
$valid_op_requests = array('out', 'save', 'in');
$_REQUEST['op'] = !empty($_REQUEST['op']) && in_array($_REQUEST['op'], $valid_op_requests) ? $_REQUEST['op'] : 'in';
$msg_id = empty($_REQUEST['msg_id']) ? 0 : intval($_REQUEST['msg_id']);
$pm_handler =& xoops_getModuleHandler('message');
if ($msg_id > 0) {
    $pm =& $pm_handler->get($msg_id);
} else {
    $pm = null;
}
if (is_object($pm) && $pm->getVar('from_userid') != $GLOBALS['xoopsUser']->getVar('uid') && $pm->getVar('to_userid') != $GLOBALS['xoopsUser']->getVar('uid')) {
    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar("dirname", "n") . '/index.php', 2, _NOPERM);
    exit;
}
if (is_object($pm) && !empty($_POST['action'])) {
    if (!$GLOBALS['xoopsSecurity']->check()) {
        echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
        exit;
    }
    $res = false;
Ejemplo n.º 30
0
$thumbwidth = $xoopsModuleConfig['thumb_width'];
$thumbheight = $xoopsModuleConfig['thumb_height'];
$maxfilebytes = $xoopsModuleConfig['max_file_size'];
$maxfileheight = $xoopsModuleConfig['max_original_height'];
$maxfilewidth = $xoopsModuleConfig['max_original_width'];
/**
 * If we are receiving a file
 */
if ($_POST['xoops_upload_file'][0] == 'sel_photo') {
    /**
     * Verify Token
     */
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_MYPICS_TOKENEXPIRED);
    }
    ini_set('memory_limit', '50M');
    /**
     * Try to upload picture resize it insert in database and then redirect to index
     */
    $handler =& xoops_getModuleHandler('image');
    if ($handler->receivePicture($title, $path_upload, $thumbwidth, $thumbheight, $pictwidth, $pictheight, $maxfilebytes, $maxfilewidth, $maxfileheight)) {
        $extra_tags['X_OWNER_NAME'] = $xoopsUser->getVar('uname');
        $extra_tags['X_OWNER_UID'] = $xoopsUser->getVar('uid');
        $notification_handler =& xoops_gethandler('notification');
        $notification_handler->triggerEvent('picture', $xoopsUser->getVar('uid'), 'new_picture', $extra_tags);
        redirect_header(XOOPS_URL . '/modules/mypics/index.php?uid=' . $xoopsUser->getVar('uid'), 3, _MD_MYPICS_UPLOADED);
    } else {
        redirect_header(XOOPS_URL . '/modules/mypics/index.php?uid=' . $xoopsUser->getVar('uid'), 3, _MD_MYPICS_NOCACHACA);
    }
}
include_once XOOPS_ROOT_PATH . '/footer.php';