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

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