Example #1
0
session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
if (!isset($_REQUEST["id"])) {
    die;
}
$id = $_REQUEST["id"];
$user->set_last_seen("editing_discussion:{$id}");
$discussion = new QuickDiscussion();
$discussion->load($id, true);
require_once "{$_SESSION["root_path"]}/page_top.php";
?>
<script type="text/javascript">
var attachments = 0;
$(function(){
    // setting the page title
    top.document.title = "<?php 
echo empty($discussion->title) ? translate("Editing post #{$id}", "Soạn bài #{$id}") : translate("Editing {$discussion->title}", "Soạn bài {$discussion->title}");
?>
";
	
	$('#smilies_area_body').load('show/qd_emoticons.php');
})
Example #2
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("front_page");
require_once "{$_SESSION["root_path"]}/page_top.php";
$num_items = isMobile() ? 5 : 10;
$months_back = isMobile() ? 1 : 3;
?>
<script type="text/javascript">
$(function(){
	// setting the page title
	top.document.title = "<?php 
echo translate("Welcome to GCX!", "Chào mừng đến với GCX!");
?>
";
	
	$("#tabs").tabs({
		cache:true,
		load: function (e, ui) {
			$(ui.panel).find(".tab-loading").remove();
		},
Example #3
0
if (isset($_REQUEST["session"])) {
    session_id($_REQUEST["session"]);
}
session_start();
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts/securimage/securimage.php";
$securimage = new Securimage();
if (!$securimage->check($_REQUEST["captcha_code"])) {
    die("error_invalid_captcha");
}
$query = mysql_query("SELECT * FROM `users` WHERE `username` = '{$_POST["username"]}'");
if (mysql_num_rows($query) == 0) {
    die("error_username_not_found");
}
$salt = mysql_fetch_object(mysql_query("SELECT `value` FROM `system` WHERE `name` = 'salt'"));
if (mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `username` = '{$_POST["username"]}' AND `password` = MD5('{$salt->value}{$_POST["password"]}') AND `active` = '1'")) == 0) {
    if (mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `username` = '{$_POST["username"]}' AND `password` = MD5('{$_POST["password"]}')")) == 0) {
        die("error_password_not_correct");
    }
}
if (isset($_POST["save"])) {
    $time = time() + 60 * 60 * 24 * 90;
} else {
    $time = 0;
}
$user = new User($_POST["username"]);
setcookie("user", $user->username, $time, "/");
$_SESSION["user"] = $user->username;
$user->set_last_seen("login");
die("done");
Example #4
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("viewpage:userslist");
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
require_once "{$_SESSION["root_path"]}/page_top.php";
$sortby = "exp";
$sortorder = "DESC";
if (isset($_REQUEST["sort"])) {
    // 'sort' must be 'name___order' format
    list($sortby, $sortorder) = explode("___", $_REQUEST["sort"]);
}
?>
<script type="text/javascript">
$(function(){
    // setting the page title
    $(function(){ top.document.title = "<?php 
echo translate("User list", "Bảng danh thành viên");
?>
"; });
    // qTip crap
    $.fn.qtip.defaults.position.target = $(".mascot");
Example #5
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("user_cp");
if (isset($_REQUEST["inactive_user"]) and mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `username` = '{$_REQUEST["inactive_user"]}' AND `active` = '0'")) > 0) {
    $check = new User($_REQUEST["inactive_user"]);
    if ($check->active != 1) {
        $user = new User($_REQUEST["inactive_user"]);
        $current_user = new User($_SESSION["user"]);
        $editing_others = true;
    }
}
require_once "{$_SESSION["root_path"]}/page_top.php";
?>
<script type="text/javascript">
$(function(){
    // setting the page title
    top.document.title = "<?php 
echo translate("User control panel", "Điều chỉnh cá nhân");
?>
";
Example #6
0
     if (isset($_REQUEST["qd_title"])) {
         $title = addslashes($_REQUEST["qd_title"]);
     }
     if (!($edit = $discussion->edit($title, $_REQUEST["quick_msg"], false, false, $_REQUEST["parent_id"], false, false, $_REQUEST["category"]))) {
         die("editing error");
     }
     $group = $_REQUEST["group"];
     $newDiscussion = new QuickDiscussion();
     $newDiscussion->load($discussion->id);
     mysql_query("UPDATE `images_general` SET `group` = 'quick_discussions:{$newDiscussion->id}:{$group}' , `comment` = '{$_REQUEST["quick_msg"]}' , `attachedto` = 'quick_discussions:{$newDiscussion->id}' WHERE `group` = '{$group}'");
     mysql_query("UPDATE `videos_general` SET `group` = 'quick_discussions:{$newDiscussion->id}:{$group}' , `comment` = '{$_REQUEST["quick_msg"]}' , `attachedto` = 'quick_discussions:{$newDiscussion->id}' WHERE `group` = '{$group}'");
     mysql_query("UPDATE `files_general` SET `group` = 'quick_discussions:{$newDiscussion->id}:{$group}' , `comment` = '{$_REQUEST["quick_msg"]}' , `attachedto` = 'quick_discussions:{$newDiscussion->id}' WHERE `group` = '{$group}'");
     mysql_query("UPDATE `music_general` SET `group` = 'quick_discussions:{$newDiscussion->id}:{$group}' , `comment` = '{$_REQUEST["quick_msg"]}' , `attachedto` = 'quick_discussions:{$newDiscussion->id}' WHERE `group` = '{$group}'");
     $newDiscussion->qd_author->sub_exp($discussion->exp);
     $newDiscussion->qd_author->add_exp($newDiscussion->exp);
     $user->set_last_seen("edited_discussion:{$newDiscussion->id}");
     break;
 case "delete":
     if ($discussion->load($_REQUEST["id"]) != true) {
         die("error");
     }
     // getting the file info if any exists
     $result = mysql_query("SELECT * FROM `files_general` WHERE `attachedto` = 'quick_discussions:{$discussion->id}'");
     while ($row = mysql_fetch_object($result)) {
         $file_path = str_replace('//', '/', "{$_SESSION["root_path"]}/{$row->file_location}");
         if (file_exists($file_path)) {
             unlink($file_path);
         }
     }
     mysql_query("DELETE FROM `files_general` WHERE `attachedto` = 'quick_discussions:{$discussion->id}'");
     // getting the image info if any exists
Example #7
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("view_discussions");
$total_discussions = mysql_num_rows(mysql_query("SELECT * FROM `quick_discussions` WHERE `parent_id` = '0'"));
$perRow = isMobile() ? 1 : 3;
$numPerPage_default = 30;
$numPerPage = $numPerPage_default;
if (isMobile()) {
    $numPerPage = 10;
} elseif (isset($_REQUEST["discussion_numperpage"]) and $_REQUEST["discussion_numperpage"] != 0) {
    $numPerPage = $_REQUEST["discussion_numperpage"];
}
if (isset($_REQUEST["numPerPage"]) and $_REQUEST["numPerPage"] != 0) {
    $numPerPage = $_REQUEST["numPerPage"];
} elseif (isset($_REQUEST["numPerPage"]) and $_REQUEST["numPerPage"] == 0) {
    $numPerPage = $numPerPage_default;
}
setcookie("discussion_numperpage", $numPerPage, 0, "/");
$numPerPage_array = array();
$i = $numPerPage_default;
while ($i < $total_discussions) {
Example #8
0
session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
if (!isset($_REQUEST["who"])) {
    die;
}
$a = new User($_REQUEST["who"]);
$user->set_last_seen("viewpage:profile:{$a->username}");
require_once "{$_SESSION["root_path"]}/page_top.php";
?>
<script type="text/javascript">
// setting the page title
$(function(){
	top.document.title = "<?php 
echo translate(ucfirst($a->name) . "'s profile", "Thông tin của " . $a->name);
?>
";
});
</script>
<div class="wrap" style="margin: 5px 0;">
	<fieldset>
		<legend style="font-size: 1.1em;"><img src="files/site_images/layout/user-32.png" style="vertical-align: middle;"/><span style="vertical-align: middle;"> <?php 
echo $a->get_full_name();
Example #9
0
    }
}
$relative_folder_path = "files/user_avatars";
$absolute_folder_path = str_replace('//', '/', "{$_SESSION["root_path"]}/{$relative_folder_path}");
if (!is_dir($absolute_folder_path)) {
    mkdir($absolute_folder_path, 0755, true);
}
$random_fileNumber = gmdate("U_") . rand(0, 1000);
$filename = "{$user->username}.{$fileExt}";
$file_absolute_path_fullsize = "{$absolute_folder_path}/{$filename}";
$file_absolute_path_thumbnail = "{$absolute_folder_path}/tn_{$filename}";
$file_relative_path_fullsize = "{$relative_folder_path}/{$filename}";
$file_relative_path_thumbnail = "{$relative_folder_path}/tn_{$filename}";
copy($_FILES['Filedata']['tmp_name'], $file_absolute_path_thumbnail);
move_uploaded_file($_FILES['Filedata']['tmp_name'], $file_absolute_path_fullsize);
$img = new SimpleImage();
$img->load($file_absolute_path_thumbnail);
$filetype = $img->image_type;
if ($img->getWidth() > $img->getHeight()) {
    $img->resizeToWidth(150);
} else {
    $img->resizeToHeight(150);
}
$img->save($file_absolute_path_thumbnail, $filetype);
if (!mysql_query("UPDATE `users` SET `avatar` = '{$file_relative_path_fullsize}' WHERE `username` = '{$user->username}'")) {
    die("database_error");
}
if (!isset($_REQUEST["inactive_user"])) {
    $user->set_last_seen("change_user_info:avatar");
}
die("done");
Example #10
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("viewpage:page_not_found:{$queries}");
require_once "{$_SESSION["root_path"]}/page_top.php";
?>
<script type="text/javascript">
$(function(){
    // setting the page title
    $(function(){ top.document.title = "<?php 
echo translate("Page not found", "Trang không tồn tại");
?>
"; });
})
</script>
<div><?php 
echo translate("Page not found", "Trang không tồn tại");
?>
</div>

<?php 
Example #11
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("addnew_discussion");
require_once "{$_SESSION["root_path"]}/page_top.php";
if (isMobile()) {
    ?>
<div style="text-align: center; margin: 10px 0;"><?php 
    echo translate("Unfortunately, adding new discussions on mobile devices isn't available at the moment, I'm currently working on making the form display properly. Please use a computer or try again at a later time.", "Rất tiếc, chức năng đăng thảo luận hiện giờ không hoạt động được trên các hệ thống di động, {$user->me} đang trong quá trình chỉnh sửa để công cụ được hoàn chỉnh hơn. Xin vui lòng sử dụng máy vi tính hoặc xem lại trang này trong tương lai.");
    ?>
</div>
<div style="text-align: center; margin: 10px 0;"><a onClick="load_page('discussions.php');">« <?php 
    echo translate("Return to discussions list", "Trở về danh sách thảo luận");
    ?>
...</a></div>
<?php 
    die;
}
?>

<script type="text/javascript">
Example #12
0
         die("error_newpw_too_short");
     }
     $salt = mysql_fetch_object(mysql_query("SELECT `value` FROM `system` WHERE `name` = 'salt'"));
     $current_password = MD5($salt->value . $_POST["cpassword"]);
     $current_password_no_salt = MD5($_POST["cpassword"]);
     if ($current_password != $user->password and $current_password_no_salt != $user->password) {
         die("error_old_pw_incorrect");
     }
     $new_password = MD5($salt->value . $_POST["password1"]);
     $new_password_no_salt = MD5($_POST["password1"]);
     if ($new_password == $user->password or $new_password_no_salt == $user->password) {
         die("error_same_new_pw");
     }
     $user->set_password($_POST["password1"]);
     if (!isset($_REQUEST["inactive_user"])) {
         $user->set_last_seen("change_user_info:password");
     }
     die("done");
 case "edit_display_name":
     $query = mysql_query("SELECT * FROM `users`");
     while ($row = mysql_fetch_object($query)) {
         if (strtolower($row->display_name) == strtolower($_POST["display_name"])) {
             die("error_display_name_used");
         }
     }
     $user->set_display_name($_POST["display_name"]);
     if (!isset($_REQUEST["inactive_user"])) {
         $user->set_last_seen("change_user_info:display_name");
     }
     die("done");
 case "edit_name":
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"]) or !isset($_REQUEST["id"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("view_discussion:{$_REQUEST["id"]}");
$post = new QuickDiscussion();
$post->load($_REQUEST["id"]);
if (!$post->id) {
    die;
}
$post->mark_read();
require_once "{$_SESSION["root_path"]}/page_top.php";
// add a column to the quick_discussion_read_status table if doesn't exist
mysql_add_column("quick_discussions_read_status", $user->username, "DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'");
?>
<div style="text-align: center; margin: 10px 0;">
	<span style="display: inline-block; vertical-align: middle;"><?php 
if ($post->parent_id > 0) {
    ?>
<img src="files/site_images/layout/discussion-16.png" style="vertical-align: middle;"/><span style="vertical-align: middle;">&nbsp;<a onClick="load_page('view_single_discussion.php?id=<?php 
    echo $post->parent_id;
    ?>
Example #14
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("music_page");
require_once "{$_SESSION["root_path"]}/page_top.php";
?>

<?php 
require_once "{$_SESSION["root_path"]}/page_bottom.php";
Example #15
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"]) or !isset($_REQUEST["id"]) or !isset($_REQUEST["type"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("view_image:{$_REQUEST["type"]}:{$_REQUEST["id"]}");
require_once "{$_SESSION["root_path"]}/page_top.php";
$type = $_GET["type"];
?>
<div>
<?php 
switch ($type) {
    default:
        die;
    case "images_user_avatars":
        $user_being_viewed = new User($_REQUEST["id"]);
        ?>
		<script type="text/javascript">
		$(function(){
			top.document.title = "<?php 
        echo translate("Viewing {$user_being_viewed->name}'s avatar", "Xem hình tượng trưng của {$user_being_viewed->name}");
        ?>
";
Example #16
0
<?php

if (isset($_REQUEST["session"])) {
    session_id($_REQUEST["session"]);
}
session_start();
require_once "{$_SESSION["root_path"]}/inc.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("logout");
setcookie("user", $user->username, time() - 42000, "/");
unset($_SESSION["{$user->username}"]);
unset($_SESSION["in"]);
unset($user);
session_destroy();
die("<script style='text/javascript'> top.location.replace('index.php'); </script>");
Example #17
0
<?php

session_start();
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"]) or !isset($_REQUEST["q"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
require_once "{$_SESSION["root_path"]}/page_top.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("search:{$_REQUEST["q"]}");
if (is_numeric($_REQUEST["q"])) {
    $result = mysql_query("SELECT * FROM `quick_discussions` WHERE `id` = '{$_REQUEST["q"]}'");
    if (mysql_num_rows($result) > 0) {
        echo "<script type='text/javascript'> load_page('view_single_discussion.php?id={$_REQUEST["q"]}'); </script>";
    } else {
        echo "<p>" . translate("No post found...", "Không tìm được bài nào...") . "</p>";
    }
} else {
    $search_query = addslashes(strip_tags($_REQUEST["q"]));
    $result = mysql_query("SELECT * FROM `quick_discussions` WHERE `title` LIKE '%{$search_query}' OR `body` LIKE '%{$search_query}%' ORDER BY `last_touched` DESC");
    if (mysql_num_rows($result) === 0) {
        echo "<p>" . translate("No post found...", "Không tìm được bài nào...") . "</p>";
    } else {
        echo "<div style='text-align: left;'>\n\t\t\t<strong>" . translate(mysql_num_rows($result) . " post(s) found", "Tìm được " . mysql_num_rows($result) . " bài") . ":</strong>\n\t\t\t<ul>";
        while ($row = mysql_fetch_object($result)) {
            $post = new QuickDiscussion();