Esempio n. 1
0
 function show($view, $loc = null, $title = '')
 {
     $template = new template('searchmodule', $view, $loc);
     $template->assign('loc', $loc);
     $template->register_permissions(array('administrate', 'configure'), $loc);
     $template->output();
 }
 function show($view, $loc = null, $title = '')
 {
     if (exponent_permissions_check('administrate', $loc) || exponent_permissions_check('create', $loc) || exponent_permissions_check('edit', $loc) || exponent_permissions_check('delete', $loc)) {
         $template = new template('HTMLTemplateModule', $view, $loc);
         $template->assign('noupload', 0);
         $template->assign('uploadError', '');
         if (!defined('SYS_FILES')) {
             include_once BASE . 'subsystems/files.php';
         }
         $directory = 'files/HTMLTemplateModule/' . $loc->src;
         if (!file_exists(BASE . $directory)) {
             $err = exponent_files_makeDirectory($directory);
             if ($err != SYS_FILES_SUCCESS) {
                 $template->assign('noupload', 1);
                 $template->assign('uploadError', $err);
             }
         }
         global $db;
         $templates = $db->selectObjects('htmltemplate');
         for ($i = 0; $i < count($templates); $i++) {
             $assocs = $db->selectObjects('htmltemplateassociation', 'template_id=' . $templates[$i]->id);
             if (count($assocs) == 1 && $assocs[0]->global == 1) {
                 $templates[$i]->global_assoc = 1;
             } else {
                 $templates[$i]->global_assoc = 0;
                 $templates[$i]->associations = $assocs;
             }
         }
         $template->assign('moduletitle', $title);
         $template->assign('templates', $templates);
         $template->register_permissions(array('administrate', 'create', 'edit', 'delete'), exponent_core_makeLocation('HTMLTemplateModule'));
         $template->output();
     }
 }
 function show($view, $loc = null, $title = '')
 {
     global $db;
     $contacts = $db->selectObjects('contact_contact', "location_data='" . serialize($loc) . "'");
     $t = new template('ContactModule', '_standard', $loc);
     $t->register_permissions(array('administrate', 'configure'), $loc);
     $t->output();
     $template = new template('ContactModule', $view, $loc);
     $template->assign('contacts', $contacts);
     $template->assign('loc', $loc);
     $template->assign('numContacts', count($contacts));
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'configure'), $loc);
     $template->output();
 }
 function show($view, $loc, $title)
 {
     global $db, $user;
     if ($user) {
         $template = new template('InboxModule', $view, $loc);
         $read = $db->countObjects('privatemessage', 'recipient=' . $user->id . ' AND unread=0');
         $unread = $db->countObjects('privatemessage', 'recipient=' . $user->id . ' AND unread=1');
         $template->assign('readMessages', $read);
         $template->assign('unreadMessages', $unread);
         $template->assign('totalMessages', $unread + $read);
         $template->assign('user', $user);
         $template->assign('moduletitle', $title);
         $template->register_permissions('administrate', $loc);
         $template->output();
     }
 }
Esempio n. 5
0
 function show($view, $loc = null, $title = '')
 {
     global $db;
     $template = new template('translatormodule', $view, $loc);
     $langs = array();
     $lloc = pathos_core_makeLocation('translatormodule');
     foreach ($db->selectObjects('translation_language') as $lang) {
         $lloc->int = $lang->id;
         $lang->permissions = array('administrate' => pathos_permissions_check('administrate', $lloc) ? 1 : 0, 'configure' => pathos_permissions_check('configure', $lloc) ? 1 : 0);
         $langs[] = $lang;
     }
     $template->assign('languages', $langs);
     $template->assign('dictionaries', translatormodule::dictionaries());
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'configure'), $loc);
     $template->output();
 }
Esempio n. 6
0
 function show($view, $loc = null, $title = '')
 {
     global $db;
     $question = $db->selectObject('poll_question', "is_active = 1 AND location_data='" . serialize($loc) . "'");
     $answers = array();
     if ($question) {
         $answers = $db->selectObjects('poll_answer', 'question_id=' . $question->id);
     }
     $answers = expSorter::sort(array('array' => $answers, 'sortby' => 'rank', 'order' => 'ASC'));
     $template = new template('simplepollmodule', $view, $loc);
     $template->assign('moduletitle', $title);
     $template->assign('question', $question);
     $template->assign('answers', $answers);
     $template->assign('have_answers', count($answers));
     $template->register_permissions(array('administrate', 'configure', 'manage_question', 'manage_answer'), $loc);
     $template->output();
 }
 function show($view, $loc = null, $title = '')
 {
     $template = new template('SharedCoreModule', $view);
     global $db;
     $cores = array();
     foreach ($db->selectObjects('sharedcore_core') as $c) {
         if (file_exists($c->path . 'exponent_version.php')) {
             $c->version = (include $c->path . 'exponent_version.php');
             $c->linked = $db->selectObjects('sharedcore_site', 'core_id=' . $c->id);
             $cores[] = $c;
         }
     }
     $template->assign('cores', $cores);
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'manage'), $loc);
     $template->output();
 }
Esempio n. 8
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     $obj = null;
     $o = $db->selectObjects('rotator_item', "location_data='" . serialize($loc) . "'");
     $num = rand(0, count($o) - 1);
     if (isset($o[$num])) {
         $obj = $o[$num];
     } else {
         $obj->text = '';
     }
     $template = new template('rotatormodule', $view, $loc);
     $template->assign('moduletitle', $title);
     $template->assign('content', $obj);
     $template->register_permissions(array('administrate', 'manage'), $loc);
     $template->output();
 }
Esempio n. 9
0
 function show($view, $loc = null, $title = '')
 {
     global $db;
     $question = $db->selectObject('poll_question', "is_active = 1 AND location_data='" . serialize($loc) . "'");
     $answers = array();
     if ($question) {
         $answers = $db->selectObjects('poll_answer', 'question_id=' . $question->id);
     }
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     usort($answers, 'pathos_sorting_byRankAscending');
     $template = new template('simplepollmodule', $view, $loc);
     $template->assign('question', $question);
     $template->assign('answers', $answers);
     $template->assign('have_answers', count($answers));
     $template->register_permissions(array('administrate', 'configure', 'manage_question', 'manage_answer'), $loc);
     $template->output();
 }
Esempio n. 10
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     $milestones = $db->selectObjects("codemap_milestone", "location_data='" . serialize($loc) . "'");
     if (!defined("SYS_SORTING")) {
         require_once BASE . "subsystems/sorting.php";
     }
     uasort($milestones, "pathos_sorting_byRankAscending");
     $stepstones = array();
     foreach ($milestones as $m) {
         $tmp = $db->selectObjects("codemap_stepstone", "milestone_id=" . $m->id . " AND location_data='" . serialize($loc) . "'");
         usort($tmp, "pathos_sorting_byNameAscending");
         $stepstones = array_merge($stepstones, $tmp);
     }
     #$stepstones = $db->selectObjects("codemap_stepstone","location_data='".serialize($loc)."'");
     $template = new template("codemapmodule", $view, $loc);
     $template->assign("milestones", $milestones);
     $template->assign("stepstones", $stepstones);
     $template->assign("moduletitle", $title);
     $template->register_permissions(array("administrate", "manage_steps", "manage_miles"), $loc);
     $template->output();
 }
 function show($view, $loc, $title = '')
 {
     if (!defined('SYS_FILES')) {
         require_once BASE . 'subsystems/files.php';
     }
     $template = new template('ResourceModule', $view, $loc);
     $directory = 'files/ResourceModule/' . $loc->src;
     if (!file_exists(BASE . $directory)) {
         $err = exponent_files_makeDirectory($directory);
         if ($err != SYS_FILES_SUCCESS) {
             $template->assign('noupload', 1);
             $template->assign('uploadError', $err);
         }
     }
     global $db;
     $location = serialize($loc);
     if (!isset($_SESSION['resource_cache'][$location])) {
         $resources = $db->selectObjects('resourceitem', "location_data='" . serialize($loc) . "'");
         $_SESSION['resource_cache'][$location] = $resources;
     } else {
         $resources = $_SESSION['resource_cache'][$location];
     }
     $iloc = exponent_core_makeLocation($loc->mod, $loc->src);
     for ($i = 0; $i < count($resources); $i++) {
         $iloc->int = $resources[$i]->id;
         $resources[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $iloc), 'edit' => exponent_permissions_check('edit', $iloc), 'delete' => exponent_permissions_check('delete', $iloc));
     }
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     usort($resources, 'exponent_sorting_byRankAscending');
     $rfiles = array();
     foreach ($db->selectObjects('file', "directory='{$directory}'") as $file) {
         $file->mimetype = $db->selectObject('mimetype', "mimetype='" . $file->mimetype . "'");
         $rfiles[$file->id] = $file;
     }
     $template->assign('moduletitle', $title);
     $template->assign('resources', $resources);
     $template->assign('files', $rfiles);
     $template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete'), $loc);
     $template->output($view);
 }
Esempio n. 12
0
 function show($view, $loc = null, $title = '')
 {
     global $user;
     global $db;
     $template = new template('calendarmodule', $view, $loc);
     $template->assign('moduletitle', $title);
     $canviewapproval = false;
     $inapproval = false;
     if ($user) {
         $canviewapproval = pathos_permissions_check("approve", $loc) || pathos_permissions_check("manage_approval", $loc);
     }
     if ($db->countObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1")) {
         foreach ($db->selectObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1") as $c) {
             if ($c->poster == $user->id) {
                 $canviewapproval = true;
             }
         }
         $inapproval = true;
     }
     $time = isset($_GET['time']) ? $_GET['time'] : time();
     $template->assign("time", $time);
     $viewconfig = $template->viewparams;
     if ($viewconfig === null) {
         $viewconfig = array("type" => "default");
     }
     if (!defined("SYS_DATETIME")) {
         require_once BASE . "subsystems/datetime.php";
     }
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     if (!function_exists("pathos_sorting_byEventStartAscending")) {
         function pathos_sorting_byEventStartAscending($a, $b)
         {
             return $a->eventstart < $b->eventstart ? -1 : 1;
         }
     }
     if ($viewconfig['type'] == "minical") {
         $monthly = array();
         $datesWithEvents = array();
         $info = getdate(time());
         $info = getdate(time());
         // Grab non-day numbers only (before end of month)
         $week = 0;
         $currentweek = 0;
         $currentday = $info['mday'];
         $infofirst = getdate(mktime(12, 0, 0, $info['mon'], 1, $info['year']));
         if ($infofirst['wday'] == 0) {
             $monthly[$week] = array();
         }
         // initialize for non days
         for ($i = 0 - $infofirst['wday']; $i < 0; $i++) {
             $monthly[$week][$i] = array("number" => -1, "ts" => -1);
         }
         $weekday = $infofirst['wday'];
         // day number in grid.  if 7+, switch weeks
         // Grab day counts
         $endofmonth = pathos_datetime_endOfMonthDay(time());
         for ($i = 1; $i <= $endofmonth; $i++) {
             $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);
             if ($i == $info['mday']) {
                 $currentweek = $week;
             }
             #$monthly[$week][$i] = array("ts"=>$start,"number"=>$db->countObjects("calendar","location_data='".serialize($loc)."' AND approved!=0 AND (eventstart >= $start AND eventend <= " . ($start+86399) . ")"));
             // NO WORKFLOW CONSIDERATIONS
             $monthly[$week][$i] = array("ts" => $start, "number" => $db->countObjects("eventdate", "location_data='" . serialize($loc) . "' AND date = {$start}"));
             if ($monthly[$week][$i]["number"] > 0) {
                 $datesWithEvents[] = $i;
             }
             if ($weekday >= 6) {
                 $week++;
                 $monthly[$week] = array();
                 // allocate an array for the next week
                 $weekday = 0;
             } else {
                 $weekday++;
             }
         }
         // Grab non-day numbers only (after end of month)
         for ($i = 1; $weekday && $i <= 7 - $weekday; $i++) {
             $monthly[$week][$i + $endofmonth] = -1;
         }
         $template->assign("datesWithEvents", implode(",", $datesWithEvents));
         $template->assign("monthly", $monthly);
         $template->assign("currentweek", $currentweek);
         $template->assign("currentday", $currentday);
         $template->assign("now", time());
     } else {
         if ($viewconfig['type'] == "byday") {
             $startperiod = 0;
             $totaldays = 0;
             if ($viewconfig['range'] == "week") {
                 $startperiod = pathos_datetime_startOfWeekTimestamp($time);
                 $totaldays = 7;
             } else {
                 $startperiod = pathos_datetime_startOfMonthTimestamp($time);
                 $totaldays = pathos_datetime_endOfMonthDay($time);
             }
             $template->assign("prev_timestamp", $startperiod - 3600);
             $template->assign("next_timestamp", $startperiod + $totaldays * 86400 + 3600);
             $days = array();
             for ($i = 0; $i < $totaldays; $i++) {
                 $start = $startperiod + $i * 86400;
                 #$days[$start] = $db->selectObjects("calendar","location_data='".serialize($loc)."' AND (eventstart >= $start AND eventend <= " . ($start+86399) . ") AND approved!=0");
                 $edates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date = {$start}");
                 $days[$start] = calendarmodule::_getEventsForDates($edates);
                 for ($j = 0; $j < count($days[$start]); $j++) {
                     $thisloc = pathos_core_makeLocation($loc->mod, $loc->src, $days[$start][$j]->id);
                     $days[$start][$j]->permissions = array("administrate" => pathos_permissions_check("administrate", $thisloc) || pathos_permissions_check("administrate", $loc), "edit" => pathos_permissions_check("edit", $thisloc) || pathos_permissions_check("edit", $loc), "delete" => pathos_permissions_check("delete", $thisloc) || pathos_permissions_check("delete", $loc));
                 }
                 usort($days[$start], "pathos_sorting_byEventStartAscending");
             }
             $template->assign("days", $days);
         } else {
             if ($viewconfig['type'] == "monthly") {
                 $monthly = array();
                 $counts = array();
                 $info = getdate($time);
                 $nowinfo = getdate(time());
                 if ($info['mon'] != $nowinfo['mon']) {
                     $nowinfo['mday'] = -10;
                 }
                 // Grab non-day numbers only (before end of month)
                 $week = 0;
                 $currentweek = -1;
                 $timefirst = mktime(12, 0, 0, $info['mon'], 1, $info['year']);
                 $infofirst = getdate($timefirst);
                 if ($infofirst['wday'] == 0) {
                     $monthly[$week] = array();
                     // initialize for non days
                     $counts[$week] = array();
                 }
                 for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {
                     $monthly[$week][$i] = array();
                     $counts[$week][$i] = -1;
                 }
                 $weekday = $infofirst['wday'];
                 // day number in grid.  if 7+, switch weeks
                 // Grab day counts
                 $endofmonth = pathos_datetime_endOfMonthDay($time);
                 for ($i = 1; $i <= $endofmonth; $i++) {
                     $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);
                     if ($i == $nowinfo['mday']) {
                         $currentweek = $week;
                     }
                     #$monthly[$week][$i] = $db->selectObjects("calendar","location_data='".serialize($loc)."' AND (eventstart >= $start AND eventend <= " . ($start+86399) . ") AND approved!=0");
                     $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date = {$start}");
                     $monthly[$week][$i] = calendarmodule::_getEventsForDates($dates);
                     $counts[$week][$i] = count($monthly[$week][$i]);
                     if ($weekday >= 6) {
                         $week++;
                         $monthly[$week] = array();
                         // allocate an array for the next week
                         $counts[$week] = array();
                         $weekday = 0;
                     } else {
                         $weekday++;
                     }
                 }
                 // Grab non-day numbers only (after end of month)
                 for ($i = 1; $weekday && $i < 8 - $weekday; $i++) {
                     $monthly[$week][$i + $endofmonth] = array();
                     $counts[$week][$i + $endofmonth] = -1;
                 }
                 $template->assign("currentweek", $currentweek);
                 $template->assign("monthly", $monthly);
                 $template->assign("counts", $counts);
                 $template->assign("nextmonth", $timefirst + 86400 * 45);
                 $template->assign("prevmonth", $timefirst - 86400 * 15);
                 $template->assign("now", $timefirst);
             } else {
                 if ($viewconfig['type'] == "administration") {
                     // Check perms and return if cant view
                     if ($viewconfig['type'] == "administration" && !$user) {
                         return;
                     }
                     $continue = pathos_permissions_check("administrate", $loc) || pathos_permissions_check("post", $loc) || pathos_permissions_check("edit", $loc) || pathos_permissions_check("delete", $loc) || pathos_permissions_check("approve", $loc) || pathos_permissions_check("manage_approval", $loc) ? 1 : 0;
                     $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "'");
                     $items = calendarmodule::_getEventsForDates($dates);
                     if (!$continue) {
                         foreach ($items as $i) {
                             $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $i->id);
                             if (pathos_permissions_check("edit", $iloc) || pathos_permissions_check("delete", $iloc) || pathos_permissions_check("administrate", $iloc)) {
                                 $continue = true;
                             }
                         }
                     }
                     if (!$continue) {
                         return;
                     }
                     for ($i = 0; $i < count($items); $i++) {
                         $thisloc = pathos_core_makeLocation($loc->mod, $loc->src, $items[$i]->id);
                         if ($user && $items[$i]->poster == $user->id) {
                             $canviewapproval = 1;
                         }
                         $items[$i]->permissions = array("administrate" => pathos_permissions_check("administrate", $thisloc) || pathos_permissions_check("administrate", $loc), "edit" => pathos_permissions_check("edit", $thisloc) || pathos_permissions_check("edit", $loc), "delete" => pathos_permissions_check("delete", $thisloc) || pathos_permissions_check("delete", $loc));
                     }
                     usort($items, "pathos_sorting_byEventStartAscending");
                     $template->assign("items", $items);
                 } else {
                     if ($viewconfig['type'] == "default") {
                         if (!isset($viewconfig['range'])) {
                             $viewconfig['range'] = "all";
                         }
                         $limit = '';
                         if (isset($template->viewconfig) && isset($template->viewconfig['num_events']) && $template->viewconfig['num_events'] != 0) {
                             $limit = $db->limit($template->viewconfig['num_events'], 0);
                         }
                         $items = null;
                         $dates = null;
                         $day = pathos_datetime_startOfDayTimestamp(time());
                         $sort_asc = true;
                         // For the getEventsForDates call
                         switch ($viewconfig['range']) {
                             case "all":
                                 #$items = $db->selectObjects("calendar","location_data='" . serialize($loc) . "' AND approved!=0");
                                 $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "'");
                                 break;
                             case "upcoming":
                                 #$items = $db->selectObjects("calendar","location_data='" . serialize($loc) . "' AND approved!=0 AND eventstart >= ".time());
                                 $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date > {$day} ORDER BY date ASC " . $limit);
                                 break;
                             case "past":
                                 #$items = $db->selectObjects("calendar","location_data='" . serialize($loc) . "' AND approved!=0 AND eventstart < ".time());
                                 $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date < {$day} ORDER BY date DESC " . $limit);
                                 $sort_asc = false;
                                 break;
                             case "today":
                                 #$items = $db->selectObjects("calendar","location_data='" . serialize($loc) . "' AND approved!=0 AND eventstart >= ".pathos_datetime_startOfDayTimestamp(time()) . " AND eventend <= " . (pathos_datetime_startOfDayTimestamp(time()) + 86400));
                                 $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date = {$day}");
                                 break;
                             case "next":
                                 #$items = array($db->selectObject("calendar","location_data='" . serialize($loc) . "' AND approved!=0 AND eventstart >= ".time()));
                                 $dates = array($db->selectObject("eventdate", "location_data='" . serialize($loc) . "' AND date >= {$day}"));
                                 break;
                             case "month":
                                 #$items = $db->selectObjects("calendar","location_data='" . serialize($loc) . "' AND approved!=0 AND eventstart >= ".pathos_datetime_startOfMonthTimestamp(time()) . " AND eventend <= " . pathos_datetime_endOfMonthTimestamp(time()));
                                 $dates = $db->selectObjects("eventdate", "location_data='" . serialize($loc) . "' AND date >= " . pathos_datetime_startOfMonthTimestamp(time()) . " AND date <= " . pathos_datetime_endOfMonthTimestamp(time()));
                                 break;
                         }
                         $items = calendarmodule::_getEventsForDates($dates, $sort_asc);
                         for ($i = 0; $i < count($items); $i++) {
                             $thisloc = pathos_core_makeLocation($loc->mod, $loc->src, $items[$i]->id);
                             if ($user && $items[$i]->poster == $user->id) {
                                 $canviewapproval = 1;
                             }
                             $items[$i]->permissions = array('administrate' => pathos_permissions_check('administrate', $thisloc) || pathos_permissions_check('administrate', $loc), 'edit' => pathos_permissions_check('edit', $thisloc) || pathos_permissions_check('edit', $loc), 'delete' => pathos_permissions_check('delete', $thisloc) || pathos_permissions_check('delete', $loc));
                         }
                         $template->assign('items', $items);
                     }
                 }
             }
         }
     }
     $template->assign('in_approval', $inapproval);
     $template->assign('canview_approval_link', $canviewapproval);
     $template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'manage_approval', 'manage_categories', 'view'), $loc);
     $cats = $db->selectObjectsIndexedArray("category", "location_data='" . serialize($loc) . "'");
     $cats[0] = null;
     $cats[0]->name = "<i>{#i18n_noitemsfound#}</i>";
     $cats[0]->color = "#000000";
     $template->assign("categories", $cats);
     $config = $db->selectObject("calendarmodule_config", "location_data='" . serialize($loc) . "'");
     if (!$config) {
         $config->enable_categories = 0;
     }
     $template->assign("modconfig", $config);
     $template->output();
 }
if ($config == null) {
    $config->allow_comments = 1;
    $config->items_per_page = 10;
}
if (isset($_GET['single'])) {
    $config->items_per_page = 1;
}
$where = "location_data='" . serialize($loc) . "' AND (is_draft = 0 OR poster = " . ($user ? $user->id : -1) . ")";
if (!exponent_permissions_check('view_private', $loc)) {
    $where .= ' AND is_private = 0';
}
$total = $db->countObjects('weblog_post', $where);
$posts = $db->selectObjects('weblog_post', $where . ' ORDER BY posted DESC ' . $db->limit($config->items_per_page, $_GET['page'] * $config->items_per_page));
if (!defined('SYS_SORTING')) {
    require_once BASE . 'subsystems/sorting.php';
}
for ($i = 0; $i < count($posts); $i++) {
    $ploc = exponent_core_makeLocation($loc->mod, $loc->src, $posts[$i]->id);
    $posts[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $ploc), 'edit' => exponent_permissions_check('edit', $ploc), 'delete' => exponent_permissions_check('delete', $ploc), 'comment' => exponent_permissions_check('comment', $ploc), 'edit_comments' => exponent_permissions_check('edit_comments', $ploc), 'delete_comments' => exponent_permissions_check('delete_comments', $ploc), 'view_private' => exponent_permissions_check('view_private', $ploc));
    $comments = $db->selectObjects('weblog_comment', 'parent_id=' . $posts[$i]->id);
    usort($comments, 'exponent_sorting_byPostedDescending');
    $posts[$i]->comments = $comments;
}
usort($posts, 'exponent_sorting_byPostedDescending');
$template->assign('posts', $posts);
$template->assign('total_posts', $total);
$template->assign('shownext', ($_GET['page'] + 1) * $config->items_per_page < $total);
$template->assign('page', $_GET['page']);
$template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'comment', 'edit_comments', 'delete_comments', 'view_private'), $loc);
$template->assign('config', $config);
$template->output();
Esempio n. 14
0
# for more details.
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: view.php,v 1.4 2005/02/19 00:32:32 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
// PERM CHECK
$t = null;
if (isset($_GET['id'])) {
    $t = $db->selectObject("htmltemplate", "id=" . $_GET['id']);
}
if ($t) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $template = new template("htmltemplatemodule", "_view", $loc);
    $template->assign("template", $t);
    $template->register_permissions(array("administrate", "edit", "delete"), $loc);
    $template->output();
} else {
    echo SITE_404_HTML;
}
// END PERM CHECK
 function show($view, $loc = null, $title = '')
 {
     $template = new template('WeblogModule', $view, $loc);
     global $db;
     global $user;
     $user_id = $user ? $user->id : -1;
     $config = $db->selectObject('WeblogModule_config', "location_data='" . serialize($loc) . "'");
     if ($config == null) {
         $config->allow_comments = 1;
         $config->items_per_page = 10;
     }
     $viewconfig = array('type' => 'default');
     if (is_readable($template->viewdir . "/{$view}.config")) {
         $viewconfig = (include $template->viewdir . "/{$view}.config");
     }
     $where = '(is_draft = 0 OR poster = ' . $user_id . ") AND location_data='" . serialize($loc) . "'";
     if (!exponent_permissions_check('view_private', $loc)) {
         $where .= ' AND is_private = 0';
     }
     if ($viewconfig['type'] == 'monthlist') {
         $months = array();
         $min_date = $db->min('weblog_post', 'posted', 'location_data', $where);
         $max_date = $db->max('weblog_post', 'posted', 'location_data', $where);
         $months = array();
         if (!defined('SYS_DATETIME')) {
             require_once BASE . 'subsystems/datetime.php';
         }
         $start_month = exponent_datetime_startOfMonthTimestamp($min_date);
         $end_month = exponent_datetime_endOfMonthTimestamp($min_date) + 86399;
         do {
             $count = $db->countObjects('weblog_post', $where . ' AND posted >= ' . $start_month . ' AND posted <= ' . $end_month);
             if ($count) {
                 $months[$start_month] = $count;
             }
             $start_month = $end_month + 1;
             $end_month = exponent_datetime_endOfMonthTimestamp($start_month) + 86399;
         } while ($start_month < $max_date);
         $template->assign('months', array_reverse($months, true));
     } else {
         if ($viewconfig['type'] == 'calendar') {
             if (!defined('SYS_DATETIME')) {
                 require_once BASE . 'subsystems/datetime.php';
             }
             $month_days = exponent_datetime_monthlyDaysTimestamp(time());
             for ($i = 0; $i < count($month_days); $i++) {
                 foreach ($month_days[$i] as $mday => $timestamp) {
                     if ($mday > 0) {
                         // Got a valid one.  Go with it.
                         $month_days[$i][$mday] = array('number' => $db->countObjects('weblog_post', $where . ' AND posted >= ' . $timestamp . ' AND posted < ' . strtotime('+1 day', $timestamp)), 'ts' => $timestamp);
                     }
                 }
             }
             $template->assign('days', $month_days);
             $template->assign('now', time());
         } else {
             $total = $db->countObjects('weblog_post', $where);
             $posts = $db->selectObjects('weblog_post', $where . ' ORDER BY posted DESC ' . $db->limit($config->items_per_page, 0));
             if (!defined('SYS_SORTING')) {
                 require_once BASE . 'subsystems/sorting.php';
             }
             for ($i = 0; $i < count($posts); $i++) {
                 $ploc = exponent_core_makeLocation($loc->mod, $loc->src, $posts[$i]->id);
                 $posts[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $ploc), 'edit' => exponent_permissions_check('edit', $ploc), 'delete' => exponent_permissions_check('delete', $ploc), 'comment' => exponent_permissions_check('comment', $ploc), 'edit_comments' => exponent_permissions_check('edit_comments', $ploc), 'delete_comments' => exponent_permissions_check('delete_comments', $ploc), 'view_private' => exponent_permissions_check('view_private', $ploc));
                 $comments = $db->selectObjects('weblog_comment', 'parent_id=' . $posts[$i]->id);
                 usort($comments, 'exponent_sorting_byPostedDescending');
                 $posts[$i]->comments = $comments;
             }
             usort($posts, 'exponent_sorting_byPostedDescending');
             $template->assign('posts', $posts);
             $template->assign('total_posts', $total);
         }
     }
     $template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'comment', 'edit_comments', 'delete_comments', 'view_private'), $loc);
     $template->assign('config', $config);
     $template->assign('moduletitle', $title);
     $template->output();
 }
Esempio n. 16
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     if (!defined("SYS_USERS")) {
         require_once BASE . "subsystems/users.php";
     }
     $boards = $db->selectObjects("bb_board", "location_data='" . serialize($loc) . "'");
     $iloc = pathos_core_makeLocation($loc->mod, $loc->src);
     for ($i = 0; $i < count($boards); $i++) {
         $iloc->int = "b" . $boards[$i]->id;
         $boards[$i]->permissions = array("edit_board" => pathos_permissions_check("edit_board", $iloc), "delete_board" => pathos_permissions_check("delete_board", $iloc));
         if ($boards[$i]->last_post_id != 0) {
             $lp = $db->selectObject("bb_post", "id=" . $boards[$i]->last_post_id);
             $lp->poster = pathos_users_getUserById($lp->poster);
             $boards[$i]->last_post = $lp;
         } else {
             $boards[$i]->last_post = null;
         }
     }
     $template = new template("bbmodule", $view, $loc);
     $template->assign("moduletitle", $title);
     $template->assign("boards", $boards);
     $template->register_permissions(array("administrate", "configure", "create_board", "edit_board", "delete_board"), $loc);
     $template->output();
 }
Esempio n. 17
0
 function show($view, $loc = null, $title = '')
 {
     if (empty($view)) {
         $view = "Default";
     }
     $source_select = array();
     $clickable_mods = null;
     // Show all
     $dest = null;
     $singleview = '_container';
     $singlemodule = 'containermodule';
     if (expSession::is_set('source_select') && defined('SELECTOR')) {
         $source_select = expSession::get('source_select');
         $singleview = $source_select['view'];
         $singlemodule = $source_select['module'];
         $clickable_mods = $source_select['showmodules'];
         if (!is_array($clickable_mods)) {
             $clickable_mods = null;
         }
         $dest = $source_select['dest'];
     }
     global $db, $user;
     $container = null;
     $container_key = serialize($loc);
     $cache = expSession::getCacheValue('containermodule');
     if (!isset($this) || !isset($this->_hasParent) || $this->_hasParent == 0) {
         // Top level container.
         if (!isset($cache['top'][$container_key])) {
             $container = $db->selectObject('container', "external='" . serialize(null) . "' AND internal='" . $container_key . "'");
             //if container isn't here already, then create it.
             if ($container == null) {
                 $container->external = serialize(null);
                 $container->internal = serialize($loc);
                 $container->view = $view;
                 $container->title = $title;
                 $container->id = $db->insertObject($container, 'container');
             }
             $cache['top'][$container_key] = $container;
             expSession::setCacheValue('containermodule', $cache);
         } else {
             $container = $cache['top'][$container_key];
         }
         if (!defined('PREVIEW_READONLY') || defined('SELECTOR')) {
             $view = empty($container->view) ? $view : $container->view;
         }
         $title = $container->title;
     }
     $template = new template('containermodule', $view, $loc, $cache);
     if ($dest) {
         $template->assign('dest', $dest);
     }
     $template->assign('singleview', $singleview);
     $template->assign('singlemodule', $singlemodule);
     $template->assign('top', $container);
     $containers = array();
     if (!isset($cache[$container_key])) {
         foreach ($db->selectObjects('container', "external='" . $container_key . "'") as $c) {
             if ($c->is_private == 0 || expPermissions::check('view', expCore::makeLocation($loc->mod, $loc->src, $c->id))) {
                 $containers[$c->rank] = $c;
             }
         }
         $cache[$container_key] = $containers;
         expSession::setCacheValue('containermodule', $cache);
     } else {
         $containers = $cache[$container_key];
     }
     ksort($containers);
     foreach (array_keys($containers) as $i) {
         $location = unserialize($containers[$i]->internal);
         // check to see if this is a controller or module
         $iscontroller = expModules::controllerExists($location->mod);
         $modclass = $iscontroller ? expModules::getControllerClassName($location->mod) : $location->mod;
         if (class_exists($modclass)) {
             $mod = new $modclass();
             ob_start();
             $mod->_hasParent = 1;
             if ($iscontroller) {
                 renderAction(array('controller' => $location->mod, 'action' => $containers[$i]->action, 'src' => $location->src, 'view' => $containers[$i]->view, 'moduletitle' => $containers[$i]->title));
             } else {
                 $mod->show($containers[$i]->view, $location, $containers[$i]->title);
             }
             $containers[$i]->output = trim(ob_get_contents());
             ob_end_clean();
             $containers[$i]->info = array('module' => $mod->name(), 'source' => $location->src, 'hasContent' => $mod->hasContent(), 'hasSources' => $mod->hasSources(), 'hasViews' => $mod->hasViews(), 'class' => $modclass, 'supportsWorkflow' => $mod->supportsWorkflow() ? 1 : 0, 'workflowPolicy' => '', 'workflowUsesDefault' => 0, 'clickable' => $clickable_mods == null || in_array($modclass, $clickable_mods), 'hasConfig' => $db->tableExists($modclass . "_config"));
         } else {
             $containers[$i]->output = sprintf(gt('The module "%s" was not found in the system'), $location->mod);
             $containers[$i]->info = array('module' => sprintf(gt('Unknown: %s'), $location->mod), 'source' => $location->src, 'hasContent' => 0, 'hasSources' => 0, 'hasViews' => 0, 'class' => $modclass, 'supportsWorkflow' => 0, 'workflowPolicy' => '', 'workflowUsesDefault' => 0, 'hasConfig' => $db->tableExists($modclass . "_config"), 'clickable' => 0);
         }
         $containers[$i]->moduleLocation = $location;
         $cloc = null;
         $cloc->mod = $loc->mod;
         $cloc->src = $loc->src;
         $cloc->int = $containers[$i]->id;
         $location->mod = str_replace('Controller', '', $location->mod);
         $containers[$i]->permissions = array('administrate' => expPermissions::check('administrate', $location) ? 1 : 0, 'configure' => expPermissions::check('configure', $location) ? 1 : 0);
     }
     $template->assign('user', $user);
     $template->assign('containers', $containers);
     $template->assign('hasParent', isset($this) && isset($this->_hasParent) ? 1 : 0);
     $template->register_permissions(array('administrate', 'add_module', 'edit_module', 'delete_module', 'order_modules'), $loc);
     $template->output();
 }
 function show($view, $location = null, $title = '')
 {
     global $user;
     global $db;
     $template = new template('SWFModule', $view, $location);
     $template->assign('moduletitle', $title);
     if (defined('PREVIEW_READONLY') && !defined('SELECTOR')) {
         return;
     }
     if (!defined('SYS_FILES')) {
         require_once BASE . 'subsystems/files.php';
     }
     $directory = 'files/SWFModule';
     if (!file_exists(BASE . $directory)) {
         $err = exponent_files_makeDirectory($directory);
         if ($err != SYS_FILES_SUCCESS) {
             $template->assign('noupload', 1);
             $template->assign('uploadError', $err);
         }
     }
     $data = $db->selectObject('swfitem', "location_data='" . serialize($location) . "'");
     if ($data == null) {
         $data->_noflash = 1;
         $data->_align = 'center';
     } else {
         $data->_noflash = 0;
         switch ($data->alignment) {
             case 1:
                 $data->_align = 'left';
                 break;
             case 2:
                 $data->_align = 'right';
                 break;
             default:
                 $data->_align = 'center';
                 break;
         }
         $file = $db->selectObject('file', 'id=' . $data->swf_id);
         if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) {
             $data->_flashurl = $file->directory . '/' . $file->filename;
         } else {
             $data->_flashurl = '';
         }
         $file = $db->selectObject('file', 'id=' . $data->alt_image_id);
         if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) {
             $data->_noflashurl = $file->directory . '/' . $file->filename;
         } else {
             $data->_noflashurl = '';
         }
     }
     $template->assign('data', $data);
     $template->register_permissions(array('administrate', 'configure'), $location);
     $template->output();
 }
Esempio n. 19
0
 function show($view, $loc, $title = '')
 {
     $template = new template('imagemanagermodule', $view, $loc);
     $uilevel = 99;
     // MAX
     if (exponent_sessions_isset("uilevel")) {
         $uilevel = exponent_sessions_get("uilevel");
     }
     $template->assign('show', defined('SELECTOR') || $uilevel > UILEVEL_PREVIEW ? 1 : 0);
     if (!defined('SYS_FILES')) {
         include_once BASE . 'subsystems/files.php';
     }
     $directory = 'files/imagemanagermodule/' . $loc->src;
     if (!file_exists(BASE . $directory)) {
         $err = exponent_files_makeDirectory($directory);
         if ($err != SYS_FILES_SUCCESS) {
             $template->assign('noupload', 1);
             $template->assign('uploadError', $err);
         }
     }
     global $db;
     $location = serialize($loc);
     if (!isset($_SESSION['image_cache'][$location])) {
         $items = $db->selectObjects("imagemanageritem", "location_data='" . serialize($loc) . "'");
         $_SESSION['image_cache'][$location] = $items;
     } else {
         $items = $_SESSION['image_cache'][$location];
     }
     $files = $db->selectObjectsIndexedArray("file", "directory='{$directory}'");
     $template->assign('items', $items);
     $template->assign('files', $files);
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'post', 'edit', 'delete'), $loc);
     $template->output();
 }
# PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: stepstone_view.php,v 1.3 2005/02/19 16:53:34 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$stepstone = null;
if (isset($_GET['id'])) {
    $stepstone = $db->selectObject("codemap_stepstone", "id=" . $_GET['id']);
}
if ($stepstone) {
    $loc = unserialize($stepstone->location_data);
    $stepstone->milestone = $db->selectObject("codemap_milestone", "id=" . $stepstone->milestone_id);
    $template = new template("codemapmodule", "_view_stepstone", $loc);
    $template->assign("stepstone", $stepstone);
    $template->register_permissions("manage_steps", $loc);
    $template->output();
} else {
    echo SITE_404_HTML;
}
Esempio n. 21
0
 function show($view, $loc, $title = '')
 {
     global $db;
     $template = new template('bannermodule', $view, $loc);
     $template->assign('title', $title);
     $viewconfig = array('type' => 'default', 'number' => 1);
     if (is_readable($template->viewdir . "/{$view}.config")) {
         $viewconfig = (include $template->viewdir . "/{$view}.config");
     }
     if ($viewconfig['type'] == 'affiliates') {
         $af = $db->selectObjects('banner_affiliate');
         for ($i = 0; $i < count($af); $i++) {
             $af[$i]->bannerCount = $db->countObjects('banner_ad', 'affiliate_id=' . $af[$i]->id);
             $af[$i]->contact_info = str_replace("\n", "<br />", $af[$i]->contact_info);
         }
         if (!defined('SYS_SORTING')) {
             require_once BASE . 'subsystems/sorting.php';
         }
         usort($af, 'pathos_sorting_byNameAscending');
         $template->assign('affiliates', $af);
     } else {
         if (!defined('SYS_FILES')) {
             require_once BASE . 'subsystems/files.php';
         }
         $directory = 'files/bannermodule/' . $loc->src;
         if (!file_exists(BASE . $directory)) {
             $err = pathos_files_makeDirectory($directory);
             if ($err != SYS_FILES_SUCCESS) {
                 $template->assign('noupload', 1);
                 $template->assign('uploadError', $err);
             }
         }
         $all = $db->selectObjects('banner_ad', "location_data='" . serialize($loc) . "'");
         if ($viewconfig['type'] == 'allbanners') {
             $bfiles = $db->selectObjectsIndexedArray('file', "directory='" . $directory . "'");
             $template->assign('affiliates', bannermodule::listAffiliates());
             $template->assign('files', $bfiles);
             $template->assign('banners', $all);
         } else {
             $num = $viewconfig['number'];
             shuffle($all);
             $banners = array_slice($all, 0, $num);
             for ($i = 0; $i < count($banners); $i++) {
                 $banners[$i]->file = $db->selectObject('file', 'id=' . $banners[$i]->file_id);
             }
             $template->assign('banners', $banners);
         }
     }
     $template->register_permissions(array('administrate', 'manage', 'manage_af'), $loc);
     $template->output();
 }
# 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 Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: view_article.php,v 1.3 2005/03/13 18:57:28 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$article = null;
if (isset($_GET['id'])) {
    $article = $db->selectObject("article", "id=" . $_GET['id']);
    if ($article != null) {
        $loc = unserialize($article->location_data);
    } else {
        echo SITE_404_HTML;
    }
}
$template = new template("articlemodule", "_viewarticle", $loc);
$template->assign('article', $article);
$template->register_permissions(array('manage'), $loc);
$template->output();
Esempio n. 23
0
pathos_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
$resource = $db->selectObject("resourceitem", "id=" . $_GET['id']);
if ($resource != null) {
    $loc = unserialize($resource->location_data);
    $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $resource->id);
    $resource->permissions = array("administrate" => pathos_permissions_check("administrate", $iloc), "edit" => pathos_permissions_check("edit", $iloc), "delete" => pathos_permissions_check("delete", $iloc));
    if ($resource->flock_owner != 0) {
        if (!defined("SYS_USERS")) {
            require_once BASE . "subsystems/users.php";
        }
        $resource->lock_owner = pathos_users_getUserById($resource->flock_owner);
        $resource->locked = 1;
    } else {
        $resource->locked = 0;
    }
    $file = $db->selectObject("file", "id=" . $resource->file_id);
    if ($file != null) {
        $mimetype = $db->selectObject("mimetype", "mimetype='" . $file->mimetype . "'");
        $template = new template("resourcesmodule", "_view", $loc);
        $template->assign("resource", $resource);
        $template->assign("user", $user);
        $template->assign("file", $file);
        $template->assign("mimetype", $mimetype);
        $template->register_permissions(array("administrate", "edit", "delete", "manage_approval"), $loc);
        $template->output();
    } else {
        echo SITE_404_HTML;
    }
} else {
    echo SITE_404_HTML;
}
Esempio n. 24
0
<?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 (exponent_permissions_check('manage', $loc)) {
    exponent_flow_set(SYS_FLOW_ACTION, SYS_FLOW_PROTECTED);
    $objects = $db->selectObjects('rotator_item', "location_data='" . serialize($loc) . "'");
    $template = new template('RotatorModule', '_manage', $loc);
    $template->assign('items', $objects);
    $template->register_permissions(array('administrate', 'manage'), $loc);
    $template->output();
} else {
    echo SITE_403_HTML;
}
Esempio n. 25
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     // Used later, for recalculation and other things.
     if (!defined("SYS_SORTING")) {
         require_once BASE . "subsystems/sorting.php";
     }
     $config = $db->selectObject('articlemodule_config', "location_data='" . serialize($loc) . "'");
     if ($config == null) {
         $object->sortorder = 'ASC';
         $object->sortfield = 'rank';
         $object->item_limit = 10;
         $config->enable_categories = 0;
         $config->recalc = 0;
         // No need to recalculate, no categories
     } else {
         if ($config->recalc == 1) {
             // We need to recaculate the rankings.
             if ($config->enable_categories == 1) {
                 // Recalc, keeping in mind the category structure.
                 $cats = $db->selectObjects("category", "location_data='" . serialize($loc) . "'");
                 $c = null;
                 $c->id = 0;
                 $cats[] = $c;
                 foreach ($cats as $c) {
                     // Loop over each category.
                     $rank = 0;
                     foreach ($db->selectObjects("article", "location_data='" . serialize($loc) . "' AND category_id=" . $c->id) as $article) {
                         $article->rank = $rank;
                         $db->updateObject($article, "article");
                         $rank++;
                     }
                 }
             } else {
                 // Recaculate blindly, ignoring categories.
                 $articles = $db->selectObjects("article", "location_data='" . serialize($loc) . "'");
                 usort($articles, "pathos_sorting_byRankAscending");
                 $rank = 0;
                 foreach ($articles as $article) {
                     $article->rank = $rank;
                     $article->category_id = 0;
                     $db->updateObject($article, "article");
                     $rank++;
                 }
             }
             $config->recalc = 0;
             $db->updateObject($config, 'articlemodule_config', "location_data='" . serialize($loc) . "'");
         }
     }
     // Create the template
     $template = new template("articlemodule", $view, $loc);
     $template->assign("config", $config);
     // Get all of the categories for this Article module:
     $cats = array();
     $cats = $db->selectObjectsIndexedArray('category', "location_data='" . serialize($loc) . "'");
     if ($config->enable_categories) {
         if (count($cats) != 0) {
             $template->assign('hasCategories', 1);
         } else {
             $template->assign('hasCategories', 0);
         }
     } else {
         $template->assign('hasCategories', 0);
     }
     $c->name = '';
     $c->id = 0;
     uasort($cats, "pathos_sorting_byRankAscending");
     $cats[0] = $c;
     $template->assign('categories', $cats);
     $data = array();
     if ($config->enable_categories == true) {
         foreach ($cats as $id => $c) {
             //Get all the questions & answers for this article module. ($qnas stands for "Questions 'n Answers")
             $tmp = $db->selectObjects("article", "location_data='" . serialize($loc) . "' AND category_id=" . $id);
             $catids = array_keys($cats);
             // for in_array check only
             for ($i = 0; $i < count($tmp); $i++) {
                 if (!in_array($tmp[$i]->category_id, $catids)) {
                     echo 'Setting cat id to 0<br />';
                     $tmp[$i]->category_id = 0;
                 }
             }
             usort($tmp, "pathos_sorting_byRankAscending");
             $data[$id] = $tmp;
         }
     } else {
         $tmp = $db->selectObjects("article", "location_data='" . serialize($loc) . "' ORDER BY " . $config->sortfield . " " . $config->sortorder . $db->limit($config->item_limit, 0));
         #usort($tmp, 'pathos_sorting_byRankAscending');
         $data[0] = $tmp;
     }
     $template->assign('data', $data);
     $template->register_permissions(array('administrate', 'configure', 'manage'), $loc);
     $template->assign('moduletitle', $title);
     //echo "<xmp>";
     //print_r ($data);
     //echo "</xmp>";
     $template->output();
 }
}
$canviewapproval = false;
if ($user) {
    $canviewapproval = exponent_permissions_check("approve", $loc) || exponent_permissions_check("manage_approval", $loc);
}
if (!$canviewapproval) {
    // still not able to view
    foreach ($db->selectObjects("newsitem", "location_data='" . serialize($loc) . "' AND (publish = 0 or publish <= " . time() . ") AND (unpublish = 0 or unpublish > " . time() . ") AND approved != 0") as $post) {
        if ($user && $user->id == $post->poster) {
            $canviewapproval = true;
            break;
        }
    }
}
$template = new template("newsmodule", isset($_GET['view']) ? $_GET['view'] : "Default", $loc);
$template->register_permissions(array("administrate", "configure", "add_item", "delete_item", "edit_items", "manage_approval"), $loc);
$news = $db->selectObjects("newsitem", "location_data='" . serialize($loc) . "' AND (publish = 0 or publish <= " . time() . ") AND (unpublish = 0 or unpublish > " . time() . ") AND approved != 0 ORDER BY posted " . $config->sortorder);
if (!defined('SYS_SORTING')) {
    include_once BASE . 'subsystems/sorting.php';
}
usort($news, $config->sortorder == "DESC" ? "exponent_sorting_byPostedDescending" : "exponent_sorting_byPostedAscending");
for ($i = 0; $i < count($news); $i++) {
    $nloc = null;
    $nloc->mod = $loc->mod;
    $nloc->src = $loc->src;
    $nloc->int = $news[$i]->id;
    $news[$i]->permissions = array("edit_item" => exponent_permissions_check("edit_item", $loc) || exponent_permissions_check("edit_item", $nloc) ? 1 : 0, "delete_item" => exponent_permissions_check("delete_item", $loc) || exponent_permissions_check("delete_item", $nloc) ? 1 : 0, "administrate" => exponent_permissions_check("administrate", $loc) || exponent_permissions_check("administrate", $nloc) ? 1 : 0);
}
// EVIL WORKFLOW
$in_approval = $db->countObjects("newsitem_wf_info", "location_data='" . serialize($loc) . "'");
$template->assign("canview_approval_link", $canviewapproval);
Esempio n. 27
0
    exit("");
}
$lang = null;
if (isset($_GET['lang_id'])) {
    $lang = $db->selectObject('translation_language', 'id=' . $_GET['lang_id']);
}
if ($lang) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $ref_constants = translatormodule::parseDictionary($_GET['type'], $_GET['name'], 'en');
    $these_constants = array();
    foreach ($db->selectObjects('translation_dictentry', "lang_id='" . $lang->id . "' AND dictionary='" . $_GET['type'] . '/' . $_GET['name'] . "'") as $entry) {
        $these_constants[$entry->constant] = $entry;
    }
    $added_constants = array_diff(array_keys($ref_constants), array_keys($these_constants));
    $removed_constants = array_diff(array_keys($these_constants), array_keys($ref_constants));
    $all_constants = array_merge(array_keys($these_constants), $added_constants);
    usort($all_constants, 'strnatcmp');
    $template = new template('translatormodule', '_viewDictionary');
    $template->assign('d_type', $_GET['type']);
    $template->assign('d_name', $_GET['name']);
    $template->assign('lang', $lang);
    $template->assign('ref_constants', $ref_constants);
    $template->assign('these_constants', $these_constants);
    $template->assign('added_constants', $added_constants);
    $template->assign('removed_constants', $removed_constants);
    $template->assign('all_constants', $all_constants);
    $template->register_permissions(array('administrate', 'configure'), $loc);
    $template->output();
} else {
    echo SITE_404_HTML;
}
Esempio n. 28
0
 function show($view, $loc = null, $title = '')
 {
     global $db, $user;
     $config = $db->selectObject('newsmodule_config', "location_data='" . serialize($loc) . "'");
     if ($config == null) {
         $config->sortorder = 'ASC';
         $config->sortfield = 'posted';
         $config->item_limit = 10;
     }
     // Check permissions for AP link
     $canviewapproval = false;
     if ($user) {
         $canviewapproval = exponent_permissions_check('approve', $loc) || exponent_permissions_check('manage_approval', $loc);
     }
     if (!$canviewapproval) {
         // still not able to view
         foreach ($db->selectObjects('newsitem', "location_data='" . serialize($loc) . "' AND (publish = 0 or publish <= " . time() . ") AND (unpublish = 0 or unpublish > " . time() . ') AND approved != 0') as $post) {
             if ($user && $user->id == $post->poster) {
                 $canviewapproval = true;
                 break;
             }
         }
     }
     $template = new template('newsmodule', $view, $loc);
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'configure', 'add_item', 'delete_item', 'edit_item', 'manage_approval', 'view_unpublished'), $loc);
     $news = $db->selectObjects('newsitem', "location_data='" . serialize($loc) . "' AND (publish = 0 or publish <= " . time() . ') AND (unpublish = 0 or unpublish > ' . time() . ') AND approved != 0 ORDER BY ' . $config->sortfield . ' ' . $config->sortorder . $db->limit($config->item_limit, 0));
     for ($i = 0; $i < count($news); $i++) {
         $news[$i]->real_posted = $news[$i]->publish != 0 ? $news[$i]->publish : $news[$i]->posted;
         $nloc = exponent_core_makeLocation($loc->mod, $loc->src, $news[$i]->id);
         $news[$i]->permissions = array('edit_item' => exponent_permissions_check('edit_item', $loc) || exponent_permissions_check('edit_item', $nloc) ? 1 : 0, 'delete_item' => exponent_permissions_check('delete_item', $loc) || exponent_permissions_check('delete_item', $nloc) ? 1 : 0, 'administrate' => exponent_permissions_check('administrate', $loc) || exponent_permissions_check('administrate', $nloc) ? 1 : 0);
     }
     // EVIL WORKFLOW
     $in_approval = $db->countObjects('newsitem_wf_info', "location_data='" . serialize($loc) . "'");
     $template->assign('canview_approval_link', $canviewapproval);
     $template->assign('in_approval', $in_approval);
     $template->assign('news', $news);
     $template->assign('morenews', count($news) < $db->countObjects('newsitem', "location_data='" . serialize($loc) . "' AND (publish = 0 or publish <= " . time() . ') AND (unpublish = 0 or unpublish > ' . time() . ') AND approved != 0'));
     $template->output();
 }
Esempio n. 29
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     $config = $db->selectObject('linklistmodule_config', "location_data='" . serialize($loc) . "'");
     if ($config == null) {
         $config->orderby = 'name';
         $config->orderhow = 0;
         // Ascending
     }
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     $links = $db->selectObjects('linklist_link', "location_data='" . serialize($loc) . "'");
     switch ($config->orderhow) {
         case 0:
             usort($links, 'pathos_sorting_byNameAscending');
             break;
         case 1:
             usort($links, 'pathos_sorting_byNameDescending');
             break;
         case 2:
             shuffle($links);
             break;
     }
     $template = new template('linklistmodule', $view, $loc);
     $template->assign('links', $links);
     $template->register_permissions(array('administrate', 'configure', 'create', 'edit', 'delete'), $loc);
     $template->output();
 }
Esempio n. 30
0
 function show($view, $loc = null)
 {
     global $db;
     if (!defined("SYS_FORMS")) {
         require_once BASE . "subsystems/forms.php";
     }
     exponent_forms_initialize();
     $i18n = exponent_lang_loadFile('modules/formmodule/class.php');
     if (defined("PREVIEW_READONLY") && !defined("SELECTOR")) {
         // Pass
     } else {
         $f = null;
         $f = $db->selectObject("formbuilder_form", "location_data='" . serialize($loc) . "'");
         if (!$f) {
             //Create a form if it's missing...
             $f->name = "New Form";
             $f->description = "";
             $f->location_data = serialize($loc);
             $f->table_name = "";
             $f->is_email = 0;
             $f->is_saved = 0;
             $f->submitbtn = $i18n['default_submit'];
             $f->resetbtn = $i18n['default_reset'];
             $f->response = $i18n['default_response'];
             $f->subject = $i18n['default_subject'];
             $frmid = $db->insertObject($f, "formbuilder_form");
             //Create Default Report;
             $rpt->name = $i18n['default_report'];
             $rpt->description = "";
             $rpt->location_data = $f->location_data;
             $rpt->text = "";
             $rpt->column_names = "";
             $rpt->form_id = $frmid;
             $db->insertObject($rpt, "formbuilder_report");
             $f->id = $frmid;
         }
         global $SYS_FLOW_REDIRECTIONPATH;
         exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
         $SYS_FLOW_REDIRECTIONPATH = "editfallback";
         exponent_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
         $SYS_FLOW_REDIRECTIONPATH = "exponent_default";
         $floc = unserialize($f->location_data);
         $controls = $db->selectObjects("formbuilder_control", "form_id=" . $f->id);
         if (!defined("SYS_SORTING")) {
             require_once BASE . "subsystems/sorting.php";
         }
         usort($controls, "exponent_sorting_byRankAscending");
         $form = new form();
         foreach ($controls as $c) {
             $ctl = unserialize($c->data);
             $ctl->_id = $c->id;
             $ctl->_readonly = $c->is_readonly;
             $form->register($c->name, $c->caption, $ctl);
         }
         $form->register(uniqid(""), "", new htmlcontrol("<br /><br />"));
         $form->register("submit", "", new buttongroupcontrol($f->submitbtn, $f->resetbtn, ""));
         $form->meta("action", "submit_form");
         $form->meta("m", $floc->mod);
         $form->meta("s", $floc->src);
         $form->meta("i", $floc->int);
         $form->meta("id", $f->id);
         $formmsg = '';
         $form->location(exponent_core_makeLocation("formbuilder", $floc->src, $floc->int));
         if (count($controls) == 0) {
             $form->controls['submit']->disabled = true;
             $formmsg .= $i18n['blank_form'] . '<br>';
         }
         if ($f->is_saved == 0 && $f->is_email == 0) {
             $form->controls['submit']->disabled = true;
             $formmsg .= $i18n['no_actions'];
         }
         $template = new template("formmodule", $view, $loc);
         $template->assign("formmsg", $formmsg);
         $template->assign("form_html", $form->toHTML($f->id));
         $template->assign("form", $f);
         $template->register_permissions(array("administrate", "editform", "editformsettings", "editreport", "viewdata", "editdata", "deletedata"), $loc);
         $template->output();
     }
 }