Ejemplo n.º 1
0
 /**
  * @param array $param array of parameters with these keys:
  *                      'obj'     => ImagesCategory|XoopsObject $obj
  *                      'target'  => textarea id
  */
 public function __construct($param)
 {
     $xoops = Xoops::getInstance();
     $groups = $xoops->getUserGroups();
     extract($param);
     $helper = Xoops\Module\Helper::getHelper('images');
     $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read');
     parent::__construct('', '', $xoops->getEnv('PHP_SELF'), 'post', false, 'inline');
     $select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id);
     $select->addOption(0, _AM_IMAGES_CAT_SELECT);
     $select->addOptionArray($categories);
     if (isset($target)) {
         $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?target=" . $target . "&imgcat_id=\" + this.value'");
     } else {
         $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?imgcat_id=\" + this.value'");
     }
     $this->addElement($select);
     if (isset($target)) {
         $this->addElement(new Xoops\Form\Hidden('target', $target));
     }
     $write = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
     if ($imgcat_id > 0 && array_key_exists($imgcat_id, $write)) {
         $this->addElement(new Xoops\Form\Hidden('op', 'upload'));
         $button = new Xoops\Form\Button('', 'submit', _IMAGES_ADD, 'submit');
         $button->setClass('btn btn-success floatright');
         $this->addElement($button);
     }
 }
Ejemplo n.º 2
0
 /**
  * Get a Gravatar URL for a specified email address.
  *
  * @param string $email The email address
  *
  * @return String containing either just a URL or a complete image tag
  *
  * @source http://gravatar.com/site/implement/images/php/
  */
 private static function getGravatar($email)
 {
     $s = 80;
     // Size in pixels, defaults to 80px [ 1 - 2048 ]
     $d = 'mm';
     // Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
     $r = 'g';
     // Maximum rating (inclusive) [ g | pg | r | x ]
     if ($helper = Xoops\Module\Helper::getHelper('gravatars')) {
         $v = $helper->getConfig('pixel_size');
         $s = empty($v) ? $s : $v;
         $v = $helper->getConfig('default_imageset');
         $d = empty($v) ? $d : $v;
         $d = $d == 'default' ? '' : $d;
         // preferences does not like empty string
         $v = $helper->getConfig('max_rating');
         $r = empty($v) ? $r : $v;
     }
     $scheme = \Xoops\Core\HttpRequest::getInstance()->getScheme();
     if ($scheme == 'https') {
         $url = 'https://secure.gravatar.com/avatar/';
     } else {
         $url = 'http://www.gravatar.com/avatar/';
     }
     $url .= md5(strtolower(trim($email)));
     $url .= "?s={$s}&d={$d}&r={$r}";
     return $url;
 }
Ejemplo n.º 3
0
 /**
  * @param ImagesImage|XoopsObject $obj
  */
 public function __construct(ImagesImage $obj)
 {
     $xoops = Xoops::getInstance();
     $helper = Xoops\Module\Helper::getHelper('images');
     $groups = $xoops->getUserGroups();
     if ($obj->isNew()) {
         $title = _AM_IMAGES_IMG_ADD;
     } else {
         $title = _AM_IMAGES_IMG_EDIT;
     }
     parent::__construct('', 'image', $xoops->getEnv('PHP_SELF'), 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system'));
     $tab1 = new Xoops\Form\Tab($title, 'tabid-1');
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true);
     if ($obj->isNew()) {
         $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
         $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id'));
         $select->addOption('', _AM_IMAGES_CAT_SELECT);
         $select->addOptionArray($categories);
         $tab1->addElement($select, true);
     } else {
         $tab1->addElement(new Xoops\Form\Label(_AM_IMAGES_CAT_SELECT, '<span class="red bold">' . $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'))->getVar('imgcat_name') . '</span>'));
         $this->addElement(new Xoops\Form\Hidden('imgcat_id', $obj->getVar('imgcat_id')));
     }
     // warning
     $category = $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'));
     $upload_msg[] = _AM_IMAGES_CAT_SIZE . ' : ' . $category->getVar('imgcat_maxsize');
     $upload_msg[] = _AM_IMAGES_CAT_WIDTH . ' : ' . $category->getVar('imgcat_maxwidth');
     $upload_msg[] = _AM_IMAGES_CAT_HEIGHT . ' : ' . $category->getVar('imgcat_maxheight');
     $image_tray = new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file');
     $image_tray->setDescription(self::message($upload_msg, ''));
     $tab1->addElement($image_tray);
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_WEIGHT, 'image_weight', 1, 4, $obj->getVar('image_weight')));
     $tab1->addElement(new Xoops\Form\RadioYesNo(_AM_IMAGES_DISPLAY, 'image_display', $obj->getVar('image_display')));
     $tabtray->addElement($tab1);
     $this->addElement($tabtray);
     $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name')));
     $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id')));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $button_2->setClass('btn btn-warning');
     $button_tray->addElement($button_2);
     $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $button_3->setExtra("onclick='javascript:history.go(-1);'");
     $button_3->setClass('btn btn-danger');
     $button_tray->addElement($button_3);
     $this->addElement($button_tray);
 }
Ejemplo n.º 4
0
 /**
  * @param Array
  *
  *        'obj'     => ImagesImage|XoopsObject $obj
  *        'target'  => textarea id
  */
 public function __construct($param)
 {
     $xoops = Xoops::getInstance();
     $helper = Xoops\Module\Helper::getHelper('images');
     //todo, remove extract
     extract($param);
     $groups = $xoops->getUserGroups();
     if ($obj->isNew()) {
         $title = _AM_IMAGES_IMG_ADD;
     } else {
         $title = _AM_IMAGES_IMG_EDIT;
     }
     parent::__construct($title, 'image', $xoops->getEnv('PHP_SELF'), 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $this->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true);
     $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
     $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id'));
     $select->addOption('', _AM_IMAGES_CAT_SELECT);
     $select->addOptionArray($categories);
     $this->addElement($select, true);
     $this->addElement(new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file'));
     $this->addElement(new Xoops\Form\Hidden('image_weight', $obj->getVar('image_weight')));
     $this->addElement(new Xoops\Form\Hidden('image_display', $obj->getVar('image_display')));
     $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name')));
     $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id')));
     $this->addElement(new Xoops\Form\Hidden('target', $target));
     /**
      * Buttons
      */
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $buttonSubmit->setClass('btn btn-success');
     $buttonTray->addElement($buttonSubmit);
     $buttonReset = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $buttonReset->setClass('btn btn-warning');
     $buttonTray->addElement($buttonReset);
     switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
         case 'xoops_images':
             $buttonClose = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
             $buttonClose->setExtra('onclick="tinyMCEPopup.close();"');
             $buttonClose->setClass('btn btn-danger');
             $buttonTray->addElement($buttonClose);
             break;
         case 'images':
         default:
             $buttonCancel = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
             $buttonCancel->setExtra("onclick='javascript:history.go(-1);'");
             $buttonCancel->setClass('btn btn-danger');
             $buttonTray->addElement($buttonCancel);
             break;
     }
     $this->addElement($buttonTray);
 }
Ejemplo n.º 5
0
 /**
  * @param category id $imgcat_id
  */
 public function __construct($imgcat_id)
 {
     $xoops = Xoops::getInstance();
     $groups = $xoops->getUserGroups();
     $helper = Xoops\Module\Helper::getHelper('images');
     $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read');
     parent::__construct('', 'category_select', $xoops->getEnv('PHP_SELF'), 'post');
     $select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id);
     $select->addOption(0, _AM_IMAGES_CAT_SELECT);
     $select->addOptionArray($categories);
     $select->setExtra("onchange='javascript:window.location.href=\"images.php?imgcat_id=\" + this.value'");
     $this->addElement($select);
 }
Ejemplo n.º 6
0
<?php

/*
 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.
*/
/**
 * Mailusers Plugin
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
$xoops = Xoops::getInstance();
$helper = Xoops\Module\Helper::getHelper('mailusers');
Ejemplo n.º 7
0
<?php

/**
 *  xoops_xlanguage plugin for tinymce
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         class / xoopseditor
 * @subpackage      tinymce / xoops plugins
 * @since           2.6.0
 * @author          Laurent JEN (aka DuGris)
 * @version         $Id$
 */
use Xoops\Core\Request;
$helper = Xoops\Module\Helper::getHelper('xlanguage');
if (!$helper) {
    ob_end_flush();
    return;
}
require_once dirname(__FILE__) . '/../../../../../../mainfile.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$xoops->simpleHeader(false);
$helper->loadLanguage('admin');
$helper->loadLanguage('tinymce');
$op = Request::getCmd('op', '');
if ($op == 'save') {
    if (!$xoops->security()->check()) {
        $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors()));
    }
    XoopsLoad::load('system', 'system');
Ejemplo n.º 8
0
    $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
    $upload_size = 500000;
    $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/smilies', $mimetypes, $upload_size, null, null);
    if ($uploader->fetchMedia($xoops_upload_file[0])) {
        $uploader->setPrefix('smil');
        if (!$uploader->upload()) {
            $msg[] = $uploader->getErrors();
            $obj->setVar('smiley_url', 'blank.gif');
        } else {
            $obj->setVar('smiley_url', 'smilies/' . $uploader->getSavedFileName());
        }
    }
    if ($helper->getHandlerSmilies()->insert($obj)) {
        $xoops->redirect('xoops_smilies.php', 2, implode('<br />', $msg));
    }
}
$xoopsTpl = new XoopsTpl();
if ($op === 'more') {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getSmilies(0, 0, false));
} else {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getActiveSmilies(false));
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
$admin = $gperm_handler->checkRight('system_admin', $xoops->getHandlerModule()->getByDirname('smilies')->getVar('mid'), $groups);
if ($admin) {
    $xoopsTpl->assign('form_add', $helper->getForm($helper->getHandlerSmilies()->create(), 'smilies')->render());
}
$xoopsTpl->display('module:smilies/smilies_tinymce.tpl');
$xoops->simpleFooter();
Ejemplo n.º 9
0
<?php

/*
 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.
*/
/**
 * smilies module
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         smilies
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
XoopsLoad::load('system', 'system');
$xoops = Xoops::getInstance();
$system = System::getInstance();
$helper = Xoops\Module\Helper::getHelper('smilies');
Ejemplo n.º 10
0
use Xoops\Core\FixedGroups;
use Xoops\Core\Request;
/**
 * images module
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
XoopsLoad::load('system', 'system');
$xoops = Xoops::getInstance();
$system = System::getInstance();
$helper = Xoops\Module\Helper::getHelper('images');
// Get Action type
$op = Request::getCmd('op', 'list');
$start = Request::getInt('start', 0);
$imgcat_id = Request::getInt('imgcat_id', 0);
$redirect = basename($xoops->getEnv('SCRIPT_NAME'));
if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) {
    exit(XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$gperm_handler = $xoops->getHandlerGroupPermission();
$groups = $xoops->getUserGroups();
// check WRITE right by category before continue
if (isset($imgcat_id) && ($op === 'addfile' || $op === 'editcat' || $op === 'updatecat' || $op === 'delcatok' || $op === 'delcat')) {
    $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
    if (!$imgcat_write) {
        $xoops->redirect($redirect, 1);
Ejemplo n.º 11
0
 */
if ($xoops->isActiveModule('search')) {
    $config = $xoops->getModuleConfig('keyword_min', 'search');
    $xoops->loadLanguage('main', 'search');
    $url = $xoops->url('modules/search/index.php');
    $obj = $xoops->getModuleByDirname('search');
    //etc
}
/**
 * Using the Helper
 */
if ($helper = Xoops\Module\Helper::getHelper('search')) {
    $config = $helper->getConfig('keyword_min');
    $helper->loadLanguage('main');
    $url = $helper->url('index.php');
    $obj = $helper->getModule();
    //etc
}
//Some examples
if ($helper = Xoops\Module\Helper::getHelper('codex')) {
    Xoops_Utils::dumpVar($helper->getModule()->getVar('name'));
    Xoops_Utils::dumpVar($helper->url('index.php'));
}
if ($helper = Xoops\Module\Helper::getHelper('search')) {
    Xoops_Utils::dumpVar($helper->getConfigs());
}
if ($helper = Xoops\Module\Helper::getHelper('nosuchmodule')) {
    Xoops_Utils::dumpVar($helper->getModule()->getVar('name'));
}
Xoops_Utils::dumpFile(__FILE__);
$xoops->footer();
Ejemplo n.º 12
0
<?php

/*
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       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Menus
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @version         $Id$
 */
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
$xoops = Xoops::getInstance();
$helper = Xoops\Module\Helper::getHelper('menus');