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


PHP nav_set_selected函数代码示例

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


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

示例1: help_content

function help_content(&$a)
{
    nav_set_selected('help');
    global $lang;
    $text = '';
    if ($a->argc > 1) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.md');
        $a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
    }
    $home = load_doc_file('doc/Home.md');
    if (!$text) {
        $text = $home;
        $a->page['title'] = t('Help');
    } else {
        $a->page['aside'] = Markdown($home);
    }
    if (!strlen($text)) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
        $tpl = get_markup_template("404.tpl");
        return replace_macros($tpl, array('$message' => t('Page not found.')));
    }
    $html = Markdown($text);
    $html = "<style>.md_warning { padding: 1em; border: #ff0000 solid 2px; background-color: #f9a3a3; color: #ffffff;</style>" . $html;
    return $html;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:25,代码来源:help.php

示例2: get

 function get()
 {
     nav_set_selected('help');
     if ($_REQUEST['search']) {
         $o .= '<div id="help-content" class="generic-content-wrapper">';
         $o .= '<div class="section-title-wrapper">';
         $o .= '<h2>' . t('Documentation Search') . ' - ' . htmlspecialchars($_REQUEST['search']) . '</h2>';
         $o .= '</div>';
         $o .= '<div class="section-content-wrapper">';
         $r = search_doc_files($_REQUEST['search']);
         if ($r) {
             $o .= '<ul class="help-searchlist">';
             foreach ($r as $rr) {
                 $dirname = dirname($rr['v']);
                 $fname = basename($rr['v']);
                 $fname = substr($fname, 0, strrpos($fname, '.'));
                 $path = trim(substr($dirname, 4), '/');
                 $o .= '<li><a href="help/' . ($path ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_', ' ', notags($fname))) . '</a><br />' . '<b><i>' . 'help/' . ($path ? $path . '/' : '') . $fname . '</i></b><br />' . '...' . str_replace('$Projectname', \Zotlabs\Lib\System::get_platform_name(), $rr['text']) . '...<br /><br /></li>';
             }
             $o .= '</ul>';
             $o .= '</div>';
             $o .= '</div>';
         }
         return $o;
     }
     $content = get_help_content();
     return replace_macros(get_markup_template("help.tpl"), array('$title' => t('$Projectname Documentation'), '$content' => $content));
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:28,代码来源:Help.php

示例3: notes_init

function notes_init(&$a)
{
    if (!local_user()) {
        return;
    }
    $profile = 0;
    $which = $a->user['nickname'];
    nav_set_selected('home');
    //	profile_load($a,$which,$profile);
}
开发者ID:vinzv,项目名称:friendica,代码行数:10,代码来源:notes.php

示例4: community_content

function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public posts can be shown
    // OR your own posts if you are a logged in member
    if (!get_config('alt_pager', 'global') && !get_pconfig(local_user(), 'system', 'alt_pager')) {
        $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`\n\t\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0 \n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0");
        if (count($r)) {
            $a->set_pager_total($r[0]['total']);
        }
        if (!$r[0]['total']) {
            info(t('No results.') . EOL);
            return $o;
        }
    }
    //$r = q("SELECT distinct(`item`.`uri`)
    $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` FORCE INDEX (`received`) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' \n\t\tAND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent`\n\t\tAND `user`.`hidewall` = 0\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self`\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    //		group by `item`.`uri`
    if (!count($r)) {
        info(t('No results.') . EOL);
        return $o;
    }
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', $update);
    if (get_config('alt_pager', 'global') || get_pconfig(local_user(), 'system', 'alt_pager')) {
        $o .= alt_pager($a, count($r));
    } else {
        $o .= paginate($a);
    }
    return $o;
}
开发者ID:ridcully,项目名称:friendica,代码行数:52,代码来源:community.php

示例5: help_content

function help_content(&$a)
{
    nav_set_selected('help');
    global $lang;
    $doctype = 'markdown';
    require_once 'library/markdown.php';
    $text = '';
    if (argc() > 1) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.md');
        $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-', ' ', notags(argv(1))));
    }
    if (!$text) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.bb');
        if ($text) {
            $doctype = 'bbcode';
        }
        $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_', ' ', notags(argv(1))));
    }
    if (!$text) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.html');
        if ($text) {
            $doctype = 'html';
        }
        $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-', ' ', notags(argv(1))));
    }
    if (!$text) {
        $text = load_doc_file('doc/Site.md');
        $a->page['title'] = t('Help');
    }
    if (!$text) {
        $doctype = 'bbcode';
        $text = load_doc_file('doc/main.bb');
        $a->page['title'] = t('Help');
    }
    if (!strlen($text)) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
        $tpl = get_markup_template("404.tpl");
        return replace_macros($tpl, array('$message' => t('Page not found.')));
    }
    $text = preg_replace_callback("/#include (.*?)\\;/ism", 'preg_callback_help_include', $text);
    if ($doctype === 'html') {
        $content = $text;
    }
    if ($doctype === 'markdown') {
        $content = Markdown($text);
    }
    if ($doctype === 'bbcode') {
        require_once 'include/bbcode.php';
        $content = bbcode($text);
    }
    return replace_macros(get_markup_template("help.tpl"), array('$content' => $content));
}
开发者ID:Mauru,项目名称:red,代码行数:52,代码来源:help.php

示例6: get

 function get()
 {
     nav_set_selected('settings');
     if (!local_channel() || $_SESSION['delegate']) {
         notice(t('Permission denied.') . EOL);
         return login();
     }
     $channel = \App::get_channel();
     if ($channel) {
         head_set_icon($channel['xchan_photo_s']);
     }
     $o = $this->sm->call('get');
     if ($o !== false) {
         return $o;
     }
     $o = '';
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:17,代码来源:Settings.php

示例7: viewcontacts_init

function viewcontacts_init(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        return;
    }
    nav_set_selected('home');
    if ($a->argc > 1) {
        $nick = $a->argv[1];
        $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", dbesc($nick));
        if (!count($r)) {
            return;
        }
        $a->data['user'] = $r[0];
        $a->profile_uid = $r[0]['uid'];
        $is_owner = local_user() && local_user() == $a->profile_uid;
        profile_load($a, $a->argv[1]);
    }
}
开发者ID:vinzv,项目名称:friendica,代码行数:18,代码来源:viewcontacts.php

示例8: message_content

function message_content(&$a)
{
    $o = '';
    nav_set_selected('messages');
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return login();
    }
    $channel = $a->get_channel();
    head_set_icon($channel['xchan_photo_s']);
    $cipher = get_pconfig(local_channel(), 'system', 'default_cipher');
    if (!$cipher) {
        $cipher = 'aes256';
    }
    $tpl = get_markup_template('mail_head.tpl');
    $header = replace_macros($tpl, array('$messages' => t('Messages'), '$tab_content' => $tab_content));
    if (argc() == 3 && argv(1) === 'dropconv') {
        if (!intval(argv(2))) {
            return;
        }
        $cmd = argv(1);
        $r = private_messages_drop(local_channel(), argv(2), true);
        if ($r) {
            info(t('Conversation removed.') . EOL);
        }
        goaway($a->get_baseurl(true) . '/message');
    }
    if (argc() == 1) {
        // list messages
        $o .= $header;
        // private_messages_list() can do other more complicated stuff, for now keep it simple
        $r = private_messages_list(local_channel(), '', $a->pager['start'], $a->pager['itemspage']);
        if (!$r) {
            info(t('No messages.') . EOL);
            return $o;
        }
        $tpl = get_markup_template('mail_list.tpl');
        foreach ($r as $rr) {
            $o .= replace_macros($tpl, array('$id' => $rr['id'], '$from_name' => $rr['from']['xchan_name'], '$from_url' => chanlink_hash($rr['from_xchan']), '$from_photo' => $rr['from']['xchan_photo_s'], '$to_name' => $rr['to']['xchan_name'], '$to_url' => chanlink_hash($rr['to_xchan']), '$to_photo' => $rr['to']['xchan_photo_s'], '$subject' => $rr['seen'] ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>', '$delete' => t('Delete conversation'), '$body' => smilies(bbcode($rr['body'])), '$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], t('D, d M Y - g:i A')), '$seen' => $rr['seen']));
        }
        $o .= alt_pager($a, count($r));
        return $o;
    }
}
开发者ID:redmatrix,项目名称:red,代码行数:44,代码来源:message.php

示例9: community_content

function community_content(&$a, $update = 0)
{
    $o = '';
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'no_community_page')) {
        notice(t('Not available.') . EOL);
        return;
    }
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o .= '<h3>' . t('Community') . '</h3>';
    if (!$update) {
        nav_set_selected('community');
        $o .= '<div id="live-community"></div>' . "\r\n";
        $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
    }
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    // Here is the way permissions work in this module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 ");
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`, `user`.`hidewall`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' \n\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 \n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\tORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
    // we behave the same in message lists as the search module
    $o .= conversation($a, $r, 'community', false);
    $o .= paginate($a);
    $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
    return $o;
}
开发者ID:nphyx,项目名称:friendica,代码行数:43,代码来源:community.php

示例10: help_content

function help_content(&$a)
{
    nav_set_selected('help');
    global $lang;
    require_once 'library/markdown.php';
    $text = '';
    if ($a->argc > 1) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.md');
        $a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
    }
    if (!$text) {
        $text = load_doc_file('doc/Home.md');
        $a->page['title'] = t('Help');
    }
    if (!strlen($text)) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
        $tpl = get_markup_template("404.tpl");
        return replace_macros($tpl, array('$message' => t('Page not found.')));
    }
    return Markdown($text);
}
开发者ID:nextgensh,项目名称:friendica,代码行数:21,代码来源:help.php

示例11: search_content

function search_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    nav_set_selected('search');
    require_once "include/bbcode.php";
    require_once 'include/security.php';
    require_once 'include/conversation.php';
    $o = '<div id="live-search"></div>' . "\r\n";
    $o .= '<h3>' . t('Search This Site') . '</h3>';
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    $o .= search($search, 'search-box', '/search', local_user() ? true : false);
    if (!$search) {
        return $o;
    }
    // Here is the way permissions work in the search module...
    // Only public wall posts can be shown
    // OR your own posts if you are a logged in member
    $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\['));
    $search_alg = $s_regx;
    $r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg} ", intval(local_user()));
    if (count($r)) {
        $a->set_pager_total($r[0]['total']);
    }
    if (!$r[0]['total']) {
        info(t('No results.') . EOL);
        return $o;
    }
    $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,\n\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,\n\t\t`user`.`nickname`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tLEFT JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0\n\t\tAND (( `wall` = 1 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `user`.`hidewall` = 0 ) \n\t\t\tOR `item`.`uid` = %d )\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t{$search_alg}\n\t\tORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
    $o .= '<h2>Search results for: ' . $search . '</h2>';
    $o .= conversation($a, $r, 'search', false);
    $o .= paginate($a);
    return $o;
}
开发者ID:nphyx,项目名称:friendica,代码行数:40,代码来源:search.php

示例12: notifications_content

function notifications_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    nav_set_selected('notifications');
    $o = '';
    $notif_tpl = get_markup_template('notifications.tpl');
    $not_tpl = get_markup_template('notify.tpl');
    require_once 'include/bbcode.php';
    $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_channel()));
    if (count($r) > 0) {
        $notifications_available = 1;
        foreach ($r as $it) {
            $notif_content .= replace_macros($not_tpl, array('$item_link' => z_root() . '/notify/view/' . $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date'])));
        }
    } else {
        $notif_content .= t('No more system notifications.');
    }
    $o .= replace_macros($notif_tpl, array('$notif_header' => t('System Notifications'), '$notif_link_mark_seen' => t('Mark all system notifications seen'), '$notif_content' => $notif_content, '$notifications_available' => $notifications_available));
    return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:23,代码来源:notifications.php

示例13: settings_content

 function settings_content(&$a)
 {
     $o = '';
     nav_set_selected('settings');
     if (!local_user()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $tabs = array(array('label' => t('Account settings'), 'url' => $a->get_baseurl() . '/settings', 'sel' => $a->argc == 1 ? 'active' : ''), array('label' => t('Connector settings'), 'url' => $a->get_baseurl() . '/settings/connectors', 'sel' => $a->argc > 1 && $a->argv[1] === 'connectors' ? 'active' : ''), array('label' => t('Plugin settings'), 'url' => $a->get_baseurl() . '/settings/addon', 'sel' => $a->argc > 1 && $a->argv[1] === 'addon' ? 'active' : ''), array('label' => t('Connections'), 'url' => $a->get_baseurl() . '/settings/oauth', 'sel' => $a->argc > 1 && $a->argv[1] === 'oauth' ? 'active' : ''), array('label' => t('Export personal data'), 'url' => $a->get_baseurl() . '/uexport', 'sel' => ''));
     $tabtpl = get_markup_template("common_tabs.tpl");
     $tabs = replace_macros($tabtpl, array('$tabs' => $tabs));
     if ($a->argc > 1 && $a->argv[1] === 'oauth') {
         if ($a->argc > 2 && $a->argv[2] === 'add') {
             $tpl = get_markup_template("settings_oauth_edit.tpl");
             $o .= replace_macros($tpl, array('$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), '', ''), '$key' => array('key', t('Consumer Key'), '', ''), '$secret' => array('secret', t('Consumer Secret'), '', ''), '$redirect' => array('redirect', t('Redirect'), '', ''), '$icon' => array('icon', t('Icon url'), '', '')));
             return $o;
         }
         if ($a->argc > 3 && $a->argv[2] === 'edit') {
             $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d", dbesc($a->argv[3]), local_user());
             if (!count($r)) {
                 notice(t("You can't edit this application."));
                 return;
             }
             $app = $r[0];
             $tpl = get_markup_template("settings_oauth_edit.tpl");
             $o .= replace_macros($tpl, array('$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), $app['name'], ''), '$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 ($a->argc > 3 && $a->argv[2] === 'delete') {
             $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", dbesc($a->argv[3]), local_user());
             goaway($a->get_baseurl() . "/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_user(), local_user());
         $tpl = get_markup_template("settings_oauth.tpl");
         $o .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$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'), '$tabs' => $tabs, '$apps' => $r));
         return $o;
     }
     if ($a->argc > 1 && $a->argv[1] === 'addon') {
         $settings_addons = "";
         $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
         if (!count($r)) {
             $settings_addons = t('No Plugin settings configured');
         }
         call_hooks('plugin_settings', $settings_addons);
         $tpl = get_markup_template("settings_addons.tpl");
         $o .= replace_macros($tpl, array('$title' => t('Plugin Settings'), '$tabs' => $tabs, '$settings_addons' => $settings_addons));
         return $o;
     }
     if ($a->argc > 1 && $a->argv[1] === 'connectors') {
         $settings_connectors = "";
         call_hooks('connector_settings', $settings_connectors);
         $diasp_enabled = sprintf(t('Built-in support for %s connectivity is %s'), t('Diaspora'), get_config('system', 'diaspora_enabled') ? t('enabled') : t('disabled'));
         $ostat_enabled = sprintf(t('Built-in support for %s connectivity is %s'), t('StatusNet'), get_config('system', 'ostatus_disabled') ? t('disabled') : t('enabled'));
         $mail_disabled = function_exists('imap_open') && !get_config('system', 'imap_disabled') ? 0 : 1;
         if (get_config('system', 'dfrn_only')) {
             $mail_disabled = 1;
         }
         if (!$mail_disabled) {
             $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", local_user());
         } else {
             $r = null;
         }
         $mail_server = count($r) ? $r[0]['server'] : '';
         $mail_port = count($r) && intval($r[0]['port']) ? intval($r[0]['port']) : '';
         $mail_ssl = count($r) ? $r[0]['ssltype'] : '';
         $mail_user = count($r) ? $r[0]['user'] : '';
         $mail_replyto = count($r) ? $r[0]['reply_to'] : '';
         $mail_pubmail = count($r) ? $r[0]['pubmail'] : 0;
         $mail_chk = count($r) ? $r[0]['last_check'] : '0000-00-00 00:00:00';
         $tpl = get_markup_template("settings_connectors.tpl");
         $o .= replace_macros($tpl, array('$title' => t('Connector Settings'), '$tabs' => $tabs, '$diasp_enabled' => $diasp_enabled, '$ostat_enabled' => $ostat_enabled, '$h_imap' => t('Email/Mailbox Setup'), '$imap_desc' => t("If you wish to communicate with email contacts using this service (optional), please specify how to connect to your mailbox."), '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk, ''), '$mail_disabled' => $mail_disabled ? t('Email access is disabled on this site.') : '', '$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''), '$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''), '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array('' => t('None'), 'TSL' => 'TSL', 'SSL' => 'SSL')), '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''), '$mail_pass' => array('mail_pass', t('Email password:'), '', ''), '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'), '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''), '$submit' => t('Submit'), '$settings_connectors' => $settings_connectors));
         return $o;
     }
     require_once 'include/acl_selectors.php';
     $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()));
     if (count($p)) {
         $profile = $p[0];
     }
     $username = $a->user['username'];
     $email = $a->user['email'];
     $nickname = $a->user['nickname'];
     $timezone = $a->user['timezone'];
     $notify = $a->user['notify-flags'];
     $defloc = $a->user['default-location'];
     $openid = $a->user['openid'];
     $maxreq = $a->user['maxreq'];
     $expire = intval($a->user['expire']) ? $a->user['expire'] : '';
     $blockwall = $a->user['blockwall'];
     $blocktags = $a->user['blocktags'];
     $expire_items = get_pconfig(local_user(), 'expire', 'items');
     $expire_items = $expire_items === false ? 1 : $expire_items;
     // default if not set: 1
     $expire_notes = get_pconfig(local_user(), 'expire', 'notes');
     $expire_notes = $expire_notes === false ? 1 : $expire_notes;
     // default if not set: 1
     $expire_starred = get_pconfig(local_user(), 'expire', 'starred');
     $expire_starred = $expire_starred === false ? 1 : $expire_starred;
     // default if not set: 1
     $expire_photos = get_pconfig(local_user(), 'expire', 'photos');
//.........这里部分代码省略.........
开发者ID:ryivhnn,项目名称:friendica,代码行数:101,代码来源:settings.php

示例14: search_content

function search_content(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    if (get_config('system', 'local_search') and !local_user()) {
        notice(t('Public access denied.') . EOL);
        return;
        //http_status_exit(403);
        //killme();
    }
    nav_set_selected('search');
    $o = '<h3>' . t('Search') . '</h3>';
    if (x($a->data, 'search')) {
        $search = notags(trim($a->data['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    $tag = false;
    if (x($_GET, 'tag')) {
        $tag = true;
        $search = x($_GET, 'tag') ? notags(trim(rawurldecode($_GET['tag']))) : '';
    }
    $o .= search($search, 'search-box', '/search', local_user() ? true : false, false);
    if (strpos($search, '#') === 0) {
        $tag = true;
        $search = substr($search, 1);
    }
    if (strpos($search, '@') === 0) {
        return dirfind_content($a);
    }
    if (strpos($search, '!') === 0) {
        return dirfind_content($a);
    }
    if (x($_GET, 'search-option')) {
        switch ($_GET['search-option']) {
            case 'fulltext':
                break;
            case 'tags':
                $tag = true;
                break;
            case 'contacts':
                return dirfind_content($a, "@");
                break;
            case 'forums':
                return dirfind_content($a, "!");
                break;
        }
    }
    if (!$search) {
        return $o;
    }
    if (get_config('system', 'only_tag_search')) {
        $tag = true;
    }
    // Here is the way permissions work in the search module...
    // Only public posts can be shown
    // OR your own posts if you are a logged in member
    // No items will be shown if the member has a blocked profile wall.
    if ($tag) {
        logger("Start tag search for '" . $search . "'", LOGGER_DEBUG);
        $r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,\n\t\t\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,\n\t\t\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,\n\t\t\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`\n\t\t\tFROM `term`\n\t\t\t\tINNER JOIN `item` ON `item`.`id`=`term`.`oid`\n\t\t\t\tINNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`\n\t\t\tWHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`\n\t\t\t\tAND (`term`.`uid` = 0 OR (`term`.`uid` = %d AND NOT `term`.`global`)) AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s'\n\t\t\tORDER BY term.created DESC LIMIT %d , %d ", intval(local_user()), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc(protect_sprintf($search)), intval($a->pager['start']), intval($a->pager['itemspage']));
    } else {
        logger("Start fulltext search for '" . $search . "'", LOGGER_DEBUG);
        if (get_config('system', 'use_fulltext_engine')) {
            $sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
        } else {
            $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
        }
        $r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,\n\t\t\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,\n\t\t\t\t`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,\n\t\t\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`\n\t\t\tFROM `item`\n\t\t\t\tINNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`\n\t\t\tWHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`\n\t\t\t\tAND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND (`item`.`private` OR NOT `item`.`network` IN ('%s', '%s', '%s'))))\n\t\t\t\t{$sql_extra}\n\t\t\tGROUP BY `item`.`uri` ORDER BY `item`.`id` DESC LIMIT %d , %d ", intval(local_user()), dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), intval($a->pager['start']), intval($a->pager['itemspage']));
    }
    if (!count($r)) {
        info(t('No results.') . EOL);
        return $o;
    }
    if ($tag) {
        $title = sprintf(t('Items tagged with: %s'), $search);
    } else {
        $title = sprintf(t('Search results for: %s'), $search);
    }
    $o .= replace_macros(get_markup_template("section_title.tpl"), array('$title' => $title));
    logger("Start Conversation for '" . $search . "'", LOGGER_DEBUG);
    $o .= conversation($a, $r, 'search', false);
    $o .= alt_pager($a, count($r));
    logger("Done '" . $search . "'", LOGGER_DEBUG);
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:88,代码来源:search.php

示例15: events_content

function events_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    nav_set_selected('all_events');
    if (argc() > 2 && argv(1) === 'ignore' && intval(argv(2))) {
        $r = q("update event set ignore = 1 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()));
    }
    if (argc() > 2 && argv(1) === 'unignore' && intval(argv(2))) {
        $r = q("update event set ignore = 0 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()));
    }
    $plaintext = true;
    //	if(feature_enabled(local_channel(),'richtext'))
    //		$plaintext = false;
    $htpl = get_markup_template('event_head.tpl');
    $a->page['htmlhead'] .= replace_macros($htpl, array('$baseurl' => $a->get_baseurl(), '$editselect' => $plaintext ? 'none' : 'textareas'));
    $o = "";
    // tabs
    $channel = $a->get_channel();
    $tabs = profile_tabs($a, True, $channel['channel_address']);
    $mode = 'view';
    $y = 0;
    $m = 0;
    $ignored = x($_REQUEST, 'ignored') ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '';
    if (argc() > 1) {
        if (argc() > 2 && argv(1) == 'event') {
            $mode = 'edit';
            $event_id = argv(2);
        }
        if (argc() > 2 && argv(1) === 'add') {
            $mode = 'add';
            $item_id = intval(argv(2));
        }
        if (argc() > 2 && argv(1) === 'drop') {
            $mode = 'drop';
            $event_id = argv(2);
        }
        if (argv(1) === 'new') {
            $mode = 'new';
            $event_id = '';
        }
        if (argc() > 2 && intval(argv(1)) && intval(argv(2))) {
            $mode = 'view';
            $y = intval(argv(1));
            $m = intval(argv(2));
        }
    }
    if ($mode === 'add') {
        event_addtocal($item_id, local_channel());
        killme();
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        $export = false;
        if (argc() === 4 && argv(3) === 'export') {
            $export = true;
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        if (argv(1) === 'json') {
            if (x($_GET, 'start')) {
                $start = date("Y-m-d h:i:s", $_GET['start']);
            }
            if (x($_GET, 'end')) {
                $finish = date("Y-m-d h:i:s", $_GET['end']);
            }
        }
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:101,代码来源:events.php


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