Esempio n. 1
0
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 pathos_core_makeLink($params);
}
Esempio n. 2
0
function pathos_core_makeSecureLink($params)
{
    if (!ENABLE_SSL) {
        return pathos_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;
}
Esempio n. 3
0
 function _appendChildren(&$master, &$blocks, $parent, $depth = 0, $parents = array())
 {
     global $db;
     if ($parent != 0) {
         $parents[] = $parent;
         // numChildren added for Barry Goed's Explorer-style navigation view
         $master[$parent]->numChildren = count($blocks[$parent]);
     }
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     usort($blocks[$parent], 'pathos_sorting_byRankAscending');
     for ($i = 0; $i < count($blocks[$parent]); $i++) {
         $child = $blocks[$parent][$i];
         if ($child->public == 1 || navigationmodule::canView($child)) {
             $child->numParents = count($parents);
             $child->numChildren = 0;
             $child->depth = $depth;
             $child->first = $i == 0 ? 1 : 0;
             $child->last = $i == count($blocks[$parent]) - 1 ? 1 : 0;
             $child->parents = $parents;
             // 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 = pathos_core_makeLink(array('section' => $child->internal_id));
                     }
                 } else {
                     // Normal link.  Just create the URL from the section's id.
                     $child->link = pathos_core_makeLink(array('section' => $child->id));
                 }
             }
             $master[$child->id] = $child;
             if (isset($blocks[$child->id])) {
                 navigationmodule::_appendChildren($master, $blocks, $child->id, $depth + 1, $parents);
             }
         }
     }
 }
Esempio n. 4
0
        //user in pMachine database does not exist in Exponent user table
        $id_map[$pm_user->id] = $db->insertObject($new_user, "user");
    } else {
        //User is pMachine user table does match a user in Exponent user table
        //Value in $opt variable tells us how to deal with the conflict
        //Since only $opt value that requires action is 1, use if statement
        if ($opt == 1) {
            $id_map[$pm_user->id] = $exp_user->id;
            //Update Exponent user with data from pMachine user entry
            $db->updateObject($new_user, "user", "username = '******'");
        }
    }
}
//Gets url data from session
$url = $post['url_array'];
//Stores ID mapping array in session data
$post['id_map'] = $id_map;
//Store daa back into session variable
pathos_sessions_set("post", $post);
//User chose to import pMachine blog data
if ($post['blog_imp'] == 1) {
    //Goes to blog import page
    $url['page'] = "blog_conf";
    header("Location: " . pathos_core_makeLink($url));
    exit;
} else {
    //Goes to summary page
    $url['page'] = "done";
    header("Location: " . pathos_core_makeLink($url));
    exit;
}
Esempio n. 5
0
 function spiderContent($item = null)
 {
     global $db;
     if (!defined('SYS_SEARCH')) {
         require_once BASE . 'subsystems/search.php';
     }
     pathos_lang_loadDictionary('modules', 'weblogmodule');
     $search = null;
     $search->category = TR_WEBLOGMODULE_SEARCHTYPE;
     $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 = " " . pathos_search_removeHTML($item->body) . " ";
         $search->title = " " . $item->title . " ";
         $search->location_data = $item->location_data;
         $view_link['id'] = $item->id;
         $search->view_link = pathos_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 = ' ' . pathos_search_removeHTML($item->body) . ' ';
             $search->title = ' ' . $item->title . ' ';
             $search->location_data = $item->location_data;
             $view_link['id'] = $item->id;
             $search->view_link = pathos_core_makeLink($view_link, true);
             $db->insertObject($search, 'search');
         }
     }
     return true;
 }
Esempio n. 6
0
         }
     }
 }
 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 = pathos_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;