@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * |
| 48 | - * @return StaticPlugin |
|
| 48 | + * @return BuyCoursesPlugin |
|
| 49 | 49 | */ |
| 50 | 50 | static function create() |
| 51 | 51 | {
|
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * Save a transfer account information |
| 270 | 270 | * @param array $params The transfer account |
| 271 | - * @return int Rows affected. Otherwise return false |
|
| 271 | + * @return false|string Rows affected. Otherwise return false |
|
| 272 | 272 | */ |
| 273 | 273 | public function saveTransferAccount($params) |
| 274 | 274 | {
|
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | /** |
| 681 | 681 | * Get session info |
| 682 | 682 | * @param array $sessionId The session ID |
| 683 | - * @return array |
|
| 683 | + * @return Session |
|
| 684 | 684 | */ |
| 685 | 685 | public function getSessionInfo($sessionId) |
| 686 | 686 | {
|
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | * Register a sale |
| 774 | 774 | * @param int $itemId The product ID |
| 775 | 775 | * @param int $paymentType The payment type |
| 776 | - * @return boolean |
|
| 776 | + * @return false|string |
|
| 777 | 777 | */ |
| 778 | 778 | public function registerSale($itemId, $paymentType) |
| 779 | 779 | {
|
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | |
| 956 | 956 | /** |
| 957 | 957 | * Get payment types |
| 958 | - * @return array |
|
| 958 | + * @return string[] |
|
| 959 | 959 | */ |
| 960 | 960 | public function getPaymentTypes() |
| 961 | 961 | {
|
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | /** |
| 996 | 996 | * Get the statuses for sales |
| 997 | - * @return array |
|
| 997 | + * @return string[] |
|
| 998 | 998 | */ |
| 999 | 999 | public function getSaleStatuses() |
| 1000 | 1000 | {
|
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | |
| 1008 | 1008 | /** |
| 1009 | 1009 | * Get the statuses for Payouts |
| 1010 | - * @return array |
|
| 1010 | + * @return string[] |
|
| 1011 | 1011 | */ |
| 1012 | 1012 | public function getPayoutStatuses() |
| 1013 | 1013 | {
|
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | |
| 1021 | 1021 | /** |
| 1022 | 1022 | * Get the list of product types |
| 1023 | - * @return array |
|
| 1023 | + * @return string[] |
|
| 1024 | 1024 | */ |
| 1025 | 1025 | public function getProductTypes() |
| 1026 | 1026 | {
|
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | /** |
| 1402 | 1402 | * Register a item |
| 1403 | 1403 | * @param array $itemData The item data |
| 1404 | - * @return int The item ID. Otherwise return false |
|
| 1404 | + * @return false|string The item ID. Otherwise return false |
|
| 1405 | 1405 | */ |
| 1406 | 1406 | public function registerItem(array $itemData) |
| 1407 | 1407 | {
|
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | /** |
| 1560 | 1560 | * Verify if the beneficiary have a paypal account |
| 1561 | 1561 | * @param int $userId |
| 1562 | - * @return true if the user have a paypal account, false if not |
|
| 1562 | + * @return boolean if the user have a paypal account, false if not |
|
| 1563 | 1563 | */ |
| 1564 | 1564 | public function verifyPaypalAccountByBeneficiary($userId) |
| 1565 | 1565 | {
|
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | /** |
| 1682 | 1682 | * Register addicional service |
| 1683 | 1683 | * @param array params $service |
| 1684 | - * @return mixed response |
|
| 1684 | + * @return string|false response |
|
| 1685 | 1685 | */ |
| 1686 | 1686 | public function storeService($service) |
| 1687 | 1687 | {
|
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | |
| 1839 | 1839 | /** |
| 1840 | 1840 | * Get the statuses for sales |
| 1841 | - * @return array |
|
| 1841 | + * @return string[] |
|
| 1842 | 1842 | */ |
| 1843 | 1843 | public function getServiceSaleStatuses() |
| 1844 | 1844 | {
|
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | * @param int $paymentType The payment type |
| 2095 | 2095 | * @param int $infoSelect The ID for Service Type |
| 2096 | 2096 | * @param int $trial trial mode |
| 2097 | - * @return boolean |
|
| 2097 | + * @return false|string |
|
| 2098 | 2098 | */ |
| 2099 | 2099 | public function registerServiceSale($serviceId, $paymentType, $infoSelect, $trial = null) |
| 2100 | 2100 | {
|
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | require_once '../config.php'; |
| 14 | 14 | |
| 15 | 15 | if (!isset($_REQUEST['t'], $_REQUEST['i'])) {
|
| 16 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 16 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $currentUserId = api_get_user_id(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $typeUser = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_USER; |
| 38 | 38 | $typeCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_COURSE; |
| 39 | 39 | $typeSession = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_SESSION; |
| 40 | -$queryString = 'i=' . intval($_REQUEST['i']) . '&t=' . intval($_REQUEST['t']).$additionalQueryString; |
|
| 40 | +$queryString = 'i='.intval($_REQUEST['i']).'&t='.intval($_REQUEST['t']).$additionalQueryString; |
|
| 41 | 41 | |
| 42 | 42 | $serviceInfo = $plugin->getServices(intval($_REQUEST['i'])); |
| 43 | 43 | $userInfo = api_get_user_info($currentUserId); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | Display::addFlash( |
| 52 | 52 | Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
|
| 53 | 53 | ); |
| 54 | - header('Location:' . api_get_self() . '?' . $queryString);
|
|
| 54 | + header('Location:'.api_get_self().'?'.$queryString);
|
|
| 55 | 55 | exit; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | Display::addFlash( |
| 60 | 60 | Display::return_message($plugin->get_lang('AdditionalInfoRequired'), 'error', false)
|
| 61 | 61 | ); |
| 62 | - header('Location:' . api_get_self() . '?' . $queryString);
|
|
| 62 | + header('Location:'.api_get_self().'?'.$queryString);
|
|
| 63 | 63 | exit; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($serviceSaleId !== false) {
|
| 69 | 69 | $_SESSION['bc_service_sale_id'] = $serviceSaleId; |
| 70 | 70 | |
| 71 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_process_confirm.php');
|
|
| 71 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_process_confirm.php');
|
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | exit; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if ($typeUser) {
|
| 87 | 87 | $users = $em->getRepository('ChamiloUserBundle:User')->findAll();
|
| 88 | - $selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']) . ' (' . get_lang('Myself') . ')';
|
|
| 88 | + $selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']).' ('.get_lang('Myself').')';
|
|
| 89 | 89 | if (!empty($users)) {
|
| 90 | 90 | foreach ($users as $user) {
|
| 91 | 91 | if (intval($userInfo['user_id']) !== intval($user->getId())) {
|
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false)
|
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 54 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 55 | 55 | exit; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | Display::return_message($erroMessage, 'error', false) |
| 67 | 67 | ); |
| 68 | 68 | unset($_SESSION['wizard']); |
| 69 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 69 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 70 | 70 | exit; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | unset($_SESSION['bc_service_sale_id']); |
| 152 | 152 | |
| 153 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 153 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 154 | 154 | |
| 155 | 155 | exit; |
| 156 | 156 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | // purchase-specific fields are ignored. This little condition handle this fact. |
| 40 | 40 | $itemPrice = $serviceSale['price']; |
| 41 | 41 | |
| 42 | - $returnUrl = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_success.php'; |
|
| 43 | - $cancelUrl = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_error.php'; |
|
| 42 | + $returnUrl = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_success.php'; |
|
| 43 | + $cancelUrl = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_error.php'; |
|
| 44 | 44 | |
| 45 | 45 | // The extra params for handle the hard job, this var is VERY IMPORTANT !! |
| 46 | 46 | $extra = ''; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $plugin->cancelServiceSale(intval($serviceSale['id'])); |
| 74 | 74 | |
| 75 | - header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 75 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 76 | 76 | exit; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | Display::addFlash( |
| 111 | 111 | Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false)
|
| 112 | 112 | ); |
| 113 | - header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 113 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 114 | 114 | exit; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | unset($_SESSION['bc_service_sale_id']); |
| 152 | - header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
|
|
| 152 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
|
|
| 153 | 153 | exit; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | function sort_files($table) |
| 72 | 72 | { |
| 73 | 73 | $tablename_direction = isset($_GET['tablename_direction']) ? Security::remove_XSS($_GET['tablename_direction']) : 'ASC'; |
| 74 | - $accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp','.svg'); |
|
| 74 | + $accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp', '.svg'); |
|
| 75 | 75 | $temp = array(); |
| 76 | 76 | |
| 77 | 77 | foreach ($table as & $file_array) { |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | $is_certificate_mode = false; |
| 62 | 62 | |
| 63 | 63 | if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') { |
| 64 | - $is_certificate_mode = true; |
|
| 64 | + $is_certificate_mode = true; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if ($is_certificate_mode) { |
| 68 | - $nameTools = get_lang('CreateCertificate'); |
|
| 68 | + $nameTools = get_lang('CreateCertificate'); |
|
| 69 | 69 | } else { |
| 70 | - $nameTools = get_lang('CreateDocument'); |
|
| 70 | + $nameTools = get_lang('CreateDocument'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* Constants and variables */ |
@@ -124,26 +124,26 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Please, do not modify this dirname formatting |
| 126 | 126 | if (strstr($dir, '..')) { |
| 127 | - $dir = '/'; |
|
| 127 | + $dir = '/'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ($dir[0] == '.') { |
| 131 | - $dir = substr($dir, 1); |
|
| 131 | + $dir = substr($dir, 1); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ($dir[0] != '/') { |
| 135 | - $dir = '/'.$dir; |
|
| 135 | + $dir = '/'.$dir; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if ($dir[strlen($dir) - 1] != '/') { |
| 139 | - $dir .= '/'; |
|
| 139 | + $dir .= '/'; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if ($is_certificate_mode) { |
| 143 | - $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates'); |
|
| 144 | - $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true); |
|
| 145 | - $folder_id = $document_data['id']; |
|
| 146 | - $dir = '/certificates/'; |
|
| 143 | + $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates'); |
|
| 144 | + $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true); |
|
| 145 | + $folder_id = $document_data['id']; |
|
| 146 | + $dir = '/certificates/'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $doc_tree = explode('/', $dir); |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | // Level correction for group documents. |
| 156 | 156 | if (!empty($group_properties['directory'])) { |
| 157 | - $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
| 157 | + $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | $relative_url = ''; |
| 161 | 161 | for ($i = 0; $i < ($count_dir); $i++) { |
| 162 | - $relative_url .= '../'; |
|
| 162 | + $relative_url .= '../'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if ($relative_url== '') { |
| 166 | - $relative_url = '/'; |
|
| 166 | + $relative_url = '/'; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | 'cols-size' => [2, 10, 0], |
| 176 | 176 | 'FullPage' => true, |
| 177 | 177 | 'InDocument' => true, |
| 178 | - 'CreateDocumentDir' => $relative_url, |
|
| 179 | - 'CreateDocumentWebDir' => (empty($group_properties['directory'])) |
|
| 180 | - ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/' |
|
| 181 | - : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/', |
|
| 182 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir |
|
| 178 | + 'CreateDocumentDir' => $relative_url, |
|
| 179 | + 'CreateDocumentWebDir' => (empty($group_properties['directory'])) |
|
| 180 | + ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/' |
|
| 181 | + : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/', |
|
| 182 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir |
|
| 183 | 183 | ); |
| 184 | 184 | |
| 185 | 185 | if ($is_certificate_mode) { |
@@ -191,41 +191,41 @@ discard block |
||
| 191 | 191 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 192 | 192 | |
| 193 | 193 | if (!is_dir($filepath)) { |
| 194 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 195 | - $dir = '/'; |
|
| 194 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 195 | + $dir = '/'; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | $to_group_id = 0; |
| 199 | 199 | if (!$is_certificate_mode) { |
| 200 | - if (api_is_in_group()) { |
|
| 200 | + if (api_is_in_group()) { |
|
| 201 | 201 | $interbreadcrumb[] = array( |
| 202 | 202 | "url" => "../group/group_space.php?".api_get_cidreq(), |
| 203 | 203 | "name" => get_lang('GroupSpace'), |
| 204 | 204 | ); |
| 205 | - $noPHP_SELF = true; |
|
| 206 | - $to_group_id = $group_properties['iid']; |
|
| 207 | - $path = explode('/', $dir); |
|
| 208 | - if ('/'.$path[1] != $group_properties['directory']) { |
|
| 209 | - api_not_allowed(true); |
|
| 210 | - } |
|
| 211 | - } |
|
| 205 | + $noPHP_SELF = true; |
|
| 206 | + $to_group_id = $group_properties['iid']; |
|
| 207 | + $path = explode('/', $dir); |
|
| 208 | + if ('/'.$path[1] != $group_properties['directory']) { |
|
| 209 | + api_not_allowed(true); |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | 212 | $interbreadcrumb[] = array( |
| 213 | 213 | "url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), |
| 214 | 214 | "name" => get_lang('Documents'), |
| 215 | 215 | ); |
| 216 | 216 | } else { |
| 217 | - $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
| 217 | + $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (!api_is_allowed_in_course()) { |
| 221 | - api_not_allowed(true); |
|
| 221 | + api_not_allowed(true); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (!($is_allowed_to_edit || |
| 225 | 225 | $groupRights || |
| 226 | 226 | DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id())) |
| 227 | 227 | ) { |
| 228 | - api_not_allowed(true); |
|
| 228 | + api_not_allowed(true); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* Header */ |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $display_dir = $dir; |
| 235 | 235 | if (isset($group_properties)) { |
| 236 | - $display_dir = explode('/', $dir); |
|
| 237 | - unset($display_dir[0]); |
|
| 238 | - unset($display_dir[1]); |
|
| 239 | - $display_dir = implode('/', $display_dir); |
|
| 236 | + $display_dir = explode('/', $dir); |
|
| 237 | + unset($display_dir[0]); |
|
| 238 | + unset($display_dir[1]); |
|
| 239 | + $display_dir = implode('/', $display_dir); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null; |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | $form->addElement('header', $nameTools); |
| 254 | 254 | |
| 255 | 255 | if ($is_certificate_mode) {//added condition for certicate in gradebook |
| 256 | - $form->addElement('hidden','certificate','true',array('id'=>'certificate')); |
|
| 257 | - if (isset($_GET['selectcat'])) { |
|
| 258 | - $form->addElement('hidden','selectcat', $select_cat); |
|
| 256 | + $form->addElement('hidden','certificate','true',array('id'=>'certificate')); |
|
| 257 | + if (isset($_GET['selectcat'])) { |
|
| 258 | + $form->addElement('hidden','selectcat', $select_cat); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | // new document created |
| 315 | 315 | |
| 316 | 316 | if (!$is_certificate_mode && |
| 317 | - !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id) |
|
| 317 | + !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id) |
|
| 318 | 318 | ) { |
| 319 | 319 | $folders = DocumentManager::get_all_document_folders( |
| 320 | 320 | $_course, |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | array('cols-size' => [2, 10, 0]) |
| 330 | 330 | ); |
| 331 | 331 | |
| 332 | - $folder_titles = array(); |
|
| 332 | + $folder_titles = array(); |
|
| 333 | 333 | if (is_array($folders)) { |
| 334 | 334 | $escaped_folders = array(); |
| 335 | 335 | foreach ($folders as $key => & $val) { |
@@ -366,22 +366,22 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if (empty($group_dir)) { |
|
| 370 | - $parent_select -> addOption(get_lang('HomeDirectory'), '/'); |
|
| 371 | - if (is_array($folders)) { |
|
| 372 | - foreach ($folders as & $folder) { |
|
| 373 | - //Hide some folders |
|
| 374 | - if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') { |
|
| 369 | + if (empty($group_dir)) { |
|
| 370 | + $parent_select -> addOption(get_lang('HomeDirectory'), '/'); |
|
| 371 | + if (is_array($folders)) { |
|
| 372 | + foreach ($folders as & $folder) { |
|
| 373 | + //Hide some folders |
|
| 374 | + if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') { |
|
| 375 | 375 | continue; |
| 376 | - } |
|
| 377 | - //Admin setting for Hide/Show the folders of all users |
|
| 378 | - if (api_get_setting('show_users_folders') == 'false' && |
|
| 376 | + } |
|
| 377 | + //Admin setting for Hide/Show the folders of all users |
|
| 378 | + if (api_get_setting('show_users_folders') == 'false' && |
|
| 379 | 379 | (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_')) |
| 380 | 380 | ){ |
| 381 | - continue; |
|
| 382 | - } |
|
| 383 | - //Admin setting for Hide/Show Default folders to all users |
|
| 384 | - if (api_get_setting('show_default_folders') == 'false' && |
|
| 381 | + continue; |
|
| 382 | + } |
|
| 383 | + //Admin setting for Hide/Show Default folders to all users |
|
| 384 | + if (api_get_setting('show_default_folders') == 'false' && |
|
| 385 | 385 | ( |
| 386 | 386 | $folder == '/images' || |
| 387 | 387 | $folder == '/flash' || |
@@ -391,82 +391,82 @@ discard block |
||
| 391 | 391 | $folder == '/video/flv' |
| 392 | 392 | ) |
| 393 | 393 | ){ |
| 394 | - continue; |
|
| 395 | - } |
|
| 396 | - //Admin setting for Hide/Show chat history folder |
|
| 397 | - if (api_get_setting('show_chat_folder') == 'false' && |
|
| 394 | + continue; |
|
| 395 | + } |
|
| 396 | + //Admin setting for Hide/Show chat history folder |
|
| 397 | + if (api_get_setting('show_chat_folder') == 'false' && |
|
| 398 | 398 | $folder=='/chat_files' |
| 399 | 399 | ){ |
| 400 | - continue; |
|
| 401 | - } |
|
| 400 | + continue; |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | - $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : ''; |
|
| 404 | - $path_parts = explode('/', $folder); |
|
| 405 | - $folder_titles[$folder] = cut($folder_titles[$folder], 80); |
|
| 403 | + $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : ''; |
|
| 404 | + $path_parts = explode('/', $folder); |
|
| 405 | + $folder_titles[$folder] = cut($folder_titles[$folder], 80); |
|
| 406 | 406 | $space_counter =count($path_parts) - 2; |
| 407 | 407 | if ($space_counter > 0) { |
| 408 | 408 | $label = str_repeat(' ', $space_counter).' — '.$folder_titles[$folder]; |
| 409 | 409 | } else { |
| 410 | 410 | $label = ' — '.$folder_titles[$folder]; |
| 411 | 411 | } |
| 412 | - $parent_select -> addOption($label, $folder); |
|
| 413 | - if ($selected != '') { |
|
| 414 | - $parent_select->setSelected($folder); |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - } else { |
|
| 419 | - if (is_array($folders) && !empty($folders)) { |
|
| 420 | - foreach ($folders as & $folder) { |
|
| 421 | - $selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : ''; |
|
| 422 | - $label = $folder_titles[$folder]; |
|
| 423 | - if ($folder == $group_dir) { |
|
| 424 | - $label = '/ (' . get_lang('HomeDirectory') . ')'; |
|
| 425 | - } else { |
|
| 426 | - $path_parts = explode('/', str_replace($group_dir, '', $folder)); |
|
| 427 | - $label = cut($label, 80); |
|
| 428 | - $label = str_repeat(' ', count($path_parts) - 2) . ' — ' . $label; |
|
| 429 | - } |
|
| 430 | - $parent_select->addOption($label, $folder); |
|
| 431 | - if ($selected != '') { |
|
| 432 | - $parent_select->setSelected($folder); |
|
| 433 | - } |
|
| 434 | - } |
|
| 435 | - } |
|
| 436 | - } |
|
| 412 | + $parent_select -> addOption($label, $folder); |
|
| 413 | + if ($selected != '') { |
|
| 414 | + $parent_select->setSelected($folder); |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + } else { |
|
| 419 | + if (is_array($folders) && !empty($folders)) { |
|
| 420 | + foreach ($folders as & $folder) { |
|
| 421 | + $selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : ''; |
|
| 422 | + $label = $folder_titles[$folder]; |
|
| 423 | + if ($folder == $group_dir) { |
|
| 424 | + $label = '/ (' . get_lang('HomeDirectory') . ')'; |
|
| 425 | + } else { |
|
| 426 | + $path_parts = explode('/', str_replace($group_dir, '', $folder)); |
|
| 427 | + $label = cut($label, 80); |
|
| 428 | + $label = str_repeat(' ', count($path_parts) - 2) . ' — ' . $label; |
|
| 429 | + } |
|
| 430 | + $parent_select->addOption($label, $folder); |
|
| 431 | + if ($selected != '') { |
|
| 432 | + $parent_select->setSelected($folder); |
|
| 433 | + } |
|
| 434 | + } |
|
| 435 | + } |
|
| 436 | + } |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $form->addHidden('dirValue', ''); |
| 440 | 440 | |
| 441 | 441 | if ($is_certificate_mode) { |
| 442 | - $form->addButtonCreate(get_lang('CreateCertificate')); |
|
| 442 | + $form->addButtonCreate(get_lang('CreateCertificate')); |
|
| 443 | 443 | } else { |
| 444 | - $form->addButtonCreate(get_lang('CreateDoc')); |
|
| 444 | + $form->addButtonCreate(get_lang('CreateDoc')); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $form->setDefaults($defaults); |
| 448 | 448 | |
| 449 | 449 | // If form validates -> save the new document |
| 450 | 450 | if ($form->validate()) { |
| 451 | - $values = $form->exportValues(); |
|
| 452 | - $readonly = isset($values['readonly']) ? 1 : 0; |
|
| 453 | - $values['title'] = trim($values['title']); |
|
| 451 | + $values = $form->exportValues(); |
|
| 452 | + $readonly = isset($values['readonly']) ? 1 : 0; |
|
| 453 | + $values['title'] = trim($values['title']); |
|
| 454 | 454 | |
| 455 | 455 | if (!empty($values['dirValue'])) { |
| 456 | 456 | $dir = $values['dirValue']; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | if ($dir[strlen($dir) - 1] != '/') { |
| 460 | - $dir .= '/'; |
|
| 461 | - } |
|
| 460 | + $dir .= '/'; |
|
| 461 | + } |
|
| 462 | 462 | $filepath = $filepath.$dir; |
| 463 | 463 | |
| 464 | 464 | // Setting the filename |
| 465 | - $filename = $values['title']; |
|
| 466 | - $filename = addslashes(trim($filename)); |
|
| 467 | - $filename = Security::remove_XSS($filename); |
|
| 468 | - $filename = api_replace_dangerous_char($filename); |
|
| 469 | - $filename = disable_dangerous_file($filename); |
|
| 465 | + $filename = $values['title']; |
|
| 466 | + $filename = addslashes(trim($filename)); |
|
| 467 | + $filename = Security::remove_XSS($filename); |
|
| 468 | + $filename = api_replace_dangerous_char($filename); |
|
| 469 | + $filename = disable_dangerous_file($filename); |
|
| 470 | 470 | $filename .= DocumentManager::getDocumentSuffix( |
| 471 | 471 | $_course, |
| 472 | 472 | api_get_session_id(), |
@@ -474,14 +474,14 @@ discard block |
||
| 474 | 474 | ); |
| 475 | 475 | |
| 476 | 476 | // Setting the title |
| 477 | - $title = $values['title']; |
|
| 477 | + $title = $values['title']; |
|
| 478 | 478 | |
| 479 | 479 | // Setting the extension |
| 480 | - $extension = 'html'; |
|
| 480 | + $extension = 'html'; |
|
| 481 | 481 | |
| 482 | - $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY); |
|
| 482 | + $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY); |
|
| 483 | 483 | |
| 484 | - /*if (strpos($content, '/css/frames.css') == false) { |
|
| 484 | + /*if (strpos($content, '/css/frames.css') == false) { |
|
| 485 | 485 | $content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content); |
| 486 | 486 | }*/ |
| 487 | 487 | |
@@ -494,21 +494,21 @@ discard block |
||
| 494 | 494 | exit; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) { |
|
| 497 | + if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) { |
|
| 498 | 498 | |
| 499 | - $content = str_replace( |
|
| 500 | - api_get_path(WEB_COURSE_PATH), |
|
| 499 | + $content = str_replace( |
|
| 500 | + api_get_path(WEB_COURSE_PATH), |
|
| 501 | 501 | api_get_configuration_value('url_append').api_get_path(REL_COURSE_PATH), |
| 502 | 502 | $content |
| 503 | 503 | ); |
| 504 | 504 | |
| 505 | - fputs($fp, $content); |
|
| 506 | - fclose($fp); |
|
| 507 | - chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files()); |
|
| 505 | + fputs($fp, $content); |
|
| 506 | + fclose($fp); |
|
| 507 | + chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files()); |
|
| 508 | 508 | |
| 509 | 509 | |
| 510 | - $file_size = filesize($filepath.$filename.'.'.$extension); |
|
| 511 | - $save_file_path = $dir.$filename.'.'.$extension; |
|
| 510 | + $file_size = filesize($filepath.$filename.'.'.$extension); |
|
| 511 | + $save_file_path = $dir.$filename.'.'.$extension; |
|
| 512 | 512 | |
| 513 | 513 | $document_id = add_document( |
| 514 | 514 | $_course, |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | $readonly |
| 521 | 521 | ); |
| 522 | 522 | |
| 523 | - if ($document_id) { |
|
| 524 | - api_item_property_update( |
|
| 523 | + if ($document_id) { |
|
| 524 | + api_item_property_update( |
|
| 525 | 525 | $_course, |
| 526 | 526 | TOOL_DOCUMENT, |
| 527 | 527 | $document_id, |
@@ -533,13 +533,13 @@ discard block |
||
| 533 | 533 | null, |
| 534 | 534 | $current_session_id |
| 535 | 535 | ); |
| 536 | - // Update parent folders |
|
| 537 | - item_property_update_on_folder($_course, $dir, $userId); |
|
| 538 | - $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
| 539 | - $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
| 536 | + // Update parent folders |
|
| 537 | + item_property_update_on_folder($_course, $dir, $userId); |
|
| 538 | + $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
| 539 | + $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
| 540 | 540 | $new_title = htmlspecialchars($new_title); |
| 541 | - if ($new_comment || $new_title) { |
|
| 542 | - $ct = ''; |
|
| 541 | + if ($new_comment || $new_title) { |
|
| 542 | + $ct = ''; |
|
| 543 | 543 | $params = []; |
| 544 | 544 | if ($new_comment) { |
| 545 | 545 | $params['comment'] = $new_comment; |
@@ -554,39 +554,39 @@ discard block |
||
| 554 | 554 | ['c_id = ? AND id = ?' => [$course_id, $document_id]] |
| 555 | 555 | ); |
| 556 | 556 | } |
| 557 | - } |
|
| 558 | - $dir= substr($dir,0,-1); |
|
| 559 | - $selectcat = ''; |
|
| 557 | + } |
|
| 558 | + $dir= substr($dir,0,-1); |
|
| 559 | + $selectcat = ''; |
|
| 560 | 560 | if (isset($_REQUEST['selectcat'])) { |
| 561 | 561 | $selectcat = "&selectcat=".intval($_REQUEST['selectcat']); |
| 562 | 562 | } |
| 563 | - $certificate_condition = ''; |
|
| 564 | - if ($is_certificate_mode) { |
|
| 565 | - $df = DocumentManager::get_default_certificate_id($_course['real_id']); |
|
| 563 | + $certificate_condition = ''; |
|
| 564 | + if ($is_certificate_mode) { |
|
| 565 | + $df = DocumentManager::get_default_certificate_id($_course['real_id']); |
|
| 566 | 566 | if (!isset($df)) { |
| 567 | 567 | DocumentManager::attach_gradebook_certificate($_course['real_id'], $document_id); |
| 568 | - } |
|
| 569 | - $certificate_condition = '&certificate=true&curdirpath=/certificates'; |
|
| 570 | - } |
|
| 568 | + } |
|
| 569 | + $certificate_condition = '&certificate=true&curdirpath=/certificates'; |
|
| 570 | + } |
|
| 571 | 571 | Display::addFlash(Display::return_message(get_lang('ItemAdded'))); |
| 572 | - header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition); |
|
| 573 | - exit(); |
|
| 574 | - } else { |
|
| 575 | - Display :: display_header($nameTools, 'Doc'); |
|
| 576 | - Display :: display_error_message(get_lang('Impossible')); |
|
| 577 | - Display :: display_footer(); |
|
| 578 | - } |
|
| 579 | - } else { |
|
| 580 | - Display :: display_header($nameTools, 'Doc'); |
|
| 581 | - Display :: display_error_message(get_lang('Impossible')); |
|
| 582 | - Display :: display_footer(); |
|
| 583 | - } |
|
| 572 | + header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition); |
|
| 573 | + exit(); |
|
| 574 | + } else { |
|
| 575 | + Display :: display_header($nameTools, 'Doc'); |
|
| 576 | + Display :: display_error_message(get_lang('Impossible')); |
|
| 577 | + Display :: display_footer(); |
|
| 578 | + } |
|
| 579 | + } else { |
|
| 580 | + Display :: display_header($nameTools, 'Doc'); |
|
| 581 | + Display :: display_error_message(get_lang('Impossible')); |
|
| 582 | + Display :: display_footer(); |
|
| 583 | + } |
|
| 584 | 584 | } else { |
| 585 | - // Copied from document.php |
|
| 586 | - $dir_array = explode('/', $dir); |
|
| 587 | - $array_len = count($dir_array); |
|
| 585 | + // Copied from document.php |
|
| 586 | + $dir_array = explode('/', $dir); |
|
| 587 | + $array_len = count($dir_array); |
|
| 588 | 588 | |
| 589 | - // Breadcrumb for the current directory root path |
|
| 589 | + // Breadcrumb for the current directory root path |
|
| 590 | 590 | if (!empty($document_data)) { |
| 591 | 591 | if (empty($document_data['parents'])) { |
| 592 | 592 | $interbreadcrumb[] = array( |
@@ -603,11 +603,11 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - Display :: display_header($nameTools, "Doc"); |
|
| 607 | - // actions |
|
| 606 | + Display :: display_header($nameTools, "Doc"); |
|
| 607 | + // actions |
|
| 608 | 608 | |
| 609 | - // link back to the documents overview |
|
| 610 | - if ($is_certificate_mode) { |
|
| 609 | + // link back to the documents overview |
|
| 610 | + if ($is_certificate_mode) { |
|
| 611 | 611 | $actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'. |
| 612 | 612 | Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
| 613 | 613 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'. |
@@ -622,19 +622,19 @@ discard block |
||
| 622 | 622 | |
| 623 | 623 | echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft)); |
| 624 | 624 | |
| 625 | - if ($is_certificate_mode) { |
|
| 625 | + if ($is_certificate_mode) { |
|
| 626 | 626 | $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
| 627 | 627 | api_get_user_id(), |
| 628 | 628 | api_get_course_id() |
| 629 | 629 | ); |
| 630 | 630 | |
| 631 | - $str_info = ''; |
|
| 632 | - foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
| 633 | - $str_info.=$info_value.'<br/>'; |
|
| 634 | - } |
|
| 635 | - $create_certificate = get_lang('CreateCertificateWithTags'); |
|
| 636 | - Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false); |
|
| 637 | - } |
|
| 631 | + $str_info = ''; |
|
| 632 | + foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
| 633 | + $str_info.=$info_value.'<br/>'; |
|
| 634 | + } |
|
| 635 | + $create_certificate = get_lang('CreateCertificateWithTags'); |
|
| 636 | + Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false); |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | 639 | // HTML-editor |
| 640 | 640 | echo '<div class="page-create"> |
@@ -650,5 +650,5 @@ discard block |
||
| 650 | 650 | '.$form->returnForm().' |
| 651 | 651 | </div> |
| 652 | 652 | </div></div>'; |
| 653 | - Display :: display_footer(); |
|
| 653 | + Display :: display_footer(); |
|
| 654 | 654 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $renderer->setHeaderTemplate('<legend>{header}</legend>'); |
| 100 | 100 | |
| 101 | 101 | //Set required field template |
| 102 | - $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); |
|
| 102 | + $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); |
|
| 103 | 103 | $noteTemplate = <<<EOT |
| 104 | 104 | <div class="form-group"> |
| 105 | 105 | <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $this->with_progress_bar = true; |
| 904 | 904 | $id = $this->getAttribute('id'); |
| 905 | 905 | |
| 906 | - $this->updateAttributes("onsubmit=\"javascript: addProgress('" . $id . "')\""); |
|
| 906 | + $this->updateAttributes("onsubmit=\"javascript: addProgress('".$id."')\""); |
|
| 907 | 907 | $this->addHtml(api_get_js('js/upload.js')); |
| 908 | 908 | } |
| 909 | 909 | |
@@ -1403,7 +1403,7 @@ discard block |
||
| 1403 | 1403 | .prop('href', file.url); |
| 1404 | 1404 | $(data.context.children()[index]).parent().wrap(link); |
| 1405 | 1405 | |
| 1406 | - var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); |
|
| 1406 | + var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded'))."')); |
|
| 1407 | 1407 | $(data.context.children()[index]).parent().append(successMessage); |
| 1408 | 1408 | } else if (file.error) { |
| 1409 | 1409 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error)); |
@@ -1412,7 +1412,7 @@ discard block |
||
| 1412 | 1412 | }); |
| 1413 | 1413 | }).on('fileuploadfail', function (e, data) { |
| 1414 | 1414 | $.each(data.files, function (index) { |
| 1415 | - var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
| 1415 | + var failedMessage = '" . addslashes(get_lang('UplUploadFailed'))."'; |
|
| 1416 | 1416 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage)); |
| 1417 | 1417 | $(data.context.children()[index]).parent().append(error); |
| 1418 | 1418 | }); |