コード例 #1
0
function module_action_url($params, &$tpl)
{
    $params['urlonly'] = 1;
    $assign = \cge_param::get_string($params, 'assign');
    unset($params['imageonly'], $params['text'], $params['title'], $params['image'], $params['class'], $params['assign']);
    $out = module_action_link($params, $tpl);
    if ($assign) {
        $tpl->assign($assign, $out);
        return;
    }
    return $out;
}
コード例 #2
0
 public function __construct()
 {
     $input = func_get_args();
     if (count($input) == 1 && is_array($input[0])) {
         $input = $input[0];
     }
     if (cge_array::is_hash($input)) {
         $this->_wmtext = \cge_param::get_string($input, 'text');
     } else {
         if (is_array($input) && count($input) >= 1) {
             $tmp = \cge_param::get_string($input, 0);
             if (is_string($tmp) && !is_numeric($tmp)) {
                 $this->_wmtext = $tmp;
             }
         }
     }
 }
コード例 #3
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!$gCms) {
    exit;
}
if (cmsms()->is_frontend_request()) {
    throw new \LogicException(__METHOD__ . ' cannot be used for frontend requests.');
}
$formdata = $mod = null;
try {
    $params = \cge_utils::decrypt_params($params);
    $module_name = cge_param::get_string($params, '_m');
    $class = cge_param::get_string($params, '_c');
    $item_id = cge_param::get_int($params, '_i');
    $mod = \cms_utils::get_module($module_name);
    if (!$mod) {
        throw new \LogicException("Could not get instance of module " . $module_name);
    }
    $formdata = $class::get_addedit_formdata();
    if (!$formdata instanceof \CGExtensions\lookup_form_data) {
        throw new \LogicException('Problem occurred getting form data for lookup table: ' . $class);
    }
    $formdata->validate();
    if ($item_id < 1) {
        throw new \LogicException('Invalid item id specified for move lookup item');
    }
    $class::delete($item_id);
} catch (\Exception $e) {
コード例 #4
0
<?php

if (!isset($gCms)) {
    exit;
}
if (!$this->CheckPermission('Modify Calendar') && !$this->CheckPermission('Add Calendar Events') && !$this->CheckPermission('Edit My Calendar Events')) {
    exit;
}
$start = cge_param::get_string($_REQUEST, 'start');
$end = cge_param::get_string($_REQUEST, 'end');
$showchildren = (int) cge_utils::get_param($params, 'showchildren', 0);
$category = (int) cge_utils::get_param($params, 'category', -1);
$keyword = trim(cge_utils::get_param($params, 'keyword'));
$when = strtolower(trim(cge_utils::get_param($params, 'when', 'any')));
// when can only be used when start/end are not specified.
$limit = cge_utils::get_param($params, 'limit', 1000);
// 1000 is more than enough.
debug_to_log(__FILE__);
debug_to_log($_REQUEST);
debug_to_log("{$start} - {$end}");
$st_ds = $db->DbTimeStamp($start);
$en_ds = $db->DbTimeStamp($end);
if ($start < 1 || $end < 1) {
    switch ($when) {
        case 'past':
            $start = 1;
            $end = time();
            break;
        case 'future':
            $start = time();
            $end = 2147483648.0;
コード例 #5
0
// deprecated
$navigation['ni_next'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_next'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$parms['week'] = $reverse ? $week + 1 : $week - 1;
$navigation['prev'] = $this->CreateURL($id, 'default', $returnid, $parms, $inline);
// deprecated
$navigation['ni_prev'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_prev'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$parms['week'] = date('W');
$parms['year'] = date('Y');
$navigation['current'] = $this->CreateURL($id, 'default', $returnid, $parms, $inline);
// deprecated
$navigation['ni_current'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_current'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$day_names = $this->GetDayNames();
$day_short_names = $this->GetDayShortNames();
// assign to Smarty
$thetemplate = $this->GetPreference(CGCALENDAR_PREF_DFLTLIST_TEMPLATE);
$thetemplate = \cge_param::get_string($params, 'listtemplate', $thetemplate);
$tpl = $this->CreateSmartyTemplate($thetemplate, 'list_');
$tpl->assign('start_date_ut', $start_ut);
$tpl->assign('end_date_ut', $end_ut);
$tpl->assign('day_names', $day_names);
$tpl->assign('day_short_names', $day_short_names);
$tpl->assign('events', $events);
$tpl->assign('year', $year);
$tpl->assign('week', $week);
$tpl->assign('lang', $this->GetLabels());
$tpl->assign('navigation', $navigation);
$tpl->assign('file_location', cgcalendar_utils::get_upload_location());
$tpl->display();
コード例 #6
0
            }
        } else {
            if (isset($cat_map[$one])) {
                $categories[] = $cat_map[$one];
            }
        }
    }
}
// resolve the editpage
$editpage = $returnid;
$tmp = $this->GetPreference('frontend_redirectpage', '');
if ($tmp) {
    $tmp = $this->ProcessTemplateFromData($tmp);
    $editpage = $this->resolve_alias_or_id($tmp, $editpage);
}
$tmp = \cge_param::get_string($params, 'editpage');
if ($tmp) {
    $editpage = $this->resolve_alias_or_id($tmp, $editpage);
}
$feu = \cms_utils::get_module('FrontEndUsers');
$feu_uid = null;
if ($feu) {
    $feu_uid = $feu->LoggedInId();
}
$st_ds = $db->DbTimeStamp($start);
$en_ds = $db->DbTimeStamp($end);
if ($start < 1 || $end < 1) {
    switch ($when) {
        case 'past':
            $start = 1;
            $end = time();
コード例 #7
0
 /**
  * @ignore
  */
 public function generate_ga()
 {
     // generate analytics stuff
     $property_id = \cge_param::get_string($this->_config, 'cghm_ga_propertyid');
     if (!$property_id) {
         return;
     }
     $linkdomains = \cge_param::get_string($this->_config, 'cghm_ga_linkdomains');
     if ($linkdomains) {
         $linkdomains = $this->str_to_array($linkdomains);
     }
     $subdomains = \cge_param::get_bool($this->_config, 'cghm_ga_subdomains');
     $domain = \cge_param::get_string($this->_config, 'cghm_ga_domain');
     if ($subdomains && !$domain) {
         $sysconfig = \cms_config::get_instance();
         $url = new \cms_url($sysconfig['root_url']);
         $domain = $url->get_host();
     }
     $tpl = $this->CreateSmartyTemplate('google_analytics.tpl');
     $tpl->assign('content_obj', \cms_utils::get_current_content());
     $tpl->assign('config', $this->_config);
     $tpl->assign('domain', $domain);
     if (count($linkdomains)) {
         $tpl->assign('linkdomains', $linkdomains);
     }
     return $tpl->fetch();
 }
コード例 #8
0
}
//
// Initialization
//
$feu = $this->GetModuleInstance('FrontEndUsers');
if (!is_object($feu)) {
    return;
}
// no feu module.
$feu_uid = $feu->LoggedInId();
if ($feu_uid <= 0) {
    return;
}
// not logged in
$thetemplate = $this->GetPreference(CGCALENDAR_PREF_DFLTMYEVENTS_TEMPLATE);
$thetemplate = \cge_param::get_string($params, 'myeventstemplate', $thetemplate);
$destpage = $returnid;
$tmp = $this->GetPreference('frontend_redirectpage', '');
$tmp = $this->ProcessTemplateFromData($tmp);
if (isset($params['editpage'])) {
    $tmp = trim($params['editpage']);
}
if ($tmp) {
    $tmp = $this->resolve_alias_or_id($tmp);
}
if ($tmp) {
    $destpage = $tmp;
}
//
// Get data
//
コード例 #9
0
 $formdata->validate();
 $item = new $class();
 if ($item_id > 0) {
     $item = $class::load($item_id);
 }
 // handle the form
 if (isset($params['cancel'])) {
     // @todo add showmessage here.
     if ($formdata->cancel_message) {
         $mod->SetMessage($formdata->cancel_message);
     }
     $mod->RedirectToTab($id, $formdata->return_tab, '', $formdata->return_action);
 } else {
     if (isset($params['submit'])) {
         $in_edit = $item->id > 0 ? TRUE : FALSE;
         $item->name = cge_param::get_string($params, 'name');
         $item->description = cge_param::get_html($params, 'description');
         $item->save();
         // all done.
         if ($in_edit) {
             if ($formdata->post_edit_message) {
                 $mod->SetMessage($formdata->post_edit_message);
             }
         } else {
             if ($formdata->post_add_message) {
                 $mod->SetMessage($formdata->post_add_message);
             }
         }
         $mod->RedirectToTab($id, $formdata->return_tab, '', $formdata->return_action);
     }
 }
コード例 #10
0
        $this->SetPreference('overlap_action', $overlap_action);
        $this->SetPreference('firstdayofweek', $firstdayofweek);
        $this->SetPreference('use_twelve_hour_clock', $use_twelve_hour_clock);
        $this->SetPreference('defaultcalendarpage', $_POST['parent_id']);
        $this->SetPreference('default_category', $default_category);
        $this->SetPreference('force_category', $force_category);
        $this->SetPreference('showpastyears', $showpastyears);
        $this->SetPreference('showfutureyears', $showfutureyears);
        $this->SetPreference('hidesummary', $hidesummary);
        $this->SetPreference('hidecontent', $hidecontent);
        $this->SetPreference('uploaddirectory', $uploaddirectory);
        $this->SetPreference('uploadfiletypes', $uploadfiletypes);
        $this->SetPreference('uploadunique', $uploadunique);
        $this->SetPreference('friendlyname', trim($params['friendlyname']));
        $this->SetPreference('dflt_fgcolor', trim($params['dflt_fgcolor']));
        $this->SetPreference('dflt_bgcolor', trim($params['dflt_bgcolor']));
        $this->SetPreference('ical_holidays', \cge_param::get_string($params, 'ical_holidays'));
        $this->SetPreference('url_prefix', get_parameter_value($params, 'url_prefix', 'calendar'));
        $this->SetPreference('dflt_alldayevent', get_parameter_value($params, 'dflt_alldayevent', 0));
        $this->SetPreference('holiday_fgcolor', trim($params['holiday_fgcolor']));
        $this->SetPreference('holiday_bgcolor', trim($params['holiday_bgcolor']));
        $start_time = '';
        $start_time = get_parameter_value($params, 'dflt_starttime_Hour', 12) . ':' . get_parameter_value($params, 'dflt_starttime_Minute', 00);
        $this->SetPreference('dflt_starttime', $start_time);
        if (isset($params['frontend_group'])) {
            $this->SetPreference('frontend_group', $params['frontend_group']);
        }
        $this->SetPreference('frontend_redirectpage', $frontend_redirectpage);
    }
    $this->RedirectToTab($id);
}
コード例 #11
0
$feu = $this->GetModuleInstance('FrontEndUsers');
if (!$feu) {
    echo '<h3><font color="red">' . $this->Lang('error_nofeu') . "</font></h3>\n";
    return;
} else {
    if (!$feu->LoggedIn()) {
        echo '<h3><font color="red">' . $this->Lang('error_feu_loggedin') . "</font></h3>\n";
        return;
    }
}
//
// initialization
//
$feu_uid = $feu->LoggedInId();
$thetemplate = $this->GetPreference(CGCALENDAR_PREF_DFLTEDITEVENT_TEMPLATE);
$thetemplate = \cge_param::get_string($params, 'editeventtemplate', $thetemplate);
$event_id = get_parameter_value($params, 'event_id', -1);
$event = $this->GetEvent($event_id, $feu_uid);
$fields = $this->GetFields();
$categories = $this->GetCategories();
$policy = $this->GetPreference('overlap_polciy', 'all');
$force_category = $this->GetPreference('force_category', 0);
$destpage = $returnid;
if (isset($params['return_id'])) {
    $destpage = (int) $params['return_id'];
} else {
    $tmp = $this->GetPreference('frontend_redirectpage', '');
    if ($tmp) {
        $tmp = $this->ProcessTemplateFromData($tmp);
        if ($tmp) {
            $tmp = $this->resolve_alias_or_id($tmp);
コード例 #12
0
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!$gCms) {
    exit;
}
if (cmsms()->is_frontend_request()) {
    throw new \LogicException(__METHOD__ . ' cannot be used for frontend requests.');
}
$formdata = $mod = null;
try {
    $params = \cge_utils::decrypt_params($params);
    $module_name = cge_param::get_string($params, '_m');
    $class = cge_param::get_string($params, '_c');
    $item_id = cge_param::get_int($params, '_i');
    $dir = cge_param::get_string($params, '_dir', 'up');
    $mod = \cms_utils::get_module($module_name);
    if (!$mod) {
        throw new \LogicException("Could not get instance of module " . $module_name);
    }
    $formdata = $class::get_addedit_formdata();
    if (!$formdata instanceof \CGExtensions\lookup_form_data) {
        throw new \LogicException('Problem occurred getting form data for lookup table: ' . $class);
    }
    $formdata->validate();
    if ($item_id < 1) {
        throw new \LogicException('Invalid item id specified for move lookup item');
    }
    $item = $class::load($item_id);
    switch ($dir) {
        case 'up':
コード例 #13
0
 public static function cghm_render($params, &$template)
 {
     // make sure that this method is only called once per request.
     static $_done = 0;
     if ($_done != 0) {
         return;
     }
     $_done = 1;
     $groups = \cge_param::get_string($params, 'group');
     $assign = \cge_param::get_string($params, 'assign');
     if ($groups) {
         $groups = self::mod()->str_to_array($groups);
     }
     if (!$groups) {
         $groups = self::mod()->get_groups();
     }
     $out = null;
     $flds = self::mod()->get_fields($groups);
     foreach ($flds as $name) {
         $tmp = self::mod()->render_field($name);
         if ($tmp) {
             $out .= "{$tmp}\n";
         }
     }
     //
     // now do google analytics stuff
     //
     $out .= self::mod()->generate_ga();
     if ($assign) {
         $template->assign($assign, $out);
     } else {
         return $out;
     }
 }
コード例 #14
0
$search_type = 'or';
#
# Setup
#
$limit = \cge_param::get_int($params, 'imit', $limit);
$thetemplate = \cge_param::get_string($params, 'searchresulttemplate', $thetemplate);
$pagenum = \cge_param::get_int($params, 'cal_pagenum', $pagenum);
#
# Get Data
#
#
# Handle Form Submission
#
if (isset($params['cal_search_submit'])) {
    $search_type = \cge_param::get_string($params, 'cal_search_type');
    $search_text = \cge_param::get_string($params, 'cal_search_text');
    $search_category = \cge_param::get_int($params, 'cal_search_category');
    if (isset($params['cal_search_start_date_Month'])) {
        $search_start_date = mktime(isset($params['cal_search_start_date_Hour']) ? (int) $params['cal_search_start_date_Hour'] : 0, isset($params['cal_search_start_date_Minute']) ? (int) $params['cal_search_start_date_Minute'] : 0, 0, (int) $params['cal_search_start_date_Month'], (int) $params['cal_search_start_date_Day'], (int) $params['cal_search_start_date_Year']);
    }
    if (isset($params['cal_search_end_date_Month'])) {
        $search_end_date = mktime(isset($params['cal_search_end_date_Hour']) ? (int) $params['cal_search_end_date_Hour'] : 23, isset($params['cal_search_end_date_Minute']) ? (int) $params['cal_search_end_date_Minute'] : 59, 0, (int) $params['cal_search_end_date_Month'], (int) $params['cal_search_end_date_Day'], (int) $params['cal_search_end_date_Year']);
    }
    // validate results
    if ($search_end_date < $search_start_date) {
        $tmp = $search_start_date;
        $search_start_date = $search_end_date;
        $search_end_date = $tmp;
    }
    if ($search_end_date - $search_start_date < 60) {
        $error = $this->Lang('error_search_invalid_dates');
コード例 #15
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!isset($gCms)) {
    exit;
}
if (!$this->CheckPermission('Modify Modules')) {
    return;
}
if (!isset($config['cg_developer_mode']) || !$config['cg_developer_mode']) {
    return;
}
try {
    $act_module = trim(\cge_param::get_string($params, 'act_module'));
    $act_generate = \cge_param::get_int($params, 'generate');
    if ($act_generate && $act_module) {
        // get the module
        $mod = \cms_utils::get_module($act_module);
        if (!$mod) {
            throw new \LogicException("Could not get instance of module {$act_module}");
        }
        if (!$mod instanceof CGExtensions) {
            throw new \LogicException("{$act_module} is not derived from CGExtensions");
        }
        $generator = new \CGExtensions\internal\ModuleIntegrityCodeGenerator($act_module);
        $generator->generate();
        $this->SetMessage($this->Lang('msg_vrfy_checksumgenerated', $act_module));
    }
    unset($act_module, $act_generate);
コード例 #16
0
# Initialization
#
$thetemplate = $this->GetPreference(CGCALENDAR_PREF_DFLTSEARCH_TEMPLATE);
$destpage = $returnid;
$inline = 0;
$search_category = -1;
$search_start_date = time();
$search_end_date = strtotime('+1 month', $search_start_date);
$search_text = '';
$searchresults = '';
$error = '';
$use_session = '';
#
# Setup
#
$thetemplate = \cge_param::get_string($params, 'searchtemlate', $thetemplate);
$inline = \cge_param::get_int($params, 'inline', 0);
if (isset($params['searchresultpage'])) {
    $tmp = $this->resolve_alias_or_id($params['searchresultpage']);
    if (!empty($tmp)) {
        $destpage = $tmp;
    }
}
if ($destpage != $returnid) {
    $inline = 0;
}
if (isset($params['use_session'])) {
    $search_text = $this->session_get($use_session . 'search_text', $search_text);
    $search_category = $this->session_get($use_session . 'search_category', $search_category);
    $search_start_date = $this->session_get($use_session . 'search_start_date', $search_start_date);
    $search_end_date = $this->session_get($use_session . 'search_end_date', $search_end_date);
コード例 #17
0
}
$category = \cge_param::get_string($params, 'category');
$tpl->assign('firstdayofweek', (int) $this->GetPreference('firstdayofweek', 1));
$tpl->assign('datestrings', $locale_info);
$tpl->assign('text_week', $this->Lang('week'));
$tpl->assign('text_month', $this->Lang('month'));
$tpl->assign('text_day', $this->Lang('day'));
$tpl->assign('text_today', $this->Lang('today'));
$tpl->assign('dflt_fgcolor', $this->GetPreference('dflt_fgcolor', '#ffffff'));
$tpl->assign('dflt_bgcolor', $this->GetPreference('dflt_bgcolor', '#009900'));
$parms = array();
if ($category) {
    $parms['category'] = $category;
}
$fetch_url = $this->create_url('cntnt01', 'ajax_fetchevents', $returnid, $parms);
$fetch_url = str_replace('amp;', '', $fetch_url);
$tpl->assign('fetch_url', $fetch_url);
$tpl->assign('dflt_fgcolor', $this->GetPreference('dflt_fgcolor', '#ffffff'));
$tpl->assign('dflt_bgcolor', $this->GetPreference('dflt_bgcolor', '#009900'));
$tpl->assign('holiday_fgcolor', $this->GetPreference('holidayfgcolor', '#000000'));
$tpl->assign('holiday_bgcolor', $this->GetPreference('holidaybgcolor', '#ccffff'));
$detailpage = $returnid;
$detailpage_str = \cge_param::get_string($params, 'detailpage');
if ($detailpage_str) {
    $detailpage = $this->resolve_alias_or_id($detailpage_str, $detailpage);
}
$tpl->assign('detailpage', $detailpage);
$tpl->display();
#
# EOF
#