XoopsModules25x /
xhelp
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /* |
||
| 4 | * You may not change or alter any portion of this comment or credits |
||
| 5 | * of supporting developers from this source code or any supporting source code |
||
| 6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 7 | * |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | */ |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 15 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||
| 16 | * @author Brian Wahoff <[email protected]> |
||
| 17 | * @author Eric Juden <[email protected]> |
||
| 18 | * @author XOOPS Development Team |
||
| 19 | */ |
||
| 20 | |||
| 21 | use Xmf\Module\Admin; |
||
| 22 | use Xmf\Request; |
||
| 23 | use XoopsModules\Xhelp; |
||
| 24 | |||
| 25 | require_once __DIR__ . '/admin_header.php'; |
||
| 26 | xoops_load('XoopsPagenav'); |
||
| 27 | define('MAX_STAFF_RESPONSETIME', 5); |
||
| 28 | define('MAX_STAFF_CALLSCLOSED', 5); |
||
| 29 | |||
| 30 | global $_GET, $xoopsModule; |
||
| 31 | $module_id = $xoopsModule->getVar('mid'); |
||
| 32 | |||
| 33 | $helper = Xhelp\Helper::getInstance(); |
||
| 34 | |||
| 35 | $op = 'default'; |
||
| 36 | |||
| 37 | if (Request::hasVar('op', 'REQUEST')) { |
||
| 38 | $op = $_REQUEST['op']; |
||
| 39 | } |
||
| 40 | |||
| 41 | switch ($op) { |
||
| 42 | case 'about': |
||
| 43 | about(); |
||
| 44 | break; |
||
| 45 | case 'mailEvents': |
||
| 46 | mailEvents(); |
||
| 47 | break; |
||
| 48 | case 'searchMailEvents': |
||
| 49 | searchMailEvents(); |
||
| 50 | break; |
||
| 51 | // case 'blocks': |
||
| 52 | // require_once __DIR__ . '/myblocksadmin.php'; |
||
| 53 | // break; |
||
| 54 | case 'createdir': |
||
| 55 | createdir(); |
||
| 56 | break; |
||
| 57 | case 'setperm': |
||
| 58 | setperm(); |
||
| 59 | break; |
||
| 60 | case 'manageFields': |
||
| 61 | manageFields(); |
||
| 62 | break; |
||
| 63 | default: |
||
| 64 | xhelp_default(); |
||
| 65 | break; |
||
| 66 | } |
||
| 67 | |||
| 68 | function modifyTicketFields() |
||
| 69 | { |
||
| 70 | //xoops_cp_header(); |
||
| 71 | //echo "not created yet"; |
||
| 72 | xoops_cp_footer(); |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param array $mailEvents |
||
| 77 | * @param array $mailboxes |
||
| 78 | */ |
||
| 79 | function displayEvents(array $mailEvents, array $mailboxes) |
||
| 80 | { |
||
| 81 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
| 82 | if (count($mailEvents) > 0) { |
||
| 83 | echo "<tr><th colspan='4'>" . _AM_XHELP_TEXT_MAIL_EVENTS . '</th></tr>'; |
||
| 84 | echo "<tr class='head'><td>" . _AM_XHELP_TEXT_MAILBOX . '</td> |
||
| 85 | <td>' . _AM_XHELP_TEXT_EVENT_CLASS . '</td> |
||
| 86 | <td>' . _AM_XHELP_TEXT_DESCRIPTION . '</td> |
||
| 87 | <td>' . _AM_XHELP_TEXT_TIME . '</td> |
||
| 88 | </tr>'; |
||
| 89 | |||
| 90 | $class = 'odd'; |
||
| 91 | foreach ($mailEvents as $event) { |
||
| 92 | echo "<tr class='" . $class . "'><td>" . $mailboxes[$event->getVar('mbox_id')]->getVar('emailaddress') . '</td> |
||
| 93 | <td>' . Xhelp\Utility::getEventClass($event->getVar('event_class')) . '</td> |
||
| 94 | <td>' . $event->getVar('event_desc') . '</td> |
||
| 95 | <td>' . $event->posted() . '</td> |
||
| 96 | </tr>'; |
||
| 97 | $class = ('odd' === $class) ? 'even' : 'odd'; |
||
| 98 | } |
||
| 99 | } else { |
||
| 100 | echo '<tr><th>' . _AM_XHELP_TEXT_MAIL_EVENTS . '</th></tr>'; |
||
| 101 | echo "<tr><td class='odd'>" . _AM_XHELP_NO_EVENTS . '</td></tr>'; |
||
| 102 | } |
||
| 103 | echo '</table><br>'; |
||
| 104 | echo "<a href='main.php?op=searchMailEvents'>" . _AM_XHELP_SEARCH_EVENTS . '</a>'; |
||
| 105 | } |
||
| 106 | |||
| 107 | function mailEvents() |
||
| 108 | { |
||
| 109 | $helper = Xhelp\Helper::getInstance(); |
||
| 110 | // Will display the last 50 mail events |
||
| 111 | /** @var \XoopsModules\Xhelp\MailEventHandler $mailEventHandler */ |
||
| 112 | $mailEventHandler = $helper->getHandler('MailEvent'); |
||
| 113 | /** @var \XoopsModules\Xhelp\DepartmentMailBoxHandler $departmentMailBoxHandler */ |
||
| 114 | $departmentMailBoxHandler = $helper->getHandler('DepartmentMailBox'); |
||
| 115 | $mailboxes = $departmentMailBoxHandler->getObjects(null, true); |
||
| 116 | |||
| 117 | $criteria = new \Criteria('', ''); |
||
| 118 | $criteria->setLimit(50); |
||
| 119 | $criteria->setOrder('DESC'); |
||
| 120 | $criteria->setSort('posted'); |
||
| 121 | $mailEvents = $mailEventHandler->getObjects($criteria); |
||
| 122 | |||
| 123 | xoops_cp_header(); |
||
| 124 | //echo $oAdminButton->renderButtons('mailEvents'); |
||
| 125 | $adminObject = Admin::getInstance(); |
||
| 126 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 127 | |||
| 128 | displayEvents($mailEvents, $mailboxes); |
||
| 129 | |||
| 130 | require_once __DIR__ . '/admin_footer.php'; |
||
| 131 | } |
||
| 132 | |||
| 133 | function searchMailEvents() |
||
| 134 | { |
||
| 135 | xoops_cp_header(); |
||
| 136 | $helper = Xhelp\Helper::getInstance(); |
||
| 137 | //echo $oAdminButton->renderButtons('mailEvents'); |
||
| 138 | $adminObject = Admin::getInstance(); |
||
| 139 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 140 | |||
| 141 | if (isset($_POST['searchEvents'])) { |
||
| 142 | /** @var \XoopsModules\Xhelp\MailEventHandler $mailEventHandler */ |
||
| 143 | $mailEventHandler = $helper->getHandler('MailEvent'); |
||
| 144 | /** @var \XoopsModules\Xhelp\DepartmentMailBoxHandler $departmentMailBoxHandler */ |
||
| 145 | $departmentMailBoxHandler = $helper->getHandler('DepartmentMailBox'); |
||
| 146 | $mailboxes = $departmentMailBoxHandler->getObjects(null, true); |
||
| 147 | |||
| 148 | $begin_date = explode('-', $_POST['begin_date']); |
||
| 149 | $end_date = explode('-', $_POST['end_date']); |
||
| 150 | $begin_hour = xhelpChangeHour($_POST['begin_mode'], $_POST['begin_hour']); |
||
| 151 | $end_hour = xhelpChangeHour($_POST['end_mode'], $_POST['end_hour']); |
||
| 152 | |||
| 153 | // Get timestamps to search by |
||
| 154 | $begin_time = mktime($begin_hour, Request::getInt('begin_minute', 0, 'POST'), (int)$begin_date[1], (int)$begin_date[2], (int)$begin_date[0]); |
||
| 155 | $end_time = mktime($end_hour, Request::getInt('end_minute', 0, 'POST'), 0, (int)$end_date[1], (int)$end_date[2], (int)$end_date[0]); |
||
| 156 | |||
| 157 | $criteria = new \CriteriaCompo(new \Criteria('posted', (string)$begin_time, '>=')); |
||
| 158 | $criteria->add(new \Criteria('posted', (string)$end_time, '<=')); |
||
| 159 | if ('' != $_POST['email']) { |
||
| 160 | $email = \Xmf\Request::getString('email', '', 'POST'); |
||
| 161 | $criteria->add(new \Criteria('emailaddress', "%$email%", 'LIKE', 'd')); |
||
| 162 | } |
||
| 163 | if ('' != $_POST['description']) { |
||
| 164 | $description = \Xmf\Request::getString('description', '', 'POST'); |
||
| 165 | $criteria->add(new \Criteria('event_desc', "%$description%", 'LIKE')); |
||
| 166 | } |
||
| 167 | $criteria->setOrder('DESC'); |
||
| 168 | $criteria->setSort('posted'); |
||
| 169 | if (isset($email)) { |
||
| 170 | $mailEvents = $mailEventHandler->getObjectsJoin($criteria); |
||
| 171 | } else { |
||
| 172 | $mailEvents = $mailEventHandler->getObjects($criteria); |
||
| 173 | } |
||
| 174 | |||
| 175 | displayEvents($mailEvents, $mailboxes); |
||
| 176 | |||
| 177 | require_once __DIR__ . '/admin_footer.php'; |
||
| 178 | } else { |
||
| 179 | $stylePath = require_once XHELP_ASSETS_PATH . '/js/calendar/calendarjs.php'; |
||
| 180 | echo '<link rel="stylesheet" type="text/css" media="all" href="' . $stylePath . '"><!--[if lt IE 7]><script src="iepngfix.js" language="JavaScript" type="text/javascript"></script><![endif]-->'; |
||
| 181 | |||
| 182 | echo "<form method='post' action='" . XHELP_ADMIN_URL . "/main.php?op=searchMailEvents'>"; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 183 | |||
| 184 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
| 185 | echo "<tr><th colspan='2'>" . _AM_XHELP_SEARCH_EVENTS . '</th></tr>'; |
||
| 186 | echo "<tr><td width='20%' class='head'>" . _AM_XHELP_TEXT_MAILBOX . "</td> |
||
| 187 | <td class='even'><input type='text' size='55' name='email' class='formButton'></td></tr>"; |
||
| 188 | echo "<tr><td class='head'>" . _AM_XHELP_TEXT_DESCRIPTION . "</td> |
||
| 189 | <td class='even'><input type='text' size='55' name='description' class='formButton'></td></tr>"; |
||
| 190 | echo "<tr><td class='head'>" . _AM_XHELP_SEARCH_BEGINEGINDATE . "</td> |
||
| 191 | <td class='even'><input type='text' name='begin_date' id='begin_date' size='10' maxlength='10' value='" . formatTimestamp(time(), 'mysql') . "'> |
||
| 192 | <a href='' onclick='return showCalendar(\"begin_date\");'><img src='" . XHELP_IMAGE_URL . "/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent;'></a> "; |
||
| 193 | xhelpDrawHourSelect('begin_hour', '12'); |
||
| 194 | xhelpDrawMinuteSelect('begin_minute'); |
||
| 195 | xhelpDrawModeSelect('begin_mode'); |
||
| 196 | echo "<tr><td class='head'>" . _AM_XHELP_SEARCH_ENDDATE . "</td> |
||
| 197 | <td class='even'><input type='text' name='end_date' id='end_date' size='10' maxlength='10' value='" . formatTimestamp(time(), 'mysql') . "'> |
||
| 198 | <a href='' onclick='return showCalendar(\"end_date\");'><img src='" . XHELP_IMAGE_URL . "/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent;'></a> "; |
||
| 199 | xhelpDrawHourSelect('end_hour', '12'); |
||
| 200 | xhelpDrawMinuteSelect('end_minute'); |
||
| 201 | xhelpDrawModeSelect('end_mode'); |
||
| 202 | echo "<tr><td class='foot' colspan='2'><input type='submit' name='searchEvents' value='" . _AM_XHELP_BUTTON_SEARCH . "'></td></tr>"; |
||
| 203 | echo '</table>'; |
||
| 204 | echo '</form>'; |
||
| 205 | |||
| 206 | require_once __DIR__ . '/admin_footer.php'; |
||
| 207 | } |
||
| 208 | } |
||
| 209 | |||
| 210 | /** |
||
| 211 | * changes hour to am/pm |
||
| 212 | * |
||
| 213 | * @param int $mode , 1-am, 2-pm |
||
| 214 | * @param int $hour hour of the day |
||
| 215 | * |
||
| 216 | * @return int in 24 hour mode |
||
| 217 | */ |
||
| 218 | function xhelpChangeHour(int $mode, int $hour): int |
||
| 219 | { |
||
| 220 | $mode = $mode; |
||
| 221 | $hour = $hour; |
||
| 222 | |||
| 223 | if (2 == $mode) { |
||
| 224 | $hour += 12; |
||
| 225 | |||
| 226 | return $hour; |
||
| 227 | } |
||
| 228 | |||
| 229 | return $hour; |
||
| 230 | } |
||
| 231 | |||
| 232 | /** |
||
| 233 | * @param string $name |
||
| 234 | * @param string $lSelect |
||
| 235 | */ |
||
| 236 | function xhelpDrawHourSelect(string $name, string $lSelect = '-1') |
||
| 237 | { |
||
| 238 | echo "<select name='" . $name . "'>"; |
||
| 239 | for ($i = 1; $i <= 12; ++$i) { |
||
| 240 | if ($lSelect == $i) { |
||
| 241 | $selected = 'selected'; |
||
| 242 | } else { |
||
| 243 | $selected = ''; |
||
| 244 | } |
||
| 245 | echo "<option value='" . $i . "'" . $selected . '>' . $i . '</option>'; |
||
| 246 | } |
||
| 247 | echo '</select>'; |
||
| 248 | } |
||
| 249 | |||
| 250 | /** |
||
| 251 | * @param string $name |
||
| 252 | */ |
||
| 253 | function xhelpDrawMinuteSelect(string $name) |
||
| 254 | { |
||
| 255 | $lSum = 0; |
||
| 256 | |||
| 257 | echo "<select name='" . $name . "'>"; |
||
| 258 | for ($i = 0; $lSum <= 50; ++$i) { |
||
| 259 | if (0 == $i) { |
||
| 260 | echo "<option value='00' selected>00</option>"; |
||
| 261 | } else { |
||
| 262 | $lSum += 5; |
||
| 263 | echo "<option value='" . $lSum . "'>" . $lSum . '</option>'; |
||
| 264 | } |
||
| 265 | } |
||
| 266 | echo '</select>'; |
||
| 267 | } |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @param string $name |
||
| 271 | * @param string $sSelect |
||
| 272 | */ |
||
| 273 | function xhelpDrawModeSelect(string $name, string $sSelect = 'AM') |
||
| 274 | { |
||
| 275 | echo "<select name='" . $name . "'>"; |
||
| 276 | if ('AM' === $sSelect) { |
||
| 277 | echo "<option value='1' selected>AM</option>"; |
||
| 278 | echo "<option value='2'>PM</option>"; |
||
| 279 | } else { |
||
| 280 | echo "<option value='1'>AM</option>"; |
||
| 281 | echo "<option value='2' selected>PM</option>"; |
||
| 282 | } |
||
| 283 | } |
||
| 284 | |||
| 285 | function xhelp_default() |
||
| 286 | { |
||
| 287 | $helper = Xhelp\Helper::getInstance(); |
||
| 288 | |||
| 289 | xoops_cp_header(); |
||
| 290 | //echo $oAdminButton->renderButtons('index'); |
||
| 291 | $adminObject = Admin::getInstance(); |
||
| 292 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 293 | |||
| 294 | $displayName = $helper->getConfig('xhelp_displayName'); // Determines if username or real name is displayed |
||
| 295 | |||
| 296 | $stylePath = XHELP_BASE_URL . '/assets/css/xhelp.css'; |
||
| 297 | echo '<link rel="stylesheet" type="text/css" media="all" href="' . $stylePath . '"><!--[if if lt IE 7]><script src="iepngfix.js" language="JavaScript" type="text/javascript"></script><![endif]-->'; |
||
| 298 | |||
| 299 | global $xoopsUser, $xoopsDB; |
||
| 300 | /** @var \XoopsModules\Xhelp\TicketHandler $ticketHandler */ |
||
| 301 | $ticketHandler = $helper->getHandler('Ticket'); |
||
| 302 | /** @var \XoopsModules\Xhelp\StatusHandler $statusHandler */ |
||
| 303 | $statusHandler = $helper->getHandler('Status'); |
||
| 304 | |||
| 305 | $criteria = new \Criteria('', ''); |
||
| 306 | $criteria->setSort('description'); |
||
| 307 | $criteria->setOrder('ASC'); |
||
| 308 | $statuses = $statusHandler->getObjects($criteria); |
||
| 309 | $table_class = ['odd', 'even']; |
||
| 310 | echo "<table border='0' width='100%'>"; |
||
| 311 | echo "<tr><td width='50%' valign='top'>"; |
||
| 312 | echo "<div id='ticketInfo'>"; |
||
| 313 | echo "<table border='0' width='95%' cellspacing='1' class='outer'> |
||
| 314 | <tr><th colspan='2'>" . _AM_XHELP_TEXT_TICKET_INFO . '</th></tr>'; |
||
| 315 | $class = 'odd'; |
||
| 316 | $totalTickets = 0; |
||
| 317 | foreach ($statuses as $status) { |
||
| 318 | $criteria = new \Criteria('status', $status->getVar('id')); |
||
| 319 | $numTickets = $ticketHandler->getCount($criteria); |
||
| 320 | $totalTickets += $numTickets; |
||
| 321 | |||
| 322 | echo "<tr class='" . $class . "'><td>" . $status->getVar('description') . '</td><td>' . $numTickets . '</td></tr>'; |
||
| 323 | if ('odd' === $class) { |
||
| 324 | $class = 'even'; |
||
| 325 | } else { |
||
| 326 | $class = 'odd'; |
||
| 327 | } |
||
| 328 | } |
||
| 329 | echo "<tr class='foot'><td>" . _AM_XHELP_TEXT_TOTAL_TICKETS . '</td><td>' . $totalTickets . '</td></tr>'; |
||
| 330 | echo '</table></div><br>'; |
||
| 331 | |||
| 332 | /** @var \XoopsModules\Xhelp\StaffHandler $staffHandler */ |
||
| 333 | $staffHandler = $helper->getHandler('Staff'); |
||
|
0 ignored issues
–
show
|
|||
| 334 | /** @var \XoopsModules\Xhelp\ResponseHandler $responseHandler */ |
||
| 335 | $responseHandler = $helper->getHandler('Response'); |
||
|
0 ignored issues
–
show
|
|||
| 336 | echo "</td><td valign='top'>"; // Outer table |
||
| 337 | echo "<div id='timeSpent'>"; // Start inner top-left cell |
||
| 338 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 339 | <tr><th colspan='2'>" . _AM_XHELP_TEXT_RESPONSE_TIME . '</th></tr>'; |
||
| 340 | |||
| 341 | $sql = sprintf('SELECT u.uid, u.uname, u.name, (s.responseTime / s.ticketsResponded) AS AvgResponseTime FROM `%s` u INNER JOIN %s s ON u.uid = s.uid WHERE ticketsResponded > 0 ORDER BY AvgResponseTime', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff')); |
||
| 342 | $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME); |
||
| 343 | $i = 0; |
||
| 344 | while ([$uid, $uname, $name, $avgResponseTime] = $xoopsDB->fetchRow($ret)) { |
||
| 345 | $class = $table_class[$i % 2]; |
||
| 346 | echo "<tr class='$class'><td>" . Xhelp\Utility::getDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . Xhelp\Utility::formatTime((int)$avgResponseTime) . '</td></tr>'; |
||
| 347 | ++$i; |
||
| 348 | } |
||
| 349 | echo '</table></div><br>'; // End inner top-left cell |
||
| 350 | echo "</td></tr><tr><td valign='top'>"; // End first, start second cell |
||
| 351 | |||
| 352 | //Get Calls Closed block |
||
| 353 | $sql = sprintf('SELECT SUM(callsClosed) FROM `%s`', $xoopsDB->prefix('xhelp_staff')); |
||
| 354 | $ret = $xoopsDB->query($sql); |
||
| 355 | if ([$totalStaffClosed] = $xoopsDB->fetchRow($ret)) { |
||
| 356 | if ($totalStaffClosed) { |
||
| 357 | $sql = sprintf('SELECT u.uid, u.uname, u.name, s.callsClosed FROM `%s` u INNER JOIN %s s ON u.uid = s.uid WHERE s.callsClosed > 0 ORDER BY s.callsClosed DESC', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff')); |
||
| 358 | $ret = $xoopsDB->query($sql, MAX_STAFF_CALLSCLOSED); |
||
| 359 | echo "<div id='callsClosed'>"; |
||
| 360 | echo "<table border='0' width='95%' cellspacing='1' class='outer'> |
||
| 361 | <tr><th colspan='2'>" . _AM_XHELP_TEXT_TOP_CLOSERS . '</th></tr>'; |
||
| 362 | $i = 0; |
||
| 363 | while ([$uid, $uname, $name, $callsClosed] = $xoopsDB->fetchRow($ret)) { |
||
| 364 | $class = $table_class[$i % 2]; |
||
| 365 | echo "<tr class='$class'><td>" . Xhelp\Utility::getDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . $callsClosed . ' (' . round(($callsClosed / $totalStaffClosed) * 100, 2) . '%)</td></tr>'; |
||
| 366 | ++$i; |
||
| 367 | } |
||
| 368 | echo '</table></div><br>'; // End inner table top row |
||
| 369 | echo "</td><td valign='top'>"; // End top row of outer table |
||
| 370 | |||
| 371 | $sql = sprintf('SELECT u.uid, u.uname, u.name, (s.responseTime / s.ticketsResponded) AS AvgResponseTime FROM `%s` u INNER JOIN %s s ON u.uid = s.uid WHERE ticketsResponded > 0 ORDER BY AvgResponseTime DESC', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff')); |
||
| 372 | $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME); |
||
| 373 | echo "<div id='leastCallsClosed'>"; |
||
| 374 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 375 | <tr><th colspan='2'>" . _AM_XHELP_TEXT_RESPONSE_TIME_SLOW . '</th></tr>'; |
||
| 376 | $i = 0; |
||
| 377 | while ([$uid, $uname, $name, $avgResponseTime] = $xoopsDB->fetchRow($ret)) { |
||
| 378 | $class = $table_class[$i % 2]; |
||
| 379 | echo "<tr class='$class'><td>" . Xhelp\Utility::getDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . Xhelp\Utility::formatTime($avgResponseTime) . '</td></tr>'; |
||
| 380 | ++$i; |
||
| 381 | } |
||
| 382 | echo '</table></div>'; // End first cell, second row of inner table |
||
| 383 | } |
||
| 384 | } |
||
| 385 | echo '</td></tr></table><br>'; // End second cell, second row of inner table |
||
| 386 | |||
| 387 | $criteria = new \Criteria('state', '2', '<>', 's'); |
||
| 388 | $criteria->setSort('priority'); |
||
| 389 | $criteria->setOrder('ASC'); |
||
| 390 | $criteria->setLimit(10); |
||
| 391 | $highPriority = $ticketHandler->getObjects($criteria); |
||
| 392 | $has_highPriority = (count($highPriority) > 0); |
||
| 393 | if ($has_highPriority) { |
||
| 394 | echo "<div id='highPriority'>"; |
||
| 395 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 396 | <tr><th colspan='8'>" . _AM_XHELP_TEXT_HIGH_PRIORITY . '</th></tr>'; |
||
| 397 | echo "<tr class='head'><td>" |
||
| 398 | . _AM_XHELP_TEXT_PRIORITY |
||
| 399 | . '</td><td>' |
||
| 400 | . _AM_XHELP_TEXT_ELAPSED |
||
| 401 | . '</td><td>' |
||
| 402 | . _AM_XHELP_TEXT_STATUS |
||
| 403 | . '</td><td>' |
||
| 404 | . _AM_XHELP_TEXT_SUBJECT |
||
| 405 | . '</td><td>' |
||
| 406 | . _AM_XHELP_TEXT_DEPARTMENT |
||
| 407 | . '</td><td>' |
||
| 408 | . _AM_XHELP_TEXT_OWNER |
||
| 409 | . '</td><td>' |
||
| 410 | . _AM_XHELP_TEXT_LAST_UPDATED |
||
| 411 | . '</td><td>' |
||
| 412 | . _AM_XHELP_TEXT_LOGGED_BY |
||
| 413 | . '</td></tr>'; |
||
| 414 | $i = 0; |
||
| 415 | foreach ($highPriority as $ticket) { |
||
| 416 | if ($ticket->isOverdue()) { |
||
| 417 | $class = $table_class[$i % 2] . ' overdue'; |
||
| 418 | } else { |
||
| 419 | $class = $table_class[$i % 2]; |
||
| 420 | } |
||
| 421 | $priority_url = "<img src='" . XHELP_IMAGE_URL . '/priority' . $ticket->getVar('priority') . ".png' alt='" . $ticket->getVar('priority') . "'>"; |
||
| 422 | $subject_url = sprintf("<a href='" . XHELP_BASE_URL . '/ticket.php?id=' . $ticket->getVar('id') . "' target='_BLANK'>%s</a>", $ticket->getVar('subject')); |
||
| 423 | $dept = $ticket->getDepartment(); |
||
| 424 | if ($dept) { |
||
| 425 | $dept_url = sprintf("<a href='" . XHELP_BASE_URL . '/index.php?op=staffViewAll&dept=' . $dept->getVar('id') . "' target='_BLANK'>%s</a>", $dept->getVar('department')); |
||
| 426 | } else { |
||
| 427 | $dept_url = _AM_XHELP_TEXT_NO_DEPT; |
||
| 428 | } |
||
| 429 | if (0 != $ticket->getVar('ownership')) { |
||
| 430 | $owner_url = sprintf("<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $ticket->getVar('uid') . "' target='_BLANK'>%s</a>", Xhelp\Utility::getUsername($ticket->getVar('ownership'), $displayName)); |
||
| 431 | } else { |
||
| 432 | $owner_url = _AM_XHELP_TEXT_NO_OWNER; |
||
| 433 | } |
||
| 434 | $user_url = sprintf("<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $ticket->getVar('uid') . "' target='_BLANK'>%s</a>", Xhelp\Utility::getUsername($ticket->getVar('uid'), $displayName)); |
||
| 435 | echo "<tr class='$class'><td>" . $priority_url . '</td> |
||
| 436 | <td>' . $ticket->elapsed() . '</td> |
||
| 437 | <td>' . Xhelp\Utility::getStatus($ticket->getVar('status')) . '</td> |
||
| 438 | <td>' . $subject_url . '</td> |
||
| 439 | <td>' . $dept_url . '</td> |
||
| 440 | <td>' . $owner_url . ' </td> |
||
| 441 | <td>' . $ticket->lastUpdated() . '</td> |
||
| 442 | <td>' . $user_url . '</td> |
||
| 443 | </tr>'; |
||
| 444 | ++$i; |
||
| 445 | } |
||
| 446 | echo '</table></div>'; |
||
| 447 | } |
||
| 448 | |||
| 449 | pathConfiguration(); |
||
| 450 | |||
| 451 | require_once __DIR__ . '/admin_footer.php'; |
||
| 452 | } |
||
| 453 | |||
| 454 | function pathConfiguration() |
||
| 455 | { |
||
| 456 | global $xoopsModule, $xoopsConfig; |
||
| 457 | |||
| 458 | // Upload and Images Folders |
||
| 459 | |||
| 460 | $paths = []; |
||
| 461 | $paths[_AM_XHELP_PATH_TICKETATTACH] = XHELP_UPLOAD_PATH; |
||
|
0 ignored issues
–
show
|
|||
| 462 | $paths[_AM_XHELP_PATH_EMAILTPL] = XHELP_BASE_PATH . "/language/{$xoopsConfig['language']}"; |
||
| 463 | |||
| 464 | echo '<h3>' . _AM_XHELP_PATH_CONFIG . '</h3>'; |
||
| 465 | echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; |
||
| 466 | echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_DESCRIPTION . '</b></td>'; |
||
| 467 | echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_PATH . '</b></td>'; |
||
| 468 | echo "<td class='bg3' align='center'><b>" . _AM_XHELP_TEXT_STATUS . '</b></td></tr>'; |
||
| 469 | |||
| 470 | foreach ($paths as $desc => $path) { |
||
| 471 | echo "<tr><td class='odd'>$desc</td>"; |
||
| 472 | echo "<td class='odd'>$path</td>"; |
||
| 473 | echo "<td class='even' class='center;'>" . xhelp_admin_getPathStatus($path) . '</td></tr>'; |
||
| 474 | } |
||
| 475 | |||
| 476 | echo '</table>'; |
||
| 477 | echo '<br>'; |
||
| 478 | |||
| 479 | echo '</div>'; |
||
| 480 | } |
||
| 481 | |||
| 482 | function about() |
||
| 483 | { |
||
| 484 | xoops_cp_header(); |
||
| 485 | //echo $oAdminButton->renderButtons(); |
||
| 486 | $adminObject = Admin::getInstance(); |
||
| 487 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 488 | |||
| 489 | require_once XHELP_ADMIN_PATH . '/about.php'; |
||
|
0 ignored issues
–
show
|
|||
| 490 | } |
||
| 491 | |||
| 492 | function createdir() |
||
| 493 | { |
||
| 494 | $path = $_GET['path']; |
||
| 495 | $res = xhelp_admin_mkdir($path); |
||
| 496 | $helper = Xhelp\Helper::getInstance(); |
||
| 497 | |||
| 498 | $msg = $res ? _AM_XHELP_PATH_CREATED : _AM_XHELP_PATH_NOTCREATED; |
||
| 499 | $helper->redirect('admin/index.php', 2, $msg . ': ' . $path); |
||
| 500 | } |
||
| 501 | |||
| 502 | function setperm() |
||
| 503 | { |
||
| 504 | $helper = Xhelp\Helper::getInstance(); |
||
| 505 | $path = $_GET['path']; |
||
| 506 | $res = xhelp_admin_chmod($path, 0777); |
||
| 507 | $msg = ($res ? _AM_XHELP_PATH_PERMSET : _AM_XHELP_PATH_NOTPERMSET); |
||
| 508 | $helper->redirect('admin/index.php', 2, $msg . ': ' . $path); |
||
| 509 | } |
||
| 510 |