Esempio n. 1
0
     if ($res) {
         Error::generate('notice', 'Authentication successful');
         Pageview::RenameUser($vid, get_viewer_id());
         if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
             redirect_raw($_SESSION['last_rendered_page']);
         } else {
             redirect();
         }
     } else {
         Error::generate('notice', $error, Error::$FLAGS['single']);
         include "views/login.view.php";
     }
 } else {
     if ($action == 'forgot_password') {
         $name = $params['name'];
         $email = User::GetAttrib(User::GetUserID($name), 'email');
         if ($email != $params['email']) {
             Error::generate('notice', 'Invalid email address and/or username');
             if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
                 redirect_raw($_SESSION['last_rendered_page']);
             } else {
                 redirect();
             }
         } else {
             $key = User::GenerateForgottenPasswordKey($name);
             $hdr = "From: jkoff@129-97-224-169.uwaterloo.ca";
             $msg = "Follow the following URL to reset your password:\\\n\t\t\t\t{$PAGE_REL_URL}/reset_password?key={$key}";
             // UWaterloo blocks SMTP (port 25) outgoing
             $res = mail("{$name} <{$email}>", 'Password Reset', $msg, $hdr);
             Error::generate('debug', $msg);
             if ($res) {
Esempio n. 2
0
             header("Pragma: no-cache");
             header("Content-Type: text/html");
             header("Connection:");
             header("Content-length:");
             echo "Successfully reported.";
         }
     }
 } else {
     if (isset($_GET['action']) && $_GET['action'] != "") {
         // Action with no params
         $action = $_GET['action'];
         switch ($action) {
             case 'list':
                 $args['list'] = ResourceReport::ListAll();
                 foreach ($args['list'] as $k => $v) {
                     $args['list'][$k]['user_name'] = User::GetAttrib($v['user_id'], 'name');
                     $args['list'][$k]['resource_subject'] = get_subject($v['resource_id'], $v['type']);
                 }
                 include "views/{$action}.view.php";
                 break;
             case 'show':
                 Error::generate('notice', 'Invalid file ID', Error::$FLAGS['single']);
                 header("Location: {$PAGE_REL_URL}");
                 break;
             default:
                 Error::generate('suspicious', "Invalid action {$action} in resource reports controller");
                 header("Location: {$PAGE_REL_URL}");
         }
     } else {
         include "views/index.view.php";
     }
Esempio n. 3
0
<div id="comment_box_<?php 
    echo $jsid;
    ?>
">
<?php 
    if ($comments) {
        foreach ($comments as $id) {
            if (is_array($id)) {
                // array of objects, not ids :-/
                $id = $id['id'];
            }
            $subject = Comment::GetSubject($id);
            $timestamp = Comment::GetTimestamp($id);
            $ownerid = Comment::GetAttrib($id, 'owner');
            $owner = User::GetAttrib($ownerid, 'name');
            $body = Comment::GetAttrib($id, 'body');
            $rating = Comment::GetAttrib($id, 'rating');
            $comment_stack[] = array($cid, $jsid, $flags, $comments, $text);
            $cid = $id;
            $jsid = uniqid();
            $flags = 1;
            $comments = Comment::ListAll($cid, 1);
            $text = "See more comments ";
            ?>
	<div class="comment">
		<div class="avatar">
			<div class="user_image">
				<img src="<?php 
            echo User::GetAvatar($ownerid);
            ?>