コード例 #1
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();
 }
コード例 #2
0
 function show($view, $loc = null, $title = '')
 {
     if (pathos_permissions_check('administrate', $loc) || pathos_permissions_check('create', $loc) || pathos_permissions_check('edit', $loc) || pathos_permissions_check('delete', $loc)) {
         $template = new template('htmltemplatemodule', $view, $loc);
         if (!defined('SYS_FILES')) {
             require_once BASE . 'subsystems/files.php';
         }
         $directory = 'files/htmltemplatemodule/' . $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);
             }
         }
         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'), pathos_core_makeLocation('htmltemplatemodule'));
         $template->output();
     }
 }
コード例 #3
0
 function register_permissions($perms, $locs)
 {
     $permissions_register = array();
     if (!is_array($perms)) {
         $perms = array($perms);
     }
     if (!is_array($locs)) {
         $locs = array($locs);
     }
     foreach ($perms as $perm) {
         foreach ($locs as $loc) {
             $permissions_register[$perm] = pathos_permissions_check($perm, $loc) ? 1 : 0;
         }
     }
     $this->tpl->assign("permissions", $permissions_register);
 }
コード例 #4
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();
 }
コード例 #5
0
#
# 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");
コード例 #6
0
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: edit.php,v 1.5 2005/03/11 15:18:37 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$item = null;
if (isset($_GET['id'])) {
    $item = $db->selectObject("imagemanageritem", "id=" . $_GET['id']);
    $loc = unserialize($item->location_data);
}
if ($item == null && pathos_permissions_check("post", $loc) || $item != null && pathos_permissions_check("edit", $loc)) {
    $form = imagemanageritem::form($item);
    $form->location($loc);
    $form->meta("action", "save");
    $template = new template("imagemanagermodule", "_form_edit", $loc);
    $directory = BASE . "files/imagemanagermodule/" . $loc->src;
    if (!isset($item->id) && !is_really_writable($directory)) {
        $template->assign("dir_not_writable", 1);
        $form->controls['submit']->disabled = 1;
    } else {
        $template->assign("dir_not_writable", 0);
    }
    $template->assign("form_html", $form->toHTML());
    $template->assign("is_edit", isset($_GET['id']));
    $template->output();
} else {
コード例 #7
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: 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;
}
コード例 #8
0
# 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;
}
コード例 #9
0
# 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: rank_switch.php,v 1.2 2005/02/19 16:53:34 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
if (pathos_permissions_check("manage", $loc)) {
    $action_a = $db->selectObject("article", "location_data='" . serialize($loc) . "' AND category_id=" . $_GET['category_id'] . " AND rank=" . $_GET['a']);
    $action_b = $db->selectObject("article", "location_data='" . serialize($loc) . "' AND category_id=" . $_GET['category_id'] . " AND rank=" . $_GET['b']);
    $action_a->rank = $_GET['b'];
    $action_b->rank = $_GET['a'];
    $db->updateObject($action_a, "article");
    $db->updateObject($action_b, "article");
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
コード例 #10
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: 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;
}
コード例 #11
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: delete.php,v 1.5 2005/02/19 00:32:33 filetreefrog Exp $
##################################################
//GREP:HARDCODEDTEXT
if (!defined("PATHOS")) {
    exit("");
}
$item = $db->selectObject("imagemanageritem", "id=" . $_GET['id']);
if ($item != null) {
    $loc = unserialize($item->location_data);
    if (pathos_permissions_check("delete", $loc)) {
        $file = $db->selectObject("file", "id=" . $item->file_id);
        $db->delete("file", "id=" . $file->id);
        $db->delete("imagemanageritem", "id=" . $item->id);
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
コード例 #12
0
# 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;
}
コード例 #13
0
# 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);
コード例 #14
0
# 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);
    $css = array(SYS_WORKFLOW_ACTION_POSTED => "workflow_action workflow_action_posted", SYS_WORKFLOW_ACTION_EDITED => "workflow_action workflow_action_", SYS_WORKFLOW_ACTION_APPROVED_APPROVED => "workflow_action workflow_action_approved_approved", SYS_WORKFLOW_ACTION_APPROVED_EDITED => "workflow_action workflow_action_approved_edited", SYS_WORKFLOW_ACTION_APPROVED_DENIED => "workflow_action workflow_action_approved_denied", SYS_WORKFLOW_ACTION_APPROVED_FINAL => "workflow_action workflow_action_approved_final", SYS_WORKFLOW_ACTION_DELETED => "workflow_action workflow_action_deleted", SYS_WORKFLOW_ACTION_RESTARTED => "workflow_action workflow_action_restarted", SYS_WORKFLOW_ACTION_IMPLICIT_APPROVAL => "workflow_action workflow_action_implicit_approval", SYS_WORKFLOW_ACTION_RESTORED => "workflow_action workflow_action_restored");
コード例 #15
0
 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;
 }
コード例 #16
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: stepstone_delete.php,v 1.4 2005/02/23 23:51:17 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);
    if (pathos_permissions_check('manage_steps', $loc)) {
        $db->delete('codemap_stepstone', 'id=' . $stepstone->id);
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
コード例 #17
0
# 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: delete_record.php,v 1.2 2005/02/19 00:32:32 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$f = $db->selectObject("formbuilder_form", "id=" . $_GET['form_id']);
if ($f) {
    if (pathos_permissions_check("deletedata", unserialize($f->location_data))) {
        $db->delete("formbuilder_" . $f->table_name, "id=" . $_GET['id']);
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
コード例 #18
0
    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
コード例 #19
0
# 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: approve.php,v 1.5 2005/04/18 15:33:05 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$info = $db->selectObject($_GET['datatype'] . "_wf_info", "real_id=" . $_GET['id']);
$object = $db->selectObject($_GET['datatype'] . "_wf_revision", "wf_original=" . $_GET['id'] . " AND wf_major=" . $info->current_major . " AND wf_minor=" . $info->current_minor);
$state = unserialize($object->wf_state_data);
$rloc = unserialize($object->location_data);
if (pathos_permissions_check("approve", $rloc) || $user && $user->id == $state[0][0]) {
    if (!defined('SYS_WORKFLOW')) {
        require_once BASE . 'subsystems/workflow.php';
    }
    pathos_workflow_processApproval($_GET['id'], $_GET['datatype'], SYS_WORKFLOW_APPROVE_APPROVE);
} else {
    echo SITE_403_HTML;
}
コード例 #20
0
# 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();
コード例 #21
0
# 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: af_delete.php,v 1.5 2005/02/19 00:32:29 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('manage_af', $loc)) {
    $af = $db->selectObject('banner_affiliate', 'id=' . $_GET['id']);
    if ($af) {
        $db->delete('banner_affiliate', 'id=' . $_GET['id']);
        pathos_flow_redirect();
    } else {
        echo SITE_404_HTML;
    }
} else {
    echo SITE_403_HTML;
}
コード例 #22
0
# 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;
}
コード例 #23
0
                file::delete($file);
                $db->delete("file", "id=" . $file->id);
            }
            $file = file::update($filefield, $directory, null);
            if ($file != null) {
                $data->alt_image_id = $db->insertObject($file, "file");
            }
        }
        if (isset($data->id)) {
            $db->updateObject($data, "swfitem");
        } else {
            $db->insertObject($data, "swfitem");
        }
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
if (pathos_permissions_check("configure", $loc)) {
    $textitem = textitem::update($_POST, $textitem);
    $textitem->location_data = serialize($loc);
    pathos_template_clear();
    if (!defined("SYS_WORKFLOW")) {
        require_once BASE . "subsystems/workflow.php";
    }
    pathos_workflow_post($textitem, "textitem", $loc);
} else {
    echo SITE_403_HTML;
}
コード例 #24
0
# 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();
} else {
コード例 #25
0
$db_data = null;
$fields = array();
$captions = array();
foreach ($controls as $c) {
    $ctl = unserialize($c->data);
    $control_type = get_class($ctl);
    $def = call_user_func(array($control_type, "getFieldDefinition"));
    if ($def != null) {
        $value = call_user_func(array($control_type, 'parseData'), $c->name, $_POST, true);
        $varname = $c->name;
        $db_data->{$varname} = $value;
        $fields[$c->name] = call_user_func(array($control_type, 'templateFormat'), $value, $ctl);
        $captions[$c->name] = $c->caption;
    }
}
if (!isset($_POST['data_id']) || isset($_POST['data_id']) && pathos_permissions_check("editdata", unserialize($f->location_data))) {
    if ($f->is_saved == 1) {
        if (isset($_POST['data_id'])) {
            //if this is an edit we remove the record and insert a new one.
            $olddata = $db->selectObject('formbuilder_' . $f->table_name, 'id=' . $_POST['data_id']);
            $db_data->ip = $olddata->ip;
            $db_data->user_id = $olddata->user_id;
            $db_data->timestamp = $olddata->timestamp;
            $db->delete('formbuilder_' . $f->table_name, 'id=' . $_POST['data_id']);
        } else {
            $db_data->ip = $_SERVER['REMOTE_ADDR'];
            if (pathos_sessions_loggedIn()) {
                $db_data->user_id = $user->id;
            } else {
                $db_data->user_id = 0;
            }
コード例 #26
0
# 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.4 2005/04/18 15:26:01 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
if (isset($_POST['id'])) {
    $textitem = $db->selectObject('textitem', 'id=' . $_POST['id']);
    if ($textitem) {
        $loc = unserialize($textitem->location_data);
    }
}
if (pathos_permissions_check('edit', $loc)) {
    $textitem = textitem::update($_POST, $textitem);
    $textitem->location_data = serialize($loc);
    pathos_template_clear();
    if (!defined('SYS_WORKFLOW')) {
        require_once BASE . 'subsystems/workflow.php';
    }
    pathos_workflow_post($textitem, 'textitem', $loc);
} else {
    echo SITE_403_HTML;
}
コード例 #27
0
# 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
            }
コード例 #28
0
# 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_control.php,v 1.3 2005/02/19 00:32:32 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$ctl = null;
if (isset($_GET['id'])) {
    $ctl = $db->selectObject("formbuilder_control", "id=" . $_GET['id']);
}
if ($ctl) {
    $f = $db->selectObject("formbuilder_form", "id=" . $ctl->form_id);
    if (pathos_permissions_check("editform", unserialize($f->location_data))) {
        $db->delete("formbuilder_control", "id=" . $ctl->id);
        $db->decrement("formbuilder_control", "rank", 1, "form_id=" . $ctl->form_id . " AND rank > " . $ctl->rank);
        $f = $db->selectObject("formbuilder_form", "id=" . $ctl->form_id);
        formbuilder_form::updateTable($f);
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
コード例 #29
0
# 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();
コード例 #30
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();
 }