Esempio n. 1
0
File: url.php Progetto: notzen/e107
 /**
  * 
  */
 public function create($route, $params = array())
 {
     if (!$params) {
         return 'page.php';
     }
     if (is_string($route)) {
         $route = explode('/', $route, 2);
     }
     if (!varset($route[1])) {
         $route[1] = 'index';
     }
     ## aliases as retrieved from the DB, map vars to proper values
     if (isset($params['page_title']) && !empty($params['page_title'])) {
         $params['name'] = $params['page_title'];
     }
     if (isset($params['page_id']) && !empty($params['page_id'])) {
         $params['id'] = $params['page_id'];
     }
     $url = 'page.php?';
     if ('--FROM--' != vartrue($params['page'])) {
         $page = varset($params['page']) ? intval($params['page']) : '0';
     } else {
         $page = '--FROM--';
     }
     $url .= intval($params['id']) . ($page ? '.' . $page : '');
     return $url;
 }
Esempio n. 2
0
 function init()
 {
     $pref = e107::getPref();
     $sql = e107::getDb();
     if (vartrue($_POST['cron_execute'])) {
         $executeID = key($_POST['cron_execute']);
         $this->cronExecute($executeID);
     }
     if (!vartrue(e107::getPref('e_cron_pwd')) || varset($_POST['generate_pwd'])) {
         $pwd = $this->setCronPwd();
     }
     $sql->gen("SELECT cron_function,cron_active FROM #cron ");
     while ($row = $sql->fetch(MYSQL_ASSOC)) {
         $this->curCrons[] = $row['cron_function'];
         if ($row['cron_active'] == 1) {
             $this->activeCrons++;
         }
     }
     $this->lastRefresh();
     // Import Core and Plugin e_cron data
     $cronDefaults['_system'] = array(0 => array('name' => LAN_CRON_01_1, 'function' => 'sendEmail', 'category' => 'mail', 'description' => str_replace("[eml]", $pref['siteadminemail'], LAN_CRON_01_2) . "<br />" . LAN_CRON_01_3), 1 => array('name' => LAN_CRON_02_1, 'category' => 'mail', 'function' => 'procEmailQueue', 'description' => LAN_CRON_02_2), 2 => array('name' => LAN_CRON_03_1, 'category' => 'mail', 'function' => 'procEmailBounce', 'description' => LAN_CRON_03_2), 3 => array('name' => LAN_CRON_04_1, 'category' => 'user', 'function' => 'procBanRetrigger', 'description' => LAN_CRON_04_2 . "<br />" . LAN_CRON_04_3, 'available' => e107::getPref('ban_retrigger')), 4 => array('name' => LAN_CRON_05_1, 'category' => 'backup', 'function' => 'dbBackup', 'description' => LAN_CRON_05_2 . ' ' . e_SYSTEM . 'backups/'), 5 => array('name' => LAN_CRON_06_1, 'category' => 'user', 'function' => 'procBanRetrigger', 'description' => LAN_CRON_06_2 . "<br />" . LAN_CRON_06_3), 6 => array('name' => LAN_CRON_20_1, 'category' => 'update', 'function' => 'checkCoreUpdate', 'description' => LAN_CRON_20_2 . "<br />" . LAN_CRON_20_3));
     if (is_dir(e_BASE . ".git")) {
         $cronDefaults['_system'][7] = array('name' => LAN_CRON_20_4, 'category' => 'update', 'function' => 'gitrepo', 'description' => LAN_CRON_20_5 . "<br />" . LAN_CRON_20_6 . "<br /><span class='label label-warning'>" . LAN_CRON_20_7 . "</span> " . LAN_CRON_20_8);
     }
     if (!vartrue($_GET['action']) || $_GET['action'] == 'refresh') {
         $this->cronImport($cronDefaults);
         // import Core Crons (if missing)
         $this->cronImport(e107::getAddonConfig('e_cron'));
         // Import plugin Crons
         $this->cronImportLegacy();
         // Import Legacy Cron Tab Settings
     }
 }
Esempio n. 3
0
 /**
  * All possible parameters
  * {GALLERY_THUMB=w=200&h=200&thumburl&thumbsrc&imageurl&orig}
  * w and h - optional width and height of the thumbnail
  * thumburl - return only the URL of the destination image (large one)
  * thumbsrc - url to the thumb, as it's written in the src attribute of the image
  * imageurl - full path to the destination image (no proxy)
  * actualPreview - large preview will use the original path to the image (no proxy)
  */
 function sc_gallery_thumb($parm = '')
 {
     $tp = e107::getParser();
     $parms = eHelper::scParams($parm);
     $w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth();
     // 190; // 160;
     $h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight();
     // 130;
     $class = $this->slideMode == TRUE ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'], 'gallery-thumb img-responsive');
     //	$rel 		= ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
     $rel = $this->slideMode == TRUE ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
     $att = 'aw=' . $w . '&ah=' . $h . '&x=1';
     // 'aw=190&ah=150';
     $srcFull = $tp->thumbUrl($this->var['media_url'], $this->attFull);
     if (vartrue($parms['actualPreview'])) {
         $srcFull = $tp->replaceConstants($this->var['media_url'], 'full');
     }
     if (isset($parms['thumburl'])) {
         return $srcFull;
     } elseif (isset($parms['thumbsrc'])) {
         return $tp->thumbUrl($this->var['media_url'], $att);
     } elseif (isset($parms['imageurl'])) {
         return $tp->replaceConstants($this->var['media_url'], 'full');
     }
     $caption = $tp->toAttribute($this->var['media_caption']);
     $description = $this->downloadable ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='Right-click > Save Link As' href='" . $srcFull . "'>Download</a>" : "";
     $description .= $tp->toAttribute($this->var['media_description']);
     $text = "<a class='" . $class . "' title=\"" . $description . "\" href='" . $srcFull . "'  data-gal='{$rel}'  >";
     $text .= "<img class='" . $class . "' src='" . $tp->thumbUrl($this->var['media_url'], $att) . "'  alt=\"" . $caption . "\" />";
     $text .= "</a>";
     return $text;
 }
Esempio n. 4
0
 public function beforeUpdate($new_data)
 {
     if (!varset($new_data['fb_category_template'])) {
         $new_data['fb_category_template'] = 'default';
     }
     return $new_data;
 }
Esempio n. 5
0
 /**
  * Register core and plugin notification events.
  */
 public function registerEvents()
 {
     $active = e107::getConfig()->get('notify');
     if (empty($active) && e_PAGE == 'notify.php') {
         e107::getMessage()->addDebug('Notify is disabled!');
         return false;
     }
     $e_event = e107::getEvent();
     if (varset($this->notify_prefs['event'])) {
         foreach ($this->notify_prefs['event'] as $id => $status) {
             $include = null;
             if ($status['class'] != e_UC_NOBODY) {
                 if (varset($status['include'])) {
                     $include = e_PLUGIN . $status['include'] . "/e_notify.php";
                     if (varset($status['legacy']) != 1) {
                         $class = $status['include'] . "_notify";
                         $method = $id;
                         $e_event->register($id, array($class, $method), $include);
                     } else {
                         $e_event->register($id, 'notify_' . $id, $include);
                     }
                 } else {
                     if (method_exists($this, 'notify_' . $id)) {
                         $e_event->register($id, array('notify', 'notify_' . $id));
                     } else {
                         $e_event->register($id, array('notify', 'generic'));
                         // use generic notification.
                     }
                 }
             }
         }
     }
     //	e107::getEvent()->debug();
 }
Esempio n. 6
0
function iconpicker_shortcode($parm)
{
    $parms = array();
    parse_str($parm, $parms);
    $name = varset($parms['id']);
    $sql = e107::getDb();
    $frm = e107::getForm();
    $tp = e107::getParser();
    // $sc_parameters is currently being used to select the media-category.
    $qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") ";
    $qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
    $qry .= "ORDER BY media_category,media_name";
    $str = "";
    $size_section = array();
    $lastsize = "16";
    if ($sql->db_Select_gen($qry)) {
        while ($row = $sql->db_Fetch()) {
            list($tmp, $tmp2, $size) = explode("_", $row['media_category']);
            if ($str != '' && $size != $lastsize) {
                $size_section[] = $str;
                $str = "";
            }
            $str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>";
            $lastsize = $size;
        }
        return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>';
    }
}
Esempio n. 7
0
 /**
  * Constructor - init paths
  * @todo FIX e107 (new folder structure), simplify all this, e.g. e107::getInstance()->initMinimal($path_to_e107_config);
  *
  * @return void
  */
 public function __construct()
 {
     // initial path
     $self = realpath(dirname(__FILE__));
     // Config
     include $self . '/e107_config.php';
     $tmp = $self . '/' . $HANDLERS_DIRECTORY;
     //Core functions - now API independent
     @(require $tmp . '/core_functions.php');
     //e107 class
     @(require $tmp . '/e107_class.php');
     $e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY', 'MEDIA_DIRECTORY', 'CACHE_DIRECTORY', 'LOGS_DIRECTORY', 'WEB_DIRECTORY', 'SYSTEM_DIRECTORY', 'CORE_DIRECTORY');
     //	$sql_info = array(); //compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLcharset');
     //e107::getInstance()->initCore($e107_paths, $self, $sql_info, varset($e107_CONFIG, array()));
     $e107 = e107::getInstance();
     $e107->site_path = substr(md5($mySQLdefaultdb . "." . $mySQLprefix), 0, 10);
     $e107->prepare_request();
     $e107->setDirs($e107_paths, varset($E107_CONFIG, array()));
     $e107->set_constants();
     $e107->set_paths();
     $e107->file_path = $e107->fix_windows_paths($self) . "/";
     $e107->set_base_path();
     $e107->set_request(false);
     $e107->set_urls(false);
     unset($tmp, $self);
     // basic Admin area detection - required for proper path parsing
     define('ADMIN', strpos(e_SELF, $e107->getFolder('admin') !== false || strpos(e_PAGE, 'admin') !== false));
     $e107->set_urls(false);
     $pref = $e107->getPref();
     //TODO optimize/benchmark
     $this->_watermark = array('activate' => vartrue($pref['watermark_activate'], false), 'text' => vartrue($pref['watermark_text']), 'size' => vartrue($pref['watermark_size'], 20), 'pos' => vartrue($pref['watermark_pos'], "BR"), 'color' => vartrue($pref['watermark_color'], 'fff'), 'font' => vartrue($pref['watermark_font']), 'margin' => vartrue($pref['watermark_margin'], 30), 'shadowcolor' => vartrue($pref['watermark_shadowcolor'], '000000'), 'opacity' => vartrue($pref['watermark_opacity'], 20));
     $this->_thumbQuality = vartrue($pref['thumbnail_quality'], 65);
     // parse request
     $this->parseRequest();
 }
Esempio n. 8
0
 /**
  * Process submitted form data.
  */
 function init()
 {
     if (isset($_POST['saveConfig']) && (int) $_POST['saveConfig'] === 1) {
         $prefs = e107::getPlugConfig('google_analytics');
         $prefs->set('account', varset($_POST['account'], ''))->save();
         $prefs->set('domain_mode', (int) vartrue($_POST['domain_mode'], 0))->save();
         $prefs->set('cross_domains', varset($_POST['cross_domains'], ''))->save();
         $prefs->set('visibility_pages', (int) vartrue($_POST['visibility_pages'], 0))->save();
         $prefs->set('pages', varset($_POST['pages'], ''))->save();
         $prefs->set('visibility_roles', (int) vartrue($_POST['visibility_roles'], 0))->save();
         $prefs->set('track_user_id', (int) vartrue($_POST['track_user_id'], 0))->save();
         $prefs->set('track_outbound', (int) vartrue($_POST['track_outbound'], 0))->save();
         $prefs->set('track_mailto', (int) vartrue($_POST['track_mailto'], 0))->save();
         $prefs->set('track_files', (int) vartrue($_POST['track_files'], 0))->save();
         $prefs->set('track_files_extensions', varset($_POST['track_files_extensions']))->save();
         $prefs->set('track_link_id', (int) vartrue($_POST['track_link_id'], 0))->save();
         $prefs->set('track_url_fragments', (int) vartrue($_POST['track_url_fragments'], 0))->save();
         $prefs->set('track_adsense', (int) vartrue($_POST['track_adsense'], 0))->save();
         $prefs->set('track_double_click', (int) vartrue($_POST['track_double_click'], 0))->save();
         $prefs->set('tracker_anonymize_ip', (int) vartrue($_POST['tracker_anonymize_ip'], 0))->save();
         $prefs->set('privacy_do_not_track', (int) vartrue($_POST['privacy_do_not_track'], 0))->save();
         $prefs->set('cache', (int) vartrue($_POST['cache'], 0))->save();
         $prefs->set('debug', (int) vartrue($_POST['debug'], 0))->save();
     }
 }
Esempio n. 9
0
 /**
  *	Get the box-related information for inbox or outbox - limits, message count etc
  *	The information read from the DB is cached internally for efficiency
  *
  *	@param	string $which = inbox|outbox|clear
  *
  *	@return	array
  *	
  */
 function pm_getInfo($which = 'inbox')
 {
     static $pm_info;
     if ('clear' == $which) {
         unset($pm_info['inbox']);
         unset($pm_info['outbox']);
         return;
     }
     if ('inbox' == $which) {
         $qry = "SELECT count(pm.pm_id) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM `#private_msg` as pm WHERE pm.pm_to = " . USERID . " AND pm.pm_read_del = 0";
     } else {
         $qry = "SELECT count(pm.pm_from) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM `#private_msg` as pm WHERE pm.pm_from = " . USERID . " AND pm.pm_sent_del = 0";
     }
     if (!isset($pm_info[$which]['total'])) {
         $this->pmDB->gen($qry);
         $pm_info[$which] = $this->pmDB->fetch();
         if ($which == 'inbox' && ($this->pmPrefs['animate'] == 1 || $this->pmPrefs['popup'] == 1)) {
             if ($new = $this->pmDB->db_Count('private_msg', '(*)', "WHERE pm_sent > '" . USERLV . "' AND pm_read = 0 AND pm_to = '" . USERID . "' AND pm_read_del != 1")) {
                 $pm_info['inbox']['new'] = $new;
             } else {
                 $pm_info['inbox']['new'] = 0;
             }
         }
     }
     if (!isset($pm_info[$which]['limit'])) {
         if (varset($this->pmPrefs['pm_limits'], 0) > 0) {
             if ($this->pmPrefs['pm_limits'] == 1) {
                 $qry = "SELECT MAX(gen_user_id) AS inbox_limit, MAX(gen_ip) as outbox_limit FROM `#generic` WHERE gen_type='pm_limit' AND gen_datestamp IN (" . USERCLASS_LIST . ")";
             } else {
                 $qry = "SELECT MAX(gen_intdata) AS inbox_limit, MAX(gen_chardata) as outbox_limit FROM `#generic` WHERE gen_type='pm_limit' AND gen_datestamp IN (" . USERCLASS_LIST . ")";
             }
             if ($this->pmDB->gen($qry)) {
                 $row = $this->pmDB->fetch();
                 $pm_info['inbox']['limit'] = $row['inbox_limit'];
                 $pm_info['outbox']['limit'] = $row['outbox_limit'];
             }
             $pm_info['inbox']['limit_val'] = $this->pmPrefs['pm_limits'] == 1 ? varset($pm_info['inbox']['total'], '') : varset($pm_info['inbox']['size'], '');
             if (!$pm_info['inbox']['limit'] || !$pm_info['inbox']['limit_val']) {
                 $pm_info['inbox']['filled'] = 0;
             } else {
                 $pm_info['inbox']['filled'] = number_format($pm_info['inbox']['limit_val'] / $pm_info['inbox']['limit'] * 100, 2);
             }
             $pm_info['outbox']['limit_val'] = $this->pmPrefs['pm_limits'] == 1 ? varset($pm_info['outbox']['total'], '') : varset($pm_info['outbox']['size'], '');
             if (!$pm_info['outbox']['limit'] || !$pm_info['outbox']['limit_val']) {
                 $pm_info['outbox']['filled'] = 0;
             } else {
                 $pm_info['outbox']['filled'] = number_format($pm_info['outbox']['limit_val'] / $pm_info['outbox']['limit'] * 100, 2);
             }
         } else {
             $pm_info['inbox']['limit'] = '';
             $pm_info['outbox']['limit'] = '';
             $pm_info['inbox']['filled'] = '';
             $pm_info['outbox']['filled'] = '';
         }
     }
     return $pm_info;
 }
Esempio n. 10
0
 function init()
 {
     if (!empty($_GET['filter'])) {
         $action = $_GET['filter'];
         $this->adminMenu['main/' . $action]['selected'] = true;
     }
     $pref = e107::pref('faqs');
     $this->access = array('main/create' => varset($pref['admin_faq_create'], e_UC_ADMIN), 'main/edit' => varset($pref['admin_faq_edit'], e_UC_ADMIN), 'main/delete' => varset($pref['admin_faq_delete'], e_UC_ADMIN), 'cat/list' => check_class($pref['admin_cat_create']) || check_class($pref['admin_cat_edit']) ? e_UC_ADMIN : e_UC_NOBODY, 'cat/create' => varset($pref['admin_cat_create'], e_UC_ADMIN), 'cat/edit' => varset($pref['admin_cat_edit'], e_UC_ADMIN), 'cat/delete' => varset($pref['admin_cat_delete'], e_UC_ADMIN));
 }
Esempio n. 11
0
 function sc_login_table_password($parm = '')
 {
     $pref = e107::getPref();
     $text = "<input class='tbox form-control input-block-level' type='password' name='userpass' id='userpass' size='40' maxlength='100' placeholder=\"" . LAN_LOGIN_2 . "\" />";
     if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'], 0)) {
         $text .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='" . e107::getSession()->get('challenge') . "' />\n\n";
     }
     return $text;
 }
Esempio n. 12
0
 function sc_contact_body($parm = '')
 {
     parse_str($parm, $parm);
     $rows = vartrue($parm['rows'], 10);
     $cols = vartrue($parm['cols'], 70);
     if ($cols > 60) {
         $size = 'input-xxlarge';
     }
     return "<textarea cols='{$cols}' style='max-width:99%'  id='contactBody' rows='{$rows}' name='body' required='required' class='tbox {$size} form-control'>" . stripslashes(varset($_POST['body'])) . "</textarea>";
 }
Esempio n. 13
0
function navigation_shortcode($parm = '')
{
    $types = array('main' => 1, 'side' => 2, 'footer' => 3, 'alt' => 4, 'alt5' => 5, 'alt6' => 6);
    $category = varset($types[$parm], 1);
    $tmpl = vartrue($parm, 'main');
    $nav = e107::getNav();
    $template = e107::getCoreTemplate('navigation', $tmpl);
    $data = $nav->initData($category);
    //	$data 			= $nav->collection($category);
    return $nav->render($data, $template);
}
Esempio n. 14
0
File: url.php Progetto: armpit/e107
 /**
  * Query mapping in format route?params:
  * - profile/view?id=xxx -> user.php?id.xxx
  * - profile/list?page=xxx -> user.php?xxx
  * - myprofile/view -> user.php
  * - profile/edit?id=xxx -> usersettings.php?xxx
  * - myprofile/edit -> usersettings.php
  * - login/index (or just 'login') -> login.php
  * - register/index (or just 'register') -> signup.php
  */
 public function create($route, $params = array())
 {
     if (!$params) {
         return 'user.php';
     }
     if (is_string($route)) {
         $route = explode('/', $route, 2);
     }
     if (!varset($route[1])) {
         $route[1] = 'index';
     }
     ## aliases as retrieved from the DB, map vars to proper values
     if (isset($params['user_name']) && !empty($params['user_name'])) {
         $params['id'] = $params['user_name'];
     }
     if (isset($params['user_id']) && !empty($params['user_id'])) {
         $params['id'] = $params['user_id'];
     }
     $url = 'user.php';
     $page = vartrue($params['page']) ? intval($params['page']) : '0';
     if ($route[0] == 'profile') {
         switch ($route[1]) {
             case '':
             case 'view':
                 $url .= '?id.' . $params['id'];
                 break;
             case 'list':
                 $url .= $page ? '?' . $page : '';
                 break;
             case 'edit':
                 $url = e_ADMIN_ABS . "user.php?mode=main&action=edit&id=" . $params['id'];
                 // 'usersettings.php?'.$params['id'];
                 break;
         }
     } elseif ($route[0] == 'myprofile') {
         switch ($route[1]) {
             case '':
             case 'view':
                 // user.php
                 break;
             case 'edit':
                 $url = 'usersettings.php';
                 break;
         }
     } elseif ($route[0] == 'login') {
         $url = 'login.php';
     } elseif ($route[0] == 'register') {
         $url = 'signup.php';
     }
     // XXX signup URL parameters
     return $url;
 }
Esempio n. 15
0
 function __construct()
 {
     $this->request = e107::getRegistry('core/pages/request');
     $action = varset($this->request['action']);
     if (($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id'])) {
         $this->var = e107::getDb()->retrieve('page_chapters', 'chapter_name, chapter_meta_description, chapter_sef', 'chapter_id = ' . intval($this->request['id']) . ' LIMIT 1');
     }
     if ($action == 'showPage' && vartrue($this->request['id'])) {
         $query = "SELECT p.page_id,c.chapter_name,c.chapter_meta_description FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id WHERE p.page_id = " . intval($this->request['id']) . " LIMIT 1 ";
         $rows = e107::getDb()->retrieve($query, true);
         $this->var = $rows[0];
     }
 }
Esempio n. 16
0
 function notify()
 {
     global $e_event;
     $this->notify_prefs = e107::getConfig("notify")->getPref();
     if (varset($this->notify_prefs['event'])) {
         foreach ($this->notify_prefs['event'] as $id => $status) {
             if ($status['class'] != 255) {
                 $e_event->register($id, 'notify_' . $id);
             }
         }
     }
     include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_notify.php');
 }
Esempio n. 17
0
 function procEmailQueue()
 {
     //global $pref;
     if (CRON_MAIL_DEBUG) {
         $e107 = e107::getInstance();
         $e107->admin_log->e_log_event(10, debug_backtrace(), 'DEBUG', 'CRON Email', 'Email run started', FALSE, LOG_TO_ROLLING);
     }
     require_once e_HANDLER . 'mail_manager_class.php';
     $mailManager = new e107MailManager();
     $mailManager->doEmailTask(varset($pref['mail_workpertick'], 5));
     if (CRON_MAIL_DEBUG) {
         $e107->admin_log->e_log_event(10, debug_backtrace(), 'DEBUG', 'CRON Email', 'Email run completed', FALSE, LOG_TO_ROLLING);
     }
 }
Esempio n. 18
0
 /**
  * Save preset
  *
  * @param string $exclude_fields Comma separated list of fields not to save
  * @param bool $output output message or use message handler. NOTE - default value will be changed to false, update your code.
  */
 function save_preset($exclude_fields = '', $output = true)
 {
     global $sql, $ns, $tp;
     $qry = explode(".", e_QUERY);
     $unique_id = is_array($this->id) ? $this->id : array($this->id);
     $uid = $tp->toDB(varset($qry[1], 0));
     if ($_POST && $qry[0] == "savepreset") {
         $saveID = $tp->toDB($unique_id[$uid], true);
         $exclude_array = explode(',', $exclude_fields);
         $existing = $sql->db_Count("preset", "(*)", " WHERE preset_name='" . $saveID . "'  ") ? TRUE : FALSE;
         foreach ($_POST as $key => $value) {
             if (in_array($key, $exclude_array) || $tp->toDB($key) != $key) {
                 unset($_POST[$key]);
                 // Remove any fields excluded from preset, and those with potentially dubious key names
             } else {
                 $_POST[$key] = $tp->toDB($value);
             }
         }
         if ($existing) {
             // Delete any existing entries for this preset (else checkbox settings not updated)
             $sql->db_Delete("preset", "preset_name ='" . $saveID . "' ");
         }
         foreach ($_POST as $key => $value) {
             $sql->db_Insert("preset", "0, '" . $saveID . "', '{$key}', '{$value}' ");
         }
         if (!$output) {
             $ns->tablerender(LAN_SAVED, LAN_PRESET_SAVED);
             return;
         }
         require_once e_HANDLER . "message_handler.php";
         $emessage =& eMessage::getInstance();
         $emessage->add(LAN_PRESET_SAVED, E_MESSAGE_SUCCESS);
     }
     if ($_POST['delete_preset'] && e_QUERY == "clr_preset") {
         $del = $tp->toDB($_POST['del_id']);
         $check = $sql->db_Delete("preset", "preset_name ='" . $unique_id[$del] . "' ");
         if ($output) {
             $ns->tablerender(LAN_SAVED, $check ? LAN_PRESET_DELETED : LAN_DELETED_FAILED);
             return;
         }
         require_once e_HANDLER . "message_handler.php";
         $emessage =& eMessage::getInstance();
         if ($check) {
             $emessage->add(LAN_PRESET_DELETED, E_MESSAGE_SUCCESS);
         } else {
             $emessage->add(LAN_DELETED_FAILED, E_MESSAGE_ERROR);
         }
     }
 }
Esempio n. 19
0
function plugin_forum_admin_events($type, $parms)
{
    //We currently only care about system cache, so just return if it's not
    if (!isset($parms['syscache']) || !$parms['syscache']) {
        return '';
    }
    switch ($type) {
        case 'cache_clear':
            $which = varset($parms['cachetag']);
            if ('nomd5_classtree' == $which) {
                return 'plugin_forum_admin_events_clear_moderators';
            }
            break;
    }
}
Esempio n. 20
0
 function compile($tags, $parm = array())
 {
     $sql = e107::getDb();
     $items = array();
     $tag_regexp = "'(^|,)(" . str_replace(",", "|", $tags) . ")(,|\$)'";
     $query = "SELECT * FROM #news WHERE news_id != " . $parm['current'] . " AND news_class REGEXP '" . e_CLASS_REGEXP . "'  AND news_meta_keywords REGEXP " . $tag_regexp . "  ORDER BY news_datestamp DESC LIMIT " . $parm['limit'];
     if ($sql->gen($query)) {
         while ($row = $sql->fetch()) {
             $items[] = array('title' => varset($row['news_title']), 'url' => e107::getUrl()->create('news/view/item', $row), 'body' => varset($row['news_summary']), 'image' => varset($row['news_image']));
         }
         return $items;
     } elseif (ADMIN) {
         //	return array(array('title'=>$query,'url'=>''));
     }
 }
Esempio n. 21
0
 function render_emailprint($mode, $id, $look = 0, $parm = array())
 {
     // $look = 0  --->display all icons
     // $look = 1  --->display email icon only
     // $look = 2  --->display print icon only
     $tp = e107::getParser();
     $text_emailprint = "";
     //new method emailprint_class : (only news is core, rest is plugin: searched for e_emailprint.php which should hold $email and $print values)
     if ($mode == "news") {
         $email = "news";
         $print = "news";
     } else {
         //load the others from plugins
         $handle = opendir(e_PLUGIN);
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && is_dir(e_PLUGIN . $file)) {
                 $plugin_handle = opendir(e_PLUGIN . $file . "/");
                 while (false !== ($file2 = readdir($plugin_handle))) {
                     if ($file2 == "e_emailprint.php") {
                         require_once e_PLUGIN . $file . "/" . $file2;
                     }
                 }
             }
         }
     }
     if (deftrue('BOOTSTRAP')) {
         $genericMail = $tp->toGlyph('icon-envelope', false);
         // "<i class='icon-envelope'></i>";
         $genericPrint = $tp->toGlyph('fa-print', false);
         // "<i class='icon-print'></i>";
         $class = varset($parm['class']) ? $parm['class'] : "";
     } else {
         $genericMail = "<img src='" . e_IMAGE_ABS . "generic/email.png'  alt='" . LAN_EMAIL_7 . "'  />";
         $genericPrint = "<img src='" . e_IMAGE_ABS . "generic/printer.png'  alt='" . LAN_PRINT_1 . "'  />";
         $class = "";
     }
     if ($look == 0 || $look == 1) {
         $ico_mail = defined("ICONMAIL") && file_exists(THEME . "images/" . ICONMAIL) ? "<img src='" . THEME_ABS . "images/" . ICONMAIL . "'  alt='" . LAN_EMAIL_7 . "'  />" : $genericMail;
         //TDOD CSS class
         $text_emailprint .= "<a class='e-tip hidden-print" . $class . "' href='" . e_HTTP . "email.php?" . $email . "." . $id . "' title='" . LAN_EMAIL_7 . "'>" . $ico_mail . "</a> ";
     }
     if ($look == 0 || $look == 2) {
         $ico_print = defined("ICONPRINT") && file_exists(THEME . "images/" . ICONPRINT) ? "<img src='" . THEME_ABS . "images/" . ICONPRINT . "' alt='" . LAN_PRINT_1 . "'  />" : $genericPrint;
         //TODO CSS class
         $text_emailprint .= "<a class='e-tip " . $class . " hidden-print' href='" . e_HTTP . "print.php?" . $print . "." . $id . "' title='" . LAN_PRINT_1 . "'>" . $ico_print . "</a>";
     }
     return $text_emailprint;
 }
Esempio n. 22
0
function imagepreview_shortcode($parm)
{
    list($name, $width, $height, $nothumb) = explode("|", $parm, 4);
    $name = rawurldecode(varset($name));
    //avoid warnings
    if (varset($width)) {
        $width = intval($width);
    } else {
        $width = 0;
    }
    if (varset($height)) {
        $height = intval($height);
    } else {
        $height = 0;
    }
    // array support
    if (strpos($name, '[')) {
        $matches = array();
        $search = $name;
        $tmp = explode('[', $name, 2);
        $name = $tmp[0];
        unset($tmp);
        $path = '';
        if (isset($_POST[$name]) && is_array($_POST[$name]) && preg_match_all('#\\[([\\w]*)\\]#', $search, $matches, PREG_PATTERN_ORDER)) {
            $posted = $_POST[$name];
            foreach ($matches[1] as $varname) {
                if (!isset($posted[$varname])) {
                    break;
                }
                $posted = $posted[$varname];
            }
        }
        if ($posted && is_string($posted)) {
            $path = e107::getParser()->replaceConstants($posted, 'full');
        }
    } else {
        $path = varset($_POST[$name]) ? e107::getParser()->replaceConstants($_POST[$name], 'full') : '';
    }
    $hide = '';
    if (!$path) {
        $path = '#';
        $thpath = e_IMAGE_ABS . "generic/blank.gif";
        $hide = ' style="display: none;"';
    } else {
        $thpath = !varset($nothumb) ? e107::getParser()->thumbUrl($path, 'w=' . $width . 'h=' . $height, true) : $path;
    }
    return "<a href='{$path}' rel='external shadowbox' class='e-image-preview'{$hide}><img src='{$thpath}' alt=\"\" class='image-selector' /></a>";
}
Esempio n. 23
0
function tablestyle($caption, $text, $mod)
{
    global $style;
    $class = '';
    if (is_string($mod) && $mod == 'admin_help') {
        $class = ' ' . str_replace('_', '-', $mod);
    }
    switch (varset($style, 'admin_content')) {
        case 'admin_menu':
            echo '
			<div class="block">
				<h4 class="caption">' . $caption . '</h4>
				' . $text . '
			</div>
		';
            break;
        case 'site_info':
            echo '
			<div class="block' . $class . '">
				<h4 class="caption">' . $caption . '</h4>
				<div class="block-text">
					' . $text . '
				</div>
			</div>
		';
            break;
        case 'admin_content':
            echo '
			<div class="block">
				<h2 class="caption">' . $caption . '</h2>
				<div class="block-text">
					' . $text . '
				</div>
			</div>
		';
            break;
        default:
            echo '
			<div class="block">
				<h4>' . $caption . '</h4>
				<div class="block-text">
					' . $text . '
				</div>
			</div>
		';
            break;
    }
}
Esempio n. 24
0
 function render()
 {
     $tp = e107::getParser();
     $sql = e107::getDb('nfp');
     $pref = e107::getPref();
     $qry = $this->getQuery();
     if ($results = $sql->gen($qry)) {
         $text = "<ul>";
         while ($row = $sql->fetch()) {
             $datestamp = $tp->toDate($row['post_datestamp'], 'relative');
             $id = $row['thread_id'];
             $topic = $row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:';
             $topic .= strip_tags($tp->toHTML($row['thread_name'], true, 'emotes_off, no_make_clickable, parse_bb', '', $pref['menu_wordwrap']));
             $row['thread_sef'] = $this->forumObj->getThreadSef($row);
             if ($row['post_user_anon']) {
                 $poster = $row['post_user_anon'];
             } else {
                 if ($row['user_name']) {
                     $poster = "<a href='" . e107::getUrl()->create('user/profile/view', array('name' => $row['user_name'], 'id' => $row['post_user'])) . "'>{$row['user_name']}</a>";
                 } else {
                     $poster = '[deleted]';
                 }
             }
             $post = strip_tags($tp->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap']));
             $post = $tp->text_truncate($post, $this->menuPref['characters'], $this->menuPref['postfix']);
             // Count previous posts for calculating proper (topic) page number for the current post.
             //	$postNum = $sql2->count('forum_post', '(*)', "WHERE post_id <= " . $row['post_id'] . " AND post_thread = " . $row['thread_id'] . " ORDER BY post_id ASC");
             //	$postPage = ceil($postNum / vartrue($this->plugPref['postspage'], 10)); // Calculate (topic) page number for the current post.
             //	$thread = $sql->retrieve('forum_thread', '*', 'thread_id = ' . $row['thread_id']); 	// Load thread for passing it to e107::url().
             // Create URL for post.
             // like: e107_plugins/forum/forum_viewtopic.php?f=post&id=1
             $url = e107::url('forum', 'topic', $row, array('query' => array('f' => 'post', 'id' => intval($row['post_id']))));
             $text .= "<li>";
             if ($this->menuPref['title']) {
                 $text .= "<a href='{$url}'>{$topic}</a><br />{$post}<br /><small class='text-muted muted'>" . LAN_FORUM_MENU_001 . " {$poster} {$datestamp}</small>";
             } else {
                 $text .= "<a href='{$url}'>" . LAN_FORUM_MENU_001 . "</a> {$poster} <small class='text-muted muted'>{$datestamp}</small><br />{$post}<br />";
             }
             $text .= "</li>";
         }
         $text .= "</ul>";
     } else {
         $text = LAN_FORUM_MENU_002;
     }
     $caption = varset($this->menuPref['caption'][e_LANGUAGE], $this->menuPref['caption']);
     e107::getRender()->tablerender($caption, $text, 'nfp_menu');
 }
Esempio n. 25
0
 /**
  *	Translate youtube bbcode into the appropriate HTML
  */
 function toHTML($code_text, $parm)
 {
     // transform to class, equal sign at 0 position is not well formed parm string
     if ($parm && !strpos($parm, '=')) {
         $parm = 'class=' . $parm;
     }
     $parms = eHelper::scParams($parm);
     // add auto-generated class name and parameter class if available
     $class = e107::getBB()->getClass('block') . (varset($parms['class']) ? ' ' . $parms['class'] : '');
     $class = ' class="' . $class . '"';
     $id = vartrue($parms['id']) ? ' id="' . eHelper::secureIdAttr($parms['id']) . '"' : '';
     $style = vartrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     if (empty($code_text)) {
         $code_text = '<!-- -->';
     }
     return '<div' . $id . $class . $style . '>' . $code_text . '</div>';
 }
Esempio n. 26
0
function sc_image_thumb($parm = '')
{
    $tp = e107::getParser();
    if ($this->var['your_image'] != '') {
        $att = 'aw=' . $w . '&ah=' . $h . '&x=1';
        // 'aw=190&ah=150';
        varset($parms['class'], 'gallery-thumb img-responsive');
        $linktitle = $tp->toAttribute($this->var['your_image']);
        $imgtitle = $this->var['your_title'];
        $text = "<a class='' title='{$linktitle}' href='" . $tp->thumbUrl($this->var['your_image'], $att) . "' data-gal='prettyPhoto'\n      title='{$linktitle}'   >";
        $text .= '<i class="fa fa-eye fa-2x red"></i>';
        $text .= "</a>";
        return $text;
    } else {
        return '';
    }
}
Esempio n. 27
0
File: url.php Progetto: armpit/e107
 /**
  * Describe all pm routes. 
  * Routes vs legacy queries:
  * list/ 			-> {no query} 
  * list/category	-> download.php?action=list&id={category-id}
  * view/item 		-> download.php?action=view&id={download-id}
  * request/item 	-> request.php?{download-id}
  */
 public function create($route, $params = array(), $options = array())
 {
     if (is_string($route)) {
         $route = explode('/', $route, 2);
     }
     if (!varset($route[0]) || 'index' == $route[0]) {
         $route[0] = 'list';
     }
     $base = e107::getInstance()->getFolder('plugins') . 'download/';
     //	var_dump($options, $route, $params);
     //	print_a($route);
     if ($route[0] == 'list') {
         if (!isset($params['id']) && isset($params['download_category_id'])) {
             $params['id'] = $params['download_category_id'];
         }
         switch ($route[1]) {
             case 'index':
                 $this->legacyQueryString = '';
                 return $base . 'download.php';
                 break;
             case 'category':
                 $url = 'action=list&id=' . $params['id'];
                 if (isset($params['from'])) {
                     $url .= "&from=" . $params['from'] . "&view=" . $params['view'] . "&order=" . $params['order'] . "&sort=" . $params['sort'];
                 }
                 $this->legacyQueryString = $url;
                 return $base . 'download.php?' . $url;
                 break;
         }
     } elseif ($route[0] == 'view') {
         if (!isset($params['id']) && isset($params['download_id'])) {
             $params['id'] = $params['download_id'];
         }
         switch ($route[1]) {
             case 'item':
                 $this->legacyQueryString = 'action=view&id=' . $params['id'];
                 return $base . 'download.php?action=view&id=' . $params['id'];
                 break;
         }
     } elseif ($route[0] == 'request') {
         $this->legacyQueryString = $params['id'];
         return $base . 'request.php?' . $params['id'];
     }
     return false;
 }
Esempio n. 28
0
/**
 * Print out upload form elements and/or process submitted uploads.
 * Your <form> tag must include: enctype='multipart/form-data' - in order to work.
 *
 * Example usage:
 * <code>
 * // Process uploaded file (sent by the form below), it'll print out message (if any)
 * if(isset($_POST['etrigger_uploadfiles']))
 * {
 * 		// NOTE: chmod permissions after upload are set to 0755
 * 		echo e107::getParser()->parseTemplate('{UPLOADFILE='.e_MEDIA.'public|process=1&upload_file_mask=jpg,jpeg,png,gif&upload_final_chmod=493}');
 * }
 *
 * // Render upload form
 * echo '<form action="'.e_SELF.'" enctype="multipart/form-data" method="post">';
 * echo e107::getParser()->parseTemplate('{UPLOADFILE='.e_MEDIA.'public|nowarn&trigger=etrigger_uploadfiles}');
 * echo '</form>';
 * </code>
 *
 * @todo Human readable *nix like permissions option (upload_final_chmod) e.g. 'rw-rw-r--' --> 0664, 'rwxrwxrwx' --> 0777
 *
 * @param string $parm upload_path|parameters (GET query format)
 * 	Available parameters:
 * 	- trigger [render] (string): name attribute of upload trigger button, default 'uploadfiles'
 * 	- name [render|processing] (string): name of upload (file) field, without array brackets ([]), default 'file_userfile'
 * 	- up_container [render] (string): the id attribute of upload container (containing upload field(s)), default 'up_container'
 * 	- up_row [render] (string): the id attribute of upload added fields (diuplicates), default 'upline'
 * 	- process [render|processing] ('0'|'1' boolean): main shortcode action, 0 - render markup, 1 - process uploaded files, default '0'
 *  - upload_file_mask [processing] (string): 'file_mask' parameter of process_uploaded_files() - comma-separated list of file types which if defined limits the allowed file types to those which are
 *  in both this list and the file specified by the 'filetypes' option. Enables restriction to, for example, image files. {@link process_uploaded_files()),
 *  default is empty string
 *  - upload_filetypes [processing] (string): 'filetypes' parameter of process_uploaded_files() - name of file containing list of valid file types, default is empty string
 * 	- upload_extra_file_types [processing] (string): 'extra_file_types' parameter of process_uploaded_files() - '0' (default) rejects totally unknown file extensions;
 *  '1' accepts totally unknown file extensions which are in $options['filetypes'] file; comma-separated list of additional permitted file extensions
 *	- upload_final_chmod [processing] (string): 'final_chmod' parameter of process_uploaded_files() - chmod() to be applied to uploaded files (0644 default).
 *	NOTE: you need to provide number with numerci base of decimal (as a string) which will be auto-converted to octal number
 *	Example: '493' --> 0755; '511' --> 0777
 *	- upload_max_upload_size [processing] (string): 'max_upload_size' parameter of process_uploaded_files() - maximum size of uploaded files in bytes,
 *	or as a string with a 'multiplier' letter (e.g. 16M) at the end, default is empty string
 *	- upload_overwrite [processing] ('0'|'1' boolean): 'overwrite' parameter of process_uploaded_files() - maximum number of files which can be uploaded - default is '0' (unlimited)
 *	- return_type [processing] ('0'|'message'|'result'): 'message' (default) - return messages (eMessage::render() method);
 *	'result' - return array generated by process_uploaded_files();
 *	'0' - return empty string;
 *	NOTE: upload messages are added to 'upload_shortcode' message namespace
 *	<code>
 *	// render messages manually (return_type=0)
 *	echo e107::getMessage()->render('upload_shortcode');
 *	// OR copy them to the default message namespace
 *	e107::getMessage()->moveStack('upload_shortcode', 'default');
 *	// Do something... and render all messages
 *	echo e107::getMessage()->render();
 *	<code>
 * @return mixed Based on 'return_type' parameter - string or uploaded array result
 */
function uploadfile_shortcode($parm)
{
    if (!FILE_UPLOADS) {
        return LAN_UPLOAD_SERVEROFF;
    }
    if (USER_AREA === TRUE && !check_class(e107::getPref('upload_class'))) {
        return LAN_DISABLED;
    }
    $parm = explode('|', $parm, 2);
    $path = $parm[0];
    if ($path && !is_writable($path)) {
        return LAN_UPLOAD_777 . " <b>" . str_replace("../", "", $path) . "</b>";
    }
    $parms = array();
    parse_str(varset($parm[1], ''), $parms);
    $parms = array_merge(array('trigger' => 'uploadfiles', 'name' => 'file_userfile', 'up_container' => 'up_container', 'up_row' => 'upline', 'process' => '0', 'upload_file_mask' => '', 'upload_filetypes' => '', 'upload_extra_file_types' => '0', 'upload_final_chmod' => '', 'upload_max_upload_size' => '0', 'upload_max_file_count' => '0', 'upload_overwrite' => '0', 'return_type' => 'message', 'disable_button' => '0'), $parms);
    // PROCESS UPLOADED FILES, optional usage by external code
    if ($parms['process']) {
        e107_require_once(e_HANDLER . 'upload_handler.php');
        $options = array('file_mask' => $parms['upload_file_mask'], 'filetypes' => $parms['upload_filetypes'], 'extra_file_types' => $parms['upload_extra_file_types'] ? true : false, 'final_chmod' => $parms['upload_final_chmod'] ? intval(intval($parms['upload_final_chmod']), 8) : 0644, 'max_upload_size' => $parms['upload_max_upload_size'], 'file_array_name' => $parms['name'], 'max_file_count' => $parms['upload_max_file_count'], 'overwrite' => $parms['upload_overwrite'] ? true : false);
        $uploaded = process_uploaded_files($path, false, $options);
        if ($uploaded) {
            $emessage = e107::getMessage();
            foreach ($uploaded as $finfo) {
                $emessage->addStack($finfo['message'], 'upload_shortcode', $finfo['error'] ? E_MESSAGE_ERROR : E_MESSAGE_SUCCESS);
            }
            if ($parms['return_type'] == 'message') {
                return $emessage->render('upload_shortcode');
            }
        }
        return $parms['return_type'] == 'result' ? $uploaded : '';
    }
    // RENDER FORM
    $onclickt = !isset($parms['nowarn']) ? " onclick=\"return jsconfirm('" . LAN_UPLOAD_CONFIRM . "')\"" : '';
    $onclickd = " onclick=\"duplicateHTML('{$parms['up_row']}','{$parms['up_container']}');\"";
    $name = $parms['name'] . '[]';
    $text .= "\n\t        <!-- Upload Shortcode -->\n\t\t\t<div>\n\t\t\t\t<div class='field-spacer'>\n\t\t\t\t\t<button class='action duplicate' type='button' value='no-value'{$onclickd}><span>" . LAN_UPLOAD_ADDFILE . "</span></button>";
    // Media Manager does the submit, not the shortcode.
    if (!$parms['disable_button']) {
        $text .= "<button class='upload' type='submit' name='{$parms['trigger']}' value='no-value'{$onclickt}><span>" . LAN_UPLOAD_FILES . "</span></button>";
    }
    $text .= "\n\t\t\t\t</div>\n\t\t\t\t<div id='{$parms['up_container']}'>\n\t\t\t\t\t<div id='{$parms['up_row']}' class='nowrap'>\n\t\t\t\t\t\t<input class='tbox file' type='file' name='{$name}' />\n\t\t\t        </div>\n\t\t\t\t</div>\n\t\t\t\t<div class='field-help'>Upload to: <strong>" . str_replace('../', '', $path) . "</strong></div>\n\t\t\t</div>\n\t\t\t<!-- End Upload Shortcode -->\n\t\t";
    return $text;
}
Esempio n. 29
0
File: url.php Progetto: armpit/e107
 public function create($route, $params = array(), $options = array())
 {
     if (is_string($route)) {
         $route = explode('/', $route, 2);
     }
     if (!varset($route[0]) || 'index' == $route[0]) {
         $route[0] = 'tagwords';
     }
     if (!varset($route[1])) {
         $route[1] = 'tagwords';
     }
     $base = e107::getInstance()->getFolder('plugins') . 'tagwords/';
     if ($route[0] == 'tagwords' || $route[0] == "search") {
         if (isset($params['q'])) {
             return $base . 'tagwords.php?q=' . $params['q'];
         } else {
             return $base . 'tagwords.php';
         }
     }
 }
Esempio n. 30
0
File: url.php Progetto: armpit/e107
 /**
  * 
  */
 public function create($route, $params = array())
 {
     if (!$params) {
         return 'page.php';
     }
     if (is_string($route)) {
         $route = explode('/', $route, 2);
     }
     if (!varset($route[1])) {
         $route[1] = 'index';
     }
     $url = 'page.php?';
     if (isset($params['chapter_id']) && !empty($params['chapter_id'])) {
         $params['id'] = $params['chapter_id'];
     }
     switch ($route[0]) {
         case 'book':
             $url .= "bk=" . intval($params['id']);
             break;
         case 'chapter':
             $url .= "ch=" . intval($params['id']);
             break;
         case 'view':
         default:
             ## aliases as retrieved from the DB, map vars to proper values
             if (isset($params['page_title']) && !empty($params['page_title'])) {
                 $params['name'] = $params['page_title'];
             }
             if (isset($params['page_id']) && !empty($params['page_id'])) {
                 $params['id'] = $params['page_id'];
             }
             if ('--FROM--' != vartrue($params['page'])) {
                 $page = varset($params['page']) ? intval($params['page']) : '0';
             } else {
                 $page = '--FROM--';
             }
             $url .= "id=" . intval($params['id']) . ($page ? '.' . $page : '');
             break;
     }
     return $url;
 }