/** * control * * The controlling structure for this script. * * @return void */ function control() { if (isset($_GET['a'])) { printAvatar(); } elseif (isset($_GET['u'])) { printUpImage(); } }
function printAvatarPhoto($method) { if (isset($_REQUEST['authorid']) && strlen($_REQUEST['authorid']) > 0) { $authorid = explode("@", $_REQUEST['authorid']); $authorid = $authorid[0]; if ($method == "facebook") { $url = "http://graph.facebook.com/{$authorid}/picture?type=large"; //?redirect=false $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "gravatar") { $url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($_REQUEST['authorid']))) . "?s=80&d=mm&r=g"; $data = file_get_contents($url); printAvatar($data, "png"); } elseif ($method == "twitter") { $url = "http://avatars.io/twitter/{$authorid}?size=large"; $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "instagram") { $url = "http://avatars.io/instagram/{$authorid}?size=large"; $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "email") { $url = "http://avatars.io/email/{$_REQUEST['authorid']}?size=large"; $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "logiks") { $profilePhoto = APPROOT . APPS_USERDATA_FOLDER . "profile_photos/{$_REQUEST['authorid']}"; if (file_exists($profilePhoto . ".png")) { header("content-type:image/png"); readfile($profilePhoto . ".png"); } elseif (file_exists($profilePhoto . ".gif")) { header("content-type:image/gif"); readfile($profilePhoto . ".gif"); } elseif (file_exists($profilePhoto . ".jpg")) { header("content-type:image/jpg"); readfile($profilePhoto . ".jpg"); } elseif (file_exists($profilePhoto . ".jpeg")) { header("content-type:image/jpeg"); readfile($profilePhoto . ".jpeg"); } else { printDefaultAvatar(); } } elseif ($method == "photoid") { if (!isset($_REQUEST['src'])) { $_REQUEST['src'] = getConfig("DBTABLE_AVATAR"); if (strlen($_REQUEST['src']) <= 0) { $_REQUEST['src'] = _dbtable("avatar"); } } $lx = _service("viewphoto") . "&type=view&loc=db&dbtbl={$_REQUEST['src']}&image={$_REQUEST['authorid']}"; header("Location:{$lx}"); exit; } } else { printDefaultAvatar(); } }