Documentation is available at dialog.php
- <?
- /**
- * dialog.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.
- * @package generator
- * @author Stephan Raabe
- */
- $file_list = array();
- /**
- * checks the export of a page
- * @return string
- */
- function startExport($paKey,$step,$step_size)
- {
- global $file_list;
- $startpage = get_page_key($paKey);
- $export_folder = $startpage["page_exportfolder"];
- $start_key = $startpage["page_key"];
- $start_file = getFile($startpage["page_path"]);
- getExFiles($paKey,$export_folder,$start_key,$start_file);
- $min_pos = ($step-1) * $step_size;
- $max_pos = $step * $step_size;
- $counter = 1;
- $check_export = 0;
- foreach (array_keys($file_list) as $keyo)
- {
- if (($counter >= $min_pos) && ($counter < $max_pos))
- {
- $check_export = 1;
- exportFile($file_list[$keyo],$export_folder,$start_key,$start_file);
- }
- $counter++;
- }
- return $check_export;
- }
- /**
- * recursive function to get all export files
- */
- function getExFiles($page_key,$export_folder,$start_key,$start_file)
- {
- global $file_list,$db_praefix,$system_directory,$site_url;
- $file_list[] = $page_key;
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE page_parent = $page_key AND page_status = 0 AND page_start = 0 AND page_lockexport = 0";
- $result = mysql_query($query);
- closeDB($link);
- while ($row = mysql_fetch_array($result))
- {
- getExFiles($row["page_key"],$export_folder,$start_key,$start_file);
- }
- }
- /**
- * recursive function to get all status files
- * @return string
- */
- function getStatusFiles($page_key,$page_status,$page_lock,$page_lockexport,$page_access)
- {
- global $db_praefix;
- $link = connectDB();
- echo $page_key;
- $query = "UPDATE ".$db_praefix."page SET page_status = $page_status,page_lock = $page_lock,page_lockexport = $page_lockexport,page_access = $page_access WHERE page_key = $page_key";
- $result = mysql_query($query);
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE page_parent = $page_key AND page_start = 0";
- $result = mysql_query($query);
- closeDB($link);
- while ($row = mysql_fetch_array($result))
- {
- getStatusFiles($row["page_key"],$page_status,$page_lock,$page_lockexport,$page_access);
- }
- }
- /**
- * updates the css record
- */
- function updateCss($page_key,$site_css)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."settings SET site_css = '$site_css'";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=system";
- </script>
- <?
- }
- /**
- * updates a template record
- */
- function updateTemplate($page_key,$template_key,$template_name,$template_description,$template_select,$template_hide,$template_short)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."template SET template_short = '$template_short',template_name = '$template_name',template_description = '$template_description',template_select = '$template_select',template_hide = $template_hide WHERE template_key = $template_key";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=templates";
- </script>
- <?
- }
- /**
- * exports a page to the export folder
- * @return string
- */
- function exportFile($page_key,$export_folder,$start_key,$start_file)
- {
- global $file_list,$db_praefix,$system_directory,$site_url;
- $currentpage = get_page_key($page_key);
- $page_path = $currentpage["page_path"];
- $page_file = getFile($page_path);
- $page_folder = getFolder($page_path);
- $fp = fopen($site_url."/website.php?id=".$page_path."&export=yes", "r");
- $content = "";
- while(!feof($fp))
- {
- $content .= fread($fp,"10000");
- }
- fclose($fp);
- $content = ereg_replace("\?id=", "", $content);
- $content = ereg_replace("website.php", "", $content);
- $content = ereg_replace($site_url, $site_url.$export_folder, $content);
- $link = connectDB();
- $query = "SELECT page_key,page_path FROM ".$db_praefix."page WHERE page_status = 0 AND page_lockexport = 0";
- $result = mysql_query($query);
- closeDB($link);
- while ($row = mysql_fetch_array($result))
- {
- $page_path_file = getFile($row["page_path"]);
- $content = ereg_replace($row["page_path"], $page_path_file, $content);
- }
- $result_replacings = get_replacings();
- while ($row = mysql_fetch_array($result_replacings))
- {
- $content = ereg_replace($row["re_name"], $row["re_value"], $content);
- }
- if ($page_key == $start_key)
- {
- $fp = fopen(".".$export_folder."/".$page_file, "w+");
- }
- else
- {
- $fp = fopen(".".$export_folder."/".$page_file, "w+");
- }
- fputs($fp,$content);
- fclose($fp);
- }
- /**
- * updates a file
- */
- function updateFile($file_name,$page_key,$field)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET $field = '$file_name' WHERE page_key = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- }
- /**
- * deletes an export folder
- */
- function deleteExportFolder($key)
- {
- global $system_directory,$db_praefix,$site_pool,$site_staging;
- $page_exp = get_page_key($key);
- if ($page_exp["page_exportfolder"] != "")
- {
- $site_pool = ".".$page_exp["page_exportfolder"]."/";
- $pool = opendir($site_pool);
- while ($file = readdir($pool))
- {
- if (($file != ".") && ($file != ".."))
- {
- unlink($site_pool.$file);
- }
- }
- }
- }
- /**
- * deletes a file cache
- */
- function deleteCache($page_path)
- {
- global $db_praefix,$site_pool,$site_staging;
- $site_pool = $site_pool."/";
- $link = connectDB();
- $pool = opendir($site_pool);
- while ($file = readdir($pool))
- {
- if (($file != ".") && ($file != ".."))
- {
- $query = "SELECT page_key,page_file FROM ".$db_praefix."page where page_file = '$file'";
- $result = mysql_query($query);
- $query = "SELECT page_key,page_file1 FROM ".$db_praefix."page where page_file1 = '$file'";
- $result1 = mysql_query($query);
- $query = "SELECT page_key,page_file2 FROM ".$db_praefix."page where page_file2 = '$file'";
- $result2 = mysql_query($query);
- $query = "SELECT page_key,page_file3 FROM ".$db_praefix."page where page_file3 = '$file'";
- $result3 = mysql_query($query);
- $query = "SELECT page_key,page_file4 FROM ".$db_praefix."page where page_file4 = '$file'";
- $result4 = mysql_query($query);
- $query = "SELECT page_key,page_file5 FROM ".$db_praefix."page where page_file5 = '$file'";
- $result5 = mysql_query($query);
- $query = "SELECT page_key,page_file6 FROM ".$db_praefix."page where page_file6 = '$file'";
- $result6 = mysql_query($query);
- if ((mysql_num_rows($result) == 0) && (mysql_num_rows($result1) == 0) && (mysql_num_rows($result2) == 0) && (mysql_num_rows($result3) == 0) && (mysql_num_rows($result4) == 0) && (mysql_num_rows($result5) == 0) && (mysql_num_rows($result6) == 0))
- {
- unlink($site_pool.$file);
- }
- }
- }
- closedir($pool);
- if ($site_staging == 1)
- {
- $query = "DELETE FROM ".$db_praefix."stage";
- $result = mysql_query($query);
- }
- closeDB($link);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $page_path; ?>";
- location.href = "website.php?id=<?= $page_path; ?>&admin=system";
- </script>
- <?
- }
- /**
- * deletes the stageing content of a page
- */
- function changesPage($page_key)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "DELETE FROM ".$db_praefix."stage WHERE page_key = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * returns the page statistic
- * @return resource
- */
- function get_statistic()
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT * FROM ".$db_praefix."page ORDER BY page_count desc";
- $result = mysql_query($query);
- closeDB($link);
- return $result;
- }
- /**
- * deletes the page statistic
- */
- function delStatistic()
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET page_count = 0";
- $result = mysql_query($query);
- closeDB($link);
- }
- /**
- * releases a text block of a page
- */
- function releasePage($page_key,$block)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT stage_input FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = $page_key";
- $result = mysql_query($query);
- $row = mysql_fetch_array($result);
- $input = $row["stage_input"];
- $query = "UPDATE ".$db_praefix."page SET $block = '$input' WHERE page_key = $page_key";
- $result = mysql_query($query);
- $query = "DELETE FROM ".$db_praefix."stage WHERE stage_edit = '$block' AND page_key = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * updates a page record
- */
- function updateProperties($page_key,$page_path,$page_path_old,$page_extern,$page_status,$page_headline,$page_title,$page_keywords,$page_description,$page_template,$page_att1,$page_att2,$page_navigation,$page_date_unformated,$page_count,$page_start,$page_lang,$page_lock)
- {
- global $db_praefix;
- if (($page_date_unformated != "") && (strlen($page_date_unformated) == 6))
- {
- $page_date = substr($page_date_unformated, 4, 2).".".substr($page_date_unformated, 2, 2).".".substr($page_date_unformated, 0, 2);
- }
- else
- {
- $page_date = "";
- }
- $page_path = str_replace(" ","_",$page_path);
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE page_path = '$page_path'";
- $result = mysql_query($query);
- closeDB($link);
- if ((mysql_num_rows($result) > 0) && ($page_path != $page_path_old))
- {
- ?>
- <script language="JavaScript">
- alert("Filename exists!");
- history.back();
- </script>
- <?
- }
- else
- {
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET page_path = '$page_path',page_extern = '$page_extern',page_status = '$page_status',page_headline = '$page_headline',page_title = '$page_title',page_navigation = '$page_navigation',page_keywords = '$page_keywords',page_description = '$page_description',page_template = '$page_template',page_att1 = '$page_att1',page_att2 = '$page_att2',page_date = '$page_date',page_date_unformated = '$page_date_unformated',page_count = '$page_count',page_start = $page_start,page_lang = '$page_lang',page_lock = $page_lock WHERE page_key = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $page_path; ?>";
- window.close();
- </script>
- <?
- die();
- }
- }
- /**
- * updates the page status
- */
- function updateAuthorization($page_key,$page_status,$page_lock,$page_lockexport,$page_access,$status_subpages)
- {
- global $db_praefix,$status_list;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET page_status = $page_status,page_lock = $page_lock,page_lockexport = $page_lockexport,page_access = $page_access WHERE page_key = $page_key";
- $result = mysql_query($query);
- if ($status_subpages == 1)
- {
- getStatusFiles($page_key,$page_status,$page_lock,$page_lockexport,$page_access);
- }
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * returns all newsletters
- * @return resource
- */
- function get_newsletters()
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT * FROM ".$db_praefix."newsletter ORDER BY nl_date_unformated DESC";
- $result = mysql_query($query);
- closeDB($link);
- return $result;
- }
- /**
- * returns a newsletter by newsletter key
- */
- function get_newsletter($nl_key)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT * FROM ".$db_praefix."newsletter WHERE nl_key = $nl_key";
- $result = mysql_query($query);
- closeDB($link);
- return $result;
- }
- /**
- * returns all newsletter receivers limited by stepsize
- * @return resource
- */
- function get_sender($target,$minimum)
- {
- global $db_praefix,$newsletter_stepsize;
- $link = connectDB();
- if (($target == "all") || ($target == ""))
- {
- $query = "SELECT * FROM ".$db_praefix."account WHERE account_info = 1 AND account_lock = 0 ORDER BY account_key LIMIT $minimum,$newsletter_stepsize";
- }
- else
- {
- $query = "SELECT * FROM ".$db_praefix."account WHERE account_info = 1 AND account_lock = 0 ORDER BY account_key AND account_lang = '$target' LIMIT $minimum,$newsletter_stepsize";
- }
- $result = mysql_query($query);
- closeDB($link);
- return $result;
- }
- /**
- * returns all newsletter receivers
- * @return resource
- */
- function get_sender_all($target)
- {
- global $db_praefix,$newslette_stepsize;
- $link = connectDB();
- if (($target == "all") || ($target == ""))
- {
- $query = "SELECT * FROM ".$db_praefix."account WHERE account_info = 1 AND account_lock = 0";
- }
- else
- {
- $query = "SELECT * FROM ".$db_praefix."account WHERE account_info = 1 AND account_lock = 0 AND account_lang = '$target'";
- }
- $result = mysql_query($query);
- closeDB($link);
- return mysql_num_rows($result);
- }
- /**
- * inserts a newsletter record
- */
- function addNewsletter($page_key,$nl_subject,$nl_sender,$nl_date,$nl_date_unformated,$nl_test,$nl_text,$nl_html,$nl_status)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "INSERT ".$db_praefix."newsletter (nl_subject,nl_sender,nl_date,nl_date_unformated,nl_test,nl_text,nl_html,nl_status) VALUES ('$nl_subject','$nl_sender','$nl_date','$nl_date_unformated','$nl_test','$nl_text','$nl_html','$nl_status')";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=newsletter";
- </script>
- <?
- }
- /**
- * updates a newsletter record
- */
- function updateNewsletter($page_key,$nl_multi,$nl_subject,$nl_sender,$nl_date_unformated,$nl_test,$nl_text,$nl_html,$nl_status,$nl_target,$nl_key)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."newsletter SET nl_subject = '$nl_subject',nl_multi = '$nl_multi',nl_sender = '$nl_sender',nl_date_unformated = '$nl_date_unformated',nl_test = '$nl_test',nl_text = '$nl_text',nl_html = '$nl_html',nl_target = '$nl_target',nl_status = $nl_status WHERE nl_key = $nl_key";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=newsletter";
- </script>
- <?
- }
- /**
- * deletes a newsletter record
- */
- function deleteNewsletter($nl_key)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "DELETE FROM ".$db_praefix."newsletter WHERE nl_key = $nl_key";
- $result = mysql_query($query);
- closeDB($link);
- }
- /**
- * copy a newsletter record
- */
- function copyNewsletter($nl_key)
- {
- global $db_praefix;
- $nl_date = date("d.m.y");
- $nl_date_unformated = date("ymd");
- $link = connectDB();
- $query = "SELECT * FROM ".$db_praefix."newsletter WHERE nl_key = $nl_key";
- $result = mysql_query($query);
- $copy_array = mysql_fetch_array($result);
- $nl_subject = $copy_array["nl_subject"]." [Copy]";
- $nl_sender = $copy_array["nl_sender"];
- $nl_test = $copy_array["nl_test"];
- $nl_text = $copy_array["nl_text"];
- $nl_html = $copy_array["nl_html"];
- $nl_status = $copy_array["nl_status"];
- $nl_multi = $copy_array["nl_multi"];
- $nl_target = $copy_array["nl_target"];
- $query = "INSERT ".$db_praefix."newsletter (nl_subject,nl_sender,nl_date,nl_date_unformated,nl_test,nl_text,nl_html,nl_status,nl_multi,nl_target) VALUES ('$nl_subject','$nl_sender','$nl_date','$nl_date_unformated','$nl_test','$nl_text','$nl_html','$nl_status','$nl_multi','$nl_target')";
- $result = mysql_query($query);
- closeDB($link);
- }
- /**
- * updates the navigation
- */
- function updateNavigation($page_key,$keys,$page_hide)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET page_hide = $page_hide WHERE page_key = $page_key";
- $result = mysql_query($query);
- $keys = substr($keys,0,strlen($keys)-1);
- $array_keys = explode(",",$keys);
- $array_keys = array_reverse($array_keys);
- $counter = 1;
- foreach ($array_keys as $value)
- {
- $query = "UPDATE ".$db_praefix."page SET page_order = $counter WHERE page_key = $value";
- $result = mysql_query($query);
- $counter++;
- }
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * updates the group order
- */
- function updateGroupOrder($page_key,$keys)
- {
- global $db_praefix;
- $link = connectDB();
- $keys = substr($keys,0,strlen($keys)-1);
- $array_keys = explode(",",$keys);
- $array_keys = array_reverse($array_keys);
- $counter = 0;
- foreach ($array_keys as $value)
- {
- $query = "UPDATE ".$db_praefix."group SET group_order = $counter WHERE group_key = $value";
- $result = mysql_query($query);
- $counter++;
- }
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>&admin=group";
- window.close();
- </script>
- <?
- }
- /**
- * inserts a page record
- */
- function addPage($page_key,$page_pathnew,$page_status,$page_headline,$page_title,$page_keywords,$page_description,$page_template,$page_att1,$page_att2,$page_navigation,$page_date,$page_date_unformated)
- {
- global $db_praefix;
- $page_parent = $page_key;
- $page_pathnew = str_replace(" ","_",$page_pathnew);
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE page_path = '$page_pathnew'";
- $result = mysql_query($query);
- closeDB($link);
- if (mysql_num_rows($result) > 0)
- {
- ?>
- <script language="JavaScript">
- alert("Filename exists!");
- history.back();
- </script>
- <?
- }
- else
- {
- $page_keynew = insertPage($page_parent,$page_pathnew,$page_status,$page_headline,$page_title,$page_keywords,$page_description,$page_template,$page_att1,$page_att2,$page_navigation,$page_date,$page_date_unformated);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- }
- /**
- * inserts a page record
- */
- function insertPage($page_parent,$page_pathnew,$page_status,$page_headline,$page_title,$page_keywords,$page_description,$page_template,$page_att1,$page_att2,$page_navigation,$page_date,$page_date_unformated)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE (page_parent = $page_parent)";
- $result = mysql_query($query) or die("ERROR WITH INSERT#3 QUERY! PLEASE GO BACK!");
- $page_order = mysql_num_rows($result) + 1;
- $query = "INSERT ".$db_praefix."page (page_parent,page_description,page_keywords,page_headline,page_title,page_navigation,page_path,page_status,page_order,page_template,page_att1,page_att2,page_date,page_date_unformated) VALUES ('$page_parent','$page_description','$page_keywords','$page_headline','$page_title','$page_navigation','$page_pathnew','$page_status','$page_order','$page_template','$page_att1','$page_att2','$page_date','$page_date_unformated')";
- $result = mysql_query($query) or die("ERROR WITH INSERT#4 QUERY! PLEASE GO BACK!");
- $page_key = mysql_insert_id();
- closeDB($link);
- return $page_key;
- }
- /**
- * deletes a page record
- */
- function deletePage($page_key)
- {
- $pagekey = get_page_key($page_key);
- $page_parent = $pagekey["page_parent"];
- $page_order = $pagekey["page_order"];
- delPage($page_parent,$page_key,$page_order);
- $pagekey = get_page_key($page_parent);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- die();
- }
- /**
- * deletes page record
- */
- function delPage($page_parent,$page_key,$page_order)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."page SET page_order = page_order-1 WHERE (page_order >= $page_order) AND (page_parent = $page_parent)";
- $result = mysql_query($query) or die("ERROR WITH DELETE#1 QUERY! PLEASE GO BACK!");
- closeDB($link);
- delPages($page_key);
- }
- /**
- * deletes recursiv page records
- */
- function delPages($page_key)
- {
- global $db_praefix,$site_staging;
- $link = connectDB();
- $query = "DELETE FROM ".$db_praefix."page WHERE page_key = $page_key";
- $result = mysql_query($query);
- if ($site_staging == 1)
- {
- $query = "DELETE FROM ".$db_praefix."stage WHERE page_key = $page_key";
- $result = mysql_query($query);
- }
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE page_parent = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- while ($row = mysql_fetch_array($result))
- {
- delPages($row["page_key"]);
- }
- }
- /**
- * cuts a page
- */
- function cutPage($page_key,$page_keynew)
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE (page_parent = $page_keynew)";
- $result = mysql_query($query);
- $page_order = mysql_num_rows($result) + 1;
- $query = "UPDATE ".$db_praefix."page SET page_order = $page_order, page_parent = $page_keynew WHERE (page_key = $page_key)";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * copy a page
- */
- function copyPage($page_key,$page_keynew)
- {
- global $db_praefix;
- $pagekey = get_page_key($page_key);
- $page_path_old = $pagekey["page_path"];
- $page_path_old = ereg_replace(".htm","", $page_path_old);
- $link = connectDB();
- $query = "SELECT page_key FROM ".$db_praefix."page WHERE (page_parent = $page_keynew)";
- $result = mysql_query($query);
- $page_order = mysql_num_rows($result) + 1;
- $query = "INSERT ".$db_praefix."page (page_teaser,page_text1,page_text2,page_text3,page_text4,page_text5,page_text6,page_lang,page_parent,page_description,page_keywords,page_headline,page_title,page_navigation,page_path,page_status,page_order,page_template,page_att1,page_att2,page_date,page_date_unformated,page_file,page_file1,page_file2,page_file3,page_file4,page_file5,page_file6) VALUES ('".$pagekey["page_teaser"]."','".$pagekey["page_text1"]."','".$pagekey["page_text2"]."','".$pagekey["page_text3"]."','".$pagekey["page_text4"]."','".$pagekey["page_text5"]."','".$pagekey["page_text6"]."','".$pagekey["page_lang"]."','$page_keynew','".$pagekey["page_description"]."','".$pagekey["page_keywords"]."','".$pagekey["page_headline"]." (Copy)"."','".$pagekey["page_title"]." (Copy)"."','".$pagekey["page_navigation"]." (Copy)"."','".$pagekey["page_path"]."','2','$page_order','".$pagekey["page_template"]."','".$pagekey["page_att1"]."','".$pagekey["page_att2"]."','".$pagekey["page_date"]."','".$pagekey["page_date_unformated"]."','".$pagekey["page_file"]."','".$pagekey["page_file1"]."','".$pagekey["page_file2"]."','".$pagekey["page_file3"]."','".$pagekey["page_file4"]."','".$pagekey["page_file5"]."','".$pagekey["page_file6"]."')";
- $result = mysql_query($query);
- $page_key = mysql_insert_id();
- $page_path_new = $page_path_old.$page_key.".htm";
- $query = "UPDATE ".$db_praefix."page SET page_path = '$page_path_new' where page_key = $page_key";
- $result = mysql_query($query);
- closeDB($link);
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * sends a message via e-mail
- */
- function sendMessage($msg_receiver,$msg_subject,$msg_message,$msg_from)
- {
- global $nl_encoding;
- require("system/admin/phpmailer/class.phpmailer.php");
- $mail = new phpmailer();
- $mail->From = $msg_from;
- $mail->FromName = "";
- $mail->AddAddress($msg_receiver);
- $mail->Subject = $msg_subject;
- $mail->Encoding = "8bit";
- $mail->CharSet = $nl_encoding;
- $text_body = $msg_message;
- $mail->Body = $text_body;
- $mail->Send();
- $mail->ClearAddresses();
- $mail->ClearAttachments();
- ?>
- <script language="Javascript">
- window.close();
- </script>
- <?
- }
- /**
- * updates an user record
- */
- function updateUser($page_key,$accountn_key,$accountn_email,$accountn_password,$accountn_firstname,$accountn_lastname,$accountn_editor,$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_editor = '$accountn_editor', account_menu = $accountn_menu where account_key = $accountn_key";
- $result = mysql_query($query);
- closeDB($link);
- $_SESSION["account_email"] = $accountn_email;
- $_SESSION["account_firstname"] = $accountn_firstname;
- $_SESSION["account_lastname"] = $accountn_lastname;
- $_SESSION["account_editor"] = $accountn_editor;
- $_SESSION["account_menu"] = $accountn_menu;
- $pagekey = get_page_key($page_key);
- ?>
- <script language="JavaScript">
- window.opener.location.href = "website.php?id=<?= $pagekey["page_path"]; ?>";
- window.close();
- </script>
- <?
- }
- /**
- * returns the newsletter status
- * @return bool
- */
- function checknewsletter()
- {
- global $db_praefix;
- $link = connectDB();
- $query = "SELECT account_key FROM ".$db_praefix."account where account_nlsend = 1";
- $result = mysql_query($query);
- closeDB($link);
- if (mysql_num_rows($result) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /**
- * unlock all receivers for newsletter
- */
- function unlockNewsletter()
- {
- global $db_praefix;
- $link = connectDB();
- $query = "UPDATE ".$db_praefix."account SET account_nlsend = 0";
- $result = mysql_query($query);
- closeDB($link);
- }
- ?>
Documentation generated on Tue, 16 Aug 2005 17:28:46 +0200 by phpDocumentor 1.3.0RC3