unlink($_POST['profileimage']); } $Name = "profile" . intval(rand() * rand() / rand()); $Img = new FileData($_FILES['image'], "../../../skin/images/profiles/temp/", $Name); echo $Img->BuildImage(200, 200); die; } } switch (strtolower($_POST['action'])) { case 'insert': $Temp = $_POST['profileimage']; $Profile = new ProfileData(); if ($Temp) { $Tmp = array_reverse(explode("/", $Temp)); $Image = "../../../skin/images/profiles/" . $Tmp[0]; MoveImage($Image, $Temp); } else { $Image = $Profile->GetDefaultImg(); } $Title = htmlentities(strtolower($_POST['title'])); $Menues = $_POST['menues'] ? explode(",", $_POST['menues']) : array(); $Insert = $DB->execQuery('insert', 'admin_profile', 'title,image,status,creation_date', "'" . $Title . "','" . $Image . "','A',NOW()"); $ID = $DB->GetInsertId(); for ($i = 0; $i < count($Menues); $i++) { $Values .= $i == 0 ? $ID . "," . $Menues[$i] : "),(" . $ID . "," . $Menues[$i]; } $DB->execQuery('insert', 'relation_menu_profile', 'profile_id,menu_id', $Values); die; break; case 'update': $ID = $_POST['id'];
function GetBigAvatar($uid) { $member = M("member")->alias("m")->where(array("m.id" => $uid))->join("left join __MEMBER_BIND__ mb on mb.uid = m.id and mb.type='weixin'")->field("m.avatar3,mb.info as weixin")->find(); if ($member) { if ($member['avatar1']) { return GetImage($member['avatar1']); } if ($member['weixin']) { $array = json_decode($member['weixin'], true); if (!empty($array) && is_array($array) && isset($array['headimgurl']) && 0 != strlen($array['headimgurl'])) { return $array['headimgurl']; } } $_uid = sprintf("%09d", $uid); $dir1 = substr($_uid, 0, 3); $dir2 = substr($_uid, 3, 2); $dir3 = substr($_uid, 5, 2); $dir4 = substr($_uid, 7, 2); $home = $dir1 . '/' . $dir2 . '/' . $dir3 . '/' . $dir4; $path = 'Ucenter/data/avatar/' . $home . '_avatar_big.jpg'; if (file_exists($path)) { $avatar = MoveImage($path); M("member")->where("id={$uid}")->save(array("avatar1" => $avatar)); return GetImage($avatar); } } return 'http://www.alhelp.net/ucenter/images/noavatar_big.gif'; }