configure_homepage.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. <?php // $Id: configure_homepage.php 11227 2007-02-26 13:45:20Z elixir_julian $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. // name of the language file that needs to be included
  20. $language_file = array ('admin', 'accessibility');
  21. $cidReset=true;
  22. include('../inc/global.inc.php');
  23. $this_section=SECTION_PLATFORM_ADMIN;
  24. api_protect_admin_script();
  25. include_once(api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php');
  26. include_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
  27. require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php");
  28. $action=$_GET['action'];
  29. $tbl_category=Database::get_main_table(TABLE_MAIN_CATEGORY);
  30. $tool_name=get_lang('ConfigureHomePage');
  31. $interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
  32. if(isset($_GET["action"])){
  33. $interbreadcrumb[]=array('url' => 'configure_homepage.php',"name" => get_lang('ConfigureHomePage'));
  34. switch($_GET["action"]){
  35. case "edit_top":
  36. $tool_name=get_lang("EditHomePage");
  37. break;
  38. case "edit_news":
  39. $tool_name=get_lang("EditNews");
  40. break;
  41. case "edit_notice":
  42. $tool_name=get_lang("EditNotice");
  43. break;
  44. case "insert_link":
  45. $tool_name=get_lang("InsertLink");
  46. break;
  47. case "edit_link":
  48. $tool_name=get_lang("EditLink");
  49. break;
  50. }
  51. }
  52. $menu_language=$_SESSION['user_language_choice'];
  53. if(!isset($menu_language))
  54. {
  55. $menu_language=$platformLanguage;
  56. }
  57. if(!file_exists('../../home/home_menu_'.$menu_language.'.html'))
  58. {
  59. copy('../../home/home_menu.html','../../home/home_menu_'.$menu_language.'.html');
  60. }
  61. $errorMsg='';
  62. if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
  63. $errorMsg=WCAG_Rendering::request_validation();
  64. }
  65. if(!empty($action))
  66. {
  67. if($_POST['formSent'])
  68. {
  69. if($action == 'edit_top')
  70. {
  71. $home_top='';
  72. if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
  73. $home_top=WCAG_Rendering::prepareXHTML();
  74. } else {
  75. $home_top=trim(stripslashes($_POST['home_top']));
  76. }
  77. if(!is_writable('../../home/home_top.html'))
  78. {
  79. $errorMsg=get_lang('HomePageFilesNotWritable');
  80. }
  81. elseif(!empty($home_top))
  82. {
  83. $fp=fopen('../../home/home_top.html','w');
  84. fputs($fp,$home_top);
  85. fclose($fp);
  86. }
  87. }
  88. elseif($action == 'edit_notice')
  89. {
  90. $notice_title=trim(strip_tags(stripslashes($_POST['notice_title'])));
  91. $notice_text=trim(str_replace(array("\r","\n"),array("","<br />"),strip_tags(stripslashes($_POST['notice_text']),'<a>')));
  92. if(empty($notice_title))
  93. {
  94. $errorMsg=get_lang('PleaseEnterNoticeTitle');
  95. }
  96. elseif(empty($notice_text))
  97. {
  98. $errorMsg=get_lang('PleaseEnterNoticeText');
  99. }
  100. elseif(!is_writable('../../home/home_notice.html'))
  101. {
  102. $errorMsg=get_lang('HomePageFilesNotWritable');
  103. }
  104. else
  105. {
  106. $fp=fopen('../../home/home_notice.html','w');
  107. fputs($fp,"<b>$notice_title</b><br />\n$notice_text");
  108. fclose($fp);
  109. }
  110. }
  111. //NEWS
  112. elseif($action == 'edit_news')
  113. {
  114. $s_languages_news=$_POST["news_languages"];
  115. //echo "langue choisie : ".$s_languages_news;
  116. if (api_get_setting('wcag_anysurfer_public_pages')=='true')
  117. {
  118. $home_news=WCAG_rendering::prepareXHTML();
  119. } else
  120. {
  121. $home_news=trim(stripslashes($_POST['home_news']));
  122. }
  123. if($s_languages_news!="all"){
  124. if(file_exists("'../../home/home_news_".$s_languages_news.".html")){
  125. if(is_writable("../../home/home_news_".$s_languages_news.".html")){
  126. $fp=fopen("../../home/home_news_".$s_languages_news.".html","w");
  127. fputs($fp,$home_news);
  128. fclose($fp);
  129. }
  130. else{
  131. $errorMsg=get_lang('HomePageFilesNotWritable');
  132. }
  133. }
  134. //File not exists
  135. else{
  136. $fp=fopen("../../home/home_news_".$s_languages_news.".html","w");
  137. fputs($fp,$home_news);
  138. fclose($fp);
  139. }
  140. }
  141. //we update all the news file
  142. else{
  143. $_languages=api_get_languages();
  144. foreach($_languages["name"] as $key => $value){
  145. $english_name=$_languages["folder"][$key];
  146. if(file_exists("'../../home/home_news_".$english_name.".html")){
  147. if(is_writable("../../home/home_news_".$english_name.".html")){
  148. $fp=fopen("../../home/home_news_".$english_name.".html","w");
  149. fputs($fp,$home_news);
  150. fclose($fp);
  151. }
  152. else{
  153. $errorMsg=get_lang('HomePageFilesNotWritable');
  154. }
  155. }
  156. //File not exists
  157. else{
  158. $fp=fopen("../../home/home_news_".$english_name.".html","w");
  159. fputs($fp,$home_news);
  160. fclose($fp);
  161. }
  162. }
  163. }
  164. /*if(!is_writable('../../home/home_news.html'))
  165. {
  166. $errorMsg=get_lang('HomePageFilesNotWritable');
  167. }
  168. elseif(!empty($home_news))
  169. {
  170. $fp=fopen('../../home/home_news.html','w');
  171. fputs($fp,$home_news);
  172. fclose($fp);
  173. }*/
  174. }
  175. elseif($action == 'insert_link' || $action == 'edit_link')
  176. {
  177. $link_index=intval($_POST['link_index']);
  178. $insert_where=intval($_POST['insert_where']);
  179. $link_name=trim(stripslashes($_POST['link_name']));
  180. $link_url=trim(stripslashes($_POST['link_url']));
  181. // WCAG
  182. if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
  183. $link_html=WCAG_Rendering::prepareXHTML();
  184. } else {
  185. $link_html=trim(stripslashes($_POST['link_html']));
  186. }
  187. $filename=trim(stripslashes($_POST['filename']));
  188. $target_blank=$_POST['target_blank']?true:false;
  189. if($link_url == 'http://')
  190. {
  191. $link_url='';
  192. }
  193. elseif(!empty($link_url) && !strstr($link_url,'://'))
  194. {
  195. $link_url='http://'.$link_url;
  196. }
  197. if(!is_writable('../../home/home_menu_'.$menu_language.'.html'))
  198. {
  199. $errorMsg=get_lang('HomePageFilesNotWritable');
  200. }
  201. elseif(empty($link_name))
  202. {
  203. $errorMsg=get_lang('PleaseEnterLinkName');
  204. }
  205. else
  206. {
  207. if($action == 'insert_link' || empty($filename) || strstr($filename,'/') || !strstr($filename,'.html'))
  208. {
  209. $filename=replace_dangerous_char($link_name,'strict').'.html';
  210. }
  211. if(!empty($filename))
  212. {
  213. $filename=str_replace('home_','user_',$filename);
  214. }
  215. if(!strstr($filename,'_'.$menu_language.'.html'))
  216. {
  217. $filename=str_replace('.html','_'.$menu_language.'.html',$filename);
  218. }
  219. $home_menu=file('../../home/home_menu_'.$menu_language.'.html');
  220. if($insert_where < -1 || $insert_where > (sizeof($home_menu) - 1))
  221. {
  222. $insert_where=sizeof($home_menu) - 1;
  223. }
  224. foreach($home_menu as $key=>$enreg)
  225. {
  226. $home_menu[$key]=trim($enreg);
  227. }
  228. if(empty($link_url))
  229. {
  230. $link_url=$_configuration['root_web'].'index.php?include='.urlencode($filename);
  231. if(!file_exists($_configuration['root_sys'].'home/'.$filename))
  232. {
  233. $fp=@fopen($_configuration['root_sys'].'home/'.$filename,'w');
  234. if($fp)
  235. {
  236. fputs($fp,get_lang('MyTextHere'));
  237. fclose($fp);
  238. }
  239. }
  240. }
  241. if($action == 'edit_link' && !empty($link_html))
  242. {
  243. $fp=@fopen($_configuration['root_sys'].'home/'.$filename,'w');
  244. if($fp)
  245. {
  246. fputs($fp,$link_html);
  247. fclose($fp);
  248. }
  249. }
  250. if($action == 'insert_link')
  251. {
  252. for($i=sizeof($home_menu);$i;$i--)
  253. {
  254. if($i > $insert_where)
  255. {
  256. $home_menu[$i]=$home_menu[$i-1];
  257. }
  258. else
  259. {
  260. break;
  261. }
  262. }
  263. $home_menu[$insert_where+1]='<li><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'">'.$link_name.'</a></li>';
  264. }
  265. else
  266. {
  267. $home_menu[$link_index]='<li><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'">'.$link_name.'</a></li>';
  268. }
  269. $home_menu=implode("\n",$home_menu);
  270. $fp=fopen('../../home/home_menu_'.$menu_language.'.html','w');
  271. fputs($fp,$home_menu);
  272. fclose($fp);
  273. }
  274. }
  275. if(empty($errorMsg))
  276. {
  277. header('Location: '.$_SERVER['PHP_SELF']);
  278. exit();
  279. }
  280. }
  281. elseif($action == 'open_link')
  282. {
  283. $link=$_GET['link'];
  284. if(strstr($link,'/') || !strstr($link,'.html'))
  285. {
  286. $link='';
  287. $action='';
  288. }
  289. }
  290. elseif($action == 'delete_link')
  291. {
  292. $link_index=intval($_GET['link_index']);
  293. $home_menu=file('../../home/home_menu_'.$menu_language.'.html');
  294. foreach($home_menu as $key=>$enreg)
  295. {
  296. if($key == $link_index)
  297. {
  298. unset($home_menu[$key]);
  299. }
  300. else
  301. {
  302. $home_menu[$key]=trim($enreg);
  303. }
  304. }
  305. $home_menu=implode("\n",$home_menu);
  306. $fp=fopen('../../home/home_menu_'.$menu_language.'.html','w');
  307. fputs($fp,$home_menu);
  308. fclose($fp);
  309. header('Location: '.$_SERVER['PHP_SELF']);
  310. exit();
  311. }
  312. elseif($action == 'edit_top')
  313. {
  314. $home_top=file('../../home/home_top.html');
  315. $home_top=implode('',$home_top);
  316. }
  317. elseif($action == 'edit_notice')
  318. {
  319. $home_notice=file('../../home/home_notice.html');
  320. $notice_title=strip_tags($home_notice[0]);
  321. $notice_text=strip_tags(str_replace('<br />',"\n",$home_notice[1]),'<a>');
  322. }
  323. elseif($action == 'edit_news')
  324. {
  325. //$home_news=file('../../home/home_news.html');
  326. //$home_news=implode('',$home_news);
  327. if(file_exists("'../../home/home_news_".$menu_language.".html")){
  328. if(is_readable("../../home/home_news_".$menu_language.".html")){
  329. $home_news=file_get_contents("../../home/home_news_".$menu_language.".html","r");
  330. $home_news=implode('',$home_news);
  331. }
  332. else{
  333. $errorMsg=get_lang('HomePageFilesNotReadable');
  334. }
  335. }
  336. //File not exists
  337. else{
  338. $home_news=file_get_contents("../../home/home_news_".$menu_language.".html","r");
  339. $home_news=implode('',$home_news);
  340. }
  341. }
  342. elseif($action == 'insert_link')
  343. {
  344. $home_menu=file('../../home/home_menu_'.$menu_language.'.html');
  345. }
  346. elseif($action == 'edit_link')
  347. {
  348. $link_index=intval($_GET['link_index']);
  349. $home_menu=file('../../home/home_menu_'.$menu_language.'.html');
  350. $target_blank=false;
  351. $link_name='';
  352. $link_url='';
  353. foreach($home_menu as $key=>$enreg)
  354. {
  355. if($key == $link_index)
  356. {
  357. if(strstr($enreg,'target="_blank"'))
  358. {
  359. $target_blank=true;
  360. }
  361. $link_name=strip_tags($enreg);
  362. $enreg=explode('href="',$enreg);
  363. list($link_url)=explode('"',$enreg[sizeof($enreg)-1]);
  364. if(strstr($link_url,$_configuration['root_web']) && strstr($link_url,'?include='))
  365. {
  366. $link_url=explode('?include=',$link_url);
  367. $filename=$link_url[sizeof($link_url)-1];
  368. if(!strstr($filename,'/') && strstr($filename,'.html'))
  369. {
  370. $link_html=file($_configuration['root_web'].'home/'.$filename);
  371. $link_html=implode('',$link_html);
  372. $link_url='';
  373. }
  374. else
  375. {
  376. $filename='';
  377. }
  378. }
  379. break;
  380. }
  381. }
  382. }
  383. }
  384. else
  385. {
  386. $result=api_sql_query("SELECT name FROM $tbl_category WHERE parent_id IS NULL ORDER BY tree_pos",__FILE__,__LINE__);
  387. $Categories=api_store_result($result);
  388. }
  389. Display::display_header($tool_name);
  390. //api_display_tool_title($tool_name);
  391. if($action == 'open_link')
  392. {
  393. ?>
  394. <?php
  395. include('../../home/'.$link);
  396. }
  397. elseif($action == 'edit_notice')
  398. {
  399. ?>
  400. <form action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;">
  401. <input type="hidden" name="formSent" value="1"/>
  402. <table border="0" cellpadding="5" cellspacing="0">
  403. <?php
  404. if(!empty($errorMsg))
  405. {
  406. ?>
  407. <tr>
  408. <td colspan="2">
  409. <?php
  410. Display::display_normal_message($errorMsg); //main API
  411. ?>
  412. </td>
  413. </tr>
  414. <?php
  415. }
  416. ?>
  417. <tr>
  418. <td nowrap="nowrap"><?php echo get_lang('NoticeTitle'); ?> :</td>
  419. <td><input type="text" name="notice_title" size="30" maxlength="50" value="<?php echo htmlentities($notice_title); ?>" style="width: 350px;"/></td>
  420. </tr>
  421. <tr>
  422. <td nowrap="nowrap" valign="top"><?php echo get_lang('NoticeText'); ?> :</td>
  423. <td><textarea name="notice_text" cols="30" rows="5" wrap="virtual" style="width: 350px;"><?php echo htmlentities($notice_text); ?></textarea></td>
  424. </tr>
  425. <tr>
  426. <td>&nbsp;</td>
  427. <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"/></td>
  428. </tr>
  429. </table>
  430. </form>
  431. <?php
  432. }
  433. elseif($action == 'insert_link' || $action == 'edit_link')
  434. {
  435. ?>
  436. <form action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;">
  437. <input type="hidden" name="formSent" value="1"/>
  438. <input type="hidden" name="link_index" value="<?php if($action == 'edit_link') echo $link_index; else echo '0'; ?>"/>
  439. <input type="hidden" name="filename" value="<?php if($action == 'edit_link') echo $filename; else echo ''; ?>"/>
  440. <table border="0" cellpadding="5" cellspacing="0">
  441. <?php
  442. if(!empty($errorMsg))
  443. {
  444. ?>
  445. <tr>
  446. <td colspan="2">
  447. <?php
  448. Display::display_normal_message($errorMsg); //main API
  449. ?>
  450. </td>
  451. </tr>
  452. <?php
  453. }
  454. ?>
  455. <tr>
  456. <td nowrap="nowrap"><?php echo get_lang('LinkName'); ?> :</td>
  457. <td><input type="text" name="link_name" size="30" maxlength="50" value="<?php echo htmlentities($link_name); ?>" style="width: 350px;"/></td>
  458. </tr>
  459. <tr>
  460. <td nowrap="nowrap"><?php echo get_lang('LinkURL'); ?> (<?php echo get_lang('Optional'); ?>) :</td>
  461. <td><input type="text" name="link_url" size="30" maxlength="100" value="<?php if(empty($link_url)) echo 'http://'; else echo htmlentities($link_url); ?>" style="width: 350px;"/></td>
  462. </tr>
  463. <?php if($action == 'insert_link'): ?>
  464. <tr>
  465. <td nowrap="nowrap"><?php echo get_lang('InsertThisLink'); ?> :</td>
  466. <td><select name="insert_where">
  467. <option value="-1"><?php echo get_lang('FirstPlace'); ?></option>
  468. <?php
  469. foreach($home_menu as $key=>$enreg)
  470. {
  471. ?>
  472. <option value="<?php echo $key; ?>" <?php if($formSent && $insert_where == $key) echo 'selected="selected"'; ?> ><?php echo get_lang('After'); ?> &quot;<?php echo trim(strip_tags($enreg)); ?>&quot;</option>
  473. <?php
  474. }
  475. ?>
  476. </select></td>
  477. </tr>
  478. <?php endif; ?>
  479. <tr>
  480. <td nowrap="nowrap"><?php echo get_lang('OpenInNewWindow'); ?> ?</td>
  481. <td><input class="checkbox" type="checkbox" name="target_blank" value="1" <?php if($target_blank) echo 'checked="checked"'; ?> /> <?php echo get_lang('Yes'); ?></td>
  482. </tr>
  483. <?php if($action == 'edit_link' && empty($link_url)): ?>
  484. </table>
  485. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  486. <tr>
  487. <td>
  488. <?php
  489. //api_disp_html_area('link_html',isset($_POST['link_html'])?$_POST['link_html']:$link_html,'400px');
  490. if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
  491. echo WCAG_Rendering::create_xhtml(isset($_POST['link_html'])?$_POST['link_html']:$link_html);
  492. } else {
  493. $oFCKeditor = new FCKeditor('link_html') ;
  494. $oFCKeditor->BasePath = api_get_path(WEB_PATH) . 'main/inc/lib/fckeditor/' ;
  495. $oFCKeditor->Height = '400';
  496. $oFCKeditor->Width = '100%';
  497. $oFCKeditor->Value = isset($_POST['link_html'])?$_POST['link_html']:$link_html;
  498. $oFCKeditor->Config['CustomConfigurationsPath'] = api_get_path(REL_PATH)."main/inc/lib/fckeditor/myconfig.js";
  499. $oFCKeditor->ToolbarSet = "Small";
  500. $TBL_LANGUAGES = Database::get_main_table(TABLE_MAIN_LANGUAGE);
  501. $sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_user"]["language"]."'";
  502. $result_sql=api_sql_query($sql);
  503. $isocode_language=mysql_result($result_sql,0,0);
  504. $oFCKeditor->Config['DefaultLanguage'] = $isocode_language;
  505. echo $oFCKeditor->CreateHtml();
  506. }
  507. ?>
  508. </td>
  509. </tr>
  510. <tr>
  511. <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"/></td>
  512. </tr>
  513. <?php else: ?>
  514. <tr>
  515. <td>&nbsp;</td>
  516. <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"/></td>
  517. </tr>
  518. <?php endif; ?>
  519. </table>
  520. </form>
  521. <?php
  522. }
  523. elseif($action == 'edit_top' || $action == 'edit_news')
  524. {
  525. if($action == 'edit_top')
  526. {
  527. $name="home_top";
  528. $open = $home_top;
  529. }
  530. else
  531. {
  532. $name="home_news";
  533. $user_selected_language = $_SESSION["_user"]["language"];
  534. if(!file_exists("../../home/home_news_".$user_selected_language.".html")){
  535. $platform_language=api_get_setting("platformLanguage");
  536. $open='../../home/home_news_'.$platform_language.'.html';
  537. }
  538. else{
  539. $open='../../home/home_news_'.$user_selected_language.'.html';
  540. }
  541. if(isset($_SESSION["user_language_choice"])){
  542. $language=$user_selected_language;
  543. }
  544. else{
  545. $language=api_get_setting("platformLanguage");
  546. }
  547. $open=file_get_contents($open);
  548. }
  549. ?>
  550. <form action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action; ?>" method="post" style="margin:0px;">
  551. <input type="hidden" name="formSent" value="1"/>
  552. <?php
  553. if(!empty($errorMsg))
  554. {
  555. Display::display_normal_message($errorMsg); //main API
  556. }
  557. if($action == 'edit_news'){
  558. $_languages=api_get_languages();
  559. echo get_lang("ChooseNewsLanguage")." : <select name='news_languages'><option value='all'>".get_lang("AllLanguages")."</option>";
  560. foreach($_languages["name"] as $key => $value){
  561. $english_name=$_languages["folder"][$key];
  562. if($language==$english_name){
  563. echo "<option value='$english_name' selected=selected>$value</option>";
  564. }
  565. else{
  566. echo "<option value='$english_name'>$value</option>";
  567. }
  568. }
  569. echo "</select>";
  570. }
  571. ?>
  572. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  573. <tr>
  574. <td>
  575. <?php
  576. //api_disp_html_area($open,isset($_POST[$open])?trim(stripslashes($_POST[$open])):${$open},'400px'); ?>
  577. <?php
  578. if (api_get_setting('wcag_anysurfer_public_pages')=='true') {
  579. ?>
  580. <script type="text/javascript" src="<?php echo(api_get_path(REL_PATH).'main/inc/lib/fckeditor/editor/plugins/ImageManagerStandalone/generic_dialog_common.js')?>" />
  581. <?php
  582. echo WCAG_Rendering::create_xhtml($open);
  583. } else {
  584. $oFCKeditor = new FCKeditor($name) ;
  585. $oFCKeditor->BasePath = api_get_path(WEB_PATH) . 'main/inc/lib/fckeditor/' ;
  586. $oFCKeditor->Height = '400';
  587. $oFCKeditor->Width = '100%';
  588. $oFCKeditor->Value = $open;
  589. $oFCKeditor->Config['CustomConfigurationsPath'] = api_get_path(REL_PATH)."main/inc/lib/fckeditor/myconfig.js";
  590. $oFCKeditor->ToolbarSet = "Small";
  591. $TBL_LANGUAGES = Database::get_main_table(TABLE_MAIN_LANGUAGE);
  592. $sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_user"]["language"]."'";
  593. $result_sql=api_sql_query($sql);
  594. $isocode_language=mysql_result($result_sql,0,0);
  595. $oFCKeditor->Config['DefaultLanguage'] = $isocode_language;
  596. echo $oFCKeditor->CreateHtml();
  597. }
  598. ?>
  599. </td>
  600. </tr>
  601. <tr>
  602. <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"/></td>
  603. </tr>
  604. </table>
  605. </form>
  606. <?php
  607. }
  608. else
  609. {
  610. ?>
  611. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  612. <tr>
  613. <td width="80%" colspan="2">
  614. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_top"><img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify')); ?>"/></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_top"><?php echo get_lang('EditHomePage'); ?></a>
  615. </td>
  616. <td width="20%">
  617. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=insert_link"><img src="../img/insert_row.png" border="0"/></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=insert_link"/><?php echo get_lang('InsertLink'); ?></a>
  618. </td>
  619. </tr>
  620. <tr>
  621. <td width="80%" colspan="2" valign="top">
  622. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  623. <tr>
  624. <td colspan="2">
  625. <?php
  626. include('../../home/home_top.html');
  627. ?>
  628. </td>
  629. </tr>
  630. <tr>
  631. <td width="50%">
  632. <br />
  633. <a href="course_category.php"><img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify')); ?>"/></a> <a href="course_category.php"><?php echo get_lang('EditCategories'); ?></a>
  634. </td>
  635. <td width="50%">
  636. <br />
  637. <!--<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_news"><img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify')); ?>"/></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_news"><?php echo get_lang('EditNews'); ?></a>-->
  638. </td>
  639. </tr>
  640. <tr>
  641. <td width="50%" valign="top">
  642. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  643. <?php
  644. if(sizeof($Categories))
  645. {
  646. foreach($Categories as $enreg)
  647. {
  648. ?>
  649. <tr>
  650. <td><img src="../img/opendir.gif" border="0" alt=""/>&nbsp;<?php echo $enreg['name']; ?></td>
  651. </tr>
  652. <?php
  653. }
  654. unset($Categories);
  655. }
  656. else
  657. {
  658. echo get_lang('NoCategories');
  659. }
  660. ?>
  661. </table>
  662. </td>
  663. <!--<td width="50%" valign="top">
  664. <?php
  665. $user_selected_language = $_SESSION["_user"]["language"];
  666. if(file_exists('../../home/home_news_'.$user_selected_language.'.html'))
  667. {
  668. include ('../../home/home_news_'.$user_selected_language.'.html');
  669. }
  670. else
  671. {
  672. $platform_language=api_get_setting("platformLanguage");
  673. if(file_exists('../../home/home_news_'.$platform_language.'.html')){
  674. include('../../home/home_news_'.$platform_language.'.html');
  675. }
  676. else{
  677. include ('../../home/home_news.html');
  678. }
  679. }
  680. ?>
  681. </td>-->
  682. </tr>
  683. </table>
  684. </td>
  685. <td width="20%" rowspan="3" valign="top">
  686. <div class="menu" style="width: 100%;">
  687. <?php
  688. api_display_language_form();
  689. ?>
  690. <form id="loginform">
  691. <label><?php echo get_lang('LoginName'); ?></label>
  692. <input type="text" id="login" size="15" value="" disabled="disabled" />
  693. <label><?php echo get_lang('UserPassword'); ?></label>
  694. <input type="password" id="password" size="15" disabled="disabled" />
  695. <input type="button" value="<?php echo get_lang('Ok'); ?>" disabled="disabled" />
  696. </form>
  697. <div class="menusection">
  698. <span class="menusectioncaption"><?php echo get_lang('User'); ?></span>
  699. <ul class="menulist">
  700. <li><span style="color: #9D9DA1; font-weight: bold;"><?php echo ucfirst(get_lang('Registration')); ?></span></li>
  701. <li><span style="color: #9D9DA1; font-weight: bold;"><?php echo ucfirst(get_lang('LostPassword')); ?></span></li>
  702. </ul>
  703. </div>
  704. <div class="menusection">
  705. <span class="menusectioncaption"><?php echo ucfirst(get_lang('General')); ?></span>
  706. <ul class="menulist">
  707. <?php
  708. $home_menu=file('../../home/home_menu_'.$menu_language.'.html');
  709. foreach($home_menu as $key=>$enreg)
  710. {
  711. $enreg=trim($enreg);
  712. if(!empty($enreg))
  713. {
  714. $edit_link='<a href="'.$_SERVER['PHP_SELF'].'?action=edit_link&amp;link_index='.$key.'"><img src="../img/edit.gif" border="0" style="margin-top: 2px;" title="'.htmlentities(get_lang('Modify')).'"/></a>';
  715. $delete_link='<a href="'.$_SERVER['PHP_SELF'].'?action=delete_link&amp;link_index='.$key.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang('ConfirmYourChoice'))).'\')) return false;"><img src="../img/delete.gif" border="0" style="margin-top: 2px;" title="'.htmlentities(get_lang('Delete')).'"/></a>';
  716. echo str_replace(array('href="'.$_configuration['root_web'].'index.php?include=','</li>'),array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($_SERVER['PHP_SELF']).'?action=open_link&link=','<br />'.$edit_link.' '.$delete_link.'</li>'),$enreg);
  717. }
  718. }
  719. ?>
  720. </ul>
  721. </div>
  722. <br />
  723. &nbsp;&nbsp;<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_notice"><img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify')); ?>"/></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=edit_notice"><?php echo get_lang('EditNotice'); ?></a>
  724. <div class="note">
  725. <?php
  726. include('../../home/home_notice.html');
  727. ?>
  728. </div>
  729. </div>
  730. </td>
  731. </tr>
  732. </table>
  733. <?php
  734. }
  735. /*
  736. ==============================================================================
  737. FOOTER
  738. ==============================================================================
  739. */
  740. Display::display_footer();
  741. ?>