Ejemplo n.º 1
0
 function process_edit_data(&$posted_data, $record, &$is_new)
 {
     if (isset($posted_data['clear'])) {
         $this->delete_user_data($record);
         global $STRINGS;
         set_session_message($STRINGS['user_data_delete'], 'info-message');
         $posted_data['redirect_url'] = $this->url('edit', $record['url']);
     }
 }
Ejemplo n.º 2
0
         $error = true;
     } else {
         set_session_message($STRINGS['item_create'], 'info-message');
         // set message
         xlog(2, 'Create: ' . $result['url'], 'EDIT');
         $redirect_url = $MODULE->url('edit', $result['url']);
     }
 } else {
     $result = $ds->update($RECORD['url'], $data);
     // update the item
     if (is_null($result)) {
         header("HTTP/1.0 400 Bad request");
         $MESSAGE = $STRINGS['error_update_record'];
         $error = true;
     } else {
         set_session_message($STRINGS['item_save'], 'info-message');
         // set message
         xlog(2, 'Update: ' . $result['url'], 'EDIT');
         $redirect_url = $MODULE->url('edit', $result['url']);
     }
 }
 // pass to module for any final processing
 $MODULE->finish_edit_process($_POST, $result, $error);
 // check for error from module
 if (@$_POST['error']) {
     header("HTTP/1.0 400 Bad request");
     $MESSAGE = $_POST['error'];
 } else {
     if (!$error) {
         // redirect to the item and return status 303
         $redirect_url .= isset($_POST['append_url']) ? $_POST['append_url'] : '';
Ejemplo n.º 3
0
    $_SESSION = array();
}
// Set up database sessions
//### if ($CONF['session_manager'] == 'peardb' && empty($CONF['new_admin']))
//###     require_once $CONF['path_src'] . 'basic/SessionHandler.class.php';
// Get the user
$USER = User::instance(is_cli() ? 'guest' : @$_SERVER['REMOTE_USER']);
// Debug mode -- used for online tests -- check timeout override value
if (@$CONF['debug'] && @$_GET['debug_time']) {
    $_SESSION[$USER->login . '_TIME'] = $_GET['debug_time'];
}
// check idle time
if ($USER->is_registered() && $USER->get_timeout() > 0) {
    if (isset($_SESSION[$USER->login . '_TIME']) && time() - $_SESSION[$USER->login . '_TIME'] > $USER->get_timeout()) {
        unset($_SESSION[$USER->login . '_TIME']);
        set_session_message($STRINGS['error_user_timeout'], 'error-message');
        header("HTTP/1.1 303 See Other");
        header("Location: " . $CONF['url_login']);
        exit;
    } else {
        $_SESSION[$USER->login . '_TIME'] = time();
    }
}
// Users who can't save data can't use email export
//### FIXME: this is the wrong right to use surely???
if (!$USER->has_right('save_data')) {
    $tmp = array_search('email', $CONF['export_formats']);
    if ($tmp !== FALSE) {
        unset($CONF['export_formats'][$tmp]);
    }
}
Ejemplo n.º 4
0
             }
         }
     }
 } else {
     if (isset($_POST['unmark_record'])) {
         $from_ajax = @$_POST['ajax'];
         $url = $_POST['url'];
         if ($MARKED_RECORDS->exists($url)) {
             if ($from_ajax) {
                 $ajax_record = $MARKED_RECORDS->get($url);
             }
             $MARKED_RECORDS->remove($url);
             // remove the record
             $status_message = $STRINGS['record_unmark'];
             if (!$from_ajax) {
                 set_session_message($status_message, 'info-message');
             }
         }
     } else {
         if (isset($_POST['unmark_all'])) {
             // clear marked list
             $MARKED_RECORDS = new MarkedRecord();
         } else {
             if (isset($_POST['update'])) {
                 $records = $MARKED_RECORDS->get_all();
                 foreach ($records as $url => $value) {
                     if (!isset($_POST[$url])) {
                         // this record was removed
                         $MARKED_RECORDS->remove($url);
                     }
                 }
Ejemplo n.º 5
0
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $mode != '' && $EMAIL_BODY != '') {
    $recipient = @$_POST['email'];
    if ($recipient == '') {
        $MESSAGE = 'Invalid email address';
        $MESSAGE_CLASS = 'error-message';
    } else {
        if (@$_POST['cancel'] == '') {
            $email_headers = array();
            $email_headers['From'] = $USER->email;
            $email_headers['To'] = $recipient;
            $email_headers['Subject'] = $email_subject;
            $email_headers['Content-Type'] = $MODULE->content_type('text');
            $body = $EMAIL_BODY;
            if (@$_POST['note'] != '') {
                $note = substr($_POST['note'], 0, $CONF['email_note_length']);
                $body = $note . "\r\n" . $body;
            }
            $MAILER->send($recipient, $email_headers, $body);
            $_SESSION['COUNT_EMAILS_SENT'] = $COUNT_EMAILS_SENT + 1;
            xlog(2, 'Sent email: From ' . $USER->email . ' to ' . $recipient, 'EMAIL');
        }
        header("Location: " . $MODULE->url($mode, $url_query), TRUE, 303);
        if (@$_POST['cancel'] == '') {
            set_session_message(sprintf('Email has been sent to %s.', $recipient), 'info-message');
        }
        exit;
    }
}
// Display page
header('Content-Type: ' . $MODULE->content_type());
require_once $CONF['path_templates'] . $TEMPLATE . '.php';
Ejemplo n.º 6
0
    // qualify url with module name if not already present
    if (substr_count($R_URL, '/') < 3) {
        $R_URL = '/' . $MODULE->name . $R_URL;
    }
    // retrieve record and query
    $nav_query = QueryFactory::get_session_query($MODULE, TRUE);
    $RECORD = $nav_query->get_record($R_URL, @$_REQUEST);
    if (!is_null($RECORD)) {
        $QUERY = $nav_query;
    }
}
// if link url was not given, try to retrieve from record
if (empty($URL) && !is_null($RECORD)) {
    $URL = @$RECORD['location'];
}
// check for error
if (empty($URL) && is_null($RECORD)) {
    set_session_message($STRINGS['error_external_link'], 'error-message');
    header("HTTP/1.1 303 See Other");
    header("Location: " . $MODULE->url('index'));
    exit;
}
$TEMPLATE = 'link';
$TITLE = $STRINGS['link_title'] . $URL;
header('Content-Type: ' . $MODULE->content_type());
// special case, return header frame
if (@$_REQUEST['t'] == 'header') {
    require_once $CONF['path_templates'] . 'inc-link_header.php';
} else {
    require_once $CONF['path_templates'] . $TEMPLATE . '.php';
}