$result = global_common::updateDeleteFlag($contentID, $IDName, $strTableName, $_pgR["status"], $objConnection); } $arrHeader = global_common::getMessageHeaderArr($banCode = 0, 0); $arrKey = array("rs", "id"); $arrValue = array($result ? 1 : 0, $contentID); $arrIsMetaData = array(0, 1); echo global_common::convertToXML($arrHeader, $arrKey, $arrValue, $arrIsMetaData); return; } elseif ($_pgR['act'] == Model_Comment::ACT_BAD_COMMENT) { if (global_common::isCLogin()) { $c_userInfo = $_SESSION[global_common::SES_C_USERINFO]; $commentID = $_pgR["id"]; $isBad = $_pgR["isbad"]; $strTableName = Model_CommentBad::TBL_SL_COMMENT_BAD; $comment = $objComment->getCommentByID($commentID); $user = $objUser->getUserByID($comment[global_mapping::CreatedBy]); if ($user && $comment) { $isSent = true; $description = "Restore Comment"; if ($isBad) { $description = "Bad Comment"; $userEmail = $user[global_mapping::Email]; $fullName = $user[global_mapping::FullName]; $linkArticle = global_common::getHostName() . '/article_detail.php?aid=' . $comment[global_mapping::ArticleID]; $commentDate = global_common::formatDateTimeVN($comment[global_mapping::CreatedDate]); $commentContent = $comment[global_mapping::Content]; $linkPolicy = global_common::getHostName() . '/' . global_common::PAGE_TERM_KM; $arrMailContent = global_common::formatMailContent(global_common::TEAMPLATE_BAD_COMMENT, null, array(global_common::formatOutputText($fullName), $linkArticle, $commentDate, $commentContent, $linkPolicy)); $emailSubject = $arrMailContent[0]; $emailContent = $arrMailContent[1]; $isSent = global_mail::send($userEmail, $fullName, $emailSubject, $emailContent, null, global_common::SUPPORT_MAIL_USERNAME, global_common::SUPPORT_MAIL_PASSWORD, global_common::SUPPORT_MAIL_DISPLAY_NAME);
$allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/x-png" || $_FILES["file"]["type"] == "image/png") && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { global_common::writeLog($_FILES["file"]["error"]); //echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { //if (file_exists("upload/" . $_FILES["file"]["name"])) //{ $manipulator = new ImageManipulator($_FILES["file"]["tmp_name"]); // resizing to 200x200 $manipulator->resample($_FILES["file"]["tmp_name"], $_FILES["file"]["type"], 200, 200); //echo "after"; $fileName = global_common::FOLDER_AVATAR . $currentUser[global_mapping::UserID] . '_' . $_FILES["file"]["name"]; $userUpdate = $objUser->getUserByID($currentUser[global_mapping::UserID]); $userUpdate[global_mapping::Avatar] = $fileName; //echo $fileName; //echo $userUpdate[global_mapping::IsActive]; $result = $objUser->update($userUpdate[global_mapping::UserID], $userUpdate[global_mapping::UserName], $userUpdate[global_mapping::Password], $userUpdate[global_mapping::FullName], $userUpdate[global_mapping::BirthDate], $userUpdate[global_mapping::Address], $userUpdate[global_mapping::Phone], $userUpdate[global_mapping::Email], $userUpdate[global_mapping::Sex], $userUpdate[global_mapping::Identity], $userUpdate[global_mapping::RoleID], $userUpdate[global_mapping::UserRankID], $userUpdate[global_mapping::Avatar], $userUpdate[global_mapping::AccountID], $userUpdate[global_mapping::IsActive]); //echo $result; $_SESSION[global_common::SES_C_USERINFO] = $currentUser = $userUpdate; move_uploaded_file($_FILES["file"]["tmp_name"], $fileName); //} //else //{ // move_uploaded_file($_FILES["file"]["tmp_name"], // global_common::FOLDER_AVATAR . $currentUser[global_mapping::UserID].$_FILES["file"]["name"]); //} } } else {
$email = html_entity_decode($email, ENT_COMPAT, 'UTF-8'); $sex = $_pgR['sex']; $sex = html_entity_decode($sex, ENT_COMPAT, 'UTF-8'); $phone = $_pgR['phone']; $phone = html_entity_decode($phone, ENT_COMPAT, 'UTF-8'); $address = $_pgR['address']; $city = $_pgR['city']; $address = html_entity_decode($address, ENT_COMPAT, 'UTF-8'); $currentUser = $_SESSION[global_common::SES_C_USERINFO]; if ($objUser->checkExistEmail($email, $currentUser[global_mapping::UserID])) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(3, 'Email đã tồn tại'), array(0, 1)); return; } $userUpdate = $objUser->getUserByID($currentUser[global_mapping::UserID]); $userUpdate[global_mapping::FullName] = $fullname; $userUpdate[global_mapping::BirthDate] = $birthDate; $userUpdate[global_mapping::Address] = $address; $userUpdate[global_mapping::Phone] = $phone; $userUpdate[global_mapping::Email] = $email; $userUpdate[global_mapping::Sex] = $sex; $userUpdate[global_mapping::CityID] = $city; $result = $objUser->update($userUpdate[global_mapping::UserID], $userUpdate[global_mapping::UserName], $userUpdate[global_mapping::Password], $userUpdate[global_mapping::FullName], $userUpdate[global_mapping::BirthDate], $userUpdate[global_mapping::Address], $userUpdate[global_mapping::Phone], $userUpdate[global_mapping::Email], $userUpdate[global_mapping::Sex], $userUpdate[global_mapping::Identity], $userUpdate[global_mapping::RoleID], $userUpdate[global_mapping::UserRankID], $userUpdate[global_mapping::Avatar], $userUpdate[global_mapping::AccountID], $userUpdate[global_mapping::IsActive], $userUpdate[global_mapping::CityID]); if ($result) { $_SESSION[global_common::SES_C_USERINFO] = $objUser->getUserByID($currentUser[global_mapping::UserID]); $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(1, 'Cập nhật thành công'), array(0, 1)); return; } else {
} else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed'), array(0, 1)); return; } } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed. Password not matched'), array(0, 1)); return; } } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed. You have no permision to perform this'), array(0, 1)); return; } } else { if ($_pgR["act"] == Model_User::ACT_GET) { $userID = $_pgR[global_mapping::UserID]; $userInfo = $objUser->getUserByID($userID); if ($userInfo) { echo global_common::convertToXML($strMessageHeader, array("rs", "content"), array(1, json_encode($userInfo)), array(0, 1)); } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, "Data is invalid. Pleae try again later"), array(0, 1)); } return; } } //$catID = $_pgR["cid"]; $page = $_pgR["p"]; if (!$page) { $page = 1; } $keyword = $_pgR["keyword"]; if ($keyword) {
} else { echo global_common::convertToXML($arrHeader, array("rs"), array(0), array(0)); return; } } else { echo global_common::convertToXML($arrHeader, array("rs", 'info'), array(0, global_common::STRING_REQUIRE_LOGIN), array(0, 1)); } return; } elseif ($_pgR['act'] == model_User::ACT_CHANGE_PAGE) { $intPage = $_pgR['p']; $outPutHTML = $objUser->getListUser($intPage); echo global_common::convertToXML($strMessageHeader, array('rs', 'inf'), array(1, $outPutHTML), array(0, 1)); return; } elseif ($_pgR['act'] == model_User::ACT_SHOW_EDIT) { $strUserID = $_pgR['id']; $arrUser = $objUser->getUserByID($strUserID); echo global_common::convertToXML($strMessageHeader, array('rs', 'UserID', 'UserName', 'Password', 'Fullname', 'BirthDate', 'Address', 'Phone', 'Email', 'Sex', 'Identity', 'RoleID', 'UserRankID', 'Avatar', 'AccountID', 'IsActived'), array(1, 'UserID', 'UserName', 'Password', 'Fullname', 'BirthDate', 'Address', 'Phone', 'Email', 'Sex', 'Identity', 'RoleID', 'UserRankID', 'Avatar', 'AccountID', 'IsActived'), array(0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0)); return; } elseif ($_pgR["act"] == model_User::ACT_GET) { $sectionID = $_pgR["sect"]; $arrSection = $objMenu->getAllMenuBySection($sectionID); if ($arrSection) { $strHTML = $objMenu->outputHTMLMenu($arrSection); echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, $strHTML), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", 'inf'), array(0, 'Kh?ng c? nh?m h?ng'), array(0, 0)); return; } } elseif ($_pgR['act'] == model_User::ACT_DELETE) { $IDName = "menu_id";
<?php /* TODO: Add code here */ require 'config/globalconfig.php'; include_once 'include/_permission.inc'; include_once 'class/model_user.php'; include_once 'class/model_city.php'; require_once 'lib/ImageManipulator.php'; $objUser = new Model_User($objConnection); $userID = Urlcrypt::decode($_pgR["uid"]); $currentUser = $objUser->getUserByID($userID); if (!$currentUser) { return; } ?> <?php include_once 'include/_header.inc'; include_once 'include/_menu.inc'; //print_r($_SESSION[global_common::SES_C_USERINFO]); ?> <div id="profile-page" class="page-content"> <div class="row-fluid"> <div class="span12"> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> Thông tin người đăng </h3> </div> </div>