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


PHP Q_Config::expect方法代码示例

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


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

示例1: Streams_before_Q_responseExtras

function Streams_before_Q_responseExtras()
{
    Q_Response::addScript('plugins/Streams/js/Streams.js');
    $host = Q_Config::get('Streams', 'node', 'host', Q_Config::get('Q', 'node', 'host', null));
    $port = Q_Config::get('Streams', 'node', 'port', Q_Config::get('Q', 'node', 'port', null));
    $user = Users::loggedInUser();
    if ($user) {
        Q_Response::setScriptData('Q.plugins.Users.loggedInUser.displayName', Streams::displayName($user));
    }
    if (!Q_Request::isAjax()) {
        $invite_url = Q_Config::get('Streams', 'invite', 'url', "http://invites.to");
        Q_Response::setScriptData('Q.plugins.Streams.invite.url', $invite_url);
        if (isset($host) && isset($port)) {
            Q_Response::setScriptData('Q.plugins.Streams.node', array("http://{$host}:{$port}"));
        }
        if ($sizes = Q_Config::expect('Streams', 'types', 'Streams/image', 'sizes')) {
            sort($sizes);
            Q_Response::setScriptData('Q.plugins.Streams.image.sizes', $sizes);
        }
        $defaults = array('readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['join'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']);
        Q_Response::setScriptData('Q.plugins.Streams.defaults', $defaults);
        if ($froalaKey = Q_Config::get('Streams', 'froala', 'key', null)) {
            Q_Response::setScriptData('Q.plugins.Streams.froala.key', $froalaKey);
        }
    }
    Q_Response::addStylesheet("plugins/Streams/css/Streams.css");
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:27,代码来源:Q_responseExtras.php

示例2: Websites_seo_post

function Websites_seo_post()
{
    if (empty($_REQUEST['streamName'])) {
        throw new Q_Exception_RequiredField(array('field' => 'streamName'));
    }
    $prefix = "Websites/seo/";
    if (substr($_REQUEST['streamName'], 0, strlen($prefix)) !== $prefix) {
        throw new Q_Exception_WrongValue(array('field' => 'streamName', 'range' => "string beginning with {$prefix}"));
    }
    $user = Users::loggedInUser(true);
    $publisherId = Q_Config::expect("Websites", "user", "id");
    $type = "Websites/seo";
    if (!Streams::isAuthorizedToCreate($user->id, $publisherId, $type)) {
        throw new Users_Exception_NotAuthorized();
    }
    $stream = new Streams_Stream($publisherId);
    $stream->publisherId = $publisherId;
    $stream->name = $_REQUEST['streamName'];
    $stream->type = $type;
    if (isset($_REQUEST['uri'])) {
        $stream->setAttribute('uri', $_REQUEST['uri']);
    }
    $stream->save();
    $stream->post($user->id, array('type' => 'Streams/created', 'content' => '', 'instructions' => Q::json_encode($stream->toArray())), true);
    $stream->subscribe();
    // autosubscribe to streams you yourself create, using templates
    Q_Response::setSlot('stream', $stream->exportArray());
}
开发者ID:dmitriz,项目名称:Platform,代码行数:28,代码来源:post.php

示例3: Users_0_9_2_Users_mysql

function Users_0_9_2_Users_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    $communityId = Users::communityId();
    $rows = Users_Session::select('COUNT(1)')->where($criteria)->fetchAll(PDO::FETCH_NUM);
    $count = $rows[0][0];
    $limit = 100;
    $offset = 0;
    $sessions = Users_Session::select('*')->orderBy('id')->limit($limit, $offset)->caching(false)->fetchDbRows();
    echo "Adding userId to sessions...";
    while ($sessions) {
        foreach ($sessions as $s) {
            $parsed = Q::json_decode($s->content, true);
            if (empty($parsed['Users']['loggedInUser']['id'])) {
                continue;
            }
            $s->userId = $parsed['Users']['loggedInUser']['id'];
        }
        Users_Session::insertManyAndExecute($sessions, array('onDuplicateKeyUpdate' => array('userId' => new Db_Expression("VALUES(userId)"))));
        $min = min($offset + $limit, $count);
        echo "[100D";
        echo "Updated {$min} of {$count} sessions";
        $offset += $limit;
        if ($offset > $count) {
            break;
        }
        $sessions = Users_Session::select('*')->orderBy('id')->limit($limit, $offset)->caching(false)->fetchDbRows();
    }
    echo "\n";
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:30,代码来源:0.9.2-Users.mysql.php

示例4: Streams_0_8_8_Streams_mysql

function Streams_0_8_8_Streams_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    $user = Users_User::fetch($app, true);
    Streams::create($app, $app, 'Streams/resource', array('name' => 'Streams/invitations', 'readLevel' => 0, 'writeLevel' => 0, 'adminLevel' => 0));
    Streams_Access::insert(array('publisherId' => $app, 'streamName' => "Streams/invitations", 'ofUserId' => '', 'grantedByUserId' => null, 'ofContactLabel' => "{$app}/admins", 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['close'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']))->execute();
}
开发者ID:dmitriz,项目名称:Platform,代码行数:7,代码来源:0.8.8-Streams.mysql.php

示例5: forSubscribers

 /**
  * Call this function to find the "nearby points" to subscribe to
  * on a grid of quantized (latitude, longitude) pairs
  * which are spaced at most $miles apart.
  * @param {double} $latitude The latitude of the coordinates to search around
  * @param {double} $longitude The longitude of the coordinates to search around
  * @param {double} $miles The radius, in miles, around this location.
  *  Should be one of the array values in the Places/nearby/miles config.
  * @return {Array} Returns an array of up to four ($streamName => $info) pairs
  *  where the $streamName is the name of the stream corresponding to the "nearby point"
  *  and $info includes the keys "latitude", "longitude", and "miles".
  */
 static function forSubscribers($latitude, $longitude, $miles)
 {
     list($latQuantized, $longQuantized, $latGrid, $a) = Places::quantize($latitude, $longitude, $miles);
     $milesArray = Q_Config::expect('Places', 'nearby', 'miles');
     if (!in_array($miles, $milesArray)) {
         throw new Q_Exception("The miles value needs to be in Places/nearby/miles config.");
     }
     $result = array();
     foreach (array($latQuantized, $latQuantized + $latGrid * 1.1) as $lat) {
         list($a, $b, $c, $longGrid) = Places::quantize($lat, $longitude, $miles);
         foreach (array($longQuantized, $longQuantized + $longGrid * 1.1) as $long) {
             list($latQ, $longQ) = Places::quantize($lat, $long, $miles);
             if ($longQ > 180) {
                 $longQ = $long % 180 - 180;
             }
             if ($longQ < -180) {
                 $longQ = $long % 180 + 180;
             }
             if ($latQ > 90) {
                 $latQ = $latQ % 90 - 90;
             }
             if ($latQ < -90) {
                 $latQ = $latQ % 90 + 90;
             }
             $streamName = self::streamName($latQ, $longQ, $miles);
             $result[$streamName] = array('latitude' => $lat, 'longitude' => $long, 'geohash' => Places_Geohash::encode($latQ, $longQ, 6), 'miles' => $miles);
         }
     }
     return $result;
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:42,代码来源:Nearby.php

示例6: Overlay_before_Q_responseExtras

function Overlay_before_Q_responseExtras()
{
    $app = Q_Config::expect('Q', 'app');
    Q_Response::addStylesheet('plugins/Q/css/Q.css');
    Q_Response::addStylesheet('css/Overlay.css', '@end');
    Q_Response::addStylesheet('http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,700');
    if (Q_Config::get('Q', 'firebug', false)) {
        Q_Response::addScript("https://getfirebug.com/firebug-lite-debug.js");
    }
    Q_Response::addScript('js/Overlay.js');
    Q_Response::setMeta("title", "Customize My Pic!");
    Q_Response::setMeta("description", "Make a statement on Facebook by customizing your profile picture, even from your smartphone.");
    Q_Response::setMeta("image", Q_Html::themedUrl('img/icon/icon.png'));
    if (Q_Request::isIE()) {
        header("X-UA-Compatible", "IE=edge");
    }
    header('Vary: User-Agent');
    // running an event for loading action-specific extras (if there are any)
    $uri = Q_Dispatcher::uri();
    $module = $uri->module;
    $action = $uri->action;
    $event = "{$module}/{$action}/response/responseExtras";
    if (Q::canHandle($event)) {
        Q::event($event);
    }
}
开发者ID:EGreg,项目名称:Overlay,代码行数:26,代码来源:Q_responseExtras.php

示例7: Streams_interests_response

function Streams_interests_response()
{
    // serve a javascript file and tell client to cache it
    $app = Q_Config::expect('Q', 'app');
    $communityId = Q::ifset($_REQUEST, 'communityId', $app);
    $tree = new Q_Tree();
    $tree->load("files/Streams/interests/{$communityId}.json");
    $categories = $tree->getAll();
    foreach ($categories as $category => &$v1) {
        foreach ($v1 as $k2 => &$v2) {
            if (!Q::isAssociative($v2)) {
                ksort($v1);
                break;
            }
            ksort($v2);
        }
    }
    header('Content-Type: text/javascript');
    header("Pragma: ", true);
    // 1 day
    header("Cache-Control: public, max-age=86400");
    // 1 day
    $expires = date("D, d M Y H:i:s T", time() + 86400);
    header("Expires: {$expires}");
    // 1 day
    $json = Q::json_encode($categories, true);
    echo "Q.setObject(['Q', 'Streams', 'Interests', 'all', '{$communityId}'], {$json});";
    return false;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:29,代码来源:response.php

示例8: Streams_0_8_1_Streams_mysql

function Streams_0_8_1_Streams_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    // template for community stream
    $stream = new Streams_Stream();
    $stream->publisherId = '';
    $stream->name = 'Streams/community/';
    $stream->type = 'Streams/template';
    $stream->title = "Community";
    $stream->content = '';
    $readLevel = Streams::$READ_LEVEL['content'];
    $writeLevel = Streams::$WRITE_LEVEL['join'];
    $adminLevel = Streams::$ADMIN_LEVEL['invite'];
    $stream->save();
    // app community stream, for announcements
    $stream = new Streams_Stream();
    $stream->publisherId = $app;
    $stream->name = 'Streams/community/main';
    $stream->type = 'Streams/community';
    $stream->title = "{$app} Community";
    $stream->save();
    // symlink the labels folder
    $cwd = getcwd();
    chdir(USERS_PLUGIN_FILES_DIR . DS . 'Users' . DS . 'icons');
    if (!file_exists('Streams')) {
        symlink(STREAMS_PLUGIN_FILES_DIR . DS . 'Streams' . DS . 'icons' . DS . 'labels' . DS . 'Streams', 'Streams');
    }
    chdir($cwd);
}
开发者ID:atirjavid,项目名称:Platform,代码行数:29,代码来源:0.8.1-Streams.mysql.php

示例9: Streams_invitations_response

/**
 * Displays an HTML document that can be printed, ideally with line breaks.
 * Uses a particular view for the layout.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.invitingUserId Required. The id of the user that generated the invitations with a call to Streams::invite.
 * @param {string} $_REQUEST.batch Required. The name of the batch under which invitations were saved during a call to Streams::invite.
 * @param {string} [$_REQUEST.limit=100] The maximum number of invitations to show on the page
 * @param {string} [$_REQUEST.offset=0] Used for paging
 * @param {string} [$_REQUEST.title='Invitations'] Override the title of the document
 * @param {string} [$_REQUEST.layout='default'] The name of the layout to use for the HTML document
 * @see Users::addLink()
 */
function Streams_invitations_response()
{
    Q_Request::requireFields(array('batch', 'invitingUserId'), true);
    $invitingUserId = $_REQUEST['invitingUserId'];
    $batch = $_REQUEST['batch'];
    $user = Users::loggedInUser(true);
    $stream = Streams::fetchOne(null, $invitingUserId, 'Streams/invitations', true);
    if (!$stream->testReadLevel('content')) {
        throw new Users_Exception_NotAuthorized();
    }
    $title = Q::ifset($_REQUEST, 'layout', 'title');
    $layoutKey = Q::ifset($_REQUEST, 'layout', 'default');
    $limit = min(1000, Q::ifset($_REQUEST, 'limit', 100));
    $offset = Q::ifset($_REQUEST, 'offset', 0);
    $layout = Q_Config::expect('Streams', 'invites', 'layout', $layoutKey);
    $pattern = Streams::invitationsPath($invitingUserId) . DS . $batch . DS . "*.html";
    $filenames = glob($pattern);
    $parts = array();
    foreach ($filenames as $f) {
        if (--$offset > 0) {
            continue;
        }
        $parts[] = file_get_contents($f);
        if (--$limit == 0) {
            break;
        }
    }
    $content = implode("\n\n<div class='Q_pagebreak Streams_invitations_separator'></div>\n\n", $parts);
    echo Q::view($layout, compact('title', 'content', 'parts'));
    return false;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:43,代码来源:response.php

示例10: Streams_0_8_6_Streams_mysql

function Streams_0_8_6_Streams_mysql()
{
    $app = Q_Config::expect('Q', 'app');
    // access for managing communities
    $access = new Streams_Access();
    $access->publisherId = $app;
    $access->streamName = 'Streams/community*';
    $access->ofUserId = '';
    $access->ofContactLabel = "{$app}/admins";
    $access->readLevel = Streams::$READ_LEVEL['messages'];
    $access->writeLevel = Streams::$WRITE_LEVEL['edit'];
    $access->adminLevel = Streams::$ADMIN_LEVEL['manage'];
    $access->save();
    // access for managing categories
    $access = new Streams_Access();
    $access->publisherId = $app;
    $access->streamName = 'Streams/category/';
    $access->ofUserId = '';
    $access->ofContactLabel = "{$app}/admins";
    $access->readLevel = Streams::$READ_LEVEL['messages'];
    $access->writeLevel = Streams::$WRITE_LEVEL['close'];
    $access->adminLevel = Streams::$ADMIN_LEVEL['manage'];
    $access->save();
    // template to help users relate things to Streams/category streams
    Streams_Stream::insert(array('publisherId' => '', 'name' => 'Streams/category/', 'type' => 'Streams/template', 'title' => 'Untitled Category', 'icon' => 'Streams/category', 'content' => '', 'attributes' => null, 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['relate'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']))->execute();
    // template to help users create subcategories for things
    Streams_RelatedTo::insert(array('toPublisherId' => '', 'toStreamName' => 'Streams/category/', 'type' => 'subcategories', 'fromPublisherId' => '', 'fromStreamName' => 'Streams/category/'))->execute();
}
开发者ID:dmitriz,项目名称:Platform,代码行数:28,代码来源:0.8.6-Streams.mysql.php

示例11: Assets_subscription_tool

/**
 * Standard tool for starting or managing subscriptions.
 * @class Assets subscription
 * @constructor
 * @param {array} $options Override various options for this tool
 *  @param {string} $options.payments can be "authnet" or "stripe"
 *  @param {string} $options.planStreamName the name of the subscription plan's stream
 *  @param {string} [$options.publisherId=Q.Users.communityId] the publisher of the subscription plan's stream
 *  @param {string} [$options.subscribeButton] Can override the title of the subscribe button
 *  @param {array} [$options=array()] Any additional options
 *  @param {string} [$options.token=null] required unless the user is an existing customer
 */
function Assets_subscription_tool($options)
{
    if (empty($options['payments'])) {
        throw new Q_Exception_RequiredField(array('field' => 'payments'), 'payments');
    }
    $payments = ucfirst($options['payments']);
    $lcpayments = strtolower($payments);
    $currency = strtolower(Q::ifset($options, 'currency', 'usd'));
    if ($payments === 'Authnet' and $currency !== 'usd') {
        throw new Q_Exception("Authnet doesn't support currencies other than USD", 'currency');
    }
    $className = "Assets_Payments_{$payments}";
    switch ($payments) {
        case 'Authnet':
            $adapter = new $className($options);
            $token = $options['token'] = $adapter->authToken();
            $testing = $options['testing'] = Q_Config::expect('Assets', 'payments', $lcpayments, 'testing');
            $action = $options['action'] = $testing ? "https://test.authorize.net/profile/manage" : "https://secure.authorize.net/profile/manage";
            break;
        case 'Stripe':
            $publishableKey = Q_Config::expect('Assets', 'payments', 'stripe', 'publishableKey');
            break;
    }
    $titles = array('Authnet' => 'Authorize.net', 'Stripe' => 'Stripe');
    $subscribeButton = Q::ifset($options, 'subscribeButton', "Subscribe with " . $titles[$payments]);
    Q_Response::setToolOptions($options);
    return Q::view("Assets/tool/subscription/{$payments}.php", compact('token', 'publishableKey', 'action', 'paymentButton', 'subscribeButton', 'planStreamName'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:40,代码来源:tool.php

示例12: Streams_interest_delete

/**
 * Used to create a new stream
 *
 * @param {array} $_REQUEST 
 * @param {String} [$_REQUEST.title] Required. The title of the interest.
 * @param {String} [$_REQUEST.publisherId] Optional. Defaults to the app name.
 * @return {void}
 */
function Streams_interest_delete()
{
    $user = Users::loggedInUser(true);
    $title = Q::ifset($_REQUEST, 'title', null);
    if (!isset($title)) {
        throw new Q_Exception_RequiredField(array('field' => 'title'));
    }
    $app = Q_Config::expect('Q', 'app');
    $publisherId = Q::ifset($_REQUEST, 'publisherId', $app);
    $name = 'Streams/interest/' . Q_Utils::normalize($title);
    $stream = Streams::fetchOne(null, $publisherId, $name);
    if (!$stream) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => Q::json_encode(compact('publisherId', 'name'))));
    }
    $miPublisherId = $user->id;
    $miName = 'Streams/user/interests';
    $myInterests = Streams::fetchOne($user->id, $miPublisherId, $miName);
    if (!$myInterests) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => Q::json_encode(array('publisherId' => $miPublisherId, 'name' => $miName))));
    }
    $stream->leave();
    Streams::unrelate($user->id, $user->id, 'Streams/user/interests', 'Streams/interest', $publisherId, $name, array('adjustWeights' => true));
    Q_Response::setSlot('publisherId', $publisherId);
    Q_Response::setSlot('streamName', $name);
    /**
     * Occurs when the logged-in user has successfully removed an interest via HTTP
     * @event Streams/interest/delete {after}
     * @param {string} publisherId The publisher of the interest stream
     * @param {string} title The title of the interest
     * @param {Users_User} user The logged-in user
     * @param {Streams_Stream} stream The interest stream
     * @param {Streams_Stream} myInterests The user's "Streams/user/interests" stream
     */
    Q::event("Streams/interest/remove", compact('publisherId', 'title', 'subscribe', 'user', 'stream', 'myInterests'), 'after');
}
开发者ID:dmitriz,项目名称:Platform,代码行数:43,代码来源:delete.php

示例13: Assets_payment_tool

/**
 * Standard tool for making payments.
 * @class Assets payment
 * @constructor
 * @param {array} $options Override various options for this tool
 *  @param {string} $options.payments can be "authnet" or "stripe"
 *  @param {string} $options.amount the amount to pay.
 *  @param {double} [$options.currency="usd"] the currency to pay in. (authnet supports only "usd")
 *  @param {string} [$options.payButton] Can override the title of the pay button
 *  @param {String} [$options.publisherId=Users::communityId()] The publisherId of the Assets/product or Assets/service stream
 *  @param {String} [$options.streamName] The name of the Assets/product or Assets/service stream
 *  @param {string} [$options.name=Users::communityName()] The name of the organization the user will be paying
 *  @param {string} [$options.image] The url pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
 *  @param {string} [$options.description=null] A short name or description of the product or service being purchased.
 *  @param {string} [$options.panelLabel] The label of the payment button in the Stripe Checkout form (e.g. "Pay {{amount}}", etc.). If you include {{amount}}, it will be replaced by the provided amount. Otherwise, the amount will be appended to the end of your label.
 *  @param {string} [$options.zipCode] Specify whether Stripe Checkout should validate the billing ZIP code (true or false). The default is false.
 *  @param {boolean} [$options.billingAddress] Specify whether Stripe Checkout should collect the user's billing address (true or false). The default is false.
 *  @param {boolean} [$options.shippingAddress] Specify whether Checkout should collect the user's shipping address (true or false). The default is false.
 *  @param {string} [$options.email=Users::loggedInUser(true)->emailAddress] You can use this to override the email address, if any, provided to Stripe Checkout to be pre-filled.
 *  @param {boolean} [$options.allowRememberMe=true] Specify whether to include the option to "Remember Me" for future purchases (true or false).
 *  @param {boolean} [$options.bitcoin=false] Specify whether to accept Bitcoin (true or false). 
 *  @param {boolean} [$options.alipay=false] Specify whether to accept Alipay ('auto', true, or false). 
 *  @param {boolean} [$options.alipayReusable=false] Specify if you need reusable access to the customer's Alipay account (true or false).
 */
function Assets_payment_tool($options)
{
    Q_Valid::requireFields(array('payments', 'amount'), $options, true);
    if (empty($options['name'])) {
        $options['name'] = Users::communityName();
    }
    if (!empty($options['image'])) {
        $options['image'] = Q_Html::themedUrl($options['image']);
    }
    $options['payments'] = strtolower($options['payments']);
    if (empty($options['email'])) {
        $options['email'] = Users::loggedInUser(true)->emailAddress;
    }
    $payments = ucfirst($options['payments']);
    $currency = strtolower(Q::ifset($options, 'currency', 'usd'));
    if ($payments === 'Authnet' and $currency !== 'usd') {
        throw new Q_Exception("Authnet doesn't support currencies other than USD", 'currency');
    }
    $className = "Assets_Payments_{$payments}";
    switch ($payments) {
        case 'Authnet':
            $adapter = new $className($options);
            $token = $options['token'] = $adapter->authToken();
            $testing = $options['testing'] = Q_Config::expect('Assets', 'payments', $lcpayments, 'testing');
            $action = $options['action'] = $testing ? "https://test.authorize.net/profile/manage" : "https://secure.authorize.net/profile/manage";
            break;
        case 'Stripe':
            $publishableKey = Q_Config::expect('Assets', 'payments', 'stripe', 'publishableKey');
            break;
    }
    $titles = array('Authnet' => 'Authorize.net', 'Stripe' => 'Stripe');
    Q_Response::setToolOptions($options);
    $payButton = Q::ifset($options, 'payButton', "Pay with " . $titles[$payments]);
    return Q::view("Assets/tool/payment/{$payments}.php", compact('token', 'publishableKey', 'action', 'payButton'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:59,代码来源:tool.php

示例14: Streams_invitations_response

/**
 * Displays an HTML document that can be printed, ideally with line breaks.
 * Uses a particular view for the layout.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.invitingUserId Required. The id of the user that generated the invitations with a call to Streams::invite.
 * @param {string} $_REQUEST.batch Required. The name of the batch under which invitations were saved during a call to Streams::invite.
 * @param {string} [$_REQUEST.limit=100] The maximum number of invitations to show on the page
 * @param {string} [$_REQUEST.offset=0] Used for paging
 * @param {string} [$_REQUEST.title='Invitations'] Override the title of the document
 * @param {string} [$_REQUEST.layout='default'] The name of the layout to use for the HTML document
 * @see Users::addLink()
 */
function Streams_invitations_response()
{
    Q_Request::requireFields(array('batch', 'invitingUserId'), true);
    $invitingUserId = $_REQUEST['invitingUserId'];
    $batch = $_REQUEST['batch'];
    $title = Q::ifset($_REQUEST, 'layout', 'title');
    $layoutKey = Q::ifset($_REQUEST, 'layout', 'default');
    $limit = min(1000, Q::ifset($_REQUEST, 'limit', 100));
    $offset = Q::ifset($_REQUEST, 'offset', 0);
    $layout = Q_Config::expect('Streams', 'invites', 'layout', $layoutKey);
    $app = Q_Config::expect('Q', 'app');
    $pattern = Streams::invitationsPath($invitingUserId) . DS . $batch . DS . "*.html";
    $filenames = glob($pattern);
    $parts = array();
    foreach ($filenames as $f) {
        if (--$offset > 0) {
            continue;
        }
        $parts[] = file_get_contents($f);
        if (--$limit == 0) {
            break;
        }
    }
    $content = implode("\n\n<div class='Q_pagebreak Streams_invitations_separator'></div>\n\n", $parts);
    echo Q::view($layout, compact('content', 'parts'));
    return false;
}
开发者ID:atirjavid,项目名称:Platform,代码行数:39,代码来源:response.php

示例15: Users_identifier_post

function Users_identifier_post()
{
    $userId = Q::ifset($_REQUEST, 'userId', null);
    if (isset($userId)) {
        $user = Users_User::fetch($userId, true);
        if ($user->emailAddress or $user->mobileNumber) {
            throw new Q_Exception("This user is already able to log in and set their own email and mobile number.");
        }
    } else {
        $user = Users::loggedInUser(true);
    }
    $app = Q_Config::expect('Q', 'app');
    $fields = array();
    $identifier = Users::requestedIdentifier($type);
    if (!$type) {
        throw new Q_Exception("a valid email address or mobile number is required", array('identifier', 'mobileNumber', 'emailAddress'));
    }
    if ($type === 'email') {
        $subject = Q_Config::get('Users', 'transactional', 'identifier', 'subject', "Welcome! Verify your email address.");
        $view = Q_Config::get('Users', 'transactional', 'identifier', 'body', 'Users/email/addEmail.php');
        $user->addEmail($identifier, $subject, $view, array(), array('html' => true));
    } else {
        if ($type === 'mobile') {
            $view = Q_Config::get('Users', 'transactional', 'identifier', 'sms', 'Users/sms/addMobile.php');
            $user->addMobile($identifier, $view);
        }
    }
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:28,代码来源:post.php


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