$course->options['custom2'] = replaceCustomFieldsCertificate($course->options['custom2'], $issued_data['date']); $xmlExport->showCustomTwo($pdf, $course->options['custom2']); } if ($course->options['custom3'] != '') { $course->options['custom3'] = replaceCustomFieldsCertificate($course->options['custom3'], $issued_data['date']); $xmlExport->showCustomThree($pdf, $course->options['custom3']); } // $fileNamePdf = "certificate_preview.pdf"; // $pdf->Output($fileNamePdf, 'D'); $fileNamePdf = "certificate_preview.pdf"; } $output = $pdf->Output('', 'S'); $pathname = $currentUser->getDirectory() . str_replace(array('/', ':', '\\', '?', '&'), '_', $fileNamePdf); file_put_contents($pathname, $output); $file = new EfrontFile($pathname, $output); $file->sendFile(); } } } else { if ($_GET['op'] == 'format_certificate') { if ($currentCourse->options['certificate_export_method'] == 'rtf' && !isset($_GET['switch'])) { eF_redirect(basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=format_certificate_docx"); } if (G_VERSIONTYPE != 'community') { #cpp#ifndef COMMUNITY if ($currentCourse->options['certificate_tpl_id'] > 0) { $currentTemplate = eF_getTableData("certificate_templates", "certificate_type", "id=" . $currentCourse->options['certificate_tpl_id']); $currentTemplateType = $currentTemplate[0]['certificate_type']; $currentTemplate = $currentCourse->options['certificate_tpl_id'] . '-' . $currentTemplateType; $smarty->assign('T_CURRENT_TEMPLATE_TYPE', $currentTemplateType); } else {
public static function exportToCsv($data, $download = false, $name = "data.csv") { $currentUser = EfrontUserFactory::factory($_SESSION['s_login']); $fp = fopen($currentUser->getDirectory() . $name, 'w'); foreach ($data as $fields) { fputcsv($fp, $fields); } fclose($fp); $file = new EfrontFile($currentUser->getDirectory() . $name); if ($download) { $file->sendFile(true); } else { return $file; } }
private function doCategoryReports() { $smarty = $this->getSmartyVar(); $currentUser = $this->getCurrentUser(); $directionsTree = new EfrontDirectionsTree(); $directionPaths = $directionsTree->toPathString(); $form = new HTML_QuickForm("category_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&tab=category_reports&do=enterprise", "", null, true); $form->addElement('select', 'category', _CATEGORY, $directionPaths); $form->addElement('checkbox', 'incomplete', _MODULE_ADMINISTRATOR_TOOLS_SHOWINCOMPLETE); $form->addElement('checkbox', 'inactive', _MODULE_ADMINISTRATOR_TOOLS_SHOWINACTIVECOURSES); $form->addElement('date', 'from_timestamp', _MODULE_ADMINISTRATOR_TOOLS_COMPLETEDFROM, array('minYear' => 1970, 'maxYear' => date("Y"))); $form->addElement('date', 'to_timestamp', _MODULE_ADMINISTRATOR_TOOLS_COMPLETEDTO, array('minYear' => 1970, 'maxYear' => date("Y"))); $form->addElement("submit", "submit", _SUBMIT, 'class = "flatButton"'); $form->setDefaults(array("from_timestamp" => mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")), "to_timestamp" => time())); if ($form->isSubmitted() && $form->validate()) { $values = $form->exportValues(); $_SESSION['from_timestamp'] = mktime(0, 0, 0, $_POST['from_timestamp']['M'], $_POST['from_timestamp']['d'], $_POST['from_timestamp']['Y']); $_SESSION['to_timestamp'] = mktime(23, 59, 59, $_POST['to_timestamp']['M'], $_POST['to_timestamp']['d'], $_POST['to_timestamp']['Y']); $_SESSION['category'] = $values['category']; $_SESSION['incomplete'] = $values['incomplete']; $_SESSION['inactive'] = $values['inactive']; $smarty->assign("T_SHOW_TABLE", true); } if (isset($_GET['ajax']) && $_GET['ajax'] == 'categoryUsersTable' || $_GET['ajax'] == 'xls' || $_GET['ajax'] == 'show_xls') { $smarty->assign("T_SHOW_TABLE", true); $smarty->assign("T_DIRECTIONS_TREE", $directionPaths); $branchesTree = new EfrontBranchesTree(); $branchesPaths = $branchesTree->toPathString(); $category = new EfrontDirection($_SESSION['category']); $directionsTree = new EfrontDirectionsTree(); $children = $directionsTree->getNodeChildren($_SESSION['category']); foreach (new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($children)), array('id')) as $value) { $siblings[] = $value; } $result = eF_getTableDataFlat("courses", "id", "archive = 0 && directions_ID in (" . implode(",", $siblings) . ")"); $categoryCourses = $result['id']; $resultCourses = eF_getTableDataFlat("users_to_courses uc, courses c", "distinct c.id", 'c.id=uc.courses_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and uc.archive=0 and uc.completed=1 and uc.to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and uc.to_timestamp <= ' . $_SESSION['to_timestamp']); $resultEvents = eF_getTableDataFlat("events e, courses c", "distinct c.id", 'c.id=e.lessons_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and e.type=54 and e.timestamp >= ' . $_SESSION['from_timestamp'] . ' and e.timestamp <= ' . $_SESSION['to_timestamp']); if (empty($resultEvents)) { $resultEvents['id'] = array(); } $result = array_unique(array_merge($resultCourses['id'], $resultEvents['id'])); $categoryCourses = array_intersect(array_unique($categoryCourses), $result); //count only courses that have users completed them if ($_SESSION['incomplete']) { $constraints = array('archive' => false, 'condition' => '(to_timestamp is null OR to_timestamp = 0 OR (to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp'] . '))'); } else { $constraints = array('archive' => false, 'condition' => 'completed=1 and to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp']); } foreach ($categoryCourses as $courseId) { $course = new EfrontCourse($courseId); foreach ($course->getCourseUsers($constraints) as $value) { $userBranches = $value->aspects['hcd']->getBranches(); $userSupervisors = $value->aspects['hcd']->getSupervisors(); $userSupervisor = end($userSupervisors); $value->user['course_active'] = $course->course['active']; $value->user['course_id'] = $course->course['id']; $value->user['category'] = $directionPaths[$course->course['directions_ID']]; $value->user['course'] = $course->course['name']; $value->user['directions_ID'] = $course->course['directions_ID']; $value->user['branch'] = $branchesPaths[current($userBranches['employee'])]; $value->user['branch_ID'] = current($userBranches['employee']); $value->user['supervisor'] = $userSupervisor; $value->user['historic'] = false; $unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']); $courseUsers[$unique] = $value->user; } $result = eF_getTableData("events", "*", 'type=54 and lessons_ID=' . $courseId . ' and timestamp >= ' . $_SESSION['from_timestamp'] . ' and timestamp <= ' . $_SESSION['to_timestamp']); //exit; foreach ($result as $entry) { try { $value = EfrontUserFactory::factory($entry['users_LOGIN']); if (!$value->user['archive']) { $userBranches = $value->aspects['hcd']->getBranches(); $userSupervisors = $value->aspects['hcd']->getSupervisors(); //pr($entry['users_LOGIN']);pr($userSupervisors);pr(current($userSupervisors)); $userSupervisor = current($userSupervisors); $value->user['course_active'] = $course->course['active']; $value->user['course_id'] = $course->course['id']; $value->user['category'] = $directionPaths[$course->course['directions_ID']]; $value->user['course'] = $course->course['name']; $value->user['directions_ID'] = $course->course['directions_ID']; $value->user['branch'] = $branchesPaths[current($userBranches['employee'])]; $value->user['branch_ID'] = current($userBranches['employee']); $value->user['supervisor'] = $userSupervisor; $value->user['to_timestamp'] = $entry['timestamp']; $value->user['completed'] = 1; $value->user['score'] = ''; $value->user['historic'] = true; $unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']); if (!isset($courseUsers[$unique])) { $courseUsers[$unique] = $value->user; } } } catch (Exception $e) { /*Bypass non-existing users*/ } } } if ($_GET['ajax'] == 'xls') { $xlsFilePath = $currentUser->getDirectory() . 'category_report.xls'; unlink($xlsFilePath); $_GET['limit'] = sizeof($courseUsers); $_GET['sort'] = 'category'; list($tableSize, $courseUsers) = filterSortPage($courseUsers); $header = array('category' => _CATEGORY, 'course' => _NAME, 'login' => _USER, 'to_timestamp' => _COMPLETED, 'score' => _SCORE, 'supervisor' => _SUPERVISOR, 'branch' => _BRANCH, 'historic' => _MODULE_ADMINISTRATOR_TOOLS_HISTORICENTRY); foreach ($courseUsers as $value) { $rows[] = array(_CATEGORY => str_replace(" → ", " -> ", $value['category']), _COURSE => $value['course'], _USER => formatLogin($value['login']), _COMPLETED => formatTimestamp($value['to_timestamp']), _SCORE => $value['historic'] ? '' : formatScore($value['score']) . '%', _SUPERVISOR => formatLogin($value['supervisor']), _BRANCH => str_replace(" → ", " -> ", $value['branch']), _MODULE_ADMINISTRATOR_TOOLS_HISTORICENTRY => $value['historic'] ? _YES : _NO); } EfrontSystem::exportToXls($rows, $xlsFilePath); exit; } else { if ($_GET['ajax'] == 'show_xls') { $xlsFilePath = $currentUser->getDirectory() . 'category_report.xls'; $file = new EfrontFile($xlsFilePath); $file->sendFile(true); exit; } else { list($tableSize, $courseUsers) = filterSortPage($courseUsers); $smarty->assign("T_SORTED_TABLE", $_GET['ajax']); $smarty->assign("T_TABLE_SIZE", $tableSize); $smarty->assign("T_DATA_SOURCE", $courseUsers); } } } $smarty->assign("T_CATEGORY_FORM", $form->toArray()); }
/** * The main functionality * * (non-PHPdoc) * @see libraries/EfrontModule#getModule() */ public function getModule() { $smarty = $this->getSmartyVar(); $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir); $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink); $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl); $smarty->assign("T_TABLE_OPTIONS", array(array('image' => $this->moduleBaseLink . 'img/order.png', 'text' => _MODULE_SECURITY_RECHECKLOCALFILES, 'href' => $this->moduleBaseUrl . '&delete_local_list=1'), array('image' => $this->moduleBaseLink . 'img/refresh.png', 'text' => _MODULE_SECURITY_RECHECKSERVERFILES, 'href' => $this->moduleBaseUrl . '&delete_remote_list=1'), array('image' => $this->moduleBaseLink . 'img/rules.png', 'text' => _MODULE_SECURITY_RESETIGNORELIST, 'href' => $this->moduleBaseUrl . '&delete_ignore_list=1'))); if (isset($_GET['download_ignore_list'])) { try { $file = new EfrontFile($this->getIgnoreListName()); $file->sendFile(true); } catch (Exception $e) { $this->setMessageVar('The list is empty', 'failure'); } } else { if ($_GET['delete_remote_list']) { $file = new EfrontFile($this->getCachedRemoteListName()); $file->delete(); } else { if ($_GET['delete_local_list']) { $file = new EfrontFile($this->getLocalListName()); $file->delete(); } else { if ($_GET['delete_ignore_list']) { try { $file = new EfrontFile($this->getIgnoreListName()); $file->delete(); } catch (Exception $e) { } } } } } if (isset($_GET['download'])) { $_GET['download'] = base64_decode($_GET['download']); } $form = new HTML_QuickForm("demo_form", "post", $this->moduleBaseUrl . "&type=" . $_GET['type'], "", null, true); switch ($_GET['type']) { case 'install': $form->addElement('submit', 'submit_delete_install', _MODULE_SECURITY_DELETEINSTALLDIRECTORY, 'class = "flatButton"'); break; case 'magic_quotes_gpc': break; case 'default_accounts': $form->addElement('submit', 'submit_deactivate', _MODULE_SECURITY_DEACTIVATEDEFAULTACCOUNTS, 'class = "flatButton" title = "Click this to deactivate these accounts"'); break; case 'changed_files': list($changed_files, $new_files) = $this->checksumCheck(); $smarty->assign("T_CHANGED_FILES", $changed_files); if (isset($_GET['download']) && in_array($_GET['download'], array_keys($changed_files)) && $_GET['download'] != 'libraries/configuration.php') { try { $file = new EfrontFile(G_ROOTPATH . $_GET['download']); $file->sendFile(true); exit; } catch (Exception $e) { $this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure'); } } else { if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($changed_files))) { $this->addToIgnoreList($_GET['ignore']); echo json_encode(array('success' => true)); exit; } } $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" '); $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" '); $form->addElement('submit', 'ignore_changed_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" '); break; case 'new_files': list($changed_files, $new_files) = $this->checksumCheck(); if (isset($_GET['download']) && in_array($_GET['download'], array_keys($new_files)) && $_GET['download'] != 'libraries/configuration.php') { try { $file = new EfrontFile(G_ROOTPATH . $_GET['download']); $file->sendFile(true); exit; } catch (Exception $e) { $this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure'); } } else { if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($new_files))) { $this->addToIgnoreList($_GET['ignore']); } else { if (isset($_GET['delete']) && in_array($_GET['delete'], array_keys($new_files))) { try { $file = new EfrontFile(G_ROOTPATH . $_GET['delete']); $file->delete(); } catch (Exception $e) { } $file = new EfrontFile($this->getLocalListName()); $file->delete(); list($changed_files, $new_files) = $this->checksumCheck(); } } } $smarty->assign("T_NEW_FILES", $new_files); $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" '); $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" '); $form->addElement('submit', 'ignore_new_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" '); break; default: $smarty->assign("T_SECURITY_FEEDS", $this->getRssFeeds()); try { $smarty->assign("T_LOCAL_ISSUES", $this->checkLocalIssues()); } catch (Exception $e) { $this->setMessageVar($e->getMessage(), 'failure'); } break; } if ($form->isSubmitted() && $form->validate()) { try { $values = $form->exportValues(); if ($values['submit_recheck']) { $file = new EfrontFile($this->getLocalListName()); $file->delete(); eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } else { if ($values['submit_delete_install']) { file_get_contents(G_SERVERNAME . 'index.php?delete_install=1'); eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } else { if ($values['submit_deactivate']) { $result = eF_updateTableData("users", array('active' => 0), "(login = '******' and password = '******') or (login = '******' and password = '******')"); eF_redirect($this->moduleBaseUrl . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } else { if ($values['reset_ignore_list']) { try { $file = new EfrontFile($this->getIgnoreListName()); $file->delete(); eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } catch (Exception $e) { $this->setMessageVar(_MODULE_SECURITY_THELISTISEMTPY, 'failure'); } } else { if ($values['ignore_new_all']) { list($changed_files, $new_files) = $this->checksumCheck(); foreach ($new_files as $key => $value) { $this->addToIgnoreList($key); } eF_redirect($this->moduleBaseUrl . '&type=new_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } else { if ($values['ignore_changed_all']) { list($changed_files, $new_files) = $this->checksumCheck(); foreach ($changed_files as $key => $value) { $this->addToIgnoreList($key); } eF_redirect($this->moduleBaseUrl . '&type=changed_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success'); } } } } } } } catch (Exception $e) { $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString()); $message = $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>'; $this->setMessageVar($message, 'failure'); } } $renderer = prepareFormRenderer($form); $smarty->assign('T_SECURITY_FORM', $renderer->toArray()); //$feeds = $this->getRssFeeds(true, false); //$smarty->assign("T_SECURITY_FEEDS", $feeds); return true; }
} } } } } if (strpos($file['path'], G_ROOTPATH . 'libraries') !== false && strpos($file['path'], G_ROOTPATH . 'libraries/language') === false && $file['mime_type'] != "application/inc") { throw new EfrontFileException(_ILLEGALPATH . ': ' . $file['path'], EfrontFileException::ILLEGAL_PATH); } if (pathinfo($file['path'], PATHINFO_EXTENSION) == 'php') { throw new EfrontFileException(_ILLEGALPATH . ': ' . $file['path'], EfrontFileException::ILLEGAL_PATH); } if (strpos($file['path'], G_ROOTPATH . 'backups') !== false && $_SESSION['s_type'] != 'administrator') { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } if (isset($_GET['action']) && $_GET['action'] == 'download') { $file->sendFile(true); } else { cacheHeaders(lastModificationTime(filemtime($file['path']))); $file->sendFile(false); } } catch (EfrontFileException $e) { if ($e->getCode() == EfrontFileException::FILE_NOT_EXIST) { header("HTTP/1.0 404"); } echo EfrontSystem::printErrorMessage($e->getMessage()); } function cacheHeaders($lastModifiedDate) { if ($lastModifiedDate) { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lastModifiedDate) { if (php_sapi_name() == 'CGI') {
/** * Handle AJAX actions * * This function is used to perform the necessary ajax actions, * that may be fired by the file manager * <br/>Example: * <code> * $basedir = $currentLesson -> getDirectory(); * $filesystem = new FileSystemTree($basedir); * $filesystem -> handleAjaxActions(); * </code> * * @param EfrontUser $currentUser The current user * @since 3.5.0 * @access public */ public function handleAjaxActions($currentUser) { if (isset($_GET['delete_file']) && (eF_checkParameter($_GET['delete_file'], 'id') || strpos(urldecode($_GET['delete_file']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['delete_file'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->delete(); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } else { if (isset($_GET['share']) && (eF_checkParameter($_GET['share'], 'id') || strpos(urldecode($_GET['share']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['share'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->share(); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } else { if (isset($_GET['unshare']) && (eF_checkParameter($_GET['unshare'], 'id') || strpos(urldecode($_GET['unshare']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['unshare'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->unshare(); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } else { if (isset($_GET['uncompress']) && (eF_checkParameter($_GET['uncompress'], 'id') || strpos(urldecode($_GET['uncompress']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['uncompress'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->uncompress(); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } elseif (isset($_GET['delete_folder']) && (eF_checkParameter($_GET['delete_folder'], 'id') || strpos(urldecode($_GET['delete_folder']), $this->dir['path']) !== false)) { try { $directory = new EfrontDirectory(urldecode($_GET['delete_folder'])); if (strpos($directory['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $directory->delete(); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } elseif (isset($_GET['download']) && (eF_checkParameter($_GET['download'], 'id') || strpos(urldecode($_GET['download']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['download'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->sendFile(true); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } elseif (isset($_GET['view']) && (eF_checkParameter($_GET['view'], 'id') || strpos(urldecode($_GET['view']), $this->dir['path']) !== false)) { try { $file = new EfrontFile(urldecode($_GET['view'])); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $file->sendFile(false); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } elseif (isset($_GET['update']) && (eF_checkParameter($_GET['update'], 'id') || strpos(urldecode($_GET['update']), $this->dir['path']) !== false)) { try { $_GET['type'] == 'file' ? $file = new EfrontFile(urldecode($_GET['update'])) : ($file = new EfrontDirectory(urldecode($_GET['update']))); if (strpos($file['path'], $this->dir['path']) === false) { throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION); } $previousName = $file['name']; if ($file['name'] != $_GET['name']) { $file->rename(dirname($file['path']) . '/' . EfrontFile::encode(urldecode($_GET['name']))); } echo json_encode(array('previousName' => $previousName, 'name' => $file['name'])); } catch (Exception $e) { handleAjaxExceptions($e); } exit; } } } } }