function getUserAvatar($params) { if (is_array($params)) { if (isset($params['avatar'])) { if (strpos("#" . $params['avatar'], "http://") || strpos("#" . $params['avatar'], "https://")) { return $params['avatar']; } elseif (isset($params['avatar_type'])) { return _service("avatar") . "&authorid={$data['avatar']}&method={$data['avatar_type']}"; } elseif (is_numeric($data['avatar'])) { return _service("avatar") . "&authorid={$data['avatar']}&method=photoid"; } else { return _service("avatar") . "&authorid={$data['avatar']}&method=email"; } } elseif (isset($params['userid'])) { $params = $params['userid']; } else { return loadMedia("images/user.png"); } } //SQL Type $sql = _db(true)->_selectQ(_dbTable("users", true), "avatar,avatar_type")->_where(array("blocked" => 'false', "userid" => $params)); $res = _dbQuery($sql, true); $data = []; if ($res) { $data = _dbData($res, true); _dbFree($res, true); if (isset($data[0])) { $data = $data[0]; return getUserAvatar($data); } } return loadMedia("images/user.png"); }
function _jsLink($jsLnk, $themeName = null) { if (is_array($jsLnk) && count($jsLnk) <= 0) { return false; } elseif (is_array($jsLnk) && count($jsLnk) == 1 && strlen($jsLnk[0]) == 0) { return false; } elseif (is_string($jsLnk)) { $jsLnk = explode(",", $jsLnk); } if ($themeName == "*" || $themeName == null) { $themeName = APPS_THEME; } $lx = _service("resources", "", "raw") . "&type=js&src=" . implode(",", $jsLnk) . "&theme={$themeName}"; return $lx; }
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 $url = "http://avatars.io/facebook/{$authorid}/large"; $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}/large"; $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "instagram") { $url = "http://avatars.io/instagram/{$authorid}/large"; $data = file_get_contents($url); printAvatar($data, "jpeg"); } elseif ($method == "email") { //d= Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] //r= Maximum rating (inclusive) [ g | pg | r | x ] $url = "http://www.gravatar.com/avatar/"; $url .= md5(strtolower(trim($_REQUEST['authorid']))); $url .= "?s=120&d=identicon&r=g"; $data = file_get_contents($url); printAvatar($data, "png"); //printDefaultAvatar(); } 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(); } }
public function test_service() { $actual = _service('test', 'action1', 'json', array('id' => 30), 'default'); $expected = SiteLocation . 'services/test?site=default&syshash=' . md5(session_id() . _server('REMOTE_ADDR')) . '&action=action1&format=json&id=30'; $this->assertEquals($actual, $expected); }
public function test_service() { $actual = _service('tmp', 'get-user', 'json', array('id' => 30), 'ssf'); $expected = SiteLocation . 'services/tmp/get-user?site=ssf&format=json&id=30'; $this->assertEquals($actual, $expected); }
margin-top: -50px; } </style> <div class="container fluid" style="margin-top:80px"> <div class="row"> <div class="col-sm-6 col-md-4 col-md-offset-4"> <div id="errormsg" style="display:none;">Hello World</div> </div> <div class="col-sm-12 col-md-4 col-md-offset-4"> <div class="panel panel-default"> <div class="panel-heading"> <strong> Sign in to continue</strong> </div> <div class="panel-body"> <form role="form" method="post" action="<?php echo _service("auth"); ?> " autocomplete='off'> <input name=onsuccess type=hidden value="<?php echo SiteLocation . SITENAME; ?> " /> <input name=onerror type=hidden value="*" /> <input name=site type=hidden value="<?php echo SITENAME; ?> " /> <fieldset> <div class="row"> <div class="center-block"> <img class='profile-img' src="<?php
/** * Validates a value. * The accepted values depend on the {@link MetadataFactoryInterface} implementation. * * @param mixed $value The value to validate * @param array|null $groups The validation groups to validate. * @param boolean $traverse Whether to traverse the value if it is traversable. * @param boolean $deep Whether to traverse nested traversable values recursively. * @return ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded. */ function _validate($value, $groups = null, $traverse = false, $deep = false) { return _service('validator')->validate($value, $groups, $traverse, $deep); }