Beispiel #1
0
 public function run()
 {
     $tpl = new template();
     $login = new login(session::getSID());
     $tpl->assign('login', $login);
     $tpl->display('general.header');
 }
Beispiel #2
0
 public function run()
 {
     $login = new login(session::getSID());
     if ($login->logged_in() === true) {
         header("Location: /index.php?logout=1");
     }
 }
 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");
     }
 }
 /**
  * start - renders applicaiton and routes to correct template, writes content to output buffer
  *
  * @access public static
  * @return void
  */
 public function start()
 {
     $config = new config();
     $login = new login(session::getSID());
     $frontController = frontcontroller::getInstance(ROOT);
     if ($login->logged_in() === false) {
         if (isset($_GET['export']) === true) {
             ob_start();
             $frontController->run();
             $toRender = ob_get_clean();
         } else {
             ob_start();
             include 'includes/templates/' . TEMPLATE . '/login.php';
             $toRender = ob_get_clean();
         }
     } else {
         ob_start();
         include 'includes/templates/' . TEMPLATE . '/content.php';
         $toRender = ob_get_clean();
     }
     $this->render($toRender);
 }
 public function run()
 {
     $login = new login(session::getSID());
     if ($login->logged_in() === true) {
         $tpl = new template();
         //Messages
         $message = new messages();
         $messages = $message->getInbox($_SESSION['userdata']['id'], 5, 0);
         $messageCount = count($messages);
         if ($messageCount) {
             $mailOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#');
         } else {
             $mailOptions = array('class' => 'dropdown-toggle');
         }
         $tpl->assign("mailOptions", $mailOptions);
         $tpl->assign("messagecount", $messageCount);
         $tpl->assign("messages", $messages);
         $tpl->assign("helper", new helper());
         //Tickets
         $tickets = new tickets();
         $newTickets = $tickets->getUnreadTickets($_SESSION['userdata']['id']);
         $ticketCount = count($newTickets);
         if (count($newTickets)) {
             $ticketOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#');
         } else {
             $ticketOptions = array('class' => 'dropdown-toggle');
         }
         if (is_array($newTickets) === true) {
             $limitedTicketItems = array_slice($newTickets, 0, 5);
         } else {
             $limitedTicketItems = array();
         }
         $tpl->assign("tickeOptions", $ticketOptions);
         $tpl->assign("ticketCount", $ticketCount);
         $tpl->assign("newTickets", $limitedTicketItems);
         $tpl->display("general.headMenu");
     }
 }
Beispiel #6
0
<?php

define('VERSION', '0.6');
define('RESTRICTED', TRUE);
define('PUBLIC', TRUE);
define('MYFILE', basename($_SERVER['PHP_SELF'], ".d"));
define('TEMPLATE', 'zypro');
$root = dirname(__FILE__);
define('ROOT', $root);
include_once 'config/settings.php';
include_once 'core/class.autoload.php';
include_once 'config/configuration.php';
$login = new login(session::getSID());
ob_start();
if ($login->logged_in() !== true) {
    $login->showLogin();
    $loginContent = ob_get_clean();
    ob_start();
} else {
    $loginContent = '';
}
$application = new application();
$application->start();
ob_end_flush();
    /**
     * 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";
            }
        }
    }