public function run()
 {
     $login = new login(session::getSID());
     if ($login->logged_in() === true) {
         $user = new users();
         $profilePicture = $user->getProfilePicture($_SESSION['userdata']['id']);
         $tpl = new template();
         $tpl->assign("profilePicture", $profilePicture);
         $tpl->assign("userName", $_SESSION['userdata']['name']);
         $tpl->assign("userEmail", $_SESSION['userdata']['mail']);
         $tpl->display("general.loginInfo");
     }
 }
Beispiel #2
0
        ?>
      			 	<?php 
        $first = true;
        ?>
      			 	class='selected'
			 	<?php 
    }
    ?>
			 	onclick='changeEmail(<?php 
    echo $msgList['id'];
    ?>
, "inbox")'>
			 	
      			<div class='thumb'>
      				<img src='<?php 
    echo $user->getProfilePicture($msgList['user_id']);
    ?>
' />
      			</div>
      			<div class='summary'>
      				<span class='date pull-right'>
      					<small>
      						<?php 
    echo date('M d, Y', strtotime($msgList['date_sent']));
    ?>
      					</small>
      				</span>
      				<h4 class="name"><?php 
    echo $msgList['firstname'] . ' ' . $msgList['lastname'];
    ?>
</h4>
    /**
     * run - display template and edit data
     *
     * @access public
     *
     */
    public function run()
    {
        $login = new login(session::getSID());
        //Check if user is logged in
        if ($login->logged_in() !== true) {
            exit;
        }
        $helper = new helper();
        $projects = new projects();
        $tickets = new tickets();
        $module = $_GET['module'];
        //Organize ajax handlers by module and action
        if ($module == "tickets.showAll") {
            // AJAX status change
            if (isset($_POST['ticketId'])) {
                $ticketId = $_POST['ticketId'];
                $newStatus = $_POST['newStatus'];
                if ($tickets->getAccessRights($ticketId)) {
                    if ($tickets->changeStatus($ticketId, $newStatus) === true) {
                        echo "Status was changed";
                    } else {
                        echo "Error with change";
                    }
                } else {
                    echo "You have no rights to do that.";
                }
            }
        } else {
            if ($module == "tickets.showTicket") {
                $users = new users();
                $id = $_GET['id'];
                $results = $tickets->getTimelineHistory($id);
                $ticket = $tickets->getTicket($id);
                $jsonArr = array();
                $description = strip_tags($ticket['description']);
                $description = str_replace("\n", "", $description);
                $description = str_replace("\r", "", $description);
                $json = '{"timeline":
			    {   "headline":"Ticket History for ' . $ticket['headline'] . '",
			        "type":"default",
					"text":"' . $description . '",
					"startDate":"' . $ticket['timelineDate'] . '",
			        "date": [ ';
                //Creation Date
                $items[] = '{
					"startDate":"' . $ticket['timelineDate'] . '",
	                "headline":"Ticket Created",
	                "text":"<p>Ticket created by ' . $ticket['userFirstname'] . ', ' . $ticket['userLastname'] . '</p>",
	                "asset":
	                {  "media":"",
	                    "credit":"",
	                    "caption":""
	                }
				}';
                foreach ($results as $row) {
                    $items[] = '{
					"startDate":"' . $row['date'] . '",
	                "headline":"Ticket Update",
	                "text":"<p>' . $row['firstname'] . ', ' . $row['lastname'] . ' changed ' . $row['changeType'] . ' to ' . $row['changeValue'] . '</p>",
	                "asset":
	                {  "media":"' . $users->getProfilePicture($row['userId']) . '",
	                    "credit":"' . $row['firstname'] . ', ' . $row['lastname'] . '",
	                    "caption":""
	                }
				}';
                }
                $comments = new comments();
                $allcomments = $comments->getComments('ticket', $id);
                foreach ($allcomments as $comment) {
                    $items[] = '{
					"startDate":"' . $comment['timelineDate'] . '",
	                "headline":"New Comment",
	                "text":' . json_encode('<p>' . $comment['firstname'] . ', ' . $comment['lastname'] . ' said:<br /> </p>' . $comment['text']) . ',
	                "asset":
	                {	"media":"' . $users->getProfilePicture($comment['userId']) . '",
	                    "credit":"' . $comment['firstname'] . ', ' . $comment['lastname'] . '",
	                    "caption":""
	                }
				}';
                }
                $file = new files();
                $files = $file->getFilesByModule('ticket', $id);
                $tempStr = '';
                $tempStr3 = '';
                $imgExtensions = array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv');
                foreach ($files as $fileRow) {
                    if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/userdata/' . $fileRow['module'] . '/' . $fileRow['encName'] . '.' . $fileRow['extension'])) {
                        $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "' />";
                        $filepath = "userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "";
                    } else {
                        $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/file.png' />";
                        $filepath = "userdata/file.png";
                    }
                    $tempStr = '{
					"startDate":"' . $fileRow['timelineDate'] . '",
	                "headline":"New File",
	                "text":"' . $fileRow['firstname'] . ', ' . $fileRow['lastname'] . ' uploaded:<br /><a href=\'' . $filepath . '\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</a>",';
                    $tempStr3 .= '<span class=\'filename\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</span>
                        </a>",';
                    $tempStr .= '
	               "asset":
	                {	"media":"' . $filepath . '",
	                    "credit":"' . $fileRow['realName'] . '.' . $fileRow['extension'] . '",
	                    "caption":""
	                }
				}';
                    $items[] = $tempStr;
                }
                $json .= implode(",", $items);
                $json .= '	
					]
    				}
				}';
                header('Content-type: text/json');
                header('Content-type: application/json');
                echo $json;
            } else {
                echo "There are no ajax actions for this module";
            }
        }
    }
 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $hasher = new PasswordHash(8, TRUE);
     $userId = $_SESSION['userdata']['id'];
     $row = $this->getUser($userId);
     // $projects = $this->getUserProjectRelation($userId);
     $infoKey = '';
     //Build values array
     $values = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user' => $row['username'], 'phone' => $row['phone'], 'role' => $row['role']);
     //Save form
     if (isset($_POST['save'])) {
         $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'password' => $hasher->HashPassword($_POST['newPassword']));
         $changedEmail = 0;
         if ($row['username'] != $values['user']) {
             $changedEmail = 1;
         }
         //Validation
         if ($values['user'] !== '') {
             $helper = new helper();
             if ($helper->validateEmail($values['user']) == 1) {
                 if ($_POST['newPassword'] == $_POST['confirmPassword']) {
                     if ($_POST['newPassword'] == '') {
                         $values['password'] = '';
                     } else {
                         $this->editOwn($values, $userId);
                     }
                     if ($changedEmail == 1) {
                         if ($this->usernameExist($values['user'], $userId) === false) {
                             $this->editOwn($values, $userId);
                             $tpl->setNotification('EDIT_SUCCESS', 'success');
                         } else {
                             $tpl->setNotification('USERNAME_EXISTS', 'error');
                         }
                     } else {
                         $this->editOwn($values, $userId);
                         $tpl->setNotification('EDIT_SUCCESS', 'success');
                     }
                 } else {
                     $tpl->setNotification('PASSWORDS_DONT_MATCH', 'ERROR');
                 }
             } else {
                 $tpl->setNotification('NO_VALID_EMAIL', 'error');
             }
         } else {
             $tpl->setNotification('NO_USERNAME', 'error');
         }
     }
     $file = new files();
     if (isset($_POST['savePic'])) {
         if (isset($_FILES)) {
             $this->setPicture($_FILES, $_SESSION['userdata']['id']);
         }
     }
     //Assign vars
     $users = new users();
     //		$tpl->assign('profilePic', $file->getFilesByModule('user',$_SESSION['userdata']['id']));
     $tpl->assign('profilePic', $users->getProfilePicture($_SESSION['userdata']['id']));
     $tpl->assign('info', $infoKey);
     $tpl->assign('values', $values);
     //$tpl->assign('roles', $this->roles);
     $tpl->assign('user', $row);
     $tpl->display('users.editOwn');
 }
Beispiel #5
0
        ?>
      			 	<?php 
        $first = true;
        ?>
      			 	class='selected'
			 	<?php 
    }
    ?>
			 	onclick='changeEmail(<?php 
    echo $msgList['id'];
    ?>
, "inbox")'>
			 	
      			<div class='thumb'>
      				<img src='<?php 
    echo $user->getProfilePicture($msgList['user_id']);
    ?>
' />
      			</div>
      			<div class='summary'>
      				<span class='date pull-right'>
      					<small>
      						<?php 
    echo date('M d, Y', strtotime($msgList['date_sent']));
    ?>
      					</small>
      				</span>
      				<h4 class="name"><?php 
    echo $msgList['firstname'] . ' ' . $msgList['lastname'];
    ?>
</h4>