$Title

$Content
 

"; return $r; } function check_directory($directory='') { if ($directory == '') return false; $fullpath = dirname(__FILE__) . '/../../'.$directory; if (!is_dir($fullpath)) { if (!mkdir($fullpath, 0755)) { $title = 'Folder Missing'; $msg = "The \"" . str_replace('admin/functions/../../', '', $fullpath) . "\" folder is missing. I attempted to create this folder but failed. Please create this folder and CHMOD this folder to 757."; return array(false, $title, $msg); } return array(true, '', ''); } // Check the folder if(!is_writable($fullpath)) { // Directory isn't writable... $title = 'Folder is unwritable'; $msg = "The \"" . realpath($fullpath) . "\" folder is not writable. Please CHMOD this folder to 757."; return array(false, $title, $msg); } return array(true, '', ''); } function AllPermissions() { global $OUTPUT, $configfilepath; $message = ""; // Check the config file if(!is_file($configfilepath)) { $fullpath = dirname(__FILE__) . '/../../includes/config.inc.php'; $fullpath = str_replace('admin/functions/../../', '', $fullpath); // Config file isn't writable $message .= "I can't find the \"" . $fullpath . "\" file. Please check it exists.
"; } if(!is_writable($configfilepath)) { // Config file isn't writable $message .= "The \"" . realpath($configfilepath) . "\" file is not writable. Please CHMOD this file to 777.
"; } $dirs_to_check = array('archive', 'temp', 'temp/images', 'temp/attachments'); foreach($dirs_to_check as $dir) { list($status, $title, $msg) = check_directory($dir); if (!$status) { $message .= $msg . '
'; } } // Check the archive/index.php folder if(!is_readable('../archive/index.php')) { $message .= "The \"archive/index.php\" file is not readable. Please CHMOD this file to 757.
"; } // Check the archive/index_list.php folder if(!is_readable('../archive/index_list.php')) { // Config file isn't writable $message .= "The \"archive/index_list.php\" file is not readable. Please CHMOD this file to 757.
"; } if ($message) { $message .= "
Click on the \"Try Again\" button below
"; $OUTPUT .= MakeInstallErrorBox("Check Permissions", $message); return false; } // Everything is OK return true; } switch($Step) { default: $OUTPUT = '
Welcome to the SendStudio Installation Wizard!
 


 Thank You for Purchasing SendStudio!


Welcome to the SendStudio installation wizard. Over the next 3 steps you will be asked for various details that will be used by SendStudio to build your MySQL database and configuration file. If you are unsure about what any particular option means, simply move your mouse over the help icon next to that item to learn more about it. To get started, please click on the "Proceed" button below.

'; break; case '1': if(AllPermissions()) { if ($safe_mode) { $OUTPUT .= '
Warning
Safe mode is active on this server.
This means archiving of newsletters and also sending of newsletters is affected.
Archiving will not work unless the hosting company changes ownerships of the archive/index_list.php file.
Newsletters will bounce back to the person sending the newsletter, not to the "Return-Path" address specified.
See http://www.php.net/features.safe-mode and
http://www.php.net/manual/en/features.safe-mode.functions.php for technical reasons.

'; } // Database box $FORM_ITEMS[$FORM_REQUIRED_ITEM . "MySQL Server"] = "textfield|MySQLServer:100:44:localhost"; $HELP_ITEMS["MySQLServer"]["Title"] = "MySQL Server"; $HELP_ITEMS["MySQLServer"]["Content"] = "MySQL server I.P. address/hostname, such as \'localhost\'"; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "MySQL Username"] = "textfield|MySQLUsername:100:44:"; $HELP_ITEMS["MySQLUsername"]["Title"] = "MySQL Server"; $HELP_ITEMS["MySQLUsername"]["Content"] = "Username for a valid MySQL account, such as \'admin\'"; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "MySQL Password"] = "password|MySQLPassword:100:44::0"; $HELP_ITEMS["MySQLPassword"]["Title"] = "MySQL Password"; $HELP_ITEMS["MySQLPassword"]["Content"] = "Password for a valid MySQL account, such as \'mypassword\'"; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "MySQL Database"] = "textfield|MySQLDatabase:100:44:"; $HELP_ITEMS["MySQLDatabase"]["Title"] = "MySQL Database"; $HELP_ITEMS["MySQLDatabase"]["Content"] = "MySQL database name where SendStudio information will be saved, such as \'mydatabase\'"; $FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . "Table Prefix"] = "textfield|TablePrefix:100:44:ss_"; $HELP_ITEMS["TablePrefix"]["Title"] = "Table Prefix"; $HELP_ITEMS["TablePrefix"]["Content"] = "Optional text to be prepended to all table names, such as \'ss_\'"; $FORM_ITEMS[-1]="submit|Proceed"; $FORM = new AdminForm; $FORM->title = "MySQL Details"; $FORM->items = $FORM_ITEMS; $FORM->action = "index.php?page=install&Step=2"; $FORM->MakeForm("MySQL Database Details"); $intro_text = 'Please enter the details for your MySQL database in the form shown below.
Fields marked with an asterisk (*) are required.'; $OUTPUT .= MakeBox("SendStudio Installation Wizard (Step 1 of 3)", $intro_text . $FORM->output); $OUTPUT .= ' '; } break; case '2': $servername = stripslashes($_POST['MySQLServer']); $username = stripslashes($_POST['MySQLUsername']); $password = stripslashes($_POST['MySQLPassword']); $database = stripslashes($_POST['MySQLDatabase']); $tableprefix = stripslashes($_POST['TablePrefix']); // Can we connect to the database? $svrConn = @mysql_connect($servername, $username, $password); if(!$svrConn) { // Couldn't connect to the database server $OUTPUT .= MakeErrorBox("Database Error", "An error occurred while trying to connect to your MySQL database server. The error was: '" . mysql_error() . "'."); break; } /* $dbConn = @mysql_select_db('mysql', $svrConn); $result = @mysql_query("CREATE DATABASE IF NOT EXISTS " . $database); if (!$result) { $OUTPUT .= MakeErrorBox("Database Error", "Unable to create new database '" . $database . "'. Please type in an existing database name or manually create this database."); break; } */ // Can we connect to the database? $dbConn = @mysql_select_db($database, $svrConn); if(!$dbConn) { // Couldn't connect to the datbase $OUTPUT .= MakeErrorBox("Database Error", "An error occurred while trying to connect to your MySQL database. The error was: '" . mysql_error() . "'."); break; } require(dirname(__FILE__) . '/../includes/schema.php'); // Can we create the tables? $errors = array(); foreach($tableSchema as $table) { $result = mysql_query(str_replace("%%TABLEPREFIX%%", $tableprefix, $table)); if (!$result) { $errors[] = mysql_error(); } } if(!empty($errors)) { // An error occurred while building the tables $OUTPUT .= MakeInstallErrorBox("Database Error", "An error occurred while trying to build your MySQL database tables. The errors were: '" . implode('
', $errors) . "'. Click on the \"Try Again\" button below to try again."); } else { // The tables were built OK. Add the default admin user mysql_query("INSERT INTO " . $tableprefix . "admins SET Username='admin', Password='".md5('password')."', Manager='1', Root='1', Status='1'"); $FORM_ITEMS[$FORM_REQUIRED_ITEM . "SendStudio URL"] = "textfield|SendStudioURL:100:44:" . str_replace(':', '$$COLON$$', $ROOTURL); $HELP_ITEMS["SendStudioURL"]["Title"] = "SendStudio URL"; $HELP_ITEMS["SendStudioURL"]["Content"] = "The full URL to the main SendStudio directory, such as \'http://www.mysite.com/sendstudio/\'. The install script has tried to guess this URL for you, please check it is correct."; $RDir = str_replace('\\', '/', $ROOTDIR); $FORM_ITEMS[$FORM_REQUIRED_ITEM . "SendStudio Path"] = "textfield|SendStudioPath:100:44:" . str_replace(':', '$$COLON$$', $RDir); $HELP_ITEMS["SendStudioPath"]["Title"] = "SendStudio Path"; $HELP_ITEMS["SendStudioPath"]["Content"] = "The full path to the main SendStudio directory, such as \'/htdocs/www/sendstudio/\'."; $FORM_ITEMS[$FORM_REQUIRED_ITEM . "License Key"] = "textfield|LicenseKey:100:44:"; $HELP_ITEMS["LicenseKey"]["Title"] = "License Key"; $HELP_ITEMS["LicenseKey"]["Content"] = "The license key that was emailed to you when you ordered."; $FORM_ITEMS[-10]="hidden|MySQLServer:" . $servername; $FORM_ITEMS[-11]="hidden|MySQLUsername:" . $username; $FORM_ITEMS[-12]="hidden|MySQLPassword:" . $password; $FORM_ITEMS[-13]="hidden|MySQLDatabase:" . $database; $FORM_ITEMS[-14]="hidden|TablePrefix:" . $tableprefix; $FORM_ITEMS[-1]="submit|Proceed"; $FORM = new AdminForm; $FORM->title = "MySQL Details"; $FORM->items = $FORM_ITEMS; $FORM->action = "index.php?page=install&Step=3"; $FORM->MakeForm("SendStudio Location Details"); $intro_text = 'Please enter the details for the location details in the form shown below.
Fields marked with an asterisk (*) are required. '; $OUTPUT .= MakeBox("SendStudio Installation Wizard (Step 2 of 3)", $intro_text . $FORM->output); $OUTPUT .= ' '; } break; case '3': $servername = stripslashes($_POST['MySQLServer']); $username = stripslashes($_POST['MySQLUsername']); $password = stripslashes($_POST['MySQLPassword']); $database = stripslashes($_POST['MySQLDatabase']); $tableprefix = stripslashes($_POST['TablePrefix']); $licensekey = stripslashes($_POST['LicenseKey']); $SendStudioURL = stripslashes($_POST['SendStudioURL']); $SendStudioPath = stripslashes($_POST['SendStudioPath']); if (substr($SendStudioURL, -1) != '/') $SendStudioURL .= '/'; if (substr($SendStudioPath, -1) != '/') $SendStudioPath .= '/'; $FORM_ITEMS["Show Info Tips"] = "checkbox|ShowInfoTips:1:Yes, show info tips :CHECKED"; $HELP_ITEMS["ShowInfoTips"]["Title"] = "Show Info Tips?"; $HELP_ITEMS["ShowInfoTips"]["Content"] = "If ticked, SendStudio will show a random email marketing tip across of the top of the control panel."; $sel = 'CHECKED'; if ($safe_mode) $sel = ''; $FORM_ITEMS["Auto Archive Content"] = "checkbox|AutoArchive:1:Yes, auto archive content :" . $sel; $HELP_ITEMS["AutoArchive"]["Title"] = "Auto Archive Content"; $HELP_ITEMS["AutoArchive"]["Content"] = "If ticked, SendStudio will save a copy of each newsletter sent to the /sendstudio/archive folder automatically."; $FORM_ITEMS["Send Emails via Cron"] = "checkbox|ServerSending:1:Yes, send emails via cron :0:onchange=\"CronAlert(this);\""; $HELP_ITEMS["ServerSending"]["Title"] = "Send emails via cron"; $HELP_ITEMS["ServerSending"]["Content"] = "If ticked, SendStudio will send the emails via cron instead of through the popup window.

This is required to schedule sending of newsletters and autoresponders.

If you are unsure of how to setup cron on your server, please see the documentation or contact your administrator"; $FORM_ITEMS[-10]="hidden|MySQLServer:" . $servername; $FORM_ITEMS[-11]="hidden|MySQLUsername:" . $username; $FORM_ITEMS[-12]="hidden|MySQLPassword:" . $password; $FORM_ITEMS[-13]="hidden|MySQLDatabase:" . $database; $FORM_ITEMS[-14]="hidden|TablePrefix:" . $tableprefix; $FORM_ITEMS[-15]="hidden|LicenseKey:" . $licensekey; $FORM_ITEMS[-16]="hidden|SendStudioURL:" . str_replace(':', '$$COLON$$', $SendStudioURL); $FORM_ITEMS[-17]="hidden|SendStudioPath:" . str_replace(':', '$$COLON$$', $SendStudioPath); $FORM_ITEMS[-1]="submit|Proceed"; $FORM = new AdminForm; $FORM->title = "MySQL Details"; $FORM->items = $FORM_ITEMS; $FORM->action = "index.php?page=install&Step=4"; $FORM->MakeForm("SendStudio Miscellaneous Details"); $intro_text = 'Please enter the details for the various miscellaneous settings in the form shown below.
Fields marked with an asterisk (*) are required.'; $OUTPUT .= MakeBox("SendStudio Installation Wizard (Step 3 of 3)", $intro_text . $FORM->output); $OUTPUT .= ' '; break; case 4: $servername = stripslashes($_POST['MySQLServer']); $username = stripslashes($_POST['MySQLUsername']); $password = stripslashes($_POST['MySQLPassword']); $database = stripslashes($_POST['MySQLDatabase']); $tableprefix = stripslashes($_POST['TablePrefix']); $licensekey = stripslashes($_POST['LicenseKey']); $ROOTURL = stripslashes($_POST['SendStudioURL']); $ROOTDIR = stripslashes($_POST['SendStudioPath']); $infotips = (isset($_POST['ShowInfoTips'])) ? 1 : 0; $autoarchive = (isset($_POST['AutoArchive'])) ? 1 : 0; $serversending = (isset($_POST['ServerSending'])) ? 1 : 0; $config = ''; if (!$fp = fopen($ROOTDIR . 'includes/config.inc.php', 'w')) { $OUTPUT .= MakeInstallErrorBox("Unable to save", 'Unable to open ' . $ROOTDIR . 'includes/config.inc.php' . ': ' . $php_errormsg); } fputs($fp, $config, strlen($config)); fclose($fp); // $OUTPUT .= MakeSuccess2Box("SendStudio Installation Complete!", "Congratulations! Your copy of SendStudio has been installed successfully.
Your default username is admin and your password is password.
Click on the button below to login.

", MakeAdminLink("index")); $OUTPUT .= "
SendStudio Installation Complete!
 


  Congratulations! SendStudio has been successfully installed on your web server.


Remember, you can modify any of the settings for SendStudio by clicking on the \"Settings\" tab in the control panel.

Please click on the button below to login to the SendStudio control panel, where you can start setting up users, mailing lists and newsletters etc.

Your default account username is admin and your default account password is password. You can change your password in the users section.


 

"; break; } ?>