userCheckAccess(LEVEL_SUPPORT); $action_is_valid=false; $support = new support(); if ( isset($_GET['action']) ) { // If the user wants to see the details of a ticket if ( $_GET['action'] == 'show') { if ( !textVerification::verifID($_GET['id'])) throw new myException('Trying to see a ticket with an invalid id'); $action_is_valid=true; $template_main = 'admin/support/show'; $ticket_id=$_GET['id']; $details = $support->getTicketDetails($ticket_id); if (!is_null($details)) { $ticket = $details[0]; $lang = new lang(); $ticket->open_date = date($lang->userGetDateFormat().' '.$lang->userGetTimeFormat(), $ticket->open_date); $pages_count = $support->countTicketTotalPages( $_GET['id'] ); $_SESSION['template']->getWords(array('pages_count' => $pages_count, 'user_actions_allowed' => true, 'ticket' => $ticket)); } else throw new myException('Ticket not found or user not allowed to see it'); } } // if no valid action was specified (or recognized) if (!$action_is_valid) { $pages_count1 = $support->countWaitingTicketsTotalPages(); $pages_count2 = $support->countRepliedTicketsTotalPages(); $_SESSION['template']->getWords(array('pages_count1' => $pages_count1, 'pages_count2' => $pages_count2)); $template_main = 'admin/support/list'; } // Load templates $_SESSION['template']->loadTemplate('_contentbegin'); $_SESSION['template']->loadTemplate($template_main); $_SESSION['template']->loadTemplate('_contentend'); $_SESSION['template']->getWords(array('sql' => $_SESSION['database']->executed_req)); // Parse templates $_SESSION['template']->parseTemplate(); } catch (myException $error) { $error->displayErrorMessage(); } ?>