private function _isAuthorized()
 {
     // do we have access to it?
     $this->_getData();
     $feu = cms_utils::get_module('FrontEndUsers');
     if (!$feu) {
         return FALSE;
     }
     $uid = $feu->LoggedInId();
     if (!$uid) {
         return FALSE;
     }
     // not logged in is a false.
     if (!isset($this->_data['groups']) || count($this->_data['groups']) == 0) {
         // no member groups selected, but still logged in, we can display this.
         return TRUE;
     }
     // get member groups and do a cross reference.
     $groups = $feu->GetMemberGroupsArray($uid);
     if (!is_array($groups) || count($groups) == 0) {
         return FALSE;
     }
     $membergroups = cge_array::extract_field($groups, 'groupid');
     for ($i = 0; $i < count($this->_data['groups']); $i++) {
         if (in_array($this->_data['groups'][$i], $membergroups)) {
             return TRUE;
         }
     }
     // no match.
     return FALSE;
 }
            }
            $query .= ')';
        }
        if (isset($params['unique_only']) && $params['unique_only']) {
            $query .= ' GROUP BY ev.event_title';
        }
        if (count($having)) {
            $query .= ' HAVING ';
            $query .= '(' . implode(' AND ', $having) . ')';
        }
        $query .= ' ORDER BY ev.event_date_start ASC';
        $searchresults = $db->GetArray($query, $qparms);
        if (!$searchresults && $db->ErrorMsg != '') {
            $error = $this->Lang('error_query_failed');
        }
        $searchresults = cge_array::extract_field($searchresults, 'event_id');
    }
}
$tpl = $this->CreateSmartyTemplate($thetemplate, 'searchresult_');
// calculate pagination stuff
// and the subset of event ids.
$numpages = 0;
$num_matches = 0;
if (!empty($searchresults)) {
    $num_matches = count($searchresults);
    $numpages = (int) (count($searchresults) / $limit);
    if (count($searchresults) % $limit > 0) {
        $numpages++;
    }
    $startoffset = ($pagenum - 1) * $limit;
    $entries = cgcalendar_utils::expand_events($searchresults, $returnid, $params, $limit, $startoffset);
// put the query together
if (count($where)) {
    $query .= ' WHERE ' . implode(' AND ', $where);
}
$rs = $db->SelectLimit($query, $limit, 0, $parms);
$list1 = array();
debug_to_log($db->sql);
while (!$rs->EOF) {
    $list1[] = $rs->fields;
    $rs->MoveNext();
}
unset($rs);
debug_to_log($list1);
if (count($list1)) {
    // get the categorie(s) for these events
    $idlist = cge_array::extract_field($list1, 'event_id');
    $query = 'SELECT * FROM ' . $this->events_to_categories_table_name . ' WHERE event_id IN (' . implode(',', $idlist) . ') ORDER BY event_id,category_id';
    $tmp = $db->GetArray($query);
    $category_list = array();
    if (is_array($tmp) && count($tmp)) {
        foreach ($tmp as $rec) {
            $category_list[$rec['event_id']][] = $rec['category_id'];
        }
    }
    // now convert this into something compatible with fullcalendar
    $outlist = array();
    foreach ($list1 as $rec) {
        try {
            $out = new stdClass();
            $out->id = $rec['event_id'];
            $out->title = $rec['event_title'];
$this->SetCurrentTab('fields');
$nupdates = 0;
$nadds = 0;
$ids = $params['field_ids'];
// (old names... empty value indicates an add)
$names = $params['field_names'];
$types = $params['field_types'];
if (isset($params['field_searchable'])) {
    $searchable = $params['field_searchable'];
}
if (isset($params['field_wysiwyg'])) {
    $wysiwyg = $params['field_wysiwyg'];
}
// find deletions.
$fields = $this->GetFields();
$field_names = cge_array::extract_field($fields, 'field_name');
$deleted = array();
foreach ($field_names as $name) {
    if ($name == '') {
        continue;
    }
    if (!in_array($name, $names)) {
        _cgcalDeleteField($name);
    }
}
// now process new records and updates
$num_records = count($ids);
$field_order = -1;
for ($i = 0; $i < $num_records; $i++) {
    $field_oldname = $ids[$i];
    $field_newname = trim($names[$i]);