} if ($task == 'delete') { he_quiz::delete_quiz($id); } elseif ($task == 'dodelete') { $deleted_quizzes = isset($_POST['delete']) ? $_POST['delete'] : array(); foreach ($deleted_quizzes as $quiz_id) { he_quiz::delete_quiz($quiz_id); } } if ($st == 1) { he_quiz::approve_quizz($id); } elseif ($st == 0) { he_quiz::disapprove_quizz($id); } $total_quizzes = he_quiz::count_quizzes(); $quizzes_per_page = 20; $page_vars = make_page($total_quizzes, $quizzes_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } $rows = he_quiz::get_quizzes($page_vars[0], $quizzes_per_page); $smarty->assign('quizzes', $rows); $smarty->assign('total_quizzes', $total_quizzes); $smarty->assign('pages', $page_array); include "admin_footer.php";
$where_clause[] = "user_level_id='{$f_level}'"; } if ($f_subnet != "") { $where_clause[] = "user_subnet_id='{$f_subnet}'"; } if ($f_enabled != "") { $where_clause[] = "user_enabled='{$f_enabled}'"; } if (count($where_clause) != 0) { $user_query .= " WHERE " . implode(" AND ", $where_clause); } // GET TOTAL USERS $total_users = $database->database_num_rows($database->database_query($user_query)); // MAKE USER PAGES $users_per_page = 100; $page_vars = make_page($total_users, $users_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } $user_query .= " ORDER BY {$sort} LIMIT {$page_vars['0']}, {$users_per_page}"; // DELETE MULTIPLE USERS if ($task == "dodelete") { $deleted_users = $_POST['delete']; for ($d = 0; $d < count($deleted_users); $d++) { $user = new se_user(array($deleted_users[$d]), array('user_id'));
$where_clause[] = "se_eventmembers.eventmember_status=1 && se_eventmembers.eventmember_approved=0"; } if (empty($v) && $v !== "0") { $where_clause[] = "se_eventmembers.eventmember_status=1 && se_eventmembers.eventmember_approved=1"; } if (!empty($search)) { $where_clause[] = "(se_users.user_username LIKE '%{$search}%' OR se_users.user_email LIKE '%{$search}%' OR CONCAT(se_users.user_fname, ' ', se_users.user_lname) LIKE '%{$search}%')"; } if (!empty($where_clause)) { $where = implode(" && ", $where_clause); } // GET TOTAL MEMBERS $total_members = $event->event_member_total($where, TRUE); // MAKE MEMBER PAGES $members_per_page = 10; $page_vars = make_page($total_members, $members_per_page, $p); // GET MEMBER ARRAY $members = $event->event_member_list($page_vars[0], $members_per_page, $s, $where); // ASSIGN VARIABLES AND SHOW USER EDIT EVENT MEMBERS PAGE $smarty->assign_by_ref('event', $event); $smarty->assign_by_ref('members', $members); $smarty->assign('total_members', $total_members); $smarty->assign('search', $search); $smarty->assign('s', $s); $smarty->assign('v', $v); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($members)); $smarty->assign('result', $result); include "footer.php";
$smarty->assign('last_day_of_month', $last_day_of_month); $smarty->assign('total_cells', $total_cells); $smarty->assign('month', $month_text); $smarty->assign('year', $month_year); $smarty->assign('date_last', $date_last); $smarty->assign('date_current', $date); $smarty->assign('date_next', $date_next); $smarty->assign('today_day', $today_day); $smarty->assign('today_month', $today_month); } elseif ($view == "list") { if (!empty($search)) { $where = "se_events.event_title LIKE '%{$search}%' || se_events.event_desc LIKE '%{$search}%'"; } // GET TOTAL EVENTS/GET EVENTS ARRAY $total_events = $event->event_total($where); $page_vars = make_page($total_events, $events_per_page, $p); $events = $event->event_list($page_vars[0], $events_per_page, $s, $where, 1); // ASSIGN $smarty->assign('s', $s); $smarty->assign('search', $search); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($blogentries)); } // ASSIGN VARIABLES AND SHOW VIEW EVENTS PAGE $smarty->assign('view', $view); $smarty->assign('total_events', $total_events); $smarty->assign_by_ref('events', $events); $smarty->assign('show_notification', $show_notification); include "footer.php";
// DETERMINE THE USER'S PERMISSIONS FOR THIS FORUM (VIEW, POST, MODERATE, ETC) $forum_permission = $forum->forum_permission($forum_info[forum_id]); // SEND USER BACK IF NOT ALLOWED TO VIEW THIS FORUM if (!$forum_permission[allowed_to_view]) { header("Location: forum.php"); exit; } // 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
if ($f_owner != "") { $where .= "se_users.user_id LIKE '%{$f_owner}%'"; } if ($f_owner != "" & $f_title != "") { $where .= " AND"; } if ($f_title != "") { $where .= " se_music.music_title LIKE '%{$f_title}%'"; } if ($where != "") { $where = "(" . $where . ")"; } // GET TOTAL ENTRIES $total_music = $music->music_list_total(NULL, NULL, $where); // MAKE ENTRY PAGES $page_vars = make_page($total_music, $entries_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } // GET SONG LIST ARRAY $music_list = $music->music_list($page_vars[0], $entries_per_page, $sort, $where); // ASSIGN VARIABLES AND SHOW VIEW ENTRIES PAGE $smarty->assign('total_music', $total_music); $smarty->assign('pages', $page_array); $smarty->assign('entries', $music_list);
$where_clause[] = "se_reports.report_object='{$f_object}'"; } if ($f_reason != "") { $where_clause[] = "se_reports.report_reason='{$f_reason}'"; } if ($f_details != "") { $where_clause[] = " se_reports.report_details LIKE '%{$f_details}%'"; } if (count($where_clause) != 0) { $reports_query .= " WHERE " . implode(" AND ", $where_clause); } // GET TOTAL REPORTS $total_reports = $database->database_num_rows($database->database_query($reports_query)); // MAKE REPORTS PAGES $reports_per_page = 100; $page_vars = make_page($total_reports, $reports_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } $reports_query .= " ORDER BY {$sort} LIMIT {$page_vars['0']}, {$reports_per_page}"; // PULL REPORTS INTO AN ARRAY $reports = $database->database_query($reports_query); while ($report_info = $database->database_fetch_assoc($reports)) { $report_array[] = $report_info; }
$total_posts = $database->database_num_rows($database->database_query("SELECT NULL FROM se_forumposts LEFT JOIN se_forumtopics ON se_forumposts.forumpost_forumtopic_id=se_forumtopics.forumtopic_id WHERE se_forumposts.forumpost_authoruser_id='{$owner->user_info[user_id]}' AND se_forumposts.forumpost_deleted='0' AND se_forumtopics.forumtopic_forum_id IN ('" . implode("', '", $forum_ids) . "')")); } // ASSIGN TOTAL POSTS IN SMARTY $smarty->assign('total_posts', $total_posts); // DISPLAY TAB ONLY IF USER HAS POSTED if ($total_posts) { // MAKE POST PAGES if (isset($_POST['p_forum'])) { $p_forum = $_POST['p_forum']; } elseif (isset($_GET['p_forum'])) { $p_forum = $_GET['p_forum']; } else { $p_forum = 1; } $posts_per_page = 10; $page_vars_forum = make_page($total_posts, $posts_per_page, $p_forum); // GET POST ARRAY $post_array = array(); $posts = $database->database_query("SELECT se_forumtopics.forumtopic_forum_id, se_forumtopics.forumtopic_subject, se_forumposts.forumpost_id, se_forumposts.forumpost_forumtopic_id, se_forumposts.forumpost_date, se_forumposts.forumpost_excerpt FROM se_forumposts LEFT JOIN se_forumtopics ON se_forumposts.forumpost_forumtopic_id=se_forumtopics.forumtopic_id WHERE se_forumposts.forumpost_authoruser_id='{$owner->user_info[user_id]}' AND se_forumposts.forumpost_deleted='0' AND se_forumtopics.forumtopic_forum_id IN ('" . implode("', '", $forum_ids) . "') ORDER BY se_forumposts.forumpost_id DESC LIMIT {$page_vars_forum['0']}, {$posts_per_page}"); while ($post_info = $database->database_fetch_assoc($posts)) { if (strlen($post_info[forumpost_excerpt]) > 47) { $post_info[forumpost_excerpt] = substr($post_info[forumpost_excerpt], 0, 47) . "..."; } $post_array[] = $post_info; } // SET SMARTY VARS $smarty->assign('forum_posts', $post_array); $smarty->assign('maxpage_forum', $page_vars_forum[2]); $smarty->assign('p_start_forum', $page_vars_forum[0] + 1); $smarty->assign('p_end_forum', $page_vars_forum[0] + count($posts)); $smarty->assign('p_forum', $page_vars_forum[1]);
// ENSURE SORT/VIEW ARE VALID if ($s != "music_date DESC" && $s != "music_track_num ASC") { $s = "music_date DESC"; } if ($v != "0" && $v != "1") { $v = 0; } // ONLY MY FRIENDS' MUSIC if ($v == "1" && $user->user_exists) { // SET WHERE CLAUSE $where = "(\r\n SELECT\r\n TRUE\r\n FROM\r\n se_friends\r\n WHERE\r\n friend_user_id1={$user->user_info[user_id]} &&\r\n friend_user_id2=se_music.music_user_id &&\r\n friend_status=1\r\n ) \r\n "; } // CREATE ALBUM OBJECT $music_object = new se_music(); // GET TOTAL ALBUMS $browse_music_total = $music_object->music_list_total(NULL, NULL, $where); // MAKE ENTRY PAGES $music_per_page = 20; $page_vars = make_page($browse_music_total, $music_per_page, $p); // GET ALBUM ARRAY $browse_music_list = $music_object->music_list($page_vars[0], $music_per_page, $s, $where); // ASSIGN SMARTY VARIABLES AND DISPLAY MUSIC PAGE $smarty->assign('browse_music_list', $browse_music_list); $smarty->assign('browse_music_total', $browse_music_total); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($browse_music_list)); $smarty->assign('s', $s); $smarty->assign('v', $v); include "footer.php";
<?php header('Content-Type: text/html; charset=utf8'); include "DBcontent.php"; include "menu.php"; //var_dump($_REQUEST); if (!isset($_REQUEST["menu_op"])) { $_REQUEST["menu_op"] = "總覽"; } //use for test //var_dump($_REQUEST); //echo "<br>"; //default DB=full display $DB_display = array("full", array()); //retrieve column names $col_names = get_column_name(); //make menu $menu = new menu(); //retrieve menu operation if (isset($_GET["ID"])) { $menu->create_profile($_GET["ID"]); } else { $menu->switchform($_REQUEST["menu_op"]); } function make_page($menu, $form, $DBcontent, $message) { $page = "\n <html>\n <head>\n <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n <title>尚肯產品資料庫</title>\n </head>\n <body>\n <div id='wrapper'> \n <div id='menu' style='text-align:center'>\n {$menu}\n </div>\n\n <div id='message' style='text-align:center'>\n {$message}\n </div>\n \n <div id='form' style='text-align:center'>\n {$form}\n </div>\n \n <div id='DB' style='text-align:center'>\n {$DBcontent}\n </div>\n \n </div>\n </body>\n </html>"; return $page; } echo make_page($menu->display_menu(), $menu->form, DB_content($DB_display), $menu->message);
$object_owner = preg_replace('/[^A-Z0-9_\\.-]/i', '', $object_owner); $classname = "se_" . $object_owner; if (class_exists($classname)) { $object_owner_class = new $classname($user->user_info['user_id'], $object_owner_id); $object_exists = $object_owner_class->{$object_owner . "_exists"}; } } if (!$owner->user_exists && !$object_exists) { exit; } // START COMMENT OBJECT $comment = new se_comment($type, $iden, $value, $tab, $col); // GET TOTAL COMMENTS $total_comments = $comment->comment_total(); // MAKE COMMENT PAGES AND GET COMMENT ARRAY $page_vars = make_page($total_comments, $cpp, $p); $comments = $comment->comment_list($page_vars[0], $cpp); // CONSTRUCT JSON RESPONSE $response_array = array('total_comments' => (int) $total_comments, 'maxpage' => (int) $page_vars[2], 'p_start' => (int) ($page_vars[0] + 1), 'p_end' => (int) ($page_vars[0] + count($comments)), 'p' => (int) $page_vars[1], 'comments' => array()); foreach ($comments as $comment_index => $comment_data) { // Escape trailing backslash if (substr($comment_data['comment_body'], -1, 1) == "\\" && substr($comment_data['comment_body'], -2, 2) != "\\\\") { $comment_data['comment_body'] .= "\\"; } $response_array['comments'][(int) $comment_data['comment_id']] = array('comment_authoruser_id' => (int) $comment_data['comment_authoruser_id'], 'comment_authoruser_exists' => (bool) $comment_data['comment_author']->user_exists, 'comment_authoruser_private' => (bool) $comment_data['comment_author_private'], 'comment_authoruser_url' => (string) $url->url_create('profile', $comment_data['comment_author']->user_info['user_username']), 'comment_authoruser_photo' => (string) $comment_data['comment_author']->user_photo('./images/nophoto.gif'), 'comment_authoruser_photo_width' => (int) $misc->photo_size($comment_data['comment_author']->user_photo('./images/nophoto.gif'), '75', '75', 'w'), 'comment_authoruser_username' => (string) $comment_data['comment_author']->user_info['user_username'], 'comment_authoruser_displayname' => (string) $comment_data['comment_author']->user_displayname, 'comment_date' => (string) $datetime->cdate("{$setting['setting_dateformat']} {$setting['setting_timeformat']}", $datetime->timezone($comment_data['comment_date'], $global_timezone)), 'comment_body' => (string) $comment_data['comment_body']); } // OUTPUT JSON echo json_encode($response_array); exit; } elseif ($task == "comment_post") { // GET COMMENT TYPE, ETC
if ($c == 0 || !is_numeric($c)) { $c = '0'; } $where .= " AND blogentry_blogentrycat_id='{$c}'"; } // SEARCH if (!empty($blog_search)) { $where .= " && MATCH (`blogentry_title`, `blogentry_body`) AGAINST ('{$blog_search}' IN BOOLEAN MODE)"; } // CREATE blog OBJECT $blog = new se_blog(); // GET TOTAL blogs $total_blogentries = $blog->blog_entries_total($where); // MAKE ENTRY PAGES $blogentries_per_page = 10; $page_vars = make_page($total_blogentries, $blogentries_per_page, $p); // GET blog ARRAY $blogentry_array = $blog->blog_entries_list($page_vars[0], $blogentries_per_page, $s, $where); // GET BLOG ENTRY CATEGORIES $blogentrycats_query = $database->database_query("SELECT * FROM se_blogentrycats WHERE blogentrycat_user_id=0 ORDER BY blogentrycat_id ASC"); $blogentrycats_array = array(); while ($blogentrycat = $database->database_fetch_assoc($blogentrycats_query)) { $blogentrycats_array[] = array('blogentrycat_id' => $blogentrycat['blogentrycat_id'], 'blogentrycat_title' => $blogentrycat['blogentrycat_title']); } // ASSIGN SMARTY VARIABLES AND DISPLAY blogs PAGE $smarty->assign('total_blogentries', $total_blogentries); $smarty->assign_by_ref('blogentries', $blogentry_array); $smarty->assign_by_ref('blogentrycats', $blogentrycats_array); $smarty->assign('blog_search', $blog_search); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]);
} if ($f_title != "") { $where_clause[] = " se_videos.video_title LIKE '%{$f_title}%'"; } if (count($where_clause) != 0) { $where = "(" . implode(" AND ", $where_clause) . ")"; } // DELETE NECESSARY VIDEOS $start = ($p - 1) * $videos_per_page; if ($task == "delete") { $video->video_delete_selected($start, $videos_per_page, $sort, $where); } // GET TOTAL VIDEOS $total_videos = $video->video_total($where); // MAKE VIDEO PAGES $page_vars = make_page($total_videos, $videos_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } // GET VIDEO ARRAY $videos = $video->video_list($page_vars[0], $videos_per_page, $sort, $where); // ASSIGN VARIABLES AND SHOW VIEW VIDEOS PAGE $smarty->assign('total_videos', $total_videos); $smarty->assign('pages', $page_array); $smarty->assign('videos', $videos);
} else { $s = "dd"; } $sort = NULL; //"se_blogentries.blogentry_date DESC"; $where = NULL; // ENSURE BLOGS ARE ENABLED FOR THIS USER if (!$user->level_info['level_blog_view']) { header("Location: user_home.php"); exit; } // CREATE BLOG OBJECT $subscriptions_per_page = 10; $blog_object = new se_blog($user->user_info['user_id']); // GET TOTAL ENTRIES $blog_subscriptions_total = $blog_object->blog_subscription_total($where); // MAKE ENTRY PAGES $page_vars = make_page($blog_subscriptions_total, $subscriptions_per_page, $p); // GET ENTRY ARRAY $blog_subscriptions_list = $blog_object->blog_subscription_list($page_vars[0], $subscriptions_per_page, $sort, $where, TRUE); //echo mysql_get_server_info(); //print_r($blog_subscriptions_list); // ASSIGN VARIABLES AND SHOW PAGE $smarty->assign('blog_subscriptions_total', $blog_subscriptions_total); $smarty->assign_by_ref('blog_subscriptions_list', $blog_subscriptions_list); $smarty->assign('s', $s); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($blog_subscriptions_list)); include "footer.php";
// CREATE PROFILE COMMENT OBJECT $comments_per_page = 10; $comment = new se_comment('article', 'article_id', $article->article_info[article_id]); // DELETE NECESSARY COMMENTS $start = ($p - 1) * $comments_per_page; if($task == "delete") { $comment->comment_delete_selected($start, $comments_per_page); } // GET TOTAL COMMENTS $total_comments = $comment->comment_total(); // MAKE COMMENT PAGES $page_vars = make_page($total_comments, $comments_per_page, $p); // GET COMMENT ARRAY $comments = $comment->comment_list($page_vars[0], $comments_per_page); // ASSIGN VARIABLES AND DISPLAY MODERATE COMMENTS PAGE $smarty->assign('article', $article); $smarty->assign('comments', $comments); $smarty->assign('total_comments', $total_comments); $smarty->assign('p', $page_vars[1]);
} if ($f_title != "") { $where_clause[] = " se_albums.album_title LIKE '%{$f_title}%'"; } if (count($where_clause) != 0) { $where = "(" . implode(" AND ", $where_clause) . ")"; } // DELETE NECESSARY ALBUMS $start = ($p - 1) * $albums_per_page; if ($task == "delete") { $album->album_delete_selected($start, $albums_per_page, $sort, $where); } // GET TOTAL ALBUMS $total_albums = $album->album_total($where); // MAKE ALBUM PAGES $page_vars = make_page($total_albums, $albums_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } // GET ALBUM ARRAY $albums = $album->album_list($page_vars[0], $albums_per_page, $sort, $where); // ASSIGN VARIABLES AND SHOW VIEW ALBUMS PAGE $smarty->assign('total_albums', $total_albums); $smarty->assign('pages', $page_array); $smarty->assign('albums', $albums);
} // SET WHERE CLAUSE $is_where = 0; $where = ""; if ($search != "") { $is_where = 1; $where = "(se_users.user_username LIKE '%{$search}%' OR se_users.user_fname LIKE '%{$search}%' OR se_users.user_lname LIKE '%{$search}%' OR CONCAT(se_users.user_fname, ' ', se_users.user_lname) LIKE '%{$search}%' OR se_users.user_email LIKE '%{$search}%')"; } // DECIDE WHETHER TO SHOW DETAILS $connection_types = explode("<!>", trim($setting['setting_connection_types'])); $show_details = !empty($connection_types) || $setting['setting_connection_other'] || $setting['setting_connection_explain']; // GET TOTAL FRIENDS $total_friends = $user->user_friend_total(0, 1, $is_where, $where); // MAKE FRIEND PAGES $friends_per_page = 10; $page_vars = make_page($total_friends, $friends_per_page, $p); // GET FRIEND ARRAY $friends = $user->user_friend_list($page_vars[0], $friends_per_page, 0, 1, $sort, $where, $show_details); // ASSIGN VARIABLES AND INCLUDE FOOTER $smarty->assign('s', $s); $smarty->assign('u', $u); $smarty->assign('l', $l); $smarty->assign('t', $t); $smarty->assign('search', $search); $smarty->assign('friends', $friends); $smarty->assign('total_friends', $total_friends); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p', $page_vars[1]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($friends)); $smarty->assign('show_details', $show_details);
header("Location: article.php?article_id=".$article->article_info[article_id]); exit(); } // UPDATE ALBUM VIEWS $articlealbum_views_new = $articlealbum_info[articlealbum_views] + 1; $database->database_query("UPDATE se_articlealbums SET articlealbum_views='$articlealbum_views_new' WHERE articlealbum_id='$articlealbum_info[articlealbum_id]' LIMIT 1"); // GET TOTAL FILES IN ARTICLE ALBUM $total_files = $article->article_media_total($articlealbum_info[articlealbum_id]); // MAKE MEDIA PAGES $files_per_page = 16; $page_vars = make_page($total_files, $files_per_page, $p); // GET MEDIA ARRAY $file_array = $article->article_media_list($page_vars[0], $files_per_page, "articlemedia_id ASC", "(articlemedia_articlealbum_id='$articlealbum_info[articlealbum_id]')"); // GET CUSTOM ARTICLE STYLE IF ALLOWED if($article->articleowner_level_info[level_article_style] != 0 & $is_article_private == 0) { $articlestyle_info = $database->database_fetch_assoc($database->database_query("SELECT articlestyle_css FROM se_articlestyles WHERE articlestyle_article_id='".$article->article_info[article_id]."' LIMIT 1")); $global_css = $articlestyle_info[articlestyle_css]; } // ASSIGN VARIABLES AND DISPLAY ARTICLE ALBUM PAGE
$s = "poll_datecreated DESC"; } if ($v != "0" && $v != "1") { $v = 0; } // SET WHERE CLAUSE $where = "CASE\r\n\t WHEN se_polls.poll_user_id='{$user->user_info['user_id']}'\r\n\t THEN TRUE\r\n\t WHEN ((se_polls.poll_privacy & @SE_PRIVACY_REGISTERED) AND '{$user->user_exists}'<>0)\r\n\t THEN TRUE\r\n\t WHEN ((se_polls.poll_privacy & @SE_PRIVACY_ANONYMOUS) AND '{$user->user_exists}'=0)\r\n\t THEN TRUE\r\n\t WHEN ((se_polls.poll_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1=se_polls.poll_user_id AND friend_user_id2='{$user->user_info['user_id']}' AND friend_status='1' LIMIT 1))\r\n\t THEN TRUE\r\n\t WHEN ((se_polls.poll_privacy & @SE_PRIVACY_SUBNET) AND '{$user->user_exists}'<>0 AND (SELECT TRUE FROM se_users WHERE user_id=se_polls.poll_user_id AND user_subnet_id='{$user->user_info['user_subnet_id']}' LIMIT 1))\r\n\t THEN TRUE\r\n\t WHEN ((se_polls.poll_privacy & @SE_PRIVACY_FRIEND2) AND (SELECT TRUE FROM se_friends AS friends_primary LEFT JOIN se_users ON friends_primary.friend_user_id1=se_users.user_id 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_polls.poll_user_id AND friends_secondary.friend_user_id2='{$user->user_info['user_id']}' AND se_users.user_subnet_id='{$user->user_info['user_subnet_id']}' LIMIT 1))\r\n\t THEN TRUE\r\n\t ELSE FALSE\r\n\tEND"; // ONLY MY FRIENDS' POLLS if ($v == "1" && $user->user_exists) { // SET WHERE CLAUSE $where .= " && (\r\n SELECT\r\n TRUE\r\n FROM\r\n se_friends\r\n WHERE\r\n friend_user_id1='{$user->user_info['user_id']}' &&\r\n friend_user_id2=se_polls.poll_user_id &&\r\n friend_status=1\r\n )\r\n "; } // CREATE poll OBJECT $poll = new se_poll(); // GET TOTAL pollS $total_polls = $poll->poll_total($where); // MAKE ENTRY PAGES $polls_per_page = 10; $page_vars = make_page($total_polls, $polls_per_page, $p); // GET poll ARRAY $poll_array = $poll->poll_list($page_vars[0], $polls_per_page, $s, $where, TRUE); // ASSIGN SMARTY VARIABLES AND DISPLAY pollS PAGE $smarty->assign('polls', $poll_array); $smarty->assign('total_polls', $total_polls); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($poll_array)); $smarty->assign('s', $s); $smarty->assign('v', $v); include "footer.php";
} // GET TOTAL POSTS $total_posts = $topic_info[forumtopic_totalreplies] + 1; // SET POSTS PER PAGE $posts_per_page = 20; // IF POST ID IS SPECIFIED, GO TO THAT PAGE if ($post_id != 0) { $post = $database->database_query("SELECT forumpost_id FROM se_forumposts WHERE forumpost_id='{$post_id}' AND forumpost_forumtopic_id='{$topic_info[forumtopic_id]}'"); if ($database->database_num_rows($post) == 1) { $post_info = $database->database_fetch_assoc($post); $posts_before = $database->database_num_rows($database->database_query("SELECT NULL FROM se_forumposts WHERE forumpost_forumtopic_id='{$topic_info[forumtopic_id]}' AND forumpost_id<'{$post_info[forumpost_id]}'")); $p = ceil(($posts_before + 1) / $posts_per_page); } } // MAKE POST PAGES $page_vars = make_page($total_posts, $posts_per_page, $p); // GET MODERATORS $mod_array_id = array(); $mods = $database->database_query("SELECT forummoderator_user_id FROM se_forummoderators WHERE forummoderator_forum_id='{$forum_info['forum_id']}'"); while ($user_info = $database->database_fetch_assoc($mods)) { $mod_array_id[] = $user_info[forummoderator_user_id]; } // SET POST ARRAY $post_array = array(); $posts = $database->database_query("SELECT se_forumposts.*, se_users.user_id, se_users.user_username, se_users.user_fname, se_users.user_lname,\tse_users.user_photo, se_users.user_signupdate, se_forumusers.forumuser_totalposts FROM se_forumposts LEFT JOIN se_users ON se_forumposts.forumpost_authoruser_id=se_users.user_id LEFT JOIN se_forumusers ON se_users.user_id=se_forumusers.forumuser_user_id WHERE forumpost_forumtopic_id='{$topic_info[forumtopic_id]}' ORDER BY forumpost_id ASC LIMIT {$page_vars[0]}, {$posts_per_page}"); while ($post_info = $database->database_fetch_assoc($posts)) { // GET POST AUTHOR $author = new se_user(); if ($post_info['forumpost_authoruser_id'] != $post_info['user_id']) { $author->user_exists = false; } else {
$criterias[] = "article_articlecat_id='0'"; } } else { $nocat = 1; } $where = join(' AND ', $criterias); // GET TOTAL ARTICLES $total_articles = $article->article_total($where); $articles_totalnocat = $article->article_total(join(' AND ', array_merge($article_menu_filter,array('no'=>"article_articlecat_id='0'")))); // MAKE ARTICLE PAGES $articles_per_page = 10; $page_vars = make_page($total_articles, $articles_per_page, $p); $s = rc_toolkit::get_request('s','date'); if ($s == 'view') { $sort = "article_views DESC"; } elseif ($s == 'title') { $sort = "article_title ASC"; } else { $sort = "article_date_start DESC"; $s = 'date'; } $category_info = $rc_articlecats->get_record($articlecat_id);
$explodedFileName = explode('_', $key); $mapName = $explodedFileName[2] . '_' . $explodedFileName[0]; if ($groupCount[$groupCountIndex][1] - 1 < $counter) { $groupCountIndex++; $counter = 0; } $matchedKeywords = implode(', ', $keywordsMatched[$key]); $counter++; $html .= <<<EOT <tr class='tr{$tmp}'> \t<td>{$date}</td> \t<td><a href='./log/{$key}'>{$mapName}</a></td> \t<td>{$matchedKeywords}</td> </tr> EOT; } $html .= <<<EOT </table><br> <center> EOT; // Output month/year choices foreach (is_array($pos) ? $pos : array() as $key => $val) { $html .= "<a href='?sel={$key}'>{$val}</a> - "; } $html = substr($html, 0, -3); $html .= <<<EOT </center> EOT; // Create the page through page.php make_page($html, $nav);
} if ($f_title != "") { $where_clause[] = "se_groups.group_title LIKE '%{$f_title}%'"; } if (count($where_clause) != 0) { $where = "(" . implode(" AND ", $where_clause) . ")"; } // DELETE NECESSARY GROUPS $start = ($p - 1) * $groups_per_page; if ($task == "delete") { $group->group_delete_selected($start, $groups_per_page, $sort, $where); } // GET TOTAL GROUPS $total_groups = $group->group_total($where, 1); // MAKE GROUP PAGES $page_vars = make_page($total_groups, $groups_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } // GET GROUP ARRAY $groups = $group->group_list($page_vars[0], $groups_per_page, $sort, $where, 1); // ASSIGN VARIABLES AND SHOW VIEW GROUPS PAGE $smarty->assign('total_groups', $total_groups); $smarty->assign('pages', $page_array); $smarty->assign('groups', $groups);
$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") { // GET VARS $p = !empty($_POST['p']) ? $_POST['p'] : 1; $cpp = !empty($_POST['cpp']) ? $_POST['cpp'] : 1; // GET EVENT ALBUM INFO $sql = "SELECT eventalbum_id,eventalbum_totalfiles FROM se_eventalbums WHERE eventalbum_event_id='" . $event->event_info['event_id'] . "' LIMIT 1"; $resource = $database->database_query($sql); $eventalbum_info = $database->database_fetch_assoc($resource); $total_files = $eventalbum_info['eventalbum_totalfiles']; // MAKE FILE PAGES AND GET FILE ARRAY $page_vars = make_page($total_files, $cpp, $p); $event_files = $event->event_media_list($page_vars[0], $cpp, NULL, NULL); // CONSTRUCT JSON RESPONSE echo json_encode(array('total_files' => (int) $total_files, 'maxpage' => (int) $page_vars[2], 'p_start' => (int) ($page_vars[0] + 1), 'p_end' => (int) ($page_vars[0] + count($event_files)), 'p' => (int) $page_vars[1], 'files' => &$event_files)); exit; }
// CHECK PRIVACY $privacy_max = $owner->user_privacy_max($user); if (!($owner->user_info['user_privacy'] & $privacy_max)) { header("Location: " . $url->url_create('profile', $owner->user_info['user_username'])); exit; } // START QUERY $photo_query = ""; // CALL TAG HOOK ($hook = SE_Hook::exists('se_mediatag')) ? SE_Hook::call($hook, array()) : NULL; // GET TOTAL PHOTOS $total_files = $database->database_num_rows($database->database_query($photo_query)); // ADD TO PHOTO QUERY $photo_query .= " ORDER BY mediatag_date DESC"; // 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 {
public function listAction() { //get object $objQuestion = new Questionanswer_Model_Question(array()); $objQuestionVote = new Questionanswer_Model_Questionvotes(array()); $objAnswer = new Questionanswer_Model_Answer(array()); $_user_id = $this->_helper->api()->user()->getViewer()->getIdentity(); if (!$_user_id) { $_user_id = 0; } //get user id $user_id = $_POST['user_id']; $_category = $_POST['category']; $_page = $_POST['page']; $_search_query = ""; $_search = $_POST['search']; $_question_id = $_POST['qid']; // SEARCH QUESTION if (!empty($_search)) { //$_search = htmlentities(stripslashes($_search)); $_search_arr = explode(" ", $_search); $_searchs = array(); foreach ($_search_arr as $item) { if ($item != "") { $_searchs[] = $item; } } $_search_query = implode("%", $_searchs); $_search_query = "%" . $_search_query . "%"; $_search_query = addslashes($_search_query); } if ($_page <= 0) { $_page = 1; } //get question $questions_per_page = 5; $total_questions = $objQuestion->countQuestion($_question_id, $user_id, $_category, $_search_query); $page_vars = make_page($total_questions, $questions_per_page, $_page); $question_array = $objQuestion->getQuestions($_question_id, $user_id, $_category, $_search_query, $questions_per_page, $page_vars[0]); if (count($question_array) > 0) { $questions_list = array(); $i = 0; foreach ($question_array as $question_info) { //get user picture $qsuser = null; $table = Engine_Api::_()->getDbtable('users', 'user'); $select = $table->select()->where('user_id = ?', $question_info['user_id']); $qsuser = $table->fetchRow($select); $question_info['user_photo'] = $this->view->htmlLink($qsuser, $this->view->itemPhoto($qsuser, 'thumb.icon', $qsuser->getTitle(), array('class' => 'qa_photo', 'style' => 'float:left')), array('class' => 'f1')); //check user voted $is_vote = $objQuestionVote->getQuestionVotesByUserIdAndQuestionId($_user_id, $question_info['question_id']); if ($_user_id && $_user_id != $question_info['user_id'] && $is_vote == 0) { $is_vote = "1"; } else { $is_vote = "0"; } $question_info['is_allowed'] = $is_vote; //get answer of question $answers_array = $objAnswer->getAnswers($question_info['question_id'], 0, 0); $answers_list = array(); foreach ($answers_array as $answer_info) { $auser = null; $table = Engine_Api::_()->getDbtable('users', 'user'); $select = $table->select()->where('user_id = ?', $answer_info['user_id']); $auser = $table->fetchRow($select); $answer_info['user_photo'] = $this->view->htmlLink($auser, $this->view->itemPhoto($auser, 'thumb.icon', $auser->getTitle(), array('class' => 'qa_photo', 'style' => 'float:left')), array('class' => 'f1')); $answers_list[] = $answer_info; } $questions_list[$i]['answers_list'] = $answers_list; $questions_list[$i]['question'] = $question_info; $i++; } } if ($total_questions == 0) { echo '{"result":"norecord", "message":"No data found!"}'; die; } else { $page_info = array("p" => $page_vars[1], "maxpage" => $page_vars[2], "p_start" => $page_vars[0] + 1, "p_end" => $page_vars[0] + $total_questions, "total_records" => $total_questions); echo json_encode(array("result" => $total_questions, "page_info" => $page_info, "threads_info" => $questions_list)); die; } }
$p = $_POST['p']; } elseif (isset($_GET['p'])) { $p = $_GET['p']; } else { $p = 1; } // CHECK FOR ADMIN ALLOWANCE OF MESSAGES if (!$user->level_info['level_message_allow']) { header("Location: user_home.php"); exit; } // SET VARS $pms_per_page = 20; // DELETE NECESSARY PMS if ($task == "deleteselected") { $user->user_message_delete_selected($_POST['delete_convos'], 0); } // GET TOTAL MESSAGES $total_pms = $user->user_message_total(0, 0); // MAKE PM PAGES $page_vars = make_page($total_pms, $pms_per_page, $p); // GET ARRAY OF MESSAGES $pms = $user->user_message_list($page_vars[0], $pms_per_page, 0); // ASSIGN VARIABLES AND INCLUDE FOOTER $smarty->assign('total_pms', $total_pms); $smarty->assign_by_ref('pms', $pms); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0] + 1); $smarty->assign('p_end', $page_vars[0] + count($pms)); include "footer.php";
exit; } $language = $database->database_fetch_assoc($lang_query); $var_query = "SELECT se_languagevars.*, \r\n\t\tCASE\r\n\t\t WHEN (languagevar_id <= 500000)\r\n\t\t THEN 'Normal Variable'\r\n\t\t WHEN (500000 < languagevar_id AND languagevar_id <= 600000)\r\n\t\t THEN 'Profile Fields/Tabs'\r\n\t\t WHEN (600000 < languagevar_id AND languagevar_id <= 633000)\r\n\t\t THEN 'Friendship Types'\r\n\t\t WHEN (633000 < languagevar_id AND languagevar_id <= 666000)\r\n\t\t THEN 'User Levels'\r\n\t\t WHEN (666000 < languagevar_id AND languagevar_id <= 700000)\r\n\t\t THEN 'Subnetworks'\r\n\t\t WHEN (700000 < languagevar_id AND languagevar_id <= 750000)\r\n\t\t THEN 'Recent Actions'\r\n\t\t WHEN (750000 < languagevar_id AND languagevar_id <= 800000)\r\n\t\t THEN 'Notifications'\r\n\t\t WHEN (800000 < languagevar_id AND languagevar_id <= 850000)\r\n\t\t THEN 'FAQ Categories/Questions'\r\n\t\t WHEN (850000 < languagevar_id AND languagevar_id <= 900000)\r\n\t\t THEN 'System Emails'\r\n\t\t WHEN (1000000 < languagevar_id AND languagevar_id <= 1500000)\r\n\t\t THEN 'Album Plugin'\r\n\t\t WHEN (1500000 < languagevar_id AND languagevar_id <= 2000000)\r\n\t\t THEN 'Blog Plugin'\r\n\t\t WHEN (2000000 < languagevar_id AND languagevar_id <= 2500000)\r\n\t\t THEN 'Group Plugin'\r\n\t\t WHEN (2500000 < languagevar_id AND languagevar_id <= 3000000)\r\n\t\t THEN 'Poll Plugin'\r\n\t\t WHEN (3000000 < languagevar_id AND languagevar_id <= 3500000)\r\n\t\t THEN 'Event Plugin'\r\n\t\t WHEN (3500000 < languagevar_id AND languagevar_id <= 4000000)\r\n\t\t THEN 'Chat Plugin'\r\n\t\t WHEN (4000000 < languagevar_id AND languagevar_id <= 4500000)\r\n\t\t THEN 'Music Plugin'\r\n\t\t WHEN (4500000 < languagevar_id AND languagevar_id <= 5000000)\r\n\t\t THEN 'Classified Plugin'\r\n\t\t ELSE\r\n\t\t 'Custom Variable'\r\n\t\tEND\r\n\t\tAS languagevar_category FROM se_languagevars WHERE languagevar_language_id='{$language_id}'"; if ($phrase_id != "") { $var_query .= " AND languagevar_id = {$phrase_id}"; $phrase = ""; } if ($phrase != "") { $var_query .= " AND languagevar_value LIKE '%" . str_replace("%", "\\%", $phrase) . "%'"; } // GET TOTAL LANGUAGE VARS $total_vars = $database->database_num_rows($database->database_query($var_query)); // MAKE LANGUAGE VAR PAGES $vars_per_page = 25; $page_vars = make_page($total_vars, $vars_per_page, $p); // GET LANGUAGE VARS $var_query .= " ORDER BY languagevar_id LIMIT {$page_vars['0']}, {$vars_per_page}"; $vars = $database->database_query($var_query); while ($var_info = $database->database_fetch_assoc($vars)) { $langvars[] = array('languagevar_id' => $var_info[languagevar_id], 'languagevar_value' => htmlspecialchars($var_info[languagevar_value], ENT_NOQUOTES), 'languagevar_category' => $var_info[languagevar_category], 'languagevar_default' => $var_info[languagevar_default]); } // GET LANGUAGE PACK LIST $lang_packlist = SE_Language::list_packs(); ksort($lang_packlist); $lang_packlist = array_values($lang_packlist); // ASSIGN VARIABLES AND SHOW ADMIN USER LEVELS PAGE $smarty->assign('language', $language); $smarty->assign('langvars', $langvars); $smarty->assign('lang_packlist', $lang_packlist); $smarty->assign('phrase_id', $phrase_id);
// send_generic($value->document_owner->user_info['user_email'], 'admin', $subject, $message); } } } elseif ($stat == 'ERROR') { $database->database_query("UPDATE se_documents SET document_status = '2' WHERE document_id='{$value->document_info['document_id']}'"); //SENDING AN EMAIL TO THE OWNER // $subject = 'Document conversion failed at scribd'; // $message = 'Document conversion failed at scribd'; // send_generic($value->document_owner->user_info['user_email'], 'admin', $subject, $message); } } $where_browse_listing = $where . " AND (document_status = 1)"; $entries_per_page = 10; // GET TOTAL DOCUMNETS $total_entries = $document->documents_total($where_browse_listing); $page_vars = make_page($total_entries, $entries_per_page, $p); // GET DOCMENTS ARRAY $documents = $document->documents_list($page_vars[0], $entries_per_page, $s, $where_browse_listing, 1); //GETTING TOTAL UNCATEGORIZED DOCUMENTS $uncategorized_where_final = $where . " AND (document_category_id = '0') AND (document_status = 1) "; $total_uncategorized = $document->documents_total($uncategorized_where_final); $smarty->assign('total_uncategorized', $total_uncategorized); //GETTING THE FEATURED DOCUMENTS $fetured_where = $where . " AND (document_featured = '1') AND (document_status = 1) "; $document_featured = $document->documents_list(0, 10, 'document_datecreated DESC', $fetured_where, 1); //GETTING THE DOCUMENT_CATEGORIES AND SUBCATEGORIES $result = $database->database_query("SELECT * FROM se_document_categories WHERE cat_dependency='0' ORDER BY cat_order"); $categories = array(); if ($database->database_num_rows($result) > 0) { while ($info = $database->database_fetch_assoc($result)) { //GETTING SUB CATEGORIES ASSOCIATED WITH THIS CATEGORY
// security filter !! if (in_array($field, $searchable_fields)) { $value = mysql_real_escape_string($value); $search_data[$field] = " $field LIKE '%$value%' "; $search_query .= "search[$field]=".urlencode($value).'&'; } } $criteria = " JOIN se_users ON se_users.user_id = se_educations.education_user_id"; if (count($search_data)) { $criteria .= " WHERE " . join(" $operation ", $search_data); } $criteria .= " ORDER BY user_username ASC"; $all_educations = $rc_education->get_records($criteria, true); $page_vars = make_page(count($all_educations), $educations_per_page, $p); $educations = array_slice($all_educations, $page_vars[0], $educations_per_page); $educations = $rc_education->build_searchable_fields($educations); foreach ($educations as $k=>$e) { $u = new se_user(); $u->user_info[user_id] = $e[user_id]; $u->user_info[user_username] = $e[user_username]; $u->user_info[user_photo] = $e[user_photo]; $educations[$k]['user'] = $u; } } $yearoptions = array(); foreach (range(date('Y') + 4, date('Y') - 100) as $number) {