function update($values, $object, $loc) { global $db; if (!isset($values['id'])) { // Only deal with the inc/dec stuff if adding a module. $src = ""; if (isset($values['i_src'])) { if ($values['i_src'] == "new_source") { $src = "@random" . uniqid(""); $object->is_existing = 0; } else { $src = $values[$values['i_src']]; $object->is_existing = 1; } } else { $object->is_existing = 0; } $newInternal = pathos_core_makeLocation($values['i_mod'], $src); // REFERENCES - Section and Location //$sect = $db->selectObject('section','id='.$_POST['current_section']); pathos_core_incrementLocationReference($newInternal, $_POST['current_section']); // Rank is only updateable from the order action $object->rank = $values['rank']; if (isset($values['rerank'])) { $db->increment("container", "rank", 1, "external='" . serialize($loc) . "' AND rank >= " . $values['rank']); } $object->internal = serialize($newInternal); $object->external = serialize($loc); } $object->is_private = isset($_POST['is_private']) ? 1 : 0; // UPDATE the container $object->view = $values['view']; $object->title = $values['title']; return $object; }
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(); }
function getLocationHierarchy($loc) { if ($loc->int == '') { return array($loc); } else { return array($loc, pathos_core_makeLocation($loc->mod, $loc->src)); } }
function show($view, $loc = null, $title = "") { $loc = pathos_core_makeLocation('filemanagermodule'); global $db; $collections = $db->selectObjects('file_collection'); $template = new template('filemanagermodule', $view, $loc); $template->assign('collections', $collections); $template->assign('moduletitle', $title); $template->output(); }
# 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: delete_entry.php,v 1.3 2005/03/13 20:40:47 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $loc = pathos_core_makeLocation('translatormodule'); $entry = null; if (isset($_GET['id'])) { $entry = $db->selectObject('translation_dictentry', 'id=' . $_GET['id']); if ($entry) { $loc = pathos_core_makeLocation('translatormodule', '', $entry->lang_id); } } if (pathos_permissions_check('configure', $loc)) { if ($entry) { $db->delete('translation_dictentry', 'id=' . $entry->id); pathos_flow_redirect(); } else { echo SITE_404_HTMl; } } else { echo SITE_403_HTML; }
function template($module, $view = null, $loc = null, $caching = false) { // Set up the Smarty template variable we wrap around. $this->tpl = new Smarty(); $this->tpl->php_handling = SMARTY_PHP_REMOVE; $this->tpl->plugins_dir[] = BASE . "plugins"; $this->viewfile = pathos_template_getModuleViewFile($module, $view); $this->viewparams = pathos_template_getViewParams($this->viewfile); $this->viewdir = realpath(dirname($this->viewfile)); $this->view = substr(basename($this->viewfile), 0, -4); $this->tpl->template_dir = $this->viewdir; // Make way for i18n // $this->tpl->compile_dir = $this->viewdir."_c"; $this->tpl->compile_dir = BASE . '/views_c'; $this->tpl->compile_id = md5($this->viewfile); $expected_view = $this->viewfile == TEMPLATE_FALLBACK_VIEW ? $view : $this->view; $this->tpl->assign("__view", $expected_view); if ($loc == null) { $loc = pathos_core_makeLocation($module); } $this->tpl->assign("__loc", $loc); $this->tpl->assign("__redirect", pathos_flow_get()); // View Config global $db; $container = $db->selectObject("container", "internal='" . serialize($loc) . "'"); $this->viewconfig = $container && $container->view_data != "" ? unserialize($container->view_data) : array(); $this->tpl->assign("__viewconfig", $this->viewconfig); }
# # 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: import_form.php,v 1.3 2005/04/26 03:01:57 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $loc = pathos_core_makeLocation('translatormodule'); if (pathos_permissions_check('configure', $loc)) { if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } pathos_forms_initialize(); $form = new form(); $form->meta('module', 'translatormodule'); $form->meta('action', 'import'); $form->register('file', '', new uploadcontrol()); $form->register('submit', '', new buttongroupcontrol('Save', '', 'Cancel')); $template = new template('translatormodule', '_form_import'); $template->assign('form_html', $form->toHTML()); $template->output(); } else { echo SITE_403_HTML;
# 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: gmgr_savemembers.php,v 1.7 2005/02/19 00:32:28 filetreefrog Exp $ ################################################## // Part of the User Management category if (!defined('PATHOS')) { exit(''); } $memb = $db->selectObject('groupmembership', 'member_id=' . $user->id . ' AND group_id=' . $_GET['id'] . ' AND is_admin=1'); if (pathos_permissions_check('user_management', pathos_core_makeLocation('administrationmodule')) || $memb) { $group = $db->selectObject('group', 'id=' . $_POST['id']); if ($group) { $db->delete('groupmembership', 'group_id=' . $group->id); $memb = null; $memb->group_id = $group->id; if ($_POST['membdata'] != "") { foreach (explode(',', $_POST['membdata']) as $str) { $str = explode(':', $str); $memb->member_id = $str[0]; $memb->is_admin = $str[1]; $db->insertObject($memb, 'groupmembership'); } } pathos_permissions_triggerRefresh(); pathos_flow_redirect();
# 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: orphanedcontent_delete.php,v 1.7 2005/02/19 00:32:28 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } // Part of the Database category if (pathos_permissions_check('database', pathos_core_makeLocation('administrationmodule'))) { $src = urldecode($_GET['delsrc']); $mod = new $_GET['mod'](); if ($mod->hasContent()) { // may not need the check, but it doesn't hurt $mod->deleteIn(pathos_core_makeLocation($_GET['mod'], $_GET['delsrc'])); } $db->delete('locationref', "module='" . $_GET['mod'] . "' AND source='{$src}' AND refcount=0"); $db->delete('sectionref', "module='" . $_GET['mod'] . "' AND source='{$src}' AND refcount=0"); pathos_flow_redirect(); } else { echo SITE_403_HTML; }
# not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: delete.php,v 1.3 2005/03/29 16:56:26 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $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); if (pathos_permissions_check("delete", $loc) || pathos_permissions_check("delete", $iloc)) { foreach ($db->selectObject("resourceitem_wf_revision", "wf_original=" . $resource->id) as $wf_res) { $file = $db->selectObject("file", "id=" . $wf_res->file_id); file::delete($file); $db->delete("file", "id=" . $file->id); } $db->delete("resourceitem", "id=" . $resource->id); $db->delete("resourceitem_wf_revision", "wf_original=" . $resource->id); $db->decrement('resourceitem', 'rank', 1, "location_data='" . $resource->location_data . "' AND rank >= " . $resource->rank); pathos_flow_redirect(SYS_FLOW_SECTIONAL); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML;
# # 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: assoc_save.php,v 1.4 2005/02/19 00:32:37 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } if (pathos_permissions_check('workflow', pathos_core_makeLocation('administrationmodule'))) { if (isset($_POST['s'])) { $assoc = $db->selectObject("approvalpolicyassociation", "module='" . $_POST['m'] . "' AND source='" . $_POST['s'] . "' AND is_global=0"); if ($assoc) { $assoc->policy_id = $_POST['policy']; $db->updateObject($assoc, "approvalpolicyassociation", "module='" . $_POST['m'] . "' AND source='" . $_POST['s'] . "' AND is_global=0"); } else { $assoc->module = $_POST['m']; $assoc->source = $_POST['s']; $assoc->policy_id = $_POST['policy']; $assoc->is_global = 0; $db->insertObject($assoc, "approvalpolicyassociation"); } } else { // Save global $assoc = $db->selectObject("approvalpolicyassociation", "module='" . $_POST['m'] . "' AND is_global=1");
} if (pathos_permissions_check('database', pathos_core_makeLocation('administrationmodule'))) { pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION); $nullrefs = $db->selectObjects('locationref', 'refcount=0'); $mods = array(); $have_bad_orphans = false; foreach ($nullrefs as $nullref) { $modclass = $nullref->module; $have_bad_orphans = false; if (!isset($mods[$nullref->module])) { if (class_exists($modclass)) { $mod = new $modclass(); $mods[$nullref->module] = array('name' => $mod->name(), 'modules' => array()); } else { $have_bad_orphans = true; } } if (class_exists($modclass)) { ob_start(); call_user_func(array($modclass, 'show'), DEFAULT_VIEW, pathos_core_makeLocation($modclass, $nullref->source)); $mods[$nullref->module]['modules'][$nullref->source] = ob_get_contents(); ob_end_clean(); } } $template = new template('administrationmodule', '_orphanedcontent'); $template->assign('modules', $mods); $template->assign('have_bad_orphans', $have_bad_orphans); $template->output(); } else { echo SITE_403_HTML; }
# # 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: manage.php,v 1.9 2005/04/18 15:22:30 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $mloc = pathos_core_makeLocation($_GET['orig_module'], $loc->src, $loc->int); if (pathos_permissions_check('manage_categories', $mloc)) { pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION); $categories = $db->selectObjects("category", "location_data='" . serialize($mloc) . "'"); if (pathos_template_getModuleViewFile($mloc->mod, "_cat_manageCategories", false) == TEMPLATE_FALLBACK_VIEW) { $template = new template("categories", "_cat_manageCategories", $loc); } else { $template = new template($mloc->mod, "_cat_manageCategories", $loc); } if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } usort($categories, "pathos_sorting_byRankAscending"); $template->assign("origmodule", $_GET['orig_module']); $template->assign("categories", $categories); $template->output();
# 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: delete.php,v 1.5 2005/02/19 00:32:29 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } $item = $db->selectObject('file', 'id=' . $_GET['id']); if ($item) { $loc = unserialize($item->location_data); $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $item->id); if (pathos_permissions_check('delete', $loc) || pathos_permissions_check('delete', $iloc)) { $db->delete('file', 'id=' . $item->id); unlink(BASE . "files/" . $item->filename); pathos_template_clear(); pathos_flow_redirect(); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML; }
# 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: remove.php,v 1.3 2005/04/03 07:57:14 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $section = null; if (isset($_GET['id'])) { $section = $db->selectObject("section", "id=" . $_GET['id']); } if ($section) { if (pathos_permissions_check('manage', pathos_core_makeLocation('navigationmodule', '', $section->id))) { navigationmodule::removeLevel($section->id); $db->decrement("section", "rank", 1, "rank > " . $section->rank . " AND parent=" . $section->parent); $section->parent = -1; $db->updateObject($section, 'section'); pathos_flow_redirect(); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML; }
# without even the implied warranty of # 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: page.php,v 1.5 2005/02/19 00:32:31 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('database', pathos_core_makeLocation('administrationmodule'))) { $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : "start"; $exporter = isset($_REQUEST['exporter']) ? $_REQUEST['exporter'] : ""; $file = BASE . "modules/exporter/exporters/{$exporter}/{$page}.php"; if ($exporter != "" && is_readable($file) && is_file($file)) { include $file; } else { echo SITE_404_HTML; } } else { echo SITE_403_HTML; }
# not, write to: # # Free Software Foundation, Inc., # 59 Temple Place, # Suite 330, # Boston, MA 02111-1307 USA # # $Id: save.php,v 1.4 2005/02/19 00:32:27 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $contact = null; $iloc = null; if (isset($_POST['id'])) { $contact = $db->selectObject("addressbook_contact", "id=" . $_POST['id']); $loc = unserialize($contact->location_data); $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $contact->id); } if ($contact == null && pathos_permissions_check("post", $loc) || $contact != null && pathos_permissions_check("edit", $loc) || $iloc != null && pathos_permissions_check("edit", $iloc)) { $contact = addressbook_contact::update($_POST, $contact); $contact->location_data = serialize($loc); if (isset($contact->id)) { $db->updateObject($contact, "addressbook_contact"); } else { $db->insertObject($contact, "addressbook_contact"); } pathos_flow_redirect(); } else { echo SITE_403_HTML; }
define('SCRIPT_FILENAME', 'db_recover.php'); // Initialize the Pathos Framework include_once dirname(realpath(__FILE__)) . '/pathos.php'; pathos_lang_loadDictionary('standard', 'dbrecover'); exit(TR_DBRECOVER_RECOVERYDISABLED); // If we made it here, the user has enabled the Database Recovery Script manually. // Save the old user data, in case current user is actually logged in. $oldu = $user; // Temproarily elevate the current user to admin status, to // allow them to install tables. $user->is_admin = 1; $user->is_acting_admin = 1; // The $loc variable would normally be created by the Pathos framework // when running the action we are about to include. Here, we synthetically // create the location, so that the action doesn't freak out. $loc = pathos_core_makeLocation('administrationmodule'); // Simulate running the Install Tables action. include_once dirname(__realpath(__FILE__)) . '/modules/administrationmodule/actions/installtables.php'; // In case something is screwed up in the database, we need to // create some records. // Create the default administrative account (username:admin, password:admin) // if there are no users in the user table. if ($db->tableIsEmpty('user')) { echo TR_DBRECOVER_CREATEDEFAULTADMIN . '<br />'; $user = null; $user->username = '******'; $user->password = md5('admin'); $user->is_admin = 1; // This wont work for other users subsystems $db->insertObject($user, 'user'); }
# 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: upload_standalone.php,v 1.1 2005/05/04 19:11:32 filetreefrog Exp $ ################################################## include_once '../../../pathos.php'; $collection = null; if (isset($_POST['collection_id'])) { $collection = $db->selectObject('file_collection', 'id=' . $_POST['collection_id']); } else { $collection->id = 0; $collection->name = 'Uncategorized Files'; $collection->description = 'Theses files have not been categorized yet,'; } $loc = pathos_core_makeLocation('filemanagermodule'); // PERM CHECK $file = file::update('file', 'files', null); if (is_object($file)) { $file->name = $_POST['name']; $file->collection_id = $collection->id; $file_id = $db->insertObject($file, 'file'); header('Location: ' . URL_FULL . 'modules/filemanagermodule/actions/picker.php?id=' . $collection->id . '&highlight_file=' . $file_id); } else { echo $file; } // END PERM CHECK
# 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: edit_core.php,v 1.6 2005/04/26 04:42:00 filetreefrog Exp $ ################################################## if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('manage_core', pathos_core_makeLocation('sharedcoremodule'))) { $core = null; if (isset($_GET['id'])) { $core = $db->selectObject('sharedcore_core', 'id=' . $_GET['id']); } $form = sharedcore_core::form($core); $form->meta('module', 'sharedcoremodule'); $form->meta('action', 'save_core'); $template = new template('sharedcoremodule', '_form_editCore'); $template->assign('is_edit', isset($core->id) ? 1 : 0); $template->assign('form_html', $form->toHTML()); $template->output(); } else { echo SITE_403_HTML; }
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(); }
function form($object) { pathos_lang_loadDictionary('modules', 'inboxmodule'); pathos_lang_loadDictionary('standard', 'core'); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } pathos_forms_initialize(); $form = new form(); $users = array(); $groups = array(); global $db, $user; if (!defined('SYS_USERS')) { require_once BASE . 'subsystems/users.php'; } if (pathos_permissions_check('contact_all', pathos_core_makeLocation('inboxmodule'))) { foreach (pathos_users_getAllUsers() as $u) { $users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')'; } } else { foreach (pathos_users_getGroupsForUser($user, 1, 0) as $g) { foreach (pathos_users_getUsersInGroup($g) as $u) { $users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')'; } } } // Process other uses who the current user has blocked, and remove them from the list // Process other users who have blocked the current user, and remove them from the list. foreach ($db->selectObjects('inbox_contactbanned', 'owner=' . $user->id . ' OR user_id=' . $user->id) as $blocked) { if ($blocked->user_id == $user->id) { // Blocked by someone else. Remove the owner (user who blocked us) unset($users[$blocked->owner]); } else { if ($blocked->owner == $user->id) { // We blocked the user, remove the blocked user_id unset($users[$blocked->user_id]); } } } uasort($users, 'strnatcmp'); $groups = array(); foreach ($db->selectObjects('inbox_contactlist', 'owner=' . $user->id) as $g) { $groups['list_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_PERSONALLIST; } if (pathos_permissions_check('contact_all', pathos_core_makeLocation('inboxmodule'))) { foreach (pathos_users_getAllGroups(1, 0) as $g) { $groups['group_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_SYSGROUP; } } else { foreach (pathos_users_getGroupsForUser($user, 1, 0) as $g) { $groups['group_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_SYSGROUP; } } uasort($groups, 'strnatcmp'); $recipient_caption = TR_INBOXMODULE_RECIPIENT; $group_recipient_caption = TR_INBOXMODULE_GROUPRECIPIENT; $btn = new buttongroupcontrol(TR_INBOXMODULE_SEND, '', TR_CORE_CANCEL); $object->group_recipient = array(); if ($object == null || !isset($object->recipient)) { $object->subject = ''; $object->body = ''; $object->recipient = array(); if (!count($users) && !count($groups)) { $btn->disabled = true; } } else { if (!defined('SYS_USERS')) { require_once BASE . 'subsystems/users.php'; } $u = pathos_users_getUserById($object->recipient); $form->register(null, '', new htmlcontrol(sprintf(TR_INBOXMODULE_REPLYTO, $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')'))); $form->meta('replyto', $object->recipient); $object->recipient = array(); unset($users[$u->id]); $recipient_caption = TR_INBOXMODULE_COPYTO; $group_recipient_caption = TR_INBOXMODULE_GROUPCOPYTO; } if (count($users)) { $form->register('recipients', $recipient_caption, new listbuildercontrol($object->recipient, $users)); } if (count($groups)) { $form->register('group_recipients', $group_recipient_caption, new listbuildercontrol($object->group_recipient, $groups)); } if (!count($groups) && !count($users)) { $form->register(null, '', new htmlcontrol('<div class="error">' . TR_INBOXMODULE_NOCONTACTSWARNING . '</div>')); } $form->register('subject', TR_INBOXMODULE_SUBJECT, new textcontrol($object->subject)); $form->register('body', TR_INBOXMODULE_MESSAGE, new htmleditorcontrol($object->body)); $form->register('submit', '', $btn); return $form; }
exit(''); } $check_id = -1; $section = null; $old_parent = null; if (isset($_POST['id'])) { // Saving an existing content page. Read it from the database. $section = $db->selectObject('section', 'id=' . $_POST['id']); if ($section) { $old_parent = $section->parent; $check_id = $section->id; } } else { $check_id = $_POST['parent']; } if ($check_id != -1 && pathos_permissions_check('manage', pathos_core_makeLocation('navigationmodule', '', $check_id))) { pathos_lang_loadDictionary('modules', 'navigationmodule'); // Update the section from the _POST data. $section = section::updateInternalAlias($_POST, $section); if ($section->active == 0) { // User tried to link to an inactive section. This makes little or no sense in // this context, so throw them back to the edit form, with an error message. $_POST['_formError'] = TR_NAVIGATIONMODULE_INTERNALLINKERR; pathos_sessions_set("last_POST", $_POST); header("Location: " . $_SERVER['HTTP_REFERER']); exit('Redirecting...'); } if (isset($section->id)) { if ($section->parent != $old_parent) { // Old_parent id was different than the new parent id. Need to decrement the ranks // of the old children (after ours), and then add
# # 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: revisions_view.php,v 1.4 2005/04/18 15:33:05 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } $rloc = pathos_core_makeLocation($_GET['m'], $_GET['s']); if (pathos_permissions_check("manage_approval", $rloc)) { pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION); if (!defined("SYS_WORKFLOW")) { require_once BASE . "subsystems/workflow.php"; } $template = new template("workflow", "_revisions", $loc); $current = $db->max($_GET['datatype'] . "_wf_revision", "wf_major", "wf_original", "wf_original=" . $_GET['id']); $template->assign("current", $current); $template->assign("datatype", $_GET['datatype']); $revisions = $db->selectObjects($_GET['datatype'] . "_wf_revision", "wf_original=" . $_GET['id']); if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } usort($revisions, "pathos_sorting_workflowRevisionDescending"); $template->assign("revisions", $revisions);
# 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: save.php,v 1.3 2005/04/18 15:25:24 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } if (isset($_POST['m']) && isset($_POST['s'])) { $floc = pathos_core_makeLocation($_POST['m'], $_POST['s'], $_POST['i']); if (pathos_permissions_check("configure", $floc)) { $data = null; $data = $db->selectObject("swfitem", "location_data='" . serialize($floc) . "'"); $data = swfitem::update($_POST, $data); $data->location_data = serialize($floc); $directory = "files/swfmodule/"; $filefield = 'swf_name'; if (isset($_FILES[$filefield]) && $_FILES[$filefield]['name'] != "") { if (isset($data->swf_id) && $data->swf_id != 0) { $file = $db->selectObject("file", "id=" . $data->swf_id); file::delete($file); $db->delete("file", "id=" . $file->id); } $file = file::update($filefield, $directory, null); if ($file != null) {
# 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: finish_install_extension.php,v 1.7 2005/04/18 15:33:33 filetreefrog Exp $ ################################################## // Part of the Extensions category if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('extensions', pathos_core_makeLocation('administrationmodule'))) { $template = new template('administrationmodule', '_upload_finalSummary', $loc); $sessid = session_id(); if (!file_exists(BASE . "extensionuploads/{$sessid}") || !is_dir(BASE . "extensionuploads/{$sessid}")) { $template->assign('nofiles', 1); } else { if (!defined('SYS_FILES')) { require_once BASE . 'subsystems/files.php'; } $success = array(); foreach (array_keys(pathos_files_listFlat(BASE . "extensionuploads/{$sessid}", true, null, array(), BASE . "extensionuploads/{$sessid}")) as $file) { if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') { pathos_files_makeDirectory(dirname($file)); $success[$file] = copy(BASE . "extensionuploads/{$sessid}" . $file, BASE . substr($file, 1)); if (basename($file) == 'views_c') { chmod(BASE . substr($file, 1), 0777);
# 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: htmlarea_saveconfig.php,v 1.5 2005/02/19 00:32:28 filetreefrog Exp $ ################################################## // Part of the HTMLArea category if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('htmlarea', pathos_core_makeLocation('administrationmodule'))) { $config = null; if (isset($_POST['id'])) { $config = $db->selectObject('htmlareatoolbar', 'id=' . $_POST['id']); } $config->name = $_POST['config_name']; $config->data = array(); foreach (explode(':', $_POST['config']) as $line) { $line = trim($line); if ($line != '') { $i = count($config->data); $config->data[] = array(); foreach (explode(';', $line) as $icon) { $config->data[$i][] = $icon; // MAY need to strip off ed }
# General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Exponent is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of # 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: order.php,v 1.5 2005/04/03 07:57:14 filetreefrog Exp $ ################################################## if (!defined("PATHOS")) { exit(""); } if (pathos_permissions_check('manage', pathos_core_makeLocation('navigationmodule', '', $_GET['parent']))) { $db->switchValues('section', 'rank', $_GET['a'], $_GET['b'], 'parent=' . $_GET['parent']); pathos_flow_redirect(); } else { echo SITE_403_HTML; }
# 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: admin_editmimetype.php,v 1.7 2005/04/18 15:49:02 filetreefrog Exp $ ################################################## // Part of the Administration Control Panel : Files Subsystem category if (!defined('PATHOS')) { exit(''); } if (pathos_permissions_check('files_subsystem', pathos_core_makeLocation('administrationmodule'))) { $type = null; if (isset($_GET['type'])) { $type = $db->selectObject('mimetype', "mimetype='" . $_GET['type'] . "'"); } if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } pathos_forms_initialize(); $form = mimetype::form($type); $form->meta('module', 'filemanager'); $form->meta('action', 'admin_savemimetype'); $template = new template('filemanager', '_form_editmimetype', $loc); $template->assign('form_html', $form->toHTML()); $template->assign('is_edit', isset($type->id) ? 1 : 0); $template->output();
<link rel="stylesheet" title="default" href="<?php echo THEME_RELATIVE; ?> style.css" /> <link rel="stylesheet" title="default" href="<?php echo THEME_RELATIVE; ?> editor.css" /> <script type="text/javascript" src="<?php echo PATH_RELATIVE; ?> pathos.js.php"></script> </head> <body onLoad="pathosJSinitialize()"> <?php define("PREVIEW_READONLY", 1); $module = $_GET['module']; $view = $_GET['view']; $mod = new $module(); $title = $_GET['title']; $source = isset($_GET['source']) ? $_GET['source'] : "@example"; $loc = pathos_core_makeLocation($module, $source, ""); $mod->show($view, $loc, $title); ?> <script type="text/javascript"> var elems = document.getElementsByTagName("a"); for (var i = 0; i < elems.length; i++) { elems[i].setAttribute("onClick","return false;"); }