1
0

editLinks.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /* $Id: editLinks.php 2893 2007-04-14 13:20:30Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. // prevent direct invocation
  16. if ((!isset($cfg['user'])) || (isset($_REQUEST['cfg']))) {
  17. @ob_end_clean();
  18. @header("location: ../../../index.php");
  19. exit();
  20. }
  21. /******************************************************************************/
  22. // init template-instance
  23. tmplInitializeInstance($cfg["theme"], "page.admin.editLinks.tmpl");
  24. // set vars
  25. $arLinks = GetLinks();
  26. $arLid = Array_Keys($arLinks);
  27. $inx = 0;
  28. $link_count = count($arLinks);
  29. $link_list = array();
  30. foreach($arLinks as $link) {
  31. $lid = $arLid[$inx++];
  32. $counter = 0;
  33. if (isset($_REQUEST["edit"]) && $_REQUEST["edit"] == $link['lid']) {
  34. $is_edit = 1;
  35. } else {
  36. $is_edit = 0;
  37. }
  38. if ($inx > 1 )
  39. $counter = 2;
  40. if ($inx == 1)
  41. $counter = 1;
  42. array_push($link_list, array(
  43. 'is_edit' => $is_edit,
  44. 'url' => $link['url'],
  45. 'sitename' => $link['sitename'],
  46. 'lid' => $lid,
  47. 'counter' => $counter,
  48. 'counter2' => ($inx != count($arLinks)) ? 1 : 0,
  49. 'last_link' => false
  50. )
  51. );
  52. }
  53. // Set a tmpl var to indicate this is last link so we can format/align the last
  54. // link correctly:
  55. $link_list[count($link_list)-1]['last_link']=true;
  56. $tmpl->setloop('link_list', $link_list);
  57. $tmpl->setvar('enable_dereferrer', $cfg["enable_dereferrer"]);
  58. //
  59. $tmpl->setvar('_ADMINEDITLINKS', $cfg['_ADMINEDITLINKS']);
  60. $tmpl->setvar('_FULLURLLINK', $cfg['_FULLURLLINK']);
  61. $tmpl->setvar('_FULLSITENAME', $cfg['_FULLSITENAME']);
  62. $tmpl->setvar('_UPDATE', $cfg['_UPDATE']);
  63. $tmpl->setvar('_DELETE', $cfg['_DELETE']);
  64. $tmpl->setvar('_EDIT', $cfg['_EDIT']);
  65. //
  66. tmplSetTitleBar($cfg['_ADMINEDITLINKS']);
  67. tmplSetAdminMenu();
  68. tmplSetFoot();
  69. tmplSetIidVars();
  70. // parse template
  71. $tmpl->pparse();
  72. ?>