|
|
|
@ -7,6 +7,8 @@ |
|
|
|
* @package chamilo.admin |
|
|
|
* @package chamilo.admin |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Symfony\Component\HttpFoundation\Request as HttpRequest; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates menu tabs for logged and anonymous users. |
|
|
|
* Creates menu tabs for logged and anonymous users. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -58,6 +60,8 @@ $this_page = ''; |
|
|
|
|
|
|
|
|
|
|
|
api_protect_admin_script(); |
|
|
|
api_protect_admin_script(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$httpRequest = HttpRequest::createFromGlobals(); |
|
|
|
|
|
|
|
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
$(function() { |
|
|
|
$(function() { |
|
|
|
$("#all_langs").change(function() { |
|
|
|
$("#all_langs").change(function() { |
|
|
|
@ -382,14 +386,14 @@ if (!empty($action)) { |
|
|
|
case 'edit_tabs': |
|
|
|
case 'edit_tabs': |
|
|
|
case 'insert_link': |
|
|
|
case 'insert_link': |
|
|
|
case 'edit_link': |
|
|
|
case 'edit_link': |
|
|
|
$link_index = (isset($_POST['link_index']) ? intval($_POST['link_index']) : 0); |
|
|
|
$link_index = $httpRequest->request->getInt('link_index'); |
|
|
|
$insert_where = (isset($_POST['insert_where']) ? intval($_POST['insert_where']) : 0); |
|
|
|
$insert_where = $httpRequest->request->getInt('insert_where'); |
|
|
|
$link_name = trim(stripslashes($_POST['link_name'])); |
|
|
|
$link_name = Security::remove_XSS($httpRequest->request->get('link_name')); |
|
|
|
$link_url = trim(stripslashes($_POST['link_url'])); |
|
|
|
$link_url = Security::remove_XSS($_POST['link_url']); |
|
|
|
$add_in_tab = (isset($_POST['add_in_tab']) ? intval($_POST['add_in_tab']) : 0); |
|
|
|
$add_in_tab = $httpRequest->request->getInt('add_in_tab'); |
|
|
|
$link_html = trim(stripslashes($_POST['link_html'])); |
|
|
|
$link_html = Security::remove_XSS($_POST['link_html']); |
|
|
|
$filename = trim(stripslashes($_POST['filename'])); |
|
|
|
$filename = Security::remove_XSS($_POST['filename']); |
|
|
|
$target_blank = isset($_POST['target_blank']); |
|
|
|
$target_blank = $httpRequest->request->has('target_blank'); |
|
|
|
|
|
|
|
|
|
|
|
if ($link_url == 'http://' || $link_url == 'https://') { |
|
|
|
if ($link_url == 'http://' || $link_url == 'https://') { |
|
|
|
$link_url = ''; |
|
|
|
$link_url = ''; |
|
|
|
@ -895,12 +899,14 @@ switch ($action) { |
|
|
|
$form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? (!empty($filename) ? $filename : '') : ''); |
|
|
|
$form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? (!empty($filename) ? $filename : '') : ''); |
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('text', 'link_name', get_lang('LinkName'), ['size' => '30', 'maxlength' => '50']); |
|
|
|
$form->addElement('text', 'link_name', get_lang('LinkName'), ['size' => '30', 'maxlength' => '50']); |
|
|
|
|
|
|
|
$form->applyFilter('text', 'html_filter'); |
|
|
|
if (!empty($link_name)) { |
|
|
|
if (!empty($link_name)) { |
|
|
|
$default['link_name'] = $link_name; |
|
|
|
$default['link_name'] = $link_name; |
|
|
|
} |
|
|
|
} |
|
|
|
$default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES); |
|
|
|
$default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES); |
|
|
|
$linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional').'<br />'.get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : ''; |
|
|
|
$linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional').'<br />'.get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : ''; |
|
|
|
$form->addElement('text', 'link_url', [get_lang('LinkURL'), $linkUrlComment], ['size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;']); |
|
|
|
$form->addElement('text', 'link_url', [get_lang('LinkURL'), $linkUrlComment], ['size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;']); |
|
|
|
|
|
|
|
$form->applyFilter('link_url', 'html_filter'); |
|
|
|
|
|
|
|
|
|
|
|
$options = ['-1' => get_lang('FirstPlace')]; |
|
|
|
$options = ['-1' => get_lang('FirstPlace')]; |
|
|
|
|
|
|
|
|
|
|
|
@ -1139,12 +1145,32 @@ switch ($action) { |
|
|
|
$home_menu = explode("\n", $home_menu); |
|
|
|
$home_menu = explode("\n", $home_menu); |
|
|
|
} |
|
|
|
} |
|
|
|
$i = 0; |
|
|
|
$i = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$editIcon = Display::return_icon('edit.png', get_lang('Edit')); |
|
|
|
|
|
|
|
$deleteIcon = Display::return_icon('delete.png', get_lang('Delete')); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($home_menu as $enreg) { |
|
|
|
foreach ($home_menu as $enreg) { |
|
|
|
$enreg = trim($enreg); |
|
|
|
$enreg = trim($enreg); |
|
|
|
if (!empty($enreg)) { |
|
|
|
if (!empty($enreg)) { |
|
|
|
$edit_link = '<a href="'.$selfUrl.'?action=edit_link&link_index='.$i.'">'.Display::return_icon('edit.png', get_lang('Edit')).'</a>'; |
|
|
|
$edit_link = Display::url( |
|
|
|
$delete_link = '<a href="'.$selfUrl.'?action=delete_link&link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>'; |
|
|
|
$editIcon, |
|
|
|
echo str_replace(['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'], ['href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'], $enreg); |
|
|
|
"$selfUrl?".http_build_query(['action' => 'edit_link', 'link_index' => $i]) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$delete_link = Display::url( |
|
|
|
|
|
|
|
$deleteIcon, |
|
|
|
|
|
|
|
"$selfUrl?".http_build_query(['action' => 'delete_link', 'link_index' => $i]), |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'onclick' => 'javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;', |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
echo str_replace( |
|
|
|
|
|
|
|
['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'], |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', |
|
|
|
|
|
|
|
$edit_link.PHP_EOL.$delete_link.PHP_EOL.'</li>' |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
$enreg |
|
|
|
|
|
|
|
); |
|
|
|
$i++; |
|
|
|
$i++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|