#!/usr/bin/perl # Installer script for AgoraCart Route 66 community version. ####################################################################### # # This installer script, AgoraCart and all associated files, except where noted, are # Copyright 2001 to Present jointly by K-Factor Technologies, Inc. # and by C E Mayo (aka Mister Ed) at AgoraCart.com & K-Factor.net # This is NOT FREE AND/OR GPL SOFTWARE! # This software is a separate script to install an ecommerce shopping cart and # is the confidential and proprietary information of K-Factor Technologies, Inc. You shall # not disclose such Confidential Information and shall use it only in # conjunction with installing the AgoraCart shopping cart. # # This file and related 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. # # This copyright notice may not be removed or altered in any way. # ####################################################################### # FTP/WWW Installation Instructions: # # This file is actually a perl program that may be used to install # AgoraCart on a UNIX or LINUX web hosting server that has FTP access or a File # Management app inside a web hosting control panel. # # This script requires the following Perl modules to be installed: # LWP::Simple # CGI # # Any remaining Perl modules necessary for AgoraCart to operate will be tested by this script. # # This script installs the latest AgoraCart Route 66 Community Version (06.6.x). # # # STEP 1 -- Put the correct path to perl on line 1 of this file, above. Default should be okay on most cPanel based servers. # # STEP 2 -- Transfer this file via FTP, in ASCII/text mode, in the directory of your # hosting account that you wish to install your store. # # STEP 3 -- Rename this file to myR66.cgi # # STEP 4 -- make this file readable/executeable (chmod 755) via your FTP software or file manager. # # STEP 5 -- If you already have a directory named 'ac66_new', please rename it to something else now! # ac66_new is a temporary directory used to install your new Route 66 storefront. # # STEP 6 -- run this script from your web browser via a URL like: # http://www.yourdomain.com/myR66.cgi # # STEP 7 -- Make sure this file is erased from your server immediately. # This script will attempt to delete itself and the compressed tar archive files it downloads. # use CGI qw(:standard); # cPanel only - loads perl modules local to the users account. eval('use cPanelUserConfig;'); $| = 1; # Flush $ENV{"PATH"} = "/bin:/usr/bin"; $my_path = $ENV{'PATH'}; $install_me = "communityRoute66_current.tgz"; $install_me_no_db = "communityRoute66_noDB_current.tgz"; $installer_file_name = "myR66.cgi"; print "Content-type: text/html\n\n"; &print_page_top(); if ( !( -e $installer_file_name ) ) { print qq~

AgoraCart Route 66 Installer Error


Thank you for using & supporting AgoraCart!


Please rename this file to $installer_file_name and try again!


~; &print_page_bottom(); exit(0); } foreach my $sparam (param()){$form_data{$sparam} = param($sparam);} if ( $form_data{"install_now"} ) { &get_extract(); exit(0); } print qq~


AgoraCart Route 66 Community Installer

Thank you for using AgoraCart!


Below you will find the information about your Perl version, OS (operating system), and the Perl modules that are required. Most are considered Perl core, and others are found on 95% of Linux based web servers. The only Perl module that is not on most servers is the GD Perl Module for graphics, which is okay as AgoraCart will run without it (only automatic image resizing is affected in a couple of manager screens). You can also ask to see if your hosting company will install any missing Perl modules, such as GD.

If things look okay, enter your Members only credentials below, and press the install button to get started. Once AgoraCart is installed, you will need to go to the store manager to do additional setups, including: the store URL, your emails, and chose a payment gateway. Other settings can be done later.


~; $my_id = `id`; $whoami = `whoami`; $linux_repsonse = qq|


If the Linux/Unix whoami command and the User ID responds back with your username, you can go ahead and proceed with the install.

|; if ( $whoami =~ /nobody|www|apache/i || $my_id =~ /nobody|www|apache/i ) { $linux_repsonse = qq|


The Unix whoami command and/or your UID response contains: 'nobody', 'www', 'apache' which might be a problem. If this is something other than your username (typically the ID you use to login with when accessing your hosting account), you should NOT use this install script without additional script wrappers.

If the Linux/Unix whoami command and the User ID responds back with your username, you can go ahead and proceed with the install.

|; } $server_name = "$ENV{'SERVER_NAME'}"; ( $core_modules, $my_modules ) = q{}; $test_perl_version = sprintf( "%vd", $^V ); $os_version = "$^O"; $perl_test_error_mesage = q{}; $perl_test_status = ''; my ( $major, $majorMin, $minner ) = split( /\./, $test_perl_version ); if ( ( $major < 5 ) || ( ( $major == 5 ) && ( $majorMin < 8 ) ) || ( ( $major == 5 ) && ( $majorMin == 8 ) && ( $minner < 9 ) ) ) { $perl_test_error_mesage = qq| WARNING: Your Perl version is VERY old (Released before 2006). The current Perl version on newer servers is 5.12.4 or 5.16.2. The AgoraCart Route 66 community version requires Perl 5.8.8 or higher, but versions 5.10.1/5.12.4 thru 5.20.x are recommended. Please ask your hosting provider if they have an additional Perl version installed that your scripts can use.

|; $perl_test_status .= ' but very old. See warning message at bottom!'; } if ( ( $major == 5 ) && ( $majorMin < 12 ) && ( $minner < 9 ) ) { $perl_test_error_mesage = qq||; $perl_test_status .= 'but slightly outdated!'; } print qq~
\n

Perl / OS / System Information

Perl version:$test_perl_version $perl_test_status | Operating System: $os_version

Scripts are running under User ID:$my_id

Linux/Unix 'whoami' responds with:$whoami

Server Name:$server_name

$linux_repsonse


~; print qq|
\n
\n

Perl Modules - Core

\n

|; # core modules, should be okay foreach $x(qw( Archive::Extract Archive::Tar Encode File::Copy File::Copy::Recursive File::Find File::Path Locale::Country LWP::Protocol::https MIME::QuotedPrint )) { eval "use $x"; $core_modules .= qq|$x:|; $core_modules .= "$@" ? ''."" : ''; $core_modules .= "
\n"; } print $core_modules; print qq|

\n

Perl Modules - Required

\n

|; # required modules. Some we install local to script foreach $x(qw( CGI::Simple::Standard GD HTTP::BrowserDetect HTTP::Request LWP::UserAgent LWP::Simple XML::Simple )) { eval "use $x"; $my_modules .= qq|$x:|; if ( $x eq "CGI::Simple::Standard" || $x eq "HTTP::BrowserDetect" || $x eq "XML::Simple" ) { $my_modules .= "$@" ? ' But we will install a copy for you'."" : ''; } elsif ($x eq "GD") { $my_modules .= "$@" ? '-- Store & Manager areas will work ok -- but you cannot use automatic image resizing for product images on product add & edit screens'."" : ''; } else { $my_modules .= "$@" ? ''."" : ''; } $my_modules .= "
\n"; } print $my_modules; print qq|

\n|; print qq~


\n

Enter Your Basic Store Setup Info



~; &print_page_bottom(); exit(0); ####################################################################### ####################################################################### sub print_page_top { print < AgoraCart Route 66 Community Version Installer
ENDOFTEXT } ####################################################################### sub print_page_bottom { print <


ENDOFTEXT } ####################################################################### sub agc_no_file_open { print "

Can't Open $install_me exiting now!

"; exit(0); } ####################################################################### sub get_extract { my $sleep_seconds = 3; my $sleeper = 0; my $result = ''; my $mydie = ''; use Archive::Tar; use Archive::Extract; $newDirectoryName = $form_data{"newDirectoryName"}; $useNonSSL = $form_data{"useNonSSL"}; $newDirectoryName =~ /^([-+\w.\.\,]+)$/; $newDirectoryName = $1; $newDirectoryLevels = $form_data{"newDirectoryLevels"}; if ( $form_data{"newDirectoryLevels"} ) { $newDirectoryLevels =~ /^([-+\w.\.\/]+)$/; $newDirectoryLevels = $1; $newDirectoryLevels =~ s/^\///; $newDirectoryLevels =~ s/\/$//; $newDirectoryLevels = $newDirectoryLevels . '/'; } $newFile = ''; $install_path = $ENV{REQUEST_URI}; $install_path =~ s/$installer_file_name//i; $myhost = $ENV{HTTP_HOST}; &print_page_top(); print <AgoraCart Route 66 Members Only Version Installation In Progress


ENDOFTEXT if ( -d $newDirectoryName ) { print qq|

ERROR: The requested new directory name, $newDirectoryName, is already used.

Please press the back button and enter a different directory name for your new AgoraCart installation.


|; exit(0); } print <Retrieving current Route 66 Community Version file from AgoraCart.com . ENDOFTEXT sleep(1); print ' . '; use LWP::UserAgent; if ( $useNonSSL eq 'yes' ) { $browser = LWP::UserAgent->new(); $browser->agent( 'AgoraCart-C-Installer' ); $req = HTTP::Request->new(GET => "http://agoracart.com/downloadupdates/Route66/$install_me"); } else { $browser = LWP::UserAgent->new( ssl_opts => { verify_hostname => "0", }, protocols_allowed => ["https"] ); $browser->agent( 'AgoraCart-C-Installer' ); $req = HTTP::Request->new(GET => "https://agoracart.com/downloadupdates/Route66/$install_me"); } my $response = $browser->request($req); $file = $response->content(); print ' . '; sleep(1); # success/error conditionals if ( $file ) { print qq|. Done


Done: $install_me successfully retrieved.

|; open(INSTALLFILE, ">./$install_me" ) || &agc_no_file_open(); print(INSTALLFILE $file); close(INSTALLFILE); sleep(1); print qq|

Done: $install_me successfully saved

|; # Now extract AgoraCart install file $Archive::Tar::CHMOD = 0; # PRESERVE PERMISSIONS! my $artar = Archive::Tar->new(); $artar->read( $install_me ); $artar->extract(); my $size = -s $install_me; if ( $size < 1024000 ) { # at least half of the known file size $file = ''; # it is not really the file unlink("$install_me"); unlink("$installer_file_name"); &agc_no_file_open; } sleep(1); print qq|

Done: $install_me successfully extracted

|; if ( (-d 'ac66_new' ) && ( -e "ac66_new/agora.cgi" ) ) { `mv ac66_new $newDirectoryName`; print qq|


Your New AgoraCart installation Successfully Renamed to: $newDirectoryName

|; } else { print qq|


Your New AgoraCart installation was not in the expected directory.

Please try again or seek help in our Members Only user forums or other support/chat channels

|; unlink("$install_me"); print qq|

Done: $install_me successfully deleted

|; unlink("$installer_file_name"); print qq|

Done: $installer_file_name (this script you're running) successfully deleted

|; # ' exit(0); } $file2remode = "$newDirectoryName/agora.cgi"; system("chmod 755 ./$file2remode"); $file2remode = "$newDirectoryName/pplistnr.cgi"; system("chmod 755 ./$file2remode"); $file2remode = "$newDirectoryName/manager/manager.cgi"; system("chmod 755 ./$file2remode"); print qq|

Done: Executable permissions set to 755

|; open(USERLIB, "<", "$newDirectoryName/user_config66/cart/agora_user_lib.pl"); while () { if ( $newDirectoryLevels ) { $_ =~ s/\[\[storeName\]\]/$newDirectoryLevels$newDirectoryName/; } else { $_ =~ s/\[\[storeName\]\]/$newDirectoryName/; } $newFile .= $_; } close(USERLIB); open(UPDATELIB, ">", "$newDirectoryName/user_config66/cart/agora_user_lib.pl"); print UPDATELIB $newFile; close(UPDATELIB); print qq|

Done: User Configs Updated for New Directory Name

|; unlink("$install_me"); print qq|

Done: $install_me successfully deleted

|; unlink("$installer_file_name"); print qq|

Done: $installer_file_name (this script you're running) successfully deleted

|; } else { print '


ERROR: The requested files were not reachable for updates.

Please press the back button and check your password settings.


'; #' exit(0); } $myhost =~ s/www\.//i; $install_path = $myhost . $install_path . $newDirectoryName . '/'; $myip = $ENV{SERVER_ADDR}; my $url = qq|://agoracart.com/misc_info/agoracart.cgi?stloc=$install_path&stdom=$myhost&stip=$myip&agcfun=install&mgrver=06.6.00.0000&mgrgp=c|; if ( $useNonSSL eq 'yes' ) { $url = 'http' . $url; $browser2 = LWP::UserAgent->new(); } else { $url = 'https' . $url; $browser2 = LWP::UserAgent->new( ssl_opts => { verify_hostname => "0", }, protocols_allowed => ["https"] ); } $browser2->agent('AgoraCart-Installer'); $req2 = HTTP::Request->new(GET => $url); my $response = $browser2->request($req2); print <

AgoraCart Route 66 Setup Tips


Thank you for installing AgoraCart. Your AgoraCart Route 66 Community Version shopping cart has been installed, but it will still need some basic configuration before it is fully functional.

Please edit your store settings & configuration using the following link (Please bookmark it!):

Your New Store Manager Area

using the following default credentials:
username: manager
password: admin


SETUP NOTES:

1) Make sure to setup the Main/Core Agoracart Settings prior to setting any other settings
2) Set the password settings prior to using the update/upgrade manager.


Initial/Basic Setup Cheat Sheet


Setup your Gold version in the order listed below, using the included online managers found by clicking on "Store Settings" link on the left side menu:

  • Main/Core AgoraCart Settings (make sure your URLs are correct! save and login again)
  • Password Settings (change the defaults, save and then login again - NEVER, EVER LEAVE THE DEFAULTS ACTIVE)
  • Set .htaccess protection (on main link menu, skip if not shown as a link. submit and login at popup login screen - this can be skipped and warnings disabled in the Misc tab of the Main/Core AgoraCart Settings manager)
  • Under Main/Core AgoraCart Settings configure items under the following tabs and then save:
    • Email
    • Checkout
    • Security
    • MetaTags
    • Misc
  • Upgrade AgoraCart Modules (upgrade any modules that should be upgraded. Skip new modules/features for now)
  • Shipping Settings and Custom Logic (set up. If not sure, consult user manuals and forums for help)
  • Tax Settings and Custom Logic (set up. If not sure, consult user manuals and forums for help)
  • Payment Gateway (set gateways & edit from Payment Gateway Settings manager found in the Store Settings area)
  • Test store with default products (can delete later)
  • Setup Templates & Layouts (choose template or copy one and then select it, edit other layout settings)
  • Enter Products & Services (just a few, to see how it works, delete demo products)
  • Test store with new products
  • Finish any remaining store setup and product/service database entry.
ENDOFTEXT &print_page_bottom(); } #######################################################################