function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'image';
     parent::__construct($content_obj, $params);
     $config = cmsms()->GetConfig();
     $this->SetProperty('prefix', isset($params['prefix']) ? $params['prefix'] : 'thumb_');
     $this->SetProperty('exclude', !isset($params['exclude']) || ac_utils::IsFalse($params['exclude']));
     $this->SetProperty('dir', cms_join_path($config['uploads_path'], isset($params['dir']) ? $params['dir'] : get_site_preference('contentimage_path')));
     $this->SetProperty('inputname', isset($params['inputname']) ? $params['inputname'] : $this->GetProperty('id'));
     $this->SetProperty('urlonly', isset($params['urlonly']) && ac_utils::IsTrue($params['urlonly']));
     $this->SetProperty('class', isset($params['class']) ? $params['class'] : '');
     $this->SetProperty('alt', isset($params['alt']) ? $params['alt'] : '');
     $this->SetProperty('css_id', isset($params['id']) ? $params['id'] : '');
     $this->SetProperty('width', isset($params['width']) ? $params['width'] : '');
     $this->SetProperty('height', isset($params['height']) ? $params['height'] : '');
     $this->SetProperty('title', isset($params['title']) ? $params['title'] : '');
 }
 public static function CreateContentBlock(&$content_obj, $params)
 {
     $params['smarty'] = isset($params['smarty']) && (ac_utils::IsTrue($params['smarty']) || $params['smarty'] == 'both' || $params['smarty'] == ac_utils::cms_access());
     # block active ?
     $params['active'] = isset($params['active']) ? $params['active'] : true;
     if ($params['smarty']) {
         $params['active'] = ac_utils::DoSmarty($content_obj, $params['active']);
     }
     if (ac_utils::IsFalse($params['active'])) {
         return false;
     }
     # do not process inactive blocks
     #---
     # additional editors
     $params['editor_groups'] = isset($params['editor_groups']) ? $params['editor_groups'] : NULL;
     $params['editor_users'] = isset($params['editor_users']) ? $params['editor_users'] : NULL;
     if (!ac_utils::is_frontend_request() && ($params['editor_groups'] || $params['editor_users']) && !ac_admin_ops::CheckBlockPermission($params['editor_users'], $params['editor_groups'])) {
         return false;
         # do not process blocks without permission to edit
     }
     #---
     # valid block type?
     $params['block_type'] = isset($params['block_type']) ? strtolower($params['block_type']) : 'text';
     $classname = 'acBlockType_' . $params['block_type'];
     if (!class_exists($classname)) {
         if (!ac_utils::is_frontend_request()) {
             $classname = 'acBlockTypePlaceholder';
         } else {
             return false;
         }
     }
     #---
     # valid block id?
     $params['block_id'] = isset($params['block']) ? preg_replace('/-+/', '_', munge_string_to_url($params['block'])) : 'content_en';
     if (!$params['block_id'] || $content_obj->IsKnownProperty($params['block_id'])) {
         if (!ac_utils::is_frontend_request()) {
             $params['block_id'] = md5($params['block_id'] . '_' . @count(self::$_content_blocks[$content_obj->Id()]));
             # count shouldn't be needed since CMSms 1.11 (multiple blocks with same id are just not possible anymore)
             $classname = 'acBlockTypePlaceholder';
         } else {
             return false;
         }
     }
     #---
     return new $classname($content_obj, $params);
 }
 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);
 }
 /**
  * Constructor.<br />
  * Required for all subclasses.<br />
  * Should be called from each subclass as the very first.
  * @param object $content_obj - the contentobject this block belongs to
  * @param array $params - the parameters of that contentblock
  */
 function __construct(&$content_obj, $params = array())
 {
     $this->content_obj = $content_obj;
     $AC =& ac_utils::get_module('AdvancedContent');
     $this->_properties['smarty'] = isset($params['smarty']) ? $params['smarty'] : false;
     $this->_properties['editor_groups'] = isset($params['editor_groups']) ? $params['editor_groups'] : '';
     $this->_properties['editor_users'] = isset($params['editor_users']) ? $params['editor_users'] : '';
     #deprecated
     $this->_properties['type'] = isset($params['block_type']) ? $params['block_type'] : '';
     $this->_properties['name'] = isset($params['block']) ? $params['block'] : 'content_en';
     $this->_properties['id'] = isset($params['block_id']) ? $params['block_id'] : str_replace(array('-', '+'), '_', munge_string_to_url($this->_properties['name']));
     $this->_properties['label'] = isset($params['label']) ? $params['label'] : ucwords($this->_properties['name']);
     $this->_properties['default'] = isset($params['default']) ? $params['default'] : '';
     $this->_properties['style'] = isset($params['style']) ? $params['style'] : '';
     # deprecated
     $this->_properties['page_tab'] = isset($params['page_tab']) ? $params['page_tab'] : (isset($params['tab']) ? $params['tab'] : 'main');
     $this->_properties['block_tab'] = isset($params['block_tab']) ? $params['block_tab'] : '';
     $this->_properties['block_group'] = isset($params['block_group']) ? $params['block_group'] : '';
     $this->_properties['description'] = isset($params['description']) ? $params['description'] : '';
     $this->_properties['translate_labels'] = isset($params['translate_labels']) && ac_utils::IsTrue($params['translate_labels']);
     $this->_properties['translate_values'] = isset($params['translate_values']) && ac_utils::IsTrue($params['translate_values']);
     $this->_properties['required'] = isset($params['required']) && ac_utils::IsTrue($params['required']);
     $this->_properties['allow_none'] = !(isset($params['allow_none']) && ac_utils::IsFalse($params['allow_none']));
     $this->_properties['no_collapse'] = isset($params['no_collapse']) && ac_utils::IsTrue($params['no_collapse']);
     $this->_properties['collapsible'] = !$this->_properties['no_collapse'] && $this->_properties['type'];
     if (!$this->_properties['collapsible']) {
         $this->_properties['collapse'] = false;
     } else {
         $this->_properties['collapse'] = isset($params['collapse']) ? !ac_utils::IsFalse($params['collapse']) : $AC->GetPreference('collapse_block_default', true);
     }
     $this->_properties['feu_access'] = isset($params['feu_access']) ? $params['feu_access'] : '';
     $this->_properties['feu_action'] = isset($params['feu_action']) && ac_utils::IsTrue($params['feu_action']);
     $this->_properties['feu_hide'] = isset($params['feu_hide']) && ac_utils::IsTrue($params['feu_hide']);
     if (!empty($params['assign'])) {
         $this->_properties['assign'] = str_replace(array('-', '+'), '_', munge_string_to_url($params['assign']));
     }
 }
 function __construct(&$content_obj, $params = array())
 {
     $params['block_type'] = 'date';
     parent::__construct($content_obj, $params);
     $showClock = !(isset($params['show_clock']) && ac_utils::IsFalse($params['show_clock']));
     $mode = 'calendar';
     if (isset($params['mode']) && strtolower($params['mode']) == 'dropdown') {
         $mode = 'dropdown';
     }
     $show24h = !(isset($params['show24h']) && ac_utils::IsFalse($params['show24h']));
     $dateFormat = isset($params['date_format']) ? $params['date_format'] : '%x %X';
     $startHour = 0;
     $endHour = 23;
     if (isset($params['start_hour'])) {
         if (endswith($params['start_hour'], 'pm')) {
             $params['start_hour'] = trim(str_ireplace('pm', '', $params['start_hour'])) + 12;
         } else {
             $params['start_hour'] = trim(str_ireplace(array('am', 'pm'), '', $params['start_hour']));
         }
         if ($params['start_hour'] > 0 && $params['start_hour'] <= $endHour) {
             $startHour = trim($params['start_hour']);
         }
     }
     if (isset($params['end_hour'])) {
         if (endswith($params['end_hour'], 'pm')) {
             $params['end_hour'] = trim(str_ireplace('pm', '', $params['end_hour'])) + 12;
         } else {
             $params['end_hour'] = trim(str_ireplace(array('am', 'pm'), '', $params['end_hour']));
         }
         if ($params['end_hour'] >= 0 && $params['end_hour'] < $endHour) {
             $endHour = trim($params['end_hour']);
         }
     }
     if ($endHour < $startHour) {
         $endHour = $startHour;
     }
     $startMinute = 0;
     if (isset($params['start_minute']) && $params['start_minute'] > 0 && $params['start_minute'] <= 59) {
         $startMinute = trim($params['start_minute']);
     }
     $endMinute = 59;
     if (isset($params['end_minute']) && $params['end_minute'] >= 0 && $params['end_minute'] < 59) {
         $endMinute = trim($params['end_minute']);
     }
     if ($endMinute < $startMinute) {
         $endMinute = $startMinute;
     }
     $startSecond = 0;
     if (isset($params['start_second']) && $params['start_second'] > 0 && $params['start_second'] <= 59) {
         $startSecond = trim($params['start_second']);
     }
     $endSecond = 59;
     if (isset($params['end_second']) && $params['end_second'] >= 0 && $params['end_second'] < 59) {
         $endSecond = trim($params['end_second']);
     }
     if ($endSecond < $startSecond) {
         $endSecond = $startSecond;
     }
     $stepHours = 1;
     if (isset($params['step_hours']) && $params['step_hours'] > 0 && $params['step_hours'] <= $endHour - $startHour) {
         $stepHours = trim($params['step_hours']);
     } else {
         if (isset($params['step_hours']) && $params['step_hours'] > 0 && $params['step_hours'] >= $endHour - $startHour) {
             $stepHours = $endHour - $startHour;
         }
     }
     $stepMinutes = 30;
     if (isset($params['step_minutes']) && $params['step_minutes'] > 0 && $params['step_minutes'] <= $endMinute - $startMinute) {
         $stepMinutes = trim($params['step_minutes']);
     } else {
         if (isset($params['step_minutes']) && $params['step_minutes'] > 0 && $params['step_minutes'] >= $endMinute - $startMinute) {
             $stepMinutes = $endMinute - $startMinute;
         }
     }
     $stepSeconds = 1;
     if (isset($params['step_seconds']) && $params['step_seconds'] > 0 && $params['step_seconds'] <= $endSecond - $startSeconds) {
         $stepSeconds = trim($params['step_seconds']);
     } else {
         if (isset($params['step_seconds']) && $params['step_seconds'] > 0 && $params['step_seconds'] >= $endSecond - $startSeconds) {
             $stepSeconds = $endSecond - $startSeconds;
         }
     }
     $this->SetProperty('show24h', $show24h);
     $this->SetProperty('mode', $mode);
     $this->SetProperty('start_hour', $startHour);
     $this->SetProperty('end_hour', $endHour);
     $this->SetProperty('start_minute', $startMinute);
     $this->SetProperty('end_minute', $endMinute);
     $this->SetProperty('start_second', $startSecond);
     $this->SetProperty('end_second', $endSecond);
     $this->SetProperty('step_hours', $stepHours);
     $this->SetProperty('step_minutes', $stepMinutes);
     $this->SetProperty('step_seconds', $stepSeconds);
     $this->SetProperty('show_clock', $showClock);
     $this->SetProperty('date_format', $dateFormat);
 }
Example #6
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 smarty_compiler_contentblock($params, &$obj)
 {
     $this->_loaded = true;
     foreach ($params as $k => $v) {
         $params[$k] = trim($v, startswith($v, "'") ? "'" : '"');
     }
     if (isset($params['active']) && ac_utils::IsFalse($params['active'])) {
         return;
     }
     # don't process inactive blocks
     if (!($contentBlock = acContentBlockManager::CreateContentBlock($this, $params))) {
         return;
     }
     acContentBlockManager::_register_content_block($this, $contentBlock);
     if (ac_utils::is_frontend_request()) {
         # check block access
         if ($feusers =& ac_utils::get_module('FrontEndUsers')) {
             if ($contentBlock->GetProperty('feu_access') && !ac_utils::FeuIsMemberOf($contentBlock->GetProperty('feu_access'))) {
                 if ($contentBlock->GetProperty('feu_action') && !$this->_feuAction) {
                     $this->_feuAction = true;
                     $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), $feusers->DoAction('default', 'cntnt01', array('form' => 'login'), $this->Id()));
                 } else {
                     $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), '');
                 }
             } else {
                 if ($contentBlock->GetProperty('feu_hide') && $feusers->LoggedInId()) {
                     $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), '');
                 }
             }
         }
         # set default value (if neccessary)
         if (!$contentBlock->GetProperty('allow_none') && $this->GetPropertyValue($contentBlock->GetProperty('id')) == '') {
             $this->SetPropertyValueNoLoad($contentBlock->GetProperty('id'), $contentBlock->GetProperty('default'));
         }
         return $contentBlock->GetCompiledContent($obj);
     }
 }