Example #1
0
if (empty($_FILES)) {
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
if (isset($_REQUEST["inactive_user"]) and mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `username` = '{$_REQUEST["inactive_user"]}' AND `active` = '0'")) > 0) {
    $user = new User($_REQUEST["inactive_user"]);
} else {
    $user = new User($_SESSION["user"]);
}
$fileParts = pathinfo($_FILES['Filedata']['name']);
$fileExt = strtolower($fileParts['extension']);
$img = getimagesize($_FILES['Filedata']['tmp_name']);
if ($img[0] < 100 or $img[1] < 100) {
    die("error_file_too_small");
}
if ($user->avatar_exists()) {
    $current_avatar = "{$_SESSION["root_path"]}/{$user->avatar}";
    $parts = explode("/", $user->avatar);
    $filename = end($parts);
    $current_avatar_thumbnail = $_SESSION["root_path"] . "/" . str_replace($filename, "tn_{$filename}", $user->avatar);
    if (file_exists($current_avatar)) {
        unlink($current_avatar);
    }
    if (file_exists($current_avatar_thumbnail)) {
        unlink($current_avatar_thumbnail);
    }
}
$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);
Example #2
0
    die;
}
$type = $_GET["type"];
require_once "{$_SESSION["root_path"]}/inc.php";
$user = new User($_SESSION["user"]);
switch ($type) {
    case "images_user_avatars":
        if (!isset($_SESSION["user"])) {
            die("You cannot view this image.");
        }
        if (!isset($_GET["id"])) {
            $img = "files/user_avatars/default.png";
        } else {
            $aaa = new User($_GET["id"]);
            if (isset($_GET["thumbnail"])) {
                if ($aaa->avatar_exists()) {
                    $parts = explode("/", $aaa->avatar);
                    $filename = end($parts);
                    $img = str_replace($filename, "tn_{$filename}", $aaa->avatar);
                } else {
                    $img = "files/user_avatars/default.png";
                }
            } else {
                if ($aaa->avatar_exists()) {
                    $img = $aaa->avatar;
                } else {
                    $img = "files/user_avatars/default.png";
                }
            }
        }
        $parts = explode("/", $img);
Example #3
0
function global_check()
{
    unset($_SESSION["global_qtip"]);
    unset($_SESSION["global_errors"]);
    unset($_SESSION["page_path"]);
    $user = new User($_SESSION["user"]);
    $global_errors = array();
    // this array holds any arrays that should be outputted to the current user
    // check user profile to see if it's missing anything
    if ($user->dob == "0000-00-00 00:00:00" or empty($user->dob)) {
        $global_errors[] = translate("The system does not have your <strong>date of birth</strong> on file, please update this now.", "Hệ thống không có <strong>ngày, tháng năm sinh</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_birthday').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if ($user->email == "" or empty($user->email)) {
        $global_errors[] = translate("The system does not have your <strong>email</strong> on file, please update this now.", "Hệ thống không có <strong>địa chỉ điện thư</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_email').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if ($user->address == "" or empty($user->address)) {
        $global_errors[] = translate("The system does not have your <strong>home address</strong> on file, please update this now.", "Hệ thống không có <strong>địa chỉ nhà</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_address').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if ($user->phone_home == "" or empty($user->phone_home) or $user->phone_home == 0) {
        $global_errors[] = translate("The system does not have your <strong>home phone number</strong> on file, please update this now.", "Hệ thống không có <strong>số điện thoại nhà</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_phone_home').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if ($user->phone_cell == "" or empty($user->phone_cell) or $user->phone_cell == 0) {
        $global_errors[] = translate("The system does not have your <strong>cell phone number</strong> on file, please update this now.", "Hệ thống không có <strong>số điện thoại di động</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_phone_cell').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if (!$user->avatar_exists()) {
        $global_errors[] = translate("The system does not have your <strong>avatar</strong> on file, please update this now.", "Hệ thống không có <strong>hình tượng trưng</strong> của {$user->you}, xin vui lòng cập nhật thông tin này.") . "<script type='text/javascript'> \$(function(){ \$('#line_avatar').css('background-color','#FFCCCC'); });</script>";
        $global_qtip = translate("Please provide the missing information. You will not being to view the website if you have not completed this section of the site.", "Xin vui lòng cung cấp thông tin thiếu xót. {$user->you} sẻ không được vào hệ thống nếu {$user->you} chưa cung cấp đầy đủ phần thông tin cá nhân này.");
        $_SESSION["page_path"] = "{$_SESSION["root_path"]}/pages/usercp.php";
    }
    if (isset($global_qtip)) {
        $_SESSION["global_qtip"] = $global_qtip;
    }
    if (!empty($global_errors)) {
        $_SESSION["global_errors"] = $global_errors;
    }
}