# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
// Bail in case someone has visited us directly, or the Exponent framework is
// otherwise not initialized.
if (!defined('EXPONENT')) {
    exit('');
}
$section = section::updatePageset($_POST, null);
if (exponent_permissions_check('manage', exponent_core_makeLocation('NavigationModule', '', $section->parent))) {
    // Still have to do some pageset processing, mostly handled by a handy
    // member method of the NavigationModule class.
    // Since this is new, we need to increment ranks, in case the user
    // added it in the middle of the level.
    $db->increment('section', 'rank', 1, 'rank >= ' . $section->rank . ' AND parent=' . $section->parent);
    // New section (Pagesets always are).  Insert a new database
    // record, and save the ID for the processing methods that need them.
    $section->id = $db->insertObject($section, 'section');
    // Process the pageset, to add sections and subsections, as well as default content
    // that the pageset writer added to each element of the set.
    if (isset($_SESSION['nav_cache']['kids'])) {
        unset($_SESSION['nav_cache']['kids']);
    }
    NavigationModule::process_section($section, $_POST['pageset']);
    // Go back to where we came from.  Probably the navigation manager.
    exponent_flow_redirect();
} else {
    echo SITE_403_HTML;
}
 function canView($section)
 {
     global $db;
     if ($section->public == 0) {
         // Not a public section.  Check permissions.
         return exponent_permissions_check('view', exponent_core_makeLocation('NavigationModule', '', $section->id));
     } else {
         // Is public.  check parents.
         if ($section->parent <= 0) {
             // Out of parents, and since we are still checking, we haven't hit a private section.
             return true;
         } else {
             $s = $db->selectObject('section', 'id=' . $section->parent);
             return NavigationModule::canView($s);
         }
     }
 }
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if ($user->is_acting_admin == 1) {
    $section = $db->selectObject('section', 'id=' . intval($_GET['id']));
    if ($section) {
        NavigationModule::deleteLevel($section->id);
        $db->delete('section', 'id=' . $section->id);
        $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);
        if (isset($_SESSION['nav_cache']['kids'])) {
            unset($_SESSION['nav_cache']['kids']);
        }
        exponent_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
    require_once BASE . 'subsystems/flow.php';
}
// Validate session
exponent_sessions_validate();
// Initialize permissions variables
exponent_permissions_initialize();
#$section = (exponent_sessions_isset('last_section') ? exponent_sessions_get('last_section') : SITE_DEFAULT_SECTION);
if (isset($_REQUEST['action']) && isset($_REQUEST['module'])) {
    $section = exponent_sessions_isset('last_section') ? exponent_sessions_get('last_section') : SITE_DEFAULT_SECTION;
} else {
    $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : SITE_DEFAULT_SECTION;
}
$section = $db->selectObject('section', 'id=' . intval($section));
if (!NavigationModule::canView($section)) {
    define('AUTHORIZED_SECTION', 0);
} else {
    define('AUTHORIZED_SECTION', 1);
}
if (!NavigationModule::isPublic($section)) {
    define('PUBLIC_SECTION', 0);
} else {
    define('PUBLIC_SECTION', 1);
}
function eDebug($var)
{
    if (DEVELOPMENT) {
        echo "<xmp>";
        print_r($var);
        echo "</xmp>";
    }
}
    include_once BASE . "subsystems/search.php";
}
$search_string = trim(strtolower(strip_tags($_GET['search_string'])));
if ($search_string == "") {
    echo exponent_lang_loadKey('modules/SearchModule/actions/search.php', 'need_term');
    return;
}
$term_status = exponent_search_cleanSearchQuery(array_map("addslashes", array_map("trim", split(" ", $search_string))));
$terms = $term_status['valid'];
$results = array();
foreach ($db->selectObjects("search", exponent_search_whereClause(array("title", "body"), $terms, SEARCH_TYPE_ANY)) as $r) {
    $result = null;
    $rloc = unserialize($r->location_data);
    $sectionref = $db->selectObject("sectionref", "module='" . $rloc->mod . "' AND source='" . $rloc->src . "'");
    $section = $db->selectObject("section", "id=" . $sectionref->section);
    $canview = NavigationModule::canView($section);
    if ($canview && $r->view_perm != '') {
        // No point in checking the perm stuff if they cant even see the section
        $canview = false;
        // They need to have specific perms on the module.
        foreach (explode(',', $r->view_perm) as $p) {
            if (exponent_permissions_check($p, $rloc)) {
                $canview = true;
                break;
            }
        }
    }
    if ($canview) {
        $weight = 0;
        $body_l = strtolower($r->body);
        $title_l = strtolower($r->title);
<?php

##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if ($user) {
    $sections = NavigationModule::levelTemplate(0, 0);
    $standalones = $db->selectObjects('section', 'parent = -1');
    $template = new template('NavigationModule', '_linker');
    $template->assign('sections', $sections);
    $template->assign('standalones', $standalones);
    $template->assign('haveStandalones', count($standalones));
    $template->output();
}
##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if (exponent_permissions_checkOnModule('manage', 'NavigationModule')) {
    exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $template = new template('NavigationModule', '_manager', $loc);
    $template->assign('sections', NavigationModule::levelTemplate(0, 0));
    // Templates
    $tpls = $db->selectObjects('section_template', 'parent=0');
    $template->assign('templates', $tpls);
    $template->output();
} else {
    echo SITE_403_HTML;
}
 function internalAliasForm($object = null)
 {
     $i18n = exponent_lang_loadFile('datatypes/section.php');
     // Initialize the forms subsystem for use.
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     exponent_forms_initialize();
     // Initialization
     if (!isset($object->id)) {
         $object->internal_id = 0;
     }
     // Grab the basic form that all page types share
     // This has the name and positional dropdowns registered.
     // This call also initializes the section object, if it is not an existing section.
     $form = section::_commonForm($object);
     // Add a dropdown to allow the user to choose an internal page.
     $form->register('internal_id', $i18n['internal_link'], new dropdowncontrol($object->internal_id, NavigationModule::levelDropDownControlArray(0, 0)));
     // Add the'Public?' checkbox.  The 'Active?' checkbox is omitted, because it makes no sense.
     $form->register('public', $i18n['public'], new checkboxcontrol($object->public));
     // Add a Submit / Cancel button.
     $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
     // Return the form to the calling scope (usually an action in the navigation module).
     return $form;
 }
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if ($user && $user->is_acting_admin == 1) {
    $page = null;
    if (isset($_GET['id'])) {
        $page = $db->selectObject('section_template', 'id=' . intval($_GET['id']));
    }
    if ($page) {
        exponent_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
        $template = new template('NavigationModule', '_view_template', $loc);
        $template->assign('template', $page);
        $template->assign('subs', NavigationModule::getTemplateHierarchyFlat($page->id));
        $template->output();
    } else {
        echo SITE_404_HTML;
    }
} else {
    echo SITE_403_HTML;
}
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Copyright (c) 2006 Maxim Mueller
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$i18n = exponent_lang_loadFile('conf/extensions/site.structure.php');
foreach (glob(BASE . "external/editors/*.glue") as $installed_glue_file) {
    $installed_editor = basename($installed_glue_file, ".glue");
    $installed_editors[$installed_editor] = $installed_editor;
}
$stuff = array($i18n['title'], array('SITE_TITLE' => array('title' => $i18n['site_title'], 'description' => $i18n['site_title_desc'], 'control' => new textcontrol()), 'USE_LANG' => array('title' => $i18n['use_lang'], 'description' => $i18n['use_lang_desc'], 'control' => new dropdowncontrol(0, exponent_lang_list())), 'SITE_ALLOW_REGISTRATION' => array('title' => $i18n['allow_registration'], 'description' => $i18n['allow_registration_desc'], 'control' => new checkboxcontrol()), 'SITE_USE_CAPTCHA' => array('title' => $i18n['use_captcha'], 'description' => $i18n['use_captcha_desc'], 'control' => new checkboxcontrol()), 'SITE_KEYWORDS' => array('title' => $i18n['site_keywords'], 'description' => $i18n['site_keywords_desc'], 'control' => new texteditorcontrol('', 10, 30)), 'SITE_DESCRIPTION' => array('title' => $i18n['site_description'], 'description' => $i18n['site_description_desc'], 'control' => new texteditorcontrol('', 15, 50)), 'SITE_404_HTML' => array('title' => $i18n['site_404'], 'description' => $i18n['site_404_desc'], 'control' => new htmleditorcontrol('', 15, 50)), 'SITE_403_REAL_HTML' => array('title' => $i18n['site_403'], 'description' => $i18n['site_403_desc'], 'control' => new htmleditorcontrol('', 15, 50)), 'SITE_DEFAULT_SECTION' => array('title' => $i18n['default_section'], 'description' => $i18n['default_section_desc'], 'control' => new dropdowncontrol('', NavigationModule::levelDropDownControlArray(0))), 'SITE_WYSIWYG_EDITOR' => array('title' => $i18n['wysiwyg_editor'], 'description' => $i18n['wysiwyg_editor_desc'], 'control' => new dropdowncontrol(null, $installed_editors)), 'SESSION_TIMEOUT' => array('title' => $i18n['session_timeout'], 'description' => $i18n['session_timeout_desc'], 'control' => new textcontrol()), 'SESSION_TIMEOUT_HTML' => array('title' => $i18n['timeout_error'], 'description' => $i18n['timeout_error_desc'], 'control' => new htmleditorcontrol('', 15, 50)), 'FILE_DEFAULT_MODE_STR' => array('title' => $i18n['fileperms'], 'description' => $i18n['fileperms_desc'], 'control' => new dropdowncontrol(null, exponent_config_dropdownData('file_permissions'))), 'DIR_DEFAULT_MODE_STR' => array('title' => $i18n['dirperms'], 'description' => $i18n['dirperms_desc'], 'control' => new dropdowncontrol(null, exponent_config_dropdownData('dir_permissions'))), 'ENABLE_SSL' => array('title' => $i18n['ssl'], 'description' => $i18n['ssl_desc'], 'control' => new checkboxcontrol()), 'NONSSL_URL' => array('title' => $i18n['nonssl_url'], 'description' => $i18n['nonssl_url_desc'], 'control' => new textcontrol()), 'SSL_URL' => array('title' => $i18n['ssl_url'], 'description' => $i18n['ssl_url_desc'], 'control' => new textcontrol()), 'WORKFLOW_REVISION_LIMIT' => array('title' => $i18n['revision_limit'], 'description' => $i18n['revision_limit_desc'], 'control' => new textcontrol())));
$info = gd_info();
if (!EXPONENT_HAS_GD) {
    $stuff[1]['SITE_USE_CAPTCHA']['description'] = $i18n['use_captcha_desc'] . '<br /><br />' . $i18n['no_gd_support'];
    $stuff[1]['SITE_USE_CAPTCHA']['control']->disabled = true;
}
return $stuff;
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if ($user->is_acting_admin == 1) {
    $section = $db->selectObject('section', 'id=' . intval($_GET['id']));
    if ($section) {
        NavigationModule::removeLevel($section->id);
        $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);
        $section->parent = -1;
        $db->updateObject($section, 'section');
        if (isset($_SESSION['nav_cache']['kids'])) {
            unset($_SESSION['nav_cache']['kids']);
        }
        exponent_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}