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


PHP q函数代码示例

本文整理汇总了PHP中q函数的典型用法代码示例。如果您正苦于以下问题:PHP q函数的具体用法?PHP q怎么用?PHP q使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: search_ac_init

function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:35,代码来源:search_ac.php

示例2: doWebContent

 public function doWebContent()
 {
     $aid = q('get.aid', 0, 'intval');
     //文章
     $article = Db::table('web_article')->where('siteid', SITEID)->where('aid', $aid)->first();
     if (empty($article)) {
         message('文章不存在', 'back', 'error');
     }
     $article['url'] = web_url('entry/content', ['aid' => $article['aid'], 'cid' => $article['category_cid']], 'article');
     //栏目
     $category = Db::table('web_category')->where('cid', $article['category_cid'])->first();
     $category['url'] = empty($category['cat_linkurl']) ? web_url('entry/category', ['cid' => $category['cid']], 'article') : $category['cat_linkurl'];
     //模板风格
     $template_name = $article['template_name'] ?: $category['template_name'];
     if (empty($template_name)) {
         $template_name = Db::table('web')->where('id', $this->webid)->pluck('template_name');
         if (empty($template_name)) {
             $template_name = Db::table('template')->where('is_default', 1)->pluck('name');
         }
     }
     $path = "theme/{$template_name}/{$this->dir}";
     if (is_file($path . '/article.html')) {
         $tpl = $path . '/article.html';
         define('__TEMPLATE__', $path);
     } else {
         //模板不存在时使用默认模板
         $tpl = 'theme/default/' . $this->dir . '/article.html';
         define('__TEMPLATE__', "theme/default/{$this->dir}");
     }
     View::with('hdcms', $article);
     View::with('category', $category);
     return View::make($tpl);
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:33,代码来源:entry.php

示例3: get

 function get()
 {
     require_once 'include/acl_selectors.php';
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     if (\App::$argc != 2) {
         return;
     }
     $contact_id = intval(\App::$argv[1]);
     $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval(local_channel()));
     if (!count($r)) {
         notice(t('Contact not found.') . EOL);
         return;
     }
     $contact = $r[0];
     $o = '<h3>' . t('Suggest Friends') . '</h3>';
     $o .= '<div id="fsuggest-desc" >' . sprintf(t('Suggest a friend for %s'), $contact['name']) . '</div>';
     $o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
     // FIXME contact_selector deprecated, removed
     //	$o .= contact_selector('suggest','suggest-select', false,
     //		array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
     $o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>';
     $o .= '</form>';
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:27,代码来源:Fsuggest.php

示例4: get

 function get()
 {
     if (argc() > 2 && argv(2) === 'add') {
         $tpl = get_markup_template("settings_oauth_edit.tpl");
         $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), '', t('Name of application')), '$key' => array('key', t('Consumer Key'), random_string(16), t('Automatically generated - change if desired. Max length 20')), '$secret' => array('secret', t('Consumer Secret'), random_string(16), t('Automatically generated - change if desired. Max length 20')), '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')), '$icon' => array('icon', t('Icon url'), '', t('Optional'))));
         return $o;
     }
     if (argc() > 3 && argv(2) === 'edit') {
         $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d", dbesc(argv(3)), local_channel());
         if (!count($r)) {
             notice(t('Application not found.'));
             return;
         }
         $app = $r[0];
         $tpl = get_markup_template("settings_oauth_edit.tpl");
         $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), $app['clname'], ''), '$key' => array('key', t('Consumer Key'), $app['client_id'], ''), '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''), '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''), '$icon' => array('icon', t('Icon url'), $app['icon'], '')));
         return $o;
     }
     if (argc() > 3 && argv(2) === 'delete') {
         check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
         $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", dbesc(argv(3)), local_channel());
         goaway(z_root() . "/settings/oauth/");
         return;
     }
     $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my \n\t\t\t\tFROM clients\n\t\t\t\tLEFT JOIN tokens ON clients.client_id=tokens.client_id\n\t\t\t\tWHERE clients.uid IN (%d,0)", local_channel(), local_channel());
     $tpl = get_markup_template("settings_oauth.tpl");
     $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$baseurl' => z_root(), '$title' => t('Connected Apps'), '$add' => t('Add application'), '$edit' => t('Edit'), '$delete' => t('Delete'), '$consumerkey' => t('Client key starts with'), '$noname' => t('No name'), '$remove' => t('Remove authorization'), '$apps' => $r));
     return $o;
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:29,代码来源:Oauth.php

示例5: repair_ostatus_content

function repair_ostatus_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $o = "<h2>" . t("Resubsribing to OStatus contacts") . "</h2>";
    $uid = local_user();
    $a = get_app();
    $counter = intval($_REQUEST['counter']);
    $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE\n                `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)", intval($uid), dbesc(NETWORK_OSTATUS), intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_SHARING));
    if (!$r) {
        return $o . t("Error");
    }
    $total = $r[0]["total"];
    $r = q("SELECT `url` FROM `contact` WHERE\n                `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)\n\t\tORDER BY `url`\n\t\tLIMIT %d, 1", intval($uid), dbesc(NETWORK_OSTATUS), intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_SHARING), $counter++);
    if (!$r) {
        $o .= t("Done");
        return $o;
    }
    $o .= "<p>" . $counter . "/" . $total . ": " . $r[0]["url"] . "</p>";
    $o .= "<p>" . t("Keep this window open until done.") . "</p>";
    $result = new_contact($uid, $r[0]["url"], true);
    $a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . $a->get_baseurl() . '/repair_ostatus?counter=' . $counter . '">';
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:27,代码来源:repair_ostatus.php

示例6: filer_content

function filer_content(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $term = unxmlify(trim($_GET['term']));
    $item_id = $a->argc > 1 ? intval($a->argv[1]) : 0;
    logger('filer: tag ' . $term . ' item ' . $item_id);
    if ($item_id && strlen($term)) {
        // file item
        store_item_tag(local_channel(), $item_id, TERM_OBJ_POST, TERM_FILE, $term, '');
        // protect the entire conversation from periodic expiration
        $r = q("select parent from item where id = %d and uid = %d limit 1", intval($item_id), intval(local_channel()));
        if ($r) {
            $x = q("update item set item_retained = 1 where id = %d and uid = %d", intval($r[0]['parent']), intval(local_channel()));
        }
    } else {
        $filetags = array();
        $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc", intval(local_channel()), intval(TERM_FILE));
        if (count($r)) {
            foreach ($r as $rr) {
                $filetags[] = $rr['term'];
            }
        }
        $tpl = get_markup_template("filer_dialog.tpl");
        $o = replace_macros($tpl, array('$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), '$submit' => t('Save')));
        echo $o;
    }
    killme();
}
开发者ID:msooon,项目名称:hubzilla,代码行数:30,代码来源:filer.php

示例7: init

 function init()
 {
     if (argc() > 1) {
         $which = argv(1);
     } else {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     if (local_channel() && argc() > 2 && argv(2) === 'view') {
         $which = $channel['channel_address'];
         $profile = argv(1);
         $r = q("select profile_guid from profile where id = %d and uid = %d limit 1", intval($profile), intval(local_channel()));
         if (!$r) {
             $profile = '';
         }
         $profile = $r[0]['profile_guid'];
     }
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if (!$profile) {
         $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)));
         if ($x) {
             \App::$profile = $x[0];
         }
     }
     profile_load($a, $which, $profile);
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:29,代码来源:Profile.php

示例8: hubwall_post

function hubwall_post(&$a)
{
    if (!is_site_admin()) {
        return;
    }
    $text = trim($_REQUEST['text']);
    if (!$text) {
        return;
    }
    $sender_name = sprintf(t('$1%s Administrator'), \Zotlabs\Lib\System::get_site_name());
    $sender_email = $_REQUEST['sender'];
    $subject = $_REQUEST['subject'];
    $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "\n"), $text))), ENT_QUOTES, 'UTF-8'));
    $htmlversion = bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "<br />\n"), $text)));
    $sql_extra = intval($_REQUEST['test']) ? sprintf(" and account_email = '%s' ", get_config('system', 'admin_email')) : '';
    $recips = q("select account_email from account where account_flags = %d {$sql_extra}", intval(ACCOUNT_OK));
    if (!$recips) {
        notice(t('No recipients found.') . EOL);
        return;
    }
    $total_recips = count($recips);
    $total_delivered = 0;
    foreach ($recips as $recip) {
        $x = \Zotlabs\Lib\Enotify::send(array('fromName' => $sender_name, 'fromEmail' => $sender_email, 'replyTo' => $sender_email, 'toEmail' => $recip['account_email'], 'messageSubject' => $subject, 'htmlVersion' => $htmlversion, 'textVersion' => $textversion));
        if ($x) {
            $total_delivered++;
        }
    }
    info(sprintf(t('%1$d of %2$d messages sent.'), $total_delivered, $total_recips) . EOL);
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:30,代码来源:hubwall.php

示例9: init

 function init()
 {
     $result = array('success' => false);
     $mindate = $_REQUEST['mindate'] ? datetime_convert('UTC', 'UTC', $_REQUEST['mindate']) : '';
     if (!$mindate) {
         $mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
     }
     if (observer_prohibited()) {
         $result['message'] = 'Public access denied';
         json_return_and_die($result);
     }
     $observer = \App::get_observer();
     $channel_address = argc() > 1 ? argv(1) : '';
     if ($channel_address) {
         $r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1", dbesc(argv(1)));
     } else {
         $x = get_sys_channel();
         if ($x) {
             $r = array($x);
         }
         $mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
     }
     if (!$r) {
         $result['message'] = 'Channel not found.';
         json_return_and_die($result);
     }
     logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
     $result['messages'] = zot_feed($r[0]['channel_id'], $observer['xchan_hash'], array('mindate' => $mindate));
     $result['success'] = true;
     json_return_and_die($result);
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:Zotfeed.php

示例10: tagrm_content

function tagrm_content(&$a)
{
    $o = '';
    if (!local_user()) {
        goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
        // NOTREACHED
    }
    $item = $a->argc > 1 ? intval($a->argv[1]) : 0;
    if (!$item) {
        goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
        // NOTREACHED
    }
    $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_user()));
    if (!count($r)) {
        goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
    }
    $arr = explode(',', $r[0]['tag']);
    if (!count($arr)) {
        goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
    }
    $o .= '<h3>' . t('Remove Item Tag') . '</h3>';
    $o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>';
    $o .= '<form id="tagrm" action="tagrm" method="post" >';
    $o .= '<input type="hidden" name="item" value="' . $item . '" />';
    $o .= '<ul>';
    foreach ($arr as $x) {
        $o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . bbcode($x) . '</input></li>';
    }
    $o .= '</ul>';
    $o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') . '" />';
    $o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') . '" />';
    $o .= '</form>';
    return $o;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:34,代码来源:tagrm.php

示例11: get

 function get()
 {
     $acc = \App::get_account();
     if (!$acc || $acc['account_id'] != get_account_id()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $default_role = '';
     $aid = get_account_id();
     if ($aid) {
         $r = q("select count(channel_id) as total from channel where channel_account_id = %d", intval($aid));
         if ($r && !intval($r[0]['total'])) {
             $default_role = get_config('system', 'default_permissions_role');
         }
         $limit = account_service_class_fetch(get_account_id(), 'total_identities');
         if ($r && $limit !== false) {
             $channel_usage_message = sprintf(t("You have created %1\$.0f of %2\$.0f allowed channels."), $r[0]['total'], $limit);
         } else {
             $channel_usage_message = '';
         }
     }
     $privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
     $perm_roles = \Zotlabs\Access\PermissionRoles::roles();
     if (get_account_techlevel() < 4 && $privacy_role !== 'custom') {
         unset($perm_roles[t('Other')]);
     }
     $name = array('name', t('Name or caption'), x($_REQUEST, 'name') ? $_REQUEST['name'] : '', t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'), "*");
     $nickhub = '@' . \App::get_hostname();
     $nickname = array('nickname', t('Choose a short nickname'), x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : '', sprintf(t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub), "*");
     $role = array('permissions_role', t('Channel role and privacy'), $privacy_role ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', $perm_roles);
     $o = replace_macros(get_markup_template('new_channel.tpl'), array('$title' => t('Create Channel'), '$desc' => t('A channel is your identity on this network. It can represent a person, a blog, or a forum to name a few. Channels can make connections with other channels to share information with highly detailed permissions.'), '$label_import' => t('or <a href="import">import an existing channel</a> from another location.'), '$name' => $name, '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create'), '$channel_usage_message' => $channel_usage_message));
     return $o;
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:33,代码来源:New_channel.php

示例12: get

 function get()
 {
     if (!local_channel()) {
         goaway(z_root() . '/' . $_SESSION['photo_return']);
         // NOTREACHED
     }
     // remove tag on the fly if item and tag are provided
     if (argc() == 4 && argv(1) === 'drop' && intval(argv(2))) {
         $item = intval(argv(2));
         $tag = argv(3);
         $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
         if (!$r) {
             goaway(z_root() . '/' . $_SESSION['photo_return']);
         }
         $r = fetch_post_tags($r, true);
         $item = $r[0];
         $new_tags = array();
         if ($item['term']) {
             for ($x = 0; $x < count($item['term']); $x++) {
                 if ($item['term'][$x]['term'] !== hex2bin($tag)) {
                     $new_tags[] = $item['term'][$x];
                 }
             }
         }
         if ($new_tags) {
             $item['term'] = $new_tags;
         } else {
             unset($item['term']);
         }
         item_store_update($item);
         info(t('Tag removed') . EOL);
         goaway(z_root() . '/' . $_SESSION['photo_return']);
     }
     //if we got only the item print a list of tags to select
     if (argc() == 3 && argv(1) === 'drop' && intval(argv(2))) {
         $o = '';
         $item = intval(argv(2));
         $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
         if (!$r) {
             goaway(z_root() . '/' . $_SESSION['photo_return']);
         }
         $r = fetch_post_tags($r, true);
         if (!count($r[0]['term'])) {
             goaway(z_root() . '/' . $_SESSION['photo_return']);
         }
         $o .= '<h3>' . t('Remove Item Tag') . '</h3>';
         $o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>';
         $o .= '<form id="tagrm" action="tagrm" method="post" >';
         $o .= '<input type="hidden" name="item" value="' . $item . '" />';
         $o .= '<ul>';
         foreach ($r[0]['term'] as $x) {
             $o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x['term']) . '" >' . bbcode($x['term']) . '</input></li>';
         }
         $o .= '</ul>';
         $o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') . '" />';
         $o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') . '" />';
         $o .= '</form>';
         return $o;
     }
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:60,代码来源:Tagrm.php

示例13: likebanner_content

function likebanner_content(&$a)
{
    if (local_channel()) {
        $channel = $a->get_channel();
    } else {
        $channel = null;
    }
    $o = '<h1>Like Banner</h1>';
    $def = $_REQUEST['addr'];
    if ($channel && !$def) {
        $def = $channel['xchan_addr'];
    }
    $o .= '<form action="likebanner" method="get" >';
    $o .= t('Your Webbie:');
    $o .= '<br /><br />';
    $o .= '<input type="text" name="addr" size="32" value="' . $def . '" />';
    $o .= '<br /><br />' . t('Fontsize (px):');
    $o .= '<br /><br />';
    $o .= '<input type="text" name="size" size="32" value="' . ($_REQUEST['size'] ? $_REQUEST['size'] : 28) . '" /><br /><br />';
    $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form><br /><br/>';
    if ($_REQUEST['addr']) {
        $o .= '<img style="border: 1px solid #000;" src="likebanner/show/?f=&addr=' . urlencode($_REQUEST['addr']) . '&size=' . $_REQUEST['size'] . '" alt="banner" />';
        if ($channel) {
            $p = q("select profile_guid from profile where uid = %d and is_default = 1 limit 1", intval($channel['channel_id']));
            if ($p) {
                $link = z_root() . '/like/profile/' . $p[0]['profile_guid'] . '?f=&verb=like&interactive=1';
                $o .= EOL . EOL . t('Link:') . EOL . '<input type="text" size="64" onclick="this.select();" value="' . $link . '" />';
                $html = '<a href="' . $link . '" ><img src="' . z_root() . '/likebanner?f=&addr=' . $def . '&size=' . $_REQUEST['size'] . '" alt="' . t('Like us on RedMatrix') . '" /></a>';
                $o .= EOL . EOL . t('Embed:') . EOL . '<input type="text" size="64" onclick="this.select();" value="' . htmlspecialchars($html, ENT_QUOTES, 'UTF-8') . '" />';
            }
        }
    }
    return $o;
}
开发者ID:einervonvielen,项目名称:redmatrix-addons,代码行数:34,代码来源:likebanner.php

示例14: init

 function init()
 {
     $uri = urldecode(notags(trim($_GET['uri'])));
     logger('xrd: ' . $uri, LOGGER_DEBUG);
     $resource = $uri;
     if (substr($uri, 0, 4) === 'http') {
         $uri = str_replace('~', '', $uri);
         $name = basename($uri);
     } else {
         $local = str_replace('acct:', '', $uri);
         if (substr($local, 0, 2) == '//') {
             $local = substr($local, 2);
         }
         $name = substr($local, 0, strpos($local, '@'));
     }
     $r = q("SELECT * FROM channel WHERE channel_address = '%s' LIMIT 1", dbesc($name));
     if (!$r) {
         killme();
     }
     $dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'), array('$baseurl' => z_root(), '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.', '', \App::get_hostname()), '$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey']))));
     $salmon_key = salmon_key($r[0]['channel_pubkey']);
     header('Access-Control-Allow-Origin: *');
     header("Content-type: application/xrd+xml");
     $aliases = array('acct:' . channel_reddress($r[0]), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
     for ($x = 0; $x < count($aliases); $x++) {
         if ($aliases[$x] === $resource) {
             unset($aliases[$x]);
         }
     }
     $o = replace_macros(get_markup_template('xrd_person.tpl'), array('$nick' => $r[0]['channel_address'], '$accturi' => $resource, '$aliases' => $aliases, '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'], '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'], '$atom' => z_root() . '/feed/' . $r[0]['channel_address'], '$zot_post' => z_root() . '/post/' . $r[0]['channel_address'], '$poco_url' => z_root() . '/poco/' . $r[0]['channel_address'], '$photo' => z_root() . '/photo/profile/l/' . $r[0]['channel_id'], '$dspr' => $dspr, '$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$subscribe' => z_root() . '/follow?url={uri}', '$bigkey' => salmon_key($r[0]['channel_pubkey'])));
     $arr = array('user' => $r[0], 'xml' => $o);
     call_hooks('personal_xrd', $arr);
     echo $arr['xml'];
     killme();
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:35,代码来源:Xrd.php

示例15: lostpass_content

function lostpass_content(&$a)
{
    if (x($_GET, 'verify')) {
        $verify = $_GET['verify'];
        $hash = hash('whirlpool', $verify);
        $r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1", dbesc($hash));
        if (!count($r)) {
            notice(t("Request could not be verified. (You may have previously submitted it.) Password reset failed.") . EOL);
            goaway(z_root());
            return;
        }
        $uid = $r[0]['uid'];
        $username = $r[0]['username'];
        $email = $r[0]['email'];
        $new_password = autoname(6) . mt_rand(100, 9999);
        $new_password_encoded = hash('whirlpool', $new_password);
        $r = q("UPDATE `user` SET `password` = '%s', `pwdreset` = ''  WHERE `uid` = %d LIMIT 1", dbesc($new_password_encoded), intval($uid));
        if ($r) {
            $tpl = get_markup_template('pwdreset.tpl');
            $o .= replace_macros($tpl, array('$lbl1' => t('Password Reset'), '$lbl2' => t('Your password has been reset as requested.'), '$lbl3' => t('Your new password is'), '$lbl4' => t('Save or copy your new password - and then'), '$lbl5' => '<a href="' . $a->get_baseurl() . '">' . t('click here to login') . '</a>.', '$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$newpass' => $new_password, '$baseurl' => $a->get_baseurl()));
            info("Your password has been reset." . EOL);
            $email_tpl = get_intltext_template("passchanged_eml.tpl");
            $email_tpl = replace_macros($email_tpl, array('$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), '$username' => $username, '$email' => $email, '$new_password' => $new_password, '$uid' => $newuid));
            $res = mail($email, "Your password has changed at {$a->config['sitename']}", $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit');
            return $o;
        }
    } else {
        $tpl = get_markup_template('lostpass.tpl');
        $o .= replace_macros($tpl, array('$title' => t('Forgot your Password?'), '$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$name' => t('Nickname or Email: '), '$submit' => t('Reset')));
        return $o;
    }
}
开发者ID:nextgensh,项目名称:friendica,代码行数:32,代码来源:lostpass.php


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