@ -680,7 +680,7 @@ function api_get_path($path = '', $configuration = [])
$emptyConfigurationParam = false;
if (empty($configuration)) {
$configuration = (array)$_configuration;
$configuration = (array) $_configuration;
$emptyConfigurationParam = true;
}
@ -712,10 +712,10 @@ function api_get_path($path = '', $configuration = [])
& & (($server_protocol == 'http'
& & $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' & & $_SERVER['SERVER_PORT'] != 443))
) {
$server_name .= ":" . $_SERVER['SERVER_PORT'];
$server_name .= ":".$_SERVER['SERVER_PORT'];
}
$root_web = $server_protocol . '://' . $server_name . $root_rel;
$root_sys = str_replace('\\', '/', realpath(__DIR__ . '/../../../')) . '/';
$root_web = $server_protocol.'://'.$server_name.$root_rel;
$root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/';
}
// Here we give up, so we don't touch anything.
}
@ -1365,10 +1365,10 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
if (isset($user['email'])) {
$result['mail'] = isset($user['email']) ? $user['email'] : null;
$result['email'] = isset($user['email'])? $user['email'] : null;
$result['email'] = isset($user['email']) ? $user['email'] : null;
} else {
$result['mail'] = isset($user['mail']) ? $user['mail'] : null;
$result['email'] = isset($user['mail'])? $user['mail'] : null;
$result['email'] = isset($user['mail']) ? $user['mail'] : null;
}
$user_id = intval($user['user_id']);
// Maintain the user_id index for backwards compatibility
@ -1465,7 +1465,7 @@ function api_get_user_info(
if (isset($userFromSession)) {
if ($cacheAvailable === true) {
$apcVar = api_get_configuration_value('apc_prefix') . 'userinfo_' . $userFromSession['user_id'];
$apcVar = api_get_configuration_value('apc_prefix').'userinfo_'.$userFromSession['user_id'];
if (apcu_exists($apcVar)) {
$user = apcu_fetch($apcVar);
} else {
@ -1487,7 +1487,7 @@ function api_get_user_info(
// Re-use user information if not stale and already stored in APCu
if ($cacheAvailable === true) {
$apcVar = api_get_configuration_value('apc_prefix') . 'userinfo_' . $user_id;
$apcVar = api_get_configuration_value('apc_prefix').'userinfo_'.$user_id;
if (apcu_exists($apcVar)) {
$user = apcu_fetch($apcVar);
@ -1495,7 +1495,7 @@ function api_get_user_info(
}
}
$sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . "
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_USER)."
WHERE id = $user_id";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
@ -1956,7 +1956,7 @@ function api_generate_password($length = 8)
$charactersUpperCase = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
$minNumbers = 2;
$length = $length - $minNumbers;
$minLowerCase = round($length/2);
$minLowerCase = round($length / 2);
$minUpperCase = $length - $minLowerCase;
$password = '';
@ -1979,7 +1979,7 @@ function api_generate_password($length = 8)
}
// Min digits default 2
for ($i = 0; $i < $minNumbers; $i ++) {
for ($i = 0; $i < $minNumbers; $i++) {
$password .= $generator->generateInt(2, 9);
}
@ -2174,7 +2174,7 @@ function api_get_session_name($session_id = 0)
}
}
$t = Database::get_main_table(TABLE_MAIN_SESSION);
$s = "SELECT name FROM $t WHERE id = ".(int)$session_id;
$s = "SELECT name FROM $t WHERE id = ".(int) $session_id;
$r = Database::query($s);
$c = Database::num_rows($r);
if ($c > 0) {
@ -2347,9 +2347,9 @@ function api_get_session_visibility(
*/
function api_get_session_image($session_id, $status_id)
{
$session_id = (int)$session_id;
$session_id = (int) $session_id;
$session_img = '';
if ((int)$status_id != 5) { //check whether is not a student
if ((int) $status_id != 5) { //check whether is not a student
if ($session_id > 0) {
$session_img = " ".Display::return_icon(
'star.png',
@ -2886,7 +2886,7 @@ function api_display_tool_view_option()
return '';
}
$sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
$sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'& action=view& lp_id='.intval($_GET['lp_id']).'& isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl);
$sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'& action=view& lp_id='.intval($_GET['lp_id']).'& isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl);
//showinframes doesn't handle student view anyway...
//return '';
$is_framed = true;
@ -3364,7 +3364,7 @@ function api_not_allowed($print_headers = false, $message = null)
}
$content .= '< div class = "well" > ';
$content .= $form->returnForm();
$content .='< / div > ';
$content .= '< / div > ';
if (api_is_cas_activated()) {
$content .= "< / div > ";
}
@ -3416,7 +3416,7 @@ function api_not_allowed($print_headers = false, $message = null)
}
$msg .= '< div class = "well" > ';
$msg .= $form->returnForm();
$msg .='< / div > ';
$msg .= '< / div > ';
if ($casEnabled) {
$msg .= "< / div > ";
}
@ -3447,7 +3447,7 @@ function convert_sql_date($last_post_datetime)
list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime);
list ($year, $month, $day) = explode('-', $last_post_date);
list ($hour, $min, $sec) = explode(':', $last_post_time);
return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year);
return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year);
}
/**
@ -4065,7 +4065,7 @@ function api_get_track_item_property_history($tool, $ref)
if ($result === false or $result === null) {
$result = array();
} else {
$result = Database::store_result($result,'ASSOC');
$result = Database::store_result($result, 'ASSOC');
}
return $result;
@ -4117,7 +4117,7 @@ function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0, $g
$rs = Database::query($sql);
$row = array();
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs,'ASSOC');
$row = Database::fetch_array($rs, 'ASSOC');
}
return $row;
@ -4152,7 +4152,7 @@ function api_get_languages_combo($name = 'language')
$languages = $language_list['name'];
$folder = $language_list['folder'];
$ret .= '< select name = "' . $name . '" id = "language_chosen" class = "selectpicker show-tick form-control" > ';
$ret .= '< select name = "'.$name.'" id = "language_chosen" class = "selectpicker show-tick form-control" > ';
foreach ($languages as $key => $value) {
if ($folder[$key] == $default) {
$selected = ' selected="selected"';
@ -4203,7 +4203,7 @@ function api_display_language_form($hide_if_no_choice = false)
}
< / script > ';
$html .= '< form id = "lang_form" name = "lang_form" method = "post" action = "'.api_get_self().'" > ';
$html .= '< label style = "display: none;" for = "language_list" > ' . get_lang('Language') . '< / label > ';
$html .= '< label style = "display: none;" for = "language_list" > '.get_lang('Language').'< / label > ';
$html .= '< select id = "language_list" class = "selectpicker show-tick form-control" name = "language_list" > ';
foreach ($original_languages as $key => $value) {
@ -4455,7 +4455,7 @@ function api_get_themes($getOnlyThemeFromVirtualInstance = false)
// This configuration value is set by the vchamilo plugin
$virtualTheme = api_get_configuration_value('virtual_css_theme_folder');
$readCssFolder = function ($dir) use ($virtualTheme) {
$readCssFolder = function($dir) use ($virtualTheme) {
$finder = new Finder();
$themes = $finder->directories()->in($dir)->depth(0)->sortByName();
$list = [];
@ -4616,7 +4616,7 @@ function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = fals
if (is_file($dirname) || is_link($dirname)) {
$res = unlink($dirname);
if ($res === false) {
error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0);
error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0);
}
return $res;
}
@ -4653,7 +4653,7 @@ function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = fals
if ($delete_only_content_in_folder == false) {
$res = rmdir($dirname);
if ($res === false) {
error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
}
}
return $res;
@ -4738,7 +4738,7 @@ function copy_folder_course_session(
$course_id = $course_info['real_id'];
$folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname));
$folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname));
$new_pathname = $base_path_document;
$path = '';
@ -4916,7 +4916,7 @@ function api_parse_info_file($filename) {
foreach (array('key', 'value1', 'value2', 'value3') as $var) {
$$var = isset($match[++$i]) ? $match[$i] : '';
}
$value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3;
$value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3;
// Parse array syntax.
$keys = preg_split('/\]?\[/', rtrim($key, ']'));
@ -5087,7 +5087,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
$t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$var = Database::escape_string($var);
$value = Database::escape_string($value);
$access_url = (int)$access_url;
$access_url = (int) $access_url;
if (empty($access_url)) { $access_url = 1; }
$select = "SELECT id FROM $t_settings WHERE variable = '$var' ";
if (!empty($subvar)) {
@ -5128,11 +5128,11 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
$row = Database::fetch_array($res);
$insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url)
VALUES
('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," .
"'".$row['type']."','".$row['category']."'," .
"'$value','".$row['title']."'," .
"".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
"".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)";
('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",".
"'".$row['type']."','".$row['category']."',".
"'$value','".$row['title']."',".
"".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",".
"".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)";
Database::query($insert);
} else {
// Such a setting does not exist.
@ -5154,11 +5154,11 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
if ($row['access_url_changeable'] == 1) {
$insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES
('".$row['variable']."',".
(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," .
"'".$row['type']."','".$row['category']."'," .
"'$value','".$row['title']."'," .
(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",".
"'".$row['type']."','".$row['category']."',".
"'$value','".$row['title']."',".
"".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".
(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",".
"".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")";
Database::query($insert);
}
@ -5192,10 +5192,10 @@ function api_set_settings_category($category, $value = null, $access_url = 1, $f
$value = Database::escape_string($value);
$sql = "UPDATE $t_s SET selected_value = '$value'
WHERE category = '$category' AND access_url = $access_url";
if (is_array($fieldtype) & & count($fieldtype)>0) {
if (is_array($fieldtype) & & count($fieldtype) > 0) {
$sql .= " AND ( ";
$i = 0;
foreach ($fieldtype as $type){
foreach ($fieldtype as $type) {
if ($i > 0) {
$sql .= ' OR ';
}
@ -5210,10 +5210,10 @@ function api_set_settings_category($category, $value = null, $access_url = 1, $f
} else {
$sql = "UPDATE $t_s SET selected_value = NULL
WHERE category = '$category' AND access_url = $access_url";
if (is_array($fieldtype) & & count($fieldtype)>0) {
if (is_array($fieldtype) & & count($fieldtype) > 0) {
$sql .= " AND ( ";
$i = 0;
foreach ($fieldtype as $type){
foreach ($fieldtype as $type) {
if ($i > 0) {
$sql .= ' OR ';
}
@ -5329,7 +5329,7 @@ function &api_get_settings($cat = null, $ordering = 'list', $access_url = 1, $ur
if ($result === null) {
return [];
}
$result = Database::store_result($result,'ASSOC');
$result = Database::store_result($result, 'ASSOC');
return $result;
}
@ -5396,12 +5396,12 @@ function api_add_setting(
// Item not found for this access_url, we have to check if the whole thing is missing
// (in which case we ignore the insert) or if there *is* a record but just for access_url = 1
$insert = "INSERT INTO $t_settings " .
"(variable,selected_value," .
"type,category," .
"subkey,title," .
"comment,scope," .
"subkeytext,access_url,access_url_changeable)" .
$insert = "INSERT INTO $t_settings ".
"(variable,selected_value,".
"type,category,".
"subkey,title,".
"comment,scope,".
"subkeytext,access_url,access_url_changeable)".
" VALUES ('$var','$val',";
if (isset($type)) {
$type = Database::escape_string($type);
@ -5566,7 +5566,7 @@ function api_is_course_visible_for_user($userid = null, $cid = null) {
$result = Database::query($sql);
//if ($row = Database::fetch_array($result)) {
if (Database::num_rows($result) > 0 ) {
if (Database::num_rows($result) > 0) {
$is_courseMember = true;
$is_courseTutor = true;
$is_courseCoach = true;
@ -5856,7 +5856,7 @@ function api_is_windows_os() {
} else {
return false;
}
return strtolower(substr((string)$os, 0, 3 )) == 'win';
return strtolower(substr((string) $os, 0, 3)) == 'win';
}
/**
@ -6454,7 +6454,7 @@ function api_get_jquery_ui_css_web_path()
function api_get_jquery_ui_js($include_jqgrid = false) {
$libraries = array();
if ($include_jqgrid) {
$libraries[]='jqgrid';
$libraries[] = 'jqgrid';
}
return api_get_jquery_libraries_js($libraries);
}
@ -6482,7 +6482,7 @@ function api_get_jquery_libraries_js($libraries) {
//languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
$jqgrid_langs = array(
'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua'
'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua'
);
if (in_array($platform_isocode, $jqgrid_langs)) {
@ -6685,7 +6685,7 @@ function api_block_course_item_locked_by_gradebook($item_id, $link_type, $course
*/
function api_check_php_version($my_inc_path = null)
{
if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '< ')) {
if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '< ')) {
$global_error_code = 1;
// Incorrect PHP version
$global_page = $my_inc_path.'global_error_message.inc.php';
@ -6703,7 +6703,7 @@ function api_check_php_version($my_inc_path = null)
function api_check_archive_dir()
{
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) & & !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning');
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning');
api_not_allowed(true, $message);
}
}
@ -6794,23 +6794,23 @@ function api_get_real_ip()
* @author Yannick Warnier for improvements and managment of multiple ranges
* @todo check for IPv6 support
*/
function api_check_ip_in_range($ip,$range)
function api_check_ip_in_range($ip, $range)
{
if (empty($ip) or empty($range)) {
return false;
}
$ip_ip = ip2long ($ip);
$ip_ip = ip2long($ip);
// divide range param into array of elements
if (strpos($range,',')!==false) {
$ranges = explode(',',$range);
if (strpos($range, ',') !== false) {
$ranges = explode(',', $range);
} else {
$ranges = array($range);
}
foreach ($ranges as $range) {
$range = trim($range);
if (empty($range)) { continue; }
if (strpos($range,'/')===false) {
if (strcmp($ip,$range)===0) {
if (strpos($range, '/') === false) {
if (strcmp($ip, $range) === 0) {
return true; // there is a direct IP match, return OK
}
continue; //otherwise, get to the next range
@ -6818,7 +6818,7 @@ function api_check_ip_in_range($ip,$range)
// the range contains a "/", so analyse completely
list ($net, $mask) = explode("/", $range);
$ip_net = ip2long ($net);
$ip_net = ip2long($net);
// mask binary magic
$ip_mask = ~((1 < < (32 - $mask)) - 1);
@ -7167,7 +7167,7 @@ function api_set_memory_limit($mem)
}
$memory_limit = ini_get('memory_limit');
if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){
if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) {
ini_set('memory_limit', $mem);
return true;
}
@ -7186,20 +7186,20 @@ function api_set_memory_limit($mem)
*/
function api_get_bytes_memory_limit($mem)
{
$size = strtolower(substr($mem,-1));
$size = strtolower(substr($mem, -1));
switch ($size) {
case 't':
$mem = intval(substr($mem,-1))*1024*1024*1024*1024;
$mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024;
break;
case 'g':
$mem = intval(substr($mem,0,-1))*1024*1024*1024;
$mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024;
break;
case 'm':
$mem = intval(substr($mem,0,-1))*1024*1024;
$mem = intval(substr($mem, 0, -1)) * 1024 * 1024;
break;
case 'k':
$mem = intval(substr($mem,0,-1))*1024;
$mem = intval(substr($mem, 0, -1)) * 1024;
break;
default:
// we assume it's integer only
@ -7310,7 +7310,7 @@ function api_block_account_captcha($username)
return false;
}
$minutesToBlock = api_get_setting('captcha_time_to_block');
$time = time() + $minutesToBlock*60;
$time = time() + $minutesToBlock * 60;
UserManager::update_extra_field_value(
$userInfo['user_id'],
'captcha_blocked_until_date',
@ -7388,7 +7388,7 @@ function api_remove_tags_with_space($in_html, $in_double_quote_replace = true)
$out_res = str_replace('"', "''", $out_res);
}
// avoid text stuck together when tags are removed, adding a space after >
$out_res = str_replace (">", "> ", $out_res);
$out_res = str_replace(">", "> ", $out_res);
$out_res = strip_tags($out_res);
return $out_res;
@ -7596,7 +7596,7 @@ function api_warn_hosting_contact($limitName)
$body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n ";
$body .= get_lang('PortalLimitType').': '.$limitName." \n ";
if (isset($hostingParams[$limitName])) {
$body .= get_lang('Value') . ': ' . $hostingParams[$limitName];
$body .= get_lang('Value').': '.$hostingParams[$limitName];
}
api_mail_html(null, $email, $subject, $body);
}
@ -7747,7 +7747,7 @@ function api_get_users_status_ignored_in_reports($format = 'array')
*/
function api_set_site_use_cookie_warning_cookie()
{
setcookie('ChamiloUsesCookies', 'ok', time()+31556926);
setcookie('ChamiloUsesCookies', 'ok', time() + 31556926);
}
/**
@ -7801,10 +7801,10 @@ function api_create_protected_dir($name, $parentDirectory)
return false;
}
$fullPath = $parentDirectory . api_replace_dangerous_char($name);
$fullPath = $parentDirectory.api_replace_dangerous_char($name);
if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) {
$fp = fopen($fullPath . '/index.html', 'w');
$fp = fopen($fullPath.'/index.html', 'w');
if ($fp) {
if (fwrite($fp, '< html > < head > < / head > < body > < / body > < / html > ')) {
@ -7869,7 +7869,7 @@ function api_mail_html(
$mail->SMTPSecure = $platform_email['SMTP_SECURE'];
}
}
$mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0;
$mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0;
// 5 = low, 1 = high
$mail->Priority = 3;
@ -8015,11 +8015,11 @@ function api_mail_html(
error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'< br / > ');
if ($mail->SMTPDebug) {
error_log(
"Connection details :: " .
"Protocol: " . $mail->Mailer . ' :: ' .
"Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' .
"Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' .
($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'')
"Connection details :: ".
"Protocol: ".$mail->Mailer.' :: '.
"Host/Port: ".$mail->Host.':'.$mail->Port.' :: '.
"Authent/Open: ".($mail->SMTPAuth ? 'Authent' : 'Open').' :: '.
($mail->SMTPAuth ? " User/Pass: ".$mail->Username.':'.$mail->Password : '')
);
}
return 0;
@ -8102,7 +8102,7 @@ function api_unique_multidim_array($array, $key)
$key_array = [];
foreach ($array as $val) {
if(!in_array($val[$key],$key_array)){
if (!in_array($val[$key], $key_array)) {
$key_array[$i] = $val[$key];
$temp_array[$i] = $val;
}
@ -8147,7 +8147,7 @@ function api_upload_file($type, $file, $itemId, $cropParameters = '')
// No "dangerous" files
$name = disable_dangerous_file($name);
$pathId = '/'.substr((string)$itemId, 0, 1).'/'.$itemId.'/';
$pathId = '/'.substr((string) $itemId, 0, 1).'/'.$itemId.'/';
$path = api_get_path(SYS_UPLOAD_PATH).$type.$pathId;
if (!is_dir($path)) {
@ -8226,7 +8226,7 @@ function api_number_format($number, $decimals = 0)
*/
function location($url, $exit = true)
{
header('Location: ' . $url);
header('Location: '.$url);
if ($exit) {
exit;