add Jquery in php file?

Links for php scripts

Moderators: macek, egami, gesf

Post Reply
crf121359
New php-forum User
New php-forum User
Posts: 17
Joined: Sun Jan 22, 2012 7:40 am

add Jquery in php file?

Post by crf121359 » Sun Nov 11, 2012 2:02 pm

Hello,

I have a php file and a fairly basic jquery popup. I need to add the JQUERY POPUP IN THE PHP FILE BUT EVERYTHING I DO THE POPUP DOESN'T WORK!!


Here is my php file:

Code: Select all

<?php
/**
* User homepage (information about user billing, profile, profile visits, user perfect matches, horoscope...)
*
* @package DatingPro
* @subpackage User Mode
**/
include "./include/index22.php";
include "./include/config.php";
include "./common.php";
include "./include/config_index.php";
include "./include/functions_index.php";
include "./include/functions_auth.php";
include "./include/functions_users.php";
include "./include/class.lang.php";
include "./include/class.news.php";
include_once "./include/class.percent.php";
include "./include/functions_poll.php";
if (file_exists("./poll/poll_cookie.php")) include "./poll/poll_cookie.php";
include "./include/functions_events.php";

CheckInstallFolder();

$smarty->assign("sub_menu_num", '2');

$user = auth_index_user();
RefreshAccount($user);
///// check ins messages if user not guest
if($user[3] != 1){
	GetAlertsMessage();
}

$profile_percent = new Percent($config, $dbconn, $user[0]);

$multi_lang = new MultiLang($config, $dbconn);
///// default multilanguage field for select
$field_name = $multi_lang->DefaultFieldName();

if(isset($_SERVER["PHP_SELF"]))
$file_name = AfterLastSlash($_SERVER["PHP_SELF"]);
else
$file_name = "homepage.php";

lastViewed();
unset($_SESSION['return_to_view']);

if($user[4]==1){
	HomePage();
}elseif($user[0] && $user[3]!=1){
	HomePage();
}else{
	echo "<script>location.href='".$config["site_root"]."/index.php'</script>";
}
function HomePage(){
	global $settings, $lang, $config, $config_index, $smarty, $dbconn, $user, $multi_lang, $field_name, $profile_percent, $file_name, $theme_ident;

	Banners(GetRightModulePath(__FILE__));
	LeftMenu();
	IndexHomePage();
	$smarty->assign("file_name",$file_name);

	cleanMailbox();

	////////// visited
	$settings = GetSiteSettings(array('icons_folder', 'zip_count', 'max_age_limit', 'min_age_limit', 'icon_male_default', 'icon_female_default',
	'icons_folder', 'site_unit_costunit', 'use_horoscope_feature', 'free_site', 'use_pilot_module_organizer','use_lift_up_in_search_service'));

	$default_photos['1'] = $settings['icon_male_default'];
	$default_photos['2'] = $settings['icon_female_default'];

	///// user info
	$smarty->assign("active_user_info", GetActiveUserInfo($user));

	///////////// icon
	$strSQL = "SELECT DISTINCT a.id, a.login, a.gender, a.date_birthday, a.big_icon_path, a.id_country, a.id_city, a.id_region,
								DATE_FORMAT(a.date_registration,'".$config["date_format"]."')  as date_registration,
								DATE_FORMAT(a.date_last_seen,'".$config["date_format"]."')  as date_last_login
				FROM ".USERS_TABLE." a  WHERE  a.id='".$user[0]."'";
	$rs = $dbconn->Execute($strSQL);
	$i = 0;
	$row = $rs->GetRowAssoc(false);

	$page["name"] = $row["login"];
	$page["age"] = AgeFromBDate($row["date_birthday"]);
	$page["date_registration"] = $row["date_registration"];
	$page["last_login"] = $row["date_last_login"];
	$page["complete"] = $profile_percent->GetAllPercent();

	$icon_path = $row["big_icon_path"];
	if($icon_path && file_exists($config["site_path"].$settings["icons_folder"]."/".$icon_path))
	$page["icon_path"] = $config["site_root"].$settings["icons_folder"]."/".$icon_path;
	$icon_image = $icon_path ? 1 : 0;

	$page["id_country"] = intval($row["id_country"]);
	$page["id_region"] = intval($row["id_region"]);
	$page["id_city"] = intval($row["id_city"]);

	$strSQL = "SELECT COUNT(*) FROM ".USER_UPLOAD_TABLE."  WHERE  id_user='".$row["id"]."' AND upload_type='f' AND status='1' AND allow in ('1', '2')";
	$rs_sub = $dbconn->Execute($strSQL);
	$page["photo_count"] = intval($rs_sub->fields[0])+$icon_image;

	$_LANG_NEED_ID["country"][] = intval($row["id_country"]);
	$_LANG_NEED_ID["region"][] = intval($row["id_region"]);
	$_LANG_NEED_ID["city"][] = intval($row["id_city"]);
	///////////// icon

	//// matches
	if ($config["social"] == 1){
		$strSQL = "	SELECT a.id, a.login, a.gender, a.date_birthday, a.icon_path, a.id_country, a.id_city, a.id_region
					FROM ".USERS_TABLE." a, ".USER_TOPTEN_TABLE." b
					WHERE a.id=b.id_user AND a.status='1' ORDER BY RAND() LIMIT 1";
		$rs = $dbconn->Execute($strSQL);
		$row = $rs->GetRowAssoc(false);
		$top_users["name"] = $row["login"];
		$top_users["age"] = AgeFromBDate($row["date_birthday"]);
		$top_users["link"] = "./viewprofile.php?id=".$row["id"]."&sel=5";
		$icon_path = $row["icon_path"]?"big_".$row["icon_path"]:$default_photos[$row["gender"]];
		$icon_image= (strlen($row["icon_path"]))?1:0;
		if($icon_path && file_exists($config["site_path"].$settings["icons_folder"]."/".$icon_path))
		$top_users["icon_path"] = $config["site_root"].$settings["icons_folder"]."/".$icon_path;
		$top_users["country"] = $dbconn->GetOne("SELECT name FROM ".COUNTRY_SPR_TABLE." WHERE id='".intval($row["id_country"])."'");
		$top_users["region"] = $dbconn->GetOne("SELECT name FROM ".REGION_SPR_TABLE." WHERE id='".intval($row["id_region"])."'");
		$top_users["city"] = $dbconn->GetOne("SELECT name FROM ".CITY_SPR_TABLE." WHERE id='".intval($row["id_city"])."'");

		$_LANG_NEED_ID["country"][] = intval($row["id_country"]);
		$_LANG_NEED_ID["region"][] = intval($row["id_region"]);
		$_LANG_NEED_ID["city"][] = intval($row["id_city"]);
		$smarty->assign("top_users", $top_users);
	}

	///// if user's perfect match is empty
	$descr_perc = $profile_percent->GetSectionPercent(6);
	$interests_perc = $profile_percent->GetSectionPercent(7);

	////// $descr_perc ~ 70%, $interests_perc ~ 30%
	/// this is avg percent if  $summ_all< 75 user must fill his perfect mach section
	$summ_all = round($descr_perc*0.7 + $interests_perc*0.3);
	$hotlist["match_count"] = 0;

	if($summ_all >= 75){
		$match_arr = GetPerfectUsersList($user[0]);
		$hotlist["match_count"] = isset($match_arr["id_arr"])?count($match_arr["id_arr"]):0;
		if(isset($match_arr["id_arr"]) && is_array($match_arr["id_arr"])){
			$user_arr["id_arr"] = (count($match_arr["id_arr"])<4)?$match_arr["id_arr"]:array_slice($match_arr["id_arr"], 0, 4);
			$user_str = implode(", ", $user_arr["id_arr"]);
		}else{
			$user_str = "''";
		}

		$strSQL = "SELECT DISTINCT a.id, a.login, a.gender, a.date_birthday, a.icon_path, a.id_country, a.id_city, a.id_region FROM ".USERS_TABLE." a where a.id in (".$user_str.") group by a.id";
		$rs = $dbconn->Execute($strSQL);
		$i = 0;
		$visited = array();
		while(!$rs->EOF){
			$row = $rs->GetRowAssoc(false);
			$visited[$i]["name"] = $row["login"];
			$visited[$i]["age"] = AgeFromBDate($row["date_birthday"]);
			$visited[$i]["link"] = "./viewprofile.php?id=".$row["id"];
			$icon_path = $row["icon_path"]?$row["icon_path"]:$default_photos[$row["gender"]];
			$icon_image= (strlen($row["icon_path"]))?1:0;
			if($icon_path && file_exists($config["site_path"].$settings["icons_folder"]."/".$icon_path))
			$visited[$i]["icon_path"] = $config["site_root"].$settings["icons_folder"]."/".$icon_path;
			$visited[$i]["id_country"] = intval($row["id_country"]);
			$visited[$i]["id_region"] = intval($row["id_region"]);
			$visited[$i]["id_city"] = intval($row["id_city"]);

			$strSQL = "SELECT COUNT(*) FROM ".USER_UPLOAD_TABLE."  WHERE  id_user='".$row["id"]."' AND upload_type='f' AND status='1' AND allow in ('1', '2')";
			$rs_sub = $dbconn->Execute($strSQL);
			$visited[$i]["photo_count"] = intval($rs_sub->fields[0])+$icon_image;

			$_LANG_NEED_ID["country"][] = intval($row["id_country"]);
			$_LANG_NEED_ID["region"][] = intval($row["id_region"]);
			$_LANG_NEED_ID["city"][] = intval($row["id_city"]);
			$rs->MoveNext();
			$i++;
		}
		$smarty->assign("visited", $visited);
	}
	//	}

	$profile["edit_link"]="myprofile.php";
	////// links
	$profile["addf_link"]="myprofile.php?sel=4";
	$profile["adda_link"]="myprofile.php?sel=4";
	$profile["addv_link"]="myprofile.php?sel=4";


	$account["units"] = $settings["site_unit_costunit"];
	$strSQL = "SELECT account_curr from ".BILLING_USER_ACCOUNT_TABLE." where id_user = '".$user[0]."'";
	$rs = $dbconn->Execute($strSQL);
	$account["account"] = round($rs->fields[0], 2);
	$account["buy_link"] = "./payment.php?sel=update_account";
	$account["sign_link"] = "./account.php#info";
	$account["alert_link"] = "./account.php#alerts";
	$account["news_link"] = "./account.php#news";
	if (isset($settings['use_lift_up_in_search_service']) && $settings['use_lift_up_in_search_service'] == 1) {
		$account["lift_up_link"] = "./payment.php?sel=service&service=lift_up";
	}
	$profile["perfect_match_link"] = "./perfect_match.php";

	$hotlist["visit_link"] = $config["site_root"].$config_index["leftmenu_path"][8];
	$hotlist["meetme_link"] = $config["site_root"].$config_index["leftmenu_path"][10];
	$hotlist["kiss_me_link"] = $config["site_root"].$config_index["leftmenu_path"][14];
	$hotlist["emailed_me_link"] = $config["site_root"]."/mailbox.php?sel=inbox";
	$hotlist["perfect_link"] = $config["site_root"].$config_index["leftmenu_path"][7];
	$hotlist["meetthem_link"] = $config["site_root"].$config_index["leftmenu_path"][9];
	$hotlist["kiss_them_link"] = $config["site_root"].$config_index["leftmenu_path"][15];
	$hotlist["emailed_them_link"] = $config["site_root"]."/mailbox.php?sel=outbox";

	$rs = $dbconn->Execute("Select COUNT(id) from ".MAILBOX_TABLE." where id_to='".$user[0]."' and  deleted_to='0' ");
	$hotlist["emailed_me_count"] = intval($rs->fields[0]);
	$rs = $dbconn->Execute("Select COUNT(id) from ".MAILBOX_TABLE." where id_to='".$user[0]."' and was_read='0' and deleted_to='0' ");
	$hotlist["emailed_me_new_count"] = intval($rs->fields[0]);
	$rs = $dbconn->Execute("Select COUNT(id) from ".MAILBOX_TABLE." where id_from='".$user[0]."' ");
	$hotlist["emailed_them_count"] = intval($rs->fields[0]);
	$rs = $dbconn->Execute("Select count(distinct a.id_from) from ".KISSLIST_TABLE." as a left join ".USERS_TABLE." as b on b.id=a.id_to where a.id_from!='".$user[0]."' and a.id_to ='".$user[0]."' and b.status='1' and b.guest_user='0'");
	$hotlist["kiss_me_count"] = intval($rs->fields[0]);
	$rs = $dbconn->Execute("Select count(distinct a.id_to) from ".KISSLIST_TABLE." as a left join ".USERS_TABLE." as b on b.id=a.id_to where a.id_from='".$user[0]."' and a.id_to !='".$user[0]."' and b.status='1' and b.guest_user='0'");
	$hotlist["kiss_them_count"] = intval($rs->fields[0]);
	$rs = $dbconn->Execute("Select count(distinct id_visiter) from ".PROFILE_VISIT_TABLE." left join ".USERS_TABLE." on id=id_visiter  where id_visiter!='".$user[0]."' and id_user='".$user[0]."' and status='1' and visible='1' and guest_user='0'");
	$hotlist["visit_count"] = intval($rs->fields[0]);

	$meet_them_arr = GetWantToMeetThemList($user[0], false);
	$hotlist["meet_them_count"] = isset($meet_them_arr["id_arr"]) ? count($meet_them_arr["id_arr"]) : 0;
	$meet_me_arr = GetWantToMeetMeList($user[0], true);
	$hotlist["meet_me_count"] = isset($meet_me_arr["id_arr"]) ? count($meet_me_arr["id_arr"]) : 0;

	$use_refer_friend_feature = GetSiteSettings("use_refer_friend_feature");
	if ($use_refer_friend_feature){
		$hotlist["referred_link"] = $config["server"].$config["site_root"]."/quick_search.php?sel=search_referred";
		$hotlist["referred_count"] = GetCountReferredFriends($user[0]);
		$smarty->assign("user_refer_frends",GetUserReferCode($user[0]));
	}
	////// if user status = 0
	if(!$user[8]) {
		$form["err"] = $lang["home_page"]["alert_header_status"];

		$strSQL = "select confirm from ".USERS_TABLE." where id = '".$user[0]."'";
		$rs = $dbconn->Execute($strSQL);
		if(!$rs->fields[0])
		$form["err"] .= "<br>".$lang["home_page"]["alert_header_confirm"];
	}

	$form["use_horoscope"] = ($settings["use_horoscope_feature"]) ? true : false;

	$rs = $dbconn->Execute("select DATE_FORMAT(date_birthday,'%m'), DATE_FORMAT(date_birthday,'%d') from ".USERS_TABLE." where id='".$user[0]."'");
	$birth_month = $rs->fields[0];
	$birth_day = $rs->fields[1];

	$rs = $dbconn->Execute("select id from ".HOROSCOPE_SIGNS_TABLE." where DATE_FORMAT(date_start,'%m')=".$birth_month." and DATE_FORMAT(date_start,'%d')<=".$birth_day);
	if ($rs->fields[0]) {
		$sign = $rs->fields[0];
	} else {
		$rs = $dbconn->Execute("select id from ".HOROSCOPE_SIGNS_TABLE." where DATE_FORMAT(date_end,'%m')=".$birth_month." and DATE_FORMAT(date_end,'%d')>=".$birth_day);
		$sign = $rs->fields[0];
	}

	$rs = $dbconn->Execute("select id, name from ".HOROSCOPE_SIGNS_TABLE);
	$i = 0;
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$horoscope[$i]["sign_name"] = $lang["horoscope"][$row["name"]]["name"];
		$horoscope[$i]["sign_link"] = "./horoscope.php?sel=view&sign=".$row["name"];
		if ($sign == $row["id"]) $horoscope[$i]["my_sign"] = 1;
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("horoscope", $horoscope);

	$form["use_account"] = ($settings["free_site"]) ? false : true;

	$spr_arr = array();
	//// search table
	$strSQL = "select distinct id, name from ".COUNTRY_SPR_TABLE." order by name";
	$rs = $dbconn->Execute($strSQL);
	$i=0;
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$spr_arr[$i]["id"] = $row["id"];
		$spr_arr[$i]["name"] = $row["name"];
		if ($page["id_country"] == $spr_arr[$i]["id"]) {
			$spr_arr[$i]["sel"] = 1;
		}
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("countries", $spr_arr);

	$spr_arr = array();
	$strSQL = "select distinct id, name from ".REGION_SPR_TABLE." where id_country='".$page["id_country"]."' order by id";
	$rs = $dbconn->Execute($strSQL);
	$i=0;
	$spr_arr = array();
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$spr_arr[$i]["id"] = $row["id"];
		$spr_arr[$i]["name"] = stripslashes($row["name"]);
		if ($page["id_region"] == $spr_arr[$i]["id"])
		$spr_arr[$i]["sel"] = 1;
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("regions", $spr_arr);

	$spr_arr = array();
	$strSQL = "select distinct id, name from ".CITY_SPR_TABLE." where id_region='".$page["id_region"]."' order by id";
	$rs = $dbconn->Execute($strSQL);
	$i=0;
	$spr_arr = array();
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$spr_arr[$i]["id"] = $row["id"];
		$spr_arr[$i]["name"] = stripslashes($row["name"]);
		if ($page["id_city"] == $spr_arr[$i]["id"])
		$spr_arr[$i]["sel"] = 1;
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("cities", $spr_arr);

	$strSQL = "	SELECT a.gender, b.gender as gender_search, b.couple as couple_search, b.age_min, b.age_max, b.id_relationship
				FROM ".USERS_TABLE." as a, ".USER_MATCH_TABLE." as b where b.id_user=a.id AND a.id='".$user[0]."'";
	$rs = $dbconn->Execute($strSQL);
	$row = $rs->GetRowAssoc(false);
	$data["gender_1"] = $row["gender"];
	$data["gender_2"] = $row["gender_search"];
	$data["couple_2"] = $row["couple_search"];
	$data["age_min"] = $row["age_min"];
	$data["age_max"] = $row["age_max"];

	if ($row["id_relationship"] !='' && $row["id_relationship"] !='0') {
		$data["arr_relationship"] = explode(',',$row["id_relationship"]);
	} else {
		$data["arr_relationship"] = 0;
	}

	$gender_arr[0]["id"] = '1';
	$gender_arr[0]["name"] = $lang["gender"]["1"];
	$gender_arr[0]["name_search"] = $lang["gender_search"]["1"];
	$gender_arr[0]["sel"] = intval($data["gender_1"]) == 1 ? 1 : 0;
	$gender_arr[0]["sel_search"] = intval($data["gender_2"]) == 1 ? 1 : 0;
	$gender_arr[1]["id"] = '2';
	$gender_arr[1]["name"] = $lang["gender"]["2"];
	$gender_arr[1]["name_search"] = $lang["gender_search"]["2"];
	$gender_arr[1]["sel"] = intval($data["gender_1"]) == 2 ? 1 : 0;
	$gender_arr[1]["sel_search"] = intval($data["gender_2"]) == 2 ? 1 : 0;
	$smarty->assign("gender", $gender_arr);

	$form["zip_count"] = $settings["zip_count"];

	$max_age = $settings["max_age_limit"];
	$min_age = $settings["min_age_limit"];
	$max_age_arr = range(intval($max_age), intval($min_age));
	$smarty->assign("age_max", $max_age_arr);
	$min_age_arr = range(intval($min_age), intval($max_age));
	$smarty->assign("age_min", $min_age_arr);

	////  relationships select
	$strSQL = "select distinct a.id, b.".$field_name." as name from ".RELATION_SPR_TABLE." a left join ".REFERENCE_LANG_TABLE." b on b.table_key='".$multi_lang->TableKey(RELATION_SPR_TABLE)."' and b.id_reference=a.id order by a.sorter ";
	$rs = $dbconn->Execute($strSQL);
	$i = 0;
	while(!$rs ->EOF){
		$row = $rs->GetRowAssoc(false);
		$relation_arr[$i]["id"] = $row["id"];
		$relation_arr[$i]["name"] = $row["name"];
		if ( is_array($data["arr_relationship"]) && in_array($relation_arr[$i]["id"], $data['arr_relationship']) ) {
			$relation_arr[$i]["sel"] = 1;
		} else {
			$relation_arr[$i]["sel"] = 0;
		}
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("relation", $relation_arr);

	////  distance select
	$strSQL = "select id, name, type from ".DISTANCE_SPR_TABLE." order by type, name desc";
	$rs = $dbconn->Execute($strSQL);
	$i=0;
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$distances_arr[$i]["id"] = $row["id"];
		$distances_arr[$i]["name"] = $row["name"];
		$distances_arr[$i]["type"] = ($row["type"] == "mile") ? $lang["distance"]["mile"] : $lang["distance"]["km"];
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("distances", $distances_arr);

	$form["search_action"] = "./quick_search.php";
	$form["search_hiddens"] = "<input type=hidden name=sel value='search'>";
	$form["search_hiddens"] .= "<input type=hidden name=flag_country value='0'>";

	if ($config['social'] == 1 || (isset($config['use_pilot_module_club']) && $config['use_pilot_module_club'] == 1)) {
		GetUserClubs($user[0]);
	}

	$place = GetUserRatingPlace($user[0]);
	if ($place != null) {
		$form['place'] = $place;
	}

	if (isset($settings['use_pilot_module_organizer']) && $settings['use_pilot_module_organizer'] == 1) {
		$strSQL = " SELECT id, area_1, area_2, area_3, area_4, area_5, area_6, area_7, area_8, area_9
				FROM ".ORG_USER_HOME_OPTIONS_TABLE."
				WHERE id_user='".$user[0]."' ";
		$rs = $dbconn->Execute($strSQL);
		if ($rs->fields[0]>0) {
			$org_home[0] = ($rs->fields[1] == 1)? 'true': 'false';
			$org_home[1] = ($rs->fields[2] == 1)? 'true': 'false';
			$org_home[2] = ($rs->fields[3] == 1)? 'true': 'false';
			$org_home[3] = ($rs->fields[4] == 1)? 'true': 'false';
			$org_home[4] = ($rs->fields[5] == 1)? 'true': 'false';
			$org_home[5] = ($rs->fields[6] == 1)? 'true': 'false';
			$org_home[6] = ($rs->fields[7] == 1)? 'true': 'false';
			$org_home[7] = ($rs->fields[8] == 1)? 'true': 'false';
			$org_home[8] = ($rs->fields[9] == 1)? 'true': 'false';
		} else {
			$org_home = array('true','true','true','true','true','true','true','true','true');
		}
		$smarty->assign("org_home", $org_home);
		$smarty->assign("hide", 1);
	}

	if ($config["color_theme"] == 'niche') {
		GetLastUploades();
	}
	if ($config["color_theme"] == "adult" || $config["color_theme"] == "gay" || $config["color_theme"] == "lesby" || $config["color_theme"] == "matrimonial" || $config["color_theme"] == "niche") {
		$smarty->assign("new_users", GetNewUsers());
	}
	$smarty->assign("base_lang", GetBaseLang($_LANG_NEED_ID));
	$smarty->assign("hotlist", $hotlist);
	$smarty->assign("news", HomepageNews());
	$smarty->assign("poll_bar", PollBar());
	$smarty->assign("events", EventsMain());
	$smarty->assign("page", $page);
	$smarty->assign("account", $account);
	$smarty->assign("profile", $profile);
	$smarty->assign("form", $form);

	$smarty->assign("data", $data);
	$smarty->assign("section", $lang["section"]);
	$smarty->assign("header", $lang["homepage"]);
	$smarty->assign('script', 'location');
	/*
	if ( isset($config['use_pilot_module_organizer']) && ( $config['use_pilot_module_organizer']==1 ) ) {
		$strSQL = " SELECT id, home_area_color, menu_back_1_color, menu_back_2_color,
					menu_back_3_color, menu_back_4_color, menu_font_1_color, menu_font_2_color,
					menu_font_3_color, menu_font_4_color, link_color, header_color, content_color,
					search_color, shoutbox_color, main_text_color,
					big_bg_color, bg_picture_path
				FROM ".ORG_USER_LAYOUTS_TABLE."
				WHERE id_user='".intval($user[0])."' ";
		$rs = $dbconn->Execute($strSQL);
		if ($rs->fields[0]>0) {
			$row = $rs->GetRowAssoc(false);
			if ($row["home_area_color"] != "") {
				$color["home_menu"] = $row["home_area_color"];
			}
			if ($row["shoutbox_color"] != "") {
				$color["shoutbox_color"] = $row["shoutbox_color"];
				$_SESSION["shoutbox_color_my"] = $row["shoutbox_color"];
			}
			if ($row["menu_back_1_color"] != "") {
				$color["menu_block_1"] = $row["menu_back_1_color"];
			}
			if ($row["menu_back_2_color"] != "") {
				$color["menu_block_2"] = $row["menu_back_2_color"];
			}
			if ($row["menu_back_3_color"] != "") {
				$color["menu_block_3"] = $row["menu_back_3_color"];
			}
			if ($row["menu_back_4_color"] != "") {
				$color["menu_block_4"] = $row["menu_back_4_color"];
			}
			if ($row["menu_font_1_color"] != "") {
				$color["menu_link_1"] = $row["menu_font_1_color"];
			}
			if ($row["menu_font_2_color"] != "") {
				$color["menu_link_2"] = $row["menu_font_2_color"];
			}
			if ($row["menu_font_3_color"] != "") {
				$color["menu_link_3"] = $row["menu_font_3_color"];
			}
			if ($row["menu_font_4_color"] != "") {
				$color["menu_link_4"] = $row["menu_font_4_color"];
			}
			if ($row["link_color"] != "") {
				$color["link"] = $row["link_color"];
			}
			if ($row["header_color"] != "") {
				$color["header"] = $row["header_color"];
			}
			if ($row["content_color"] != "") {
				$color["content"] = $row["content_color"];
			}
			if ($row["search_color"] != "") {
				$color["home_search"] = $row["search_color"];
			}
			if ($row["big_bg_color"] != "") {
				$color["bg_color"] = $row["big_bg_color"];
			}
			if ($row["main_text_color"] != "") {
				$color["main_text_color"] = $row["main_text_color"];
			}
			if ($row["bg_picture_path"] != "") {
				$settings = GetSiteSettings( array("photos_folder"));
				$color["bg_picture_path"] = $config['site_root'].$settings["photos_folder"]."/".$row["bg_picture_path"];
			}
			$smarty->append("css_color", $color, true);
			$smarty->assign("customised", "1");
			$smarty->assign("id_customed", $user[0]);
		} else {
			unset($_SESSION["shoutbox_color_my"]);
		}
	} else {
		unset($_SESSION["shoutbox_color_my"]);
	}
	*/
	$smarty->display(TrimSlash($config["index_theme_path"])."/homepage_table".$config["theme_postfix"].".tpl");
	exit;
}
function HomepageNews(){				/////// return array for smarty
	global $lang, $config, $config_index, $smarty, $dbconn, $user;

	if ($config["color_theme"] == "niche") {
		$config_index["news_homepage_numpage"] = 3;
	}
	$news = GetLastNews($config_index["news_homepage_numpage"]);
	if (is_array($news) && sizeof($news)>0) {
		foreach($news as $key=>$n){
			$news[$key]["text"] = strip_tags($n["title"]);
			if(!strlen(utf8_decode($news[$key]["text"])))
			$news[$key]["text"] = utf8_substr(strip_tags($n["news_text"]), 0, 100)."...";
			$news[$key]["date"] = $n["date_add"];
			$news[$key]["link_read"] = GetNewsReadLink($n["id"]);
		}
		return $news;
	} else {
		return;
	}
}

function GetUserClubs($id_user) {
	global $lang, $config, $config_index, $smarty, $dbconn, $user;

	$file_name = "club.php";

	$settings = GetSiteSettings(array('show_users_connection_str','show_users_comments','show_users_group_str','photos_default','club_uploads_folder','thumb_max_width'));

	$strSQL = " SELECT DISTINCT id_club FROM ".CLUB_USERS_TABLE." WHERE id_user='".$id_user."' GROUP BY id_club LIMIT 0,4 ";
	$rs = $dbconn->Execute($strSQL);
	$num_records = $rs->RowCount();
	if ($num_records>0){
		$id_arr = array();
		while(!$rs->EOF){
			array_push($id_arr, $rs->fields[0]);
			$rs->MoveNext();
		}
		$id_str = implode(",", $id_arr);
	}

	if ($num_records>0) {
		$strSQL = " SELECT DISTINCT
								ct.id, ct.name as club_name, cct.name as category, cut.upload_path, ct.id_creator as leader_id,
								ct.is_open
							FROM ".CLUB_TABLE." ct
			                LEFT JOIN ".CLUB_CATEGORIES_TABLE." cct on cct.id=ct.id_category
			                LEFT JOIN ".CLUB_UPLOADS_TABLE." cut ON (cut.id_club=ct.id AND cut.club_icon='1' AND cut.status='1' AND cut.upload_type='f')
			                WHERE ct.id IN (".$id_str.")
			                GROUP BY ct.id ORDER BY ct.id DESC ";
		$rs = $dbconn->Execute($strSQL);
		$i = 0;
		$clubs = array();
		while(!$rs->EOF){
			$row = $rs->GetRowAssoc(false);
			$clubs[$i]["id"] = $row["id"];
			$clubs[$i]["club_name"] = stripslashes($row["club_name"]);
			$clubs[$i]["category"] = stripslashes($row["category"]);

			$clubs[$i]["is_open"] = $row["is_open"];
			if ($row["leader_id"] == $id_user){
				$clubs[$i]["user_is_leader"] = 1;
			}

			$icon_path = $row["upload_path"]?$row["upload_path"]:$settings["photos_default"];

			if($icon_path && file_exists($config["site_path"].$settings["club_uploads_folder"]."/thumb_".$icon_path)){
				$clubs[$i]["icon_path"] = $config["site_root"].$settings["club_uploads_folder"]."/thumb_".$icon_path;
			} else {
				$clubs[$i]["icon_path"] = $config["server"].$config["site_root"].$settings["club_uploads_folder"]."/".$settings["photos_default"];
			}
			$clubs[$i]["link"] = $file_name."?sel=club&id_club=".$clubs[$i]["id"];


			$strSQL = "SELECT id FROM ".CLUB_USERS_TABLE." WHERE id_club='".$clubs[$i]["id"]."' AND id_user='".$id_user."' " ;
			$rs_c = $dbconn->Execute($strSQL);
			if ($rs_c->fields[0]>0){
				$clubs[$i]["user_in_club"] = 1;
			} else {
				$clubs[$i]["user_in_club"] = 0;
			}
			$rs->MoveNext();
			$i++;
		}

		$smarty->assign("clubs", $clubs);
	} else {
		$smarty->assign("clubs", 'empty');
	}
	return ;
}

function GetNewUsers($limit=10){
	global $dbconn, $settings, $config, $default_photos;
	$strSQL = "SELECT DISTINCT id, icon_path, login
				FROM ".USERS_TABLE."
				WHERE status='1' AND root_user = '0' AND guest_user='0' AND icon_path!=''
				ORDER BY date_registration DESC LIMIT 0,".$limit;

	$rs = $dbconn->Execute($strSQL);
	$i = 0;
	while(!$rs->EOF){
		$row = $rs->GetRowAssoc(false);
		$new_users[$i]["link"] = "./viewprofile.php?id=".$row["id"];
		$new_users[$i]["login"] = $row["login"];
		$icon_path = $row["icon_path"]?$row["icon_path"]:$default_photos[$row["gender"]];
		$icon_image= (strlen($row["icon_path"]))?1:0;
		$config["site_path"].$settings["icons_folder"]."/".$icon_path;
		if($icon_path && file_exists($config["site_path"].$settings["icons_folder"]."/".$icon_path))
		$new_users[$i]["icon_path"] = $config["site_root"].$settings["icons_folder"]."/".$icon_path;

		$strSQL = "SELECT COUNT(*) FROM ".USER_UPLOAD_TABLE."  WHERE  id_user='".$row["id"]."' AND upload_type='f' AND status='1' AND allow in ('1', '2')";
		$rs_sub = $dbconn->Execute($strSQL);
		$new_users[$i]["photo_count"] = intval($rs_sub->fields[0])+$icon_image;

		$rs->MoveNext();
		$i++;
	}
	return $new_users;
}
function GetLastUploades() {
	global $smarty, $lang, $config, $dbconn, $config_index, $user, $multi_lang, $field_name;
	$upload_folder = GetSiteSettings('photos_folder');
	//get last photos
	$strSQL = " SELECT DISTINCT uu.id, uu.upload_path, gc.id, rl.".$field_name." as name, ut.login, uu.id_user, uu.is_adult, ual.title
				FROM ".USER_UPLOAD_TABLE." uu
				LEFT JOIN ".GALLERY_CATEGORIES_TABLE." gc on gc.id=uu.id_gallery
				LEFT JOIN ".USERS_TABLE." ut ON ut.id=uu.id_user
				LEFT JOIN ".REFERENCE_LANG_TABLE." rl ON gc.id=rl.id_reference AND rl.table_key='".$multi_lang->TableKey(GALLERY_CATEGORIES_TABLE)."'
				LEFT JOIN ".USER_ALBUMS." ual ON ual.id=uu.id_album
				WHERE uu.is_gallary='1' AND uu.status='1' AND uu.allow='1' AND is_adult!='1' AND uu.upload_type='f' AND gc.id=uu.id_gallery
				GROUP BY uu.id ORDER BY uu.id DESC LIMIT 0,6";
	$rs = $dbconn->Execute($strSQL);
	$i = 0;
	$last_uploads = array();
	while(!$rs->EOF) {
		$last_uploads[$i]['id'] = $rs->fields[0];
		$last_uploads[$i]["is_adult"] = $rs->fields[6];
		$last_uploads[$i]["link_type"] = 3;
		$last_uploads[$i]["view_link"] = "gallary.php?sel=view_upload&upload_type=f&id=".$last_uploads[$i]['id'];
		if (isset($rs->fields[1]) && $rs->fields[1] != '' && file_exists($config['site_path'].$upload_folder."/thumb_".$rs->fields[1])) {
			$last_uploads[$i]['upload_path'] = $config['server'].$config['site_root'].$upload_folder."/thumb_".$rs->fields[1];
		}
		$last_uploads[$i]['category_id'] = $rs->fields[2];
		$last_uploads[$i]['category_name'] = stripslashes($rs->fields[3]);
		$last_uploads[$i]['author_login'] = stripslashes($rs->fields[4]);
		$last_uploads[$i]['author_id'] = $rs->fields[5];

		$last_uploads[$i]['album_title'] = stripslashes($rs->fields[7]);
		if (strlen(utf8_decode($last_uploads[$i]['album_title'])>15)) {
			$last_uploads[$i]['album_title'] = utf8_substr($last_uploads[$i]['album_title'],0,15);
		}
		$rs->MoveNext();
		$i++;
	}
	$smarty->assign("last_uploads", $last_uploads);
	return ;
}

function cleanMailbox(){
	global $dbconn, $config;

	$last_mailbox_cleaning = intval(GetSiteSettings('last_mailbox_cleaning'));

	$strSQL = "UPDATE ".SETTINGS_TABLE." SET  value='".time()."' WHERE name='last_mailbox_cleaning'";
	$dbconn->Execute($strSQL);

	if ($last_mailbox_cleaning < time()-1*24*60*60){

		$attaches_folder = GetSiteSettings('attaches_folder');

		$strSQL = "UPDATE ".MAILBOX_TABLE." SET deleted_from='1' WHERE kill_date_from<'".time()."'";
		$dbconn->Execute($strSQL);
		$strSQL = "UPDATE ".MAILBOX_TABLE." SET deleted_to='1' WHERE kill_date_to<'".time()."'";
		$dbconn->Execute($strSQL);

		//delete attaches
		$strSQL = "SELECT b.id, b.attach_name FROM ".MAILBOX_TABLE." a, ".MAILBOX_ATTACHES_TABLE." b
					WHERE a.id=b.id_mail AND a.deleted_from='1' AND a.deleted_to='1'";
		$rs = $dbconn->Execute($strSQL);
		while (!$rs->EOF){
			$attach_ids[] = $rs->fields[0];
			$attach_name = $rs->fields[1];
			$attach_path = $config["site_path"].$config["site_root"].$attaches_folder."/".$attach_name;
			if (file_exists($attach_path)) unlink($attach_path);
			$rs->MoveNext();
		}

		//delete attaches records
		if (isset($attach_ids) && is_array($attach_ids)){
			$attach_ids_str = implode(",",$attach_ids);
			$strSQL = "DELETE FROM ".MAILBOX_ATTACHES_TABLE." WHERE id in (".$attach_ids_str.")";
			$dbconn->Execute($strSQL);
		}
		//delete mails
		$strSQL = "DELETE FROM ".MAILBOX_TABLE." WHERE deleted_from='1' AND deleted_to='1'";
		$dbconn->Execute($strSQL);
	}else{
		return ;
	}
}
?>

and here is the jquery code:

Code: Select all

<?php
echo "<!doctype html>\n"; 
echo " \n"; 
echo "<html lang=\"en\">\n"; 
echo "<head>\n"; 
echo "    <link rel=\"stylesheet\" href=\"http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css\" />\n"; 
echo "    <script src=\"http://code.jquery.com/jquery-1.8.2.js\"></script>\n"; 
echo "    <script src=\"/resources/demos/external/jquery.bgiframe-2.1.2.js\"></script>\n"; 
echo "    <script src=\"http://netolancer.co.uk/jquery-ui.js\"></script>\n"; 
echo "    <link rel=\"stylesheet\" href=\"/resources/demos/style.css\" />\n"; 
echo "    <script>\n"; 
echo "    $(function() {\n"; 
echo "        $( \"#dialog\" ).dialog();\n"; 
echo "    });\n"; 
echo "    </script>\n"; 
echo "</head>\n"; 
echo "<body>\n"; 
echo " \n"; 
echo "<div id=\"dialog\" title=\"Basic dialog\">\n"; 
echo "    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>\n"; 
echo "</div>\n"; 
echo " \n"; 
echo " \n"; 
echo "</body>\n"; 
echo "</html>\n";
?>

could someone please help me out with this?

Thank you in advance.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest