Source for file admin.php

Documentation is available at admin.php

  1. <?
  2. /**
  3. * admin.php
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (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. * @author Stephan Raabe
  14. */
  15.  
  16. /**
  17. * Writes a cancel button
  18. */
  19.  
  20. function writeCancel($link)
  21. {
  22. echo '<input style="background-image:url(system/admin/img/oes_cancelback.png);background-repeat:no-repeat;" type="button" value="Cancel" class="adminsubmitbtn" onclick="'.$link.'">';
  23. }
  24.  
  25. /**
  26. * Writes an OK button
  27. */
  28. function writeOk($link)
  29. {
  30. echo '<input style="background-image:url(system/admin/img/oes_okback.png);background-repeat:no-repeat;" type="button" value="Ok" class="adminsubmitbtn" onclick="'.$link.'">';
  31. }
  32.  
  33. /**
  34. * Writes a back button
  35. */
  36. function writeBack($link)
  37. {
  38. echo '<input style="background-image:url(system/admin/img/oes_backback.png);background-repeat:no-repeat;" type="button" value="Back" class="adminsubmitbtn" onclick="'.$link.'">';
  39. }
  40.  
  41. /**
  42. * Writes a menu item
  43. */
  44. function writeOeLink($title,$link,$icon)
  45. {
  46. ?>
  47. <div class="oe_menu_item">
  48. <div class="icon"><a href="<?= $link; ?>"><img src="system/admin/img/oes_<?= $icon; ?>.png"></a></div>
  49. <div class="link"><a href="<?= $link; ?>"><?= $title; ?></a></div>
  50. </div>
  51. <?
  52. }
  53.  
  54. /**
  55. * writes the admin menu header
  56. */
  57. function getAdminHead($name,$img,$control = "")
  58. {
  59. global $admin_lang,$page,$site_help;
  60. ?>
  61. <? if ($control == "yes") { ?>
  62. <link rel="stylesheet" type="text/css" href="system/admin/style/oe_pullmenu.css" />
  63. <script type="text/javascript" src="system/admin/script/DropDownMenuX.js"></script>
  64. <div id="oe_menuback"></div>
  65. <div id="oe_pulldown">
  66. <table cellspacing="0" cellpadding="0" id="menu1" class="ddmx">
  67. <tr>
  68. <td>
  69. <a class="item1" href="javascript:void(0)">System</a>
  70. <div class="section">
  71. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=settings"><?= $admin_lang["settings"][1]; ?></a>
  72. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=phpinfo">PHP Info</a>
  73. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=deletecache"><?= $admin_lang["filecache"][1]; ?></a>
  74. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=stringpool"><?= $admin_lang["stringpool"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  75. <div class="section">
  76. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=stringpool&action=showstringpoolItem"><?= $admin_lang["stringpool"][5]; ?></a>
  77. </div>
  78. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=languages"><?= $admin_lang["lang"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  79. <div class="section">
  80. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=languages&action=showlanguageItem"><?= $admin_lang["table"][23]; ?></a>
  81. </div>
  82. </div>
  83. </td>
  84. <td>
  85. <a class="item1" href="javascript:void(0)">Layout</a>
  86. <div class="section">
  87. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=templates"><?= $admin_lang["templates"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  88. <div class="section">
  89. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=templates&action=showtemplateItem"><?= $admin_lang["table"][18]; ?></a>
  90. </div>
  91. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=attributes"><?= $admin_lang["attributes"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  92. <div class="section">
  93. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=attributes&action=showattributeItem"><?= $admin_lang["table"][19]; ?></a>
  94. </div>
  95. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=edit/css">Editor CSS</a>
  96. </div>
  97. </td>
  98. <td>
  99. <a class="item1" href="javascript:void(0)"><?= $admin_lang["admin"][5]; ?></a>
  100. <div class="section">
  101. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=accounts"><?= $admin_lang["accounts"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  102. <div class="section">
  103. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=accounts&action=showaccountItem"><?= $admin_lang["table"][20]; ?></a>
  104. </div>
  105. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=statistic"><?= $admin_lang["statistics"][1]; ?></a>
  106. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=newsletter"><?= $admin_lang["newsletter"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  107. <div class="section">
  108. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=newsletter&action=shownewsletterItem"><?= $admin_lang["table"][21]; ?></a>
  109. </div>
  110. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=group"><?= $admin_lang["group"][1]; ?></a>
  111. </div>
  112. </td>
  113. <td>
  114. <a class="item1" href="javascript:void(0)"><?= $admin_lang["admin"][6]; ?></a>
  115. <div class="section">
  116. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=exporting"><?= $admin_lang["exporting"][1]; ?></a>
  117. <a class="item2 arrow" href="website.php?id=<?= $page["page_path"]; ?>&admin=replacing"><?= $admin_lang["replacing"][1]; ?><img src="system/admin/img/arrow1.gif" width="10" height="12" alt="" /></a>
  118. <div class="section">
  119. <a class="item2" href="website.php?id=<?= $page["page_path"]; ?>&admin=replacing&action=showreplacingItem"><?= $admin_lang["table"][22]; ?></a>
  120. </div>
  121. </div>
  122. </td>
  123. <td>
  124. <a class="item1" href="javascript:void(0)"><?= $admin_lang["admin"][7]; ?></a>
  125. <div class="section">
  126. <a class="item2" href="<?= $site_help; ?>" target="_blank"><?= $admin_lang["admin"][2]; ?></a>
  127. <a class="item2" href="http://www.openengine.de" target="_blank">openengine.de</a>
  128. <a class="item2" href="http://www.openengine.de/forum" target="_blank">Forum</a>
  129. </div>
  130. </td>
  131. </tr>
  132. </table>
  133. </div>
  134. <script type="text/javascript">
  135. var ddmx = new DropDownMenuX('menu1');
  136. ddmx.delay.show = 0;
  137. ddmx.delay.hide = 400;
  138. ddmx.position.levelX.left = 2;
  139. ddmx.init();
  140. </script>
  141. <? } ?>
  142. <!-- Admin Head START -->
  143. <div id="oe_head">
  144. <div class="icon"><img src="system/admin/img/oes_<?= $img; ?>.png" alt="" border="0"></div>
  145. <div class="text"><?= $name; ?></div>
  146. </div>
  147. <!-- Admin Head END -->
  148.  
  149. <?
  150. }
  151.  
  152. /**
  153. * returns the filename of a path
  154. * @return string
  155. */
  156. function getFile($page_file)
  157. {
  158. $file_name = ereg_replace("/", "_", $page_file);
  159. if (substr($file_name, 0, 1) == "_")
  160. {
  161. $file_name = substr($file_name, 1);
  162. }
  163. return $file_name;
  164. }
  165.  
  166. /**
  167. * returns the folders of a path
  168. * @return string
  169. */
  170. function getFolder($page_file)
  171. {
  172. $folders = explode("/",$page_file);
  173. $str_folder = "";
  174. for ($i = 0; $i < sizeof($folders) - 1; $i++)
  175. {
  176. $str_folder .= $folders[$i]."/";
  177. }
  178. return $str_folder;
  179. }
  180.  
  181. /**
  182. * checks if a staging textblock of a page is temporaly saved (staging)
  183. * @return bool
  184. */
  185. function isStage($page_key,$block)
  186. {
  187. global $site_staging,$db_praefix;
  188. $link = connectDB();
  189. $query = "SELECT page_key FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = $page_key";
  190. $result = mysql_query($query);
  191. closeDB($link);
  192. if (mysql_num_rows($result) == 0)
  193. {
  194. return false;
  195. }
  196. else
  197. {
  198. return true;
  199. }
  200. }
  201.  
  202. /**
  203. * checks if a page has a temporaly saved textblock (staging)
  204. * @return bool
  205. */
  206. function isPageStage($page_key)
  207. {
  208. global $site_staging,$db_praefix;
  209. $link = connectDB();
  210. $query = "SELECT page_key FROM ".$db_praefix."stage WHERE page_key = $page_key";
  211. $result = mysql_query($query);
  212. closeDB($link);
  213. if (mysql_num_rows($result) == 0)
  214. {
  215. return false;
  216. }
  217. else
  218. {
  219. return true;
  220. }
  221. }
  222.  
  223. /**
  224. * returns the content of page by textblock definition
  225. * @return string
  226. */
  227. function staging_output($block)
  228. {
  229. global $page,$db_praefix;
  230. $link = connectDB();
  231. $query = "SELECT stage_input FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = ".$page["page_key"];
  232. $result = mysql_query($query);
  233. closeDB($link);
  234. if (mysql_num_rows($result) == 0)
  235. {
  236. return $page[$block];
  237. }
  238. else
  239. {
  240. $output = mysql_fetch_array($result);
  241. return $output["stage_input"];
  242. }
  243. }
  244.  
  245. /**
  246. * updates the statistic entry of a page
  247. */
  248. function update_statistic($page_key,$page_count)
  249. {
  250. global $db_praefix;
  251. $page_count = $page_count + 1;
  252. $link = connectDB();
  253. $query = "UPDATE ".$db_praefix."page SET page_count = $page_count where page_key = $page_key";
  254. $result = mysql_query($query);
  255. closeDB($link);
  256. }
  257.  
  258. /**
  259. * returns a page by path
  260. * @return array
  261. */
  262. function get_page($page_path)
  263. {
  264. global $db_praefix;
  265.  
  266. $account_status = 0;
  267. $access = "";
  268. if (empty($_GET["export"]))
  269. {
  270. $account_status = $_SESSION["account_group"];
  271. if ($_SESSION["account_group"] == 1)
  272. {
  273. $account_access = $_SESSION["account_access"];
  274. $access = " AND (page_access <= $account_access)";
  275. }
  276. }
  277.  
  278. $link = connectDB();
  279. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_path = '$page_path') AND (page_status <= ".$account_status.") $access";
  280. $result = mysql_query($query);
  281. $menge = mysql_num_fields($result);
  282. $row = mysql_fetch_row ($result);
  283. $page_rows = mysql_num_rows($result);
  284. for($x = 0; $x < $menge; $x++)
  285. {
  286. $page[mysql_field_name($result,$x)] = $row[$x];
  287. }
  288. mysql_free_result($result);
  289. $page["page_rows"] = $page_rows;
  290. if (isset($_GET["template"]))
  291. {
  292. $page["page_template"] = $_GET["template"];
  293. }
  294. closeDB($link);
  295. return $page;
  296. }
  297.  
  298. /**
  299. * returns a page by path
  300. * @return array
  301. */
  302. function get_key_path($page_path)
  303. {
  304. global $db_praefix;
  305.  
  306. $account_status = 0;
  307. $access = "";
  308. if (empty($_GET["export"]))
  309. {
  310. $account_status = $_SESSION["account_group"];
  311. if ($_SESSION["account_group"] == 1)
  312. {
  313. $account_access = $_SESSION["account_access"];
  314. $access = " AND (page_access <= $account_access)";
  315. }
  316. }
  317.  
  318. $link = connectDB();
  319. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_path = '$page_path') AND (page_status <= ".$account_status.") $access";
  320. $result = mysql_query($query);
  321. $menge = mysql_num_fields($result);
  322. $row = mysql_fetch_row ($result);
  323. $page_rows = mysql_num_rows($result);
  324. for($x = 0; $x < $menge; $x++)
  325. {
  326. $page[mysql_field_name($result,$x)] = $row[$x];
  327. }
  328. mysql_free_result($result);
  329. closeDB($link);
  330. return $page;
  331. }
  332.  
  333. /**
  334. * returns a recordset of subpages
  335. * @return resource
  336. */
  337. function get_subpages($page_path)
  338. {
  339. global $db_praefix;
  340.  
  341. $account_status = 0;
  342. $access = "";
  343. if (empty($_GET["export"]))
  344. {
  345. $account_status = $_SESSION["account_group"];
  346. if ($_SESSION["account_group"] == 1)
  347. {
  348. $account_access = $_SESSION["account_access"];
  349. $access = " AND (page_access <= $account_access)";
  350. }
  351. }
  352. $page = get_key_path($page_path);
  353. $page_key = $page["page_key"];
  354. $link = connectDB();
  355. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC";
  356. $result = mysql_query($query);
  357. closeDB($link);
  358. return $result;
  359. }
  360.  
  361. /**
  362. * returns a recordset of subpages order by date
  363. * @return resource
  364. */
  365. function get_subpages_date($page_path,$order)
  366. {
  367. global $db_praefix;
  368.  
  369. $account_status = 0;
  370. $access = "";
  371. if (empty($_GET["export"]))
  372. {
  373. $account_status = $_SESSION["account_group"];
  374. if ($_SESSION["account_group"] == 1)
  375. {
  376. $account_access = $_SESSION["account_access"];
  377. $access = " AND (page_access <= $account_access)";
  378. }
  379. }
  380. $page = get_key_path($page_path);
  381. $page_key = $page["page_key"];
  382. $link = connectDB();
  383. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_date_unformated $order";
  384. $result = mysql_query($query);
  385. closeDB($link);
  386. return $result;
  387. }
  388.  
  389. /**
  390. * returns a recordset of subpages
  391. * @return resource
  392. */
  393. function get_subpages_key($page_key)
  394. {
  395. global $db_praefix;
  396.  
  397. $account_status = 0;
  398. $access = "";
  399. if (empty($_GET["export"]))
  400. {
  401. $account_status = $_SESSION["account_group"];
  402. if ($_SESSION["account_group"] == 1)
  403. {
  404. $account_access = $_SESSION["account_access"];
  405. $access = " AND (page_access <= $account_access)";
  406. }
  407. }
  408. $link = connectDB();
  409. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC";
  410. $result = mysql_query($query);
  411. closeDB($link);
  412. return $result;
  413. }
  414.  
  415. /**
  416. * returns a recordset of subpages limited by a start index and a stepsize
  417. * @return resource
  418. */
  419. function get_subpages_key_limit($page_key,$start,$stepsize)
  420. {
  421. global $db_praefix;
  422.  
  423. $account_status = 0;
  424. $access = "";
  425. if (empty($_GET["export"]))
  426. {
  427. $account_status = $_SESSION["account_group"];
  428. if ($_SESSION["account_group"] == 1)
  429. {
  430. $account_access = $_SESSION["account_access"];
  431. $access = " AND (page_access <= $account_access)";
  432. }
  433. }
  434. $link = connectDB();
  435. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC LIMIT $start, $stepsize";
  436. $result = mysql_query($query);
  437. closeDB($link);
  438. return $result;
  439. }
  440.  
  441. /**
  442. * returns a recordset of subpages orderd by field
  443. * @return resource
  444. */
  445. function get_subpages_alphabetic($page_path,$field)
  446. {
  447. global $db_praefix;
  448.  
  449. $account_status = 0;
  450. $access = "";
  451. if (empty($_GET["export"]))
  452. {
  453. $account_status = $_SESSION["account_group"];
  454. if ($_SESSION["account_group"] == 1)
  455. {
  456. $account_access = $_SESSION["account_access"];
  457. $access = " AND (page_access <= $account_access)";
  458. }
  459. }
  460.  
  461. $page = get_key_path($page_path);
  462. $page_key = $page["page_key"];
  463. $link = connectDB();
  464. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY $field";
  465. $result = mysql_query($query);
  466. closeDB($link);
  467. return $result;
  468. }
  469.  
  470. /**
  471. * returns a searchresult
  472. * @return array
  473. */
  474. function get_searchresult($searchstring,$field_name,$stepsize,$step)
  475. {
  476. global $db_praefix;
  477. $search = array();
  478. $link = connectDB();
  479. $query = "SELECT * FROM ".$db_praefix."page WHERE ($field_name like '%$searchstring%') ORDER BY page_headline";
  480. $result = mysql_query($query);
  481. $maxsearch = mysql_num_rows($result);
  482. $counter = 1;
  483. while ($row = mysql_fetch_array($result))
  484. {
  485. if (($counter >= (($step - 1) * $stepsize)) && ($counter < (($step * $stepsize)) + 1))
  486. {
  487. $search[$counter] = array("search_max" => $maxsearch,"search_counter" => $counter,"page_headline" => $row["page_headline"],"page_title" => $row["page_title"],"page_path" => $row["page_path"],$field_name => $row[$field_name]);
  488. }
  489. $counter++;
  490. }
  491. closeDB($link);
  492. return $search;
  493. }
  494.  
  495. /**
  496. * returns a page by page key
  497. * @return array
  498. */
  499. function get_page_key($page_key)
  500. {
  501. global $db_praefix;
  502.  
  503. $account_status = 0;
  504. $access = "";
  505. if (empty($_GET["export"]))
  506. {
  507. $account_status = $_SESSION["account_group"];
  508. if ($_SESSION["account_group"] == 1)
  509. {
  510. $account_access = $_SESSION["account_access"];
  511. $access = " AND (page_access <= $account_access)";
  512. }
  513. }
  514. $link = connectDB();
  515. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_key) AND (page_status <= ".$account_status.") $access";
  516. $result = mysql_query($query);
  517. $menge = mysql_num_fields($result);
  518. $row = mysql_fetch_row ($result);
  519. $page_rows = mysql_num_rows($result);
  520. for($x = 0; $x < $menge; $x++)
  521. {
  522. $page[mysql_field_name($result,$x)] = $row[$x];
  523. }
  524. mysql_free_result($result);
  525. $page["page_rows"] = $page_rows;
  526. if (isset($_GET["template"]))
  527. {
  528. $page["page_template"] = $_GET["template"];
  529. }
  530. closeDB($link);
  531. return $page;
  532. }
  533.  
  534. /**
  535. * returns a homepage
  536. * @return array
  537. */
  538. function get_homepage($page_start)
  539. {
  540. global $db_praefix;
  541. $account_status = 0;
  542. $access = "";
  543. if (empty($_GET["export"]))
  544. {
  545. $account_status = $_SESSION["account_group"];
  546. if ($_SESSION["account_group"] == 1)
  547. {
  548. $account_access = $_SESSION["account_access"];
  549. $access = " AND (page_access <= $account_access)";
  550. }
  551. }
  552.  
  553. $link = connectDB();
  554. $homepage = array();
  555. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_start) AND (page_status <= ".$account_status.") $access";
  556. $result = mysql_query($query);
  557. $menge = mysql_num_fields($result);
  558. $row = mysql_fetch_row ($result);
  559. $page_rows = mysql_num_rows($result);
  560. for($x = 0; $x < $menge; $x++)
  561. {
  562. $homepage[mysql_field_name($result,$x)] = $row[$x];
  563. }
  564. mysql_free_result($result);
  565. closeDB($link);
  566. return $homepage;
  567. }
  568.  
  569. /**
  570. * returns all start sites
  571. * @return resource
  572. */
  573. function get_homepages()
  574. {
  575. global $db_praefix;
  576. $account_status = 0;
  577. $access = "";
  578. if (empty($_GET["export"]))
  579. {
  580. $account_status = $_SESSION["account_group"];
  581. if ($_SESSION["account_group"] == 1)
  582. {
  583. $account_access = $_SESSION["account_access"];
  584. $access = " AND (page_access <= $account_access)";
  585. }
  586. }
  587.  
  588. $link = connectDB();
  589. $query = "SELECT * FROM ".$db_praefix."page WHERE ((page_start = 1) OR (page_parent = 0)) AND (page_status <= ".$account_status.") $access";
  590. $result = mysql_query($query);
  591. closeDB($link);
  592. return $result;
  593.  
  594. }
  595.  
  596. /**
  597. * returns the path navigation
  598. * @return array
  599. */
  600. function get_path($url_mode)
  601. {
  602. global $db_praefix,$page;
  603. $path = array();
  604. $external = 0;
  605. $account_status = 0;
  606. $access = "";
  607. if (empty($_GET["export"]))
  608. {
  609. $account_status = $_SESSION["account_group"];
  610. if ($_SESSION["account_group"] == 1)
  611. {
  612. $account_access = $_SESSION["account_access"];
  613. $access = " AND (page_access <= $account_access)";
  614. }
  615. }
  616. $link = connectDB();
  617. if (empty($_GET["export"]))
  618. {
  619. $path_url = "website.php?id=".$page["page_path"];
  620. }
  621. else
  622. {
  623. $path_url = getFile($page["page_path"]);
  624. }
  625. $path[0] = array("current" => "1","external" => "0","page_lang" => $page["page_lang"],"page_key" => $page["page_key"],"page_headline" => $page["page_headline"],"page_navigation" => $page["page_navigation"],"page_title" => $page["page_title"],"page_path" => $path_url,"page_template" => $page["page_template"]);
  626. $counter = 1;
  627. $page_parent = $page["page_parent"];
  628. $page_start = $page["page_start"];
  629. while (($page_parent != 0) && ($page_start != 1))
  630. {
  631. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_parent) AND (page_status <= ".$account_status.") $access";
  632. $result = mysql_query($query);
  633. $row = mysql_fetch_array($result);
  634. if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
  635. {
  636. $link_path = $row["page_extern"];
  637. $external = 1;
  638. }
  639. else
  640. {
  641. if (empty($_GET["export"]))
  642. {
  643. $link_path = "website.php?id=".$row["page_path"];
  644. }
  645. else
  646. {
  647. $link_path = getFile($row["page_path"]);
  648. }
  649. }
  650. $path[$counter] = array("current" => "0","external" => $external,"page_lang" => $row["page_lang"],"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_template" => $row["page_template"]);
  651. $counter++;
  652. $page_parent = $row["page_parent"];
  653. $page_start = $row["page_start"];
  654. mysql_free_result($result);
  655. }
  656. $path = array_reverse($path);
  657. closeDB($link);
  658. return $path;
  659. }
  660.  
  661. /**
  662. * returns the primary navigation
  663. * @return array
  664. */
  665. function get_primary($path,$prim_key,$url_mode)
  666. {
  667. global $db_praefix;
  668. $link = connectDB();
  669. $external = 0;
  670. $primary = array();
  671.  
  672. $account_status = 0;
  673. $access = "";
  674. if (empty($_GET["export"]))
  675. {
  676. $account_status = $_SESSION["account_group"];
  677. if ($_SESSION["account_group"] == 1)
  678. {
  679. $account_access = $_SESSION["account_access"];
  680. $access = " AND (page_access <= $account_access)";
  681. }
  682. }
  683.  
  684. if (sizeof($path) > 1)
  685. {
  686. $primarytemp = $path[1];
  687. $page_keycurrent = $primarytemp["page_key"];
  688. $query = "SELECT * FROM ".$db_praefix."page WHERE page_parent = $prim_key AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC";
  689. $result = mysql_query($query);
  690. $counter = 0;
  691. while ($row = mysql_fetch_array ($result))
  692. {
  693. if ($row["page_hide"] == 0)
  694. {
  695. if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
  696. {
  697. $link_path = $row["page_extern"];
  698. $external = 1;
  699. }
  700. else
  701. {
  702. if (empty($_GET["export"]))
  703. {
  704. $link_path = "website.php?id=".$row["page_path"];
  705. }
  706. else
  707. {
  708. $link_path = getFile($row["page_path"]);
  709. }
  710. }
  711. if ($page_keycurrent == $row["page_key"])
  712. {
  713. $primary[$counter] = array("current" => "1","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  714. }
  715. else
  716. {
  717. $primary[$counter] = array("current" => "0","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  718. }
  719. $counter++;
  720. }
  721. }
  722. mysql_free_result($result);
  723. }
  724. else
  725. {
  726. $query = "SELECT * FROM ".$db_praefix."page WHERE page_parent = $prim_key AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC";
  727. $result = mysql_query($query);
  728. $counter = 0;
  729. while ($row = mysql_fetch_array ($result))
  730. {
  731. if ($row["page_hide"] == 0)
  732. {
  733. if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
  734. {
  735. $link_path = $row["page_extern"];
  736. $external = 1;
  737. }
  738. else
  739. {
  740. if (empty($_GET["export"]))
  741. {
  742. $link_path = "website.php?id=".$row["page_path"];
  743. }
  744. else
  745. {
  746. $link_path = getFile($row["page_path"]);
  747. }
  748. }
  749. $primary[$counter] = array("current" => "0","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  750. $counter++;
  751. }
  752. }
  753. mysql_free_result($result);
  754. }
  755. closeDB($link);
  756. return $primary;
  757. }
  758.  
  759. /**
  760. * returns the siblings navigation
  761. * @return array
  762. */
  763. function get_siblings($page,$url_mode)
  764. {
  765. global $db_praefix;
  766. $external = 0;
  767. $account_status = 0;
  768. $access = "";
  769. if (empty($_GET["export"]))
  770. {
  771. $account_status = $_SESSION["account_group"];
  772. if ($_SESSION["account_group"] == 1)
  773. {
  774. $account_access = $_SESSION["account_access"];
  775. $access = " AND (page_access <= $account_access)";
  776. }
  777. }
  778. $siblings = array();
  779. if (($page["page_start"] == 0) && ($page["page_parent"] != 0))
  780. {
  781. $link = connectDB();
  782. $page_parent = $page["page_parent"];
  783. $query = "SELECT * FROM ".$db_praefix."page WHERE page_parent = $page_parent AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_order DESC";
  784. $result = mysql_query($query);
  785. $counter = 0;
  786. while ($row = mysql_fetch_array ($result))
  787. {
  788. if ($row["page_hide"] == 0)
  789. {
  790. if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
  791. {
  792. $link_path = $row["page_extern"];
  793. $external = 1;
  794. }
  795. else
  796. {
  797. if (empty($_GET["export"]))
  798. {
  799. $link_path = "website.php?id=".$row["page_path"];
  800. }
  801. else
  802. {
  803. $link_path = getFile($row["page_path"]);
  804. }
  805. }
  806. if ($page["page_key"] == $row["page_key"])
  807. {
  808. $siblings[$counter] = array("current" => "1","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  809. }
  810. else
  811. {
  812. $siblings[$counter] = array("current" => "0","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  813. }
  814. $counter++;
  815. }
  816. }
  817. mysql_free_result($result);
  818. closeDB($link);
  819. }
  820. return $siblings;
  821. }
  822.  
  823. /**
  824. * returns the children navigation
  825. * @return array
  826. */
  827. function get_childs($page_key,$url_mode)
  828. {
  829. global $db_praefix;
  830. $external = 0;
  831. $account_status = 0;
  832. $access = "";
  833. if (empty($_GET["export"]))
  834. {
  835. $account_status = $_SESSION["account_group"];
  836. if ($_SESSION["account_group"] == 1)
  837. {
  838. $account_access = $_SESSION["account_access"];
  839. $access = " AND (page_access <= $account_access)";
  840. }
  841. }
  842.  
  843. $childs = array();
  844. $link = connectDB();
  845. $query = "SELECT * FROM ".$db_praefix."page WHERE page_parent = $page_key AND (page_status <= ".$account_status.") AND (page_start = 0) $access ORDER BY page_order DESC";
  846. $result = mysql_query($query);
  847. $counter = 0;
  848. while ($row = mysql_fetch_array ($result))
  849. {
  850. if ($row["page_hide"] == 0)
  851. {
  852. if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
  853. {
  854. $link_path = $row["page_extern"];
  855. $external = 1;
  856. }
  857. else
  858. {
  859. if (empty($_GET["export"]))
  860. {
  861. $link_path = "website.php?id=".$row["page_path"];
  862. }
  863. else
  864. {
  865. $link_path = getFile($row["page_path"]);
  866. }
  867. }
  868. $childs[$counter] = array("current" => "0","external" => $external,"page_key" => $row["page_key"],"page_headline" => $row["page_headline"],"page_navigation" => $row["page_navigation"],"page_title" => $row["page_title"],"page_path" => $link_path,"page_att1" => $row["page_att1"],"page_att2" => $row["page_att2"],"page_template" => $row["page_template"]);
  869. $counter++;
  870. }
  871. }
  872. mysql_free_result($result);
  873. closeDB($link);
  874. return $childs;
  875. }
  876.  
  877. /**
  878. * writes a required javascript
  879. */
  880. function writeRequire($formName,$fields)
  881. {
  882. global $db_praefix,$admin_lang;
  883. echo "function checkInput() {";
  884. $strg = "if (";
  885. $counter = 0;
  886. foreach ($fields as $field)
  887. {
  888. $counter = $counter + 1;
  889. $strg = $strg. "(document.".$formName.".".$field.".value != '')";
  890. if ($counter < sizeof($fields))
  891. {
  892. $strg = $strg." && ";
  893. }
  894. }
  895. $strg = $strg.")";
  896. echo $strg;
  897. echo "{ document.".$formName.".submit(); } else { alert ('".$admin_lang["profile"][3]."') }}";
  898. }
  899.  
  900. /**
  901. * returns the status name by status key
  902. * @return string
  903. */
  904. function getStatus($page_status)
  905. {
  906. switch ($page_status)
  907. {
  908. case "0":
  909. return "Released";
  910. break;
  911. case "1":
  912. return "Registered User";
  913. break;
  914. case "2":
  915. return "Locked";
  916. break;
  917. }
  918. }
  919.  
  920. /**
  921. * returns all language packs
  922. * @return resource
  923. */
  924. function get_langs()
  925. {
  926. global $db_praefix;
  927. $link = connectDB();
  928. $query = "SELECT * FROM ".$db_praefix."language ORDER BY lang_short";
  929. $result = mysql_query($query);
  930. closeDB($link);
  931. return $result;
  932. }
  933.  
  934. /**
  935. * returns all templates
  936. * @return resource
  937. */
  938. function get_templates()
  939. {
  940. global $db_praefix;
  941. $link = connectDB();
  942. $query = "SELECT * FROM ".$db_praefix."template ORDER BY template_short";
  943. $result = mysql_query($query);
  944. closeDB($link);
  945. return $result;
  946. }
  947.  
  948. /**
  949. * returns a template by template key
  950. * @return resource
  951. */
  952. function get_template($template_key)
  953. {
  954. global $db_praefix;
  955. $link = connectDB();
  956. $query = "SELECT * FROM ".$db_praefix."template WHERE template_key = $template_key";
  957. $result = mysql_query($query);
  958. closeDB($link);
  959. return $result;
  960. }
  961.  
  962. /**
  963. * returns a template by template key
  964. * @return resource
  965. */
  966. function get_template_page($template_key)
  967. {
  968. global $db_praefix;
  969. $link = connectDB();
  970. $query = "SELECT * FROM ".$db_praefix."template WHERE template_key = $template_key";
  971. $result = mysql_query($query);
  972. $template = mysql_fetch_array($result);
  973. $template_name = $template["template_name"];
  974. $query = "SELECT * FROM ".$db_praefix."page WHERE page_template = '$template_name'";
  975. $result = mysql_query($query);
  976. closeDB($link);
  977. return $result;
  978. }
  979.  
  980. /**
  981. * returns the content of template select
  982. * @return string
  983. */
  984. function get_templateselect($template_name)
  985. {
  986. global $db_praefix;
  987. $link = connectDB();
  988. $query = "SELECT * FROM ".$db_praefix."template WHERE template_name = '$template_name'";
  989. $result = mysql_query($query);
  990. closeDB($link);
  991. $templateselect = mysql_fetch_array($result);
  992. return $templateselect["template_select"];
  993. }
  994.  
  995. /**
  996. * returns all attributes
  997. * @return resource
  998. */
  999. function get_attributes()
  1000. {
  1001. global $db_praefix;
  1002. $link = connectDB();
  1003. $query = "SELECT * FROM ".$db_praefix."attribute ORDER BY att_name";
  1004. $result = mysql_query($query);
  1005. closeDB($link);
  1006. return $result;
  1007. }
  1008.  
  1009. /**
  1010. * returns an attribute by attribute key
  1011. * @return resource
  1012. */
  1013. function get_attribute($att_key)
  1014. {
  1015. global $db_praefix;
  1016. $link = connectDB();
  1017. $query = "SELECT * FROM ".$db_praefix."attribute WHERE att_key = $att_key";
  1018. $result = mysql_query($query);
  1019. closeDB($link);
  1020. return $result;
  1021. }
  1022.  
  1023. /**
  1024. * returns all user groups
  1025. * @return resource
  1026. */
  1027. function get_groups()
  1028. {
  1029. global $db_praefix;
  1030. $link = connectDB();
  1031. $query = "SELECT * FROM ".$db_praefix."group ORDER BY group_order DESC";
  1032. $result = mysql_query($query);
  1033. closeDB($link);
  1034. return $result;
  1035. }
  1036.  
  1037. /**
  1038. * returns a user group by group key
  1039. * @return resource
  1040. */
  1041. function get_group($group_key)
  1042. {
  1043. global $db_praefix;
  1044. $link = connectDB();
  1045. $query = "SELECT * FROM ".$db_praefix."group WHERE group_key = $group_key";
  1046. $result = mysql_query($query);
  1047. closeDB($link);
  1048. return $result;
  1049. }
  1050.  
  1051. /**
  1052. * returns all replacings for export
  1053. * @return resource
  1054. */
  1055. function get_replacings()
  1056. {
  1057. global $db_praefix;
  1058. $link = connectDB();
  1059. $query = "SELECT * FROM ".$db_praefix."replacing ORDER BY re_name";
  1060. $result = mysql_query($query);
  1061. closeDB($link);
  1062. return $result;
  1063. }
  1064.  
  1065. /**
  1066. * returns a replacing by replacing key
  1067. * @return resource
  1068. */
  1069. function get_replacing($re_key)
  1070. {
  1071. global $db_praefix;
  1072. $link = connectDB();
  1073. $query = "SELECT * FROM ".$db_praefix."replacing WHERE re_key = $re_key";
  1074. $result = mysql_query($query);
  1075. closeDB($link);
  1076. return $result;
  1077. }
  1078.  
  1079. /**
  1080. * returns all export folders
  1081. * @return resource
  1082. */
  1083. function get_exportfolders()
  1084. {
  1085. global $db_praefix;
  1086. $link = connectDB();
  1087. $query = "SELECT page_key,page_path,page_title,page_exportfolder FROM ".$db_praefix."page WHERE page_start = 1 ORDER BY page_title";
  1088. $result = mysql_query($query);
  1089. closeDB($link);
  1090. return $result;
  1091. }
  1092.  
  1093. /**
  1094. * returns a export folder by folder key
  1095. * @return resource
  1096. */
  1097. function get_exportfolder($page_key)
  1098. {
  1099. global $db_praefix;
  1100. $link = connectDB();
  1101. $query = "SELECT page_key,page_title,page_exportfolder FROM ".$db_praefix."page WHERE page_key = $page_key";
  1102. $result = mysql_query($query);
  1103. closeDB($link);
  1104. return $result;
  1105. }
  1106.  
  1107. /**
  1108. * returns all accounts
  1109. * @return resource
  1110. */
  1111. function get_accounts()
  1112. {
  1113. global $db_praefix;
  1114. $link = connectDB();
  1115. $query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 0) ORDER BY account_lastname";
  1116. $result = mysql_query($query);
  1117. closeDB($link);
  1118. return $result;
  1119. }
  1120.  
  1121. /**
  1122. * returns all active accounts of the group registered users
  1123. * @return resource
  1124. */
  1125. function get_freeaccounts()
  1126. {
  1127. global $db_praefix;
  1128. $link = connectDB();
  1129. $query = "SELECT * FROM ".$db_praefix."account WHERE (account_group = 1) AND (account_lock = 0) ORDER BY account_lastname";
  1130. $result = mysql_query($query);
  1131. closeDB($link);
  1132. return $result;
  1133. }
  1134.  
  1135. /**
  1136. * returns all active authors and administrators
  1137. * @return resource
  1138. */
  1139. function get_adminaccounts()
  1140. {
  1141. global $db_praefix;
  1142. $link = connectDB();
  1143. $query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 1) AND (account_group != 0) AND (account_lock = 0) ORDER BY account_lastname";
  1144. $result = mysql_query($query);
  1145. closeDB($link);
  1146. return $result;
  1147. }
  1148.  
  1149. /**
  1150. * returns all active accounts with newsletter flag
  1151. * @return resource
  1152. */
  1153. function get_infoaccounts()
  1154. {
  1155. global $db_praefix;
  1156. $link = connectDB();
  1157. $query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 0) AND (account_lock = 0) AND (account_info = 1) ORDER BY account_lastname";
  1158. $result = mysql_query($query);
  1159. closeDB($link);
  1160. return $result;
  1161. }
  1162.  
  1163. /**
  1164. * returns a account search result
  1165. * @return resource
  1166. */
  1167. function search_accounts($accounts_lastname,$accounts_email,$accounts_group)
  1168. {
  1169. global $db_praefix;
  1170. $link = connectDB();
  1171. $query = "SELECT * FROM ".$db_praefix."account WHERE (account_lastname like '$accounts_lastname%') AND (account_email like '%$accounts_email%') AND (account_group = $accounts_group) ORDER BY account_lastname";
  1172. $result = mysql_query($query);
  1173. closeDB($link);
  1174. return $result;
  1175. }
  1176.  
  1177. /**
  1178. * updates an account record
  1179. */
  1180. function updateAccount($page_key,$accountn_key,$accountn_email,$accountn_password,$accountn_firstname,$accountn_lastname,$accountn_telefon,$accountn_company,$accountn_homepage,$accountn_group,$accountn_lock,$accountn_info,$accountn_lang,$accountn_editor,$accountn_access,$accountn_menu)
  1181. {
  1182. global $db_praefix;
  1183. $link = connectDB();
  1184. if ($accountn_password != "")
  1185. {
  1186. $accountn_password = md5($accountn_password);
  1187. $query = "UPDATE ".$db_praefix."account SET account_password = '$accountn_password' WHERE account_key = $accountn_key";
  1188. $result = mysql_query($query);
  1189. }
  1190. $query = "UPDATE ".$db_praefix."account SET account_email = '$accountn_email', account_firstname = '$accountn_firstname', account_lastname = '$accountn_lastname', account_telefon = '$accountn_telefon', account_company = '$accountn_company', account_lang = '$accountn_lang', account_homepage = '$accountn_homepage', account_group = $accountn_group, account_lock = $accountn_lock, account_info = $accountn_info, account_editor = '$accountn_editor', account_access = $accountn_access, account_menu = $accountn_menu WHERE account_key = $accountn_key";
  1191. $result = mysql_query($query);
  1192. closeDB($link);
  1193. $pagekey = get_page_key($page_key);
  1194. ?>
  1195. <script language="JavaScript">
  1196. location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=accounts";
  1197. </script>
  1198. <?
  1199. }
  1200.  
  1201. /**
  1202. * returns an account by accout key
  1203. * @return resource
  1204. */
  1205. function get_account($account_key)
  1206. {
  1207. global $db_praefix;
  1208. $link = connectDB();
  1209. $query = "SELECT * FROM ".$db_praefix."account WHERE account_key = $account_key";
  1210. $result = mysql_query($query);
  1211. closeDB($link);
  1212. return $result;
  1213. }
  1214.  
  1215. /**
  1216. * inserts an account record
  1217. */
  1218. function addAccount($page_key,$accountn_email,$accountn_password,$accountn_firstname,$accountn_lastname,$accountn_telefon,$accountn_company,$accountn_group,$accountn_lock)
  1219. {
  1220. global $db_praefix;
  1221. $link = connectDB();
  1222. $query = "SELECT * FROM ".$db_praefix."account WHERE account_email = '$accountn_email'";
  1223. $result2 = mysql_query($query);
  1224. closeDB($link);
  1225.  
  1226. if (mysql_num_rows($result2) == 0)
  1227. {
  1228. $accountn_password = md5($accountn_password);
  1229. $link = connectDB();
  1230. $query = "INSERT ".$db_praefix."account (account_email,account_password,account_firstname,account_lastname,account_telefon,account_company,account_group,account_lock) VALUES ('$accountn_email','$accountn_password','$accountn_firstname','$accountn_lastname','$accountn_telefon','$accountn_company','$accountn_group','$accountn_lock')";
  1231. $result = mysql_query($query);
  1232. closeDB($link);
  1233. $pagekey = get_page_key($page_key);
  1234. ?>
  1235. <script language="JavaScript">
  1236. location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=accounts";
  1237. </script>
  1238. <?
  1239. }
  1240. else
  1241. {
  1242. ?>
  1243. <script language="JavaScript">
  1244. alert("Username exists!");
  1245. location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=accounts&action=addaccount";
  1246. </script>
  1247. <?
  1248. }
  1249. }
  1250.  
  1251. /**
  1252. * deletes an account record
  1253. */
  1254. function deleteAccount($account_key)
  1255. {
  1256. global $db_praefix;
  1257. $link = connectDB();
  1258. $query = "DELETE FROM ".$db_praefix."account WHERE account_key = $account_key";
  1259. $result = mysql_query($query);
  1260. closeDB($link);
  1261. }
  1262.  
  1263. /**
  1264. * updates a content of a page
  1265. */
  1266. function updateText($page_key,$page_edit,$page_input)
  1267. {
  1268. global $db_praefix,$site_url,$site_staging,$site_admin;
  1269. $link = connectDB();
  1270. $page_input = ereg_replace($site_url."/","",$page_input);
  1271. $page_input = ereg_replace("'","&#039;", $page_input);
  1272. $page_input = ereg_replace("<oe:site_url/>",$site_url, $page_input);
  1273. $page_input = ereg_replace("<oe:site_admin/>",$site_admin, $page_input);
  1274. if ($site_staging == 0)
  1275. {
  1276. $query = "UPDATE ".$db_praefix."page SET $page_edit = '$page_input' WHERE page_key = $page_key";
  1277. $result = mysql_query($query);
  1278. }
  1279. else
  1280. {
  1281. $query = "SELECT stage_key FROM ".$db_praefix."stage WHERE stage_edit = '$page_edit' AND page_key = $page_key";
  1282. $result = mysql_query($query);
  1283. if (mysql_num_rows($result) == 0)
  1284. {
  1285. $query = "INSERT ".$db_praefix."stage (page_key,stage_edit,stage_input) VALUES ('$page_key','$page_edit','$page_input')";
  1286. $result = mysql_query($query);
  1287. }
  1288. else
  1289. {
  1290. $query = "UPDATE ".$db_praefix."stage SET stage_input = '$page_input' WHERE stage_edit = '$page_edit' AND page_key = $page_key";
  1291. $result = mysql_query($query);
  1292. }
  1293. }
  1294. closeDB($link);
  1295. $pagekey = get_page_key($page_key);
  1296. ?>
  1297. <script language="JavaScript">
  1298. window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
  1299. window.close();
  1300. </script>
  1301. <?
  1302. }
  1303.  
  1304. /**
  1305. * updates a content of a page
  1306. */
  1307. function updateTextNoCache($page_key,$page_edit,$page_input)
  1308. {
  1309. global $db_praefix,$site_url,$site_staging,$site_admin;
  1310. $link = connectDB();
  1311. $page_input = ereg_replace($site_url."/","",$page_input);
  1312. $page_input = ereg_replace("'","&#039;", $page_input);
  1313. $query = "UPDATE ".$db_praefix."page SET $page_edit = '$page_input' WHERE page_key = $page_key";
  1314. $result = mysql_query($query);
  1315. closeDB($link);
  1316. $pagekey = get_page_key($page_key);
  1317. $pageparent = get_page_key($pagekey["page_parent"]);
  1318. ?>
  1319. <script language="JavaScript">
  1320. window.opener.location.href = "website.php?id=<?= $pageparent["page_path"]; ?>";
  1321. window.close();
  1322. </script>
  1323. <?
  1324. }
  1325.  
  1326. /**
  1327. * returns the next navigation
  1328. * @return array
  1329. */
  1330. function nextpage()
  1331. {
  1332. global $db_praefix,$page;
  1333. $account_status = 0;
  1334. $access = "";
  1335. if (empty($_GET["export"]))
  1336. {
  1337. $account_status = $_SESSION["account_group"];
  1338. if ($_SESSION["account_group"] == 1)
  1339. {
  1340. $account_access = $_SESSION["account_access"];
  1341. $access = " AND (page_access <= $account_access)";
  1342. }
  1343. }
  1344. $link = connectDB();
  1345. $parent_key = $page["page_parent"];
  1346. $page_order = $page["page_order"] - 1;
  1347. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $parent_key) AND (page_order = $page_order) AND (page_status <= ".$account_status.") $access AND (page_start = 0)";
  1348. $result = mysql_query($query);
  1349. closeDB($link);
  1350. $next_array = mysql_fetch_array($result);
  1351. return $next_array;
  1352. }
  1353.  
  1354. /**
  1355. * returns the back navigation
  1356. * @return array
  1357. */
  1358. function backpage()
  1359. {
  1360. global $db_praefix,$page;
  1361. $account_status = 0;
  1362. $access = "";
  1363. if (empty($_GET["export"]))
  1364. {
  1365. $account_status = $_SESSION["account_group"];
  1366. if ($_SESSION["account_group"] == 1)
  1367. {
  1368. $account_access = $_SESSION["account_access"];
  1369. $access = " AND (page_access <= $account_access)";
  1370. }
  1371. }
  1372. $link = connectDB();
  1373. $parent_key = $page["page_parent"];
  1374. $page_order = $page["page_order"] + 1;
  1375. $query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $parent_key) AND (page_order = $page_order) AND (page_status <= ".$account_status.") $access AND (page_start = 0)";
  1376. $result = mysql_query($query);
  1377. closeDB($link);
  1378. $back_array = mysql_fetch_array($result);
  1379. return $back_array;
  1380. }
  1381.  
  1382. /**
  1383. * writes admin log in folder /logfiles
  1384. */
  1385. function writeLog($log_user,$log_action,$log_page)
  1386. {
  1387. global $log_path;
  1388. if ($log_path != "")
  1389. {
  1390. $log_time = date("ymdhis");
  1391. $log_file = $log_path."/admin_log.csv";
  1392. $fp = fopen($log_file,"a");
  1393. $log_text = $log_user.";".$log_action.";".$log_page.";".$log_time."\n";
  1394. fputs($fp,$log_text);
  1395. fclose($fp);
  1396. }
  1397. }
  1398.  
  1399. /**
  1400. * returns string pool value
  1401. * @return string
  1402. */
  1403. function stringpool($name,$select)
  1404. {
  1405. global $db_praefix;
  1406. $link = connectDB();
  1407. $query = "SELECT * FROM ".$db_praefix."stringpool WHERE str_name = '$name' AND str_select = '$select'";
  1408. $result = mysql_query($query);
  1409. if (mysql_num_rows($result) == 0)
  1410. {
  1411. return "";
  1412. }
  1413. else
  1414. {
  1415. $stringpool_arr = mysql_fetch_array($result);
  1416. return $stringpool_arr["str_value"];
  1417. }
  1418. closeDB($link);
  1419. }
  1420.  
  1421. /**
  1422. * check if $page_parent is a parent page of the current page
  1423. * @return bool
  1424. */
  1425. function isParent($parent_key)
  1426. {
  1427. global $path;
  1428. $isParent = false;
  1429. if (isset($path))
  1430. {
  1431. foreach ($path as $value)
  1432. {
  1433. if ($value["page_key"] == $parent_key)
  1434. {
  1435. $isParent = true;
  1436. }
  1437. }
  1438. }
  1439. return $isParent;
  1440. }
  1441. ?>

Documentation generated on Tue, 16 Aug 2005 17:32:18 +0200 by phpDocumentor 1.3.0RC3