From: Steve Sutton Date: Fri, 30 Sep 2016 18:11:41 +0000 (-0400) Subject: Getting the site to run locally X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=58bc9d546be38daf224065c16e4da47200e29505;p=web%2Fwww.mackinacbridge.org.git Getting the site to run locally --- diff --git a/.htaccess b/.htaccess index 63a309d..47f8eaa 100755 --- a/.htaccess +++ b/.htaccess @@ -1,8 +1,8 @@ -Options +FollowSymLinks +#Options +FollowSymLinks #ErrorDocument 404 /www.?????.com/sitemap.php?nf=1 RewriteEngine On AddDefaultCharset utf-8 -#RewriteBase /www.mackinacbridge.org/ +RewriteBase /www.mackinacbridge.org/ RewriteRule ^.*-17/([A-Za-z0-9\+]*)/$ index\.php?catid=17&category=$1 [L] RewriteRule ^.*-22/([0-9]*)/$ index\.php?catid=22&card=$1 [L] RewriteRule ^.*-([0-9]*)/([0-9]*)/$ index\.php?catid=$1&photo_catid=$2 [L] diff --git a/classes/class_db.inc b/classes/class_db.inc index 0fec491..37e1765 100755 --- a/classes/class_db.inc +++ b/classes/class_db.inc @@ -1,7 +1,7 @@ * Database abstraction layer for postgres (mainly) * Database abstraction layer for postgres (mainly) @@ -10,7 +10,7 @@ * @package Toolbox Library * @subpackage Database Library * @filesource - * + * */ /** * Database Class :) @@ -28,78 +28,70 @@ * @version $Revision: 1.3 $ * @since $Date: 2010/03/08 19:15:16 $ * @todo create mysql part of these function for abstraction also - * - + * + */ -class GLM_DB +class GLM_DB { /** - * host + * host * string host database host server name - * + * * @var mixed * @access public */ var $host; /** - * dbname - * string dbname name of the database - * + * dbname + * string dbname name of the database + * * @var mixed * @access public */ var $dbname; /** - * user + * user * string user The user to connect as - * + * * @var mixed * @access public */ var $user; /** - * password - * string password The users password if any - * + * password + * string password The users password if any + * * @var mixed * @access public */ var $password; /** - * dbd + * dbd * string dbd Database connection result ID# - * + * * @var mixed * @access public */ var $dbd; /** - * conn + * conn * string conn string postgres connection string default = CONN_STR - * + * * @var mixed * @access public */ var $conn; /** - * trans - * boolean trans bool if true a transaction is in process - * + * trans + * boolean trans bool if true a transaction is in process + * * @var mixed * @access public */ var $trans; /** - * dbd - * resource dbd connection object from postgres - * - * @var mixed - * @access public - */ - var $dbd; - /** - * Result - * + * Result + * * @var mixed * @access public */ @@ -110,17 +102,17 @@ class GLM_DB $this->host = ""; $this->dbname = ""; $this->user = "nobody"; - $this->password = ""; + $this->password = ""; $this->conn = $conn; - $this->trans = 0; + $this->trans = 0; $this->dbd = ""; } - /** + /** * db_connect * - * Creates a connection to database specified $conn_str, - * and returns a boolean for success. + * Creates a connection to database specified $conn_str, + * and returns a boolean for success. * * @uses GLM_DB::$dbd * @uses GLM_DB::$conn @@ -128,18 +120,18 @@ class GLM_DB * @uses GLM_DB::$host * @uses GLM_DB::$user * @uses GLM_DB::$password - * {@source } - * @param conn_str Connect String + * {@source } + * @param conn_str Connect String * @param fail_mode Failure Mode TRUE = Abort with HTML FALSE = Return with fail code - * @returns int - * @access public + * @returns int + * @access public */ function db_connect() { if( isset( $this->dbd ) && $this->dbd != "" ) { - return( $this->dbd ); + return( $this->dbd ); } switch ( DB_TYPE ) { @@ -149,7 +141,7 @@ class GLM_DB $conn = $this->conn;// CONN_STR; } else - { + { $conn .= ( $this->host ) ? 'host='.$this->host.' ' : ''; $conn .= ( $this->dbname ) ? 'dbname='.$this->dbname.' ' : ''; $conn .= ( $this->user ) ? 'user='.$this->user." " : ''; @@ -165,17 +157,17 @@ class GLM_DB return( 0 ); break; } - return( $this->dbd ); + return( $this->dbd ); } - /** db_close + /** db_close * - * Closes the connection to database specified by the handle dbd - * returns a boolean for success + * Closes the connection to database specified by the handle dbd + * returns a boolean for success * - * {@source } - * @returns bool - Returns 1 on success 0 if dbd is not a valid connection - * @access public + * {@source } + * @returns bool - Returns 1 on success 0 if dbd is not a valid connection + * @access public */ function db_close() @@ -192,19 +184,19 @@ class GLM_DB /** db_exec * - * Execute an SQL query, * returning a valid result index or zero(0) on - * failure. + * Execute an SQL query, * returning a valid result index or zero(0) on + * failure. * - * {@source } - * @param $qs -- SQL query string - * @returns int Returns a valid result index on success 0 on failure - * @access public + * {@source } + * @param $qs -- SQL query string + * @returns int Returns a valid result index on success 0 on failure + * @access public */ function db_exec( $qs ) { if( !$this->dbd ) { - $this->dbd = $this->db_connect(); + $this->dbd = $this->db_connect(); } switch ( DB_TYPE ) { @@ -220,15 +212,15 @@ class GLM_DB /** db_fetch_array * - * Stores the data in associative indices, using the field names as - * keys. + * Stores the data in associative indices, using the field names as + * keys. * - * {@source } - * @param $res -- valid database result index - * @param $i -- row number - * @param $type -- PGSQL_ASSOC,PGSQL_BOTH,PGSQL_NUM - * @returns array Returns an associative array of key-value pairs - * @access public + * {@source } + * @param $res -- valid database result index + * @param $i -- row number + * @param $type -- PGSQL_ASSOC,PGSQL_BOTH,PGSQL_NUM + * @returns array Returns an associative array of key-value pairs + * @access public */ function db_fetch_array( $res, $i, $type ) @@ -247,12 +239,12 @@ class GLM_DB /** db_freeresult * - * Free result memory. + * Free result memory. * - * {@source } - * @param $res -- valid database result index - * @returns bool - Returns 1 for success 0 for failure - * @access public + * {@source } + * @param $res -- valid database result index + * @returns bool - Returns 1 for success 0 for failure + * @access public */ function db_freeresult( $res ) @@ -271,12 +263,12 @@ class GLM_DB /** db_numrows * - * Determine number of rows in a result index + * Determine number of rows in a result index * - * {@source } - * @param $res -- valid database result index - * @returns int - Returns number of rows - * @access public + * {@source } + * @param $res -- valid database result index + * @returns int - Returns number of rows + * @access public */ function db_numrows( $res ) @@ -295,17 +287,17 @@ class GLM_DB } /** db_auto_get_array * - * The auto function for retrieving an array based soley on a query - * string. This function makes the connection, does the exec, fetches - * the array, closes the connection, frees memory used by the result, - * and then returns the array + * The auto function for retrieving an array based soley on a query + * string. This function makes the connection, does the exec, fetches + * the array, closes the connection, frees memory used by the result, + * and then returns the array * - * {@source } - * @param $qs SQL query string - * @param $i row number - * @param $type PGSQL_ASSOC or PGSQL_BOTH or PSQL_NUM - * @returns array - Returns an associative array of key-value pairs - * @access public + * {@source } + * @param $qs SQL query string + * @param $i row number + * @param $type PGSQL_ASSOC or PGSQL_BOTH or PSQL_NUM + * @returns array - Returns an associative array of key-value pairs + * @access public */ function db_auto_array( $qs, $i, $type ) @@ -337,15 +329,15 @@ class GLM_DB /** db_auto_exec * - * The auto function for executing a query. - * This function makes the connection, does the exec, fetches - * the array, closes the connection, frees memory used by the result, - * and then returns success (not a valid result index) + * The auto function for executing a query. + * This function makes the connection, does the exec, fetches + * the array, closes the connection, frees memory used by the result, + * and then returns success (not a valid result index) * - * {@source } - * @param $qs SQL query string - * @returns int - Returns 1 for success 0 for failure - * @access public + * {@source } + * @param $qs SQL query string + * @returns int - Returns 1 for success 0 for failure + * @access public */ function db_auto_exec( $qs ) @@ -359,25 +351,25 @@ class GLM_DB { return( 0 ); } - else + else { return( 1 ); } } /** db_auto_get_data * - *

The auto function for retrieving an array based soley on a query - * string. This function makes the connection, does the exec, fetches - * the array, closes the connection, frees memory used by the result, + *

The auto function for retrieving an array based soley on a query + * string. This function makes the connection, does the exec, fetches + * the array, closes the connection, frees memory used by the result, * and then returns the array.

* - * {@source } - * @param string $qs SQL query string + * {@source } + * @param string $qs SQL query string * @returns mixed - * @access public + * @access public */ - function db_auto_get_data( $qs ) + function db_auto_get_data( $qs ) { if( !$this->dbd ) { @@ -392,7 +384,7 @@ class GLM_DB { $data[$i] = $this->db_fetch_array ($res, $i, PGSQL_ASSOC ); } - if( isset( $data ) && $data != "" ) + if( isset( $data ) && $data != "" ) { return( $data ); } @@ -404,11 +396,11 @@ class GLM_DB /** trans_start * - * Start a postgres transaction + * Start a postgres transaction * - * {@source } + * {@source } * @returns bool true if sucessful - * @access public + * @access public */ function trans_start() { @@ -434,11 +426,11 @@ class GLM_DB /** trans_end * - * Commit the postgres transaction + * Commit the postgres transaction * - * {@source } + * {@source } * @returns bool true if successful - * @access public + * @access public */ function trans_end() { @@ -456,12 +448,12 @@ class GLM_DB } /** trans_exec * - * exec a postgres query in a + * exec a postgres query in a * postgres transaction * - * {@source } - * @param string query - * @access public + * {@source } + * @param string query + * @access public */ function trans_exec( $query ) { diff --git a/setup.phtml b/setup.phtml index eb571e0..2878bd5 100755 --- a/setup.phtml +++ b/setup.phtml @@ -12,7 +12,7 @@ ini_set('include_path', '/usr/share/pear' . ':' .ini_get('include_path')); if( !isset($SITEINFO) ) { - if(!isset($DEBUG)) + if(!isset($DEBUG)) { $DEBUG = (isset($mysecretcode) && $mysecretcode == 1234); } @@ -24,19 +24,19 @@ if( !isset($SITEINFO) ) //$DEBUG = TRUE; /* - * Customer Setup + * Customer Setup */ define("SITENAME","Mackinac Bridge Authority"); // used for outputing name of site in admin area define("SITE_NAME",SITENAME); // same as SITENAME define("DB_TYPE", "postgres"); // DB library only knows postgres (FUTURE EXPANSION) define("DB_ERROR_MSG", "an error has occured with the database!"); // default error message define("MULTIPLE_CAT",0); // weather or not to use many to many relations - define("CAT_LOCK",0); // If set to 1 or true will lock the categories + define("CAT_LOCK",0); // If set to 1 or true will lock the categories define("ENTRIES_PER_PAGE",10); // default per page number define("HTML_HELP_CODE",1); // this is being depreciated for general help guides define("PRODUCTION_MODE","ON"); // used in the email out for contact DB define("HTML_EMAIL","ON"); // turn ON for html emails - define("ACTIVE_FLAG",1); // turn on if bus_category table has active bool field + define("ACTIVE_FLAG",1); // turn on if bus_category table has active bool field define("DELUXE_TOOLBOX",1); // used for the toolbox deluxe vrs. define("SEO_URL",1); // weather to use Search Engine Optimisezd url's requires .htaccess enabled /* integration of different apps */ @@ -58,20 +58,31 @@ if( !isset($SITEINFO) ) // Find where this file is located - $BASE_PATH = dirname( __FILE__ ); - - $CALLED_FROM_DIR = substr( dirname($HTTP_SERVER_VARS["PATH_TRANSLATED"]), strlen($BASE_PATH) ); +$BASE_PATH = dirname(__FILE__); +$php_version = phpversion(); +// If php5 or above +if (version_compare($php_version, '5.0.0', '>')) { + $CALLED_FROM_DIR = substr(dirname($_SERVER['SCRIPT_FILENAME']), strlen($BASE_PATH)); + define('GLM_HOST_ID', $_ENV['GLM_HOST_ID']); + define('PHP5', true); +} else { + $CALLED_FROM_DIR = substr(dirname($HTTP_SERVER_VARS['PATH_TRANSLATED']), strlen($BASE_PATH)); + define('GLM_HOST_ID', $_SERVER['GLM_HOST_ID']); + define('PHP5', false); +} - if( ($x = strlen($CALLED_FROM_DIR)) > 0 ) - $base_url = $HTTP_HOST.substr( dirname($SCRIPT_NAME), 0, -strlen($CALLED_FROM_DIR) ); - else - { - $script_name_dir = dirname($SCRIPT_NAME); - if( $script_name_dir == "/" ) - $script_name_dir = ""; - $base_url = $HTTP_HOST.$script_name_dir; - } - $BASE_URL = "http://".$base_url; +if (($x = strlen($CALLED_FROM_DIR)) > 0) { + $base_url = $_SERVER['HTTP_HOST'] . substr(dirname($_SERVER['SCRIPT_NAME']), 0, -strlen($CALLED_FROM_DIR)); +} else { + $script_name_dir = dirname($_SERVER['SCRIPT_NAME']); + if ($script_name_dir == '/') { + $script_name_dir = ''; + } + $base_url = $_SERVER['HTTP_HOST'] . $script_name_dir; +} +// Added to strip any trailing /'s to make sure we don't end up with many +$base_url = preg_replace('|/*$|', '', $base_url); +$BASE_URL = "http://$base_url"; // Indicate that this file has been referenced $SITEINFO = TRUE; /* @@ -82,10 +93,10 @@ if( !isset($SITEINFO) ) switch( $GLM_SERVER_ID ) { - case "devsys.gaslightmedia.com": + case "devsys.gaslightmedia.com": ini_set("display_errors","1"); // Use the $BASE_URL for secure URL on Devsys - $BASE_SECURE_URL = $BASE_URL; + $BASE_SECURE_URL = $BASE_URL; define("CONN_STR","host=devsys dbname=mackinacbridge"); define("OWNER_EMAIL", "steve@gaslightmedia.com"); // site owner's email address define("FROM_NEWS_EMAIL", "info@gaslightmedia.com"); // site owner's email address @@ -111,6 +122,15 @@ if( !isset($SITEINFO) ) break; default: // There should be no need for any settings here + ini_set("display_errors","0"); + // Use the $BASE_URL for secure URL on Devsys + $BASE_SECURE_URL = $BASE_URL; + //define("CONN_STR","host=devsys dbname=mackinacbridge"); + define("CONN_STR","host=ds4 user=nobody dbname=mackinacbridge2"); + define("OWNER_EMAIL", "steve@gaslightmedia.com"); // site owner's email address + define("FROM_NEWS_EMAIL", "info@gaslightmedia.com"); // site owner's email address + define("REPLY_TO", "info@gaslightmedia.com"); // the reply-to field for email's + define('DEVELOPMENT', true); break; } @@ -126,28 +146,28 @@ if( !isset($SITEINFO) ) define("HELP_IMG",URL_BASE."images/help.gif"); // help image url (depriated) define("ORIGINAL_PATH", BASE."images/original/"); // path of original images define("RESIZED_PATH", BASE."images/resized/"); // path of first resized image - define("MIDSIZED_PATH", BASE."images/midsized/"); // path of half sized of resized + define("MIDSIZED_PATH", BASE."images/midsized/"); // path of half sized of resized define("THUMB_PATH", BASE."images/thumb/"); // path of thumbnail directory if( $_SERVER['HTTPS'] == "on" ) { define("ORIGINAL", $BASE_SECURE_URL."/images/original/"); // url of original images - define("RESIZED", $BASE_SECURE_URL."/images/resized/"); // url of resized + define("RESIZED", $BASE_SECURE_URL."/images/resized/"); // url of resized define("MIDSIZED", $BASE_SECURE_URL."/images/midsized/"); // url of midsized define("THUMB", $BASE_SECURE_URL."/images/thumb/"); // url of thumbnail } else { define("ORIGINAL", URL_BASE."images/original/"); // url of original images - define("RESIZED", URL_BASE."images/resized/"); // url of resized + define("RESIZED", URL_BASE."images/resized/"); // url of resized define("MIDSIZED", URL_BASE."images/midsized/"); // url of midsized define("THUMB", URL_BASE."images/thumb/"); // url of thumbnail } - /** these are the image sizing defines USE THESE ONLY + /** these are the image sizing defines USE THESE ONLY only allowed string of 'WxH[<>]' [-quality Percentage] */ define("ITEM_RESIZED", "'261>'"); // used in convert call to resize images - define("ITEM_MIDSIZED", "'180>'"); + define("ITEM_MIDSIZED", "'180>'"); define("ITEM_THUMB","'120>'"); define("FOOTER_IMG", URL_BASE."images/logosmall.gif"); @@ -292,7 +312,7 @@ if( !isset($SITEINFO) ) $states["YT"] = "Yukon"; $states["Asia"] = "Asia"; $states["Australia"] = "Australia"; - $states["Bahamas"] = "Bahamas"; + $states["Bahamas"] = "Bahamas"; $states["Caribbean"] = "Caribbean"; $states["Costa Rica"] = "Costa Rica"; $states["South America"] = "South America"; @@ -333,9 +353,9 @@ if( !isset($SITEINFO) ) "\xc2\x9f" => "\xc5\xb8" /* LATIN CAPITAL LETTER Y WITH DIAERESIS*/ ); /** - * is_utf8 - * - * @param mixed $string + * is_utf8 + * + * @param mixed $string * @access public * @return void */ @@ -343,9 +363,9 @@ if( !isset($SITEINFO) ) return (preg_match('/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xec][\x80-\xbf]{2}|\xed[\x80-\x9f][\x80-\xbf]|[\xee-\xef][\x80-\xbf]{2}|f0[\x90-\xbf][\x80-\xbf]{2}|[\xf1-\xf3][\x80-\xbf]{3}|\xf4[\x80-\x8f][\x80-\xbf]{2})*$/', $string) === 1); } /** - * cp1252_to_utf8 - * - * @param mixed $str + * cp1252_to_utf8 + * + * @param mixed $str * @access public * @return void */ @@ -354,9 +374,9 @@ if( !isset($SITEINFO) ) return strtr(utf8_encode($str), $cp1252_map); } /** - * myEncode - * - * @param mixed $string + * myEncode + * + * @param mixed $string * @access public * @return void */ @@ -370,7 +390,7 @@ if( !isset($SITEINFO) ) { return( cp1252_to_utf8( $string ) ); } - } + } /** * CreditVal : CreditVal Checks for a valid credit card number doing Luhn check, if no @@ -380,37 +400,37 @@ if( !isset($SITEINFO) ) * @param $Num: Credit Card Number * @param $Name = '': Type of Card * @param $Accepted='' : Accepted array - * - * @return bool - * @access + * + * @return bool + * @access **/ - function CreditVal($Num, $Name = '', $Accepted='') - { + function CreditVal($Num, $Name = '', $Accepted='') + { $Name = strtolower( $Name ); $Accepted = strtolower( $Accepted ); $GoodCard = 1; - $Num = ereg_replace("[^[:digit:]]", "", $Num); - switch ($Name) - { + $Num = ereg_replace("[^[:digit:]]", "", $Num); + switch ($Name) + { - case "mastercard" : - $GoodCard = ereg("^5[1-5].{14}$", $Num); - break; + case "mastercard" : + $GoodCard = ereg("^5[1-5].{14}$", $Num); + break; - case "visa" : - $GoodCard = ereg("^4.{15}$|^4.{12}$", $Num); - break; + case "visa" : + $GoodCard = ereg("^4.{15}$|^4.{12}$", $Num); + break; - case "americanexpress" : - $GoodCard = ereg("^3[47].{13}$", $Num); - break; + case "americanexpress" : + $GoodCard = ereg("^3[47].{13}$", $Num); + break; - case "discover" : - $GoodCard = ereg("^6011.{12}$", $Num); - break; + case "discover" : + $GoodCard = ereg("^6011.{12}$", $Num); + break; - case "dinerscard" : - $GoodCard = ereg("^30[0-5].{11}$|^3[68].{12}$", $Num); + case "dinerscard" : + $GoodCard = ereg("^30[0-5].{11}$|^3[68].{12}$", $Num); break; default: @@ -420,7 +440,7 @@ if( !isset($SITEINFO) ) if( ereg("^6011.{12}$", $Num) ) $Name = "discover"; if( ereg("^30[0-5].{11}$|^3[68].{12}$", $Num) ) $Name="dinerscard"; break; - } + } // If there's a limit on card types we accept, check for it here. if( $Accepted ) @@ -434,28 +454,28 @@ if( !isset($SITEINFO) ) if( !$type_verified ) return(FALSE); } - $Num = strrev($Num); + $Num = strrev($Num); - $Total = 0; + $Total = 0; - for ($x=0; $x @@ -809,11 +829,11 @@ if( !isset($SITEINFO) ) * html_nav_table :Generates a navigation table on the page it's called on. * @param $nav: associative array with entries like:$nav[text][url] * @param $$w : max width of table - * - * @return void - * @access + * + * @return void + * @access **/ - function html_nav_table($nav, $w) + function html_nav_table($nav, $w) { if( is_array( $nav ) ) { @@ -828,16 +848,16 @@ if( !isset($SITEINFO) ) } /** - * html_header :Opens up the html tags, and includes the style sheet link + * html_header :Opens up the html tags, and includes the style sheet link generates a header table on the top of the page it's called on. - * @param $title: Page Title - * @param $msg: message to display + * @param $title: Page Title + * @param $msg: message to display * @param $$img : image to display - * - * @return void - * @access + * + * @return void + * @access **/ - function html_header($title, $msg, $img) + function html_header($title, $msg, $img) { $header_table_width = "400"; $header_table_align = "center"; @@ -855,7 +875,7 @@ if( !isset($SITEINFO) ) "; } @@ -918,13 +938,13 @@ if( !isset($SITEINFO) ) * @param $name: string name of text box * @param $value: string value of text box * @param $$size = 35 : string size of text box - * - * @return void - * @access + * + * @return void + * @access **/ - function text_box($name, $value, $size = 35) + function text_box($name, $value, $size = 35) { - echo ""; } @@ -932,16 +952,16 @@ if( !isset($SITEINFO) ) * form_footer :Closes up the form tag, and includes the submit button * @param $name: string form action string * @param $$suppress = 0: string Method of form - * @param $$cs : int colspan for td - * - * @return void - * @access + * @param $$cs : int colspan for td + * + * @return void + * @access **/ - function form_footer($name, $suppress = 0, $cs) + function form_footer($name, $suppress = 0, $cs) { echo "
<?echo HEAD?> @@ -874,22 +894,22 @@ if( !isset($SITEINFO) ) } /** - * form_header :Opens up the form tag, and includes the hidden assoc array as hidden + * form_header :Opens up the form tag, and includes the hidden assoc array as hidden fields. * @param $action: string form action string * @param $method: string Method of form * @param $$hidden = "" : assoc array with $hidden($name => $value) - * - * @return void - * @access + * + * @return void + * @access **/ - function form_header($action, $method, $hidden = "") + function form_header($action, $method, $hidden = "") { - echo "
"; - if($hidden != "" && is_array($hidden)) - { - foreach($hidden as $key=>$value) + if($hidden != "" && is_array($hidden)) + { + foreach($hidden as $key=>$value) { echo ""; } @@ -903,13 +923,13 @@ if( !isset($SITEINFO) ) * @param $$rows = 15: int4 number of rows in textarea box * @param $$cols = 50: int4 number of cols in textarea box * @param $$wrap = "virtual" : string the wrap value for the textarea box - * - * @return void - * @access + * + * @return void + * @access **/ - function text_area($name, $value, $rows = 15, $cols = 50, $wrap = "virtual" ) + function text_area($name, $value, $rows = 15, $cols = 50, $wrap = "virtual" ) { - echo "
"; - if($suppress == 1) + if($suppress == 1) { echo ""; } @@ -952,35 +972,35 @@ if( !isset($SITEINFO) ) /* Graphics Libraries */ /** - * process_image :Main function for image processing - * NOTES: - * This function does the following: + * process_image :Main function for image processing + * NOTES: + * This function does the following: * - * 1) places image into original folder + * 1) places image into original folder * * 2) makes three images from original size and places them * into the RESIZED, MIDSIZED, and THUMB folders * @param $image: The variable of the image being post from the form * @param $$image_name : The variable_name of the image being post - * + * * @return string - Returns $image_name - * @access + * @access **/ - function process_image ($image,$image_name) + function process_image ($image,$image_name) { - if(!defined("ORIGINAL_PATH")) + if(!defined("ORIGINAL_PATH")) { html_error("this not defined original_path",1); } - if(!defined("RESIZED_PATH")) + if(!defined("RESIZED_PATH")) { html_error("this not defined resized_path",1); } - if(!defined("MIDSIZED_PATH")) + if(!defined("MIDSIZED_PATH")) { html_error("this not defined midsized_path",1); } - if(!defined("THUMB_PATH")) + if(!defined("THUMB_PATH")) { html_error("this not defined thumb_path",1); } @@ -998,11 +1018,11 @@ if( !isset($SITEINFO) ) * @param $image: path to image which needs to be resized * @param $thumb: path where resized image will live * @param $$size : using axis size of new image - * - * @return array $img_resize_array - * @access + * + * @return array $img_resize_array + * @access **/ - function img_resize($path2image,$path2thumb,$size) + function img_resize($path2image,$path2thumb,$size) { exec( "which convert", $output, $return ); if( $return == 0 ) @@ -1025,38 +1045,38 @@ if( !isset($SITEINFO) ) } /** - * img_upload :Function moves the image to the destination directory - Checking to make sure that it does not have same named file in dicectory. + * img_upload :Function moves the image to the destination directory + Checking to make sure that it does not have same named file in dicectory. Image must be either jpg ,png or gif format file to be uploaded. * @param $form_field: $form_field of image * @param $img_name: $form_field of image with _name * @param $$destination_path : path to store uploaded image - * + * * @return array $img_upload_array - * @access + * @access **/ - function img_upload($form_field,$img_name,$destination_path) + function img_upload($form_field,$img_name,$destination_path) { - if (ereg("[!@#$%^&()+={};:\'\"\/ ]",$img_name)) + if (ereg("[!@#$%^&()+={};:\'\"\/ ]",$img_name)) { $img_name = ereg_replace("[!@#$%^&()+={};:\'\"\/ ]","-",$img_name); } $size = getImageSize($form_field); - if( $size[2] == 1 || $size[2] == 2 || $size[2] == 3 ) + if( $size[2] == 1 || $size[2] == 2 || $size[2] == 3 ) { $img_name_in_use = "FALSE"; if( file_exists(RESIZED_PATH.$img_name) ) { $img_name_in_use = "TRUE"; } - if ($img_name_in_use == "TRUE") + if ($img_name_in_use == "TRUE") { $new_img_name = mktime().$img_name; $new_img_location = $destination_path.'/'.$new_img_name; copy($form_field,$new_img_location); $img_upload_array = array("$new_img_name","$new_img_location"); } - else + else { $new_img_name = $img_name; $new_img_location = $destination_path.'/'.$new_img_name; @@ -1068,7 +1088,7 @@ if( !isset($SITEINFO) ) chmod($new_img_location, 0666); } } - else + else { echo '

' .'The file you uploaded was of an incorect type, please only upload .gif,.png or .jpg files' @@ -1088,14 +1108,14 @@ if( !isset($SITEINFO) ) * @param $form_field: $form_field of image * @param $file_name: $form_field of image with _name * @param $$destination_path : path to store uploaded image - * + * * @return string $file_upload - * @access + * @access **/ - function file_upload($form_field,$file_name,$destination_path) + function file_upload($form_field,$file_name,$destination_path) { $file_name_in_use = false; - if (ereg("[!@#$%^&()+={};:\'\"\/ ]",$file_name)) + if (ereg("[!@#$%^&()+={};:\'\"\/ ]",$file_name)) { $file_name = ereg_replace("[!@#$%^&()+={};:\'\"\/ ]","_",$file_name); } @@ -1103,14 +1123,14 @@ if( !isset($SITEINFO) ) { $file_name_in_use = true; } - if ($file_name_in_use == true) + if ($file_name_in_use == true) { $new_file_name = mktime().$file_name; $new_file_location = $destination_path.'/'.$new_file_name; copy($form_field,$new_file_location); $file_upload = $new_file_name; } - else + else { $new_file_name = $file_name; $new_file_location = $destination_path.'/'.$new_file_name; @@ -1129,31 +1149,31 @@ if( !isset($SITEINFO) ) /** * http_strip :Strips the http:// part from start of string * @param $&$string : $string - * + * * @return string $stirng minus http:// in front - * @access + * @access **/ - function http_strip(&$string) + function http_strip(&$string) { $test_string = strtolower($string); - if(substr($test_string,0,7) == "http://") + if(substr($test_string,0,7) == "http://") { $string = substr($string,7); } } /** - * footer : used for admin page footer to close out the top function - * - * @return void - * @access + * footer : used for admin page footer to close out the top function + * + * @return void + * @access **/ - function footer() + function footer() { $out = ' - '; + '; echo $out; } @@ -1162,22 +1182,22 @@ if( !isset($SITEINFO) ) * @param $message: The title * @param $hp: The help file to use * @param $$hp2 = NULL : The help file to use (links to gaslightmedia.com) - * - * @return void - * @access + * + * @return void + * @access **/ - function top($message, $hp,$hp2 = NULL) + function top($message, $hp,$hp2 = NULL) { if($hp2 != "") { $help_guide = '

'; /* $help_guide = ''; } $out = ' @@ -1190,7 +1210,7 @@ if( !isset($SITEINFO) ) -

'.$message.'

+

'.$message.'

'.$help_guide.' '; echo $out; @@ -1198,14 +1218,14 @@ if( !isset($SITEINFO) ) /** * top2 : alias to top() - * @param $message: message title - * @param $hp: help file + * @param $message: message title + * @param $hp: help file * @param $$hp2 = NULL : gaslight help file - * - * @return - * @access + * + * @return + * @access **/ - function top2($message, $hp,$hp2 = NULL) + function top2($message, $hp,$hp2 = NULL) { // make this an alias to top() // by calling top instead of adding extra code @@ -1324,9 +1344,9 @@ if( !isset($SITEINFO) ) * MUST BE CALLED AFTER TEXTAREAS ON PAGE * @param $$w = 570: width of htmlarea in px * @param $$h = 400: height of htmlarea in px - * + * * @return void - * @access + * @access **/ function htmlcode( $w = 570, $h = 400, $textarea = array('description') ) { @@ -1334,7 +1354,7 @@ if( !isset($SITEINFO) ) @@ -1418,7 +1438,7 @@ if( !isset($SITEINFO) ) } echo ', "htmlmode", "separator", "copy", "cut", "paste", "space", "undo", "redo" ] - ]; + ]; '; if( HTMLAREA_CONTEXT_MENU == true ) { @@ -1432,7 +1452,7 @@ if( !isset($SITEINFO) ) echo ' // register the TableOperations plugin - editor_'.$htmlarea.'.registerPlugin(TableOperations); + editor_'.$htmlarea.'.registerPlugin(TableOperations); '; } if( HTMLAREA_CHARACTER_MAP == true ) @@ -1440,7 +1460,7 @@ if( !isset($SITEINFO) ) echo ' // register the CharacterMap plugin - editor_'.$htmlarea.'.registerPlugin(CharacterMap); + editor_'.$htmlarea.'.registerPlugin(CharacterMap); '; } echo ' @@ -1449,50 +1469,50 @@ if( !isset($SITEINFO) ) } echo ' - } + } function addEvent(obj, evType, fn) - { - if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } - else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } - else { return false; } - } + { + if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } + else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } + else { return false; } + } addEvent(window, \'load\', initdocument); //]]> - + '; } /** * date_entry : Generate the select boxes for date entry * month-day-year as drop down select - * @param $month: - * @param $day: - * @param $year: - * @param $month_name: name of select month - * @param $day_name: name of select day + * @param $month: + * @param $day: + * @param $year: + * @param $month_name: name of select month + * @param $day_name: name of select day * @param $$year_name : name of select year - * - * @return - * @access + * + * @return + * @access **/ - function date_entry($month,$day,$year,$month_name,$day_name,$year_name,$onChange = NULL) + function date_entry($month,$day,$year,$month_name,$day_name,$year_name,$onChange = NULL) { $cur_date = getdate(); - if($month == "") + if($month == "") { $month = $cur_date['mon']; } - if($day == "") + if($day == "") { $day = $cur_date['mday']; - } - if($year == "") + } + if($year == "") { $year = $cur_date['year']; } $date = '"; - for($i=1;$i<=12;$i++) + for($i=1;$i<=12;$i++) { $time .= "