function pathConfiguration() { global $xoopsModule, $xoopsConfig; // Upload and Images Folders $paths = array(); $paths[_AM_XHELP_PATH_TICKETATTACH] = XHELP_UPLOAD_PATH; $paths[_AM_XHELP_PATH_EMAILTPL] = XHELP_BASE_PATH . "/language/{$xoopsConfig['language']}"; echo "<h3>" . _AM_XHELP_PATH_CONFIG . "</h3>"; echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_DESCRIPTION . "</b></td>"; echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_PATH . "</b></td>"; echo "<td class='bg3' align='center'><b>" . _AM_XHELP_TEXT_STATUS . "</b></td></tr>"; foreach ($paths as $desc => $path) { echo "<tr><td class='odd'>{$desc}</td>"; echo "<td class='odd'>{$path}</td>"; echo "<td class='even' style='text-align: center;'>" . xhelp_admin_getPathStatus($path) . "</td></tr>"; } echo "</table>"; echo "<br />"; echo "</div>"; }
function manageFiles() { global $oAdminButton, $aSortBy, $aOrderBy, $aLimitBy, $order, $limit, $start, $sort; $xhelpUploadDir = XHELP_UPLOAD_PATH; $dir_status =& xhelp_admin_getPathStatus($xhelpUploadDir, true); if ($dir_status == -1) { $can_upload = xhelp_admin_mkdir($xhelpUploadDir); } $hFile =& xhelpGetHandler('file'); if (isset($_POST['deleteFiles'])) { // Delete all selected files $aFiles = $_POST['files']; $crit = new Criteria('id', "(" . implode($aFiles, ',') . ")", "IN"); if ($hFile->deleteAll($crit)) { header("Location: " . XHELP_ADMIN_URL . "/file.php?op=manageFiles"); } redirect_header(XHELP_ADMIN_URL . "/file.php?op=manageFiles", 3, _XHELP_MESSAGE_DELETE_FILE_ERR); } xoops_cp_header(); echo $oAdminButton->renderButtons('manFiles'); echo '<script type="text/javascript" src="' . XOOPS_URL . '/modules/xhelp/include/functions.js"></script>'; echo "<form method='post' action='" . XHELP_ADMIN_URL . "/file.php?op=manageFiles'>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='2'><label>" . _AM_XHELP_TEXT_TOTAL_USED_SPACE . "</label></th></tr>"; echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_ALL_ATTACH . "</td>\r\n <td class='even'>" . xhelpDirsize($xhelpUploadDir) . "\r\n </td>\r\n </tr>"; $resolvedSize = xhelpDirsize($xhelpUploadDir, true); echo "<tr><td class='head'>" . _AM_XHELP_TEXT_RESOLVED_ATTACH . "</td>\r\n <td class='even'>"; if ($resolvedSize > 0) { echo $resolvedSize . " <b>(" . _AM_XHELP_TEXT_DELETE_RESOLVED . "\r\n <a href='" . XHELP_ADMIN_URL . "/file.php?op=deleteResolved'><img src='" . XHELP_IMAGE_URL . "/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE . "' name='deleteFile' /></a>)</b>"; } else { echo $resolvedSize; } echo "</td>\r\n </tr>"; echo "</table></form>"; $crit = new Criteria('', ''); $crit->setOrder($order); $crit->setSort($sort); $crit->setLimit($limit); $crit->setStart($start); $files =& $hFile->getObjects($crit); $total = $hFile->getCount($crit); $nav = new XoopsPageNav($total, $limit, $start, 'start', "op=manageFiles&limit={$limit}"); echo "<form action='" . XHELP_ADMIN_URL . "/file.php?op=manageFiles' style='margin:0; padding:0;' method='post'>"; echo "<table width='100%' cellspacing='1' class='outer'>"; echo "<tr><td align='right'>" . _AM_XHELP_TEXT_SORT_BY . "\r\n <select name='sort'>"; foreach ($aSortBy as $value => $text) { $sort == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_ORDER_BY . "\r\n <select name='order'>"; foreach ($aOrderBy as $value => $text) { $order == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_NUMBER_PER_PAGE . "\r\n <select name='limit'>"; foreach ($aLimitBy as $value => $text) { $limit == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n <input type='submit' name='file_sort' id='file_sort' value='" . _AM_XHELP_BUTTON_SUBMIT . "' />\r\n </td>\r\n </tr>"; echo "</table></form>"; echo "<form method='post' action='" . XHELP_ADMIN_URL . "/file.php?op=manageFiles'>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='6'><label>" . _AM_XHELP_TEXT_MANAGE_FILES . "</label></th></tr>"; if ($total != 0) { echo "<tr class='head'>\r\n <td>" . _AM_XHELP_TEXT_ID . "</td>\r\n <td>" . _AM_XHELP_TEXT_TICKETID . "</td>\r\n <td>" . _AM_XHELP_TEXT_FILENAME . "</td>\r\n <td>" . _AM_XHELP_TEXT_SIZE . "</td>\r\n <td>" . _AM_XHELP_TEXT_MIMETYPE . "</td>\r\n <td>" . _AM_XHELP_TEXT_ACTIONS . "</td>\r\n </tr>"; foreach ($files as $file) { $filepath = XHELP_BASE_URL . '/viewFile.php?id=' . $file->getVar('id'); $ticketpath = XHELP_BASE_URL . '/ticket.php?id=' . $file->getVar('ticketid'); $filesize = filesize($xhelpUploadDir . '/' . $file->getVar('filename')); echo "<tr class='even'>\r\n <td><input type='checkbox' name='files[]' value='" . $file->getVar('id') . "' /> " . $file->getVar('id') . "</td>\r\n <td><a href='" . $ticketpath . "' target='_BLANK'>" . $file->getVar('ticketid') . "</a></td>\r\n <td><a href='" . $filepath . "'>" . $file->getVar('filename') . "</a></td>\r\n <td>" . xhelpPrettyBytes($filesize) . "</td>\r\n <td>" . $file->getVar('mimetype') . "</td>\r\n <td>\r\n <a href='" . XHELP_ADMIN_URL . "/file.php?op=deleteFile&fileid=" . $file->getVar('id') . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE . "' name='deleteFile' /></a>\r\n </td>\r\n </tr>"; } echo "<tr class='foot'><td colspan='6'>\r\n <input type='checkbox' name='checkAllFiles' value='0' onclick='selectAll(this.form,\"files[]\",this.checked);' />\r\n <input type='submit' name='deleteFiles' id='deleteFiles' value='" . _AM_XHELP_BUTTON_DELETE . "' /></td></tr>"; echo "</table></form>"; echo "<div id='status_nav'>" . $nav->renderNav() . "</div>"; } else { echo "<tr class='even'<td colspan='6'>" . _AM_XHELP_TEXT_NO_FILES . "</td></tr>"; echo "</table></form>"; } xhelpAdminFooter(); xoops_cp_footer(); }