function show($view, $loc = null, $title = '') { $template = new template('loginmodule', $view, $loc); $template->assign('title', $title); if (pathos_sessions_loggedIn()) { global $user, $db; $template->assign('loggedin', 1); $template->assign('user', $user); // Generate display name as username if the first and last name fields are blank. $display_name = $user->firstname . ' ' . $user->lastname; if (trim($display_name) == '') { $display_name = $user->username; } $template->assign('displayname', $display_name); // Need to check for groups and whatnot if ($db->countObjects('groupmembership', 'member_id=' . $user->id . ' AND is_admin=1')) { $template->assign('is_group_admin', 1); } else { $template->assign('is_group_admin', 0); } } else { $template->assign("loggedin", 0); } $template->output($view); }
function show($view, $loc = null, $title = '') { $template = new template('previewmodule', $view, $loc); $level = 99; if (pathos_sessions_isset('uilevel')) { $level = pathos_sessions_get('uilevel'); } $template->assign('editMode', pathos_sessions_loggedIn() && $level != UILEVEL_PREVIEW); $template->assign('title', $title); $template->assign('previewMode', $level == UILEVEL_PREVIEW); $template->output($view); }
$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; } $db_data->timestamp = time(); } $db->insertObject($db_data, 'formbuilder_' . $f->table_name); } //Email stuff here... //Don't send email if this is an edit. if ($f->is_email == 1 && !isset($_POST['data_id'])) { //Building Email List... $emaillist = array(); foreach ($db->selectObjects("formbuilder_address", "form_id=" . $f->id) as $address) { if ($address->group_id != 0) {
function pathos_sessions_validate() { global $db; if (pathos_sessions_loggedIn()) { $ticket = $db->selectObject('sessionticket', "ticket='" . $_SESSION[SYS_SESSION_KEY]['ticket'] . "'"); $timeoutval = SESSION_TIMEOUT; if ($timeoutval < 300) { $timeoutval = 300; } if ($ticket == null || $ticket->last_active < time() - $timeoutval) { pathos_sessions_logout(); define('SITE_403_HTML', SESSION_TIMEOUT_HTML); return; } global $user; $user = $_SESSION[SYS_SESSION_KEY]['user']; if ($ticket->refresh == 1) { pathos_permissions_load($user); $db->updateObject($ticket, 'sessionticket', "ticket='" . $ticket->ticket . "'"); } $ticket->refresh = 0; $ticket->last_active = time(); $db->updateObject($ticket, 'sessionticket', "ticket='" . $ticket->ticket . "'"); } define('SITE_403_HTML', SITE_403_REAL_HTML); }
function pathos_flow_redirect($url_type = SYS_FLOW_NONE) { global $SYS_FLOW_REDIRECTIONPATH; $access_level = pathos_sessions_loggedIn() ? SYS_FLOW_PROTECTED : SYS_FLOW_PUBLIC; // Fallback to the default redirection path in strange edge cases. if (!pathos_sessions_isset($SYS_FLOW_REDIRECTIONPATH . '_flow_last_' . $access_level)) { $SYS_FLOW_REDIRECTIONPATH = 'pathos_default'; } $url = ''; switch ($url_type) { case SYS_FLOW_NONE: $url = pathos_sessions_get($SYS_FLOW_REDIRECTIONPATH . '_flow_last_' . $access_level); break; case SYS_FLOW_SECTIONAL: case SYS_FLOW_ACTION: $url = pathos_sessions_get($SYS_FLOW_REDIRECTIONPATH . '_flow_' . $access_level . '_' . $url_type); break; } if ($url == '') { $url = URL_FULL . 'index.php?section=' . SITE_DEFAULT_SECTION; } if (DEVELOPMENT >= 2) { echo '<a href="' . $url . '">' . $url . '</a>'; } else { header("Location: {$url}"); } exit('Redirecting...'); }