/*
http://www.openengine.de
mail@openengine.de
Copyright (C) 2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
?>
/**
* MySQL Server
* @var string
*/
$db_server = "localhost";
/**
* MySQL Username
* @var string
*/
$db_user = "kleindvt";
/**
* MySQL Password
* @var string
*/
$db_password = "Mghm287$";
/**
* MySQL Database for openEngine
* @var string
*/
$db_name = "kleindvt";
/**
* Table Praefix
* (for more than one openEngine Installation in a single database)
* @var string
*/
$db_praefix = "mueller_";
?>
/**
* settings.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
include("system/generator/database.php");
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."settings";
$result = mysql_query($query);
closeDB($link);
$settings_array = mysql_fetch_array($result);
/**
* Name of your Website
* @var string
*/
$site_name = $settings_array["site_name"];
/**
* E-mail Adress of Administrator
* @var string
*/
$site_admin = $settings_array["site_admin"];
/**
* openEngine path to the default homepage
* @var string
*/
$site_home = $settings_array["site_home"];
/**
* openEngine path to the internal filepool
* @var string
*/
$pool_path = $settings_array["pool_path"];
/**
* path to logfiles
* @var string
*/
$log_path = $settings_array["log_path"];
/**
* staging mode on (= 1) or off (= 0)
* @var int
*/
$site_staging = $settings_array["site_staging"];
/**
* Security Check UserAgent, yes (= 0) or no (= 1)
* @var int
*/
$check_useragent = $settings_array["check_useragent"];
/**
* allow authors to release, yes (= 1) or no (= 0)
* @var int
*/
$author_release = $settings_array["author_release"];
/**
* allow authors to edit their profil, yes (= 1) or no (= 0)
* @var int
*/
$author_profile = $settings_array["author_profile"];
/**
* path to a static export for a direct redirect
* @var string
*/
$site_static = $settings_array["site_static"];
/**
* url of your website
* @var string
*/
$site_url = $settings_array["site_url"];
/**
* default language item
* @var string
*/
$lang_default = $settings_array["lang_default"];
/**
* external users have a active account status after registration, yes (= 0) or no (= 1)
* @var int
*/
$account_register = $settings_array["account_register"];
/**
* allow authors to export the page, yes (= 1) or no (= 0)
* @var int
*/
$author_export = $settings_array["author_export"];
/**
* css content
* @var string
*/
$site_css = $settings_array["site_css"];
$site_css .= "/* openEngine - System */ \n";
$site_css .= ".oe_comment { font-family: Verdana, Arial, Helvetica, sans-serif; border:1px solid red; font-size:11px; color: red; padding: 3px; display:block; font-weight:normal; line-height:17px; background-color:#FFF; }";
/**
* link to the openEngine documentation
* @var string
*/
$site_help = $settings_array["site_help"];
/**
* top position for the admin starter button
* @var int
*/
$menu_top = $settings_array["menu_top"];
/**
* allow authors to delete pages
* @var int
*/
$author_delete = $settings_array["author_delete"];
/**
* site character set
* @var string
*/
$site_encoding = "";
if ($settings_array["site_encoding"] != "")
{
$site_encoding = $settings_array["site_encoding"];
}
else
{
$site_encoding = "iso-8859-1";
}
/**
* newsletter stepsize
* @var int
*/
$nl_stepsize = $settings_array["nl_stepsize"];
/**
* newsletter timer
* @var int
*/
$nl_timer = $settings_array["nl_timer"];
/**
* newsletter character set
* @var string
*/
$nl_encoding = "";
if ($settings_array["nl_encoding"] != "")
{
$nl_encoding = $settings_array["nl_encoding"];
}
else
{
$nl_encoding = "iso-8859-1";
}
/**
* export stepsize
* @var int
*/
$export_stepsize = $settings_array["export_stepsize"];
/**
* export timer
* @var int
*/
$export_timer = $settings_array["export_timer"];
/**
* tree_static
* @var int
*/
$tree_static = $settings_array["tree_static"];
/**
* path to filepool
* @var string
*/
$url_pool = "/img/pool";
/**
* relative link to filepool
* @var string
*/
$link_pool = "img/pool";
/**
* relative link to filepool
* @var string
*/
$site_pool = $link_pool;
/**
* generator name
* @var string
*/
$system_generator = "openEngine 1.7 Version 050825 - Open Source Web Content Management System (c) 2005 - http://www.openengine.de";
/**
* generator html name
* @var string
*/
$system_html = "openEngine 1.7 Version 050825 Open Source Web Content Management System © 2005http://www.openengine.de ";
/**
* generator short name
* @var string
*/
$system_short = "openEngine 1.7";
/**
* fingerprint
* @var string
*/
if (!isset($_GET["export"]))
{
$system_fingerprint = md5($_SERVER["HTTP_USER_AGENT"]."oe_17");
}
/**
* updates the settings record
*/
function updateSettings($page_key,$site_name,$site_admin,$site_home,$site_url,$lang_default,$account_register,$pool_path,$site_staging,$author_release,$author_profile,$site_static,$author_export,$site_help,$menu_top,$site_encoding,$nl_timer,$nl_stepsize,$nl_encoding,$export_timer,$export_stepsize,$author_delete,$tree_static,$check_useragent,$log_path)
{
global $db_praefix;
$link = connectDB();
$query = "UPDATE ".$db_praefix."settings SET site_url = '$site_url',site_name = '$site_name',site_admin = '$site_admin',site_home = '$site_home',lang_default = '$lang_default',account_register = $account_register,pool_path = '$pool_path',site_staging = $site_staging,author_release = $author_release,author_profile = $author_profile,site_static = '$site_static',author_export = $author_export,site_help = '$site_help',menu_top = $menu_top,site_encoding = '$site_encoding',nl_timer = $nl_timer,nl_stepsize = $nl_stepsize,nl_encoding = '$nl_encoding',export_timer = $export_timer,export_stepsize = $export_stepsize,author_delete = $author_delete,tree_static = $tree_static,check_useragent = $check_useragent,log_path = '$log_path'";
$result = mysql_query($query);
$_SESSION["site_url_key"] = $site_url;
closeDB($link);
$pagekey = get_page_key($page_key);
?>
}
?>
/**
* session.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
if (empty($_GET["export"]))
{
session_name("sid");
session_start();
if (!isset($_SESSION["initiated"]))
{
if ($check_useragent == 1)
{
session_regenerate_id();
}
$_SESSION['initiated'] = true;
setGuest();
}
if ($_SESSION["site_url_key"] != $site_url)
{
setGuest();
}
if (SID != '')
{
ob_start('rewriteURL');
}
if ($check_useragent == 1)
{
if ((isset($_SESSION["account_group"])) && (isset($_SESSION["HTTP_USER_AGENT"])))
{
if ($_SESSION["HTTP_USER_AGENT"] != $system_fingerprint)
{
setGuest();
}
}
else
{
$_SESSION["HTTP_USER_AGENT"] = $system_fingerprint;
setGuest();
}
}
else
{
if (empty($_SESSION["account_group"]))
{
setGuest();
}
}
}
if (empty($_SESSION["account_group"]))
{
setGuest();
}
/**
* Rewrites URL
* @return string
*/
function rewriteURL($strBuffer)
{
if (!isAdmin())
{
$sid = session_id();
$strBuffer = preg_replace('#website.php\?id=(/.+)(\'|")#U','website.php?sid='.$sid.'&id=\\1\\2',$strBuffer);
}
return $strBuffer;
}
/**
* sets the SESSION to the guest status
*/
function setGuest()
{
global $db_praefix,$site_url;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE account_group = 0";
$result = mysql_query($query);
$menge = mysql_num_fields($result);
$row = mysql_fetch_row($result);
$user_rows = mysql_num_rows($result);
for($x = 0; $x < $menge; $x++)
{
$_SESSION[mysql_field_name($result,$x)] = $row[$x];
}
$_SESSION["site_url_key"] = $site_url;
closeDB($link);
}
/**
* user login function external
* @return bool
*/
function login($account_email,$account_password,$page_pathn)
{
global $db_praefix,$site_url;
$account_password = md5($account_password);
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_email = '$account_email') AND (account_password = '$account_password') AND (account_lock = 0)";
$result = mysql_query($query);
closeDB($link);
$user_rows = mysql_num_rows($result);
if ($user_rows == 1)
{
$menge = mysql_num_fields($result);
$row = mysql_fetch_row($result);
for($x = 0; $x < $menge; $x++)
{
$_SESSION[mysql_field_name($result,$x)] = $row[$x];
}
return true;
}
else
{
return false;
}
}
/**
* user login function internal
* @return bool
*/
function loginInt($account_email,$account_password,$page_pathn)
{
global $db_praefix,$site_url;
$account_password = md5($account_password);
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_email = '$account_email') AND (account_password = '$account_password') AND (account_lock = 0)";
$result = mysql_query($query);
closeDB($link);
$user_rows = mysql_num_rows($result);
if ($user_rows == 1)
{
$menge = mysql_num_fields($result);
$row = mysql_fetch_row($result);
for($x = 0; $x < $menge; $x++)
{
$_SESSION[mysql_field_name($result,$x)] = $row[$x];
}
if (isAdmin())
{
?>
}
else
{
?>
}
return true;
}
else
{
return false;
}
}
/**
* user logout function external
*/
function logout($page_path)
{
global $check_useragent;
if ($check_useragent == 1)
{
session_regenerate_id();
}
$page_new = get_page($page_path);
setGuest();
if ($page_new["page_status"] != 0)
{
?>
}
}
/**
* user logout function internal
*/
function logoutInt($page_path)
{
global $check_useragent;
if ($check_useragent == 1)
{
session_regenerate_id();
}
setGuest();
?>
}
/**
* external user password e-mail
*/
function getAccountExt($accountn_email)
{
global $site_url,$db_praefix,$site_home,$site_name,$site_admin,$admin_lang,$nl_encoding;
if ($accountn_email != "")
{
$link = connectDB();
$query = "SELECT account_key FROM ".$db_praefix."account WHERE account_email = '$accountn_email' and account_group = 1";
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) == 1)
{
$acc_key = mysql_fetch_array($result);
$account_key = $acc_key["account_key"];
$pass_new_output = rand(10000000,99999999);
$pass_new = md5($pass_new_output);
$link = connectDB();
$query = "UPDATE ".$db_praefix."account SET account_password = '$pass_new' WHERE account_key = $account_key";
$result = mysql_query($query);
closeDB($link);
require("system/admin/phpmailer/class.phpmailer.php");
$mail = new phpmailer();
$mail->From = $site_admin;
$mail->FromName = "";
$mail->AddAddress($accountn_email);
$mail->Subject = $site_name;
$mail->Encoding = "8bit";
$mail->CharSet = $nl_encoding;
$text_body = "Your Password: ".$pass_new_output;
$mail->Body = $text_body;
$mail->Send();
$mail->ClearAddresses();
$mail->ClearAttachments();
?>
}
else
{
?>
}
}
}
/**
* external user deletion
*/
function deleteAccountExt($accountn_email,$accountn_key)
{
global $site_url,$db_praefix,$site_home,$site_name,$site_admin,$admin_lang;
if ($accountn_email != "")
{
$link = connectDB();
$query = "DELETE FROM ".$db_praefix."account WHERE account_email = '$accountn_email' and account_key = $accountn_key";
$result = mysql_query($query);
closeDB($link);
setGuest();
?>
}
}
/**
* extrenal user registration
*/
function newAccountExt($accountn_firstname,$accountn_lastname,$accountn_telefon,$accountn_company,$accountn_homepage,$accountn_email,$accountn_password,$accountn_info,$accountn_lock,$link_redirect)
{
global $site_url,$db_praefix,$site_home,$admin_lang,$account_register;
$link = connectDB();
$query = "SELECT account_key FROM ".$db_praefix."account WHERE account_email = '$accountn_email'";
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) == 0)
{
$accountn_passwordold = $accountn_password;
$accountn_password = md5($accountn_password);
$link = connectDB();
$query = "INSERT ".$db_praefix."account (account_email,account_password,account_firstname,account_lastname,account_telefon,account_company,account_homepage,account_group,account_info,account_lock) VALUES ('$accountn_email','$accountn_password','$accountn_firstname','$accountn_lastname','$accountn_telefon','$accountn_company','$accountn_homepage','1','$accountn_info','$accountn_lock')";
$result = mysql_query($query);
closeDB($link);
?>
if ($account_register == 0)
{
login($accountn_email,$accountn_passwordold,$link_redirect);
}
else
{
?>
}
}
else
{
?>
}
}
/**
* external user update
*/
function updateAccountExt($accountn_firstname,$accountn_lastname,$accountn_telefon,$accountn_company,$accountn_homepage,$accountn_email,$accountn_emailnew,$accountn_password,$accountn_key,$accountn_lang,$accountn_info)
{
global $site_url,$db_praefix,$admin_lang;
$checker = true;
if ($accountn_email != $accountn_emailnew)
{
$link = connectDB();
$query = "SELECT account_key FROM ".$db_praefix."account WHERE account_email = '$accountn_emailnew'";
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) != 0)
{
?>
$checker = false;
}
}
if ($checker == true)
{
$link = connectDB();
if ($accountn_password != "")
{
$accountn_password = md5($accountn_password);
$query = "UPDATE ".$db_praefix."account SET account_password = '$accountn_password' WHERE account_key = $accountn_key";
$result = mysql_query($query);
$_SESSION["account_password"] = $accountn_password;
}
$query = "UPDATE ".$db_praefix."account SET account_email = '$accountn_emailnew', account_firstname = '$accountn_firstname', account_lastname = '$accountn_lastname', account_telefon = '$accountn_telefon', account_company = '$accountn_company', account_homepage = '$accountn_homepage', account_lang = '$accountn_lang', account_info = $accountn_info WHERE account_key = $accountn_key";
$result = mysql_query($query);
closeDB($link);
$_SESSION["account_email"] = $accountn_emailnew;
$_SESSION["account_firstname"] = $accountn_firstname;
$_SESSION["account_lastname"] = $accountn_lastname;
$_SESSION["account_company"] = $accountn_company;
$_SESSION["account_homepage"] = $accountn_homepage;
$_SESSION["account_telefon"] = $accountn_telefon;
$_SESSION["account_info"] = $accountn_info;
$_SESSION["account_lang"] = $accountn_lang;
?>
}
}
/**
* returns all admin accounts
* @return resource
*/
function get_Admins()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE account_group = 2 ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all author accounts
* @return resource
*/
function get_Authors()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE account_group = 3 ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* return the group name by group key
* @return string
*/
function getGroup($account_group)
{
switch ($account_group)
{
case "1":
return "User";
break;
case "2":
return "Administrator";
break;
case "3":
return "Author";
break;
}
}
/**
* check the login status for administrators and authors
* @return bool
*/
function isAdmin()
{
if (isset($_GET["preview"]))
{
return false;
}
else
{
if ($_SESSION["account_group"] > 1)
{
return true;
}
else
{
return false;
}
}
}
/**
* saves the admin menu position
*/
function saveMenu($page_key,$accountn_menux,$accountn_menuy)
{
global $db_praefix;
$accountn_key = $_SESSION["account_key"];
$accountn_menux = str_replace("px", "", $accountn_menux);
$accountn_menuy = str_replace("px", "", $accountn_menuy);
$link = connectDB();
$query = "UPDATE ".$db_praefix."account SET account_menux = $accountn_menux, account_menuy = $accountn_menuy where account_key = $accountn_key";
$result = mysql_query($query);
closeDB($link);
$_SESSION["account_menux"] = $accountn_menux;
$_SESSION["account_menuy"] = $accountn_menuy;
$pagekey = get_page_key($page_key);
?>
}
?>
/**
* admin.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
/**
* Writes a cancel button
*/
function writeCancel($link)
{
echo ' ';
}
/**
* Writes an OK button
*/
function writeOk($link)
{
echo ' ';
}
/**
* Writes a back button
*/
function writeBack($link)
{
echo ' ';
}
/**
* Writes a menu item
*/
function writeOeLink($title,$link,$icon)
{
?>
}
/**
* writes the admin menu header
*/
function getAdminHead($name,$img,$control = "")
{
global $admin_lang,$page,$site_help;
?>
if ($control == "yes") { ?>
} ?>
}
/**
* returns the filename of a path
* @return string
*/
function getFile($page_file)
{
$file_name = ereg_replace("/", "_", $page_file);
if (substr($file_name, 0, 1) == "_")
{
$file_name = substr($file_name, 1);
}
return $file_name;
}
/**
* returns the folders of a path
* @return string
*/
function getFolder($page_file)
{
$folders = explode("/",$page_file);
$str_folder = "";
for ($i = 0; $i < sizeof($folders) - 1; $i++)
{
$str_folder .= $folders[$i]."/";
}
return $str_folder;
}
/**
* checks if a staging textblock of a page is temporaly saved (staging)
* @return bool
*/
function isStage($page_key,$block)
{
global $site_staging,$db_praefix;
$link = connectDB();
$query = "SELECT page_key FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = $page_key";
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) == 0)
{
return false;
}
else
{
return true;
}
}
/**
* checks if a page has a temporaly saved textblock (staging)
* @return bool
*/
function isPageStage($page_key)
{
global $site_staging,$db_praefix;
$link = connectDB();
$query = "SELECT page_key FROM ".$db_praefix."stage WHERE page_key = $page_key";
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) == 0)
{
return false;
}
else
{
return true;
}
}
/**
* returns the content of page by textblock definition
* @return string
*/
function staging_output($block)
{
global $page,$db_praefix;
$link = connectDB();
$query = "SELECT stage_input FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = ".$page["page_key"];
$result = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result) == 0)
{
return $page[$block];
}
else
{
$output = mysql_fetch_array($result);
return $output["stage_input"];
}
}
/**
* updates the statistic entry of a page
*/
function update_statistic($page_key,$page_count)
{
global $db_praefix;
$page_count = $page_count + 1;
$link = connectDB();
$query = "UPDATE ".$db_praefix."page SET page_count = $page_count where page_key = $page_key";
$result = mysql_query($query);
closeDB($link);
}
/**
* returns a page by path
* @return array
*/
function get_page($page_path)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_path = '$page_path') AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
$menge = mysql_num_fields($result);
$row = mysql_fetch_row ($result);
$page_rows = mysql_num_rows($result);
for($x = 0; $x < $menge; $x++)
{
$page[mysql_field_name($result,$x)] = $row[$x];
}
mysql_free_result($result);
$page["page_rows"] = $page_rows;
if (isset($_GET["template"]))
{
$page["page_template"] = $_GET["template"];
}
closeDB($link);
return $page;
}
/**
* returns a page by path
* @return array
*/
function get_key_path($page_path)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_path = '$page_path') AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
$menge = mysql_num_fields($result);
$row = mysql_fetch_row ($result);
$page_rows = mysql_num_rows($result);
for($x = 0; $x < $menge; $x++)
{
$page[mysql_field_name($result,$x)] = $row[$x];
}
mysql_free_result($result);
closeDB($link);
return $page;
}
/**
* returns a recordset of subpages
* @return resource
*/
function get_subpages($page_path)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$page = get_key_path($page_path);
$page_key = $page["page_key"];
$link = connectDB();
$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";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages order by date
* @return resource
*/
function get_subpages_date($page_path,$order)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$page = get_key_path($page_path);
$page_key = $page["page_key"];
$link = connectDB();
$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";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages
* @return resource
*/
function get_subpages_key($page_key)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$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";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages order alphabetic up
* @return resource
*/
function get_subpages_key_up($page_key)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_navigation";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages order alphabetic up
* @return resource
*/
function get_subpages_key_down($page_key)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY page_navigation DESC";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages limited by a start index and a stepsize
* @return resource
*/
function get_subpages_key_limit($page_key,$start,$stepsize)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$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";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a recordset of subpages orderd by field
* @return resource
*/
function get_subpages_alphabetic($page_path,$field)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$page = get_key_path($page_path);
$page_key = $page["page_key"];
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_parent = $page_key) AND (page_status <= ".$account_status.") $access AND (page_start = 0) ORDER BY $field";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a searchresult
* @return array
*/
function get_searchresult($searchstring,$field_name,$stepsize,$step)
{
global $db_praefix;
$search = array();
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE ($field_name like '%$searchstring%') ORDER BY page_headline";
$result = mysql_query($query);
$maxsearch = mysql_num_rows($result);
$counter = 1;
while ($row = mysql_fetch_array($result))
{
if (($counter >= (($step - 1) * $stepsize)) && ($counter < (($step * $stepsize)) + 1))
{
$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]);
}
$counter++;
}
closeDB($link);
return $search;
}
/**
* returns a page by page key
* @return array
*/
function get_page_key($page_key)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_key) AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
$menge = mysql_num_fields($result);
$row = mysql_fetch_row ($result);
$page_rows = mysql_num_rows($result);
for($x = 0; $x < $menge; $x++)
{
$page[mysql_field_name($result,$x)] = $row[$x];
}
mysql_free_result($result);
$page["page_rows"] = $page_rows;
if (isset($_GET["template"]))
{
$page["page_template"] = $_GET["template"];
}
closeDB($link);
return $page;
}
/**
* returns a homepage
* @return array
*/
function get_homepage($page_start)
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$homepage = array();
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_start) AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
$menge = mysql_num_fields($result);
$row = mysql_fetch_row ($result);
$page_rows = mysql_num_rows($result);
for($x = 0; $x < $menge; $x++)
{
$homepage[mysql_field_name($result,$x)] = $row[$x];
}
mysql_free_result($result);
closeDB($link);
return $homepage;
}
/**
* returns all start sites
* @return resource
*/
function get_homepages()
{
global $db_praefix;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."page WHERE ((page_start = 1) OR (page_parent = 0)) AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns the path navigation
* @return array
*/
function get_path($url_mode)
{
global $db_praefix,$page;
$path = array();
$external = 0;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
if (empty($_GET["export"]))
{
$path_url = "website.php?id=".$page["page_path"];
}
else
{
$path_url = getFile($page["page_path"]);
}
$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"]);
$counter = 1;
$page_parent = $page["page_parent"];
$page_start = $page["page_start"];
while (($page_parent != 0) && ($page_start != 1))
{
$query = "SELECT * FROM ".$db_praefix."page WHERE (page_key = $page_parent) AND (page_status <= ".$account_status.") $access";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
{
$link_path = $row["page_extern"];
$external = 1;
}
else
{
if (empty($_GET["export"]))
{
$link_path = "website.php?id=".$row["page_path"];
}
else
{
$link_path = getFile($row["page_path"]);
}
}
$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"]);
$counter++;
$page_parent = $row["page_parent"];
$page_start = $row["page_start"];
mysql_free_result($result);
}
$path = array_reverse($path);
closeDB($link);
return $path;
}
/**
* returns the primary navigation
* @return array
*/
function get_primary($path,$prim_key,$url_mode)
{
global $db_praefix;
$link = connectDB();
$external = 0;
$primary = array();
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
if (sizeof($path) > 1)
{
$primarytemp = $path[1];
$page_keycurrent = $primarytemp["page_key"];
$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";
$result = mysql_query($query);
$counter = 0;
while ($row = mysql_fetch_array ($result))
{
if ($row["page_hide"] == 0)
{
if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
{
$link_path = $row["page_extern"];
$external = 1;
}
else
{
if (empty($_GET["export"]))
{
$link_path = "website.php?id=".$row["page_path"];
}
else
{
$link_path = getFile($row["page_path"]);
}
}
if ($page_keycurrent == $row["page_key"])
{
$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"]);
}
else
{
$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"]);
}
$counter++;
}
}
mysql_free_result($result);
}
else
{
$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";
$result = mysql_query($query);
$counter = 0;
while ($row = mysql_fetch_array ($result))
{
if ($row["page_hide"] == 0)
{
if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
{
$link_path = $row["page_extern"];
$external = 1;
}
else
{
if (empty($_GET["export"]))
{
$link_path = "website.php?id=".$row["page_path"];
}
else
{
$link_path = getFile($row["page_path"]);
}
}
$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"]);
$counter++;
}
}
mysql_free_result($result);
}
closeDB($link);
return $primary;
}
/**
* returns the siblings navigation
* @return array
*/
function get_siblings($page,$url_mode)
{
global $db_praefix;
$external = 0;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$siblings = array();
if (($page["page_start"] == 0) && ($page["page_parent"] != 0))
{
$link = connectDB();
$page_parent = $page["page_parent"];
$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";
$result = mysql_query($query);
$counter = 0;
while ($row = mysql_fetch_array ($result))
{
if ($row["page_hide"] == 0)
{
if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
{
$link_path = $row["page_extern"];
$external = 1;
}
else
{
if (empty($_GET["export"]))
{
$link_path = "website.php?id=".$row["page_path"];
}
else
{
$link_path = getFile($row["page_path"]);
}
}
if ($page["page_key"] == $row["page_key"])
{
$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"]);
}
else
{
$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"]);
}
$counter++;
}
}
mysql_free_result($result);
closeDB($link);
}
return $siblings;
}
/**
* returns the children navigation
* @return array
*/
function get_childs($page_key,$url_mode)
{
global $db_praefix;
$external = 0;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$childs = array();
$link = connectDB();
$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";
$result = mysql_query($query);
$counter = 0;
while ($row = mysql_fetch_array ($result))
{
if ($row["page_hide"] == 0)
{
if (($row["page_extern"] != "") && ($_SESSION["account_group"] < 2))
{
$link_path = $row["page_extern"];
$external = 1;
}
else
{
if (empty($_GET["export"]))
{
$link_path = "website.php?id=".$row["page_path"];
}
else
{
$link_path = getFile($row["page_path"]);
}
}
$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"]);
$counter++;
}
}
mysql_free_result($result);
closeDB($link);
return $childs;
}
/**
* writes a required javascript
*/
function writeRequire($formName,$fields)
{
global $db_praefix,$admin_lang;
echo "function checkInput() {";
$strg = "if (";
$counter = 0;
foreach ($fields as $field)
{
$counter = $counter + 1;
$strg = $strg. "(document.".$formName.".".$field.".value != '')";
if ($counter < sizeof($fields))
{
$strg = $strg." && ";
}
}
$strg = $strg.")";
echo $strg;
echo "{ document.".$formName.".submit(); } else { alert ('".$admin_lang["profile"][3]."') }}";
}
/**
* returns the status name by status key
* @return string
*/
function getStatus($page_status)
{
switch ($page_status)
{
case "0":
return "Released";
break;
case "1":
return "Registered User";
break;
case "2":
return "Locked";
break;
}
}
/**
* returns all language packs
* @return resource
*/
function get_langs()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."language ORDER BY lang_short";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all templates
* @return resource
*/
function get_templates()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."template ORDER BY template_short";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a template by template key
* @return resource
*/
function get_template($template_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."template WHERE template_key = $template_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a template by template key
* @return resource
*/
function get_template_page($template_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."template WHERE template_key = $template_key";
$result = mysql_query($query);
$template = mysql_fetch_array($result);
$template_name = $template["template_name"];
$query = "SELECT * FROM ".$db_praefix."page WHERE page_template = '$template_name'";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns the content of template select
* @return string
*/
function get_templateselect($template_name)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."template WHERE template_name = '$template_name'";
$result = mysql_query($query);
closeDB($link);
$templateselect = mysql_fetch_array($result);
return $templateselect["template_select"];
}
/**
* returns all attributes
* @return resource
*/
function get_attributes()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."attribute ORDER BY att_name";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns an attribute by attribute key
* @return resource
*/
function get_attribute($att_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."attribute WHERE att_key = $att_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all user groups
* @return resource
*/
function get_groups()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."group ORDER BY group_order DESC";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a user group by group key
* @return resource
*/
function get_group($group_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."group WHERE group_key = $group_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all replacings for export
* @return resource
*/
function get_replacings()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."replacing ORDER BY re_name";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a replacing by replacing key
* @return resource
*/
function get_replacing($re_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."replacing WHERE re_key = $re_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all export folders
* @return resource
*/
function get_exportfolders()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT page_key,page_path,page_title,page_exportfolder FROM ".$db_praefix."page WHERE page_start = 1 ORDER BY page_title";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a export folder by folder key
* @return resource
*/
function get_exportfolder($page_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT page_key,page_title,page_exportfolder FROM ".$db_praefix."page WHERE page_key = $page_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all accounts
* @return resource
*/
function get_accounts()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 0) ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all active accounts of the group registered users
* @return resource
*/
function get_freeaccounts()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_group = 1) AND (account_lock = 0) ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all active authors and administrators
* @return resource
*/
function get_adminaccounts()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 1) AND (account_group != 0) AND (account_lock = 0) ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns all active accounts with newsletter flag
* @return resource
*/
function get_infoaccounts()
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE (account_group != 0) AND (account_lock = 0) AND (account_info = 1) ORDER BY account_lastname";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* returns a account search result
* @return resource
*/
function search_accounts($accounts_lastname,$accounts_email,$accounts_group)
{
global $db_praefix;
$link = connectDB();
$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";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* updates an account record
*/
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)
{
global $db_praefix;
$link = connectDB();
if ($accountn_password != "")
{
$accountn_password = md5($accountn_password);
$query = "UPDATE ".$db_praefix."account SET account_password = '$accountn_password' WHERE account_key = $accountn_key";
$result = mysql_query($query);
}
$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";
$result = mysql_query($query);
closeDB($link);
$pagekey = get_page_key($page_key);
?>
}
/**
* returns an account by accout key
* @return resource
*/
function get_account($account_key)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE account_key = $account_key";
$result = mysql_query($query);
closeDB($link);
return $result;
}
/**
* inserts an account record
*/
function addAccount($page_key,$accountn_email,$accountn_password,$accountn_firstname,$accountn_lastname,$accountn_telefon,$accountn_company,$accountn_group,$accountn_lock)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."account WHERE account_email = '$accountn_email'";
$result2 = mysql_query($query);
closeDB($link);
if (mysql_num_rows($result2) == 0)
{
$accountn_password = md5($accountn_password);
$link = connectDB();
$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')";
$result = mysql_query($query);
closeDB($link);
$pagekey = get_page_key($page_key);
?>
}
else
{
?>
}
}
/**
* deletes an account record
*/
function deleteAccount($account_key)
{
global $db_praefix;
$link = connectDB();
$query = "DELETE FROM ".$db_praefix."account WHERE account_key = $account_key";
$result = mysql_query($query);
closeDB($link);
}
/**
* updates a content of a page
*/
function updateText($page_key,$page_edit,$page_input)
{
global $db_praefix,$site_url,$site_staging,$site_admin;
$link = connectDB();
$page_input = ereg_replace($site_url."/","",$page_input);
$page_input = ereg_replace("'","'", $page_input);
$page_input = ereg_replace(" ",$site_url, $page_input);
$page_input = ereg_replace(" ",$site_admin, $page_input);
if ($site_staging == 0)
{
$query = "UPDATE ".$db_praefix."page SET $page_edit = '$page_input' WHERE page_key = $page_key";
$result = mysql_query($query);
}
else
{
$query = "SELECT stage_key FROM ".$db_praefix."stage WHERE stage_edit = '$page_edit' AND page_key = $page_key";
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{
$query = "INSERT ".$db_praefix."stage (page_key,stage_edit,stage_input) VALUES ('$page_key','$page_edit','$page_input')";
$result = mysql_query($query);
}
else
{
$query = "UPDATE ".$db_praefix."stage SET stage_input = '$page_input' WHERE stage_edit = '$page_edit' AND page_key = $page_key";
$result = mysql_query($query);
}
}
closeDB($link);
$pagekey = get_page_key($page_key);
?>
}
/**
* updates a content of a page
*/
function updateTextNoCache($page_key,$page_edit,$page_input)
{
global $db_praefix,$site_url,$site_staging,$site_admin;
$link = connectDB();
$page_input = ereg_replace($site_url."/","",$page_input);
$page_input = ereg_replace("'","'", $page_input);
$query = "UPDATE ".$db_praefix."page SET $page_edit = '$page_input' WHERE page_key = $page_key";
$result = mysql_query($query);
closeDB($link);
$pagekey = get_page_key($page_key);
$pageparent = get_page_key($pagekey["page_parent"]);
?>
}
/**
* returns the next navigation
* @return array
*/
function nextpage()
{
global $db_praefix,$page;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$parent_key = $page["page_parent"];
$page_order = $page["page_order"] - 1;
$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)";
$result = mysql_query($query);
closeDB($link);
$next_array = mysql_fetch_array($result);
return $next_array;
}
/**
* returns the back navigation
* @return array
*/
function backpage()
{
global $db_praefix,$page;
$account_status = 0;
$access = "";
if (empty($_GET["export"]))
{
$account_status = $_SESSION["account_group"];
if ($_SESSION["account_group"] == 1)
{
$account_access = $_SESSION["account_access"];
$access = " AND (page_access <= $account_access)";
}
}
$link = connectDB();
$parent_key = $page["page_parent"];
$page_order = $page["page_order"] + 1;
$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)";
$result = mysql_query($query);
closeDB($link);
$back_array = mysql_fetch_array($result);
return $back_array;
}
/**
* writes admin log in folder /logfiles
*/
function writeLog($log_user,$log_action,$log_page)
{
global $log_path;
if ($log_path != "")
{
$log_time = date("ymdhis");
$log_file = $log_path."/admin_log.csv";
$fp = fopen($log_file,"a");
$log_text = $log_user.";".$log_action.";".$log_page.";".$log_time."\n";
fputs($fp,$log_text);
fclose($fp);
}
}
/**
* returns string pool value
* @return string
*/
function stringpool($name,$select)
{
global $db_praefix;
$link = connectDB();
$query = "SELECT * FROM ".$db_praefix."stringpool WHERE str_name = '$name' AND str_select = '$select'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{
return "";
}
else
{
$stringpool_arr = mysql_fetch_array($result);
return $stringpool_arr["str_value"];
}
closeDB($link);
}
/**
* check if $page_parent is a parent page of the current page
* @return bool
*/
function isParent($parent_key)
{
global $path;
$isParent = false;
if (isset($path))
{
foreach ($path as $value)
{
if ($value["page_key"] == $parent_key)
{
$isParent = true;
}
}
}
return $isParent;
}
?>
/**
* editor.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
/**
* writes the text editor icon
*/
function editText($block,$tooltip,$output)
{
global $page,$site_staging,$author_release;
if (isset($_GET["preview"]))
{
if ($site_staging == 0)
{
if ($output != "no") { echo $page[$block]; }
}
else
{
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'WYSIWYG-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo $page[$block]; }
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'WYSIWYG-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if ($output != "no") { echo $page[$block]; }
}
}
}
/**
* writes the link editor icon
*/
function editLink($link,$tooltip)
{
global $page;
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
?>
}
}
/**
* writes the item editor icon
*/
function editItem($block,$tooltip,$output)
{
global $page,$site_staging,$author_release;
if (isset($_GET["preview"]))
{
if ($site_staging == 0)
{
if ($output != "no") { echo $page[$block]; }
}
else
{
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Item-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo $page[$block]; }
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Item-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if ($output != "no") { echo $page[$block]; }
}
}
}
/**
* writes the upload editor icon
*/
function editUpload($block,$tooltip)
{
global $page,$site_staging,$author_release;
if (empty($_GET["preview"]))
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Upload-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Upload-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
}
/**
* writes the uploadpath editor icon
*/
function editUploadPath($path,$block,$tooltip)
{
global $site_staging,$author_release;
$page_path = get_page($path);
?>
&cache=false','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Upload-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
/**
* returns the content of a text block
* @return string
*/
function outputBlock($block)
{
global $page,$site_staging;
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
return $page[$block];
}
else
{
if(isStage($page["page_key"],$block))
{
return staging_output($block);
}
else
{
return $page[$block];
}
}
}
else
{
return $page[$block];
}
}
/**
* returns if the text block is not equal null
* @return bool
*/
function isContent($block)
{
global $page,$site_staging;
if ($site_staging == 0)
{
if ($page[$block] == "")
{
return false;
}
else
{
return true;
}
}
else
{
if(isStage($page["page_key"],$block))
{
if (staging_output($block) == "")
{
return false;
}
else
{
return true;
}
}
else
{
if ($page[$block] == "")
{
return false;
}
else
{
return true;
}
}
}
}
/**
* writes the Select editor icon
*/
function editSelect($block,$select,$tooltip)
{
global $page,$site_staging,$author_release;
$selectstring = "option=";
foreach ($select as $value)
{
$selectstring .= $value["name"]."**";
$selectstring .= $value["value"]."***";
}
if (empty($_GET["preview"]))
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
&= $selectstring; ?>','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Select-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
&= $selectstring; ?>','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Select-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
}
/**
* returns the content of a select block
* @return string
*/
function outputSelect($block,$select)
{
global $page,$site_staging,$author_release;
$input = "";
$emptyOutput = 0;
if ($site_staging == 0)
{
if ($page[$block] == "")
{
$emptyOutput = 1;
}
}
else
{
if (staging_output($block) == "")
{
$emptyOutput = 1;
}
}
if ($emptyOutput == 0)
{
if ($site_staging == 0)
{
$input = $page[$block];
}
else
{
$input = staging_output($block);
}
foreach ($select as $value)
{
if ($value["value"] == $input)
{
echo $value["name"];
}
}
}
else
{
echo $select[0]["name"];
}
}
/**
* writes the NewData editor icon
*/
function editNew($tooltip,$template)
{
global $page;
$icon = "system/admin/img/oes_addpage.png";
if (empty($_GET["preview"]))
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
?>
','newdata&newtemplate== $template; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'New-Data-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
/**
* writes the individual editor icon
*/
function editIndividual($include,$tooltip,$name)
{
global $page;
if (empty($_GET["preview"]))
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
?>
','edit/individual&include== $include; ?>&name== $name; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'Individual-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
/**
* writes the NewData editor icon with user icon
*/
function editNewIcon($tooltip,$template,$icon)
{
global $page;
if (empty($_GET["preview"]))
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
?>
','newdata&newtemplate== $template; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'New-Data-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
/**
* writes the HTML editor icon
*/
function editHTML($block,$tooltip,$output)
{
global $page,$site_staging,$author_release;
if (isset($_GET["preview"]))
{
if ($site_staging == 0)
{
if ($output != "no") { echo $page[$block]; }
}
else
{
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'HTML-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo $page[$block]; }
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'HTML-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
if ($output != "no") { echo staging_output($block); }
}
}
else
{
if ($output != "no") { echo $page[$block]; }
}
}
}
/**
* writes the PHP editor icon
*/
function editPHP($block,$tooltip)
{
global $page,$site_staging,$author_release;
if (isset($_GET["preview"]))
{
if ($site_staging == 0)
{
eval($page[$block]);
}
else
{
eval(staging_output($block));
}
}
else if (isset($_GET["export"]))
{
echo " ".$page[$block]." ?>";
}
else
{
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'PHP-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
eval($page[$block]);
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'PHP-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
eval(staging_output($block));
}
}
else
{
eval($page[$block]);
}
}
}
/**
* writes the RSS editor icon
*/
function editRSS($block,$tooltip)
{
global $page,$site_staging,$author_release;
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if (empty($_GET["preview"]))
{
if ($site_staging == 0)
{
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'RSS-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
else
{
if(isStage($page["page_key"],$block))
{
if (($_SESSION["account_group"] == 3) && ($author_release == 0))
{
}
else
{
?>
','= $page["page_key"]; ?>','= $block; ?>');" onmouseover="return overlib('Release Content', CAPTION, 'Release', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
?>
','= $block; ?>');" onmouseover="return overlib('= $tooltip; ?>', CAPTION, 'RSS-Editor', WIDTH, 150, FGCOLOR, '#ffffff', BGCOLOR, '#FF9933');" onmouseout="return nd();">
}
}
}
}
/**
* returns a rss object
*/
function outputRss($block)
{
global $page,$site_staging,$site_url;
if (($_SESSION["account_group"] == 2) || (($_SESSION["account_group"] == 3) && ($page["page_lock"] == 0)))
{
if ($site_staging == 0)
{
$url = $page[$block];
}
else
{
if(isStage($page["page_key"],$block))
{
$url = staging_output($block);
}
else
{
$url = $page[$block];
}
}
}
else
{
$url = $page[$block];
}
require_once("system/admin/magpierss061/rss_fetch.inc");
$rss = fetch_rss($url);
return $rss;
}
?>
/**
* page.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
$url_complete = getCompleteUrl();
$input = $site_home;
$lang = "";
$url_mode = "id";
$mode = "?id=";
if (isset($_GET["id"]))
{
$input = $_GET["id"];
}
else
{
$input = $site_home;
$link = connectDB();
$query = "SELECT page_path FROM ".$db_praefix."page WHERE page_path = '$input'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{
$query = "SELECT page_path FROM ".$db_praefix."page WHERE page_parent = 0";
$result = mysql_query($query);
$home_arr = mysql_fetch_array($result);
$input = $home_arr["page_path"];
}
closeDB($link);
}
$page = get_page($input);
if ($page["page_rows"] == 1)
{
$path = get_path($url_mode);
$start_key = $path[0]["page_key"];
$page_lang = $path[0]["page_lang"];
$homepage = get_homepage($start_key);
$primary = get_primary($path,$start_key,$url_mode);
$siblings = get_siblings($page,$url_mode);
$childs = get_childs($page["page_key"],$url_mode);
if ($page_lang != "")
{
$lang = "/".$page_lang;
}
else
{
$lang = "";
}
}
/**
* checks the syntax of the url
*/
function checkUrl()
{
global $url_complete,$site_url;
$url_complete = htmlentities($url_complete);
$pos1 = strpos ($url_complete, "<");
$pos2 = strpos ($url_complete, ">");
$pos3 = strpos ($url_complete, "%3c");
$pos4 = strpos ($url_complete, "%3e");
if (($pos1 === false) && ($pos2 === false) && ($pos3 === false) && ($pos4 === false))
{
}
else
{
Header("Location: $site_url");
}
}
/**
* returns the complete url
*/
function getCompleteUrl()
{
if (isset($_SERVER["PHP_SELF"]))
{
$url_complete = $_SERVER["PHP_SELF"];
}
else
{
$url_complete = "";
}
if (isset($_SERVER["QUERY_STRING"]))
{
$url_complete .= "?".$_SERVER["QUERY_STRING"];
}
else
{
$url_complete .= "";
}
return $url_complete;
}
?>
/**
* lang.php
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @author Stephan Raabe
*/
if ($lang != "")
{
$lang_input = $page_lang;
}
else
{
$lang_input = $lang_default;
}
$lang_admin = $lang_input;
if ((isset($_SESSION["account_lang"])) && ($_SESSION["account_lang"] != ""))
{
$lang_admin = $_SESSION["account_lang"];
}
$lang_list = "";
$link = connectDB();
$query = "SELECT lang_short from ".$db_praefix."language order by lang_short";
$result = mysql_query($query);
closeDB($link);
while ($row = mysql_fetch_array($result))
{
$lang_list .= $row["lang_short"].",";
}
if (strlen($lang_list) > 0)
{
$lang_list = substr($lang_list,0,strlen($lang_list)-1);
}
if (isset($_GET["admin"]))
{
include("system/language_packs/lang_".$lang_admin.".php");
}
else
{
include("system/language_packs/lang_".$lang_input.".php");
}
?>