/**
  * Not part of the api
  */
 private function _get_items_array($selItems = array())
 {
     $AC =& ac_utils::get_module('AdvancedContent');
     $items = array();
     if ($this->GetProperty('items') != '') {
         foreach (explode($this->GetProperty('delimiter'), $this->GetProperty('items')) as $key => $val) {
             $items[$key]['id'] = munge_string_to_url(trim($val));
             $items[$key]['label'] = trim($val);
             if ($this->GetProperty('translate_labels')) {
                 $items[$key]['label'] = $AC->lang($items[$key]['label']);
             }
             $items[$key]['value'] = $items[$key]['label'];
             $items[$key]['selected'] = in_array($items[$key]['label'], $selItems);
         }
     }
     if ($this->GetProperty('values') != '') {
         foreach (explode($this->GetProperty('delimiter'), $this->GetProperty('values')) as $key => $val) {
             $items[$key]['value'] = trim($val);
             if ($this->GetProperty('translate_values')) {
                 $items[$key]['value'] = $AC->lang($items[$key]['value']);
             }
             $items[$key]['selected'] = in_array($items[$key]['value'], $selItems);
             if (!isset($items[$key]['label'])) {
                 $items[$key]['label'] = $items[$key]['value'];
             }
         }
     }
     return $items;
 }
 public function GetCompiledContent(&$obj)
 {
     $config = cmsms()->GetConfig();
     $img = ac_utils::CleanURL($config['uploads_url'] . '/' . $this->GetProperty('dir')) . $this->GetContent();
     # ToDo: base64 support
     # get width height automatically from file?
     if (!$this->GetProperty('urlonly')) {
         $img = '<img src="' . $img . '" alt="' . $this->GetProperty('alt') . '"' . ($this->GetProperty('title') ? ' title="' . $this->GetProperty('title') . '"' : '') . ($this->GetProperty('class') ? ' class="' . $this->GetProperty('class') . '"' : '') . ($this->GetProperty('css_id') ? ' id="' . $this->GetProperty('id') . '"' : '') . ($this->GetProperty('width') ? ' width="' . $this->GetProperty('width') . '"' : '') . ($this->GetProperty('height') ? ' height="' . $this->GetProperty('height') . '"' : '') . '>';
     }
     $this->SetContent($img);
     return parent::GetCompiledContent($obj);
 }
 function __construct(&$content_obj, $params = array())
 {
     parent::__construct($content_obj, $params);
     $AC =& ac_utils::get_module('AdvancedContent');
     $this->SetProperty('no_collapse', true);
     $this->SetProperty('collapsible', false);
     $this->SetProperty('collapse', false);
     if ($this->content_obj->IsKnownProperty($this->GetProperty('id'))) {
         $this->SetProperty('error_message', $AC->lang('error_basicattrib', $this->GetProperty('name')));
     } else {
         $this->SetProperty('error_message', $AC->lang('invalid_block', $this->GetProperty('name'), $this->Type()));
     }
     $this->SetContent('');
 }
 public function GetInput()
 {
     $AC =& ac_utils::get_module('AdvancedContent');
     if ($this->GetProperty('module') == '') {
         return $AC->lang('error_insufficient_blockparams', 'module', $this->GetProperty('name'));
     }
     if (!($module =& $AC->GetModuleInstance($this->GetProperty('module')))) {
         return $AC->lang('error_loading_module', $this->GetProperty('module'), $this->GetProperty('name'));
     }
     if (!$module->HasCapability('contentblocks')) {
         return $AC->lang('error_contentblock_support', $this->GetProperty('module'), $this->GetProperty('name'));
     }
     return $module->GetContentBlockInput($this->GetProperty('id'), $this->GetContent(), $this->GetProperty('params'), $this->GetProperty('adding'));
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'text';
     parent::__construct($content_obj, $params);
     $size = isset($params['size']) ? intval($params['size']) : '';
     $maxlength = isset($params['maxlength']) ? $params['maxlength'] : '';
     $usewysiwyg = (!isset($params['usewysiwyg']) || !ac_utils::IsFalse($params['usewysiwyg'])) && (!isset($params['wysiwyg']) || !ac_utils::IsFalse($params['wysiwyg']));
     $rows = isset($params['rows']) ? $params['rows'] : '';
     $cols = isset($params['cols']) ? $params['cols'] : '';
     $auto_resize = !isset($params['auto_resize']) || !ac_utils::IsFalse($params['auto_resize']);
     $oneline = isset($params['oneline']) && ac_utils::IsTrue($params['oneline']);
     $this->SetProperty('size', $size);
     $this->SetProperty('usewysiwyg', $usewysiwyg);
     $this->SetProperty('oneline', $oneline);
     $this->SetProperty('maxlength', $maxlength);
     $this->SetProperty('rows', $rows);
     $this->SetProperty('cols', $cols);
     $this->SetProperty('auto_resize', $auto_resize);
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'ui_slider';
     parent::__construct($content_obj, $params);
     $slider_params = array();
     if (isset($params['min'])) {
         $slider_params['min'] = intval($params['min']);
     }
     if (isset($params['max'])) {
         $slider_params['max'] = intval($params['max']);
     }
     if (isset($params['orientation'])) {
         $slider_params['orientation'] = $params['orientation'];
     }
     if (isset($params['range'])) {
         $slider_params['range'] = ac_utils::IsTrue($params['range']) ? true : $params['range'];
     }
     if (isset($params['step'])) {
         $slider_params['step'] = intval($params['step']);
     }
     $this->SetProperty('slider_params', $slider_params);
     $this->SetProperty('unit', isset($params['unit']) ? $params['unit'] : '');
 }
 public function GetInput()
 {
     $AC =& ac_utils::get_module('AdvancedContent');
     $items = array();
     if ($this->GetProperty('items') != '') {
         foreach (explode($this->GetProperty('delimiter'), $this->GetProperty('items')) as $key => $val) {
             $items[$key]['label'] = trim($val);
             if ($this->GetProperty('translate_labels')) {
                 $items[$key]['label'] = $AC->lang($items[$key]['label']);
             }
             $items[$key]['value'] = $items[$key]['label'];
             $items[$key]['selected'] = trim($this->GetContent()) === $items[$key]['value'];
         }
     }
     if ($this->GetProperty('values') != '') {
         foreach (explode($this->GetProperty('delimiter'), $this->GetProperty('values')) as $key => $val) {
             $items[$key]['value'] = trim($val);
             if ($this->GetProperty('translate_values')) {
                 $items[$key]['value'] = $AC->lang($items[$key]['value']);
             }
             $items[$key]['selected'] = trim($this->GetContent()) === $items[$key]['value'];
             if (!isset($items[$key]['label'])) {
                 $items[$key]['label'] = $items[$key]['value'];
             }
         }
     }
     $input = '<select name="' . $this->GetProperty('id') . '" ' . ($this->GetProperty('style') != '' ? 'style="' . $this->GetProperty('style') . ' "' : '') . ' >';
     foreach ($items as $item) {
         $input .= '<option value="' . $item['value'] . '"';
         if ($item['selected']) {
             $input .= ' selected="selected"';
         }
         $input .= '>' . $item['label'] . '</option>';
     }
     $input .= '</select>';
     return $input;
 }
 /**
  * Just a wrapper to get a module instance in the template
  *
  * @param string $module_name - the exact name of the module (case sensitive)
  * @param string $module_version (optional) - the minimum version of the module
  * @return object
  */
 public function &get_module($module_name, $module_version = '')
 {
     return ac_utils::get_module($module_name, $module_version);
 }
 /**
  * @internal
  * @access private
  */
 public static function _register_content_block(&$content_obj, &$contentBlock)
 {
     # do not process blocks with same id twice
     if (isset(self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')])) {
         self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')]->SetProperty('multiple', true);
         return;
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $block_id = $contentBlock->GetProperty('id');
     # this block has been added to the template after page has been created?
     if (!$content_obj->HasProperty($block_id)) {
         $contentBlock->SetProperty('new_block', true);
     }
     # ToDo: how remove the backend stuff from this class without need to loop through all content blocks again?
     if (!ac_utils::is_frontend_request()) {
         $type = $contentBlock->Type();
         if (!isset(self::$_block_types[$type])) {
             self::$_block_types[$type] = array('content_blocks' => array(), 'header_html_called' => false, 'props' => array());
         }
         self::$_block_types[$type]['content_blocks'][$block_id] = $block_id;
         acTabManager::SetTabs($content_obj, $contentBlock);
         if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE) {
             if ($contentBlock->GetProperty('smarty')) {
                 foreach ($contentBlock->GetProperties() as $propName => $propValue) {
                     $contentBlock->SetProperty($propName, ac_utils::DoSmarty($content_obj, $propValue));
                 }
             }
             $value = $contentBlock->GetContent();
             if ($content_obj->Id() < 0 && $value == '' || $value == '' && !$contentBlock->GetProperty('allow_none') || $contentBlock->GetProperty('new_block')) {
                 $value = $contentBlock->GetProperty('default');
             }
             $content_obj->SetPropertyValueNoLoad($block_id, $value);
             $block_display = true;
             if ($contentBlock->GetProperty('collapsible')) {
                 $block_display = ac_admin_ops::GetVisibility('block', $block_id, $content_obj->Id(), $content_obj->TemplateId(), !$contentBlock->GetProperty('collapse'));
                 $contentBlock->SetProperty('pref_url', str_replace('&amp);', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_block'), array('item_type' => 'block', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => !$block_display), '', true)));
             }
             $contentBlock->SetProperty('display', $block_display);
         }
         if (strtolower($contentBlock->GetProperty('label')) == 'content_en') {
             $contentBlock->SetProperty('label', lang('content'));
         }
         if ($contentBlock->GetProperty('translate_labels')) {
             $contentBlock->SetProperty('label', $AC->lang($contentBlock->GetProperty('label')));
         }
         # deprecated (should not be needed since CMSms 1.11)
         if ($contentBlock->GetProperty('multiple') && ac_admin_ops::GetVisibility('message', $block_id, $content_obj->Id(), $content_obj->TemplateId())) {
             $hide_link = str_replace('&amp;', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_message'), array('item_type' => 'message', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => 0), '', false, '', 'onclick="jQuery.get(this.href); jQuery(\'#' . $block_id . '_message\').toggle(\'fast\',function(){jQuery(this).remove()}); return false;"'));
             $contentBlock->SetProperty('message', $AC->lang('notice_duplicatecontent', $contentBlock->GetProperty('name')) . ' (' . $hide_link . ')');
         }
         #---
         $contentBlock->SetBlockTypeProperties();
     }
     if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE && ac_utils::is_frontend_request() || !ac_utils::is_frontend_request()) {
         $content_obj->AddExtraProperty($block_id);
         # backward compatibility (deprecated)
         self::$_content_blocks[$content_obj->Id()][$block_id] = $contentBlock;
     }
 }
    public function GetInput()
    {
        if (!$this->GetContent()) {
            $this->SetContent(time());
        }
        setlocale(LC_ALL, get_preference(get_userid(), 'default_cms_language'));
        $date = strftime('%x', intval($this->GetContent()));
        $time = '0:0';
        if ($this->GetProperty('show_clock')) {
            $time = strftime('%H:%M', intval($this->GetContent()));
        }
        $_tmp = ac_utils::CleanArray(explode(':', $time));
        $timeSeconds = $_tmp[0] * 3600 + $_tmp[1] * 60;
        $dateSeconds = $this->GetContent() - $timeSeconds;
        $dateInput = '<input id="' . $this->GetProperty('id') . '_AdvancedContentDatePickerDisplay" type="text" value="' . $date . '" />
			<input id="' . $this->GetProperty('id') . '_AdvancedContentDate" type="hidden" name="' . $this->GetProperty('id') . '[date]" value="' . $dateSeconds * 1000 . '" />';
        $suffix = '';
        $timeInput = '';
        if ($this->GetProperty('show_clock')) {
            $timeInput = '&nbsp;&nbsp;-&nbsp;&nbsp;<select name="' . $this->GetProperty('id') . '[time]">';
            $_i = 0;
            for ($i = $this->GetProperty('start_hour'); $i <= $this->GetProperty('end_hour'); $i += $this->GetProperty('step_hours')) {
                if ($i < 12 && !$this->GetProperty('show24h')) {
                    $suffix = ' am';
                } else {
                    if (!$this->GetProperty('show24h')) {
                        $suffix = ' pm';
                    }
                }
                for ($j = $this->GetProperty('start_minute'); $j <= $this->GetProperty('end_minute'); $j += $this->GetProperty('step_minutes')) {
                    $value = $i * 3600 + $j * 60;
                    if ($this->GetProperty('end_hour') < 23 && $value <= $this->GetProperty('end_hour') * 3600 || $this->GetProperty('end_hour') == 23) {
                        $timeInput .= '<option value="' . $value . '"' . ($value == $timeSeconds ? ' selected="selected"' : '') . '>' . ($i < 10 ? '0' . $i : (!$this->GetProperty('show24h') && $i > 12 ? $i - 12 : $i)) . ':' . ($j < 10 ? '0' . $j : $j) . $suffix . '</option>';
                    }
                }
                $j = $this->GetProperty('start_minute');
            }
            $timeInput .= '</select>';
        }
        return $dateInput . $timeInput;
    }
 $times[$this->lang('weeks')] = 'week';
 $times[$this->lang('months')] = 'month';
 $times[$this->lang('years')] = 'year';
 $start_date = explode(' ', $this->GetPreference("start_date", '1 week'));
 $end_date = explode(' ', $this->GetPreference("end_date", '1 week'));
 $this->smarty->assign('start_date_text', $this->lang('startdate'));
 $this->smarty->assign('start_date_input', $this->CreateInputText($id, 'AdvancedContentStartDate', $start_date[0], 3, 5) . $this->CreateInputDropdown($id, 'AdvancedContentStartTime', $times, '', $start_date[1]) . '&nbsp;' . $this->lang('aftercurrdate'));
 $this->smarty->assign('end_date_text', $this->lang('enddate'));
 $this->smarty->assign('end_date_input', $this->CreateInputText($id, 'AdvancedContentEndDate', $end_date[0], 3, 5) . $this->CreateInputDropdown($id, 'AdvancedContentEndTime', $times, '', $end_date[1]) . '&nbsp;' . $this->lang('afterstartdate'));
 if ($feusers =& $this->GetModuleInstance('FrontEndUsers')) {
     $this->smarty->assign('feuaccess_text', $this->lang('frontendaccess'));
     $feuAccess = array($this->lang('inherit_from_parent') => -1);
     $feuAccess = array_merge($feuAccess, $feusers->GetGroupList());
     $selectedGroups = $this->GetPreference('feu_access');
     $delim = strpos($selectedGroups, ',') === FALSE ? ';' : ',';
     $selectedGroups = ac_utils::CleanArray(explode($delim, $selectedGroups));
     $this->smarty->assign('feuaccess_input', $this->CreateInputHidden($id, 'feu_access', '') . $this->CreateInputSelectList($id, 'feu_access[]', $feuAccess, $selectedGroups, count($feuAccess), !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : '', 1));
     $this->smarty->assign('redirectpage_text', $this->lang('redirectpage'));
     $this->smarty->assign('redirectpage_input', ac_admin_ops::CreateRedirectDropdown($id, 'redirect_page', $this->GetPreference('redirect_page')));
     $this->smarty->assign('inherit_text', $this->lang('inherit_from_parent'));
     $this->smarty->assign('redirectparams_text', $this->lang('redirectparams'));
     $this->smarty->assign('evaluatesmarty_text', $this->lang('evaluatesmarty'));
     $inheritParams = $this->GetPreference('inherit_feu_params', 0);
     $this->smarty->assign('inherit_feu_params_input', $this->CreateInputHidden($id, 'inherit_feu_params', 0) . $this->CreateInputCheckbox($id, 'inherit_feu_params', 1, $inheritParams, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('feu_params_text', $this->lang('feu_params'));
     $this->smarty->assign('feu_params_input', $this->CreateInputText($id, 'feu_params', $this->GetPreference('feu_params'), 32, 128, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('feu_params_smarty_text', $this->lang('feu_params_smarty'));
     $this->smarty->assign('feu_params_smarty_input', $this->CreateInputHidden($id, 'feu_params_smarty', 0) . $this->CreateInputCheckbox($id, 'feu_params_smarty', 1, $this->GetPreference('feu_params_smarty'), !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $inheritParams = $this->GetPreference('inherit_custom_params', 0);
     $this->smarty->assign('inherit_custom_params_input', $this->CreateInputHidden($id, 'inherit_custom_params', 0) . $this->CreateInputCheckbox($id, 'inherit_custom_params', 1, $inheritParams, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('custom_params_text', $this->lang('custom_params'));
 /**
  * Smarty Plugin : {get_global_contents}
  * Purpose       : This plugin displays properties of global content blocks of CMSms 
  *                 divided by a separator
  * Author        : Georg Busch (NaN)
  * Copyright     : 2010 - 2012 Georg Busch (NaN)
  * Version       : 1.0
  * License       : GPL
  */
 public static function get_global_contents($params, &$obj)
 {
     if (version_compare(CMS_VERSION, '1.11') < 0) {
         $smarty =& $obj;
     } else {
         $smarty =& $obj->smarty;
     }
     $gcbs = cmsms()->GetGlobalContentOperations()->LoadHtmlBlobs();
     $delimiter = "<hr />";
     if (isset($params['delimiter']) && trim($params['delimiter']) != '') {
         $delimiter = trim($params['delimiter']);
     }
     $excl_prefix = array();
     $incl_prefix = array();
     $excl_sufix = array();
     $incl_sufix = array();
     if (isset($params['excl_prefix'])) {
         $excl_prefix = ac_utils::CleanArray(explode(',', $params['excl_prefix']));
     }
     if (isset($params['excl_sufix'])) {
         $excl_sufix = ac_utils::CleanArray(explode(',', $params['excl_sufix']));
     }
     if (isset($params['incl_prefix'])) {
         $incl_prefix = ac_utils::CleanArray(explode(',', $params['incl_prefix']));
     }
     if (isset($params['incl_sufix'])) {
         $incl_sufix = ac_utils::CleanArray(explode(',', $params['incl_sufix']));
     }
     $assign_as = 'string';
     if (isset($params['assign_as'])) {
         $assign_as = $params['assign_as'];
     }
     $output = 'content';
     // name, id, owner, modified_date, full_object
     if (isset($params['output'])) {
         $output = $params['output'];
     }
     $sort_by = 'id';
     if (isset($params['sort_by'])) {
         $sort_by = $params['sort_by'];
     }
     $sort_order = 'asc';
     if (isset($params['sort_order'])) {
         $sort_order = $params['sort_order'];
     }
     $gcb_array = array();
     foreach ($gcbs as $gcb) {
         $skip = false;
         foreach ($excl_prefix as $str) {
             if (startswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($incl_prefix as $str) {
             if (!startswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($excl_sufix as $str) {
             if (endswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($incl_sufix as $str) {
             if (!endswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         switch ($sort_by) {
             case 'name':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->name] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->name] = $gcb->{$output};
                 break;
             case 'modified_date':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->modified_date] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->modified_date] = $gcb->{$output};
                 break;
             case 'owner':
             case 'owner+create_date':
             case 'owner+id':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->id] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->id] = $gcb->{$output};
                 break;
             case 'owner+name':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->name] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->name] = $gcb->{$output};
                 break;
             case 'owner+modified_date':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->modified_date] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->modified_date] = $gcb->{$output};
                 break;
             case 'id':
             case 'create_date':
             default:
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->id] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->id] = $gcb->{$output};
                 break;
         }
     }
     if ($sort_order == 'desc') {
         krsort($gcb_array);
     } else {
         ksort($gcb_array);
     }
     if (isset($params['assign'])) {
         if ($assign_as == "array") {
             $smarty->assign($params['assign'], $gcb_array);
             return;
         }
         $smarty->assign($params['assign'], implode($delimiter, $gcb_array));
         return;
     }
     return implode($delimiter, $gcb_array);
 }
 private static function _set_block_group($content_obj, &$contentBlock)
 {
     if ($contentBlock->GetProperty('block_group') == '') {
         return;
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $page_tab_id = $contentBlock->GetProperty('page_tab');
     $block_tab_id = $contentBlock->GetProperty('block_tab');
     $group_name = $contentBlock->GetProperty('block_group');
     $group_id = ($block_tab_id ? $block_tab_id : $page_tab_id) . '_' . ac_utils::CleanStrId($group_name);
     $tab_array = $block_tab_id ? self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['block_groups'] : self::$_tabs[$page_tab_id]['block_groups'];
     if (!isset($tab_array[$group_id])) {
         $collapsible = $contentBlock->GetProperty('collapsible');
         $group_display = $collapsible ? ac_admin_ops::GetVisibility('group', $group_id, $content_obj->Id(), $content_obj->TemplateId(), !$AC->GetPreference('collapse_group_default', 1)) : true;
         $pref_url = $collapsible ? str_replace('&amp;', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_group'), array('item_type' => 'group', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $group_id, 'item_display' => !$group_display), '', true)) : '#';
         $tab_array[$group_id] = array('group_id' => $group_id, 'group_name' => $group_name, 'collapsible' => $collapsible, 'display' => $group_display, 'pref_url' => $pref_url);
     }
     $block_id = $contentBlock->GetProperty('id');
     $tab_array[$group_id]['content_blocks'][$block_id] = $block_id;
     if ($block_tab_id) {
         self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['block_groups'] = $tab_array;
         unset(self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['content_blocks'][$block_id]);
     } else {
         self::$_tabs[$page_tab_id]['block_groups'] = $tab_array;
     }
     unset(self::$_tabs[$page_tab_id]['content_blocks'][$block_id]);
 }
 public static function EditAsArray(&$content_obj, $adding = false, $tab = 0, $showadmin = false)
 {
     if (!($tab_id = acTabManager::GetTabId($tab))) {
         return array();
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $ret = array();
     $tmp = array();
     if ($tab_id == 'main' || $tab_id == 'options' && check_permission(get_userid(), 'Manage All Content')) {
         $tmp = ac_utils::CleanArray($content_obj->DisplayAttributes($adding, $tab));
     } else {
         if ($tab_id == 'AdvancedContent') {
             $tmp = self::DisplayAdvancedOptions($content_obj, $adding);
         }
     }
     foreach ($tmp as $one) {
         $ret[] = $one;
     }
     $AC->smarty->assign_by_ref('content_obj', $content_obj);
     $AC->smarty->assign('tab', acTabManager::GetTab($tab_id));
     $AC->smarty->assign('locale', substr(get_preference(get_userid(), 'default_cms_language'), 0, 2));
     if ($tab == 0) {
         $html = $AC->GetHeaderHTML() . '<!-- start ac blocktypes head -->';
         $blockTypes =& acContentBlockManager::GetBlockTypes();
         foreach ($blockTypes as &$btype) {
             if ($btype['header_html_called']) {
                 continue;
             }
             $btype['header_html_called'] = true;
             $blocks = $btype['content_blocks'];
             $block_id = array_shift($blocks);
             $contentBlock =& $content_obj->GetContentBlock($block_id);
             if ($contentBlock->Type() == AC_INVALID_BLOCK_TYPE) {
                 continue;
             }
             $html .= $contentBlock->GetHeaderHTML();
         }
         echo $html . '<!-- end ac blocktypes head -->';
     }
     $ret[] = array('', $AC->ProcessTemplate('editcontent.tpl'));
     return $ret;
 }
Example #15
0
 /**
  * Just gets all frontend user groups a frontend user belongs to
  * and caches them in a member variable
  * @param int $userid - the id of the user
  * @return array
  */
 private function GetFeuGroups($userid)
 {
     if (!$userid) {
         return false;
     }
     if (($feusers =& self::get_module('FrontEndUsers')) && !self::$_feuGroups) {
         self::$_feuGroups = $feusers->GetMemberGroupsArray($userid);
     }
     return self::$_feuGroups;
 }
Example #16
0
     $this->SetPreference('group_display_settings', $params['group_display_settings']);
 }
 if (isset($params['collapse_group_default'])) {
     $this->SetPreference('collapse_group_default', $params['collapse_group_default']);
 }
 if (isset($params['use_expire_date'])) {
     $this->SetPreference('use_expire_date', $params['use_expire_date']);
 }
 if (isset($params['AdvancedContentStartDate'])) {
     $this->SetPreference('start_date', intval($params['AdvancedContentStartDate']) . ' ' . $params['AdvancedContentStartTime']);
 }
 if (isset($params['AdvancedContentEndDate'])) {
     $this->SetPreference('end_date', intval($params['AdvancedContentEndDate']) . ' ' . $params['AdvancedContentEndTime']);
 }
 if (isset($params['feu_access'])) {
     $this->SetPreference('feu_access', implode(',', ac_utils::CleanArray($params['feu_access'])));
 }
 if (isset($params['redirect_page'])) {
     $this->SetPreference('redirect_page', $params['redirect_page']);
 }
 if (isset($params['feu_params'])) {
     $this->SetPreference('feu_params', $params['feu_params']);
 }
 if (isset($params['feu_params_smarty'])) {
     $this->SetPreference('feu_params_smarty', $params['feu_params_smarty']);
 }
 if (isset($params['inherit_feu_params'])) {
     $this->SetPreference('inherit_feu_params', $params['inherit_feu_params']);
 }
 if (isset($params['custom_params'])) {
     $this->SetPreference('custom_params', $params['custom_params']);
Example #17
0
    $module =& ac_utils::get_module($modulename);
    if (is_object($module) && $module->IsPluginModule()) {
        @ob_start();
        $params = GetModuleParameters($id);
        $returnid = isset($params['returnid']) ? $params['returnid'] : $content_obj->Id();
        $output = $module->DoActionBase($action, $id, $params, $returnid);
        if ($output !== FALSE && (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output']))) {
            echo $output;
        }
        $output = @ob_get_contents();
        @ob_end_clean();
    }
} else {
    $oldvalue = cmsms()->GetSmarty()->caching;
    cmsms()->GetSmarty()->caching = false;
    $contentId = $content_obj->Id();
    $output = cmsms()->GetSmarty()->fetch(str_replace(' ', '_', 'content:' . $block), '|' . $block, $contentId . $block);
    cmsms()->GetSmarty()->caching = $oldvalue;
    $defaultValue = isset($params['default']) ? trim($params['default']) : '';
    $doSmarty = isset($params['smarty']) && ac_utils::IsTrue($params['smarty']);
    if ($doSmarty) {
        $defaultValue = ac_utils::DoSmarty($content_obj, $defaultValue);
    }
    $allowNone = !isset($params['allow_none']) || ac_utils::IsFalse($params['allow_none']);
    if ($output == '' && !$allowNone) {
        $output = $defaultValue;
    }
}
if (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output'])) {
    echo trim($output);
}
 public function FillParams(&$params, $editing = false)
 {
     $blockId = $this->GetProperty('id');
     $multi_inputs = array();
     $value = '';
     $blockType =& acContentBlockManager::GetBlockType('multi_input');
     $multiInput_props = $blockType['props'];
     foreach (ac_utils::CleanArray(explode(',', $this->GetProperty('inputs'))) as $k1 => $multi_input_id) {
         $multi_input_values = array();
         foreach ($multiInput_props[$multi_input_id]['elements'] as $k2 => $inputBlock) {
             if (isset($params['multiInput-' . $blockId . '-' . $multi_input_id . '-' . $k1 . '-' . $k2])) {
                 $inputBlock->SetProperty('id', 'multiInput-' . $blockId . '-' . $multi_input_id . '-' . $k1 . '-' . $k2);
                 $multi_input_values[] = $inputBlock->FillParams($params, $editing);
             }
         }
         $multi_inputs[] = implode($this->GetProperty('value_delimiter'), $multi_input_values);
     }
     if (!ac_utils::IsVarEmpty($multi_inputs)) {
         $value = implode($this->GetProperty('input_delimiter'), $multi_inputs);
     }
     return $value;
 }
 /**
  * Function for the subclass to perform the blocks compiled output in frontend.<br />
  * Needs to be overwritten if the blocktype provides a special kind of data that needs to be processed before compiling it in frontend.
  * @param $obj
  * @return string
  * @since 0.9.4
  */
 public function GetCompiledContent(&$obj)
 {
     $id = '';
     $modulename = '';
     $action = '';
     $inline = false;
     if (isset($_REQUEST['module'])) {
         $modulename = $_REQUEST['module'];
     }
     if (isset($_REQUEST['id'])) {
         $id = $_REQUEST['id'];
     } elseif (isset($_REQUEST['mact'])) {
         $ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4);
         $modulename = isset($ary[0]) ? $ary[0] : '';
         $id = isset($ary[1]) ? $ary[1] : '';
         $action = isset($ary[2]) ? $ary[2] : '';
         $inline = isset($ary[3]) && $ary[3] == 1 ? true : false;
     }
     if (isset($_REQUEST[$id . 'action'])) {
         $action = $_REQUEST[$id . 'action'];
     } else {
         if (isset($_REQUEST['action'])) {
             $action = $_REQUEST['action'];
         }
     }
     if ($this->_properties['id'] == 'content_en' && ($id == 'cntnt01' || $id == '_preview_' || $id != '' && $inline == false)) {
         $module =& ac_utils::get_module($modulename);
         if (is_object($module) && $module->IsPluginModule()) {
             @ob_start();
             $params = GetModuleParameters($id);
             $returnid = isset($params['returnid']) ? $params['returnid'] : $this->content_obj->Id();
             echo $module->DoActionBase($action, $id, $params, $returnid);
             $output = @ob_get_contents();
             @ob_end_clean();
         }
     } else {
         if (version_compare(CMS_VERSION, '1.11') < 0) {
             $smarty =& $obj;
         } else {
             $smarty =& $obj->smarty;
         }
         $oldvalue = $smarty->caching;
         $smarty->caching = false;
         if ($id == '_preview_' || $id == '') {
             $output = $smarty->fetch('string:' . $this->GetContent());
         } else {
             $output = $smarty->fetch(str_replace(' ', '_', 'content:' . $this->_properties['id']), '|' . $this->_properties['id'], $this->content_obj->Id() . $this->_properties['id']);
         }
         $smarty->caching = $oldvalue;
         if ($output == '' && !$this->_properties['allow_none']) {
             $output = $this->_properties['default'];
         }
     }
     if (!empty($this->_properties['assign'])) {
         $smarty->assign($this->_properties['assign'], $output);
         return '';
     }
     return trim($output);
 }