Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * ***********************************************************************************************
- * Project: yappa-ng (yet another php photo album - next generation)
- * Filename: safe_mode_install.php
- * Type: Standalone Monolythic Script
- * Module: Safe Mode Installation Tool for yappa-ng
- * Subcategory: Part 2 (Final)
- * Description: This Safe Mode Install-Tool is the second step in the setup process
- * if the Server runs in "safe_mode" enabled mode
- * Please read the INSTALL.html (section: safe_mode Install) for instructions on how to use it!
- * ***********************************************************************************************
- * Author: Fritz Berger <wizard@zirkon.at>
- * Copyright: 2004 Fritz Berger
- * Homepage: http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_main_eng.html
- * ***********************************************************************************************
- * $Header: /cvsroot/yappa-ng/yappa-ng/safe_mode_install.php,v 1.15 2005/04/25 18:01:48 zirkon13 Exp $
- * ***********************************************************************************************
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
- /*
- * ***********************************************************************************************
- * ***
- * *** DECLARATIONS
- * ***
- * ***********************************************************************************************
- */
- /* for security!!!
- * Do not forget to remove before official release!
- */
- // $STOP = TRUE;
- if($STOP) {
- print "<BR><BR><h1>Security STOP is enabled!</h1><BR><BR>To disable you have to go into the sourcecode and remove the line<BR><BR>";
- print "\$STOP = TRUE;";
- exit;
- }
- /*
- * *******************************************************************
- * Setting of Error reporting within the Setup-Tool!
- *
- * Syntax
- * error_reporting(E_ALL & ~(E_WARNING | E_NOTICE | ...));
- *
- * Standard: error_reporting(E_ALL & ~(E_WARNING | E_NOTICE ));
- * Enable real ERRORS only!
- * Debugging: error_reporting(E_ALL);
- * Enable Errrors, Warnings and the Notice of undefined variables
- * *******************************************************************
- */
- error_reporting(E_ALL);
- //error_reporting(E_ALL & ~(E_WARNING | E_NOTICE));
- /*
- * *******************************************************************
- * Install-Tool Revision!
- *
- * This string will be shown in HTML-title!
- * - it will be in the bookmarks if this tool gets bookmarked
- * - it will be in the description of the browser
- * *******************************************************************
- */
- $install_tool_revision = "1.1";
- /*
- * ***********************************************************************************************
- * ***
- * *** FUNCTIONS
- * ***
- * ***********************************************************************************************
- */
- /*
- * ***********************************************************************************************
- * function writeHTMLheader()
- *
- * This function writes the HTML-Header.
- *
- * Complete startup of HTML including DOCTYPE, meta-tags and style types
- * ***********************************************************************************************
- */
- function writeHTMLheader() {
- global $setup_tool_revision;
- global $sm_install_DEMO;
- global $install_tool_revision;
- global $config;
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title>yappa-ng Safe Mode Install-Tool <?php print $install_tool_revision; ?></title>
- <link rel="SHORTCUT ICON" href="images/favicon.ico">
- <meta http-equiv="expires" content="0">
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="author" content="Fritz Berger">
- <meta name="description" content="yappa-ng Safe Mode Install-Tool (Yet Another PHP Photo Album - Next Generation)">
- <style type="text/css">
- <!--
- body { font-family: verdana, arial, helvetica, sans-serif; font-size: 80%; background-color: #DAE9FC; margin-left:20px; margin-right:50px; margin-top:0; margin-bottom:0; }
- .Heading { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 200%; font-weight:bold; color: #000000; margin-bottom:5px; }
- .links { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 70%; color: #000000; margin-bottom:5px; }
- .Description { font-size: 120%; font-weight:bold; color: #0000FF; margin-top:10px; }
- .mainComment { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 100%; font-weight:bold; color: #000000; margin-bottom:0px; }
- .Comments { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 100%; font-style:italic; color: #000000; }
- .thumbnailCell { background-color: #DAE9FC; }
- .hint { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 120%; font-weight:bold; color: #008000; }
- .errormsg { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 120%; font-weight:bold; color: #FF0000; }
- .errordesc { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 100%; font-weight:bold; color: #FF0000; }
- .gratulation { font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 150%; font-weight:bold; color: #008000; }
- -->
- </style>
- </head>
- <body>
- <form action="<?php echo $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; ?>" enctype="multipart/form-data" method="post">
- <input type="hidden" name="MAX_FILE_SIZE" value="500000">
- <a name="top"></a>
- <table cellspacing="0" cellpadding="5" border="0" width="100%">
- <tr valign="top">
- <td class="thumbnailCell">
- <table width="100%" border="0" cellspacing="0" cellpadding="3">
- <tr><td width="5%"> </td><td width="10%"> </td><td width="10%"> </td><td width="20%"> </td><td width="20%"> </td><td width="35%"> </td>
- <tr><td colspan=6 align="center" class="Heading">Welcome to Part 2 of the yappa-ng<br>"Safe Mode Install-Tool"</td></tr>
- <tr><td colspan="6" align="center" class="Comments">Be sure to read the Install Instructions on Safe Mode Installation in the
- <a href="http://www.zirkon.at/yappa-ng_demo/docs/INSTALL.html#safe_mode" target="_blank">INSTALL Manual</a> (external link!)</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6" align="center" class="Comments">You are installing into the directory: <?php print $config['source_root']; ?>!!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6" align="center" class="Comments">This Install Tool is the second step to be able to install yappa-ng on a server with
- the Safe Mode restrictions enabled.<br>
- Now when you read this, you should have run the startscript "safe_mode_start.php" and this script should be located on the webserver where you want to install yappa-ng in a directory where the yappa-ng subdirectory
- with the complete installation will be situated. This yappa-ng subdirectory was created in the first step with the "safe_mode_start.php" tool.</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="errormsg">IMPORTANT: </td><td colspan=5 class="errordesc">Be sure to delete this little script after usage (or if you do not need it, but unzipped it nevertheless)!
- ANYBODY can upload any PHP script to the server with this script! There is no passwordprotection for this script. There is no uploadrestriction and there are no securitychecks like in the yappa-ng upload section.
- The only purpose for this script is to create the needed subdirectories and upload the needed files.
- If this is done its useless but dangerous! <br>DELETE IT!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6" align="left">
- <?php
- }
- /*
- * ***********************************************************************************************
- * function writeHTMLsubmit($name, $text)
- *
- * This function writes the HTML-Submit Button and closes the HTML-document.
- *
- * $name = name of the form input. this string is the text in the issubmitted function
- * $text = text of the submit-button
- * ***********************************************************************************************
- */
- function writeHTMLsubmit($name, $text) {
- ?>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6" align="center">
- <input type="hidden" name="<?php print $name; ?>" value="true">
- <input type="submit" name="submit" value="<?php print $text; ?>">
- </td></tr>
- </table>
- </td></tr>
- </table>
- </form>
- </body>
- </HTML>
- <?php
- }
- /*
- * ***********************************************************************************************
- * function initialize_config()
- *
- * This function initializes the config-file with default values.
- *
- * This function gets only called if the setup.php is not able to locate the config.inc.php
- * AND you pushed the button to Initialize the config file new!
- * The Setup-Tool password does NOT get set. First thing after the initialization is you get asked for the pwd.
- * ***********************************************************************************************
- */
- function initialize_config()
- {
- global $config;
- global $config_source_root;
- $config = array();
- // The config-file does not exist so we make a first initialisation.
- // PART 1 -> MAIN SYSTEM SETUP -------------------------------------------------------------
- $config['source_root'] = $config_source_root;
- $config['photo_root'] = singleslash($config['source_root'] . "/photos");
- $config['cache_root'] = singleslash($config['source_root'] . "/cache");
- $config['maintenance_mode'] = FALSE;
- $config['resize_cache'] = TRUE;
- $config['restrict_cache'] = FALSE;
- $config['image_module'] = 'gd';
- $config['convert_path'] = '/usr/bin/convert';
- $config['gd_truecolor'] = 'yes';
- // PART 2 -> Title and Links -------------------------------------------------------------
- $config['title'] = 'yappa-ng Photo Gallery';
- $config['slogan'] = 'The Online Photo Gallery <br>for Original Photos and Photo Hostings';
- $config['site_root_name'] = 'ZIRKON Box:';
- $config['site_root_url'] = 'http://www.zirkon.at';
- $config['site_root_target'] = '_self';
- $config['site_link1_name'] = "";
- $config['site_link1_url'] = "";
- $config['site_link1_target'] = '_top';
- $config['site_link2_name'] = "";
- $config['site_link2_url'] = "";
- $config['site_link2_target'] = '_top';
- $config['site_link3_name'] = 'yappa-ng Sourcecode';
- $config['site_link3_url'] = 'http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_main_eng.html';
- $config['site_link3_target'] = '_top';
- $config['site_link4_name'] = "yappa-ng ToolBox";
- $config['site_link4_url'] = "toolbox.php";
- $config['site_link4_target'] = '_blank';
- $config['site_link5_name'] = 'yappa-ng All Over The World';
- $config['site_link5_url'] = 'http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_link_collection.html';
- $config['site_link5_target'] = '_self';
- // PART 3 -> Configuration of Images -------------------------------------------------------------
- $config['resize_quality'] = 60;
- $config['thumb_width'] = 100;
- $config['thumb_height'] = 100;
- $config['thumb_border_width'] = 150;
- $config['thumb_border_height'] = 130;
- $config['resize_mini'] = '50x50';
- $config['resize_options'] = array( "640x640", "800x800", "1024x1024", "1600x1600", "original" );
- $config['resize_default'] = '640x640';
- $config['album_sort_by'] = 'name';
- $config['album_sort_order'] = 'a';
- $config['display_albumhits'] = 'yes';
- $config['permitted_filetypes'] = array( "jpg", "jpeg", "jpe", "gif", "png", "mov", "mpg", "mpeg", "avi" );
- $config['show_left_navbar_border'] = TRUE;
- $config['show_exif'] = TRUE;
- // PART 4 -> Language Settings -------------------------------------------------------------
- $config['lang_default'] = 'English';
- $config['lang_support'] = 'yes';
- $config['autodetect_language'] = 'yes';
- $config['lang_intuitive'] = 'standard';
- // PART 5 -> Themes Settings -------------------------------------------------------------
- $config['themes_installed'] = array (
- 'zirkon',
- 'riders',
- 'silver',
- 'passport',
- 'hot',
- 'wood',
- 'bash',
- );
- $config['theme_default'] = 'zirkon';
- $config['theme_support'] = 'yes';
- $config['header_size'] = 'yes';
- // PART 6 -> Admin-Related Settings -------------------------------------------------------------
- $config['upload_limit'] = '1500000';
- $config['upload_number'] = '8';
- $config['show_info'] = 'yes';
- $config['use_initialize'] = 'yes';
- $config['permit_ahref'] = 'no';
- $config['permit_newalbum'] = 'yes';
- //$config['permit_video_global'] = TRUE;
- $config['permit_uploaduser'] = 'yes';
- $config['use_overall'] = 'yes';
- $config['show_album_desc_prev'] = 'no';
- $config['rate_album'] = TRUE;
- $config['rate_album_checkIP'] = TRUE;
- $config['rate_image'] = TRUE;
- $config['rate_image_checkIP'] = TRUE;
- $config['rate_show_albumpreview'] = TRUE;
- // PART 7 -> Miscellaneous -------------------------------------------------------------
- $config['basic_errorcheck'] = TRUE;
- $config['error_rep'] = '3';
- $config['safe_mode_installation'] = TRUE;
- // PART A -> Externally set and changed (ToolBox,...) ----------------------------------
- $config['loglevel'] = '63';
- }
- /*
- * ***********************************************************************************************
- * function save_config()
- *
- * This function saves the config-file to the harddisk.
- * Output filename: config.inc.php
- * Location of outputfile: same directory as the setup.php is located
- * The file-format is an "Include file":
- * - to be compatible to yappa-ng versions previous to Release 2.1.1
- * - to make it possible to edit the config.inc.php manually if its needed
- * - easy to debug
- * - extension .php and the PHP-language markers at the beginning
- * and the end of the file should prevent to view it with the browser.
- * (It gets parsed from PHP - not shown!) This enhances security!
- *
- * If writing of the config-file is not possible cry for help and exit
- * ***********************************************************************************************
- */
- function save_config()
- {
- global $config;
- $config_filename = "config.inc.php";
- $config_help = "<?php \n \n";
- $config_help .= "// Global yappa-ng Configuration File!!! \n \n";
- $config_help .= "// SAFE MODE enabled!!! \n \n";
- $config_help .= "// Written by Safe mode Install Tool (ymd-H:m:s = " . date("ymd-H:i:s") . ") \n// \n";
- $config_help .= "// DO NOT EDIT THIS FILE !! \n// This file is created automatically! \n// Please run the \"setup.php\" script! \n \n";
- $config_help .= "// If you do want to edit the config manually \n// - rename the file config.inc.php.orig file to config.inc.php \n// - edit the new config.inc.php \n \n";
- $config_help .= "// No support if you manipulate this file config.inc.php manually!!! \n \n";
- // PART 1 -> MAIN SYSTEM SETUP -------------------------------------------------------------
- $config_help .= "// PART 1 -> MAIN SYSTEM SETUP ------------------------------------------------------------- \n \n";
- if ($config['maintenance_mode']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['maintenance_mode'] = " . $msg . "; \n";
- $config_help .= "\$config['source_root'] = \"" . str_replace('\\',"/",$config['source_root']) . "\"; \n";
- $config_help .= "\$config['photo_root'] = \"" . str_replace('\\',"/",$config['photo_root']) . "\"; \n";
- if ($config['resize_cache']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['resize_cache'] = " . $msg . "; \n";
- if ($config['restrict_cache']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['restrict_cache'] = " . $msg . "; \n";
- $config_help .= "\$config['cache_root'] = \"" . str_replace("\\","/",$config['cache_root'] ). "\"; \n";
- $config_help .= "\$config['image_module'] = \"" . $config['image_module'] . "\"; \n";
- $config_help .= "\$config['convert_path'] = \"" . $config['convert_path'] . "\"; \n";
- $config_help .= "\$config['gd_truecolor'] = \"" . $config['gd_truecolor'] . "\"; \n \n";
- // PART 2 -> Title and Links -------------------------------------------------------------
- $config_help .= "// PART 2 -> Title and Links ------------------------------------------------------------- \n \n";
- $config_help .= "\$config['title'] = \"" . $config['title'] . "\"; \n";
- $config_help .= "\$config['slogan'] = \"" . $config['slogan'] . "\"; \n";
- $config_help .= "\$config['site_root_name'] = \"" . $config['site_root_name'] . "\"; \n";
- $config_help .= "\$config['site_root_url'] = \"" . $config['site_root_url'] . "\"; \n";
- $config_help .= "\$config['site_root_target'] = \"" . $config['site_root_target'] . "\"; \n";
- $config_help .= "\$config['site_link1_name'] = \"" . $config['site_link1_name'] . "\"; \n";
- $config_help .= "\$config['site_link1_url'] = \"" . $config['site_link1_url'] . "\"; \n";
- $config_help .= "\$config['site_link1_target'] = \"" . $config['site_link1_target'] . "\"; \n";
- $config_help .= "\$config['site_link2_name'] = \"" . $config['site_link2_name'] . "\"; \n";
- $config_help .= "\$config['site_link2_url'] = \"" . $config['site_link2_url'] . "\"; \n";
- $config_help .= "\$config['site_link2_target'] = \"" . $config['site_link2_target'] . "\"; \n";
- $config_help .= "\$config['site_link3_name'] = \"" . $config['site_link3_name'] . "\"; \n";
- $config_help .= "\$config['site_link3_url'] = \"" . $config['site_link3_url'] . "\"; \n";
- $config_help .= "\$config['site_link3_target'] = \"" . $config['site_link3_target'] . "\"; \n";
- $config_help .= "\$config['site_link4_name'] = \"" . $config['site_link4_name'] . "\"; \n";
- $config_help .= "\$config['site_link4_url'] = \"" . $config['site_link4_url'] . "\"; \n";
- $config_help .= "\$config['site_link4_target'] = \"" . $config['site_link4_target'] . "\"; \n";
- $config_help .= "\$config['site_link5_name'] = \"" . $config['site_link5_name'] . "\"; \n";
- $config_help .= "\$config['site_link5_url'] = \"" . $config['site_link5_url'] . "\"; \n";
- $config_help .= "\$config['site_link5_target'] = \"" . $config['site_link5_target'] . "\"; \n \n";
- // PART 3 -> Configuration of Images -------------------------------------------------------------
- $config_help .= "// PART 3 -> Configuration of Images ------------------------------------------------------------- \n \n";
- $config_help .= "\$config['resize_quality'] = " . $config['resize_quality'] . "; \n";
- $config_help .= "\$config['thumb_width'] = " . $config['thumb_width'] . "; \n";
- $config_help .= "\$config['thumb_height'] = " . $config['thumb_width'] . "; \n";
- $config_help .= "\$config['thumb_border_width'] = " . $config['thumb_border_width'] . "; \n";
- $config_help .= "\$config['thumb_border_height'] = " . $config['thumb_border_height'] . "; \n";
- $config_help .= "\$config['resize_mini'] = \"" . $config['resize_mini'] . "\"; \n";
- $config_help .= "\$config['resize_options'] = array( ";
- $l_help = 0;
- foreach ($config['resize_options'] as $value) {
- if ($l_help == 0) {
- $config_help .= "\"" . $value . "\"";
- $l_help = 1;
- } else {
- $config_help .= ", \"" . $value . "\"";
- }
- }
- $config_help .= " ); \n";
- $config_help .= "\$config['resize_default'] = \"" . $config['resize_default'] . "\"; \n";
- $config_help .= "\$config['permitted_filetypes'] = array( ";
- $l_help = 0;
- foreach ($config['permitted_filetypes'] as $value) {
- if ($l_help == 0) {
- $config_help .= "\"" . $value . "\"";
- $l_help = 1;
- } else {
- $config_help .= ", \"" . $value . "\"";
- }
- }
- $config_help .= " ); \n";
- $config_help .= "\$config['album_sort_by'] = \"" . $config['album_sort_by'] . "\"; \n";
- $config_help .= "\$config['album_sort_order'] = \"" . $config['album_sort_order'] . "\"; \n \n";
- $config_help .= "\$config['display_albumhits'] = \"" . $config['display_albumhits'] . "\"; \n";
- if ($config['show_left_navbar_border']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['show_left_navbar_border'] = " . $msg . "; \n";
- if ($config['show_exif']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['show_exif'] = " . $msg . "; \n";
- // PART 4 -> Language Settings -------------------------------------------------------------
- $config_help .= "// PART 4 -> Language Settings ------------------------------------------------------------- \n \n";
- $config_help .= "\$config['lang_default'] = \"" . $config['lang_default'] . "\"; \n";
- $config_help .= "\$config['lang_support'] = \"" . $config['lang_support'] . "\"; \n";
- $config_help .= "\$config['autodetect_language'] = \"" . $config['autodetect_language'] . "\"; \n";
- $config_help .= "\$config['lang_intuitive'] = \"" . $config['lang_intuitive'] . "\"; \n \n";
- // PART 5 -> Themes Settings -------------------------------------------------------------
- $config_help .= "// PART 5 -> Themes Settings ------------------------------------------------------------- \n \n";
- $config_help .= "\$config['themes_installed'] = array( ";
- $l_help = 0;
- foreach ($config['themes_installed'] as $value) {
- if ($l_help == 0) {
- $config_help .= "\"" . $value . "\"";
- $l_help = 1;
- } else {
- $config_help .= ", \"" . $value . "\"";
- }
- }
- $config_help .= " ); \n";
- $config_help .= "\$config['theme_default'] = \"" . $config['theme_default'] . "\"; \n";
- $config_help .= "\$config['theme_support'] = \"" . $config['theme_support'] . "\"; \n \n";
- $config_help .= "\$config['header_size'] = \"" . $config['header_size'] . "\"; \n \n";
- // PART 6 -> Admin-Related Settings -------------------------------------------------------------
- $config_help .= "// PART 6 -> Admin-Related Settings ------------------------------------------------------------- \n \n";
- $config_help .= "\$config['upload_limit'] = \"" . $config['upload_limit'] . "\"; \n";
- $config_help .= "\$config['upload_number'] = \"" . $config['upload_number'] . "\"; \n";
- $config_help .= "\$config['show_info'] = \"" . $config['show_info'] . "\"; \n";
- $config_help .= "\$config['use_initialize'] = \"" . $config['use_initialize'] . "\"; \n";
- $config_help .= "\$config['permit_ahref'] = \"" . $config['permit_ahref'] . "\"; \n";
- $config_help .= "\$config['permit_newalbum'] = \"" . $config['permit_newalbum'] . "\"; \n";
- /*if ($config['permit_video_global']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['permit_video_global'] = " . $msg . "; \n";
- */
- $config_help .= "\$config['permit_uploaduser'] = \"" . $config['permit_uploaduser'] . "\"; \n";
- $config_help .= "\$config['use_overall'] = \"" . $config['use_overall'] . "\"; \n \n";
- $config_help .= "\$config['show_album_desc_prev'] = \"" . $config['show_album_desc_prev'] . "\"; \n \n";
- if ($config['rate_album']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['rate_album'] = " . $msg . "; \n";
- if ($config['rate_album_checkIP']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['rate_album_checkIP'] = " . $msg . "; \n";
- if ($config['rate_image']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['rate_image'] = " . $msg . "; \n";
- if ($config['rate_image_checkIP']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['rate_image_checkIP'] = " . $msg . "; \n";
- if ($config['rate_show_albumpreview']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['rate_show_albumpreview'] = " . $msg . "; \n\n";
- // PART 7 -> Miscellaneous -------------------------------------------------------------
- $config_help .= "// PART 7 -> Miscellaneus ------------------------------------------------------------- \n \n";
- // $config_help .= "\$config['setup_pwd'] = \"" . $config['setup_pwd'] . "\"; \n";
- if ($config['basic_errorcheck']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['basic_errorcheck'] = " . $msg . "; \n";
- $config_help .= "\$config['error_rep'] = \"" . $config['error_rep'] . "\"; \n\n";
- if ($config['safe_mode_installation']) {
- $msg = 'TRUE';
- } else {
- $msg = 'FALSE';
- }
- $config_help .= "\$config['safe_mode_installation'] = " . $msg . "; \n\n";
- // PART A -> Externally set and changed (ToolBox,...) ----------------------------------
- $config_help .= "// PART A -> Externally set and changed (ToolBox,...) ---------------------\n \n";
- $config_help .= "\$config['loglevel'] = \"" . $config['loglevel'] . "\"; \n\n";
- $config_help .= "define(\"SecCheck\", 1); \n\n";
- $config_help .= "require(\"config_mimetypes.inc.php\"); \n";
- $config_help .= "require(\"config_private.inc.php\"); \n\n";
- $config_help .= "\n // End of global yappa-ng configuration file!! \n \n";
- $config_help .= " \n?>";
- $config_path = singleslash($config['source_root'] . "/" . $config_filename);
- $fd = fopen($config_path, "w");
- if ($fd) {
- // everything ok
- flock($fd, 2); // get an exclusive lock
- fwrite($fd, $config_help);
- flock($fd, 3); // release the lock
- fclose($fd);
- } else {
- $config['errorcount']++;
- // config_file not written
- // cry for help and exit
- ?>
- Could not write the config-file!<br>
- Please make sure the directory where the setup.php is located <b>is writeable for the webserver</b>!<br>
- Exiting...<br>
- <?php exit;
- }
- }
- /*
- * ***********************************************************************************************
- * function check_cache_root()
- *
- * This function checks the submitted path for cache_root.
- *
- * If not available - create it
- * ***********************************************************************************************
- */
- function check_cache_root()
- {
- global $config;
- /* check for the cache root ******************************************************************************************************* */
- if (!@is_dir($config['cache_root'])) {
- if (!(mkdir ($config['cache_root'], intval("0777", 8)))) {
- // directory not created!
- $config['errorcount']++;
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($config['cache_root'], intval("0777", 8));
- }
- }
- sleep(1);
- clearstatcache();
- /* check AGAIN for the cache_root */
- if (!@is_dir($config['cache_root'])) { ?>
- <tr><td colspan="6"><a name="bottom">&bnsp;</a></td></tr>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Cannot find the directory: "<?php print $config["cache_root"]; ?>" !!!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Please specify another directory and hit "Submit cache_root"</td></tr>
- <?php
- $config['errorcount']++;
- writeHTMLsubmit("SubmittedFinal", "Submit cache_root!");
- exit;
- }
- /* make a testfile in cache_root */
- $testfilename = $config['cache_root'] . "/test.txt";
- $testfilecontent = "ok: This is a TestFile, but I am NOT overwritten!!!";
- $fd = fopen($testfilename, "w");
- if ($fd) {
- // testfile created successfully
- flock($fd, 2); // get an exclusive lock
- fwrite($fd, $testfilecontent);
- flock($fd, 3); // release the lock
- fclose($fd);
- } else { ?>
- <tr><td colspan="6"><a name="bottom">&bnsp;</a></td></tr>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">I cannot write into the directory: "<?php print $config["cache_root"]; ?>",</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Please make sure the cache_root directory is writeable for the webserver!</td></tr>
- <?php
- $config['errorcount']++;
- writeHTMLsubmit("SubmittedFinal", "Submit cache_root!");
- exit;
- }
- /* overwrite the testfile */
- $testfilecontent = "ok: This is the overwritten TestFile!";
- $fd = fopen($testfilename, "w");
- if ($fd) {
- // testfile overwritten successfully
- flock($fd, 2); // get an exclusive lock
- fwrite($fd, $testfilecontent);
- flock($fd, 3); // release the lock
- fclose($fd);
- } else { ?>
- <tr><td colspan="6"><a name="bottom">&bnsp;</a></td></tr>
- <tr><td class="errormsg">Warning: </td><td colspan=5 class="errordesc">I could not overwrite the testfile: "<?php print $testfilename; ?>",</td></tr>
- <?php
- }
- /* read the content of the same testfile */
- $testfilecontent = " ";
- $fd = fopen($testfilename, "rt");
- if ($fd) {
- // testfile opened for read successfully
- $data = "";
- while(!feof($fd)) {
- $data = fgets($fd, 1024);
- $testfilecontent = $testfilecontent . $data;
- }
- fclose($fd);
- } else { ?>
- <tr><td colspan="6"><a name="bottom">&bnsp;</a></td></tr>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">I could not read the testfile: "<?php print $testfilename; ?>",</td></tr>
- <?php
- $config['errorcount']++;
- writeHTMLsubmit("SubmittedFinal", "Submit cache_root!");
- exit;
- }
- /* delete testfile */
- unlink ($testfilename);
- clearstatcache();
- if (file_exists($testfilename)) { ?>
- <tr><td colspan="6"><a name="bottom">&bnsp;</a></td></tr>
- <tr><td class="errormsg">Warning: </td><td colspan=5 class="errordesc">I could not delete the testfile: "<?php print $testfilename; ?>",</td></tr>
- <?php
- }
- }
- /*
- * ***********************************************************************************************
- * function make_needed_dirs()
- *
- * This function creates the needed dirs!
- * ***********************************************************************************************
- */
- function make_needed_dirs()
- {
- global $config;
- $dirname = singleslash($config['source_root'] . "/languages");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/themes");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/images");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/admin_modules");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/docs");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/toolbox_modules");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/install");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/src");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/exifer");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- $dirname = singleslash($config['source_root'] . "/exifer/makers");
- if (!@is_dir($dirname)) {
- if (!(mkdir ($dirname, intval("0777", 8)))) {
- // directory not created!
- $return_value["check"] = 1;
- return $return_value;
- } else {
- @chmod($dirname, intval("0777", 8));
- }
- }
- }
- /*
- * ***********************************************************************************************
- * function upload_needed_files()
- *
- * This function uploads the needed files:
- *
- * yappa-ng/index.php
- * yappa-ng/setup.php
- * yappa-ng/show.php
- * yappa-ng/slideshow.php
- * yappa-ng/toolbox.php
- * yappa-ng/toolbox_logview.php
- * yappa-ng/photos/sample/yappa-ng_DEMO.jpg
- * ***********************************************************************************************
- */
- function upload_needed_files()
- {
- global $config;
- // upload yappa-ng/check_setup.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['check']) && ($_FILES['fupload']['size']['check'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['check'];
- if($l_dest_filename != "check_setup.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file check_setup.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/check_setup.php");
- if (!copy($_FILES['fupload']['tmp_name']['check'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file check_setup.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of check_setup.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/index.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['index']) && ($_FILES['fupload']['size']['index'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['index'];
- if($l_dest_filename != "index.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file index.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/index.php");
- if (!copy($_FILES['fupload']['tmp_name']['index'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file index.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of index.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/setup.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['setup']) && ($_FILES['fupload']['size']['setup'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['setup'];
- if($l_dest_filename != "setup.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file setup.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/setup.php");
- if (!copy($_FILES['fupload']['tmp_name']['setup'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file setup.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of setup.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/show.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['show']) && ($_FILES['fupload']['size']['show'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['show'];
- if($l_dest_filename != "show.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file show.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/show.php");
- if (!copy($_FILES['fupload']['tmp_name']['show'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file show.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of show.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/slideshow.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['slideshow']) && ($_FILES['fupload']['size']['slideshow'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['slideshow'];
- if($l_dest_filename != "slideshow.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file slideshow.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/slideshow.php");
- if (!copy($_FILES['fupload']['tmp_name']['slideshow'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file slideshow.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of slideshow.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/toolbox.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['toolbox']) && ($_FILES['fupload']['size']['toolbox'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['toolbox'];
- if($l_dest_filename != "toolbox.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file toolbox.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/toolbox.php");
- if (!copy($_FILES['fupload']['tmp_name']['toolbox'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file toolbox.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of toolbox.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/toolbox_logview.php
- $dirname = $config['source_root'];
- if (($_FILES['fupload']['name']['toollog']) && ($_FILES['fupload']['size']['toollog'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['toollog'];
- if($l_dest_filename != "toolbox_logview.php") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file toolbox_logview.php!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/toolbox_logview.php");
- if (!copy($_FILES['fupload']['tmp_name']['toollog'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file toolbox_logview.php!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of toolbox_logview.php successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/cache/yappa-ng_DEMO.jpg
- $dirname = $config['cache_root'];
- if (($_FILES['fupload']['name']['demo']) && ($_FILES['fupload']['size']['demo'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['demo'];
- if($l_dest_filename != "yappa-ng_DEMO.jpg") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file yappa-ng_DEMO.jpg!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/yappa-ng_DEMO.jpg");
- if (!copy($_FILES['fupload']['tmp_name']['demo'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file yappa-ng_DEMO.jpg!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of yappa-ng_DEMO.jpg successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/cache/error_image.jpg
- $dirname = $config['cache_root'];
- if (($_FILES['fupload']['name']['errimg']) && ($_FILES['fupload']['size']['errimg'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['errimg'];
- if($l_dest_filename != "error_image.jpg") {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload the file error_image.jpg!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/error_image.jpg");
- if (!copy($_FILES['fupload']['tmp_name']['errimg'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file error_image.jpg!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of error_image.jpg successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/languages/lang_*
- $dirname = singleslash($config['source_root'] . "/languages");
- if (($_FILES['fupload']['name']['lang1']) && ($_FILES['fupload']['size']['lang1'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['lang1'];
- if(strpos($l_dest_filename, "lang_") === false) {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload a languagefile (beginning with "lang_" )!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/" . $_FILES['fupload']['name']['lang1']);
- if (!copy($_FILES['fupload']['tmp_name']['lang1'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file <?php print $_FILES['fupload']['name']['lang1']; ?>!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of <?php print $_FILES['fupload']['name']['lang1']; ?> successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/languages/lang_*
- $dirname = singleslash($config['source_root'] . "/languages");
- if (($_FILES['fupload']['name']['lang2']) && ($_FILES['fupload']['size']['lang2'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['lang2'];
- if(strpos($l_dest_filename, "lang_") === false) {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload a languagefile (beginning with "lang_" )!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/" . $_FILES['fupload']['name']['lang2']);
- if (!copy($_FILES['fupload']['tmp_name']['lang2'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file <?php print $_FILES['fupload']['name']['lang2']; ?>!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of <?php print $_FILES['fupload']['name']['lang2']; ?> successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- // upload yappa-ng/languages/lang_*
- $dirname = singleslash($config['source_root'] . "/languages");
- if (($_FILES['fupload']['name']['lang3']) && ($_FILES['fupload']['size']['lang3'] != "0")) {
- $l_dest_filename = $_FILES['fupload']['name']['lang3'];
- if(strpos($l_dest_filename, "lang_") === false) {
- // error - wrong filename!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Wrong filename! You should upload a languagefile (beginning with "lang_" )!</td></tr>
- <?php
- } else {
- $dest = singleslash($dirname . "/" . $_FILES['fupload']['name']['lang3']);
- if (!copy($_FILES['fupload']['tmp_name']['lang3'], $dest)) {
- // copy error!
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="errordesc">Could not upload the file <?php print $_FILES['fupload']['name']['lang3']; ?>!</td></tr>
- <tr><td> </td><td colspan=5 class="Comments">Something is very wrong!!</td></tr>
- <?php
- } else {
- //upload ok!
- ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Upload of <?php print $_FILES['fupload']['name']['lang3']; ?> successful!</td></tr>
- <?php
- if (!@chmod($dest, intval("0666", 8))) {
- // fehler!
- }
- }
- }
- }
- }
- /*
- * ***********************************************************************************************
- * function check_dir($dirname, $error_count)
- *
- * This function checks if a dir exists and gives the statement
- * ***********************************************************************************************
- */
- function check_dir($dirname, $error_count)
- {
- if(is_dir($dirname)) { ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">Directory: <?php print $dirname; ?> found!</td></tr>
- <?php } else {
- $error_count++;
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="Comments">Directory: <?php print $dirname; ?> NOT found!</td></tr>
- <?php }
- return $error_count;
- }
- /*
- * ***********************************************************************************************
- * function check_file($filename, $error_count)
- *
- * This function checks if a file exists and gives the statement
- * ***********************************************************************************************
- */
- function check_file($filename, $error_count)
- {
- if(file_exists($filename)) { ?>
- <tr><td class="hint">ok: </td><td colspan=5 class="Comments">File: <?php print $filename; ?> found!</td></tr>
- <?php } else {
- $error_count++;
- ?>
- <tr><td class="errormsg">Error: </td><td colspan=5 class="Comments">File: <?php print $filename; ?> NOT found!</td></tr>
- <?php }
- return $error_count;
- }
- /*
- * ***********************************************************************************************
- * function check_configuration()
- *
- * This function checks the needed:
- *
- * created directories:
- * yappa-ng
- * yappa-ng/cache
- * yappa-ng/languages
- * yappa-ng/themes
- * yappa-ng/images
- * yappa-ng/admin_modules
- * yappa-ng/docs
- * yappa-ng/install
- * yappa-ng/toolbox_modules
- * yappa-ng/exifer
- * yappa-ng/exifer/makers
- *
- * ***********************************************************************************************
- */
- function check_installation()
- {
- global $config;
- global $config_album;
- $error_count = 0;
- ?>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan=6 class="MainComment">Final check of all files and directories.</td></tr>
- <tr><td colspan=6 class="Comments">
- Last check for all files and directories. If you see an error here please investigate and correct!
- </td></tr>
- <tr><td colspan="6"> </td></tr>
- <?php
- // directories
- print "<tr><td colspan='6'>Checking created directories</td></tr>";
- // directory yappa-ng
- $dirname = $config['source_root'];
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/cache
- $dirname = singleslash($config['source_root'] . "/cache");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/languages
- $dirname = singleslash($config['source_root'] . "/languages");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/themes
- $dirname = singleslash($config['source_root'] . "/themes");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/admin_modules
- $dirname = singleslash($config['source_root'] . "/admin_modules");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/images
- $dirname = singleslash($config['source_root'] . "/images");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/docs
- $dirname = singleslash($config['source_root'] . "/docs");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/install
- $dirname = singleslash($config['source_root'] . "/install");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/toolbox_modules
- $dirname = singleslash($config['source_root'] . "/toolbox_modules");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/src
- $dirname = singleslash($config['source_root'] . "/src");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/src
- $dirname = singleslash($config['source_root'] . "/exifer");
- $error_count = check_dir($dirname, $error_count);
- // directory yappa-ng/src
- $dirname = singleslash($config['source_root'] . "/exifer/makers");
- $error_count = check_dir($dirname, $error_count);
- // uploaded files
- print "<tr><td colspan='6'>Checking uploaded files</td></tr>";
- // file yappa-ng/check_setup.php
- $filename = singleslash($config['source_root'] . "/check_setup.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/index.php");
- $filename = singleslash($config['source_root'] . "/index.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/setup.php
- $filename = singleslash($config['source_root'] . "/setup.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/show.php
- $filename = singleslash($config['source_root'] . "/show.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/slideshow.php
- $filename = singleslash($config['source_root'] . "/slideshow.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/toolbox.php
- $filename = singleslash($config['source_root'] . "/toolbox.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/toolbox_logview.php
- $filename = singleslash($config['source_root'] . "/toolbox_logview.php");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/cache/yappa-ng_DEMO.jpg
- $filename = singleslash($config['cache_root'] . "/yappa-ng_DEMO.jpg");
- $error_count = check_file($filename, $error_count);
- // file yappa-ng/cache/error_image.jpg
- $filename = singleslash($config['cache_root'] . "/error_image.jpg");
- $error_count = check_file($filename, $error_count);
- return $error_count;
- }
- /*
- * ***********************************************************************************************
- * function gd2_info()
- *
- * This is an alternate method for the gd_info() function
- * which exists on PHP >= 4.3.0 !
- * This function is a slightly modified version of the one found on PHP.net
- * in the PHP Manual posted by johnschaefer at gmx dot de
- * (search for function gd_info and go down to the usercomments)
- * Input: - (Parses the phpinfo - function)
- * Output: Infos on the GD-Library
- * ***********************************************************************************************
- */
- function gd2_info() {
- $gd_array = array(
- "GD Version" => "",
- "FreeType Support" => 0,
- "FreeType Support" => 0,
- "FreeType Linkage" => "",
- "T1Lib Support" => 0,
- "GIF Read Support" => 0,
- "GIF Create Support" => 0,
- "JPG Support" => 0,
- "PNG Support" => 0,
- "WBMP Support" => 0,
- "XBM Support" => 0
- );
- $gif_support = 0;
- ob_start();
- eval("phpinfo();");
- $l_php_info = ob_get_contents();
- //ob_end_flush();
- ob_end_clean();
- foreach(explode("\n", $l_php_info) as $line) {
- if(strpos($line, "GD Version")!==false) {
- $gd_array["GD Version"] = trim(str_replace("GD Version", "", strip_tags($line)));
- }
- if(strpos($line, "FreeType Support")!==false) {
- $gd_array["FreeType Support"] = trim(str_replace("FreeType Support", "", strip_tags($line)));
- }
- if(strpos($line, "FreeType Linkage")!==false) {
- $gd_array["FreeType Linkage"] = trim(str_replace("FreeType Linkage", "", strip_tags($line)));
- }
- if(strpos($line, "T1Lib Support")!==false) {
- $gd_array["T1Lib Support"] = trim(str_replace("T1Lib Support", "", strip_tags($line)));
- }
- if(strpos($line, "GIF Read Support")!==false) {
- $gd_array["GIF Read Support"] = trim(str_replace("GIF Read Support", "", strip_tags($line)));
- }
- if(strpos($line, "GIF Create Support")!==false) {
- $gd_array["GIF Create Support"] = trim(str_replace("GIF Create Support", "", strip_tags($line)));
- }
- if(strpos($line, "GIF Support")!==false) {
- $gif_support = trim(str_replace("GIF Support", "", strip_tags($line)));
- }
- if(strpos($line, "JPG Support")!==false) {
- $gd_array["JPG Support"] = trim(str_replace("JPG Support", "", strip_tags($line)));
- }
- if(strpos($line, "PNG Support")!==false) {
- $gd_array["PNG Support"] = trim(str_replace("PNG Support", "", strip_tags($line)));
- }
- if(strpos($line, "WBMP Support")!==false) {
- $gd_array["WBMP Support"] = trim(str_replace("WBMP Support", "", strip_tags($line)));
- }
- if(strpos($line, "XBM Support")!==false) {
- $gd_array["XBM Support"] = trim(str_replace("XBM Support", "", strip_tags($line)));
- }
- }
- if($gif_support==="enabled") {
- $gd_array["GIF Read Support"] = 1;
- $gd_array["GIF Create Support"] = 1;
- }
- if($gd_array["FreeType Support"]==="enabled") {
- $gd_array["FreeType Support"] = 1;
- }
- if($gd_array["T1Lib Support"]==="enabled") {
- $gd_array["T1Lib Support"] = 1;
- }
- if($gd_array["GIF Read Support"]==="enabled") {
- $gd_array["GIF Read Support"] = 1;
- }
- if($gd_array["GIF Create Support"]==="enabled") {
- $gd_array["GIF Create Support"] = 1;
- }
- if($gd_array["JPG Support"]==="enabled") {
- $gd_array["JPG Support"] = 1;
- }
- if($gd_array["PNG Support"]==="enabled") {
- $gd_array["PNG Support"] = 1;
- }
- if($gd_array["WBMP Support"]==="enabled") {
- $gd_array["WBMP Support"] = 1;
- }
- if($gd_array["XBM Support"]==="enabled") {
- $gd_array["XBM Support"] = 1;
- }
- return $gd_array;
- }
- /*
- * ***********************************************************************************************
- * function singleslash($path)
- *
- * This is to prevent multiple slashes or Windows style backslashes
- * Input: a path or url
- * Output: a path or url without doubleslashes and slashes only
- * ***********************************************************************************************
- */
- function singleslash($path) {
- $path = str_replace("\\","/",$path );
- $l_single_slash = str_replace("///","/",$path);
- $path = str_replace("//","/",$l_single_slash);
- $l_single_slash = str_replace("%2F%2F%2F","%2F",$path);
- $single_slash = str_replace("%2F%2F","%2F",$l_single_slash);
- return $single_slash;
- }
- /*
- * ***********************************************************************************************
- * function singlebackslash($path)
- *
- * This is to prevent multiple backslashes
- *
- * setup.php v1.0 had a bug with backslashes. Could happen, that there where multiple
- * backslashes (doubling every save!!)
- * This function not only takes care of double-backslashes but removes ALL of them!
- *
- * Input: a path or url
- * Output: a path or url without multiple backslashes
- * ***********************************************************************************************
- */
- function singlebackslash($path) {
- $check = TRUE;
- $check = TRUE;
- while ($check) {
- $l_dummy = strpos($path,"\\\\");
- if ($l_dummy === FALSE) {
- $check = FALSE;
- } else {
- $path = str_replace("\\\\","\\",$path);
- }
- }
- return $path;
- }
- /*
- * ***********************************************************************************************
- * function strip_slashes($path)
- *
- * This is to check PHP-setting of magic_quotes_gpc()
- * If its "On" then strip the slashes - else leave it alone!
- * Input: a path or url
- * Output: a path or url with corrected stripslashes
- * ***********************************************************************************************
- */
- function strip_slashes($path) {
- if (get_magic_quotes_gpc()) {
- $path = stripslashes($path);
- }
- return $path;
- }
- /*
- * ***********************************************************************************************
- * function remTrailSlash($path)
- *
- * This is to strip trailing slashes from paths
- * Input: a path or url and a count (should be zero (=0)!!!)
- * Output: a path or url without trailing slashes
- * ***********************************************************************************************
- */
- function remTrailSlash($path, $count) {
- // remove automatically added slashes if magic_quotes_gpc=On and loop is first round ($count=0)
- if (get_magic_quotes_gpc() && ($count = 0)) {
- $path = stripslashes($path);
- }
- $count=1;
- // remove all leading and trailing whitespace
- $path = trim($path);
- // this is the path
- $path_clean = $path;
- $len = strlen($path);
- $last_char = substr($path,($len - 1),1);
- // check if the last character is a slash or backslash
- if (($last_char == "/") or ($last_char == "\\")) {
- // remove last character
- $path = substr($path,0,($len - 1));
- // call function again to take a look at the now last character
- $path_clean = remTrailSlash($path, $count);
- }
- return $path_clean;
- }
- /*
- * ***********************************************************************************************
- * ***
- * *** START INITIALIZING
- * ***
- * ***********************************************************************************************
- */
- if (empty($_SERVER['QUERY_STRING'])) {
- print "<BR><BR><h1>No QUERY_STRING!</h1><BR><BR>Please call this Tool from the "safe_mode_start.php"!<BR><BR>";
- exit();
- }
- if (empty($_GET['installpath'])) {
- $l_query_string = str_replace("%2F", "/", $_SERVER['QUERY_STRING']);
- $l_query_string = str_replace("?", "", $l_query_string);
- $config_source_root = str_replace("installpath=", "", $l_query_string);
- if($l_query_string == $config_source_root) {
- print "<BR><BR><h1>Wrong QUERY_STRING!</h1><BR><BR>Please call this Tool from the "safe_mode_start.php"!<BR><BR>";
- print "<BR><BR>The QUERY_STRING sent is: " . $_SERVER['QUERY_STRING'] . "<BR>";
- exit();
- }
- } else {
- $config_source_root = $_GET['installpath'];
- }
- initialize_config();
- $config['errorcount'] = 0;
- //}
- /*
- * ***********************************************************************************************
- * ***
- * *** START HTML OUTPUT
- * ***
- * ***********************************************************************************************
- */
- writeHTMLheader();
- ?>
- </td></tr>
- <?php
- /* check for safemode */
- if (ini_get('safe_mode')) { ?>
- <tr><td colspan=6 class="mainComment">The PHP-Installation on this Server is running in "Safe Mode"!</td></tr>
- <?php
- if (ini_get('safe_mode_exec_dir')) { ?>
- <tr><td colspan=6 class="Comments">The Safe Mode Execution Directory is set to: <?php ini_get('safe_mode_exec_dir'); ?></td></tr>
- <?php }
- if (ini_get('safe_mode_gid')) { ?>
- <tr><td colspan=6 class="Comments">The GroupID related to the Safe Mode setting is set! ?></td></tr>
- <?php }
- if (ini_get('safe_mode_include_dir')) { ?>
- <tr><td colspan=6 class="Comments">The Safe mode Include Directory is set to: <?php ini_get('safe_mode_include_dir'); ?></td></tr>
- <?php }
- if (ini_get('open_basedir')) { ?>
- <tr><td colspan=6 class="mainComment">The PHP-Installation on this Server has the "Open Basedir" PHP directive enabled!</td></tr>
- <tr><td colspan=6 class="Comments">All of the files used with yappa-ng have to be within the directory <?php print ini_get('open_basedir'); ?>
- Please read the appropriate section of the <a href="docs/INSTALL.html#open_basedir" target="_blank">INSTALL Manual</a>!</td></tr>
- <?php } ?>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan=6 class="Comments">If you want to know more about "Safe Mode" and what it means to you and the yappa-ng Setup
- take a view at the <a href="docs/INSTALL.html#safe_mode" target="_blank">INSTALL Manual</a>!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <?php
- } else { ?>
- <tr><td colspan=6 class="mainComment">The PHP-Installation on this Server is <b>NOT</b>running in "Safe Mode"!</td></tr>
- <tr><td colspan=6 class="Comments">You do not need this script! Please run the standard installation routine
- as described in the <a href="docs/INSTALL.html" target="_blank">INSTALL Manual</a>!</td></tr>
- <?php
- //exit;
- }
- ?>
- <tr><td colspan="6"> </td></tr>
- <?php
- if (isset($_POST['SubmittedFinal'])) {
- if ($_POST['SubmittedFinal']) {
- $answer = check_cache_root();
- }
- } ?>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan=6 class="Description">Uploading files</td></tr>
- <tr><td colspan=6 class="MainComment">Upload of some needed files.</td></tr>
- <tr><td colspan=6 class="Comments">
- Here you upload all files which are called directly and are not included into another file.
- And you upload the yappa-ng_DEMO.jpg image which you need for checking if something does not run as expected!
- Please search for the files to upload them to the webserver.<br>
- After hitting the "Submit" button this part of the installation will be finished! :-)
- </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td> </td><td nowrap>Upload file check_setup.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[check]"></td></tr>
- <tr><td> </td><td nowrap>Upload file index.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[index]"></td></tr>
- <tr><td> </td><td nowrap>Upload file setup.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[setup]"></td></tr>
- <tr><td> </td><td nowrap>Upload file show.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[show]"></td></tr>
- <tr><td> </td><td nowrap>Upload file slideshow.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[slideshow]"></td></tr>
- <tr><td> </td><td nowrap>Upload file toolbox.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[toolbox]"></td></tr>
- <tr><td> </td><td nowrap>Upload file toolbox_logview.php: </td><td colspan="4" align="left"><input type=file size=30 name="fupload[toollog]"></td></tr>
- <tr><td> </td><td nowrap>Upload file yappa-ng_DEMO.jpg: </td><td colspan="3" align="left"><input type=file size=30 name="fupload[demo]"></td><td align='left'> (located in the "yappa-ng/install" directory)</td></tr>
- <tr><td> </td><td nowrap>Upload file error_image.jpg: </td><td colspan="3" align="left"><input type=file size=30 name="fupload[errimg]"></td><td align='left'> (located in the "yappa-ng/install" directory)</td></tr>
- <tr><td colspan="6">Upload the languages you want. Upload and submit as often as you want!</td></tr>
- <tr><td> </td><td nowrap>Upload file Language 1: </td><td colspan="3" align="left"><input type=file size=30 name="fupload[lang1]"></td><td align='left'> (languages/lang_???.inc.php)</td></tr>
- <tr><td> </td><td nowrap>Upload file Language 2: </td><td colspan="3" align="left"><input type=file size=30 name="fupload[lang2]"></td><td align='left'> (???-> eng=English, ger=German, esp=espanol,...)</td></tr>
- <tr><td> </td><td nowrap>Upload file Language 3: </td><td colspan="3" align="left"><input type=file size=30 name="fupload[lang3]"></td><td align='left'> (languages/lang_???.inc.php)</td></tr>
- <tr><td colspan="6"><b>Do NOT forget to upload the rest of the language related files (language_selection.inc.php and languages_translated.inc.php) with FTP or cut&paste or ... in the next step!!!!!!</b></td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <?php
- /* ok - if you got until here - go on */
- if (isset($_POST['SubmittedFinal'])) {
- if ($_POST['SubmittedFinal']) {
- $answer = make_needed_dirs();
- //$answer = make_needed_files();
- $answer = upload_needed_files();
- $answer = save_config();
- }
- }
- $answer = 1;
- if (isset($_POST['SubmittedFinal'])) {
- if ($_POST['SubmittedFinal']) {
- $answer = check_installation();
- }
- } ?>
- <tr><td colspan="6"> </td></tr>
- <?php
- if ($answer == 0) { ?>
- <tr><td colspan="6"><a name="bottom"> </a></td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="gratulation">Gratulation! </td><td colspan="5" class="hint">Step 2 (of 4 steps) is finished! :-)</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="hint">Step 3: </td><td colspan="5" class="Comments">Now FTP (or copy&paste or move) <b>ALL</b> files of the yappa-ng release (including all subdirectories!) into the directory <?php print $config['source_root']; ?>!<br>
- <b>Please make sure that you do not overwrite any files!!!</b><br>
- Be sure to keep exactly the directory structure as it is in the release package!!!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="hint">Step 4: </td><td colspan="5" class="Comments">The last step is to point your browser to the file "setup.php" script and run it! Follow all instructions provided there!</td></tr>
- <tr><td> </td><td colspan="5" class="errormsg">Do not change any pathnames in the "Part 1 Main" - Section of the Setup Tool!! All these paths have been created now during step 1 and 2 !!!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="errormsg" colspan="6">Do not forget to delete the files "safe_mode_start.php" and "safe_mode_install.php"!!!</td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="gratulation" colspan="5" >Have Fun!!!! </td></tr>
- <?php
- exit;
- } else { ?>
- <tr><td colspan="6"> </td></tr>
- <tr><td class="errormsg">Not finished! </td><td colspan=5 class="errordesc">Please go on until all checks are green and the "Submit" button disappears!</td></tr>
- <?php
- writeHTMLsubmit("SubmittedFinal", "Submit All");
- exit;
- }
- /*
- * ***********************************************************************************************
- *
- * END of Part2 of the Safe Mode installation procedure!
- *
- * ***********************************************************************************************
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement