Пример #1
0
function mediashare_external_pasteitem($args)
{
    // FIXME access check
    $albumId = mediashareGetIntUrl('aid', $args, 0);
    $mediaId = mediashareGetIntUrl('mid', $args, 0);
    $mode = FormUtil::getPassedValue('mode');
    if (isset($_POST['backButton'])) {
        return pnRedirect(pnModUrl('mediashare', 'external', 'finditem', array('aid' => $albumId, 'mid' => $mediaId, 'mode' => $mode)));
    }
    $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId));
    /*
        if (!($handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $mediaItem['mediaHandler'])))) {
            return false;
        }
    */
    $render =& pnRender::getInstance('mediashare', false);
    mediashareExternalLoadTheme($render);
    $render->assign('albumId', $albumId);
    $render->assign('mediaId', $mediaId);
    $render->assign('mediaItem', $mediaItem);
    if ($mediaItem['mediaHandler'] != 'extapp') {
        $mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
        $render->assign('thumbnailUrl', $mediadir . $mediaItem['thumbnailRef']);
        $render->assign('previewUrl', $mediadir . $mediaItem['previewRef']);
        $render->assign('originalUrl', $mediadir . $mediaItem['originalRef']);
    } else {
        $render->assign('thumbnailUrl', "{$mediaItem['thumbnailRef']}");
        $render->assign('previewUrl', "{$mediaItem['previewRef']}");
        $render->assign('originalUrl', "{$mediaItem['originalRef']}");
    }
    $render->assign('mode', $mode);
    echo $render->fetch('mediashare_external_pasteitem.html');
    return true;
}
Пример #2
0
 /**
  * Event listener for 'core.postinit' event.
  * 
  * @param Zikula_Event $event
  *
  * @return void
  */
 public static function coreinit(Zikula_Event $event)
 {
     // get the module name
     $args = array();
     $args['modulename'] = ModUtil::getName();
     $module = $args['modulename'];
     // exit if Content module active - to avoid double loadings if user has given ids and functions
     if ($args['modulename'] == 'content') {
         return;
     }
     // Security check if user has COMMENT permission for scribite
     if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
         return;
     }
     // get passed func
     $func = FormUtil::getPassedValue('func', isset($args['func']) ? $args['func'] : null, 'GET');
     // get config for current module
     $modconfig = array();
     $modconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => $args['modulename']));
     // return if module is not supported or editor is not set
     if (!$modconfig['mid'] || $modconfig['modeditor'] == '-') {
         return;
     }
     // check if current func is fine for editors or funcs is empty (or all funcs)
     if (is_array($modconfig['modfuncs']) && (in_array($func, $modconfig['modfuncs']) || $modconfig['modfuncs'][0] == 'all')) {
         $args['areas'] = $modconfig['modareas'];
         $args['editor'] = $modconfig['modeditor'];
         $scribite = ModUtil::apiFunc('Scribite', 'user', 'loader', array('modulename' => $args['modulename'], 'editor' => $args['editor'], 'areas' => $args['areas']));
         // add the scripts to page header
         if ($scribite) {
             PageUtil::AddVar('header', $scribite);
         }
     }
 }
Пример #3
0
    /**
     * Update the configuration values
     * @author: Sara Arjona Téllez (sarjona@xtec.cat)
     * @params	The config values from the form
     * @return	Thue if success
     */
    public function confupdate($args) {
        $skins = FormUtil::getPassedValue('skins', isset($args['skins']) ? $args['skins'] : null, 'POST');
        $langs = FormUtil::getPassedValue('langs', isset($args['langs']) ? $args['langs'] : null, 'POST');
        $maxdelivers = FormUtil::getPassedValue('maxdelivers', isset($args['maxdelivers']) ? $args['maxdelivers'] : null, 'POST');
        $basedisturl = FormUtil::getPassedValue('basedisturl', isset($args['basedisturl']) ? $args['basedisturl'] : null, 'POST');

        // Security check
        if (!SecurityUtil::checkPermission('IWqv::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }

        // Confirm authorisation code
        $this->checkCsrfToken();

        if (isset($skins))
            ModUtil::setVar('IWqv', 'skins', $skins);
        if (isset($langs))
            ModUtil::setVar('IWqv', 'langs', $langs);
        if (isset($maxdelivers))
            ModUtil::setVar('IWqv', 'maxdelivers', $maxdelivers);
        if (isset($basedisturl))
            ModUtil::setVar('IWqv', 'basedisturl', $basedisturl);

        LogUtil::registerStatus($this->__f('Done! %1$s updated.', $this->__('settings')));
        return System::redirect(ModUtil::url('IWqv', 'admin', 'main'));
    }
Пример #4
0
 public function initialize(Zikula_Form_View $view)
 {
     $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
     $offset = (int) FormUtil::getPassedValue('offset');
     if ((bool) $this->getVar('inheritPermissions', false) === true) {
         if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     } else {
         if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
             throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
         }
     }
     $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false));
     if ($page === false) {
         return $this->view->registerError(null);
     }
     $versionscnt = ModUtil::apiFunc('Content', 'History', 'getPageVersionsCount', array('pageId' => $this->pageId));
     $versions = ModUtil::apiFunc('Content', 'History', 'getPageVersions', array('pageId' => $this->pageId, 'offset' => $offset));
     if ($versions === false) {
         return $this->view->registerError(null);
     }
     $this->view->assign('page', $page);
     $this->view->assign('versions', $versions);
     Content_Util::contentAddAccess($this->view, $this->pageId);
     // Assign the values for the smarty plugin to produce a pager
     $this->view->assign('numitems', $versionscnt);
     PageUtil::setVar('title', $this->__("Page history") . ' : ' . $page['title']);
     if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
         $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     }
     return true;
 }
Пример #5
0
function FlashChatBridge_user_showChat()
{
    // perform permission check
    if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_READ)) {
        return LogUtil::registerPermissionError();
    }
    $popup = FormUtil::getPassedValue('popup', false);
    // Security check
    $render =& pnRender::getInstance('FlashChatBridge', false);
    $UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
    $client_type = FormUtil::getPassedValue('client_type', 'standard');
    $settings = pnModGetVar('FlashChatBridge');
    $settings['init_user'] = $UserVars['uname'];
    $settings['init_password'] = $UserVars['pass'];
    if ($settings['autosize'] == 1) {
        $settings['width'] = "100%";
        $settings['height'] = "100%";
    }
    if ($popup) {
        $settings['width'] = "100%";
        $settings['height'] = "100%";
        $render->assign('settings', $settings);
        $chat = $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
        $render->assign('chat', $chat);
        echo $render->fetch('flashchatbridge_user_popup.htm');
        exit;
    } else {
        $render->assign('settings', $settings);
        return $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
    }
}
Пример #6
0
    public function updateConfig($args)
    {
        // Security check
        if (!SecurityUtil::checkPermission('SiriusXtecAuth::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }
        $items = array( 'ldap_active' => FormUtil::getPassedValue('ldap_active', false, 'POST')?true:false,
                'users_creation' => FormUtil::getPassedValue('users_creation', false, 'POST')?true:false,
                'new_users_activation' => FormUtil::getPassedValue('new_users_activation', false, 'POST')?true:false,
                'iw_write' => FormUtil::getPassedValue('iw_write', false, 'POST')?true:false,
                'iw_lastnames' => FormUtil::getPassedValue('iw_lastnames', false, 'POST')?true:false,
                'new_users_groups' => FormUtil::getPassedValue('new_users_groups', array(), 'POST'),
                'ldap_server' => FormUtil::getPassedValue('ldap_server', false, 'POST'),
                'ldap_basedn' => FormUtil::getPassedValue('ldap_basedn', false, 'POST'),
                'ldap_searchattr' => FormUtil::getPassedValue('ldap_searchattr', false, 'POST'),
                'loginXtecApps' => FormUtil::getPassedValue('loginXtecApps', false, 'POST'),
                'logoutXtecApps' => FormUtil::getPassedValue('logoutXtecApps', false, 'POST'),
                'gtafProtocol' => FormUtil::getPassedValue('gtafProtocol', false, 'POST'),
                'e13Protocol' => FormUtil::getPassedValue('e13Protocol', false, 'POST'),
                'gtafURL' => FormUtil::getPassedValue('gtafURL', false, 'POST'),
                'e13URL' => FormUtil::getPassedValue('e13URL', false, 'POST'),
				'loginTime' => FormUtil::getPassedValue('loginTime', false, 'POST'),
				'logoutTime' => FormUtil::getPassedValue('logoutTime', false, 'POST'));
        ModUtil::setVars($this->name,$items);
        LogUtil::registerStatus($this->__('S\'ha actualitzat la configuració del mòdul.'));
        return System::redirect(ModUtil::url('SiriusXtecAuth', 'admin', 'main'));
    }
Пример #7
0
 public function modifyconfig()
 {
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission());
     // Create form
     $form = FormUtil::newForm('Scribite', $this);
     return $form->execute('admin/modifyconfig.tpl', new Scribite_FormHandler_ModifyConfig());
 }
Пример #8
0
 function initialize(Zikula_Form_View $view)
 {
     $this->id = (int) FormUtil::getPassedValue('id', -1, 'GETPOST');
     $objectid = FormUtil::getPassedValue('objectid', '', 'GETPOST');
     $redirect = base64_decode(FormUtil::getPassedValue('redirect', '', 'GETPOST'));
     $view->caching = false;
     $comment = ModUtil::apiFunc('EZComments', 'user', 'get', array('id' => $this->id));
     if ($comment == false || !is_array($comment)) {
         return LogUtil::registerError($this->__('No such comment found.'), ModUtil::url('EZComments', 'user', 'main'));
     }
     // check if user is allowed to modify this content
     $modifyowntime = (int) ModUtil::getVar('EZComments', 'modifyowntime');
     $ts = strtotime($comment['date']);
     if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
         // user has no admin permissions. Only commenting user should be able to modify
         if ($comment['uid'] != UserUtil::getVar('uid')) {
             // foreign content and no admin permissions
             $view->assign('nomodify', 1);
             $this->nomodify = 1;
         } else {
             if ($modifyowntime > 0 && $ts + $modifyowntime * 60 * 60 < time()) {
                 $view->assign('nomodify', 1);
                 $this->nomodify = 1;
             }
         }
     } else {
         $view->assign('nomodify', 0);
         $this->nomodify = 0;
     }
     $view->assign('redirect', isset($redirect) && !empty($redirect) ? true : false);
     // finally asign the comment information
     $view->assign($comment);
     return true;
 }
Пример #9
0
 public function decode(Zikula_Form_View $view)
 {
     $this->value = FormUtil::getPassedValue($this->inputName, null, 'POST');
     if (get_magic_quotes_gpc()) {
         $this->value = stripslashes($this->value);
     }
 }
Пример #10
0
 function update($blockinfo)
 {
     $vars = BlockUtil::varsFromContent($blockinfo['content']);
     $vars['page'] = FormUtil::getPassedValue('page', 0, 'POST');
     $blockinfo['content'] = BlockUtil::varsToContent($vars);
     return $blockinfo;
 }
Пример #11
0
    /**
     * Function to delete an ids log entry
     */
    public function deleteidsentry()
    {
        // verify auth-key
        $this->checkCsrfToken();

        // Security check
        if (!SecurityUtil::checkPermission('SecurityCenter::', '::', ACCESS_DELETE)) {
            return LogUtil::registerPermissionError();
        }

        // get paramters
        $id = (int)FormUtil::getPassedValue('id', 0, 'GETPOST');

        // sanity check
        if (!is_numeric($id)) {
            return LogUtil::registerError($this->__f("Error! Received a non-numeric object ID '%s'.", $id));
        }

        $class = 'SecurityCenter_DBObject_Intrusion';
        $object = new $class();
        $data = $object->get($id);

        // check for valid object
        if (!$data) {
            return LogUtil::registerError($this->__f('Error! Invalid %s received.', "object ID [$id]"));
        } else {
            // delete object
            $object->delete();
        }

        // redirect back to view function
        $this->redirect(ModUtil::url('SecurityCenter', 'admin', 'viewidslog'));
    }
Пример #12
0
    public function initialize(Zikula_Form_View $view)
    {
        $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);

        if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }
        if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

        $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false), 'includeContent' => false));
        if ($page === false) {
            throw new Zikula_Exception_Fatal($this->__('Page not found'));
        }

        // Only allow subpages if edit access on parent page
        if (!SecurityUtil::checkPermission('Content:page:', $page['id'] . '::', ACCESS_EDIT)) {
            throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
        }

        PageUtil::setVar('title', $this->__('Clone page') . ' : ' . $page['title']);

        $this->view->assign('page', $page);
        Content_Util::contentAddAccess($this->view, $this->pageId);

        return true;
    }
Пример #13
0
 /**
  * Setup form.
  *
  * @param Zikula_Form_View $view Current Zikula_Form_View instance.
  *
  * @return boolean
  */
 public function initialize(Zikula_Form_View $view)
 {
     // load and assign registred categories
     $categories = CategoryRegistryUtil::getRegisteredModuleCategories('ExampleDoctrine', 'User', 'id');
     $view->assign('registries', $categories);
     $id = FormUtil::getPassedValue('id', null, "GET", FILTER_SANITIZE_NUMBER_INT);
     if ($id) {
         // load user with id
         $user = $this->entityManager->find('ExampleDoctrine_Entity_User', $id);
         if ($user) {
             // switch to edit mode
             $this->_id = $id;
         } else {
             return LogUtil::registerError($this->__f('User with id %s not found', $id));
         }
     } else {
         $user = new ExampleDoctrine_Entity_User();
     }
     $userData = $user->toArray();
     // overwrite attributes array entry with a form compitable format
     $field1 = $user->getAttributes()->get('field1') ? $user->getAttributes()->get('field1')->getValue() : '';
     $field2 = $user->getAttributes()->get('field2') ? $user->getAttributes()->get('field2')->getValue() : '';
     $userData['attributes'] = array('field1' => $field1, 'field2' => $field2);
     // assign current values to form fields
     $view->assign('user', $user)->assign('meta', $user->getMetadata() != null ? $user->getMetadata()->toArray() : array())->assign($userData);
     $this->_user = $user;
     return true;
 }
Пример #14
0
 function delete()
 {
     // security check
     if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
     $url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
     $class = 'AddressBook_DBObject_' . ucfirst($ot);
     if (!class_exists($class)) {
         return z_exit(__f('Error! Unable to load class [%s]', $ot));
     }
     $object = new $class();
     $data = $object->get($id);
     if (!$data) {
         LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
         return System::redirect($url);
     }
     $object->delete();
     if ($ot == "customfield") {
         $sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
         try {
             DBUtil::executeSQL($sql, -1, -1, true, true);
         } catch (Exception $e) {
         }
     }
     LogUtil::registerStatus($this->__('Done! Item deleted.'));
     return System::redirect($url);
 }
Пример #15
0
    /**
     * Update the module configuration
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @param:	Configuration values
     * @return:	The form with needed to change the parameters
     */
    public function updateConf($args) {
        $jclicJarBase = FormUtil::getPassedValue('jclicJarBase', isset($args['jclicJarBase']) ? $args['jclicJarBase'] : null, 'POST');
        $timeLap = FormUtil::getPassedValue('timeLap', isset($args['timeLap']) ? $args['timeLap'] : null, 'POST');
        $groups = FormUtil::getPassedValue('groups', isset($args['groups']) ? $args['groups'] : null, 'POST');
        $jclicUpdatedFiles = FormUtil::getPassedValue('jclicUpdatedFiles', isset($args['jclicUpdatedFiles']) ? $args['jclicUpdatedFiles'] : null, 'POST');

        // Security check
        if (!SecurityUtil::checkPermission('IWjclic::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }

        // Confirm authorisation code
        $this->checkCsrfToken();

        $groupsString = '$';
        foreach ($groups as $group)
            $groupsString .= '$' . $group . '$';

        $this->setVar('jclicUpdatedFiles', $jclicUpdatedFiles)
                ->setVar('jclicJarBase', $jclicJarBase)
                ->setVar('timeLap', $timeLap)
                ->setVar('groupsProAssign', $groupsString);

        LogUtil::registerStatus($this->__('The module configuration has changed'));

        return System::redirect(ModUtil::url('IWjclic', 'admin', 'main'));
    }
Пример #16
0
 /**
  * Configuration screen.
  *
  * @return string Plugin configuration output.
  */
 public function configure()
 {
     // Create form
     $form = FormUtil::newForm($this->pluginName, $this);
     $form->setCompileId($this->pluginName);
     return $form->execute('configure.tpl', new Scribite_FormHandler_ModifyEditor());
 }
Пример #17
0
 function get_geodata()
 {
     if (!SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_EDIT)) {
         AjaxUtil::error($this->__('Error! No authorization to access this module.'));
     }
     $val_1 = FormUtil::getPassedValue('val_1', NULL, 'GETPOST');
     $val_2 = FormUtil::getPassedValue('val_2', NULL, 'GETPOST');
     $val_3 = FormUtil::getPassedValue('val_3', NULL, 'GETPOST');
     $val_4 = FormUtil::getPassedValue('val_4', NULL, 'GETPOST');
     //GMaps test
     include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
     $key = ModUtil::getVar('AddressBook', 'google_api_key');
     $map = new GoogleMapAPI();
     $map->setApiKey($key);
     $geocode = $map->getGeocode($val_1 . ', ' . $val_2 . ', ' . $val_3 . ', ' . $val_4);
     if (isset($geocode['lat']) && isset($geocode['lon'])) {
         $result = $geocode['lat'] . ',' . $geocode['lon'];
     } else {
         $result = '';
     }
     if (FormUtil::getPassedValue('plane', NULL, 'GETPOST')) {
         return $result;
     }
     return new Zikula_Response_Ajax(array('lat_lon' => $result, 'result' => $result ? true : false));
 }
Пример #18
0
 /**
  * display items for a day
  *
  * @param $args array Arguments array.
  *
  * @return string html string
  */
 public function display($args)
 {
     $eid = FormUtil::getPassedValue('eid', isset($args['eid']) ? $args['eid'] : null, 'REQUEST');
     $objectid = FormUtil::getPassedValue('objectid', isset($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
     if (!empty($objectid)) {
         $eid = $objectid;
     }
     if (!isset($args['eid']) and !empty($eid)) {
         $args['eid'] = $eid;
     }
     // Chek permissions
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission());
     // check if the contents are cached.
     $template = 'ephemerides_user_display.tpl';
     if ($this->view->is_cached($template)) {
         return $this->view->fetch($template);
     }
     // get items
     if (isset($args['eid']) and $args['eid'] > 0) {
         $items = ModUtil::apiFunc($this->name, 'user', 'getall', $args);
     } else {
         $items = ModUtil::apiFunc($this->name, 'user', 'gettoday', $args);
     }
     $this->view->assign('items', $items);
     return $this->view->fetch($template);
 }
Пример #19
0
    /**
     * display theme changing user interface
     */
    public function main()
    {
        // check if theme switching is allowed
        if (!System::getVar('theme_change')) {
            LogUtil::registerError($this->__('Notice: Theme switching is currently disabled.'));
            $this->redirect(ModUtil::url('Users', 'user', 'main'));
        }

        if (!SecurityUtil::checkPermission('Theme::', '::', ACCESS_COMMENT)) {
            return LogUtil::registerPermissionError();
        }

        // get our input
        $startnum = FormUtil::getPassedValue('startnum', isset($args['startnum']) ? $args['startnum'] : 1, 'GET');

        // we need this value multiple times, so we keep it
        $itemsperpage = $this->getVar('itemsperpage');

        // get some use information about our environment
        $currenttheme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));

        // get all themes in our environment
        $allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER);

        $previewthemes = array();
        $currentthemepic = null;
        foreach ($allthemes as $key => $themeinfo) {
            $themename = $themeinfo['name'];
            if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_medium.png')) {
                $themeinfo['previewImage'] = $themepic;
                $themeinfo['largeImage'] = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_large.png';
            } else {
                $themeinfo['previewImage'] = 'system/Theme/images/preview_medium.png';
                $themeinfo['largeImage'] = 'system/Theme/images/preview_large.png';
            }
            if ($themename == $currenttheme['name']) {
                $currentthemepic = $themepic;
                unset($allthemes[$key]);
            } else {
                $previewthemes[$themename] = $themeinfo;
            }
        }

        $previewthemes = array_slice($previewthemes, $startnum-1, $itemsperpage);

        $this->view->setCaching(Zikula_View::CACHE_DISABLED);

        $this->view->assign('currentthemepic', $currentthemepic)
                   ->assign('currenttheme', $currenttheme)
                   ->assign('themes', $previewthemes)
                   ->assign('defaulttheme', ThemeUtil::getInfo(ThemeUtil::getIDFromName(System::getVar('Default_Theme'))));

        // assign the values for the pager plugin
        $this->view->assign('pager', array('numitems' => sizeof($allthemes),
                                           'itemsperpage' => $itemsperpage));

        // Return the output that has been generated by this function
        return $this->view->fetch('theme_user_main.tpl');
    }
Пример #20
0
 /**
  * Collect available actions for this entity.
  */
 protected function prepareItemActions()
 {
     if (!empty($this->_actions)) {
         return;
     }
     $currentType = FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING);
     $currentFunc = FormUtil::getPassedValue('func', 'main', 'GETPOST', FILTER_SANITIZE_STRING);
     $dom = ZLanguage::getModuleDomain('Reviews');
     if ($currentType == 'admin') {
         if (in_array($currentFunc, array('main', 'view'))) {
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'preview', 'linkTitle' => __('Open preview page', $dom), 'linkText' => __('Preview', $dom));
             $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom));
         }
         if (in_array($currentFunc, array('main', 'view', 'display'))) {
             $component = 'Reviews:Review:';
             $instance = $this->id . '::';
             if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) {
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom));
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom));
             }
             if (SecurityUtil::checkPermission($component, $instance, ACCESS_DELETE)) {
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'delete', 'arguments' => array('ot' => 'review', 'id' => $this['id'])), 'icon' => 'delete', 'linkTitle' => __('Delete', $dom), 'linkText' => __('Delete', $dom));
             }
         }
         if ($currentFunc == 'display') {
             $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'view', 'arguments' => array('ot' => 'review')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom));
         }
     }
     if ($currentType == 'user') {
         if (in_array($currentFunc, array('main', 'view'))) {
             if (ModUtil::getVar('Reviews', 'addcategorytitletopermalink') == 1 && ModUtil::getVar('Reviews', 'enablecategorization') == 1) {
                 $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom));
             } else {
                 $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom));
             }
         }
         /* if (in_array($currentFunc, array('main', 'view', 'display'))) {
             $component = 'Reviews:Review:';
            $instance = $this->id . '::';
            if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) {
            $this->_actions[] = array(
                    'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'id' => $this['id'])),
                    'icon' => 'edit',
                    'linkTitle' => __('Edit', $dom),
                    'linkText' => __('Edit', $dom)
            );
            $this->_actions[] = array(
                    'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'astemplate' => $this['id'])),
                    'icon' => 'saveas',
                    'linkTitle' => __('Reuse for new item', $dom),
                    'linkText' => __('Reuse', $dom)
            );
            }
            } */
         if ($currentFunc == 'display') {
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'view', 'arguments' => array('ot' => 'review')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom));
         }
     }
 }
Пример #21
0
 /**
  * Create or edit record.
  *
  * @return string|boolean Output.
  */
 public function edit()
 {
     if (!SecurityUtil::checkPermission('ExampleDoctrine::', '::', ACCESS_ADD)) {
         return LogUtil::registerPermissionError(ModUtil::url('ExampleDoctrine', 'user', 'main'));
     }
     $form = FormUtil::newForm('ExampleDoctrine', $this);
     return $form->execute('exampledoctrine_user_edit.tpl', new ExampleDoctrine_Handler_Edit());
 }
Пример #22
0
function mediashareGetStringUrl($param, $args, $default = null)
{
    $s = isset($args[$param]) ? $args[$param] : FormUtil::getPassedValue($param);
    if ($s == '') {
        $s = $default;
    }
    return $s;
}
Пример #23
0
 /**
  * Get a cookie.
  *
  * @param string  $name    Name of cookie.
  * @param boolean $signed  Override system setting to use signatures.
  * @param boolean $default Default value.
  *
  * @return mixed Cookie value as string or bool false.
  */
 public static function getCookie($name, $signed = true, $default = '')
 {
     $cookie = FormUtil::getPassedValue($name, $default, 'COOKIE');
     if (System::getVar('signcookies') && !$signed == false) {
         return SecurityUtil::checkSignedData($cookie);
     }
     return $cookie;
 }
Пример #24
0
    public function getFile($args) {
        // File name with the path
        $fileName = FormUtil::getPassedValue('fileName', isset($args['fileName']) ? $args['fileName'] : 0, 'GET');

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        return ModUtil::func('IWmain', 'user', 'getFile', array('fileName' => $fileName,
                    'sv' => $sv));
    }
Пример #25
0
    /**
     * This function displays a form to sent a test mail
     * @return string HTML string
     */
    public function testconfig()
    {
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN));

        $form = FormUtil::newForm('Mailer', $this);

        return $form->execute('mailer_admin_testconfig.tpl', new Mailer_Form_Handler_TestConfig());
    }
Пример #26
0
 /**
  * Main Admin function
  */
 public function main()
 {
     if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError(System::getHomepageUrl());
     }
     $form = FormUtil::newForm('BBSmile', $this);
     return $form->execute('admin/modifyconfig.tpl', new BBSmile_Form_Handler_Admin_ModifyConfig());
 }
Пример #27
0
    public function edit($args = array())
    {
        $this->checkAjaxToken();

        $mode = $this->request->request->get('mode', 'new');
        $accessLevel = $mode == 'edit' ? ACCESS_EDIT : ACCESS_ADD;
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Categories::', '::', $accessLevel));

        $cid = isset($args['cid']) ? $args['cid'] : $this->request->request->get('cid', 0);
        $parent = isset($args['parent']) ? $args['parent'] : $this->request->request->get('parent', 1);
        $validationErrors = FormUtil::getValidationErrors();
        $editCat = '';

        $languages = ZLanguage::getInstalledLanguages();

        if ($validationErrors) {
            $category = new Categories_DBObject_Category(DBObject::GET_FROM_VALIDATION_FAILED); // need this for validation info
            $editCat = $category->get();
            $validationErrors = $validationErrors['category'];
        } else {
            // indicates that we're editing
            if ($mode == 'edit') {
                if (!$cid) {
                    return new Zikula_Response_Ajax_BadData($this->__('Error! Cannot determine valid \'cid\' for edit mode in \'Categories_admin_edit\'.'));
                }
                $category = new Categories_DBObject_Category();
                $editCat = $category->select($cid);
                $this->throwNotFoundUnless($editCat, $this->__('Sorry! No such item found.'));
            } else {
                // someone just pressen 'new' -> populate defaults
                $category = new Categories_DBObject_Category(); // need this for validation info
                $editCat['sort_value'] = '0';
                $editCat['parent_id'] = $parent;
            }
        }

        $attributes = isset($editCat['__ATTRIBUTES__']) ? $editCat['__ATTRIBUTES__'] : array();

        Zikula_AbstractController::configureView();
        $this->view->setCaching(Zikula_View::CACHE_DISABLED);

        $this->view->assign('mode', $mode)
            ->assign('category', $editCat)
            ->assign('attributes', $attributes)
            ->assign('languages', $languages)
            ->assign('validation', $category->_objValidation);

        $result = array(
            'action' => $mode == 'new' ? 'add' : 'edit',
            'result' => $this->view->fetch('categories_adminajax_edit.tpl'),
            'validationErrors' => $validationErrors
        );
        if ($validationErrors) {
            return new Zikula_Response_Ajax_BadData($validationErrors, $result);
        }

        return new Zikula_Response_Ajax($result);
    }
Пример #28
0
 /**
  * Collect available actions for this entity.
  */
 protected function prepareItemActions()
 {
     if (!empty($this->_actions)) {
         return;
     }
     $currentType = FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING);
     $currentFunc = FormUtil::getPassedValue('func', 'main', 'GETPOST', FILTER_SANITIZE_STRING);
     $dom = ZLanguage::getModuleDomain('MUBoard');
     if ($currentType == 'admin') {
         if (in_array($currentFunc, array('main', 'view'))) {
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'preview', 'linkTitle' => __('Open preview page', $dom), 'linkText' => __('Preview', $dom));
             $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this['title']), 'linkText' => __('Details', $dom));
         }
         if (in_array($currentFunc, array('main', 'view', 'display'))) {
             if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_EDIT)) {
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom));
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom));
             }
             if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_DELETE)) {
                 $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'delete', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'delete', 'linkTitle' => __('Delete', $dom), 'linkText' => __('Delete', $dom));
             }
         }
         if ($currentFunc == 'display') {
             $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'view', 'arguments' => array('ot' => 'posting')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom));
         }
     }
     if ($currentType == 'user') {
         if (in_array($currentFunc, array('main', 'view'))) {
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this['title']), 'linkText' => __('Details', $dom));
         }
         if (in_array($currentFunc, array('main', 'view', 'display'))) {
             if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_EDIT)) {
                 /*$this->_actions[] = array(
                    'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting')),
                           'icon' => 'save',
                           'linkTitle' => __('Create new issue', $dom),
                           'linkText' => __('', $dom)
                   );
                   $this->_actions[] = array(
                           'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])),
                           'icon' => 'edit',
                           'linkTitle' => __('Edit', $dom),
                           'linkText' => __('Edit', $dom)
                   );
                   $this->_actions[] = array(
                           'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'astemplate' => $this['id'])),
                           'icon' => 'saveas',
                           'linkTitle' => __('Reuse for new item', $dom),
                           'linkText' => __('Reuse', $dom)
                   );*/
             }
         }
         if ($currentFunc == 'display') {
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'forum', 'id' => $posting . Forum . id)), 'icon' => 'back', 'linkTitle' => __('Back to forum ', $dom) . $posting . Forum . title, 'linkText' => __('Back to forum overview', $dom));
             $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'view', 'arguments' => array('ot' => 'category')), 'icon' => 'back', 'linkTitle' => __('Back to forum overview', $dom), 'linkText' => __('', $dom));
         }
     }
 }
Пример #29
0
 /**
  * Sets custom plugin variables.
  */
 public function setParameters()
 {
     // Object types to be used in the newsletter
     $objectTypes = FormUtil::getPassedValue($this->modname . 'ObjectTypes', array(), 'POST');
     $this->setPluginVar('ObjectTypes', array_keys($objectTypes));
     // Additional arguments
     $args = FormUtil::getPassedValue($this->modname . 'Args', array(), 'POST');
     $this->setPluginVar('Args', $args);
 }
/**
 * Get validation errors.
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - field:    The name of the field for which we wish to get the erorr
 *   - indent:   Wether or not to indent the validation error
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string
 */
function smarty_function_formutil_getvalidationerror($params, Zikula_View $view)
{
    $error = FormUtil::getValidationError($params['objectType'], $params['field']);
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $error);
    } else {
        return $error;
    }
}