load_files(); ?>
member_id) { ?> member_id) { ?> member_id) { ?>

Copyright �2006 Shuffle Your Dance Cards.
All rights reserved. �Psi Pi
query($sql); if($conn->num_rows($rs)>0) { return true; } return false; } function isContact($user_id, $cl_user_id) { global $conn; $sql = "select * from m_contact_list where user_id = " . $user_id . " and cl_user_id = " . $cl_user_id; $rs = $conn->query($sql); if($conn->num_rows($rs)>0) { return true; } return false; } // Formateaza o data din modelul mysql in formatul romanesc function format_mysql_data($value,$time=1) { $arr = explode(" ",$value); $data = $arr[0]; $timp = $arr[1]; $data_arr = explode("-",$arr[0]); //data e nula (si neavenita) if ($data_arr[2]=='00') return 'N/A'; $data_str = $data_arr[2]."/".$data_arr[1]."/".$data_arr[0]; if ($timp=='' || $time==0) return $data_str; else { $timp_arr = explode(":",$arr[1]); //nu are nevoie nimeni de ora la secunda $data_str .=" ".$timp_arr[0].":".$timp_arr[1]; return $data_str; } } function myDateFormat($timestamp) { return date('d/m/y h:i',$timestamp); } function unhtmlentities($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); $trans_tbl = array_flip ($trans_tbl); return strtr ($string, $trans_tbl); } function get_date($string_date) { $yr = substr($string_date,0,4); $mon = substr($string_date,5,2); $day = substr($string_date,8,2); $time = substr($string_date,11,8); return $mon."/".$day."/".$yr." ".$time; } ?>discipline_caption= $DISCIPLINE_LABEL; $event_filter->proc_file="event_proc.php"; $event_filter->show_filter($info); return $event_filter->filter_cond; } //return the days that have event for use in the calendar for example //all days inside periods are also returned function get_dates_with_events($event_cond='1',$date_format='Y-n-j') { global $conn; $dates=array(); $events_query=get_events_query($event_cond); $events_res=$conn->query($events_query); while ($info=$conn->fetch_array($events_res)) { $current_date=format_date($info["event_date"],$date_format); $dates[]=$current_date; if ( $info["period"] && strlen($info["event_end_date"]) ) { $end_date=format_date($info["event_end_date"],$date_format); $current_time=strtotime($current_date); $end_time=strtotime($end_date); while($current_time < $end_time && $i<100)//100 just for safety { $i++; $current_time=strtotime("+1 day", $current_time); $dates[]=date($date_format,$current_time); } } } return $dates; } //shows the menu for events: few buttons function show_front_menu() { global $auth; ?>
member_id) { ?>
send %%remained_msg_no%% messages until %%disable_date%% when the anti-spam filter will be lifted."; var $sent_msg_no; // number of sent messages in the first days from subscription var $disable_date; // the date when the restriction will be lifted var $conn; /* @var CConn */ function CMsgRestriction() { global $conn; $this->conn=&$conn; $this->get_settings(); } /* load settings from database */ function get_settings() { $query="SELECT * FROM settings"; $info=$this->conn->fetch($query); $this->max_allowed_msg_no=$info["antispam_max_allowed_msg_no"]; $this->days_from_subscr=$info["antispam_days_from_subscr"]; $this->forbid_msg=$info["antispam_forbid_msg"]; $this->notice_msg=$info["antispam_notice_msg"]; } /* Implements the restriction and returns false if forbidden*/ function check($member_id, $subscribe_date) { $query=" SELECT COUNT(*) AS sent_msg_no ,('$subscribe_date' + INTERVAL $this->days_from_subscr DAY) AS disable_date ,NOW()<('$subscribe_date' + INTERVAL $this->days_from_subscr DAY) AS recently_subscribed FROM m_messages WHERE from_id=$member_id AND message_date<('$subscribe_date' + INTERVAL $this->days_from_subscr DAY)"; $info=$this->conn->fetch($query); if($info["recently_subscribed"]) { $this->sent_msg_no=$info["sent_msg_no"]; $this->disable_date=$info["disable_date"]; } if ($this->sent_msg_no>=$this->max_allowed_msg_no) { $this->forbid_msg=str_replace("%%max_allowed_msg_no%%",$this->max_allowed_msg_no,$this->forbid_msg); $this->forbid_msg=str_replace("%%days_from_subscr%%",$this->days_from_subscr,$this->forbid_msg); return false; } return true; } /* returns the notice message to inform the user about the number of messages he may send */ function get_notice_msg($member_id, $subscribe_date) { $this->check($member_id, $subscribe_date); if ($this->sent_msg_no && $this->sent_msg_no<$this->max_allowed_msg_no) { $remained_msg_no=$this->max_allowed_msg_no-$this->sent_msg_no; $disable_date=format_date($this->disable_date); $this->notice_msg=str_replace("%%remained_msg_no%%",$remained_msg_no,$this->notice_msg); $this->notice_msg=str_replace("%%disable_date%%",$disable_date,$this->notice_msg); return $this->notice_msg; } } } ?>main_table=$main_table; $this->categories_table=$categories_table; $this->states=$states; unset($this->states[-1]); $this->conn=$conn; } function set_filter($info) { global $auth; if (!is_array($info) && !$auth->is_admin) $info=$this->get_filter_preferences($this->main_caption,$auth->member_id); $this->info=$info; } function get_filter_cond($info) { $this->set_filter($info); $filter_cond=""; $info=$this->info; if ($info["country"]) { $filter_cond.=" AND (country='".$info["country"]."' OR country=0) "; } if ($info["category"]) { $filter_cond.=" AND (category='".$info["category"]."' OR category=0) "; } if (strlen($info["town"])) { $filter_cond.=" AND (town='".$info["town"]."' OR town='') "; } if ($info["discipline"]) { $filter_cond.=" AND (discipline=".$info["discipline"]." OR discipline=0) "; } $this->filter_cond=$filter_cond; return $filter_cond; } function show_filter($info) { global $conn, $BG_COLOR1, $BG_COLOR2, $auth; $this->set_filter($info); $info=$this->info; $states=$this->states; $this->filter_button="Filter ".ucfirst($this->main_caption); $state_sel=new CSelect($info["country"],$conn); $category_sel=new CSelect($info["category"],$conn); $town_sel=new CSelect($info["town"],$conn); $discipline_sel=new CSelect($info["discipline"],$conn); //highlight active filters if ($info["country"]) $country_bg=$BG_COLOR2; if ($info["category"]) $category_bg=$BG_COLOR2; if (strlen($info["town"])) $town_bg=$BG_COLOR2; if ($info["discipline"]) $discipline_bg=$BG_COLOR2; ?>
Select your filter criteria*
show_category_field) { ?>
Country: Town:
Catagory: show_discipline_field) { ?> discipline_caption?>:
member_id && !$auth->is_admin) {?>
You can set your filter preferences here
(*)To filter main_caption?>, select your criteria then press the filter_button?> button
is_admin && $auth->member_id) {?>Load preferences
get_filter_cond($info); } function get_populated_countries() { global $states, $conn; $arr=array(); $query=" SELECT country, COUNT(*) AS no FROM $this->main_table GROUP BY country ORDER BY country"; $res=$conn->query($query); if (!$conn->num_rows($res)) return $arr; while ($info=$conn->fetch_array($res)) $countries[$info["country"]]=$info["no"]; $for_all=(int)$countries[0]; foreach ($countries as $key=>$value) $arr[$key]=$states[$key]; //$arr[$key]=$states[$key]." (".($for_all+$value).")"; unset($arr[0]); return $arr; } function get_populated_towns() { $query=" CREATE TEMPORARY TABLE temporary_towns SELECT DISTINCT town FROM $this->main_table WHERE LENGTH(town)>0"; $this->conn->query($query); $query=" SELECT c.town, CONCAT(c.town,' (',SUM(e.town IS NOT NULL),')') AS show_name_numbers, c.town AS show_name FROM temporary_towns AS c LEFT JOIN $this->main_table AS e ON (c.town=e.town OR e.town='') GROUP BY LOWER(c.town) "; $res=$this->conn->query($query); $this->conn->query("DROP TABLE IF EXISTS temporary_towns"); return $res; } function get_populated_categories() { $query=" SELECT c.category_id, CONCAT(c.name,' (',SUM(e.category IS NOT NULL),')') AS show_name_numbers, c.name AS show_name FROM $this->categories_table AS c INNER JOIN $this->main_table AS e ON (e.category=c.category_id OR e.category=0) GROUP BY c.category_id HAVING MAX(e.category)!=0 ORDER BY c.position "; return $this->conn->query($query); } function get_populated_disciplines() { $query=" SELECT d.discipline_id, CONCAT(d.discipline,' (',SUM(e.discipline IS NOT NULL),')') AS show_name_numbers, d.discipline AS show_name FROM disciplines AS d LEFT JOIN $this->main_table AS e ON (e.discipline=d.discipline_id OR e.discipline=0) GROUP BY d.discipline_id HAVING MAX(e.discipline)!=0 ORDER BY d.position "; return $this->conn->query($query); } function get_filter_preferences($prefix,$member_id) { if (!$member_id) return array(); //empty array since member is not logged in $country_field=$prefix."_country"; $town_field=$prefix."_town"; $category_field=$prefix."_category"; $discipline_field=$prefix."_discipline"; $query=" SELECT $country_field AS country, $town_field AS town, $category_field AS category, $discipline_field AS discipline FROM preferences WHERE member_id=$member_id"; $info=$this->conn->fetch($query); return $info; } } ?>