function fileURL($filename) { $fileURL = getServerURL() . '/admin/reseller_locator/products/product_images/' . $filename; // if($GLOBALS['debug']) { // echo 'file\'s full path on the webserver: ' . $fileURL; // } return $fileURL; }
/** * Build a URL to a server action */ function buildURL($action = null, $escaped = true) { $url = getServerURL(); if ($action) { $url .= '/' . $action; } return $escaped ? htmlspecialchars($url, ENT_QUOTES) : $url; }
/** * Instantiate a new OpenID server object */ function getServer() { global $CONFIG; static $server; $op_endpoint = getServerURL(); if (!isset($server)) { $server =& new Auth_OpenID_Server(getOpenIDServerStore(), $op_endpoint); } return $server; }
function authCancel($info) { if ($info) { setRequestInfo(); $url = $info->getCancelURL(); } else { $url = getServerURL(); } return redirect_render($url); }
/** * Handle a standard OpenID server request */ function action_default() { global $store; $server =& getServer(); $method = $_SERVER['REQUEST_METHOD']; /*$request = null; if ($method == 'GET') { $request = $_GET; } else { $request = $_POST; } */ $request = $server->decodeRequest(); if (!$request) { return ""; //about_render(); } setRequestInfo($request); if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) { $identity = getLoggedInUser(); if (isTrusted($identity, $request->trust_root, $request->return_to)) { if ($request->message->isOpenID1()) { $response =& $request->answer(true); } else { $response =& $request->answer(true, false, getServerURL(), $identity); } } else { if ($request->immediate) { $response =& $request->answer(false, getServerURL()); } else { if (!getLoggedInUser()) { $_SESSION['last_forward_from'] = current_page_url() . '?' . http_build_query(Auth_OpenID::getQuery()); system_message(elgg_echo('openid_server:not_logged_in')); forward('login'); } return trust_render($request); } } addSregFields(&$response); } else { $response =& $server->handleRequest($request); } $webresponse =& $server->encodeResponse($response); foreach ($webresponse->headers as $k => $v) { header("{$k}: {$v}"); } header(header_connection_close); print $webresponse->body; exit(0); }
/** * Handle a standard OpenID server request */ function action_default() { $server =& getServer(); $method = $_SERVER['REQUEST_METHOD']; $request = null; if ($method == 'GET') { $request = $_GET; } else { $request = $_POST; } $request = Auth_OpenID::fixArgs($request); $request = $server->decodeRequest($request); if (!$request) { return about_render(); } setRequestInfo($request); if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) { if (isTrusted($request->identity, $request->trust_root)) { $response =& $request->answer(true); $sreg = getSreg($request->identity); if (is_array($sreg)) { foreach ($sreg as $k => $v) { $response->addField('sreg', $k, $v); } } } else { if ($request->immediate) { $response =& $request->answer(false, getServerURL()); } else { if (!getLoggedInUser()) { return login_render(); } return trust_render($request); } } } else { $response =& $server->handleRequest($request); } $webresponse =& $server->encodeResponse($response); foreach ($webresponse->headers as $k => $v) { header("{$k}: {$v}"); } header(header_connection_close); print $webresponse->body; exit(0); }
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $extra = ""; if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("profile", $user["id"], "", "_"); } else { $link = getServerURL() . "?uid=" . $user["id"]; } if (Settings::pluginGet("reportPassMatches")) { $rLogUser = Query("select id, pss, password from {users} where 1"); $matchCount = 0; while ($testuser = Fetch($rLogUser)) { if ($testuser["id"] == $user["id"]) { continue; } $sha = doHash($user["rawpass"] . $salt . $testuser['pss']); if ($testuser['password'] == $sha) { $matchCount++; } } if ($matchCount) { $extra .= "-- " . Plural($matchCount, "password match") . " "; } } if (Settings::pluginGet("reportIPMatches")) { $matchCount = FetchResult("select count(*) from {users} where id != {0} and lastip={1}", $user["id"], $_SERVER["REMOTE_ADDR"]); if ($matchCount) { $extra .= "-- " . Plural($matchCount, "IP match") . " "; }
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $thename = $loguser["name"]; if ($loguser["displayname"]) { $thename = $loguser["displayname"]; } if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("thread", $tid, "", "_"); } else { $link = getServerURL() . "?tid=" . $tid; } if ($forum['minpower'] <= 0) { ircReport("" . $c2 . "New thread by{$c1} " . ircUserColor($thename, $loguser['sex'], $loguser['powerlevel']) . "{$c2}: {$c1}" . $thread["title"] . "{$c2} (" . $forum["title"] . ")" . " -- " . $link); }
setRequestInfo($info); $req_url_path = substr($req_url, strpos($req_url, ":")); $user_path = substr($user, strpos($user, ":")); if ($info->message->isOpenID1() && $req_url_path != $user_path) { register_error(sprintf(elgg_echo("openid_server:loggedin_as_wrong_user"), $req_url, $user)); forward(); } else { $trust_root = $info->trust_root; $trusted = isset($trusted) ? $trusted : isTrusted($identity, $trust_root); if ($trusted) { setRequestInfo(); $server =& getServer(); if ($info->message->isOpenID1()) { $response =& $info->answer(true, null, $req_url); } else { $response =& $info->answer(true, null, getServerURL(), $identity); } addSregFields($response, $info, $identity); $webresponse =& $server->encodeResponse($response); $new_headers = array(); foreach ($webresponse->headers as $k => $v) { $new_headers[] = $k . ": " . $v; } writeResponse(array($new_headers, $webresponse->body)); exit(0); } elseif ($fail_cancels) { setRequestInfo(); forward($info->getCancelURL()); } else { writeResponse(trust_render($info)); }
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $thename = $loguser["name"]; if ($loguser["displayname"]) { $thename = $loguser["displayname"]; } if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("post", $pid, "", "_"); } else { $link = getServerURL() . "?pid=" . $pid; } if ($forum['minpower'] <= 0) { ircReport("" . $c2 . "New reply by{$c1} " . ircUserColor($thename, $loguser['sex'], $loguser['powerlevel']) . "{$c2}: {$c1}" . $thread["title"] . "{$c2} (" . $forum["title"] . ")" . " -- " . $link); }
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $thename = $loguser["name"]; if ($loguser["displayname"]) { $thename = $loguser["displayname"]; } $uncolor = ircUserColor($thename, $loguser['sex'], 0); if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("objectdbchanges", $sprite['id'], 'rev=' . $rev, '_'); } else { $link = getServerURL() . "?page=objectdbchanges&id={$sprite['id']}&rev={$rev}"; } ircReport("{$c2}Object {$c1}{$spritename} ({$sprite['id']}) {$c2}edited by {$c1}{$uncolor} {$c2}(rev. {$rev}) -- {$link}");
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $thename = $loguser["name"]; if ($loguser["displayname"]) { $thename = $loguser["displayname"]; } $uncolor = ircUserColor($thename, $loguser['sex'], 0); if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("objectdbchanges", $id, 'rev=' . $previousrev, '_'); } else { $link = getServerURL() . "?page=objectdbchanges&id={$id}&rev={$previousrev}"; } $objname = FetchResult("SELECT s.name FROM {sprites} s LEFT JOIN {spriterevisions} sr ON sr.id=s.id AND sr.revision=s.revision WHERE s.id={0}", $id); ircReport("{$c2}Object {$c1}{$objname} ({$id}) {$c2}reverted by {$c1}{$uncolor} {$c2}(rev. {$previousrev}) -- {$link}");
<?php $c1 = ircColor(Settings::pluginGet("color1")); $c2 = ircColor(Settings::pluginGet("color2")); $thename = $loguser["name"]; if ($loguser["displayname"]) { $thename = $loguser["displayname"]; } $uncolor = ircUserColor($thename, $loguser['sex'], 0); if ($urlRewriting) { $link = getServerURLNoSlash() . actionLink("wiki", $page['id'], '', '_'); } else { $link = getServerURL() . "?page=wiki&id=" . $page['id']; } if ($page['new'] == 2) { ircReport("{$c2}New wiki page: {$c1}" . url2title($page['id']) . " {$c2}created by {$c1}{$uncolor} {$c2} -- {$link}"); } else { ircReport("{$c2}Wiki page {$c1}" . url2title($page['id']) . " {$c2}edited by {$c1}{$uncolor} {$c2}(rev. {$rev}) -- {$link}"); }
function getFullRequestedURL($https = false) { return getServerURL($https) . $_SERVER['REQUEST_URI']; }
function getRequestURL() { $serverURL = getServerURL(); $requestURL = $_SERVER['REQUEST_URI']; return $serverURL . $requestURL; }
function send_cancel($info) { if ($info) { $url = $info->getCancelURL(); } else { $url = getServerURL(); } return redirect_render($url); }
function getCompleteURL() { return getServerURL() . $_SERVER["REQUEST_URI"]; }
function render_admin($method, &$request, &$template) { global $auth, $storage; Server_needAuth($request); Server_needAdmin(); if (array_key_exists('username', $request)) { $username = $request['username']; $pass1 = $request['pass1']; $pass2 = $request['pass2']; $success = true; $errors = Server_accountCheck($username, $pass1, $pass2); if ($errors) { foreach ($errors as $e) { $template->addError($e); } } else { // Good. if ($username != ADMIN_USERNAME && $auth->newAccount($username, $pass1, $request)) { // Add an identity URL to storage. $storage->addIdentifier($username, Server_getAccountIdentifier($username)); Server_addMessage('Account created.'); Server_redirect(getServerURL(), 'admin'); } else { $template->addError("Sorry; the username '{$username}' is already taken!"); } } } else { if (array_key_exists('remove', $request)) { foreach ($request['account'] as $account => $on) { $auth->removeAccount($account); $storage->removeAccount($account); } Server_addMessage('Account(s) removed.'); Server_redirect(getServerURL() . "?search=" . $request['search'], 'admin'); } } if (array_key_exists('search', $request) && ($request['search'] || array_key_exists('showall', $request))) { // Search for accounts. if (array_key_exists('showall', $request)) { $results = $auth->search(); $template->assign('showall', 1); } else { $results = $auth->search($request['search']); } $template->assign('search', $request['search']); $template->assign('search_results', $results); } $template->display('admin.tpl'); }