configure_homepage.php 23 KB

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