コード例 #1
0
/**
 * Zikula_View function to create  manual link.
 *
 * This function creates a manual link from some parameters.
 *
 * Available parameters:
 *   - manual:    name of manual file, manual.html if not set
 *   - chapter:   an anchor in the manual file to jump to
 *   - newwindow: opens the manual in a new window using javascript
 *   - width:     width of the window if newwindow is set, default 600
 *   - height:    height of the window if newwindow is set, default 400
 *   - title:     name of the new window if newwindow is set, default is modulename
 *   - class:     class for use in the <a> tag
 *   - assign:    if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {manuallink newwindow=1 width=400 height=300 title=rtfm }
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string|void
 */
function smarty_function_manuallink($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
    $userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $stdlang = System::getVar('language_i18n');
    $title = isset($params['title']) ? $params['title'] : 'Manual';
    $manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
    $chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
    $class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
    $width = isset($params['width']) ? $params['width'] : 600;
    $height = isset($params['height']) ? $params['height'] : 400;
    $modname = ModUtil::getName();
    $possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
    foreach ($possibleplaces as $possibleplace) {
        if (file_exists($possibleplace)) {
            $url = $possibleplace . $chapter;
            break;
        }
    }
    if (isset($params['newwindow'])) {
        $link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    } else {
        $link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    }
    if (isset($params['assign'])) {
        $ret = array('url' => $url, 'link' => $link);
        $view->assign($params['assign'], $ret);
        return;
    } else {
        return $link;
    }
}
コード例 #2
0
/**
 * Obtain and display a configuration variable from the Zikula system.
 *
 * Available attributes:
 *  - name      (string)    The name of the configuration variable to obtain
 *  - html      (bool)      If set, the output is prepared for display by
 *                          DataUtil::formatForDisplayHTML instead of
 *                          DataUtil::formatForDisplay
 *  - assign    (string)    the name of a template variable to assign the
 *                          output to, instead of returning it to the template. (optional)
 *
 * <i>Note that if the the result is assigned to a template variable, it is not
 * prepared for display by either DataUtil::formatForDisplayHTML or
 * DataUtil::formatForDisplay. If it is to be displayed, the safetext
 * modifier should be used.</i>
 *
 * Examples:
 *
 * <samp><p>Welcome to {configgetvar name='sitename'}!</p></samp>
 *
 * <samp>{configgetvar name='sitename' assign='thename'}</samp><br>
 * <samp><p>Welcome to {$thename|safetext}!</p></samp>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the {@link Zikula_View} object.
 *
 * @return mixed The value of the configuration variable.
 */
function smarty_function_configgetvar($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('configgetvar')), E_USER_DEPRECATED);

    $name      = isset($params['name'])    ? $params['name']    : null;
    $default   = isset($params['default']) ? $params['default'] : null;
    $html      = isset($params['html'])    ? $params['html']    : null;
    $assign    = isset($params['assign'])  ? $params['assign']  : null;

    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('configgetvar', 'name')));
        return false;
    }

    $result = System::getVar($name, $default);

    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if (is_bool($html) && $html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
コード例 #3
0
ファイル: function.modgetvar.php プロジェクト: Silwereth/core
/**
 * Zikula_View function to get module variable
 *
 * This function obtains a module-specific variable from the Zikula system.
 *
 * Note that the results should be handled by the safetext or the safehtml
 * modifier before being displayed.
 *
 *
 * Available parameters:
 *   - module:   The well-known name of a module from which to obtain the variable
 *   - name:     The name of the module variable to obtain
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - html:     If true then result will be treated as html content
 *   - default:  The default value to return if the config variable is not set
 *
 * Example
 *   {modgetvar module='Example' name='foobar' assign='foobarOfExample'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The module variable.
 */
function smarty_function_modgetvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $module = isset($params['module']) ? $params['module'] : null;
    $html = isset($params['html']) ? (bool) $params['html'] : false;
    $name = isset($params['name']) ? $params['name'] : null;
    if (!$module) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'module')));
        return false;
    }
    if (!$name && !$assign) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'name')));
        return false;
    }
    if (!$name) {
        $result = ModUtil::getVar($module);
    } else {
        $result = ModUtil::getVar($module, $name, $default);
    }
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if ($html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
コード例 #4
0
ファイル: Marquee.php プロジェクト: nmpetkov/Zgoodies
 /**
  * Display block
  */
 public function display($blockinfo)
 {
     if (!SecurityUtil::checkPermission('Zgoodies:marqueeblock:', "{$blockinfo['bid']}::", ACCESS_OVERVIEW)) {
         return;
     }
     if (!ModUtil::available('Zgoodies')) {
         return;
     }
     $vars = BlockUtil::varsFromContent($blockinfo['content']);
     $lang = ZLanguage::getLanguageCode();
     // block title
     if (isset($vars['block_title'][$lang]) && !empty($vars['block_title'][$lang])) {
         $blockinfo['title'] = $vars['block_title'][$lang];
     }
     // marquee content
     if (isset($vars['marquee_content'][$lang]) && !empty($vars['marquee_content'][$lang])) {
         $vars['marquee_content_lang'] = $vars['marquee_content'][$lang];
     }
     if (!isset($vars['marquee_content'])) {
         $vars['marquee_content_lang'] = '';
     }
     $this->view->assign('vars', $vars);
     $this->view->assign('bid', $blockinfo['bid']);
     $blockinfo['content'] = $this->view->fetch('blocks/' . $vars['block_template']);
     if (isset($vars['block_wrap']) && !$vars['block_wrap']) {
         if (empty($blockinfo['title'])) {
             return $blockinfo['content'];
         } else {
             return '<h4>' . DataUtil::formatForDisplayHTML($blockinfo['title']) . '</h4>' . "\n" . $blockinfo['content'];
         }
     }
     return BlockUtil::themeBlock($blockinfo);
 }
コード例 #5
0
ファイル: function.user.php プロジェクト: Silwereth/core
/**
 * Zikula_View function to display the user name
 *
 * Example
 * {user}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.userwelcome.php::smarty_function_user()
 *
 * @return string The username.
 */
function smarty_function_user($params, Zikula_View $view)
{
    if (UserUtil::isLoggedIn()) {
        $username = UserUtil::getVar('uname');
    } else {
        $username = __('anonymous guest');
    }
    return DataUtil::formatForDisplayHTML($username);
}
コード例 #6
0
function smarty_modifier_contact($string)
{
    if (ereg("@", $string)) {
        $string = '<a href="mailto:' . $string . '">' . $string . '</a>';
    } else {
        $string = preg_replace_callback("#(\\w+)://([\\w\\+\\-\\@\\=\\?\\.\\%\\/\\:\\&\\;~\\|\\#]+)(\\.)?#", '_smarty_modifier_contact_callback', $string);
    }
    return DataUtil::formatForDisplayHTML($string);
}
コード例 #7
0
ファイル: Ajax.php プロジェクト: projectesIF/Sirius
    public function reloadFlaggedBlock() {
        // Security check
        if (!SecurityUtil::checkPermission('IWmain:flaggedBlock:', "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
            AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Sorry! No authorization to access this module.')));
        }

        //get the headlines saved in the user vars. It is renovate every 10 minutes

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists',
                                    array('name' => 'flagged',
                                          'module' => 'IWmain_block_flagged',
                                          'uid' => UserUtil::getVar('uid'),
                                          'sv' => $sv));
        $chars = 15;
        if (!$exists) {
            ModUtil::func('IWmain', 'user', 'flagged',
                           array('where' => '',
                                 'chars' => $chars));
        }
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $have_flags = ModUtil::func('IWmain', 'user', 'userGetVar',
                                     array('uid' => UserUtil::getVar('uid'),
                                           'name' => 'have_flags',
                                           'module' => 'IWmain_block_flagged',
                                           'sv' => $sv));
        if ($have_flags != '0') {
            ModUtil::func('IWmain', 'user', 'flagged',
                           array('where' => $have_flags,
                                 'chars' => $chars));
            //Posa la variable d'usuari have_news en blanc per no haver-la de tornar a llegir a la propera reiteraci�
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            ModUtil::func('IWmain', 'user', 'userSetVar',
                           array('uid' => UserUtil::getVar('uid'),
                                 'name' => 'have_flags',
                                 'module' => 'IWmain_block_flagged',
                                 'sv' => $sv,
                                 'value' => '0'));
        }

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $flags = ModUtil::func('IWmain', 'user', 'userGetVar',
                                array('uid' => UserUtil::getVar('uid'),
                                      'name' => 'flagged',
                                      'module' => 'IWmain_block_flagged',
                                      'sv' => $sv,
                                      'nult' => true));

        $view = Zikula_View::getInstance('IWmain', false);

        $view->assign('flags', $flags);
        $content = $view->fetch('IWmain_block_iwflagged.tpl');

        return new Zikula_Response_Ajax(array('content' => $content,
                ));
    }
コード例 #8
0
ファイル: Heading.php プロジェクト: robbrandt/Content
 public function displayEditing()
 {
     // just show the header itself during page editing
     $this->view->assign('text', DataUtil::formatForDisplayHTML($this->text));
     $this->view->assign('headerSize', DataUtil::formatForDisplayHTML($this->headerSize));
     $this->view->assign('anchorName', DataUtil::formatForDisplayHTML($this->anchorName));
     $this->view->assign('displayPageTitle', $this->displayPageTitle);
     $this->view->assign('contentId', $this->contentId);
     return $this->view->fetch($this->getTemplate());
 }
コード例 #9
0
ファイル: Quote.php プロジェクト: robbrandt/Content
 function displayEditing()
 {
     $text = DataUtil::formatForDisplayHTML($this->text);
     $source = DataUtil::formatForDisplayHTML($this->source);
     $desc = DataUtil::formatForDisplayHTML($this->desc);
     // this event should be moved to the template
     $event = new Zikula_Event('content.hook.contentitem.ui.filter', $this->view, array('caller' => $this->getModule()), $text);
     $text = $this->view->getEventManager()->notify($event)->getData();
     $text = '<div class="content-quote"><blockquote>' . $text . '</blockquote><p>-- ' . $desc . '</p></div>';
     return $text;
 }
コード例 #10
0
ファイル: Category.php プロジェクト: Silwereth/core
 public function selectPostProcess($data = null)
 {
     if (!$data) {
         $data =& $this->_objData;
     }
     if (!$data) {
         return $data;
     }
     $data['display_name'] = DataUtil::formatForDisplayHTML(unserialize($data['display_name']));
     $data['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($data['display_desc']));
     $this->_objData = $data;
     return $data;
 }
コード例 #11
0
function smarty_modifier_customtype($string)
{
    $ret_string = $string;
    $ar_type = array('varchar(60) default NULL', 'varchar(120) default NULL', 'varchar(240) default NULL', 'text', 'int default NULL', 'decimal(10,2) default NULL', 'date default NULL', 'dropdown', 'tinyint default NULL', 'smallint default NULL');
    $ar_dspname = array('Text, 60 chars, 1 line', 'Text, 120 chars, 2 lines', 'Text, 240 chars, 4 lines', 'Text, unlimited, 6 lines', 'Integer numbers', 'Decimal numbers', 'Date', 'Dropdown List', 'Blank line', 'Horizontal rule');
    for ($i = 0; $i < count($ar_type); $i++) {
        if ($string == $ar_type[$i]) {
            $ret_string = $ar_dspname[$i];
            break;
        }
    }
    return DataUtil::formatForDisplayHTML($ret_string);
}
コード例 #12
0
ファイル: Html.php プロジェクト: projectesIF/Sirius
    function display()
    {
        if ($this->inputType == 'raw') {
            $text = DataUtil::formatForDisplay($this->text);
        } else {
            $text = DataUtil::formatForDisplayHTML($this->text);
        }

        $this->view->assign('inputType', $this->inputType);
        $this->view->assign('text', $text);

        return $this->view->fetch($this->getTemplate());
    }
コード例 #13
0
ファイル: CategoryArray.php プロジェクト: rmaiwald/core
 public function selectPostProcess($objArray = null)
 {
     if (!$objArray) {
         $objArray =& $this->_objData;
     }
     if (!$objArray) {
         return $objArray;
     }
     foreach ($objArray as $k => $obj) {
         $objArray[$k]['display_name'] = DataUtil::formatForDisplayHTML(unserialize($obj['display_name']));
         $objArray[$k]['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($obj['display_desc']));
     }
     return $objArray;
 }
コード例 #14
0
ファイル: Flickr.php プロジェクト: robbrandt/Content
 function display()
 {
     $flickr = new phpFlickr(ModUtil::getVar('Content', 'flickrApiKey'));
     $flickr->enableCache("fs", System::getVar('temp'));
     // Find the NSID of the username
     $person = $flickr->people_findByUsername($this->userName);
     // Get the photos
     //$photos = $flickr->people_getPublicPhotos($person['id'], NULL, $this->photoCount);
     $photos = $flickr->photos_search(array('user_id' => $person['id'], 'tags' => $this->tags, 'per_page' => $this->photoCount));
     $photoData = array();
     foreach ((array) $photos['photo'] as $photo) {
         $photoData[] = array('title' => DataUtil::formatForDisplayHTML($this->decode($photo['title'])), 'src' => $flickr->buildPhotoURL($photo, "Square"), 'url' => "http://www.flickr.com/photos/{$photo['owner']}/{$photo['id']}");
     }
     $this->view->assign('photos', $photoData);
     return $this->view->fetch($this->getTemplate());
 }
コード例 #15
0
/**
 * FormUtil::getPassedValue().
 *
 * Available parameters:
 *   assign    The smarty variable to assign the retrieved value to.
 *   html      Wether or not to DataUtil::formatForDisplayHTML'ize the ML value.
 *   key       The key to retrieve from the input vector.
 *   name      Alias for key.
 *   default   The default value to return if the key is not set.
 *   source    The input source to retrieve the key from .
 *   noprocess If set, no processing is applied to the constant value.
 *
 * @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_getpassedvalue($params, Zikula_View $view)
{
    if ((!isset($params['key']) || !$params['key']) && (!isset($params['name']) || !$params['name'])) {
        // use name as an alias for key for programmer convenience
        $view->trigger_error('formutil_getpassedvalue: attribute key (or name) required');
        return false;
    }
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $key = isset($params['key']) ? $params['key'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $html = isset($params['html']) ? $params['html'] : null;
    $source = isset($params['source']) ? $params['source'] : null;
    $noprocess = isset($params['noprocess']) ? $params['noprocess'] : null;
    if (!$key) {
        $key = isset($params['name']) ? $params['name'] : null;
    }
    $source = isset($source) ? $source : null;
    switch ($source) {
        case 'GET':
            $val = $view->getRequest()->query->get($key, $default);
            break;
        case 'POST':
            $val = $view->getRequest()->request->get($key, $default);
            break;
        case 'SERVER':
            $val = $view->getRequest()->server->get($key, $default);
            break;
        case 'FILES':
            $val = $view->getRequest()->files->get($key, $default);
            break;
        default:
            $val = $view->getRequest()->query->get($key, $view->getRequest()->request->get($key, $default));
            break;
    }
    if ($noprocess) {
        $val = $val;
    } elseif ($html) {
        $val = DataUtil::formatForDisplayHTML($val);
    } else {
        $val = DataUtil::formatForDisplay($val);
    }
    if ($assign) {
        $view->assign($assign, $val);
    } else {
        return $val;
    }
}
コード例 #16
0
ファイル: Ajax.php プロジェクト: projectesIF/Sirius
    /**
     * Delete specified user assignment
     * @author: Sara Arjona Téllez (sarjona@xtec.cat)
     * @param:	args Array with:
     * 			- qvaid user assignment identifier
     * @return:	Show an error or status message
     */
    public function deleteuserassignment($args) {
        // Security check
        if (!SecurityUtil::checkPermission('IWqv::', '::', ACCESS_ADD)) {
            AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Sorry! No authorization to access this module.')));
        }

        // Get the parameters
        $qvaid = FormUtil::getPassedValue('qvaid', null, 'POST');
        if (ModUtil::apiFunc('IWqv', 'user', 'deleteuserassignment', array('qvaid' => $qvaid))) {
            $output = DataUtil::formatForDisplayHTML($this->__f('Done! %1$s deleted.', $this->__('QV assignment')));
        } else {
            $output = AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Error! Sorry! Deletion attempt failed.')));
        }

        AjaxUtil::output(array('qvaid' => $qvaid,
            'result' => $output));
    }
コード例 #17
0
ファイル: function.userlinks.php プロジェクト: rmaiwald/core
/**
 * Zikula_View function to display some user links
 *
 * Example
 * {userlinks start="[" end="]" seperator="|"}
 *
 * Parameters:
 *  start     Start delimiter
 *  end       End delimiter
 *  seperator Seperator
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.userlinks.php::smarty_function_userlinks()
 *
 * @return string User links.
 */
function smarty_function_userlinks($params, Zikula_View $view)
{
    $start = isset($params['start']) ? $params['start'] : '[';
    $end = isset($params['end']) ? $params['end'] : ']';
    $seperator = isset($params['seperator']) ? $params['seperator'] : '|';
    if (UserUtil::isLoggedIn()) {
        $links = "{$start} ";
        $profileModule = System::getVar('profilemodule', '');
        if (!empty($profileModule) && ModUtil::available($profileModule)) {
            $links .= "<a href=\"" . DataUtil::formatForDisplay(ModUtil::url($profileModule, 'user', 'view')) . '">' . __('Your Account') . "</a> {$seperator} ";
        } else {
            $links .= "<a href=\"" . DataUtil::formatForDisplay(ModUtil::url('ZikulaUsersModule', 'user', 'index')) . '">' . __('Your Account') . "</a> {$seperator} ";
        }
        $links .= "<a href=\"" . DataUtil::formatForDisplay(ModUtil::url('ZikulaUsersModule', 'user', 'logout')) . '">' . __('Log out') . "</a> {$end}";
    } else {
        $links = "{$start} <a href=\"" . DataUtil::formatForDisplay(ModUtil::url('ZikulaUsersModule', 'user', 'register')) . '">' . __('Register new account') . "</a> {$seperator} " . "<a href=\"" . DataUtil::formatForDisplay(ModUtil::url('ZikulaUsersModule', 'user', 'login')) . '">' . __('Login') . "</a> {$end}";
    }
    return DataUtil::formatForDisplayHTML($links);
}
コード例 #18
0
ファイル: Themeswitcher.php プロジェクト: projectesIF/Sirius
    /**
     * get information on block
     *
     * @return array The block information
     */
    public function info()
    {
        $switchThemeEnable = System::getVar('theme_change');

        if (!$switchThemeEnable) {
            $requirement_message = $this->__f('Notice: This theme switcher block will not be displayed until you allow users to change themes. You can enable/disable this from the <a href="%s">settings</a> of the Theme module.', DataUtil::formatForDisplayHTML(ModUtil::url('Theme', 'admin', 'modifyconfig')));
        } else {
            $requirement_message = '';
        }

        return array('module'       => 'Theme',
                     'text_type'         => $this->__('Theme switcher'),
                     'text_type_long'    => $this->__('Theme switcher'),
                     'allow_multiple'    => true,
                     'form_content'      => false,
                     'form_refresh'      => false,
                     'show_preview'      => true,
                     'admin_tableless'   => true,
                     'requirement'       => $requirement_message);
    }
コード例 #19
0
/**
 * Concatenate several values together and assign the resultant string to a template variable.
 *
 * Available attributes:
 *  - 1..10 (string)    The 1st through 10th value(s) we wish to assign
 *  - name  (string)    The name of the template variable to which the
 *                      concatenated string will be assigned
 *  - html  (bool)      (optional) If the specified value(s) contain HTML,
 *                      this should be set to true (or 1)
 *
 * Examples:
 *
 *  Concatenate the template variables $myVar1, $myVar2 and $myVar2 and store
 *  the resultant string in the template variable $myString:
 *
 *  <samp>{assign_concat name='myString' 1=$myVar1 2=$myVar2 3=$myVar3}</samp>
 *
 *  Concatenate the template variables $myVar1, $myVar2 and $myVar2 and store
 *  the resultant string in the template variable $myString. The string contains
 *  HTML, therefore it is passed through DataUtil::formatForDisplayHTML:
 *
 *  <samp>{assign_concat name='myString' 1=$myVar1 2=$myVar2 3=$myVar3 html=true}</samp>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the {@link Zikula_View} object.
 *
 * @return Void
 */
function smarty_function_assign_concat($params, Zikula_View $view)
{
    if (!isset($params['name']) || !$params['name']) {
        $view->trigger_error(__f('Invalid %1$s passed to %2$s.', array('name', 'assign_concat')));
        return false;
    }
    $txt = '';
    $i = 1;
    if (isset($params[$i])) {
        do {
            $txt .= "{$params[$i]}";
            $i++;
        } while (isset($params[$i]));
    }
    if (isset($params['html']) && $params['html']) {
        $view->assign($params['name'], DataUtil::formatForDisplayHTML($txt));
    } else {
        $view->assign($params['name'], $txt);
    }
}
コード例 #20
0
/**
 * Smarty function to display admin links for the reviews module
 * based on the user's permissions
 *
 * Reviews
 * <!--[reviewsuserlinks start="[" end="]" seperator="|" class="pn-menuitem-title"]-->
 *
 * @author       Mark West
 * @since        23/04/04
 * @see          function.reviewsuserlinks.php::smarty_function_reviewsuserlinks()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      &$smarty     Reference to the Smarty object
 * @param        string      $start       start string
 * @param        string      $end         end string
 * @param        string      $seperator   link seperator
 * @param        string      $class       CSS class
 * @return       string      the results of the module function
 */
function smarty_function_reviewsuserlinks($params, &$smarty)
{
    // set some defaults
    if (!isset($params['start'])) {
        $params['start'] = '[';
    }
    if (!isset($params['end'])) {
        $params['end'] = ']';
    }
    if (!isset($params['seperator'])) {
        $params['seperator'] = '|';
    }
    if (!isset($params['class'])) {
        $params['class'] = 'z-menuitem-title';
    }
    $dom = ZLanguage::getModuleDomain('Reviews');
    $userlinks = array();
    if (SecurityUtil::checkPermission('Reviews::', "::", ACCESS_OVERVIEW)) {
        $userlinks[] = array('url' => ModUtil::url('Reviews', 'user'), 'text' => __('Reviews index', $dom));
    }
    if (SecurityUtil::checkPermission('Reviews::', "::", ACCESS_OVERVIEW)) {
        $userlinks[] = array('url' => ModUtil::url('Reviews', 'user', 'view'), 'text' => __('View reviews', $dom));
    }
    if (SecurityUtil::checkPermission('Reviews::', "::", ACCESS_COMMENT)) {
        $userlinks[] = array('url' => ModUtil::url('Reviews', 'user', 'newreview'), 'text' => __('Submit a review', $dom));
    }
    if (empty($userlinks)) {
        return '';
    }
    $output = "<span class=\"" . $params['class'] . "\">" . $params['start'] . " ";
    foreach ($userlinks as $k => $link) {
        $userlinks[$k] = "<a href=\"" . DataUtil::formatForDisplayHTML($link['url']) . "\">{$link['text']}</a>";
    }
    $output .= implode(" {$params['seperator']} ", $userlinks);
    $output .= $params['end'] . "</span>\n";
    return $output;
}
コード例 #21
0
/**
 * FormUtil::getPassedValue().
 *
 * Available parameters:
 *   assign    The smarty variable to assign the retrieved value to.
 *   html      Wether or not to DataUtil::formatForDisplayHTML'ize the ML value.
 *   key       The key to retrieve from the input vector.
 *   name      Alias for key.
 *   default   The default value to return if the key is not set.
 *   source    The input source to retrieve the key from .
 *   noprocess If set, no processing is applied to the constant value.
 *
 * @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_getpassedvalue($params, Zikula_View $view)
{
    if ((!isset($params['key']) || !$params['key']) &&
            (!isset($params['name']) || !$params['name'])) {
        // use name as an alias for key for programmer convenience
        $view->trigger_error('formutil_getpassedvalue: attribute key (or name) required');
        return false;
    }

    $assign = isset($params['assign']) ? $params['assign'] : null;
    $key = isset($params['key']) ? $params['key'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $html = isset($params['html']) ? $params['html'] : null;
    $source = isset($params['source']) ? $params['source'] : null;
    $noprocess = isset($params['noprocess']) ? $params['noprocess'] : null;

    if (!$key) {
        $key = isset($params['name']) ? $params['name'] : null;
    }

    $val = FormUtil::getPassedValue($key, $default, $source);

    if ($noprocess) {
        $val = $val;
    } elseif ($html) {
        $val = DataUtil::formatForDisplayHTML($val);
    } else {
        $val = DataUtil::formatForDisplay($val);
    }

    if ($assign) {
        $view->assign($assign, $val);
    } else {
        return $val;
    }
}
コード例 #22
0
ファイル: User.php プロジェクト: projectesIF/Sirius
    /**
     * compose a message
     *
     * @author       The PostNuke Development Team
     * @param        integer      $tid     the ID of the item to display
     * @return       output       The item detail page
     */
    public function compose($args) {
        $reply = FormUtil::getPassedValue('reply', isset($args['reply']) ? $args['reply'] : 0, 'GETPOST');
        $replied = FormUtil::getPassedValue('replied', isset($args['replied']) ? $args['replied'] : 0, 'POST');
        $send = FormUtil::getPassedValue('send', isset($args['send']) ? $args['send'] : null, 'POST');
        $msg_id = FormUtil::getPassedValue('msg_id', isset($args['msg_id']) ? $args['msg_id'] : null, 'REQUEST');
        $uname = FormUtil::getPassedValue('uname', isset($args['uname']) ? $args['uname'] : null, 'REQUEST');
        $message = FormUtil::getPassedValue('message', isset($args['message']) ? $args['message'] : null, 'POST');
        $touser = FormUtil::getPassedValue('touser', isset($args['touser']) ? $args['touser'] : null, 'POST');
        $to_group = FormUtil::getPassedValue('to_group', isset($args['to_group']) ? $args['to_group'] : null, 'POST');
        $image = FormUtil::getPassedValue('image', isset($args['image']) ? $args['image'] : null, 'POST');
        $inici = FormUtil::getPassedValue('inici', isset($args['inici']) ? $args['inici'] : null, 'REQUEST');
        $rpp = FormUtil::getPassedValue('rpp', isset($args['rpp']) ? $args['rpp'] : null, 'REQUEST');
        $inicisend = FormUtil::getPassedValue('inicisend', isset($args['inicisend']) ? $args['inicisend'] : null, 'REQUEST');
        $rppsend = FormUtil::getPassedValue('rppsend', isset($args['rppsend']) ? $args['rppsend'] : null, 'REQUEST');
        $filtersend = FormUtil::getPassedValue('filtersend', isset($args['filtersend']) ? $args['filtersend'] : null, 'REQUEST');
        $filter = FormUtil::getPassedValue('filter', isset($args['filter']) ? $args['filter'] : null, 'REQUEST');
        if (!SecurityUtil::checkPermission('IWmessages::', $uname . '::', ACCESS_COMMENT)) {
            throw new Zikula_Exception_Forbidden();
        }
        $groupsMulti_array = array();
        $canUpdate = '';
        $subject = '';
        $icons = false;
        $touser = '';
        $toUserFixed = false;
        $fromuser = '';

        if (isset($uname) && $uname != '')
            $touser = $uname;

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $groupsInfo = ModUtil::func('IWmain', 'user', 'getAllGroupsInfo',
                        array('sv' => $sv));
        $month_long = explode(' ', $this->__('January February March April May June July August September October November December'));
        if ($reply == 1) {
            $replied = $msg_id;
            // The API function is called.  The arguments to the function are passed in
            // as their own arguments array
            $item = ModUtil::apiFunc('IWmessages', 'user', 'get',
                            array('uid' => UserUtil::getVar('uid'),
                                'msgid' => $msg_id));
            $fromuserdata = UserUtil::getVars($item['from_userid']);
            $touserdata = UserUtil::getVars($item['to_userid']);
            $user_id = UserUtil::getVar('uid');
            if (UserUtil::isLoggedIn() && ($user_id != $touserdata['uid'])) {
                LogUtil::registerError($this->__('You can\'t reply to that message. It wasn\'t sent to you.'));
                return System::redirect(ModUtil::url('IWmessages', 'user', 'view'));
            }
            $fromuser = $fromuserdata['uname'];
            if (strpos($item['subject'], 'Re:') === false) {
                $reText = $this->__('Re') . ': ';
            }
            $subject = $reText . $item['subject'];

            if (!empty($uname)) {
                $view->assign('touser', $uname);
            }
            $text = preg_replace('/(<br[ \/]*?>)/i', '', $item['msg_text']);
            $text = DataUtil::formatForDisplayHTML($text);
            $text = eregi_replace('\[addsig]', '', $text);
            $text = nl2br($text);

            $row['msg_time'] = mktime(substr($item['msg_time'], 11, 2), // hour
                            substr($item['msg_time'], 14, 2), // minute
                            '0', // second
                            substr($item['msg_time'], 5, 2), // month
                            substr($item['msg_time'], 8, 2), // day
                            substr($item['msg_time'], 0, 4)); // year
            $userTime = $row['msg_time'];
            $reply = "[quote=$fromuserdata[uname] " . $this->__('wrote') . ' ' . $this->__('on') . ' ' . date('d/', $userTime) . $month_long[date('m', $userTime) - 1] . date('/Y - H.i', $userTime) . "]<br />" . '<div class="messageBody">' . $text . "</div><br />[/quote]<br />" . $item['reply'];
        } else {
            $reply = false;
        }
        if ($this->getVar('smiliesActive')) {
            $icons = ModUtil::apiFunc('IWmain', 'user', 'getAllIcons');
        }
        // assign the username if both present and valid
        if (!empty($uname)) {
            // we call the API to check if the uname is valid
            $uid = UserUtil::getIdFromName($uname);
            if (isset($uid)) {
                $toUserFixed = true;
                $touser = $uname;
            }
        }
        if (empty($msg_id)) {
            $msg_id = '';
        }
        //Check if the user can upload files
        $groupsCanUpdate = ModUtil::getVar('IWmessages', 'groupsCanUpdate');
        $multiMail = ModUtil::getVar('IWmessages', 'multiMail');
        $groupsUpdate = explode('$$', substr($groupsCanUpdate, 0, -1));
        array_shift($groupsUpdate);

        foreach ($groupsUpdate as $update) {
            $names = explode('|', $update);

            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $isMember = ModUtil::func('IWmain', 'user', 'isMember',
                            array('uid' => UserUtil::getVar('uid'),
                                'gid' => $names[0],
                                'sgid' => $names[1],
                                'sv' => $sv));
            if ($isMember) {
                $canUpdate = true;
                break;
            }
        }
        //Check if the user can send mails to multi users
        $multiMail = explode('$$', substr($multiMail, 0, -1));
        array_shift($multiMail);
        sort($multiMail);
        $allGroups = false;
        foreach ($multiMail as $multi) {
            $names = explode('-', $multi);
            $names1 = explode('|', $names[0]);
            $names2 = explode('|', $names[1]);
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $isMember = ModUtil::func('IWmain', 'user', 'isMember',
                            array('uid' => UserUtil::getVar('uid'),
                                'gid' => $names1[0],
                                'sgid' => $names1[1],
                                'sv' => $sv));
            if ($isMember) {
                if ($names2[0] == 0 && $names2[1] == 0) {
                    $allGroups = true;
                    break;
                }
                $gn2 = $groupsInfo[$names2[0]];
                $groupsMulti_array[] = array('id' => $names2[0] . '|' . $names2[1],
                    'name' => $gn2);
            }
        }
        if ($allGroups) {
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $grups = ModUtil::func('IWmain', 'user', 'getAllGroups',
                            array('sv' => $sv));
            $groupsMulti_array = array();
            $groupsMulti_array[] = array('id' => "0|0",
                'name' => $this->__('To all users'));
            foreach ($grups as $grup) {
                $groupsMulti_array[] = array('id' => $grup['id'] . '|0',
                    'name' => $grup['name']);
            }
        }
        $canMulti = (count($groupsMulti_array) > 0) ? true : false;
        $photosFolder = ModUtil::getVar('IWmessages', 'photosFolder');
        $multiMail = ModUtil::getVar('IWmessages', 'multiMail');

        return $this->view->assign('replied', $replied)
                ->assign('groupsMulti', $groupsMulti_array)
                ->assign('canUpdate', $canUpdate)
                ->assign('canMulti', $canMulti)
                ->assign('msgid', $msg_id)
                ->assign('extensions', ModUtil::getVar('IWmain', 'extensions'))
                ->assign('message', $message)
                ->assign('touser', $touser)
                ->assign('to_group', $to_group)
                ->assign('image', $image)
                ->assign('inici', $inici)
                ->assign('inicisend', $inicisend)
                ->assign('filter', $filter)
                ->assign('filtersend', $filtersend)
                ->assign('rpp', $rpp)
                ->assign('subject', $subject)
                ->assign('rppsend', $rppsend)
                ->assign('dissableSuggest', ModUtil::getVar('IWmessages', 'dissableSuggest'))
                ->assign('reply', $reply)
                ->assign('reply1', htmlspecialchars($reply))
                ->assign('icons', $icons)
                ->assign('touser', $touser)
                ->assign('toUserFixed', $toUserFixed)
                ->assign('fromuser', $fromuser)
                ->fetch('IWmessages_user_new.tpl');
    }
コード例 #23
0
/**
 * Exit.
 *
 * @param string  $msg  Message.
 * @param boolean $html True for html.
 *
 * @deprecated since 1.3.0
 *
 * @return false
 */
function z_exit($msg, $html = true)
{
    if ($html) {
        $msg = DataUtil::formatForDisplayHTML($msg);
    }
    LogUtil::registerError($msg);
    trigger_error($msg, E_USER_ERROR);
    return false;
    //throw new Zikula_Exception_Fatal($msg);
}
コード例 #24
0
ファイル: Ajax.php プロジェクト: projectesIF/Sirius
    public function editForumDesc($args){
        
        $fid = $this->request->getPost()->get('fid', '');
        if (!$fid) {
            throw new Zikula_Exception_Fatal($this->__('no forum id'));
        }
        
        if (!SecurityUtil::checkPermission('IWforums::', '::', ACCESS_READ)) {
            throw new Zikula_Exception_Fatal($this->__('Sorry! No authorization to access this module.'));
        }

        //check if user can access the forum
        $access = ModUtil::func('IWforums', 'user', 'access', array('fid' => $fid));
        if ($access < 4) {
            throw new Zikula_Exception_Fatal($this->__('Sorry! No authorization to edit content forum.'));
        }
        
        // Get forum fields
        $forum = ModUtil::apiFunc('IWforums', 'user', 'get',
                                  array('fid' => $fid));
             
        if ($forum == false) {
            AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Forum not found')));
        }
        
        $view = Zikula_View::getInstance('IWforums', false);
        //$view->assign('fid', $fid);
        $view->assign('nom_forum', $forum['nom_forum']);
        $view->assign('descriu', $forum['descriu']);
        $view->assign('lDesc', $forum['longDescriu']);
        $view->assign('observacions', $forum['observacions']);
        $view->assign('forum', $forum);
        $view->assign('mode', 'edit');

        $content = $view->fetch('user/IWforums_user_forumDesc.tpl');
        
        return new Zikula_Response_Ajax(array('content' => $content));
    }
コード例 #25
0
ファイル: CoreExtension.php プロジェクト: Silwereth/core
 /**
  * @param $string
  * @return string
  */
 public function safeHtml($string)
 {
     return \DataUtil::formatForDisplayHTML($string);
 }
コード例 #26
0
ファイル: LogUtil.php プロジェクト: Silwereth/core
 /**
  * Add popup message to the status or error messages.
  *
  * @param string  $message The message.
  * @param integer $type    The message type.
  *
  * @throws InvalidArgumentException Thrown if the $type is invalid.
  *
  * @return void
  */
 private static function _addPopup($message, $type = E_USER_NOTICE)
 {
     self::log($message, Log::DEBUG);
     $session = ServiceUtil::getManager()->get('session');
     if ($type === Log::INFO) {
         $session->addMessage(Zikula_Session::MESSAGE_STATUS, DataUtil::formatForDisplayHTML($message));
     } elseif ($type === Log::WARNING) {
         $session->addMessage(Zikula_Session::MESSAGE_WARNING, DataUtil::formatForDisplayHTML($message));
     } elseif ($type === E_USER_ERROR) {
         $session->addMessage(Zikula_Session::MESSAGE_ERROR, DataUtil::formatForDisplayHTML($message));
     } else {
         throw new InvalidArgumentException(__f('Invalid type %s for LogUtil::_addPopup', $type));
     }
 }
コード例 #27
0
/**
 * Smarty function to display edit and delete links for a news article
 *
 * Example
 * <!--[articleadminlinks sid='1' start='[' and=']' seperator='|' class='z-sub']-->
 *
 * @author       Mark West
 * @since        20/10/03
 * @see          function.articleadminlinks.php::smarty_function_articleadminlinks()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      &$smarty     Reference to the Smarty object
 * @param        integer     $sid         article id
 * @param        string      $start       start string
 * @param        string      $end         end string
 * @param        string      $seperator   link seperator
 * @param        string      $class       CSS class
 * @return       string      the results of the module function
 */
function smarty_function_articleadminlinks($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('News');

    // get the info template var
    $info = $smarty->get_template_vars('info');

    if (!isset($params['sid'])) {
        $params['sid'] = $info['sid'];
    }
    if (!isset($params['page'])) {
        $params['page'] = $smarty->get_template_vars('page');
    }

    // set some defaults
    if (!isset($params['start'])) {
        $params['start'] = '[';
    }
    if (!isset($params['end'])) {
        $params['end'] = ']';
    }
    if (!isset($params['seperator'])) {
        $params['seperator'] = '|';
    }
    if (!isset($params['class'])) {
        $params['class'] = 'z-sub';
    }
    if (isset($params['type']) && $params['type'] <> 'ajax') {
        $params['type'] = '';
    }

/*
    // Check for the current user to enable users to edit their own articles
    if (UserUtil::isLoggedIn()) {
        $uid = UserUtil::getVar('uid');
    } else {
        $uid = 0;
    }
*/
    $articlelinks = '';
    if (SecurityUtil::checkPermission('News::', "$info[cr_uid]:$info[cattitle]:$info[sid]", ACCESS_EDIT) /*|| ($uid != 0 && $info['cr_uid'] == $uid)*/) {
        // load our ajax files into the header
        if (isset($params['type']) && $params['type'] == 'ajax') {
            // load our ajax files into the header
            require_once $smarty->_get_plugin_filepath('function', 'ajaxheader');
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'news.js'), $smarty);
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'sizecheck.js'), $smarty);
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'prototype-base-extensions.js'), $smarty);
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'prototype-date-extensions.js'), $smarty);
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'datepicker.js'), $smarty);
            smarty_function_ajaxheader(array('modname' => 'News', 'filename' => 'datepicker-locale.js'), $smarty);
            if (ModUtil::getVar('News', 'enableattribution')) {
                PageUtil::addVar('javascript', 'javascript/helpers/Zikula.itemlist.js');
            }
            PageUtil::addVar('stylesheet', 'modules/News/style/datepicker.css');
            $articlelinks .= '<img id="news_loadnews" src="'.System::getBaseUrl().'images/ajax/circle-ball-dark-antialiased.gif" alt="" /><span class="' . $params['class'] . '"> ' . $params['start'] . ' <a onclick="editnews(' . $params['sid'] . ',' . $params['page'] . ')" href="javascript:void(0);">' . __('Quick edit', $dom) . '</a> ' . $params['end'] . "</span>\n";
        } else {
            $articlelinks .= '<span class="' . $params['class'] . '"> ' . $params['start'] . ' <a href="' . DataUtil::formatForDisplayHTML(ModUtil::url('News', 'admin', 'modify', array('sid' => $params['sid']))) . '">' . __('Edit', $dom) . '</a>';
            if (SecurityUtil::checkPermission('News::', "$info[cr_uid]:$info[cattitle]:$info[sid]", ACCESS_DELETE)) {
                $articlelinks .= ' ' . $params['seperator'] . ' <a href="' . DataUtil::formatForDisplay(ModUtil::url('News', 'admin', 'delete', array('sid' => $params['sid']))) . '">' . __('Delete', $dom) . '</a>';
            }
            $articlelinks .= ' ' . $params['end'] . "</span>\n";
        }
    }

    return $articlelinks;
}
コード例 #28
0
ファイル: CategoryUtil.php プロジェクト: projectesIF/Sirius
 /**
  * Return an array of categories objects according the specified where-clause and sort criteria.
  *
  * @param string  $where                  The where clause to use in the select (optional) (default='').
  * @param string  $sort                   The order-by clause to use in the select (optional) (default='').
  * @param string  $assocKey               The field to use as the associated array key (optional) (default='').
  * @param boolean $enablePermissionFilter Whether or not to enable the permission filter(optional) (default=false).
  * @param array   $columnArray            Array of columns to select (optional) (default=null).
  *
  * @return The resulting folder object array.
  */
 public static function getCategories($where = '', $sort = '', $assocKey = '', $enablePermissionFilter = true, $columnArray = null)
 {
     ModUtil::dbInfoLoad('Categories');
     if (!$sort) {
         $dbtables = DBUtil::getTables();
         $category_column = $dbtables['categories_category_column'];
         $sort = "ORDER BY {$category_column['sort_value']}, {$category_column['path']}";
     }
     $permFilter = array();
     if ($enablePermissionFilter) {
         $permFilter[] = array('realm' => 0, 'component_left' => 'Categories', 'component_middle' => '', 'component_right' => 'Category', 'instance_left' => 'id', 'instance_middle' => 'path', 'instance_right' => 'ipath', 'level' => ACCESS_OVERVIEW);
     }
     $cats = DBUtil::selectObjectArray('categories_category', $where, $sort, -1, -1, $assocKey, $permFilter, null, $columnArray);
     $arraykeys = array_keys($cats);
     foreach ($arraykeys as $arraykey) {
         if ($cats[$arraykey]['display_name']) {
             $cats[$arraykey]['display_name'] = DataUtil::formatForDisplayHTML(unserialize($cats[$arraykey]['display_name']));
         }
         if (isset($cats[$arraykey]['display_desc']) && $cats[$arraykey]['display_desc']) {
             $cats[$arraykey]['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($cats[$arraykey]['display_desc']));
         }
         if (!$enablePermissionFilter) {
             $cats[$arraykey]['accessible'] = SecurityUtil::checkPermission('Categories::Category', $cats[$arraykey]['id'] . ':' . $cats[$arraykey]['path'] . ':' . $cats[$arraykey]['ipath'], ACCESS_OVERVIEW);
         }
     }
     return $cats;
 }
コード例 #29
0
ファイル: Theme.php プロジェクト: rmaiwald/core
 /**
  * Display a block.
  *
  * @param array $block Block information.
  *
  * @return string The rendered output.
  */
 public function themesidebox($block)
 {
     // assign the block information
     $this->assign($block);
     $bid = $block['bid'];
     $bkey = strtolower($block['bkey']);
     if (array_key_exists('position', $block)) {
         $position = strtolower($block['position']);
     } else {
         $position = 'none';
     }
     // fix block positions - for now....
     if ($position == 'l') {
         $position = 'left';
     }
     if ($position == 'c') {
         $position = 'center';
     }
     if ($position == 'r') {
         $position = 'right';
     }
     // HACK: Save/restore output filters - we don't want to output-filter blocks
     $outputfilters = $this->_plugins['outputfilter'];
     $this->_plugins['outputfilter'] = array();
     // HACK: Save/restore cache settings
     $caching = $this->caching;
     $this->caching = Zikula_View::CACHE_DISABLED;
     $return = '';
     // determine the correct template and construct the output
     if (isset($this->themeconfig['blockinstances'][$bid]) && !empty($this->themeconfig['blockinstances'][$bid])) {
         $return .= $this->fetch($this->themeconfig['blockinstances'][$bid]);
     } elseif (isset($this->themeconfig['blocktypes'][$bkey]) && !empty($this->themeconfig['blocktypes'][$bkey])) {
         $return .= $this->fetch($this->themeconfig['blocktypes'][$bkey]);
     } elseif (isset($this->themeconfig['blockpositions'][$position]) && !empty($this->themeconfig['blockpositions'][$position])) {
         $return .= $this->fetch($this->themeconfig['blockpositions'][$position]);
     } elseif (!empty($this->themeconfig['block'])) {
         $return .= $this->fetch($this->themeconfig['block']);
     } else {
         if (!empty($block['title'])) {
             $return .= '<h4>' . DataUtil::formatForDisplayHTML($block['title']) . ' ' . $block['minbox'] . '</h4>';
         }
         $return .= $block['content'];
     }
     // HACK: Save/restore output filters
     $this->_plugins['outputfilter'] = $outputfilters;
     // HACK: Save/restore cache settings
     $this->caching = $caching;
     if ((bool) $this->themeconfig['blockwrapper']) {
         $return = '<div class="z-block ' . 'z-blockposition-' . DataUtil::formatForDisplay($position) . ' z-bkey-' . DataUtil::formatForDisplay(strtolower($block['bkey'])) . ' z-bid-' . DataUtil::formatForDisplay($block['bid']) . '">' . "\n" . $return . "</div>\n";
     }
     return $return;
 }
コード例 #30
0
ファイル: Ajax.php プロジェクト: hardtoneselector/Files
 public function externalModifyImg($args)
 {
     if (!SecurityUtil::checkPermission('Files::', '::', ACCESS_ADD)) {
         AjaxUtil::error(DataUtil::formatForDisplayHTML(_MODULENOAUTH));
     }
     $image = FormUtil::getPassedValue('image', -1, 'GET');
     if ($image == -1) {
         AjaxUtil::error($this->__('no image found'));
     }
     $factor = FormUtil::getPassedValue('factor', -1, 'GET');
     if ($factor == -1) {
         AjaxUtil::error($this->__('no size factor defined'));
     }
     $folderName = FormUtil::getPassedValue('folder', -1, 'GET');
     if ($folderName == -1) {
         AjaxUtil::error($this->__('No folder defined.'));
     }
     $action = FormUtil::getPassedValue('action', -1, 'GET');
     $folderPath = SecurityUtil::checkPermission('Files::', '::', ACCESS_ADMIN) ? $folderName : ModUtil::getVar('Files', 'usersFolder') . '/' . strtolower(substr(UserUtil::getVar('uname'), 0, 1)) . '/' . UserUtil::getVar('uname') . '/' . $folderName;
     // gets root folder for the user
     $initFolderPath = ModUtil::func('Files', 'user', 'getInitFolderPath');
     list($width, $height) = getimagesize($initFolderPath . '/' . $folderName . '/' . $image);
     $factor = $action == 'increase' ? round($factor / 1.2, 2) : round($factor * 1.2, 2);
     $newWidth = floor($width / $factor);
     $newHeight = floor($height / $factor);
     // create output object
     $file = array('name' => $image, 'width' => $width, 'viewWidth' => $newWidth, 'viewHeight' => $newHeight, 'height' => $height, 'factor' => $factor);
     // create new thumbnail
     ModUtil::func('Files', 'user', 'thumbnail', array('fileName' => $image, 'folder' => $folderName, 'newWidth' => $newWidth, 'fromAjax' => 1));
     $this->view->setCaching(false);
     $this->view->assign('file', $file);
     $this->view->assign('folderPath', $folderPath);
     $this->view->assign('folderName', $folderName);
     $this->view->assign('hook', 0);
     $content = $this->view->fetch('Files_external_getFilesImgContent.tpl');
     AjaxUtil::output(array('image' => $image, 'content' => $content));
 }