function smarty_function_link($params, &$smarty)
{
    $loc = $smarty->_tpl_vars['__loc'];
    if (!isset($params['module'])) {
        $params['module'] = $loc->mod;
    }
    if (!isset($params['src'])) {
        $params['src'] = $loc->src;
    }
    if (!isset($params['int'])) {
        $params['int'] = $loc->int;
    }
    echo exponent_core_makeLink($params);
}
Example #2
0
function exponent_core_makeSecureLink($params)
{
    if (!ENABLE_SSL) {
        return exponent_core_makeLink($params);
    }
    $link = SSL_URL . SCRIPT_FILENAME . "?";
    foreach ($params as $key => $value) {
        $value = chop($value);
        $key = chop($key);
        if ($value != "") {
            $link .= urlencode($key) . "=" . urlencode($value) . "&";
        }
    }
    $link = substr($link, 0, -1);
    return $link;
}
 function levelTemplate($parent, $depth = 0, $parents = array())
 {
     if ($parent != 0) {
         $parents[] = $parent;
     }
     global $db, $user;
     $nodes = array();
     if (!isset($_SESSION['nav_cache']['kids'][$parent])) {
         $kids = $db->selectObjects('section', 'parent=' . $parent);
         $_SESSION['nav_cache']['kids'][$parent] = $kids;
     } else {
         $kids = $_SESSION['nav_cache']['kids'][$parent];
     }
     if (!defined('SYS_SORTING')) {
         include_once BASE . 'subsystems/sorting.php';
     }
     usort($kids, 'exponent_sorting_byRankAscending');
     for ($i = 0; $i < count($kids); $i++) {
         $child = $kids[$i];
         //foreach ($kids as $child) {
         if ($child->public == 1 || exponent_permissions_check('view', exponent_core_makeLocation('NavigationModule', '', $child->id))) {
             $child->numParents = count($parents);
             $child->depth = $depth;
             $child->first = $i == 0 ? 1 : 0;
             $child->last = $i == count($kids) - 1 ? 1 : 0;
             $child->parents = $parents;
             $child->canManage = $user && $user->is_acting_admin == 1 ? 1 : 0;
             $child->canManageRank = $child->canManage;
             // Generate the link attribute base on alias type.
             if ($child->alias_type == 1) {
                 // External link.  Set the link to the configured website URL.
                 // This is guaranteed to be a full URL because of the
                 // section::updateExternalAlias() method in datatypes/section.php
                 $child->link = $child->external_link;
             } else {
                 if ($child->alias_type == 2) {
                     // Internal link.
                     // Need to check and see if the internal_id is pointing at an external link.
                     $dest = $db->selectObject('section', 'id=' . $child->internal_id);
                     if ($dest->alias_type == 1) {
                         // This internal alias is pointing at an external alias.
                         // Use the external_link of the destination section for the link
                         $child->link = $dest->external_link;
                     } else {
                         // Pointing at a regular section.  This is guaranteed to be
                         // a regular section because aliases cannot be turned into sections,
                         // (and vice-versa) and because the section::updateInternalLink
                         // does 'alias to alias' dereferencing before the section is saved
                         // (see datatypes/section.php)
                         $child->link = exponent_core_makeLink(array('section' => $child->internal_id));
                     }
                 } else {
                     // Normal link.  Just create the URL from the section's id.
                     $child->link = exponent_core_makeLink(array('section' => $child->id));
                 }
             }
             $child->numChildren = $db->countObjects('section', 'parent=' . $child->id);
             $nodes[] = $child;
             $nodes = array_merge($nodes, NavigationModule::levelTemplate($child->id, $depth + 1, $parents));
         }
     }
     return $nodes;
 }
 function spiderContent($item = null)
 {
     global $db;
     if (!defined('SYS_SEARCH')) {
         require_once BASE . 'subsystems/search.php';
     }
     $search = null;
     $search->category = exponent_lang_loadKey('modules/WeblogModule/class.php', 'search_category');
     $search->view_link = "";
     // FIXME : need a view action
     $search->ref_module = 'WeblogModule';
     $search->ref_type = 'weblog_post';
     $view_link = array('module' => 'WeblogModule', 'action' => 'view', 'id' => 0);
     if ($item && $item->is_draft == 0) {
         $db->delete('search', "ref_module='WeblogModule' AND ref_type='weblog_post' AND original_id=" . $item->id);
         $search->original_id = $item->id;
         $search->body = " " . exponent_search_removeHTML($item->body) . " ";
         $search->title = " " . $item->title . " ";
         $search->location_data = $item->location_data;
         $view_link['id'] = $item->id;
         $search->view_link = exponent_core_makeLink($view_link, true);
         $db->insertObject($search, 'search');
     } else {
         $db->delete('search', "ref_module='WeblogModule' AND ref_type='weblog_post'");
         foreach ($db->selectObjects('weblog_post', 'is_private=0 AND is_draft=0') as $item) {
             $search->original_id = $item->id;
             $search->body = ' ' . exponent_search_removeHTML($item->body) . ' ';
             $search->title = ' ' . $item->title . ' ';
             $search->location_data = $item->location_data;
             $view_link['id'] = $item->id;
             $search->view_link = exponent_core_makeLink($view_link, true);
             $db->insertObject($search, 'search');
         }
     }
     return true;
 }
         }
     }
 }
 if ($canview) {
     $weight = 0;
     $body_l = strtolower($r->body);
     $title_l = strtolower($r->title);
     foreach ($terms as $term) {
         $weight += preg_match("/(\\s+" . $term . "[\\s\\.,:;]+)/", $body_l);
         $weight += preg_match("/(\\s+" . $term . "[\\s\\.,:;]+)/", $title_l);
     }
     if ($weight) {
         // find view link
         if ($r->view_link == "") {
             // No viewlink - go to the page
             $result->view_link = exponent_core_makeLink(array("section" => $sectionref->section));
         } else {
             $result->view_link = URL_FULL . $r->view_link;
         }
         // find title
         if ($r->title == "") {
             // No title - use site title and section name
             $section = $db->selectObject("section", "id=" . $sectionref->section);
             $result->title = $section->name . " :: " . SITE_TITLE;
         } else {
             $result->title = $r->title;
         }
         $lastpos = 0;
         $first = 0;
         $last = 0;
         $halflen = 50;