public static function pkg_subscr_to_expirydate($pkg, $time = '')
 {
     if (!$time) {
         $time = time();
     }
     $expires = '';
     if (!is_array($pkg)) {
         return $expires;
     }
     if (!isset($pkg['subscr_num']) || !isset($pkg['subscr_type'])) {
         return $expires;
     }
     $type = $pkg['subscr_type'];
     switch ($type) {
         case 'month':
         case 'year':
             $type .= 's';
             $expires = strtotime("+{$pkg['subscr_num']} {$type}", $time);
             break;
         case 'none':
         default:
             $feu = cge_utils::get_module('FrontEndUsers');
             if ($feu) {
                 $timeperiod = $feu->GetPreference('expireage_months', 120);
                 $expires = strtotime("+{$timeperiod} months", $time);
             }
             break;
     }
     return $expires;
 }
 private static function lang()
 {
     if (!self::$__mod) {
         self::$__mod = \cge_utils::get_module('CGExtensions');
     }
     $args = func_get_args();
     return call_user_func_array(array(self::$__mod, 'Lang'), $args);
 }
 public static function create_template_dropdown($id, $name, $prefix = '', $selectedvalue = -1, $addtext = '')
 {
     $templates = self::get_templates_by_prefix('', $prefix);
     $items = array();
     foreach ($templates as $onename) {
         $tmp = substr($onename, strlen($prefix));
         $items[$tmp] = $onename;
     }
     return cge_utils::get_module()->CreateInputDropdown($id, $name, $items, -1, $selectedvalue, $addtext);
 }
 public static function &get_uploader($prefix = '', $destdir = '')
 {
     $mod = cge_utils::get_cge();
     $obj = new cge_uploader($prefix, $destdir);
     $obj->set_accepted_filetypes($mod->GetPreference('alloweduploadfiles'));
     $obj->set_accepted_imagetypes($mod->GetPreference('imageextensions'));
     $obj->set_preview($mod->GetPreference('allow_resizing', 0));
     $obj->set_preview_size($mod->GetPreference('resizeimage', 0));
     $obj->set_watermark($mod->GetPreference('allow_watermarking', 0));
     $obj->set_thumbnail($mod->GetPreference('allow_thumbnailing', 0));
     $obj->set_thumbnail_size($mod->GetPreference('thumbnailsize'));
     $obj->set_delete_orig($mod->GetPreference('delete_orig_image'));
     return $obj;
 }
 public static function self_url($assign = '')
 {
     $s = \cge_utils::ssl_request() ? "s" : "";
     $p = strpos($_SERVER['SERVER_PROTOCOL'], '/');
     $protocol = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, $p)) . $s;
     $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
     $s = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port;
     $txt = $s . $_SERVER['REQUEST_URI'];
     if (!empty($assign)) {
         $smarty = CmsApp::get_instance()->GetSmarty();
         $smarty->assign($assign, $txt);
         return;
     }
     return $txt;
 }
 public static function &get_auth_consumer()
 {
     $res = null;
     $feu = cge_utils::get_module('FrontEndUsers');
     $name = $feu->GetPreference('auth_module', '');
     if ($name == '' || $name == '__BUILTIN__') {
         return self::get_std_consumer();
     }
     $module = cge_utils::get_module($name);
     if (!$module) {
         return $res;
     }
     $res = $module->GetFeuAuthConsumer();
     return $res;
 }
 public function transform(CGImageBase $src)
 {
     $_dest = new CGImageBase($src);
     $watermarker = \cge_setup::get_watermarker();
     if ($this->_wmtext) {
         // clean up the text
         $text = strip_tags($this->_wmtext);
         $text = substr($text, 0, 50);
         $text = trim($text);
         if (is_null(\cge_utils::to_bool($text, TRUE))) {
             $watermarker->set_watermark_text($text);
         }
     }
     $_dest['rsrc'] = $watermarker->get_watermarked_image($_dest['rsrc']);
     return $_dest;
 }
 /**
  * @ignore
  * @internal
  */
 protected function _query()
 {
     if ($this->_rs) {
         return;
     }
     $sql = $this->_filter['sql'];
     // get the first two words out of the query
     list($w1, $w2, $junk) = explode(' ', $sql);
     if (strtoupper($w1) == 'SELECT') {
         if (strtoupper($w2) != 'SQL_CALC_FOUND_ROWS') {
             // inject SQL_CALC_FOUND_ROWS
             $sql = substr_replace($sql, 'SELECT SQl_CALC_FOUND_ROWS', 0, strlen('SELECT'));
         }
     }
     $db = \cge_utils::get_db();
     $this->_rs = $db->SelectLimit($sql, $this->_filter['limit'], $this->_filter['offset'], $this->_filter['parms']);
     $this->_totalmatching = (int) $db->GetOne('SELECT FOUND_ROWS()');
 }
 public static function transform_image($srcSpec, $destSpec, $size = '')
 {
     $config = cmsms()->GetConfig();
     require_once $config['root_path'] . '/lib/filemanager/ImageManager/Classes/Transform.php';
     if ($size == '') {
         $cge = cge_utils::get_cge();
         $size = $cge->GetPreference('thumbnailsize');
     }
     $it = new Image_Transform();
     $img = $it->factory($config['image_manipulation_prog']);
     $img->load($srcSpec);
     if ($img->img_x < $img->img_y) {
         $long_axis = $img->img_y;
     } else {
         $long_axis = $img->img_x;
     }
     if ($long_axis > $size) {
         $img->scaleByLength($size);
         $img->save($destSpec, 'jpeg');
     } else {
         $img->save($destSpec, 'jpeg');
     }
     $img->free();
 }
 /**
  * @ignore
  */
 public function __set($key, $val)
 {
     $key = trim((string) $key);
     switch ($key) {
         case 'parent':
         case 'current':
             if ($val instanceof cms_tree) {
                 $val = (int) $val->get_tag('id');
                 $this->_data[$key] = $val;
             } else {
                 if (!empty($val)) {
                     $val = (string) $val;
                     if (is_numeric($val)) {
                         $val = (int) $val;
                     } else {
                         $root = cmsms()->GetHierarchyManager();
                         $node = $root->sureGetNodeByAlias($val);
                         if (!$node) {
                             throw new \LogicException('Could not find a content object with alias or id of ' . $val);
                         }
                         $val = (int) $node->get_tag('id');
                     }
                     $this->_data[$key] = $val;
                 }
             }
             break;
         case 'spacer':
             $this->_data[$key] = trim((string) $val);
             break;
         case 'show_unlinkable':
         case 'show_disabled':
         case 'show_navhidden':
             if (!empty($val) || is_numeric($val)) {
                 $val = \cge_utils::to_bool($val);
                 $this->_data[$key] = $val;
             }
             break;
     }
 }
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# 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');
    }
    $upload_id = (int) $params['upload_id'];
}
if ($upload_id <= 0) {
    die('error ... no upload');
}
$query = 'SELECT * FROM ' . cms_db_prefix() . 'module_uploads WHERE upload_id = ?';
$row = $db->GetRow($query, array($upload_id));
if (!is_array($row)) {
    die('error ... could not find upload');
}
$catpath = $this->getCategoryPathFromID($row['upload_category_id']);
$fn = $this->_categoryPath($catpath . DIRECTORY_SEPARATOR . $row['upload_name']);
if (!file_exists($fn)) {
    die('error ... file not found ' . $fn);
}
$mimetype = cge_utils::get_mime_type($fn);
if (!$mimetype) {
    $mimetype = 'application/octet-stream';
}
if (ini_get('zlib.output_compression')) {
    ini_set('zlib.output_compression', 'Off');
}
$bn = basename($fn);
set_time_limit(999);
$chunksize = intval($this->GetPreference('download_chunksize', 8)) * 1024;
$handlers = ob_list_handlers();
for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) {
    ob_end_clean();
}
header('Content-Type: ' . $mimetype);
header("Content-Disposition: inline; filename=\"{$bn}\"");
# in any Non GPL version of CMS Made simple, or in any version of CMS
# Made simple that does not indicate clearly and obviously in its admin
# section that the site was built with CMS Made simple.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# 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
$db = cge_utils::get_db();
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$dict = NewDataDictionary($db);
$this->DeleteTemplate();
$this->RemovePreference();
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_COUNTRIES);
$dict->ExecuteSQLArray($tmp);
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_STATES);
$dict->ExecuteSQLArray($tmp);
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_ASSOCDATA);
$dict->ExecuteSQLArray($tmp);
\CGExtensions\jsloader\jsloader::unregister_by_module($this->GetName());
$this->RemoveEventHandler('Core', 'ContentPostRender');
#
# EOF
#
 /**
  * Get a safe array of strings from an input parameter that is an array.
  *
  * @see cge_param::get_string()
  * @param array $params An associative array of input params
  * @param string $key The key to the associative array
  * @param string[] $dflt The default value to use if the key does not exist in the $params aray.
  */
 public static function get_string_array($params, $key, $dflt = null)
 {
     $tmp = \cge_utils::get_param($params, $key, $dflt);
     if (!is_array($tmp)) {
         $tmp = array($tmp);
     }
     for ($i = 0, $n = count($tmp); $i < $n; $i++) {
         $tmp[$i] = html_entity_decode($tmp[$i]);
         $tmp[$i] = trim(strip_tags($tmp[$i]));
     }
     return $tmp;
 }
<?php

if (!isset($gCms)) {
    exit;
}
if (!$this->CheckPermission('Manage Calendar Attributes')) {
    return;
}
$this->SetCurrentTab('admin_manage_categories');
$catid = (int) cge_utils::get_param($params, 'catid');
if ($catid < 1) {
    $this->SetError($this->Lang('error_insufficientparams'));
}
try {
    \CGCalendar\category::delete($catid);
    $this->SetMessage($this->Lang('categorydeleted'));
} catch (Exception $e) {
    $this->SetError($e->GetMessage());
}
$this->RedirectToTab();
                    $out->candelete = 1;
                }
            }
            $out->start = $rec['event_date_start'];
            $out->end = $rec['event_date_end'];
            $out->allDay = $rec['event_all_day'] ? true : false;
            $parms = array('event_id' => $rec['event_id']);
            $parms['display'] = 'event';
            if ($eventtemplate) {
                $parms['eventtemplate'] = $eventtemplate;
            }
            $out->detail_url = $this->create_url('cntnt01', 'default', $detailpage, $parms);
            $out->detail_url = str_replace('&amp;', '&', $out->detail_url);
            if ($feu_uid && $rec['event_created_by'] == $feu_uid) {
                $parms = array('event_id' => $rec['event_id']);
                if ($editeventtemplate) {
                    $parms['editeventtemplate'] = $editeventtemplate;
                }
                $parms['return_id'] = $returnid;
                $out->edit_url = $this->create_url('cntnt01', 'addedit_event', $editpage, $parms);
                $out->edit_url = str_replace('&amp;', '&', $out->edit_url);
            }
            $outlist[] = $out;
        } catch (Exception $e) {
            debug_to_log(__FILE__);
            debug_to_log($e->GetMessage());
        }
    }
}
cge_utils::send_ajax_and_exit($outlist);
    $page = $this->GetPreference('pageid_login');
    if (isset($params['returnto'])) {
        $page = $params['returnto'];
    }
    // replace {$groupname} with the first groupname we can find that matches
    $groups = $this->GetMemberGroupsArray($this->LoggedinId());
    $groupname = $this->GetGroupName($groups[0]['groupid']);
    $smarty->assign('username', $params['feu_input_username']);
    $smarty->assign('group', $groupname);
    $page = $this->ProcessTemplateFromData($page);
}
// send the event
$parms = array();
$parms['id'] = $this->LoggedInId();
$parms['username'] = $params['feu_input_username'];
$parms['ip'] = cge_utils::get_real_ip();
$this->SendEvent('OnLogin', $parms);
$this->_SendNotificationEmail('OnLogin', $parms);
if ($return_url != '') {
    redirect($return_url);
} else {
    if ($page) {
        $id = ContentManager::GetPageIDFromAlias($page);
        if ($id) {
            $this->RedirectContent($id);
            return;
        }
        die("couldn't get pageid for {$page}");
    } else {
        $this->RedirectContent($returnid);
    }
 /**
  * Geerate tags (such as stylesheet tags) that are required for the HEAD portion of the HTML output.
  *
  * @return string The HTML tags to go into the HEAD portion.
  */
 protected function get_head_contents()
 {
     $out = '';
     if (count($this->_stylesheets)) {
         $mod = \cge_utils::get_cge();
         foreach ($this->_stylesheets as $one) {
             if (!file_exists($one)) {
                 continue;
             }
             $url = \cge_utils::file_to_url($one);
             if (!$url) {
                 continue;
             }
             $out .= '<link rel="stylesheet" type="text/css" href="' . $url . '">';
         }
     }
     return $out;
 }
                }
                $results[] = $tmpa;
                $date = $tmp;
                break;
        }
    }
    return $results;
}
$events_to_categories_table_name = $this->events_to_categories_table_name;
if (isset($params['cancel'])) {
    $this->Redirect($id, 'defaultadmin', $returnid, array("module_message" => $message));
}
//
// Gather parameters
//
$event_id = cge_utils::get_param($params, 'event_id', -1);
$recurring_events = '';
$user_id = get_userid(FALSE) * -1 - 100;
$categories = get_parameter_value($params, 'event_categories', -1);
$event = $this->GetEvent($event_id);
$this->GetEventFromParams($event, $params, true);
$event_parent_id = $event_id;
// permissions check
if ($event_id < 1) {
    // adding
    if (!$this->CheckPermission('Modify Calendar') && !$this->CheckPermission('Add Calendar Events')) {
        $this->SetError($this->Lang('error_permission'));
        $this->RedirectToAdminTab();
    }
} else {
    // editing
 public static function cge_pageoptions($params, $smarty)
 {
     $current = trim(cge_utils::get_param($params, 'value'));
     $current = trim(cge_utils::get_param($params, 'selected'));
     $none = cge_utils::to_bool(cge_utils::get_param($params, 'none'));
     $params['current'] = $current;
     unset($params['value'], $params['selected'], $params['none']);
     $builder = new \CGExtensions\content_list_builder($params);
     $tmp = null;
     if ($none) {
         $mod = cge_utils::get_module(MOD_CGEXTENSIONS);
         $tmp .= '<option value="">' . $mod->Lang('none') . '</option>';
         $tmp .= '<option disabled="disabled">---</option>';
     }
     $tmp .= $builder->get_options();
     return $tmp;
 }
 /**
  * A function to provide a form to edit a single template.  Provides restore
  * to factory default settings as well.
  *
  * @param object  The module that this template is for.
  * @param string  The module action id.
  * @param integer The returnid (usually empty)
  * @param string  The template name
  * @param string  The active tab name
  * @param string  A title for the form, usually indicates which template this form is editing.
  * @param string  The filename (relative to the modules templates directory) of the factory default template source.
  * @param string  Optional help for this template
  * @param string  The destination action (usually defaultadmin)
  * @return string An HTML form
  */
 public static function get_single_template_form(&$module, $id, $returnid, $tmplname, $active_tab, $title, $filename, $info = '', $destaction = 'defaultadmin')
 {
     $cgextensions =& cge_utils::get_module('CGExtensions');
     $smarty =& $module->smarty;
     $smarty->assign('defaulttemplateform_title', $title);
     $smarty->assign('info_title', $info);
     $smarty->assign('startform', $cgextensions->CreateFormStart($id, 'setdefaulttemplate', $returnid, 'post', '', false, '', array('prefname' => $tmplname, 'usetemplate' => '1', 'destmodule' => $module->GetName(), 'cg_activetab' => $active_tab, 'destaction' => $destaction, 'filename' => $filename)));
     $smarty->assign('prompt_template', $cgextensions->Lang('template'));
     $smarty->assign('input_template', $cgextensions->CreateTextArea(false, $id, $module->GetTemplate($tmplname), 'input_template'));
     $smarty->assign('submit', $cgextensions->CreateInputSubmit($id, 'submit', $cgextensions->Lang('submit')));
     $smarty->assign('reset', $cgextensions->CreateInputSubmit($id, 'resettodefault', $cgextensions->Lang('resettofactory')));
     $smarty->assign('endform', $cgextensions->CreateFormEnd());
     return $cgextensions->ProcessTemplate('editdefaulttemplate.tpl');
 }
 public static function expand_events($eventids, $returnid, $parameters, $limit = 10000, $startoffset = 0)
 {
     if (!is_array($eventids) || count($eventids) < 1) {
         return FALSE;
     }
     $module = cge_utils::get_module(MOD_CGCALENDAR);
     $gCms = CmsApp::get_instance();
     $db = $gCms->GetDb();
     $events_to_categories_table_name = $module->events_to_categories_table_name;
     $categories_table_name = $module->categories_table_name;
     $event_field_values_table_name = $module->event_field_values_table_name;
     $userops = $gCms->GetUserOperations();
     $tmp = $userops->LoadUsers();
     $users = array();
     foreach ($tmp as $oneuser) {
         $users[$oneuser->id] = $oneuser;
     }
     $query = 'SELECT * FROM ' . $module->events_table_name . ' WHERE event_id IN (' . implode(',', $eventids) . ')
               ORDER BY event_date_start ASC';
     $rs = $db->SelectLimit($query, $limit, $startoffset);
     $feu_users = array();
     while (!$rs->EOF()) {
         $row = $rs->fields;
         $uid = $row['event_created_by'];
         if ($uid < 1 && !in_array($uid, $feu_users)) {
             $feu_users[] = $uid;
         }
         $rs->MoveNext();
     }
     debug_display($feu_users);
     die;
     $rs->MoveFirst();
     $events = array();
     while ($rs && ($row = $rs->FetchRow())) {
         $titleSEO = munge_string_to_url($row['event_title']);
         $destpage = $module->GetPreference('defaultcalendarpage', -1);
         $destpage = $destpage > 0 ? $destpage : $returnid;
         //$destpage =$detailpage!=''?$detailpage:$destpage;
         $prefix = $module->GetPreference('url_prefix');
         if (!$prefix) {
             $prefix = 'calendar';
         }
         $prettyurl = sprintf($prefix . "/%d/%d-%s", $destpage, $row['event_id'], $titleSEO);
         $parms = array();
         $parms['event_id'] = $row['event_id'];
         $parms['display'] = 'event';
         if (isset($parameters['eventtemplate'])) {
             $parms['eventtemplate'] = $parameters['eventtemplate'];
         }
         $url = $module->CreateLink('cntnt01', 'default', $destpage, $contents = '', $parms, '', true, '', '', '', $prettyurl);
         $row['url'] = $url;
         $row['author'] = $users[$row['event_created_by']]->username;
         $row['authorname'] = $users[$row['event_created_by']]->firstname . ' ' . $users[$row['event_created_by']]->lastname;
         // Build the sql to retrieve the categories for this event.
         $sql = "SELECT category_name FROM {$events_to_categories_table_name}\n\t        INNER JOIN {$categories_table_name} ON  {$events_to_categories_table_name}.category_id = {$categories_table_name}.category_id\n\t        WHERE event_id = ?";
         $crs = $db->Execute($sql, array($row['event_id']));
         // Get the field values
         $categories = array();
         $categories_temp = array();
         if ($crs) {
             // make sure there are results and assign to the $categories array
             $categories_temp = $crs->GetArray();
             foreach ($categories_temp as $category) {
                 $category_name = $category['category_name'];
                 $categories[$category_name] = '1';
             }
         }
         // Attach the custom fields to the event
         $row['categories'] = $categories;
         // Build the sql to retrieve the field values for this event.
         $sql = "SELECT field_name,field_value FROM {$event_field_values_table_name} WHERE event_id = ?";
         $frs = $db->Execute($sql, array($row['event_id']));
         // Get the field values
         $fields = array();
         $fields_temp = array();
         if ($frs) {
             // make sure there are results and assign to the $fields array
             $fields_temp = $frs->GetArray();
             foreach ($fields_temp as $field) {
                 $field_name = $field['field_name'];
                 $field_value = $field['field_value'];
                 $fields[$field_name] = $field_value;
             }
         }
         // Attach the custom fields to the event
         $row['fields'] = $fields;
         // End custom fields retrieval
         // and add it to the list of completed, expanded events.
         $events[] = $row;
     }
     if ($rs) {
         $rs->Close();
     }
     return $events;
 }
 public static function cge_is_smartphone($params, &$smarty)
 {
     $browser = cge_utils::get_browser();
     $smartphone = $browser->isMobile();
     if (isset($params['assign'])) {
         $smarty->assign($params['assign'], $smartphone);
         return;
     }
     return $smartphone;
 }
         $params['field_' . $thefield] = $filename;
     }
 }
 // merge field values back into the fields array
 foreach ($params as $key => $value) {
     if (!startswith($key, 'field_')) {
         continue;
     }
     $fieldname = substr($key, strlen('field_'));
     switch ($fields[$fieldname]->type) {
         case 0:
             $value = filter_var(trim($value), FILTER_SANITIZE_STRING);
             break;
         case 2:
             $value = html_entity_decode(trim($value));
             $value = cge_utils::clean_input_html($value);
             break;
     }
     $fields[$fieldname]->value = $value;
 }
 // merge category values back into the categories array
 if (isset($params['event_categories'])) {
     foreach ($categories as &$one) {
         $one->checked = 0;
         if (isset($params['event_categories'][$one->id])) {
             $one->checked = $params['event_categories'][$one->id];
         }
     }
 }
 // ready to insert or update
 $fieldtext = '';
 public static function &get_instance($name)
 {
     return cge_utils::get_module($name);
 }
$smarty->assign('hidden_field_color', $this->GetPreference('hidden_field_color', 'green'));
$smarty->assign('secure_field_marker', $this->GetPreference('secure_field_marker', '^^'));
$smarty->assign('secure_field_color', $this->GetPreference('secure_field_color', 'yellow'));
$smarty->assign('pageidforgotpasswd', $this->GetPreference('pageidforgotpasswd'));
$smarty->assign('pageid_changesettings', $this->GetPreference('pageid_changesettings'));
$smarty->assign('pageid_login', $this->GetPreference('pageid_login'));
$smarty->assign('pageid_logout', $this->GetPreference('pageid_logout'));
$smarty->assign('pageid_afterverify', $this->GetPreference('pageid_afterverify'));
$smarty->assign('pageid_afterchangesettings', $this->GetPreference('pageid_afterchangesettings'));
// Get the number of users installed in FEU.
$query = 'SELECT count(id) FROM ' . cms_db_prefix() . 'module_feusers_users';
$db = cmsms()->GetDb();
$nusers = $db->GetOne($query);
$smarty->assign('total_user_count', $nusers);
$smarty->assign('pwsalt', $this->GetPreference('pwsalt'));
$cgecom = cge_utils::get_module('CGEcommerceBase');
$selfreg = cge_utils::get_module('SelfRegistration');
if ($cgecom && $selfreg && $selfreg->GetPreference('allowpaidregistration')) {
    $opts = array();
    $opts['none'] = $this->Lang('none');
    $opts['delete'] = $this->Lang('delete_user');
    $opts['expire'] = $this->Lang('expire_user');
    $smarty->assign('ecommerce_actions', $opts);
    $smarty->assign('ecomm_ordercancelled', $this->GetPreference('ecomm_ordercancelled', 'none'));
    $smarty->assign('ecomm_orderdeleted', $this->GetPreference('ecomm_orderdeleted', 'none'));
    $smarty->assign('ecomm_paidregistration', $this->GetPreference('ecomm_paidregistration', 0));
}
echo $this->ProcessTemplate('admin_authtab.tpl');
#
# EOF
#
 public static function redirect_with_error($returnid, $message, $error = 1)
 {
     $mod = cge_utils::get_module();
     $mod->Redirect($id, 'showmessage', $returnid, array('cge_msg' => $message, 'cge_error' => (int) $error));
 }
<?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;
 /**
  * Resize an image to have the specifified number of pixels in the logest dimension while retaining aspect ratio.
  *
  * @param string $srcSpec The complete path to the input file.
  * @param string $destSpec The complete path to the output file.
  * @param int $size The maximum size of the longest dimension of the image (in pixels).
  */
 public static function transform_image($srcSpec, $destSpec, $size = null)
 {
     if (!file_exists($srcSpec)) {
         throw new \CmsInvalidDataException('File ' . $srcSpec . ' not found');
     }
     if (!is_readable($srcSpec)) {
         throw new \CmsInvalidDataException('File ' . $srcSpec . ' is not readable');
     }
     $destdir = dirname($destSpec);
     if (!is_writable($destdir)) {
         throw new \CmsInvalidDataException($destdir . ' is not writable');
     }
     if (file_exists($destSpec) && !is_writable($destSpec)) {
         throw new \CmsInvalidDataException($destSpec . ' exists, but cannot be overwritten.');
     }
     $imginfo = getimagesize($srcSpec);
     if ($imginfo === FALSE) {
         throw new \RuntimeException($srcSpec . ' is not a valid image file (could not get dimensions)');
     }
     if ($size < 1) {
         // get a default thumbnail size.
         $cge = cge_utils::get_cge();
         $size = (int) $cge->GetPreference('thumbnailsize');
     }
     // calculate new sizes.
     $new_w = $new_h = 0;
     if ($imginfo[0] >= $imginfo[1]) {
         // image is taller than wide
         $new_w = $size;
         $new_h = round($new_w / $imginfo[0] * $imginfo[1], 0);
     } else {
         $new_h = $size;
         $new_w = round($new_h / $imginfo[1] * $imginfo[0], 0);
     }
     self::resize($srcSpec, $destSpec, $new_w, $new_h);
 }
 /**
  * convert the current object to a format suitable for saving in the database
  *
  * @return string
  */
 public function to_dbformat()
 {
     $db = cge_utils::get_db();
     return trim($db->DbTimeSTamp($this->_time), "'");
 }