当前位置: 首页>>代码示例>>PHP>>正文


PHP Q_Request::baseUrl方法代码示例

本文整理汇总了PHP中Q_Request::baseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Request::baseUrl方法的具体用法?PHP Q_Request::baseUrl怎么用?PHP Q_Request::baseUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q_Request的用法示例。


在下文中一共展示了Q_Request::baseUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Shipping_scheduled_response_content

function Shipping_scheduled_response_content($params)
{
    // redirect to home page if not logged in
    if (!Users::loggedInUser()) {
        header("Location: " . Q_Request::baseUrl());
        exit;
    }
    // get "Shipping/shipments" stream
    $publisherId = Users::communityId();
    $streamName = 'Shipping/shipment/' . Q_Request::uri()->shipmentStreamName;
    $stream = Streams::fetchOne($publisherId, $publisherId, $streamName);
    //$xml = simplexml_load_file(APP_DIR.'/classes/dhl/response.xml');
    //$xml = simplexml_load_string(str_replace('req:', '', file_get_contents(APP_DIR.'/classes/dhl/response.xml')));
    //print_r($xml); exit;
    // test pickup
    //$carrier = new Shipping_Carrier_DHL();
    //$carrier->createAWBBarCode($stream, 'iVBORw0KGgoAAAANSUhEUgAAAYwAAABeAQMAAAAKdrGZAAAABlBMVEX///8AAABVwtN+AAAAaklEQVR42mNkYGBIyL8wZcutG2wTzVMZfG99eep7y1tp5oIokaMMOtabG6PuTflrnnHqVfI013vzlRYwMDAxkAxGtYxqGdUyqmVUy6iWUS2jWka1jGoZ1TKqZVTLqJZRLaNaRrWMaiEVAABqDRe8DYfcJgAAAABJRU5ErkJggg==', "AWBBarCode");
    // -----------
    //echo Shipping::getShipmentRelation($stream, true);
    //unlink("/tmp/dhl-api-autoload.php");
    if (!$stream || !$stream->testReadLevel('see')) {
        throw new Users_Exception_NotAuthorized();
    }
    return Q::view('Shipping/content/scheduled.php', compact('streamName'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:25,代码来源:content.php

示例2: Users_user_response_data

function Users_user_response_data($params)
{
    // Get Gravatar info
    // WARNING: INTERNET_REQUEST
    $hash = md5(strtolower(trim($identifier)));
    $thumbnailUrl = Q_Request::baseUrl() . "/action.php/Users/thumbnail?hash={$hash}&size=80&type=" . Q_Config::get('Users', 'login', 'iconType', 'wavatar');
    $json = @file_get_contents("http://www.gravatar.com/{$hash}.json");
    $result = json_decode($json, true);
    if ($result) {
        if ($type === 'email') {
            $result['emailExists'] = !empty($exists);
        } else {
            if ($type === 'mobile') {
                $result['mobileExists'] = !empty($exists);
            }
        }
        return $result;
    }
    // otherwise, return default
    $email_parts = explode('@', $identifier, 2);
    $result = array("entry" => array(array("id" => "571", "hash" => "357a20e8c56e69d6f9734d23ef9517e8", "requestHash" => "357a20e8c56e69d6f9734d23ef9517e8", "profileUrl" => "http://gravatar.com/test", "preferredUsername" => ucfirst($email_parts[0]), "thumbnailUrl" => $thumbnailUrl, "photos" => array(), "displayName" => "", "urls" => array())));
    if ($type === 'email') {
        $result['emailExists'] = !empty($exists);
    } else {
        $result['mobileExists'] = !empty($exists);
    }
    if ($terms_label = Users::termsLabel('register')) {
        $result['termsLabel'] = $terms_label;
    }
    return $result;
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:31,代码来源:data.php

示例3: Users_label_post

/**
 * Adds a label to the system. Fills the "label" (and possibly "icon") slot.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.title The title of the label
 * @param {string} [$_REQUEST.label] You can override the label to use
 * @param {string} [$_REQUEST.icon] Optional path to an icon
 * @param {string} [$_REQUEST.userId=Users::loggedInUser(true)->id] You can override the user id, if another plugin adds a hook that allows you to do this
 */
function Users_label_post($params = array())
{
    $req = array_merge($_REQUEST, $params);
    Q_Request::requireFields(array('title'), $req, true);
    $loggedInUserId = Users::loggedInUser(true)->id;
    $userId = Q::ifset($req, 'userId', $loggedInUserId);
    $icon = Q::ifset($req, 'icon', null);
    $title = $req['title'];
    $l = Q::ifset($req, 'label', 'Users/' . Q_Utils::normalize($title));
    Users::canManageLabels($loggedInUserId, $userId, $l, true);
    $label = new Users_Label();
    $label->userId = $userId;
    $label->label = $l;
    if ($label->retrieve()) {
        throw new Users_Exception_LabelExists();
    }
    $label->title = $title;
    if (is_array($icon)) {
        // Process any icon that was posted
        $icon['path'] = 'uploads/Users';
        $icon['subpath'] = "{$userId}/label/{$label}/icon";
        $data = Q::event("Q/image/post", $icon);
        Q_Response::setSlot('icon', $data);
        $label->icon = Q_Request::baseUrl() . '/' . $data[''];
    } else {
        $label->icon = 'default';
    }
    $label->save();
    Q_Response::setSlot('label', $label->exportArray());
}
开发者ID:atirjavid,项目名称:Platform,代码行数:38,代码来源:post.php

示例4: Streams_after_Q_image_save

function Streams_after_Q_image_save($params)
{
    $user = Users::loggedInUser(true);
    $path = $subpath = $data = $save = null;
    extract($params, EXTR_OVERWRITE);
    if (isset(Users::$cache['iconUrlWasChanged']) and Users::$cache['iconUrlWasChanged'] === false) {
        // the logged-in user's icon was changed without the url changing
        $stream = Streams::fetchOne($user->id, $user->id, "Streams/user/icon");
    } else {
        if (!empty(Streams::$cache['canWriteToStream'])) {
            // some stream's icon was being changed
            $stream = Streams::$cache['canWriteToStream'];
        }
    }
    if (empty($stream)) {
        return;
    }
    $url = $data[''];
    $stream->icon = Q_Valid::url($url) ? $url : Q_Request::baseUrl() . '/' . $url;
    $sizes = array();
    foreach ($save as $k => $v) {
        $sizes[] = "{$k}";
    }
    sort($sizes);
    $stream->setAttribute('sizes', $sizes);
    if (empty(Streams::$beingSavedQuery)) {
        $stream->changed($user->id);
    } else {
        $stream->save();
    }
}
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:Q_image_save.php

示例5: Streams_after_Q_file_save

function Streams_after_Q_file_save($params)
{
    $user = Users::loggedInUser(true);
    $path = $subpath = $name = $writePath = $data = $tailUrl = null;
    extract($params, EXTR_OVERWRITE);
    if (!empty(Streams::$cache['canWriteToStream'])) {
        // some stream's associated file was being changed
        $stream = Streams::$cache['canWriteToStream'];
    }
    if (empty($stream)) {
        return;
    }
    $filesize = filesize($writePath . DS . $name);
    $url = $tailUrl;
    $url = Q_Valid::url($url) ? $url : Q_Request::baseUrl() . '/' . $url;
    $prevUrl = $stream->getAttribute('file.url');
    $stream->setAttribute('file.url', $url);
    $stream->setAttribute('file.size', $filesize);
    // set the title and icon every time a new file is uploaded
    $stream->title = $name;
    $parts = explode('.', $name);
    $urlPrefix = Q_Request::baseUrl() . '/plugins/Streams/img/icons/files';
    $dirname = STREAMS_PLUGIN_FILES_DIR . DS . 'Streams' . DS . 'icons' . DS . 'files';
    $extension = end($parts);
    $stream->icon = file_exists($dirname . DS . $extension) ? "{$urlPrefix}/{$extension}" : "{$urlPrefix}/_blank";
    if (empty(Streams::$beingSavedQuery)) {
        $stream->changed($user->id);
    } else {
        $stream->save();
    }
}
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:Q_file_save.php

示例6: Users_label_put

/**
 * Edits a label in the system. Fills the "label" (and possibly "icon") slot.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.label The label
 * @param {string} [$_REQUEST.title] The title of the label
 * @param {string} [$_REQUEST.icon] Optional path to an icon
 * @param {string} [$_REQUEST.userId=Users::loggedInUser(true)->id] You can override the user id, if another plugin adds a hook that allows you to do this
 */
function Users_label_put($params = array())
{
    $req = array_merge($_REQUEST, $params);
    Q_Request::requireFields(array('label'), $req, true);
    $loggedInUserId = Users::loggedInUser(true)->id;
    $userId = Q::ifset($req, 'userId', $loggedInUserId);
    $l = $req['label'];
    $icon = Q::ifset($req, 'icon', null);
    $title = Q::ifset($req, 'title', null);
    Users::canManageLabels($loggedInUserId, $userId, $l, true);
    $label = new Users_Label();
    $label->userId = $userId;
    $label->label = $l;
    if (!$label->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'Label', 'criteria' => json_encode($label->fields)));
    }
    if (isset($title)) {
        $label->title = $title;
    }
    if (is_array($icon)) {
        // Process any icon data
        $icon['path'] = 'uploads/Users';
        $icon['subpath'] = "{$userId}/label/{$label}/icon";
        $data = Q::event("Q/image/post", $icon);
        Q_Response::setSlot('icon', $data);
        $label->icon = Q_Request::baseUrl() . '/' . $data[''];
    }
    $label->save();
    Q_Response::setSlot('label', $label->exportArray());
}
开发者ID:atirjavid,项目名称:Platform,代码行数:38,代码来源:put.php

示例7: Users_user_response_data

function Users_user_response_data($params)
{
    $identifier = Users::requestedIdentifier($type);
    // check our db
    if ($user = Users::userFromContactInfo($type, $identifier)) {
        $verified = !!Users::identify($type, $identifier);
        return array('exists' => $user->id, 'verified' => $verified, 'username' => $user->username, 'icon' => $user->icon, 'passphrase_set' => !empty($user->passphraseHash), 'fb_uid' => $user->fb_uid ? $user->fb_uid : null);
    }
    if ($type === 'email') {
        $email = new Users_Email();
        Q_Valid::email($identifier, $normalized);
        $email->address = $normalized;
        $exists = $email->retrieve();
    } else {
        if ($type === 'mobile') {
            $mobile = new Users_Mobile();
            Q_Valid::phone($identifier, $normalized);
            $mobile->number = $normalized;
            $exists = $mobile->retrieve();
        }
    }
    if (empty($exists) and Q_Config::get('Users', 'login', 'noRegister', false)) {
        $nicetype = $type === 'email' ? 'email address' : 'mobile number';
        throw new Q_Exception("This {$nicetype} was not registered", array('identifier'));
    }
    // Get Gravatar info
    // WARNING: INTERNET_REQUEST
    $hash = md5(strtolower(trim($identifier)));
    $thumbnailUrl = Q_Request::baseUrl() . "/action.php/Users/thumbnail?hash={$hash}&size=80&type=" . Q_Config::get('Users', 'login', 'iconType', 'wavatar');
    $json = @file_get_contents("http://www.gravatar.com/{$hash}.json");
    $result = json_decode($json, true);
    if ($result) {
        if ($type === 'email') {
            $result['emailExists'] = !empty($exists);
        } else {
            if ($type === 'mobile') {
                $result['mobileExists'] = !empty($exists);
            }
        }
        return $result;
    }
    // otherwise, return default
    $email_parts = explode('@', $identifier, 2);
    $result = array("entry" => array(array("id" => "571", "hash" => "357a20e8c56e69d6f9734d23ef9517e8", "requestHash" => "357a20e8c56e69d6f9734d23ef9517e8", "profileUrl" => "http://gravatar.com/test", "preferredUsername" => ucfirst($email_parts[0]), "thumbnailUrl" => $thumbnailUrl, "photos" => array(), "displayName" => "", "urls" => array())));
    if ($type === 'email') {
        $result['emailExists'] = !empty($exists);
    } else {
        $result['mobileExists'] = !empty($exists);
    }
    if ($terms_label = Users::termsLabel('register')) {
        $result['termsLabel'] = $terms_label;
    }
    return $result;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:54,代码来源:data.php

示例8: Streams_message_tool

function Streams_message_tool($options)
{
    extract($options);
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    if (empty($publisherId)) {
        $publisherId = Streams::requestedPublisherId();
    }
    if (empty($publisherId)) {
        $publisherId = $_REQUEST['publisherId'] = $user->id;
    }
    if (empty($name)) {
        $name = Streams::requestedName(true);
    }
    $stream = Streams::fetch($user->id, $publisherId, $name);
    $stream = !empty($stream) ? reset($stream) : null;
    if (!$stream) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
    }
    if (!$stream->testReadLevel('messages') || !$stream->testWriteLevel('post')) {
        throw new Users_Exception_NotAuthorized();
    }
    $hidden = array('publisherId' => $publisherId, 'streamName' => $name);
    $fields = array('stream' => array('label' => 'Stream', 'type' => 'static', 'value' => $stream->title));
    $type = Streams::requestedType();
    // check if stream has messages
    $types = Q_Config::get('Streams', 'messages', $stream->type, array());
    if (count($types) === 0) {
        throw new Q_Exception("Stream of type '{$stream->type}' does not support messages");
    }
    if (!empty($type) && !in_array($type, $types)) {
        throw new Q_Exception("Requested message type '{$type}' is not alowed for streams of type '{$stream->type}'");
    }
    if (!empty($type)) {
        $hidden['type'] = $type;
        $fields['type'] = array('label' => 'Message type', 'type' => 'static', 'value' => $type);
    } else {
        $fields['type'] = array('label' => 'Message type', 'type' => 'select', 'options' => array_merge(array('' => 'Select type'), array_combine($types, $types)), 'value' => '');
    }
    $fields['content'] = array('label' => 'Content', 'type' => 'textarea');
    $fields['submit'] = array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => 'Post'));
    return Q_Html::tag('h3', array(), 'Post a message') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/message', 'post', array(), Q_Html::hidden($hidden) . Q::tool('Q/form', array('fields' => $fields, 'onSuccess' => 'function (data) {
					if (data.errors) alert(data.errors);
					else {
						alert("Message posted");
						var message = Q.getObject(["slots", "form", "fields"], data);
						Q.handle(Q.info.baseUrl+"/plugins/Streams/message?publisherId="+message.publisherId+"&name="+message.streamName);
					}
				}')));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:52,代码来源:tool.php

示例9: Platform_api_response

function Platform_api_response()
{
    $result = array();
    if ($_REQUEST['discover']) {
        $discover = $_REQUEST['discover'];
        if (is_string($discover)) {
            $discover = explode(',', $_REQUEST['discover']);
        }
        $discover = array_flip($discover);
        if (isset($discover['user'])) {
            $result['user'] = 'itzabhws';
        }
        if (isset($discover['contacts'])) {
            $result['contacts'] = array('bhbsneuc' => array('labels' => array(1, 4)), 'bgeoekat' => array('labels' => array(1, 7)));
        }
    }
    $json = Q::json_encode($result);
    $referer = $_SERVER['HTTP_REFERER'];
    $parts = parse_url($referer);
    $origin = Q::json_encode($parts['scheme'] . '://' . $parts['host']);
    $appUrl = Q::json_encode(Q_Request::baseUrl());
    echo <<<EOT
<!doctype html>
<html>
    <head>
        <title>Qbix Platform</title>
\t\t<script type="text/javascript">
\t\twindow.addEventListener("message", receiveMessage, false);
\t\tfunction receiveMessage(event) {
\t\t\tvar request = event.data;
\t\t\tvar response = '';
\t\t\tif (!request.method) {
\t\t\t\tresponse = {"error": "Missing method"};
\t\t\t}
\t\t\tif (request.appUrl.substr(0, event.origin.length) !== event.origin) {
\t\t\t\tresponse = {"error": "Origin doesn't match"};
\t\t\t} else {
\t\t\t\tresponse = {$json};
\t\t\t}
\t\t\twindow.parent.postMessage(response, {$origin});
\t\t}
\t\tvar ExposedMethods = function () {
\t
\t\t};
\t\t</script>
    </head>
    <body>
    </body>
</html>
EOT;
    return false;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:52,代码来源:response.php

示例10: Q_before_Q_responseExtras

/**
 * This is the default handler for the Q/responseExtras event.
 * It should not be invoked during AJAX requests, and especially
 * not during JSONP requests. It will output things like the nonce,
 * which prevents CSRF attacks, but is only supposed to be printed
 * on our webpages and not also given to anyone who does a JSONP request.
 */
function Q_before_Q_responseExtras()
{
    $app = Q_Config::expect('Q', 'app');
    $uri = Q_Dispatcher::uri();
    $url = Q_Request::url(true);
    $base_url = Q_Request::baseUrl();
    $ajax = Q_Request::isAjax();
    if (!$uri) {
        return;
    }
    $info = array('url' => $url, 'uriString' => (string) $uri);
    if ($uri) {
        $info['uri'] = $uri->toArray();
    }
    if (!$ajax) {
        $info = array_merge(array('app' => Q_Config::expect('Q', 'app')), $info, array('proxies' => Q_Config::get('Q', 'proxies', array()), 'baseUrl' => $base_url, 'proxyBaseUrl' => Q_Uri::url($base_url), 'proxyUrl' => Q_Uri::url($url), 'sessionName' => Q_Session::name(), 'nodeUrl' => Q_Utils::nodeUrl(), 'slotNames' => Q_Config::get("Q", "response", "slotNames", array('content', 'dashboard', 'title', 'notices'))));
    }
    foreach ($info as $k => $v) {
        Q_Response::setScriptData("Q.info.{$k}", $v);
    }
    if (!$ajax) {
        $uris = Q_Config::get('Q', 'javascript', 'uris', array());
        $urls = array();
        foreach ($uris as $u) {
            $urls["{$u}"] = Q_Uri::url("{$u}");
        }
        Q_Response::setScriptData('Q.urls', $urls);
    }
    // Export more variables to inline js
    $nonce = isset($_SESSION['Q']['nonce']) ? $_SESSION['Q']['nonce'] : null;
    if ($nonce) {
        Q_Response::setScriptData('Q.nonce', $nonce);
    }
    // Attach stylesheets and scripts
    foreach (Q_Config::get('Q', 'javascript', 'responseExtras', array()) as $src => $b) {
        if (!$b) {
            continue;
        }
        Q_Response::addScript($src);
    }
    foreach (Q_Config::get('Q', 'stylesheets', 'responseExtras', array()) as $src => $media) {
        if (!$media) {
            continue;
        }
        if ($media === true) {
            $media = 'screen,print';
        }
        Q_Response::addStylesheet($src, null, $media);
    }
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:57,代码来源:responseExtras.php

示例11: execute

 /**
  * Excecute web request
  * @method execute
  * @static
  */
 static function execute()
 {
     // Fixes for different platforms:
     if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
         // ISAPI 3.0
         $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
     }
     // Get the base URL
     $base_url = Q_Request::baseUrl();
     if (Q::$controller === 'Q_ActionController') {
         // we detected action.php in the URL, but
         // a misconfigured web server executed index.php instead
         return Q_ActionController::execute();
     }
     // Set the controller that is being used
     if (!isset(Q::$controller)) {
         Q::$controller = 'Q_WebController';
     }
     try {
         $slots = Q_Request::slotNames(false);
         $slots = $slots ? ' slots: (' . implode(',', $slots) . ') from' : '';
         $method = Q_Request::method();
         Q::log("{$method}{$slots} url: " . Q_Request::url(true), null, null, array('maxLength' => 10000));
         Q_Dispatcher::dispatch();
         $dispatchResult = Q_Dispatcher::result();
         if (!isset($dispatchResult)) {
             $dispatchResult = 'Ran dispatcher';
         }
         $uri = Q_Request::uri();
         $module = $uri->module;
         $action = $uri->action;
         if ($module and $action) {
             $slotNames = Q_Request::slotNames();
             $returned_slots = empty($slotNames) ? '' : implode(',', $slotNames);
             Q::log("~" . ceil(Q::milliseconds()) . 'ms+' . ceil(memory_get_peak_usage() / 1000) . 'kb.' . " {$dispatchResult} for {$module}/{$action}" . " ({$returned_slots})", null, null, array('maxLength' => 10000));
         } else {
             Q::log("~" . ceil(Q::milliseconds()) . 'ms+' . ceil(memory_get_peak_usage() / 1000) . 'kb.' . " {$dispatchResult} No route for " . $_SERVER['REQUEST_URI'], null, null, array('maxLength' => 10000));
         }
     } catch (Exception $exception) {
         /**
          * @event Q/exception
          * @param {Exception} exception
          */
         Q::event('Q/exception', compact('exception'));
     }
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:51,代码来源:WebController.php

示例12: Streams_after_Q_file_save

function Streams_after_Q_file_save($params)
{
    $path = $subpath = $name = $writePath = $data = $tailUrl = $size = $audio = null;
    extract($params, EXTR_OVERWRITE);
    if (!empty(Streams::$cache['canWriteToStream'])) {
        // some stream's associated file was being changed
        $stream = Streams::$cache['canWriteToStream'];
    }
    if (empty($stream)) {
        return;
    }
    $url = Q_Valid::url($tailUrl) ? $tailUrl : '{{baseUrl}}/' . $tailUrl;
    $stream->setAttribute('Q.file.url', $url);
    $stream->setAttribute('Q.file.size', $size);
    if ($audio) {
        include_once Q_CLASSES_DIR . DS . 'Audio' . DS . 'getid3' . DS . 'getid3.php';
        $getID3 = new getID3();
        $meta = $getID3->analyze($writePath . $name);
        $bitrate = $meta['audio']['bitrate'];
        $bits = $size * 8;
        $duration = $bits / $bitrate;
        $stream->setAttribute('Q.audio.bitrate', $bitrate);
        $stream->setAttribute('Q.audio.duration', $duration);
    }
    if (Streams_Stream::getConfigField($stream->type, 'updateTitle', false)) {
        // set the title every time a new file is uploaded
        $stream->title = $name;
    }
    if (Streams_Stream::getConfigField($stream->type, 'updateIcon', false)) {
        // set the icon every time a new file is uploaded
        $parts = explode('.', $name);
        $urlPrefix = Q_Request::baseUrl() . '/plugins/Streams/img/icons/files';
        $dirname = STREAMS_PLUGIN_FILES_DIR . DS . 'Streams' . DS . 'icons' . DS . 'files';
        $extension = end($parts);
        $stream->icon = file_exists($dirname . DS . $extension) ? "{$urlPrefix}/{$extension}" : "{$urlPrefix}/_blank";
    }
    if (empty(Streams::$beingSavedQuery)) {
        $stream->changed();
    } else {
        $stream->save();
    }
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:42,代码来源:Q_file_save.php

示例13: Streams_user_response_data

function Streams_user_response_data($params)
{
    $identifier = Users::requestedIdentifier($type);
    $hash = md5(strtolower(trim($identifier)));
    $icon = Q_Config::get('Users', 'register', 'icon', 'leaveDefault', false) ? $url = "plugins/Users/img/icons/default/80.png" : Q_Request::baseUrl() . "/action.php/Users/thumbnail?hash={$hash}&size=80&type=" . Q_Config::get('Users', 'login', 'iconType', 'wavatar');
    // check our db
    if ($user = Users::userFromContactInfo($type, $identifier)) {
        $displayname = Streams::displayName($user);
        $verified = !!Users::identify($type, $identifier);
        return array('exists' => $user->id, 'verified' => $verified, 'username' => $user->username, 'displayName' => $displayname, 'icon' => $verified ? $icon : $user->icon, 'passphrase_set' => !empty($user->passphraseHash), 'fb_uid' => $user->fb_uid ? $user->fb_uid : null);
    }
    if ($type === 'email') {
        $email = new Users_Email();
        Q_Valid::email($identifier, $normalized);
        $email->address = $normalized;
        $exists = $email->retrieve();
    } else {
        if ($type === 'mobile') {
            $mobile = new Users_Mobile();
            Q_Valid::phone($identifier, $normalized);
            $mobile->number = $normalized;
            $exists = $mobile->retrieve();
        }
    }
    if (empty($exists) and Q_Config::get('Users', 'login', 'noRegister', false)) {
        $nicetype = $type === 'email' ? 'email address' : 'mobile number';
        throw new Q_Exception("This {$nicetype} was not registered", array('identifier'));
    }
    $result = array("entry" => array(array("thumbnailUrl" => $icon)));
    if ($type === 'email') {
        $result['emailExists'] = !empty($exists);
    } else {
        $result['mobileExists'] = !empty($exists);
    }
    if ($terms_label = Users::termsLabel('register')) {
        $result['termsLabel'] = $terms_label;
    }
    return $result;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:39,代码来源:data.php

示例14: Overlay_home_response_content

function Overlay_home_response_content($params)
{
    $countries = array();
    $files = glob(APP_WEB_DIR . DS . 'img' . DS . 'squareflags' . DS . '*');
    foreach ($files as $file) {
        $basename = basename($file);
        $src = Q_Request::baseUrl() . "/img/squareflags/{$basename}";
        $src = str_replace(' ', '%20', $src);
        if (empty($firstCountrySrc)) {
            $firstCountrySrc = $src;
        }
        $parts = explode('.', $basename);
        $parts2 = explode('_', $parts[0]);
        foreach ($parts2 as &$v) {
            $v = strtoupper($v[0]) . substr($v, 1);
        }
        $countries[$src] = implode(' ', $parts2);
    }
    $counter = Overlay::counter();
    $proxyHost = 'http://' . $_SERVER['HTTP_HOST'] . ':' . Q_Config::get('Q', 'node', 'port', '80');
    Q_Response::setScriptData('Overlay.proxyHost', $proxyHost);
    return Q::view('Overlay/content/home.php', compact('countries', 'firstCountrySrc', 'counter'));
}
开发者ID:EGreg,项目名称:Overlay,代码行数:23,代码来源:content.php

示例15: resendActivationMessage

 function resendActivationMessage($view = null, $fields = array(), $options = array())
 {
     if (!isset($view)) {
         $view = Q_Config::get('Users', 'transactional', 'resend', 'sms', Q_Config::get('Users', 'transactional', 'resend', 'sms', 'Users/sms/activation.php'));
     }
     $user = $this->get('user', null);
     if (!$user) {
         $user = new Users_User();
         $user->id = $this->userId;
         if (!$user->retrieve()) {
             throw new Q_Exception_NotVerified(array('type' => 'mobile number'), 'mobileNumber');
         }
     }
     $minutes = Q_Config::get('Users', 'activation', 'expires', 60 * 24 * 7);
     $this->activationCode = strtolower(Q_Utils::unique(5));
     $this->activationCodeExpires = new Db_Expression("CURRENT_TIMESTAMP + INTERVAL {$minutes} MINUTE");
     $this->authCode = md5(microtime() + mt_rand());
     $number = $this->number;
     if (substr($number, 0, 2) == '+1') {
         $number = substr($number, 2);
     }
     $link = 'Users/activate?p=1&code=' . urlencode($this->activationCode) . ' mobileNumber=' . urlencode($number);
     /**
      * @event Users/resend {before}
      * @param {string} user
      * @param {string} mobile
      */
     Q::event('Users/resend', compact('user', 'mobile', 'link'), 'before');
     $this->save();
     $fields2 = array_merge($fields, array('user' => $user, 'mobile' => $this, 'app' => Q_Config::expect('Q', 'app'), 'baseUrl' => Q_Request::baseUrl(), 'link' => $link));
     $this->sendMessage($view, $fields2, $options);
     // may throw exception if badly configured
     /**
      * @event Users/resend {after}
      * @param {string} user
      * @param {string} mobile
      */
     Q::event('Users/resend', compact('user', 'mobile'), 'after');
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:39,代码来源:Mobile.php


注:本文中的Q_Request::baseUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。