Thank you so much for your reply... here is the includes.inc.php file.... I am really clueless about this error.... thanks again
Code: Select all
<?php
// Functions include file
// Set variable so PHPBB functions work
define('IN_PHPBB', true);
// Includes
$phpbb_root_path = '/var/www/html/';
include_once('/var/www/html/extension.inc');
include_once('/var/www/html/common.php');
require_once('/var/www/html/includes/classes.inc.php');
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1',
trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx :
'profile.'.$phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' :
'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' .
trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;
//
// End session management
//
// Set $User variable with the User object for the logged in user.
$User = new User($userdata['user_id']);
// Generate location drop down used on several pages
$output_array['location_dropdown'] = '<SELECT NAME="user_location">';
$query = $db->sql_query("SELECT * FROM locations WHERE location_active =
1");
while ($result = $db->sql_fetchrow($query))
{
$output_array['location_dropdown'] .= '<OPTION
VALUE="'.$result['location_id'].'">'.$result['location_name'].'</OPTION>';
}
$output_array['location_dropdown'] .= "</SELECT>";
// Do member box login routine used on all pages
if ($User->logged_in())
{
$output_array['login'] = make_output("login_in", get_object_vars($User));
} else {
$output_array['login'] = make_output("login_out");
}
/*=================================
|| Function Name: display_output
|| Description: Runs through the given template and builds HTML output
using the sent replacements
|| Parameters: 1) Filename of the template to use
|| 2) Associative array with replacement keys and values
|| Returns: Returns the processed HTML in String format
=================================*/
function make_output ($template, $replacements = Array())
{
global $db, $User, $phpbb_root_path;
// Set to "on" to see template names in HTML source
$debug = "off";
$buffer = file($phpbb_root_path . "templates/".$template.".html");
$i = 0;
$j = 0;
$staff_line = 0;
while($i < count($buffer))
{
if(!ereg("^#(.)*$",$buffer[$i]))
{
$current_line = trim($buffer[$i]);
// Set if current line is only for staff members
if ($current_line == "<!--BEGIN STAFF-->")
{
$staff_line = 1;
$i++;
continue;
}
if ($current_line == "<!--END STAFF-->")
{
$staff_line = 0;
$i++;
continue;
}
// Set if current line is for Admins
if ($current_line == "<!--BEGIN ADMIN-->")
{
$admin_line = 1;
$i++;
continue;
}
if ($current_line == "<!--END ADMIN-->")
{
$admin_line = 0;
$i++;
continue;
}
// Check if user is staff or admin and display line if true
if ($staff_line == 1 || $admin_line == 1)
{
if ($User)
{
if ($User->is_staff())
{
if ($admin_line == 1)
{
if ($User->is_admin())
{
$skipped_buffer[$j] = $buffer[$i];
$j++;
} else {
$i++;
continue;
}
} else {
$skipped_buffer[$j] = $buffer[$i];
$j++;
}
} else {
$i++;
continue;
}
}
} else {
$skipped_buffer[$j] = $buffer[$i];
$j++;
}
}
$i++;
}
//--Retrieve message
$output = implode("", $skipped_buffer);
//--Change TAGS with variables content
if (is_array($replacements))
{
foreach ($replacements as $replaced => $replacer)
{
$output = ereg_replace("<!--".$replaced."-->", $replacer,
$output);
}
}
// Display debug info if set on
if ($debug == "on")
{
$output = "<!--".$template."
START-->\n\n".$output."\n\n<!--".$template." END-->\n\n";
}
return $output;
}
/*=================================
|| Function Name: arrayKeyExists
|| Description: Older version PHP replacement function. Looks in the sent
array for the sent key.
|| Parameters: 1) Key searching for
|| 2) Array searching in
|| Returns: True if the key exists in the array, false if not
=================================*/
function arrayKeyExists($key, $search) {
if (in_array($key, array_keys($search))) {
return true;
} else {
return false;
}
}
/*=================================
|| Function Name: email_user
|| Description: Emails a Quoticom user building the email from the given
template and replacement variables.
|| Parameters: 1) User ID of User that email is being sent to
|| 2) Template to use when building the email
|| 3) Send to temporary email? (1=yes, 2-no) Used for changing
email
|| 4) Array of replacement variables to used when building the
email
|| Returns: 1 after email is sent
=================================*/
function email_user($user_id, $template, $temp=0, $content=Array())
{
// Gather user details
$user = new User($user_id);
// Figure out which address to use
if ($temp != 0)
{
$email = $user->user_tempemail;
} else {
$email = $user->user_email;
}
// As per doteasy, if sending to a quoticom email address, need to change
the TO address
if (substr($email, -12) == "quoticom.com")
{
$pieces = explode('@', $email);
$email = $pieces[0]."%".$pieces[1]."@dpmail17.doteasy.com";
}
// Set replacement values
$user_values = get_object_vars($user);
$values = $content;
$values["site_url"] = 'http://www.quoticom.com';
// Determine subject from template
$message = make_output($template, $user_values+$values);
$message_array = explode("|||", $message);
if (count($message_array) > 1)
{
// template has a subject
$subject = trim(str_replace("Subject=", "", $message_array[0]));
$message_text = $message_array[1];
} else {
$subject = "Important Quoticom Information";
$message_text = $message_array[0];
}
// MIME HTML EMAIL
require_once('/var/www/html/includes/mail/htmlMimeMail.php');
$mail = new htmlMimeMail();
$text = strip_tags($message_text);
$html = make_output("emails/email_html_shell", Array("message" =>
nl2br($message_text)));
$mail->setHtml($html, $text);
$mail->setFrom('Quoticom <info@quoticom.com>');
$mail->setSubject($subject);
// Send the email
$result = $mail->send(array($email));
return 1;
}
/*=================================
|| Function Name: email_admins
|| Description: Wraps the email_user function to send email to all admins
(usergroup 2)
|| Parameters: 1) Filename of the template to use
|| 2) Associative array with replacement keys and values
|| Returns: True when email is sent
=================================*/
function email_admins($template, $content)
{
global $db;
// gather admin accounts from db
$sql = "SELECT user_id FROM user_group WHERE group_id = '2'";
$query = $db->sql_query($sql);
while ($result = $db->sql_fetchrow($query))
{
// email admins using email function
email_user($result['user_id'], $template, 0, $content);
}
return;
}
/*=================================
|| Function Name: EmailCheck
|| Description: Verifies that the sent email is in the valid format for an
email address
|| Parameters: 1) Email address to check
|| Returns: True if the email passes, false if not
=================================*/
function EmailCheck($Email)
{
$Result = ereg ("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $Email );
if ($Result)
{
return TRUE;
} else {
return FALSE;
}
}
/*=================================
|| Function Name: gen_actkey
|| Description: Generates a random 8 character actkey that is used for
verifying emails
|| Parameters: 1) Set to 1 if you want an md5 hash of the key returned, 0
if just the key
|| Returns: Returns the hashed key, or just the key
=================================*/
function gen_actkey($hash)
{
$chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f',
'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M',
'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u',
'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '0');
$max_chars = count($chars) - 1;
srand( (double) microtime()*1000000);
$rand_str = '';
for($i = 0; $i < 8; $i++)
{
$rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str .
$chars[rand(0, $max_chars)];
}
return ( $hash ) ? md5($rand_str) : $rand_str;
}
/*=================================
|| Function Name: build_member_list
|| Description: Takes an array of members and builds the HTML memberlist
|| Parameters: 1) An array of member User IDs
|| Returns: Returns the member list HTML ready for output
=================================*/
function build_member_list ($array)
{
// use array to return a formatted list of members
if (!is_array($array))
{
$array = Array($array);
}
$i = 0;
// Loop through each member ID and build table
foreach ($array AS $user_id)
{
$Member = new User($user_id);
$row_array = get_object_vars($Member);
if ($i%2 == 0)
{
$row_array['bgcolor'] = "#FFFFFF";
} else {
$row_array['bgcolor'] = "#DDDDDD";
}
if (in_array("3", $Member->type))
{
$row_array['buyer'] = "<B>.</B>";
} else {
$row_array['buyer'] = " ";
}
if (in_array("4", $Member->type))
{
$row_array['seller'] = "<B>.</B>";
} else {
$row_array['seller'] = " ";
}
if (in_array("5", $Member->type))
{
$row_array['profitshare'] = "<B>.</B>";
} else {
$row_array['profitshare'] = " ";
}
$content_array['rows'] .= make_output("manage/members_table_row",
$row_array);
$i++;
}
// build HTML from template
$html = make_output("manage/members_table", $content_array);
return $html;
}
/*=================================
|| Function Name: get_start_end_dates
|| Description: For the leads and quotes management tables. Takes a year
month and date,
|| and determines the starting and ending dates for the SQL
query.
|| Parameters: 1) Year being displayed
|| 2) Month being displayed
|| 3) Day being displayed
|| Returns: Array with start date at position 0 and end date at position 1
=================================*/
function get_start_end_dates($year, $month, $day)
{
// If year isn't set, set to current year
if (!$year)
{
$year = date("Y");
}
// Length, in seconds, for sent/current year
$length = date("z", mktime(23, 59, 59, 12, 31, $year)) * 86400;
if ($month)
{
// Length, in seconds, for sent/current month
$length = date("t", mktime(0, 0, 0, $month, 1, $year)) * 86400;
} else {
$month = "1";
}
if ($day)
{
$length = "86400";
if (!$month)
{
$month = date("m");
}
} else {
$day = "01";
}
// Figure starting and ending timestamps to use in SQL query
$date_start = mktime(0, 0, 0, $month, $day, $year);
$date_end = $date_start + $length;
return Array($date_start, $date_end);
}
/*=================================
|| Function Name: create_list_querystring
|| Description: Replaces any old variables with the new variables, then
builds a querystring using all the variables.
|| Good to use when creating buttons used in displaying lists
of data. Will use old variables if there
|| aren't any matching new variables.
|| Parameters: 1) Array of new variables to replace with
|| 2) Array of old variables to be replaced
|| 3) Day being displayed
|| Returns: Query string sans the ?
=================================*/
function create_list_querystring ($new_variables, $old_variables)
{
// Take two arrays, an array built and sent, and old variables array and
from them generate a variable list for the query string of the new link
$variables = array_merge($old_variables, $new_variables);
$return_string = "";
foreach($variables AS $query_item => $query_value)
{
$return_string .= $query_item."=".$query_value;
$return_string .= "&";
}
// strip last ampersand
$return_string = substr($return_string, 0, strlen($return_string)-1);
return $return_string;
}
/*=================================
|| Function Name: make_year_dropdown
|| Description: Builds an HTML select dropdown of years starting at
$start_year and continuing through to current year.
|| Marks the selected year with SELECTED if sent
|| Parameters: 1) Year to be set as selected
|| 2) Year to start at
|| Returns: HTML select list
=================================*/
function make_year_dropdown($select_year="", $start_year)
{
$output = '<SELECT NAME="year">';
$current_year = date("Y");
for ($i_year = $start_year; $i_year <= $current_year; $i_year++)
{
$output .= '<OPTION VALUE="'.$i_year.'" ';
// Determine if matches selected year
if ($i_year == $select_year)
{
$output .= "SELECTED";
}
$output .= '>'.$i_year.'</OPTION>'."\n";
}
$output .= '</SELECT>';
return $output;
}
/*=================================
|| Function Name: make_month_dropdown
|| Description: Builds an HTML select dropdown for months. Marks the
selected month with SELECTED if matches.
|| Parameters: 1) Month to select, needs to be an integer, no leading zero
(1 - 12)
|| Returns: HTML select
=================================*/
function make_month_dropdown($select_month)
{
$output = '<SELECT NAME="month"><OPTION VALUE=""> </OPTION>';
for ($i_month = 1; $i_month <= 12; $i_month++)
{
$output .= '<OPTION VALUE="'.$i_month.'" ';
if ($i_month == $select_month)
{
$output .= "SELECTED";
}
$output .= '>'.date("F", mktime(0, 0, 0, $i_month, 1,
2000)).'</OPTION>'."\n";
}
$output .= '</SELECT>';
return $output;
}
/*=================================
|| Function Name: make_day_dropdown
|| Description: Builds an HTML select dropdown for days. Marks the selected
day with SELECTED if matches.
|| Parameters: 1) Day to select, needs to be an integer, no leading zero (1
- 31)
|| Returns: HTML select
=================================*/
function make_day_dropdown($select_day)
{
$output = '<SELECT NAME="day"><OPTION VALUE=""> </OPTION>';
for ($i_day = 1; $i_day <= 31; $i_day++)
{
$output .= '<OPTION VALUE="'.$i_day.'" ';
if ($i_day == $select_day)
{
$output .= 'SELECTED';
}
$output .= '>'.$i_day.'</OPTION>'."\n";
}
$output .= '</SELECT>';
return $output;
}
/*=================================
|| Function Name: get_userid_by_referrer
|| Description: Returns the user id for the user that has the sent Referral
ID
|| Parameters: 1) referrer id of the user you are looking for. Must be a
string.
|| Returns: The user id of the User if found, else returns null
=================================*/
function get_userid_by_referrer($referrer_id)
{
global $db;
//get userid by referrer
$sql = "SELECT user_id FROM users WHERE user_referral_id =
'".$referrer_id."'";
$query = $db->sql_query($sql);
$result = $db->sql_fetchrow($query);
return $result['user_id'];
}
?>