function search_blog() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results; // CONSTRUCT QUERY $sql = "\r\n SELECT\r\n se_blogentries.blogentry_id,\r\n se_blogentries.blogentry_title,\r\n se_blogentries.blogentry_body,\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n FROM\r\n se_blogentries,\r\n se_users,\r\n se_levels\r\n WHERE\r\n se_blogentries.blogentry_user_id=se_users.user_id &&\r\n se_users.user_level_id=se_levels.level_id &&\r\n (\r\n se_blogentries.blogentry_search='1' ||\r\n se_levels.level_blog_search='0'\r\n ) \r\n "; $sql .= " && MATCH (`blogentry_title`, `blogentry_body`) AGAINST ('{$search_text}' IN BOOLEAN MODE)"; /* $sql .= " && ( blogentry_title LIKE '%$search_text%' || blogentry_body LIKE '%$search_text%' ) "; */ // GET TOTAL ENTRIES $sql2 = $sql . " LIMIT 201"; $resource = $database->database_query($sql2); $total_entries = $database->database_num_rows($resource); // IF NOT TOTAL ONLY if ($t == "blog") { // MAKE BLOG PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // SEARCH BLOGS $sql3 = $sql . " ORDER BY blogentry_id DESC LIMIT {$start}, {$limit}"; $resource = $database->database_query($sql3); while ($blogentry_info = $database->database_fetch_assoc($resource)) { // CREATE AN OBJECT FOR AUTHOR $profile = new se_user(); $profile->user_info['user_id'] = $blogentry_info['user_id']; $profile->user_info['user_username'] = $blogentry_info['user_username']; $profile->user_info['user_photo'] = $blogentry_info['user_photo']; $profile->user_info['user_fname'] = $blogentry_info['user_fname']; $profile->user_info['user_lname'] = $blogentry_info['user_lname']; $profile->user_displayname(); // IF EMPTY TITLE if (!trim($blogentry_info['blogentry_title'])) { $blogentry_info['blogentry_title'] = SE_Language::get(589); } $blogentry_info['blogentry_body'] = cleanHTML($blogentry_info['blogentry_body'], ''); // IF BODY IS LONG if (strlen($blogentry_info['blogentry_body']) > 150) { $blogentry_info['blogentry_body'] = substr($blogentry_info['blogentry_body'], 0, 147) . "..."; } $result_url = $url->url_create('blog_entry', $blogentry_info['user_username'], $blogentry_info['blogentry_id']); $result_name = 1500118; $result_desc = 1500119; $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/blog_blog48.gif', 'result_name' => $result_name, 'result_name_1' => $blogentry_info['blogentry_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $blogentry_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $blogentry_info['blogentry_body']); } // SET TOTAL RESULTS $total_results = $total_entries; } // SET ARRAY VALUES SE_Language::_preload_multi(1500118, 1500119, 1500120); if ($total_albums > 200) { $total_albums = "200+"; } $search_objects[] = array('search_type' => 'blog', 'search_lang' => 1500120, 'search_total' => $total_entries); }
function search_poll() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results; // CONSTRUCT QUERY $sql = "\r\n SELECT\r\n se_polls.poll_id,\r\n se_polls.poll_title,\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n FROM\r\n se_polls,\r\n se_users,\r\n se_levels\r\n WHERE\r\n se_polls.poll_user_id=se_users.user_id &&\r\n se_users.user_level_id=se_levels.level_id &&\r\n (\r\n se_polls.poll_search='1' ||\r\n se_levels.level_poll_search='0'\r\n ) &&\r\n (\r\n poll_title LIKE '%{$search_text}%' ||\r\n poll_desc LIKE '%{$search_text}%' ||\r\n poll_options LIKE '%{$search_text}%'\r\n )\r\n "; // GET TOTAL ENTRIES $total_polls = $database->database_num_rows($database->database_query($sql . " LIMIT 201")); // IF NOT TOTAL ONLY if ($t == "poll") { // MAKE POLL PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // SEARCH POLLS $sql .= " ORDER BY se_polls.poll_id DESC LIMIT {$start}, {$limit}"; $resource = $database->database_query($sql) or die($database->database_error()); while ($poll_info = $database->database_fetch_assoc($resource)) { // CREATE AN OBJECT FOR AUTHOR $profile = new se_user(); $profile->user_info['user_id'] = $poll_info['user_id']; $profile->user_info['user_username'] = $poll_info['user_username']; $profile->user_info['user_fname'] = $poll_info['user_fname']; $profile->user_info['user_lname'] = $poll_info['user_lname']; $profile->user_info['user_photo'] = $poll_info['user_photo']; $profile->user_displayname(); $result_url = $url->url_create('poll', $poll_info['user_username'], $poll_info['poll_id']); $result_name = 2500112; $result_desc = 2500113; // IF EMPTY TITLE if (!trim($poll_info['poll_title'])) { SE_Language::_preload(589); SE_Language::load(); $poll_info['poll_title'] = SE_Language::_get(589); } $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/poll_poll48.gif', 'result_name' => $result_name, 'result_name_1' => $poll_info['poll_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $profile->user_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $poll_info['poll_desc']); } // SET TOTAL RESULTS $total_results = $total_polls; } // SET ARRAY VALUES SE_Language::_preload_multi(2500111, 2500112, 2500113); if ($total_polls > 200) { $total_polls = "200+"; } $search_objects[] = array('search_type' => 'poll', 'search_lang' => 2500111, 'search_total' => $total_polls); }
function search_documents() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results; // START TO QUERY BUILD $sql = "\r\n SELECT\r\n se_documents.document_id,\r\n se_documents.document_title,\r\n se_documents.document_slug,\r\n se_documents.document_description,\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n FROM\r\n se_documents \r\n INNER JOIN \r\n se_users \r\n ON se_documents.document_user_id=se_users.user_id\r\n INNER JOIN\r\n se_levels\r\n ON se_users.user_level_id=se_levels.level_id \r\n LEFT JOIN\r\n\t se_document_tags\r\n\t ON se_documents.document_id = se_document_tags.document_id\r\n\t LEFT JOIN se_documenttags\r\n\t ON se_document_tags.tag_id = se_documenttags.id \r\n WHERE\r\n\r\n (\r\n se_documents.document_search='1' ||\r\n se_levels.level_document_search='0'\r\n ) &&\r\n (\r\n document_title LIKE '%{$search_text}%' ||\r\n document_description LIKE '%{$search_text}%' ||\r\n document_fulltext LIKE '%{$search_text}%' ||\r\n tag_name LIKE '%{$search_text}%'\r\n )\r\n &&\r\n (\r\n se_documents.document_approved='1'\r\n )\r\n &&\r\n (\r\n se_documents.document_publish='1'\r\n )\r\n &&\r\n (\r\n se_documents.document_status='1'\r\n )\r\n GROUP BY se_documents.document_id \r\n "; // GET TOTAL DOCUMNETS $total_documents = $database->database_num_rows($database->database_query($sql . " LIMIT 201")); // IF NOT TOTAL ONLY if ($t == "document") { // DOCUMENTS PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // SEARCH DOCUMENTS $sql .= " ORDER BY se_documents.document_id DESC LIMIT {$start}, {$limit}"; $resource = $database->database_query($sql) or die($database->database_error()); while ($document_info = $database->database_fetch_assoc($resource)) { // CREATE AN OBJECT FOR AUTHOR $profile = new se_user(); $profile->user_info['user_id'] = $document_info['user_id']; $profile->user_info['user_username'] = $document_info['user_username']; $profile->user_info['user_fname'] = $document_info['user_fname']; $profile->user_info['user_lname'] = $document_info['user_lname']; $profile->user_info['user_photo'] = $document_info['user_photo']; $profile->user_displayname(); $result_url = $url->url_create("document", $document_info['user_username'], $document_info['document_id'], $document_info['document_slug']); $result_name = 650003007; $result_desc = 650003008; $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/document60.gif', 'result_name' => $result_name, 'result_name_1' => $document_info['document_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $profile->user_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $document_info['document_description']); } // SET TOTAL RESULTS $total_results = $total_documents; } // SET ARRAY VALUES SE_Language::_preload_multi(650003009, 650003007, 650003008); if ($total_documents > 200) { $total_documents = "200+"; } $search_objects[] = array('search_type' => 'document', 'search_lang' => 650003009, 'search_total' => $total_documents); }
function userconnection_users_information($path_array) { global $setting, $database, $user; $path = NULL; // CACHING $cache_object = SECache::getInstance('serial'); if (is_object($cache_object)) { $path = $cache_object->get('shortest_path'); } // RETRIEVAL if (!is_array($path)) { // HERE WE WILL TAKE ALL USER ID'S IN A SINGLE VARIABLE $USERS_ID $users_id = implode(",", $path_array); $id = $user->user_info['user_id']; $sql = "SELECT user_id, user_username, user_fname, user_lname, user_photo, user_lastlogindate, user_dateupdated FROM se_users WHERE ((user_verified='1' AND user_enabled='1' AND user_search='1') OR (user_id = '{$id}')) AND user_id IN ({$users_id}) "; $resource = $database->database_query($sql); $path = array(); while ($user_info = $database->database_fetch_assoc($resource)) { $shortest_user = new se_user(); $shortest_user->user_info['user_id'] = $user_info['user_id']; $shortest_user->user_info['user_username'] = $user_info['user_username']; $shortest_user->user_info['user_photo'] = $user_info['user_photo']; $shortest_user->user_info['user_fname'] = $user_info['user_fname']; $shortest_user->user_info['user_lname'] = $user_info['user_lname']; $shortest_user->user_info['user_lastlogindate'] = $user_info['user_lastlogindate']; $shortest_user->user_info['user_dateupdated'] = $user_info['user_dateupdated']; $shortest_user->user_displayname(); $path[$user_info['user_id']] =& $shortest_user; unset($shortest_user); } // foreach ($path_array as $l) { if (!empty($path[$l])) { $new_user_array[] = $path[$l]; } } // CACHE if (is_object($cache_object)) { $cache_object->store($path, 'shortest_path'); } } return $new_user_array; }
function load_se_user() { $user = new se_user(); $user->user_exists = 1; $user->user_info = $this->getProperties(); $this->se_user = $user; $this->se_user->user_displayname(); $this->user_displayname_short = $this->se_user->user_displayname_short; $this->user_displayname = $this->se_user->user_displayname; return $this->se_user; }
$subnets = $database->database_query("SELECT subnet_id, subnet_name FROM se_subnets ORDER BY subnet_name"); $subnet_array[0] = array('subnet_id' => 0, 'subnet_name' => 152); SE_Language::_preload(152); while ($subnet_info = $database->database_fetch_assoc($subnets)) { SE_Language::_preload($subnet_info[subnet_name]); $subnet_array[$subnet_info[subnet_id]] = $subnet_info; } // PULL USERS INTO AN ARRAY $users = $database->database_query($user_query); while ($user_info = $database->database_fetch_assoc($users)) { $user = new se_user(); $user->user_info[user_id] = $user_info[user_id]; $user->user_info[user_username] = $user_info[user_username]; $user->user_info[user_fname] = $user_info[user_fname]; $user->user_info[user_lname] = $user_info[user_lname]; $user->user_displayname(); $user_info[user_displayname] = $user->user_displayname; $user_array[] = $user_info; } // ASSIGN VARIABLES AND SHOW VIEW USERS PAGE $smarty->assign('total_users', $total_users); $smarty->assign('pages', $page_array); $smarty->assign('users', $user_array); $smarty->assign('i', $i); $smarty->assign('u', $u); $smarty->assign('em', $em); $smarty->assign('v', $v); $smarty->assign('sd', $sd); $smarty->assign('p', $page_vars[1]); $smarty->assign('s', $s); $smarty->assign('f_user', $f_user);
function search_video() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results; // CONSTRUCT QUERY $video_query = "SELECT \r\n\t\t\t se_videos.*, \r\n\t\t\t se_users.user_id, \r\n\t\t\t se_users.user_username,\r\n\t\t\t se_users.user_photo,\r\n\t\t\t se_users.user_fname,\r\n\t\t\t se_users.user_lname\r\n\t\t\tFROM\r\n\t\t\t se_videos,\r\n\t\t\t se_users,\r\n\t\t\t se_levels\r\n\t\t\tWHERE\r\n\t\t\t se_videos.video_user_id=se_users.user_id AND\r\n\t\t\t se_users.user_level_id=se_levels.level_id AND\r\n\t\t\t (\r\n\t\t\t se_videos.video_search='1' OR\r\n\t\t\t se_levels.level_video_search='0'\r\n\t\t\t )\r\n\t\t\t AND\r\n\t\t\t (\r\n\t\t\t se_videos.video_title LIKE '%{$search_text}%' OR\r\n\t\t\t se_videos.video_desc LIKE '%{$search_text}%'\r\n\t\t\t )"; // GET TOTAL RESULTS $total_videos = $database->database_num_rows($database->database_query($video_query . " LIMIT 201")); // IF NOT TOTAL ONLY if ($t == "video") { // MAKE VIDEO PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // SEARCH VIDEOS $video = new se_video(); $videos = $database->database_query($video_query . " ORDER BY video_id DESC LIMIT {$start}, {$limit}"); while ($video_info = $database->database_fetch_assoc($videos)) { // CREATE AN OBJECT FOR USER $profile = new se_user(); $profile->user_info[user_id] = $video_info[user_id]; $profile->user_info[user_username] = $video_info[user_username]; $profile->user_info[user_fname] = $video_info[user_fname]; $profile->user_info[user_lname] = $video_info[user_lname]; $profile->user_info[user_photo] = $video_info[user_photo]; $profile->user_displayname(); // SET RESULT VARS $result_url = $url->url_create("video", $video_info[user_username], $video_info[video_id]); $result_name = 5500141; $result_desc = 5500142; // SET DIRECTORY $video_info[video_dir] = $video->video_dir($video_info[user_id]); // CHECK FOR THUMBNAIL $thumb_path = $video_info[video_dir] . $video_info[video_id] . "_thumb.jpg"; if (!file_exists($thumb_path)) { $video_info[video_thumb] = "./images/video_placeholder.gif"; } // IF NO TITLE if ($video_info[video_title] == "") { $video_info[video_title] = SE_Language::get(589); } // IF DESCRIPTION IS LONG if (strlen($video_info[video_desc]) > 150) { $video_info[video_desc] = substr($video_info[video_desc], 0, 147) . "..."; } $results[] = array('result_url' => $result_url, 'result_icon' => $thumb_path, 'result_name' => $result_name, 'result_name_1' => $video_info[video_title], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $video_info[user_username]), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $video_info[video_desc]); } // SET TOTAL RESULTS $total_results = $total_videos; } // SET ARRAY VALUES SE_Language::_preload_multi(5500141, 5500142, 5500143); if ($total_videos > 200) { $total_videos = "200+"; } $search_objects[] = array('search_type' => 'video', 'search_lang' => 5500143, 'search_total' => $total_videos); }
function comment_list($start, $limit) { global $database, $setting, $user; $comment_array = array(); $comment_query = "\r\n SELECT \r\n\t\t\t\t`se_{$this->comment_type}comments`.*, \r\n\t\t\t\tse_users.user_id, \r\n\t\t\t\tse_users.user_username, \r\n\t\t\t\tse_users.user_fname,\r\n\t\t\t\tse_users.user_lname,\r\n\t\t\t\tse_users.user_photo,\r\n\t\t\tCASE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_REGISTERED) AND '{$user->user_exists}'<>0)\r\n\t\t\t THEN FALSE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_ANONYMOUS) AND '{$user->user_exists}'=0)\r\n\t\t\t THEN FALSE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_SELF) AND se_users.user_id='{$user->user_info['user_id']}')\r\n\t\t\t THEN FALSE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1=se_users.user_id AND friend_user_id2='{$user->user_info['user_id']}' AND friend_status='1' LIMIT 1))\r\n\t\t\t THEN FALSE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_SUBNET) AND se_users.user_subnet_id='{$user->user_info['user_subnet_id']}')\r\n\t\t\t THEN FALSE\r\n\t\t\t WHEN ((se_users.user_privacy & @SE_PRIVACY_FRIEND2) AND se_users.user_subnet_id='{$user->user_info['user_subnet_id']}' AND (SELECT TRUE FROM se_friends AS friends_primary LEFT JOIN se_friends AS friends_secondary ON friends_primary.friend_user_id2=friends_secondary.friend_user_id1 WHERE friends_primary.friend_user_id1=se_users.user_id AND friends_secondary.friend_user_id2='{$user->user_info['user_id']}' LIMIT 1))\r\n\t\t\t THEN FALSE\r\n\t\t\t ELSE TRUE\r\n\t\t\tEND\r\n\t\t\tAS is_profile_private\r\n\t\t\tFROM \r\n\t\t\t\t`se_{$this->comment_type}comments`\r\n\t\t\tLEFT JOIN \r\n\t\t\t\tse_users \r\n\t\t\tON \r\n\t\t\t\t`se_{$this->comment_type}comments`.`{$this->comment_type}comment_authoruser_id`=se_users.user_id \r\n\t\t\tWHERE \r\n\t\t\t\t`{$this->comment_type}comment_{$this->comment_identifier}`='{$this->comment_identifying_value}' \r\n\t\t\tORDER BY\r\n `{$this->comment_type}comment_id` DESC \r\n\t\t\tLIMIT\r\n {$start}, {$limit}\r\n "; $comments = $database->database_query($comment_query); while ($comment_info = $database->database_fetch_assoc($comments)) { // CREATE AN OBJECT FOR AUTHOR $author = new se_user(); if ($comment_info['user_id'] != $comment_info[$this->comment_type . 'comment_authoruser_id']) { $author->user_exists = FALSE; } else { $author->user_exists = TRUE; $author->user_info['user_id'] = $comment_info['user_id']; $author->user_info['user_username'] = $comment_info['user_username']; $author->user_info['user_fname'] = $comment_info['user_fname']; $author->user_info['user_lname'] = $comment_info['user_lname']; $author->user_info['user_photo'] = $comment_info['user_photo']; $author->user_displayname(); } // SET COMMENT ARRAY $comment_array[] = array('comment_id' => $comment_info[$this->comment_type . 'comment_id'], 'comment_authoruser_id' => $comment_info[$this->comment_type . 'comment_authoruser_id'], 'comment_author' => $author, 'comment_date' => $comment_info[$this->comment_type . 'comment_date'], 'comment_body' => $comment_info[$this->comment_type . 'comment_body'], 'comment_author_private' => $comment_info['is_profile_private']); } return $comment_array; }
function friends_birthdays() { global $setting, $database, $user; $birthdays = NULL; // CACHING $cache_object = SECache::getInstance('serial'); if (is_object($cache_object)) { $birthdays = $cache_object->get('friends_birthdays_user_' . $user->user_info['user_id']); } // RETRIEVAL //if( !is_array($birthdays) || empty($birthdays) ) if (!is_array($birthdays)) { $birthdays = array(); $sql = "SELECT profilefield_id, t2.profilecat_id FROM se_profilefields LEFT JOIN se_profilecats AS t1 ON se_profilefields.profilefield_profilecat_id=t1.profilecat_id LEFT JOIN se_profilecats AS t2 ON t1.profilecat_dependency=t2.profilecat_id WHERE profilefield_special='1'"; $resource = $database->database_query($sql); if ($database->database_num_rows($resource) > 0) { // CONSTRUCT QUERY $birthdays_upcoming_query = "\r\n SELECT\r\n se_users.user_id, \r\n se_users.user_username, \r\n se_users.user_fname, \r\n se_users.user_lname,\r\n CASE\r\n "; while ($birthday_field = $database->database_fetch_assoc($resource)) { $birthdays_upcoming_query .= " WHEN se_users.user_profilecat_id='{$birthday_field['profilecat_id']}' THEN DATE_FORMAT(CONCAT(YEAR(CURDATE()), \"-\", MONTH(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`), \"-\", DAY(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`)), '%Y-%m-%d')"; $birthdays_upcoming_where[] = "(se_users.user_profilecat_id='{$birthday_field['profilecat_id']}' AND DAY(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`)<>'0' AND MONTH(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`)<>'0' AND CURDATE() <= DATE_FORMAT(CONCAT(YEAR(CURDATE()), \"-\", MONTH(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`), \"-\", DAY(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`)), '%Y-%m-%d') AND DATE_ADD(CURDATE(), INTERVAL 7 DAY) >= DATE_FORMAT(CONCAT(YEAR(CURDATE()), \"-\", MONTH(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`), \"-\", DAY(se_profilevalues.`profilevalue_{$birthday_field['profilefield_id']}`)), '%Y-%m-%d'))"; } $birthdays_upcoming_query .= " ELSE '0000-00-00' END AS birthday FROM se_friends LEFT JOIN se_users ON se_friends.friend_user_id2=se_users.user_id LEFT JOIN se_profilevalues ON se_users.user_id=se_profilevalues.profilevalue_user_id WHERE se_friends.friend_user_id1='{$user->user_info['user_id']}' AND (" . implode(" OR ", $birthdays_upcoming_where) . ") ORDER BY birthday"; $resource = $database->database_query($birthdays_upcoming_query); while ($birthday_info = $database->database_fetch_assoc($resource)) { $birthday_user = new se_user(); $birthday_user->user_info['user_id'] = $birthday_info['user_id']; $birthday_user->user_info['user_username'] = $birthday_info['user_username']; $birthday_user->user_info['user_fname'] = $birthday_info['user_fname']; $birthday_user->user_info['user_lname'] = $birthday_info['user_lname']; $birthday_user->user_displayname(); // SET BIRTHDAY $birthday_date = mktime(0, 0, 0, substr($birthday_info['birthday'], 5, 2), substr($birthday_info['birthday'], 8, 2), 1990); $birthdays[] = array('birthday_user_id' => $birthday_user->user_info['user_id'], 'birthday_user_username' => $birthday_user->user_info['user_username'], 'birthday_user_displayname' => $birthday_user->user_displayname, 'birthday_date' => $birthday_date, 'birthday_user' => &$birthday_user); unset($birthday_user); } } // CACHE if (is_object($cache_object)) { $cache_object->store($birthdays, 'friends_birthdays_user_' . $user->user_info['user_id']); } } return $birthdays; }
$actiontype_selected = 0; } SE_Language::_preload($actiontype['actiontype_desc']); $actiontypes_array[] = array('actiontype_id' => $actiontype['actiontype_id'], 'actiontype_selected' => $actiontype_selected, 'actiontype_desc' => $actiontype['actiontype_desc']); } // CREATE ARRAY OF BLOCKED USERS if ($user->user_info['user_blocklist'] != "") { $blocked_users = $database->database_query("SELECT user_id, user_username, user_fname, user_lname, user_photo FROM se_users WHERE user_id IN('" . implode("','", array_filter(explode(",", $user->user_info['user_blocklist']))) . "')"); while ($block = $database->database_fetch_assoc($blocked_users)) { $block_user = new se_user(); $block_user->user_info['user_id'] = $block['user_id']; $block_user->user_info['user_username'] = $block['user_username']; $block_user->user_info['user_photo'] = $block['user_photo']; $block_user->user_info['user_fname'] = $block['user_fname']; $block_user->user_info['user_lname'] = $block['user_lname']; $block_user->user_displayname(); $block_array[] = $block_user; } } // GET PREVIOUS PRIVACY SETTINGS for ($c = 0; $c < count($level_profile_privacy); $c++) { if (user_privacy_levels($level_profile_privacy[$c]) != "") { SE_Language::_preload(user_privacy_levels($level_profile_privacy[$c])); $privacy_options[$level_profile_privacy[$c]] = user_privacy_levels($level_profile_privacy[$c]); } } for ($c = 0; $c < count($level_profile_comments); $c++) { if (user_privacy_levels($level_profile_comments[$c]) != "") { SE_Language::_preload(user_privacy_levels($level_profile_comments[$c])); $comment_options[$level_profile_comments[$c]] = user_privacy_levels($level_profile_comments[$c]); }
function video_list($start, $limit, $sort_by = "video_id DESC", $where = "", $details = 0) { global $database, $user, $owner; // BEGIN QUERY $video_query = "SELECT se_videos.*"; // GET DETAILS if ($details) { $video_query .= ", count(se_videocomments.videocomment_id) AS total_comments"; } // IF NO USER ID SPECIFIED, RETRIEVE USER INFORMATION if ($this->user_id == 0) { $video_query .= ", se_users.user_id, se_users.user_username, se_users.user_photo, se_users.user_fname, se_users.user_lname"; } // CONTINUE QUERY $video_query .= " FROM se_videos"; // GET DETAILS if ($details) { $video_query .= " LEFT JOIN se_videocomments ON se_videos.video_id=se_videocomments.videocomment_video_id"; } // IF NO USER ID SPECIFIED, JOIN TO USER TABLE if ($this->user_id == 0) { $video_query .= " LEFT JOIN se_users ON se_videos.video_user_id=se_users.user_id"; } // ADD WHERE IF NECESSARY if ($where != "" || $this->user_id != 0) { $video_query .= " WHERE"; } // ENSURE USER ID IS NOT EMPTY if ($this->user_id != 0) { $video_query .= " video_user_id='{$this->user_id}'"; } // INSERT AND IF NECESSARY if ($this->user_id != 0 && $where != "") { $video_query .= " AND"; } // ADD WHERE CLAUSE, IF NECESSARY if ($where != "") { $video_query .= " {$where}"; } // ADD GROUP BY, ORDER, AND LIMIT CLAUSE $video_query .= " GROUP BY video_id ORDER BY {$sort_by} LIMIT {$start}, {$limit}"; // RUN QUERY $videos = $database->database_query($video_query); // GET VIDEOS INTO AN ARRAY $video_array = array(); while ($video_info = $database->database_fetch_assoc($videos)) { // IF NO USER ID SPECIFIED, CREATE OBJECT FOR AUTHOR if ($this->user_id == 0) { $author = new se_user(); $author->user_exists = 1; $author->user_info['user_id'] = $video_info['user_id']; $author->user_info['user_username'] = $video_info['user_username']; $author->user_info['user_fname'] = $video_info['user_fname']; $author->user_info['user_lname'] = $video_info['user_lname']; $author->user_info['user_photo'] = $video_info['user_photo']; $author->user_displayname(); } elseif ($owner->user_exists != 0 && $owner->user_info['user_id'] == $video_info['video_user_id']) { $author = $owner; } elseif ($user->user_exists != 0 && $user->user_info['user_id'] == $video_info['video_user_id']) { $author = $user; } // SET AUTHOR AND DIRECTORY $video_info['video_author'] = $author; $video_info['video_dir'] = $this->video_dir($video_info['video_user_id'], TRUE); // CHECK FOR THUMBNAIL $video_info['video_thumb'] = file_exists($video_info['video_dir'] . $video_info['video_id'] . "_thumb.jpg"); // SET UP DURATION $minutes = floor($video_info['video_duration_in_sec'] / 60); $seconds = $video_info['video_duration_in_sec'] - 60 * $minutes; $video_info['video_duration_in_min'] = sprintf("%02d:%02d", $minutes, $seconds); // SET UP RATING $video_info['video_rating_full'] = floor($video_info['video_cache_rating']); $video_info['video_rating_part'] = $video_info['video_cache_rating'] - $video_info['video_rating_full'] == 0 ? 0 : 1; $video_info['video_rating_none'] = 5 - $video_info['video_rating_full'] - $video_info['video_rating_part']; // CREATE ARRAY OF VIDEO DATA $video_array[] = $video_info; } // RETURN ARRAY return $video_array; }
function blog_subscription_notification($newblogentry_id, $newblogentry_title, $newblogentry_privacy = 1) { global $database, $user, $url, $notify; // Quick fix for self if (!$newblogentry_privacy || $newblogentry_privacy == 1) { return; } // Generate query $sql = "\r\n SELECT\r\n se_blogsubscriptions.*,\r\n subscriber.user_id,\r\n subscriber.user_username,\r\n subscriber.user_fname,\r\n subscriber.user_lname,\r\n subscriber.user_email,\r\n subscriber_settings.usersetting_notify_newblogsubscriptionentry\r\n FROM\r\n se_blogsubscriptions\r\n LEFT JOIN\r\n se_users AS subscriber\r\n ON subscriber.user_id=se_blogsubscriptions.blogsubscription_user_id\r\n LEFT JOIN\r\n se_usersettings AS subscriber_settings\r\n ON subscriber_settings.usersetting_user_id=subscriber.user_id\r\n WHERE\r\n se_blogsubscriptions.blogsubscription_owner_id='{$user->user_info['user_id']}' &&\r\n CASE\r\n /* DO NOT SEND AN EMAIL TO SELF, BESIDES THEY SHOULDNT BE SUBSCRIBED TO THEIR OWN BLOG... */\r\n WHEN subscriber.user_id='{$user->user_info['user_id']}'\r\n THEN FALSE\r\n /* IGNORE MISSING USERS */\r\n WHEN (({$newblogentry_privacy} & @SE_PRIVACY_ANONYMOUS) AND subscriber.user_id IS NULL)\r\n THEN FALSE\r\n /* NORMAL */\r\n WHEN (({$newblogentry_privacy} & @SE_PRIVACY_REGISTERED) AND subscriber.user_id IS NOT NULL)\r\n THEN TRUE\r\n WHEN (({$newblogentry_privacy} & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=subscriber.user_id AND friend_status='1' LIMIT 1))\r\n THEN TRUE\r\n WHEN (({$newblogentry_privacy} & @SE_PRIVACY_SUBNET) AND (SELECT TRUE FROM se_users WHERE user_id='{$user->user_info['user_id']}' AND user_subnet_id=subscriber.user_subnet_id LIMIT 1))\r\n THEN TRUE\r\n WHEN (({$newblogentry_privacy} & @SE_PRIVACY_FRIEND2) AND (\r\n SELECT TRUE FROM se_friends AS friends_primary\r\n LEFT JOIN se_users ON friends_primary.friend_user_id1=se_users.user_id\r\n LEFT JOIN se_friends AS friends_secondary ON friends_primary.friend_user_id2=friends_secondary.friend_user_id1\r\n WHERE friends_primary.friend_user_id1='{$user->user_info['user_id']}' AND friends_secondary.friend_user_id2=subscriber.user_id AND se_users.user_subnet_id=subscriber.user_subnet_id LIMIT 1)\r\n )\r\n THEN TRUE\r\n ELSE FALSE\r\n END\r\n "; $resource = $database->database_query($sql); // Get all recipients and send emails // TODO: large numbers of subscribers $blogentry_url = $url->url_create('blog_entry', $user->user_info['user_username'], $newblogentry_id); while ($result = $database->database_fetch_assoc($resource)) { // Create user object for displayname $recipient_object = new se_user(); $recipient_object->user_info['user_id'] = $result['user_id']; $recipient_object->user_info['user_username'] = $result['user_username']; $recipient_object->user_info['user_fname'] = $result['user_fname']; $recipient_object->user_info['user_lname'] = $result['user_lname']; $recipient_object->user_displayname(); // NOTIFICATION $notifytype = $notify->notify_add($recipient_object->user_info['user_id'], "newblogsubscriptionentry", $newblogentry_id, array($user->user_info['user_username'], $newblogentry_id), array($newblogentry_title)); // EMAIL NOTIFICATION if (!empty($result['user_email']) && $result['usersetting_notify_newblogsubscriptionentry']) { send_systememail('newblogsubscriptionentry', $result['user_email'], array($recipient_object->user_displayname, $user->user_displayname, "<a href=\"{$blogentry_url}\">{$blogentry_url}</a>")); } unset($recipient_object); } }
function search_album() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results; // CONSTRUCT QUERY $album_query = "\r\n\t(\r\n\tSELECT\r\n '1' AS sub_type,\r\n\t se_media.media_album_id AS album_id,\r\n\t se_media.media_title AS title,\r\n\t se_media.media_desc AS description,\r\n\t se_media.media_id AS media_id,\r\n\t se_media.media_ext AS media_ext,\r\n\t se_users.user_id,\r\n\t se_users.user_username,\r\n\t se_users.user_photo,\r\n\t se_users.user_fname,\r\n\t se_users.user_lname\r\n\tFROM\r\n\t se_media,\r\n\t se_albums,\r\n\t se_users,\r\n\t se_levels\r\n\tWHERE\r\n\t se_media.media_album_id=se_albums.album_id AND\r\n\t se_albums.album_user_id=se_users.user_id AND\r\n\t se_users.user_level_id=se_levels.level_id AND\r\n\t (\r\n\t se_albums.album_search='1' OR\r\n\t se_levels.level_album_search='0'\r\n\t )\r\n\t AND\r\n\t (\r\n\t se_media.media_title LIKE '%{$search_text}%' OR\r\n\t se_media.media_desc LIKE '%{$search_text}%'\r\n\t )\r\n\tORDER BY media_id DESC\r\n\t)\r\n\tUNION ALL\r\n\t(\r\n\tSELECT\r\n\t '2' AS sub_type,\r\n\t se_albums.album_id AS album_id,\r\n\t se_albums.album_title AS title,\r\n\t se_albums.album_desc AS description,\r\n\t se_albums.album_cover AS media_id,\r\n\t se_media.media_ext AS media_ext,\r\n\t se_users.user_id,\r\n\t se_users.user_username,\r\n\t se_users.user_photo,\r\n\t se_users.user_fname,\r\n\t se_users.user_lname\r\n\tFROM\r\n\t se_albums,\r\n\t se_users,\r\n\t se_levels,\r\n\t se_media\r\n\tWHERE\r\n\t se_albums.album_user_id=se_users.user_id AND\r\n\t se_users.user_level_id=se_levels.level_id AND\r\n\t se_albums.album_cover=se_media.media_id AND \r\n\t (\r\n\t se_albums.album_search='1' OR\r\n\t se_levels.level_album_search='0'\r\n\t )\r\n\t AND\r\n\t (\r\n\t se_albums.album_title LIKE '%{$search_text}%' OR\r\n\t se_albums.album_desc LIKE '%{$search_text}%'\r\n\t )\r\n\tORDER BY album_id DESC\r\n\t)"; // GET TOTAL RESULTS $total_albums = $database->database_num_rows($database->database_query($album_query . " LIMIT 201")); // IF NOT TOTAL ONLY if ($t == "album") { // MAKE ALBUM PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // SEARCH ALBUMS $albums = $database->database_query($album_query . " ORDER BY album_id DESC LIMIT {$start}, {$limit}"); while ($album_info = $database->database_fetch_assoc($albums)) { // CREATE AN OBJECT FOR USER $profile = new se_user(); $profile->user_info['user_id'] = $album_info['user_id']; $profile->user_info['user_username'] = $album_info['user_username']; $profile->user_info['user_fname'] = $album_info['user_fname']; $profile->user_info['user_lname'] = $album_info['user_lname']; $profile->user_info['user_photo'] = $album_info['user_photo']; $profile->user_displayname(); // RESULT IS A MEDIA if ($album_info[sub_type] == 1) { $result_url = $url->url_create('album_file', $album_info['user_username'], $album_info['album_id'], $album_info['media_id']); $result_name = 1000119; $result_desc = 1000121; // RESULT IS AN ALBUM } else { $result_url = $url->url_create('album', $album_info['user_username'], $album_info['album_id']); $result_name = 1000120; $result_desc = 1000122; } // SET THUMBNAIL, IF AVAILABLE switch ($album_info['media_ext']) { case "jpeg": case "jpg": case "gif": case "png": case "bmp": $thumb_path = $url->url_userdir($album_info['user_id']) . $album_info['media_id'] . "_thumb.jpg"; break; case "mp3": case "mp4": case "wav": $thumb_path = "./images/icons/audio_big.gif"; break; case "mpeg": case "mpg": case "mpa": case "avi": case "swf": case "mov": case "ram": case "rm": $thumb_path = "./images/icons/video_big.gif"; break; default: $thumb_path = "./images/icons/file_big.gif"; } if (!file_exists($thumb_path)) { $thumb_path = "./images/icons/file_big.gif"; } // IF NO TITLE if ($album_info['title'] == "") { SE_Language::_preload(589); SE_Language::load(); $album_info['title'] = SE_Language::_get(589); } // IF DESCRIPTION IS LONG if (strlen($album_info['description']) > 150) { $album_info['description'] = substr($album_info['description'], 0, 147) . "..."; } $results[] = array('result_url' => $result_url, 'result_icon' => $thumb_path, 'result_name' => $result_name, 'result_name_1' => $album_info['title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $album_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $album_info['description']); } // SET TOTAL RESULTS $total_results = $total_albums; } // SET ARRAY VALUES SE_Language::_preload_multi(1000118, 1000119, 1000120, 1000121, 1000122); if ($total_albums > 200) { $total_albums = "200+"; } $search_objects[] = array('search_type' => 'album', 'search_lang' => 1000118, 'search_total' => $total_albums); }
function get_users($user_ids) { if (!$user_ids) { return array(); } $user_ids_str = implode(',', $user_ids); $sql = "SELECT `user_id`, `user_username`, `user_fname`, `user_lname`, `user_photo` FROM `se_users`\r\n \tWHERE `user_id` IN ({$user_ids_str})"; $user_list = array(); $res = he_database::query($sql); while ($row = he_database::fetch_row_from_resource($res)) { $author = new se_user(); $author->user_exists = 1; $author->user_info['user_id'] = $row['user_id']; $author->user_info['user_username'] = $row['user_username']; $author->user_info['user_fname'] = $row['user_fname']; $author->user_info['user_lname'] = $row['user_lname']; $author->user_info['user_photo'] = $row['user_photo']; $author->user_displayname(); $user_list[$row['user_id']] = $author; } return $user_list; }
$signup_user->user_info['user_id'] = $signup['user_id']; $signup_user->user_info['user_username'] = $signup['user_username']; $signup_user->user_info['user_photo'] = $signup['user_photo']; $signup_user->user_info['user_fname'] = $signup['user_fname']; $signup_user->user_info['user_lname'] = $signup['user_lname']; $signup_user->user_displayname(); $signup_array[] = $signup_user; } // GET RECENT STATUS UPDATES $statuses = $database->database_query("SELECT user_id, user_username, user_fname, user_lname, user_status FROM se_users WHERE user_subnet_id='{$n}' AND user_id<>'{$user->user_info['user_id']}' AND user_status<>'' ORDER BY user_status_date DESC LIMIT 10"); while ($status = $database->database_fetch_assoc($statuses)) { $status_user = new se_user(); $status_user->user_info['user_id'] = $status['user_id']; $status_user->user_info['user_username'] = $status['user_username']; $status_user->user_info['user_fname'] = $status['user_fname']; $status_user->user_info['user_lname'] = $status['user_lname']; $status_user->user_displayname(); $statuses_array[] = array('status_user_id' => $status['user_id'], 'status_user_username' => $status['user_username'], 'status_user_displayname' => $status_user->user_displayname, 'status_user_status' => $status['user_status']); } // SET GLOBAL PAGE TITLE $global_page_title[0] = 1155; SE_Language::_preload($network_info['subnet_name']); SE_Language::load(); $global_page_title[1] = SE_Language::_get($network_info['subnet_name']); $global_page_description = $global_page_title; // ASSIGN SMARTY VARIABLES AND INCLUDE FOOTER $smarty->assign('network', $network_info); $smarty->assign('signups', $signup_array); $smarty->assign('statuses', $statuses_array); $smarty->assign('actions', $actions->actions_display(2, $setting['setting_actions_actionsperuser'], "se_users.user_subnet_id='{$network_info['subnet_id']}'")); include "footer.php";
// GET USER INPUT AND LIMIT $input = strtolower($_GET['input']); $len = strlen_utf8($input); $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 20; // RETRIEVE FITTING FRIENDS $results = array(); $sql = "SELECT user_id, user_username, user_fname, user_lname, user_photo FROM se_users WHERE user_id<>'{$user->user_info['user_id']}' AND (SUBSTRING(user_username, 1, {$len})='{$input}' OR SUBSTRING(user_fname, 1, {$len})='{$input}' OR SUBSTRING(user_lname, 1, {$len})='{$input}') LIMIT {$limit}"; $resource = $database->database_query($sql); while ($user_info = $database->database_fetch_assoc($resource)) { $sugg_user = new se_user(); $sugg_user->user_info['user_id'] = $user_info['user_id']; $sugg_user->user_info['user_username'] = $user_info['user_username']; $sugg_user->user_info['user_fname'] = $user_info['user_fname']; $sugg_user->user_info['user_lname'] = $user_info['user_lname']; $sugg_user->user_info['user_photo'] = $user_info['user_photo']; $sugg_user->user_displayname(); if (!$setting['setting_username']) { $user_info['user_username'] = $sugg_user->user_displayname; } $results[] = array("id" => $user_info['user_id'], "value" => $user_info['user_username'], "info" => $sugg_user->user_displayname, "photo" => $sugg_user->user_photo("./images/nophoto.gif"), "photo_width" => $misc->photo_size($sugg_user->user_photo("./images/nophoto.gif"), '50', '50', 'w')); } // OUTPUT JSON header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 header("Content-Type: application/json");
function event_join() { global $user, $database, $url, $actions, $notify; // JOIN if (!$this->is_member && !$this->is_member_waiting) { $new_member_approved = $this->event_info['event_inviteonly'] ? '0' : '1'; // INSERT $sql = "INSERT INTO se_eventmembers (eventmember_user_id, eventmember_event_id, eventmember_status, eventmember_approved, eventmember_rank) VALUES ('{$this->user_id}', '{$this->event_info['event_id']}', '1', '{$new_member_approved}', '1')"; $database->database_query($sql); // UPDATE MEMBER INFO $this->is_member = (bool) $new_member_approved; $this->is_member_waiting = !$new_member_approved; $this->eventmember_info['eventmember_approved'] = (int) $new_member_approved; // NOTIFY EVENT OWNER IF REQUESTING APPROVAL if (!$new_member_approved) { $sql = "SELECT se_users.user_id, se_users.user_username, se_users.user_email, se_users.user_fname, se_users.user_lname, se_usersettings.usersetting_notify_eventmemberrequest FROM se_users LEFT JOIN se_usersettings ON se_users.user_id=se_usersettings.usersetting_user_id WHERE se_users.user_id='{$this->event_info['event_user_id']}'"; $resource = $database->database_query($sql); if (!$database->database_num_rows($resource)) { return FALSE; } $eventowner_info = $database->database_fetch_assoc($resource); // Create user object for displayname $recipient_object = new se_user(); $recipient_object->user_info['user_id'] = $eventowner_info['user_id']; $recipient_object->user_info['user_username'] = $eventowner_info['user_username']; $recipient_object->user_info['user_fname'] = $eventowner_info['user_fname']; $recipient_object->user_info['user_lname'] = $eventowner_info['user_lname']; $recipient_object->user_displayname(); // NOTIFICATION $notifytype = $notify->notify_add($recipient_object->user_info['user_id'], "eventmemberrequest", $this->event_info['event_id'], array($user->user_info['user_username'], $this->event_info['event_id']), array($this->event_info['event_title'])); if ($eventowner_info['usersetting_notify_eventmemberrequest']) { send_systememail('eventmemberrequest', $eventowner_info['user_email'], array($recipient_object->user_displayname, $user->user_displayname, $this->event_info['event_title'], "<a href=\"{$url->url_base}login.php\">{$url->url_base}login.php</a>")); } } else { $sql = "UPDATE se_events SET event_totalmembers=event_totalmembers+1 WHERE event_id='{$this->event_info['event_id']}' LIMIT 1"; $database->database_query($sql); } } elseif ($this->is_member_waiting && $this->eventmember_info['eventmember_approved']) { $sql = "UPDATE se_eventmembers SET eventmember_status=1 WHERE eventmember_event_id='{$this->event_info['event_id']}' && eventmember_user_id='{$this->user_id}' LIMIT 1"; $database->database_query($sql); // INCREMENT MEMBER COUNT $sql = "UPDATE se_events SET event_totalmembers=event_totalmembers+1 WHERE event_id='{$this->event_info['event_id']}' LIMIT 1"; $database->database_query($sql); // UPDATE MEMBER INFO $this->is_member = TRUE; $this->is_member_waiting = FALSE; $this->eventmember_info['eventmember_status'] = 1; } else { $this->is_error = 3000248; return FALSE; } // DELETE NOTIFICATION $sql = "DELETE FROM se_notifys USING se_notifys LEFT JOIN se_notifytypes ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id WHERE se_notifys.notify_user_id='{$this->user_id}' AND se_notifytypes.notifytype_name='eventinvite' AND notify_object_id='{$this->event_info['event_id']}'"; $database->database_query($sql); // INSERT ACTION IF NOT REQUESTING APPROVAL if ($new_member_approved || !empty($this->eventmember_info['eventmember_approved'])) { $event_title = $this->event_info['event_title']; if (strlen($event_title) > 100) { $event_title = substr($event_title, 0, 97) . "..."; } $actions->actions_add($user, "joinevent", array($user->user_info['user_username'], $user->user_displayname, $this->event_info['event_id'], $event_title), NULL, 60, FALSE, "event", $this->event_info['event_id'], $this->event_info['event_privacy']); } return TRUE; }
$total_users = $database->database_num_rows($database->database_query($search_query)); // MAKE SEARCH PAGES $page_vars = make_page($total_users, $users_per_page, $p); // ADD LIMIT TO QUERY $search_query .= " ORDER BY {$sort} LIMIT {$page_vars['0']}, {$users_per_page}"; // GET USERS $online_users_array = online_users(); $users = $database->database_query($search_query); while ($user_info = $database->database_fetch_assoc($users)) { $search_user = new se_user(); $search_user->user_info['user_id'] = $user_info['user_id']; $search_user->user_info['user_username'] = $user_info['user_username']; $search_user->user_info['user_fname'] = $user_info['user_fname']; $search_user->user_info['user_lname'] = $user_info['user_lname']; $search_user->user_info['user_photo'] = $user_info['user_photo']; $search_user->user_displayname(); // DETERMINE IF USER IS ONLINE if (in_array($search_user->user_info['user_username'], $online_users_array[2])) { $search_user->is_online = 1; } else { $search_user->is_online = 0; } $user_array[] = $search_user; } // SET GLOBAL PAGE TITLE $global_page_title[0] = 926; $global_page_description[0] = 1088; } // ASSIGN VARIABLES AND INCLUDE FOOTER $smarty->assign('users', $user_array); $smarty->assign('total_users', $total_users);
function search_music() { global $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results, $user; // CONSTRUCT QUERY $sql = "\r\n SELECT\r\n se_music.*,\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n FROM\r\n se_music\r\n LEFT JOIN\r\n se_users\r\n ON se_users.user_id=se_music.music_user_id\r\n WHERE\r\n se_music.music_title LIKE '%{$search_text}%'\r\n "; // GET TOTAL RESULTS $total_music = $database->database_num_rows($database->database_query($sql . " LIMIT 201")); // IF NOT TOTAL ONLY if ($t == "music") { // MAKE MUSIC PAGES $start = ($p - 1) * $results_per_page; $limit = $results_per_page + 1; // Lang for download song SE_Language::_preload(4000095); SE_Language::load(); // SEARCH MUSIC $sql .= " ORDER BY se_music.music_id DESC LIMIT {$start}, {$limit}"; $resource = $database->database_query($sql) or die($database->database_error()); while ($music_info = $database->database_fetch_assoc($resource)) { // CREATE AN OBJECT FOR USER $profile = new se_user(); $profile->user_info['user_id'] = $music_info['user_id']; $profile->user_info['user_username'] = $music_info['user_username']; $profile->user_info['user_fname'] = $music_info['user_fname']; $profile->user_info['user_lname'] = $music_info['user_lname']; $profile->user_info['user_photo'] = $music_info['user_photo']; $profile->user_displayname(); $result_url = $url->url_create('profile', $music_info['user_username']); $result_name = 4000105; $result_desc = 4000106; $userdir = $url->url_userdir($music_info['user_id']); $music_path = "{$userdir}{$music_info['music_id']}.{$music_info['music_ext']}"; // IF NO TITLE if (!trim($music_info['music_title'])) { SE_Language::_preload(589); SE_Language::load(); $music_info['music_title'] = SE_Language::_get(589); } $dl_lv = SE_Language::_get(4000095); $desc3 = <<<EOF <br /> <table><tr><td> <object width="17" height="17" data="images/music_button.swf?song_url={$music_path}" type="application/x-shockwave-flash"> <param value="images/music_button.swf?song_url={$music_path}" name="movie" /> <img width="17" height="17" alt="" src="noflash.gif" /> </object> </td> EOF; if ($user->user_exists && $user->level_info['level_music_allow_downloads']) { $desc3 .= <<<EOF <td style="padding-left:10px;vertical-align:middle;"> <a type="application/force-download" href="{$music_path}">{$dl_lv}</a> </td> EOF; } $desc3 .= "</tr></table>"; $results[] = array('result_url' => $result_url, 'result_icon' => './images/icons/music_music48.gif', 'result_name' => $result_name, 'result_name_1' => $music_info['music_title'], 'result_desc' => $result_desc, 'result_desc_1' => $url->url_create('profile', $profile->user_info['user_username']), 'result_desc_2' => $profile->user_displayname, 'result_desc_3' => $desc3); } // SET TOTAL RESULTS $total_results = $total_music; } // SET ARRAY VALUES SE_Language::_preload_multi(4000104, 4000105, 4000106); if ($total_music > 200) { $total_music = "200+"; } $search_objects[] = array('search_type' => 'music', 'search_lang' => 4000104, 'search_total' => $total_music); }
function forum_topic_list($forum_id, $start, $limit) { global $database, $user; // GET TOPICS $sql = "SELECT se_forumlogs.forumlog_date, se_forumtopics.* FROM se_forumtopics LEFT JOIN se_forumlogs ON (se_forumtopics.forumtopic_id=se_forumlogs.forumlog_forumtopic_id AND se_forumlogs.forumlog_user_id='{$user->user_info[user_id]}') WHERE forumtopic_forum_id='{$forum_id}' ORDER BY forumtopic_sticky DESC, forumtopic_date DESC LIMIT {$start}, {$limit}"; $forumtopics = $database->database_query($sql); $forumtopic_array = array(); while ($forumtopic_info = $database->database_fetch_assoc($forumtopics)) { // GET LAST POST $lastpost = $database->database_query("SELECT se_forumposts.forumpost_id, se_forumposts.forumpost_date, se_forumposts.forumpost_excerpt, se_forumposts.forumpost_authoruser_id, se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname, se_users.user_photo FROM se_forumposts LEFT JOIN se_users ON se_forumposts.forumpost_authoruser_id=se_users.user_id WHERE se_forumposts.forumpost_forumtopic_id='{$forumtopic_info[forumtopic_id]}' AND se_forumposts.forumpost_deleted='0' ORDER BY se_forumposts.forumpost_id DESC LIMIT 1"); if ($database->database_num_rows($lastpost) == 1) { $lastpost_info = $database->database_fetch_assoc($lastpost); $forumtopic_info[lastpost] = true; // GET POST AUTHOR $author = new se_user(); if ($lastpost_info['forumpost_authoruser_id'] != $lastpost_info['user_id']) { $author->user_exists = false; } else { $author->user_exists = true; $author->user_info['user_id'] = $lastpost_info['user_id']; $author->user_info['user_username'] = $lastpost_info['user_username']; $author->user_info['user_fname'] = $lastpost_info['user_fname']; $author->user_info['user_lname'] = $lastpost_info['user_lname']; $author->user_info['user_photo'] = $lastpost_info['user_photo']; $author->user_displayname(); } $lastpost_info[author] = $author; $forumtopic_info[lastpost_info] = $lastpost_info; } else { $forumtopic_info[lastpost] = false; } if ($forumtopic_info[forumlog_date] == NULL || $forumtopic_info[forumlog_date] < $forumtopic_info[forumtopic_date]) { $forumtopic_info[is_new] = true; } else { $forumtopic_info[is_new] = false; } $forumtopic_array[] = $forumtopic_info; } return $forumtopic_array; }
$user_info['user_code'] = ""; $user_info['user_email'] = ""; $user_info['user_newemail'] = ""; $user_info['user_verified'] = ""; } else { $user_info = $database->database_fetch_assoc($user_query); $thisuser = new se_user(); $thisuser->user_exists = 1; $thisuser->user_info['user_id'] = $user_info['user_id']; $thisuser->user_info['user_username'] = $user_info['user_username']; $thisuser->user_info['user_fname'] = $user_info['user_fname']; $thisuser->user_info['user_lname'] = $user_info['user_lname']; $thisuser->user_info['user_email'] = $user_info['user_email']; $thisuser->user_info['user_newemail'] = $user_info['user_newemail']; $thisuser->user_info['user_code'] = $user_info['user_code']; $thisuser->user_displayname(); } // VERIFY USER IS NOT ALREADY VERIFIED if ($user_info['user_verified'] == 1 && $user_info['user_email'] == $user_info['user_newemail']) { $is_error = 1044; } // NO ERROR, RESEND EMAIL if ($is_error == 0) { $verify_code = md5($thisuser->user_info['user_code']); $time = time(); $verify_link = $url->url_base . "signup_verify.php?u={$thisuser->user_info['user_id']}&verify={$verify_code}&d={$time}"; send_systememail('verification', $thisuser->user_info['user_newemail'], array($thisuser->user_displayname, $thisuser->user_info['user_newemail'], "<a href=\"{$verify_link}\">{$verify_link}</a>")); $result = 1042; } } elseif ($resend != 1) { // VALIDATE USER ID
} else { echo json_encode(array('result' => FALSE, 'error' => SE_Language::get($event->is_error))); } exit; } elseif ($task == "getfriends") { $results = array(); //$sql = "SELECT user_id, user_username, user_fname, user_lname FROM se_friends LEFT JOIN se_users ON se_friends.friend_user_id2=se_users.user_id LEFT JOIN se_levels ON se_users.user_level_id=se_levels.level_id LEFT JOIN se_eventmembers ON se_users.user_id=se_eventmembers.eventmember_user_id AND se_eventmembers.eventmember_event_id={$event->event_info[event_id]} WHERE se_friends.friend_status=1 AND se_friends.friend_user_id1='{$user->user_info['user_id']}' AND se_eventmembers.eventmember_id IS NULL ORDER BY user_fname, user_lname, user_username"; $sql = "SELECT user_id, user_username, user_fname, user_lname FROM se_friends LEFT JOIN se_users ON se_friends.friend_user_id2=se_users.user_id LEFT JOIN se_levels ON se_users.user_level_id=se_levels.level_id LEFT JOIN se_eventmembers ON se_users.user_id=se_eventmembers.eventmember_user_id AND se_eventmembers.eventmember_event_id={$event->event_info[event_id]} WHERE (se_levels.level_event_allow & 2) AND se_friends.friend_status=1 AND se_friends.friend_user_id1='{$user->user_info['user_id']}' AND se_eventmembers.eventmember_id IS NULL ORDER BY user_fname, user_lname, user_username"; $resource = $database->database_query($sql); while ($friend_info = $database->database_fetch_assoc($resource)) { $friend = new se_user(); $friend->user_info['user_id'] = $friend_info['user_id']; $friend->user_info['user_username'] = $friend_info['user_username']; $friend->user_info['user_fname'] = $friend_info['user_fname']; $friend->user_info['user_lname'] = $friend_info['user_lname']; $friend->user_displayname(); $results[$friend_info['user_id']] = $friend->user_displayname; } // OUTPUT JSON header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 header("Content-Type: application/json"); echo json_encode(array('result' => TRUE, 'friends' => &$results)); exit; } elseif ($task == "getfiles") {
function album_media_list($start, $limit, $sort_by = "media_id DESC", $where = "", $select = "") { global $database, $user, $owner; // BEGIN QUERY $sql = "\r\n SELECT\r\n se_media.*,\r\n se_albums.album_id,\r\n se_albums.album_user_id,\r\n se_albums.album_title,\r\n se_media.media_totalcomments AS total_comments\r\n "; // IF NO USER ID SPECIFIED, RETRIEVE USER INFORMATION if (!$this->user_id) { $sql .= ",\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n "; } // ADD ADDITIONAL SELECTS if (!empty($select)) { $sql .= $select; } // CONTINUE QUERY $sql .= "\r\n FROM\r\n se_media\r\n LEFT JOIN\r\n se_albums\r\n ON se_albums.album_id=se_media.media_album_id\r\n "; // IF NO USER ID SPECIFIED, JOIN TO USER TABLE if (!$this->user_id) { $sql .= "\r\n LEFT JOIN\r\n se_users\r\n ON se_albums.album_user_id=se_users.user_id\r\n "; } // ADD WHERE IF NECESSARY if (!empty($where) || $this->user_id) { $sql .= "\r\n WHERE\r\n "; } // ENSURE USER ID IS NOT EMPTY if ($this->user_id) { $sql .= "\r\n album_user_id='{$this->user_id}'\r\n "; } // INSERT AND IF NECESSARY if ($this->user_id && !empty($where)) { $sql .= " AND"; } // ADD WHERE CLAUSE, IF NECESSARY if (!empty($where)) { $sql .= "\r\n {$where}\r\n "; } // ADD GROUP BY, ORDER, AND LIMIT CLAUSE $sql .= "\r\n ORDER BY\r\n {$sort_by}\r\n LIMIT\r\n {$start}, {$limit}\r\n "; // RUN QUERY $resource = $database->database_query($sql); // GET MEDIA INTO AN ARRAY $media_array = array(); while ($media_info = $database->database_fetch_assoc($resource)) { // IF NO USER ID SPECIFIED, CREATE OBJECT FOR AUTHOR if (!$this->user_id) { $author = new se_user(); $author->user_exists = TRUE; $author->user_info['user_id'] = $media_info['user_id']; $author->user_info['user_username'] = $media_info['user_username']; $author->user_info['user_photo'] = $media_info['user_photo']; $author->user_info['user_fname'] = $media_info['user_fname']; $author->user_info['user_lname'] = $media_info['user_lname']; $author->user_displayname(); } elseif ($owner->user_exists && $owner->user_info['user_id'] == $media_info['album_user_id']) { $author =& $owner; } elseif ($user->user_exists && $user->user_info['user_id'] == $media_info['album_user_id']) { $author =& $user; } $media_info['media_author'] =& $author; // BACKWARDS COMPAT $media_info['media_comments_total'] = $media_info['total_comments']; $media_info['media_desc'] = str_replace("<br>", "\r\n", $media_info['media_desc']); // CREATE ARRAY OF MEDIA DATA $media_array[] = $media_info; unset($media_info, $author); } // RETURN ARRAY return $media_array; }
$profile_viewers = array(); $view_query = $database->database_query("SELECT profileview_views, profileview_viewers FROM se_profileviews WHERE profileview_user_id='{$user->user_info['user_id']}'"); if ($database->database_num_rows($view_query) == 1) { $views = $database->database_fetch_assoc($view_query); $profile_views = $views['profileview_views']; if ($views['profileview_viewers'] == "") { $views['profileview_viewers'] = "''"; } $viewer_query = $database->database_query("SELECT user_id, user_username, user_fname, user_lname FROM se_users WHERE user_id IN ({$views['profileview_viewers']})"); while ($viewer_info = $database->database_fetch_assoc($viewer_query)) { $viewer = new se_user(); $viewer->user_info['user_id'] = $viewer_info['user_id']; $viewer->user_info['user_username'] = $viewer_info['user_username']; $viewer->user_info['user_fname'] = $viewer_info['user_fname']; $viewer->user_info['user_lname'] = $viewer_info['user_lname']; $viewer->user_displayname(); // SET PROFILE VIEWERS $profile_viewers[] = $viewer; } $profile_viewers_array = explode(",", $views['profileview_viewers']); usort($profile_viewers, create_function('$a,$b', 'global $profile_viewers_array; if(array_search($a->user_info["user_id"], $profile_viewers_array) == array_search($b->user_info["user_id"], $profile_viewers_array)) { return 0; } else { return (array_search($a->user_info["user_id"], $profile_viewers_array) < array_search($b->user_info["user_id"], $profile_viewers_array)) ? -1 : 1; }')); } // CREATE ARRAY OF ACTION TYPES $actiontypes_array = $actions->actions_allowed(); $smarty->assign_by_ref('actiontypes', $actiontypes_array); // GET UPCOMING BIRTHDAYS, START BY CHECKING FOR BIRTHDAY PROFILE FIELDS $birthday_array = friends_birthdays(); $smarty->assign_by_ref('birthdays', $birthday_array); // Get online users $online_array = online_users(); $smarty->assign_by_ref('online_users', $online_array);
// IF LOGGED IN, SET COOKIE TO SIGNAL FORUM IS "READ" if ($user->user_exists) { setcookie("forum_{$user->user_info[user_id]}_{$forum_info[forum_id]}", time(), time() + 99999999, "/"); } // GET TOTAL TOPICS $total_topics = $forum_info[forum_totaltopics]; // MAKE TOPIC PAGES $topics_per_page = 25; $page_vars = make_page($total_topics, $topics_per_page, $p); // SET TOPIC ARRAY $topic_array = $forum->forum_topic_list($forum_info[forum_id], $page_vars[0], $topics_per_page); // GET MODERATORS $mod_array = array(); $mods = $database->database_query("SELECT se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname FROM se_forummoderators LEFT JOIN se_users ON se_forummoderators.forummoderator_user_id=se_users.user_id WHERE se_forummoderators.forummoderator_forum_id='{$forum_info['forum_id']}' AND se_users.user_id IS NOT NULL"); while ($user_info = $database->database_fetch_assoc($mods)) { $mod_user = new se_user(); $mod_user->user_info[user_id] = $user_info[user_id]; $mod_user->user_info[user_username] = $user_info[user_username]; $mod_user->user_info[user_fname] = $user_info[user_fname]; $mod_user->user_info[user_lname] = $user_info[user_lname]; $mod_user->user_displayname(); $mod_array[] = $mod_user; } // ASSIGN SMARTY VARS AND INCLUDE FOOTER $smarty->assign('forum_info', $forum_info); $smarty->assign('topics', $topic_array); $smarty->assign('moderators', $mod_array); $smarty->assign('forum_permission', $forum_permission); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); include "footer.php";
function poll_list($start, $limit, $sort_by = "poll_id DESC", $where = "", $poll_details = 0) { global $database, $user; // BEGIN QUERY $sql = "\r\n SELECT\r\n se_polls.*,\r\n se_polls.poll_totalcomments AS total_comments\r\n "; // SELECT RELEVANT poll DETAILS IF NECESSARY if ($poll_details == 1) { $sql .= ",\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n "; } // CONTINUE QUERY $sql .= "\r\n FROM\r\n se_polls\r\n "; // CONTINUE QUERY IF NECESSARY if ($poll_details == 1) { $sql .= "\r\n LEFT JOIN\r\n se_users\r\n ON se_polls.poll_user_id=se_users.user_id\r\n "; } // ADD WHERE IF NECESSARY if ($where != "" | $this->user_id != 0) { $sql .= "\r\n WHERE\r\n "; } // ENSURE USER ID IS NOT EMPTY if ($this->user_id != 0) { $sql .= "\r\n poll_user_id='{$this->user_id}'\r\n "; } // INSERT AND IF NECESSARY if ($this->user_id != 0 & $where != "") { $sql .= " AND"; } // ADD WHERE CLAUSE, IF NECESSARY if ($where != "") { $sql .= "\r\n {$where}\r\n "; } // ADD ORDER, AND LIMIT CLAUSE $sql .= "\r\n ORDER BY\r\n {$sort_by}\r\n LIMIT\r\n {$start}, {$limit}\r\n "; // RUN QUERY $resource = $database->database_query($sql) or die($database->database_error() . " SQL: " . $sql); // GET pollS INTO AN ARRAY $poll_array = array(); while ($poll_info = $database->database_fetch_assoc($resource)) { // CREATE OBJECT FOR poll $poll = new se_poll($poll_info['user_id']); $poll->poll_exists = TRUE; // CREATE OBJECT FOR poll CREATOR IF poll DETAILS if ($poll_details) { $creator = new se_user(); $creator->user_exists = TRUE; $creator->user_info['user_id'] = $poll_info['user_id']; $creator->user_info['user_username'] = $poll_info['user_username']; $creator->user_info['user_photo'] = $poll_info['user_photo']; $creator->user_info['user_fname'] = $poll_info['user_fname']; $creator->user_info['user_lname'] = $poll_info['user_lname']; $creator->user_displayname(); $poll->poll_owner =& $creator; unset($creator); } // TURN OPTIONS AND ANSWERS INTO ARRAYS, GET TOTAL VOTES $poll_info['poll_options'] = unserialize($poll_info['poll_options']); $poll_info['poll_answers'] = unserialize($poll_info['poll_answers']); $poll_info['poll_voted'] = unserialize($poll_info['poll_voted']); // GET IF THIS POLL HAS BEEN VOTED ON if (!$user->user_exists || in_array($user->user_info['user_id'], $poll_info['poll_voted'])) { $poll_info['poll_viewonly'] = TRUE; } else { $poll_info['poll_viewonly'] = FALSE; } // PRIVACY $poll_info['poll_privacy_lang'] = user_privacy_levels($poll_info['poll_privacy']); SE_Language::_preload($poll_info['poll_privacy_lang']); $poll->poll_info = $poll_info; $poll_array[] = $poll; } // RETURN ARRAY return $poll_array; }
// MAKE MEDIA PAGES $page_vars = make_page($total_files, $media_per_page, $p); // RUN TAG QUERY $media = $database->database_query($photo_query); // GET MEDIA INTO AN ARRAY $file_array = array(); while ($media_info = $database->database_fetch_assoc($media)) { // CREATE OBJECT FOR AUTHOR, IF EXISTS if ($media_info['user_id'] != '0') { $author = new se_user(); $author->user_exists = 1; $author->user_info['user_id'] = $media_info['user_id']; $author->user_info['user_username'] = $media_info['user_username']; $author->user_info['user_fname'] = $media_info['user_fname']; $author->user_info['user_lname'] = $media_info['user_lname']; $author->user_displayname(); } else { $author = new se_user(); $author->user_exists = 0; } $media_info['author'] = $author; $file_array[] = $media_info; } // SET GLOBAL PAGE TITLE $global_page_title[0] = 1204; $global_page_title[1] = $owner->user_displayname; $global_page_title[2] = $total_files; $global_page_description[0] = 1204; $global_page_description[1] = $owner->user_displayname; $global_page_description[2] = $total_files; // ASSIGN VARIABLES AND DISPLAY PHOTOS PAGE
// UPDATE NOTIFICATIONS if ($user->user_info['user_id'] == $group->group_info['group_user_id']) { $database->database_query("DELETE FROM se_notifys USING se_notifys LEFT JOIN se_notifytypes ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id WHERE se_notifys.notify_user_id='{$user->user_info['user_id']}' AND (se_notifytypes.notifytype_name='groupmediacomment' OR se_notifytypes.notifytype_name='groupmediatag' OR se_notifytypes.notifytype_name='newgrouptag') AND notify_object_id='{$media_info['groupmedia_id']}'"); } // RETRIEVE TAGS FOR THIS PHOTO $tag_array = array(); $tags = $database->database_query("SELECT se_groupmediatags.*, se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname FROM se_groupmediatags LEFT JOIN se_users ON se_groupmediatags.groupmediatag_user_id=se_users.user_id WHERE groupmediatag_groupmedia_id='{$media_info['groupmedia_id']}' ORDER BY groupmediatag_id ASC"); while ($tag = $database->database_fetch_assoc($tags)) { $taggeduser = new se_user(); if ($tag['user_id']) { $taggeduser->user_exists = TRUE; $taggeduser->user_info['user_id'] = $tag['user_id']; $taggeduser->user_info['user_username'] = $tag['user_username']; $taggeduser->user_info['user_fname'] = $tag['user_fname']; $taggeduser->user_info['user_lname'] = $tag['user_lname']; $taggeduser->user_displayname(); } else { $taggeduser->user_exists = FALSE; } $tag['tagged_user'] = $taggeduser; $tag_array[] = $tag; } // SET GROUP OWNER (OR EDITOR) if ($group->user_rank == 2 || $group->user_rank == 1) { $groupowner = $user; } else { $groupowner = new se_user(array($group->group_info['group_user_id'])); } // SET GLOBAL PAGE TITLE $global_page_title[0] = 2000326; $global_page_title[1] = $group->group_info['group_title'];
// NOTIFY GROUP OWNER $group_title_short = $group->group_info['group_title']; if (strlen($group_title_short) > 100) { $group_title_short = substr($group_title_short, 0, 97); $group_title_short .= "..."; } $sql = "SELECT se_users.user_id, se_users.user_username, se_users.user_email, se_users.user_fname, se_users.user_lname, se_usersettings.usersetting_notify_groupmemberrequest FROM se_users LEFT JOIN se_usersettings ON se_users.user_id=se_usersettings.usersetting_user_id WHERE se_users.user_id='{$group->group_info['group_user_id']}'"; $groupowner_info = $database->database_fetch_assoc($database->database_query($sql)); if ($groupowner_info['usersetting_notify_groupmemberrequest'] == 1) { $group_owner = new se_user(); $group_owner->user_info['user_id'] = $groupowner_info['user_id']; $group_owner->user_info['user_username'] = $groupowner_info['user_username']; $group_owner->user_info['user_email'] = $groupowner_info['user_email']; $group_owner->user_info['user_fname'] = $groupowner_info['user_fname']; $group_owner->user_info['user_lname'] = $groupowner_info['user_lname']; $group_owner->user_displayname(); send_systememail('groupmemberrequest', $groupowner_info['user_email'], array($group_owner->user_displayname, $user->user_displayname, $group->group_info['group_title'], "<a href=\"" . $url->url_base . "login.php\">" . $url->url_base . "login.php</a>")); } $notify->notify_add($groupowner_info['user_id'], 'groupmemberrequest', $user->user_info['user_id'], array('', $group->group_info['group_id']), array($group_title_short)); // SET RESULT $result = 2000164; } else { $database->database_query("\r\n INSERT INTO se_groupmembers (\r\n groupmember_user_id,\r\n groupmember_group_id,\r\n groupmember_status,\r\n groupmember_approved,\r\n groupmember_rank\r\n ) VALUES (\r\n '{$user->user_info['user_id']}',\r\n '{$group->group_info['group_id']}',\r\n '1',\r\n '1',\r\n '0'\r\n )\r\n "); $database->database_query("UPDATE se_groups SET group_totalmembers=group_totalmembers+1 WHERE group_id='{$group->group_info['group_id']}' LIMIT 1"); // INSERT ACTION $group_title_short = $group->group_info['group_title']; if (strlen($group_title_short) > 100) { $group_title_short = substr($group_title_short, 0, 97); $group_title_short .= "..."; } $actions->actions_add($user, "joingroup", array($user->user_info['user_username'], $user->user_displayname, $group->group_info['group_id'], $group_title_short), array(), 0, false, "group", $group->group_info['group_id'], $group->group_info['group_privacy']);
function documents_list($start, $limit, $sort_by = "created DESC", $where = "", $document_details = 0) { global $database, $user; // START THE SQL QUERY $sql = "\r\n SELECT\r\n se_documents.*,\r\n se_documents.document_totalcomments AS total_comments,\r\n se_document_categories.category_name,\r\n se_document_categories.category_id\r\n "; // SELECT USER DETAIL OF DOCUMENT IF REQUIRED if ($document_details == 1) { $sql .= ",\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n "; } // ADD FROM TABLE $sql .= "\r\n FROM\r\n se_documents\r\n "; if ($document_details == 1) { $sql .= "\r\n LEFT JOIN\r\n se_users\r\n ON se_documents.document_user_id=se_users.user_id\r\n "; } // JOIN WITH THE CATEGORIES TABLE $sql .= "\r\n\t LEFT JOIN\r\n\t se_document_categories\r\n\t ON se_documents.document_category_id = se_document_categories.category_id\r\n\t "; // JOIN WITH THE TAGS TABLE $sql .= "\r\n\t LEFT JOIN\r\n\t se_document_tags\r\n\t ON se_documents.document_id = se_document_tags.document_id\r\n\t LEFT JOIN se_documenttags\r\n\t ON se_document_tags.tag_id = se_documenttags.id\r\n\t "; // ADD WHERE STATMENT IF REQUIRED if ($where != "" | $this->user_id != 0) { $sql .= "\r\n WHERE\r\n "; } // CHECK FOR USER ID if ($this->user_id != 0) { $sql .= "\r\n se_documents.document_user_id='{$this->user_id}'\r\n "; } // ADD AND STATMENT IF REQUIRED if ($this->user_id != 0 & $where != "") { $sql .= " AND"; } // ADD WHERE CONDITION, IF REQUIRED if ($where != "") { $sql .= "\r\n {$where}\r\n "; } // ADD ORDER, AND LIMIT CLAUSE $sql .= "\r\n\t GROUP BY\r\n\t se_documents.document_id\r\n ORDER BY\r\n {$sort_by}\r\n LIMIT\r\n {$start}, {$limit}\r\n "; $resource = $database->database_query($sql) or die($database->database_error() . " SQL: " . $sql); $document_array = array(); while ($document_info = $database->database_fetch_assoc($resource)) { // CREATE OBJECT FOR DOCUMENT $document = new Document(null, null, $document_info['user_id']); $document->document_exists = TRUE; // CREATE OBJECT FOR DOCUMENT CREATOR IF DOCUMENT DETAILS if ($document_details) { $document_creator = new se_user(); $document_creator->user_exists = TRUE; $document_creator->user_info['user_id'] = $document_info['user_id']; $document_creator->user_info['user_username'] = $document_info['user_username']; $document_creator->user_info['user_photo'] = $document_info['user_photo']; $document_creator->user_info['user_fname'] = $document_info['user_fname']; $document_creator->user_info['user_lname'] = $document_info['user_lname']; $document_creator->user_displayname(); $document->document_owner =& $document_creator; unset($document_creator); } //CHECKING IF THE ASSOCIATED CATEGORY HAS A MAIN CATEGORY $main_cat = $database->database_fetch_assoc($database->database_query("SELECT t2.category_id, t2.category_name FROM se_document_categories as t1 INNER JOIN se_document_categories t2 ON t1.cat_dependency = t2.category_id WHERE t1.category_id = '{$document_info['category_id']}'")); if (!empty($main_cat)) { $document_info['main_cat'] = $main_cat; } //GETTING THE TAGS ASSOCIATED WITH THE DOCUMENT $tag_array = array(); $query = "SELECT tag_name FROM se_document_tags INNER JOIN se_documenttags ON se_document_tags.tag_id = se_documenttags.id WHERE se_document_tags.document_id = '{$document_info['document_id']}'"; $result = $database->database_query($query); while ($info = $database->database_fetch_assoc($result)) { $tag_array[] = $info['tag_name']; } $document_info['tags'] = $tag_array; $document->document_info = $document_info; $document_array[] = $document; } // RETURN ARRAY return $document_array; }