本文整理汇总了PHP中get_pconfig函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pconfig函数的具体用法?PHP get_pconfig怎么用?PHP get_pconfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pconfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send a multipart/alternative message with Text and HTML versions
*
* @param fromName name of the sender
* @param fromEmail email fo the sender
* @param replyTo replyTo address to direct responses
* @param toEmail destination email address
* @param messageSubject subject of the message
* @param htmlVersion html version of the message
* @param textVersion text only version of the message
* @param additionalMailHeader additions to the smtp mail header
* @param optional uid user id of the destination user
*/
public static function send($params)
{
call_hooks('emailer_send_prepare', $params);
$email_textonly = False;
if (x($params, "uid")) {
$email_textonly = get_pconfig($params['uid'], "system", "email_textonly");
}
$fromName = email_header_encode(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
// generate a mime boundary
$mimeBoundary = rand(0, 9) . "-" . rand(10000000000, 99999999999) . "-" . rand(10000000000, 99999999999) . "=:" . rand(10000, 99999);
// generate a multipart/alternative message header
$messageHeader = $params['additionalMailHeader'] . "From: {$fromName} <{$params['fromEmail']}>\n" . "Reply-To: {$fromName} <{$params['replyTo']}>\n" . "MIME-Version: 1.0\n" . "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
// assemble the final multipart message body with the text and html types included
$textBody = chunk_split(base64_encode($params['textVersion']));
$htmlBody = chunk_split(base64_encode($params['htmlVersion']));
$multipartMessageBody = "--" . $mimeBoundary . "\n" . "Content-Type: text/plain; charset=UTF-8\n" . "Content-Transfer-Encoding: base64\n\n" . $textBody . "\n";
if (!$email_textonly && !is_null($params['htmlVersion'])) {
$multipartMessageBody .= "--" . $mimeBoundary . "\n" . "Content-Type: text/html; charset=UTF-8\n" . "Content-Transfer-Encoding: base64\n\n" . $htmlBody . "\n";
}
$multipartMessageBody .= "--" . $mimeBoundary . "--\n";
// message ending
// send the message
$hookdata = array('to' => $params['toEmail'], 'subject' => $messageSubject, 'body' => $multipartMessageBody, 'headers' => $messageHeader);
//echo "<pre>"; var_dump($hookdata); killme();
call_hooks("emailer_send", $hookdata);
$res = mail($hookdata['to'], $hookdata['subject'], $hookdata['body'], $hookdata['headers']);
logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
logger("return value " . ($res ? "true" : "false"), LOGGER_DEBUG);
return $res;
}
示例2: update_network_content
function update_network_content(&$a)
{
$profile_uid = intval($_GET['p']);
header("Content-type: text/html");
echo "<!DOCTYPE html><html><body>\r\n";
echo "<section>";
if (!get_pconfig($profile_uid, "system", "no_auto_update") or $_GET['force'] == 1) {
$text = network_content($a, $profile_uid);
} else {
$text = "";
}
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\\s*audio[^>]*>(.*?)<\\s*\\/\\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\\s*video[^>]*>(.*?)<\\s*\\/\\s*video>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\\s*embed[^>]*>(.*?)<\\s*\\/\\s*embed>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\\s*iframe[^>]*>(.*?)<\\s*\\/\\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
echo str_replace("\t", ' ', $text);
echo "</section>";
echo "</body></html>\r\n";
killme();
}
示例3: nofed_post_local
function nofed_post_local(&$a, &$b)
{
if ($b['created'] != $b['edited']) {
return;
}
if ($b['mid'] !== $b['parent_mid']) {
return;
}
if (local_channel() && local_channel() == $b['uid']) {
if ($b['allow_cid'] || $b['allow_gid'] || $b['deny_cid'] || $b['deny_gid']) {
return;
}
$nofed_post = get_pconfig(local_channel(), 'nofed', 'post');
if (!$nofed_post) {
return;
}
$nofed_enable = $nofed_post && x($_REQUEST, 'nofed_enable') ? intval($_REQUEST['nofed_enable']) : 0;
// if API is used, default to the chosen settings
if ($_REQUEST['api_source'] && intval(get_pconfig(local_channel(), 'nofed', 'post_by_default'))) {
$nofed_enable = 1;
}
if ($nofed_enable) {
return;
}
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'nodeliver';
}
}
示例4: curweather_plugin_settings
function curweather_plugin_settings(&$a, &$s)
{
if (!local_user()) {
return;
}
/* Add our stylesheet to the curweather so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$enable = intval(get_pconfig(local_user(), 'curweather', 'curweather_enable'));
$enable_checked = $enable ? ' checked="checked" ' : '';
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Current Weather') . '</h3>';
$s .= '<div id="curweather-settings-wrapper">';
$s .= '<p>Find the location code for the airport/weather station nearest you <a href="http://en.wikipedia.org/wiki/International_Air_Transport_Association_airport_code" target="_blank">here</a>.</p>';
$s .= '<label id="curweather-location-label" for="curweather_loc">' . t('Weather Location: ') . '</label>';
$s .= '<input id="curweather-location" type="text" name="curweather_loc" value="' . $curweather_loc . '"/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="curweather-enable-label" for="curweather_enable">' . t('Enable Current Weather') . '</label>';
$s .= '<input id="curweather-enable" type="checkbox" name="curweather_enable" value="1" ' . $enable_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '</div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="curweather-settings-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}
示例5: widgets_settings
function widgets_settings(&$a, &$o)
{
if (!local_user()) {
return;
}
$key = get_pconfig(local_user(), 'widgets', 'key');
if ($key == '') {
$key = mt_rand();
set_pconfig(local_user(), 'widgets', 'key', $key);
}
$widgets = array();
$d = dir(dirname(__FILE__));
while (false !== ($f = $d->read())) {
if (substr($f, 0, 7) == "widget_") {
preg_match("|widget_([^.]+).php|", $f, $m);
$w = $m[1];
if ($w != "") {
require_once $f;
$widgets[] = array($w, call_user_func($w . "_widget_name"));
}
}
}
$t = file_get_contents(dirname(__FILE__) . "/settings.tpl");
$o .= replace_macros($t, array('$submit' => t('Generate new key'), '$baseurl' => $a->get_baseurl(), '$title' => "Widgets", '$label' => t('Widgets key'), '$key' => $key, '$widgets_h' => t('Widgets available'), '$widgets' => $widgets));
}
示例6: altpager_settings
/**
*
* Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
function altpager_settings(&$a, &$s)
{
if (!local_user()) {
return;
}
$global = get_config("alt_pager", "global");
if ($global == 1) {
return;
}
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/altpager/altpager.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$altpager = get_pconfig(local_user(), 'system', 'alt_pager');
if ($altpager === false) {
$altpager = 0;
}
$checked = $altpager ? ' checked="checked" ' : '';
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Alternate Pagination Setting') . '</h3>';
$s .= '<div id="altpager-wrapper">';
$s .= '<label id="altpager-label" for="altpager">' . t('Use links to "newer" and "older" pages in place of page numbers?') . '</label>';
$s .= '<input id="altpager-input" type="checkbox" name="altpager" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="altpager-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}
示例7: theme_content
/**
* Theme settings
*/
function theme_content(&$a)
{
if (!local_user()) {
return;
}
$font_size = get_pconfig(local_user(), 'diabook', 'font_size');
$line_height = get_pconfig(local_user(), 'diabook', 'line_height');
$resolution = get_pconfig(local_user(), 'diabook', 'resolution');
$color = get_pconfig(local_user(), 'diabook', 'color');
$TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm');
$ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom');
$ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX');
$ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY');
$close_pages = get_pconfig(local_user(), 'diabook', 'close_pages');
$close_mapquery = get_pconfig(local_user(), 'diabook', 'close_mapquery');
$close_profiles = get_pconfig(local_user(), 'diabook', 'close_profiles');
$close_helpers = get_pconfig(local_user(), 'diabook', 'close_helpers');
$close_services = get_pconfig(local_user(), 'diabook', 'close_services');
$close_friends = get_pconfig(local_user(), 'diabook', 'close_friends');
$close_twitter = get_pconfig(local_user(), 'diabook', 'close_twitter');
$close_lastusers = get_pconfig(local_user(), 'diabook', 'close_lastusers');
$close_lastphotos = get_pconfig(local_user(), 'diabook', 'close_lastphotos');
$close_lastlikes = get_pconfig(local_user(), 'diabook', 'close_lastlikes');
return diabook_form($a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes);
}
示例8: invite_content
function invite_content(&$a)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
return;
}
$tpl = get_markup_template('invite.tpl');
$invonly = false;
if (get_config('system', 'invitation_only')) {
$invonly = true;
$x = get_pconfig(local_user(), 'system', 'invites_remaining');
if (!$x && !is_site_admin()) {
notice(t('You have no more invitations available') . EOL);
return '';
}
}
$dirloc = get_config('system', 'directory_submit_url');
if (strlen($dirloc)) {
if ($a->config['register_policy'] == REGISTER_CLOSED) {
$linktxt = sprintf(t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), dirname($dirloc) . '/siteinfo');
} elseif ($a->config['register_policy'] != REGISTER_CLOSED) {
$linktxt = sprintf(t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), $a->get_baseurl()) . "\r\n" . "\r\n" . sprintf(t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'), dirname($dirloc) . '/siteinfo');
}
} else {
$o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
return $o;
}
$o = replace_macros($tpl, array('$invite' => t('Send invitations'), '$addr_text' => t('Enter email addresses, one per line:'), '$msg_text' => t('Your message:'), '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linktxt . "\r\n" . "\r\n" . ($invonly ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . t('Once you have registered, please connect with me via my profile page at:') . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendica.com') . "\r\n" . "\r\n", '$submit' => t('Submit')));
return $o;
}
示例9: oembed_replacecb
/** @file */
function oembed_replacecb($matches)
{
$embedurl = $matches[1];
// implements a personal embed white/black list for logged in members
if (local_channel()) {
if ($x = get_pconfig(local_channel(), 'system', 'embed_deny')) {
$l = explode("\n", $x);
if ($l) {
foreach ($l as $ll) {
if (trim($ll) && strpos($embedurl, trim($ll)) !== false) {
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
}
}
}
}
if ($x = get_pconfig(local_channel(), 'system', 'embed_allow')) {
$found = false;
$l = explode("\n", $x);
if ($l) {
foreach ($l as $ll) {
if (trim($ll) && strpos($embedurl, trim($ll)) !== false) {
$found = true;
break;
}
}
}
if (!$found) {
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
}
}
}
$j = oembed_fetch_url($embedurl);
$s = oembed_format_object($j);
return $s;
}
示例10: change_channel
/**
* @brief Change to another channel with current logged-in account.
*
* @param int $change_channel The channel_id of the channel you want to change to
*
* @return bool|array false or channel record of the new channel
*/
function change_channel($change_channel)
{
$ret = false;
if ($change_channel) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and channel_removed = 0 limit 1", intval($change_channel), intval(get_account_id()));
// It's not there. Is this an administrator, and is this the sys channel?
if (is_developer()) {
if (!$r) {
if (is_site_admin()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_system = 1 and channel_removed = 0 limit 1", intval($change_channel));
}
}
}
if ($r) {
$hash = $r[0]['channel_hash'];
$_SESSION['uid'] = intval($r[0]['channel_id']);
get_app()->set_channel($r[0]);
$_SESSION['theme'] = $r[0]['channel_theme'];
$_SESSION['mobile_theme'] = get_pconfig(local_channel(), 'system', 'mobile_theme');
date_default_timezone_set($r[0]['channel_timezone']);
$ret = $r[0];
}
$x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
if ($x) {
$_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
get_app()->set_observer($x[0]);
get_app()->set_perms(get_all_perms(local_channel(), $hash));
}
if (!is_dir('store/' . $r[0]['channel_address'])) {
@os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
}
}
return $ret;
}
示例11: langfilter_prepare_body
function langfilter_prepare_body(&$a, &$b)
{
if (get_pconfig(local_user(), 'langfilter', 'disable')) {
return;
}
if (local_user()) {
$langs = get_pconfig(local_user(), 'langfilter', 'languages');
}
if ($langs) {
$arr = explode(',', $langs);
} else {
return;
}
$found = false;
$l = new Text_LanguageDetect();
$l->_name_mode = 2;
// two letter codes
$l->_threshold = 600;
// make it a bit harder to be confident with a lng
// IOW make it more possible that lng is correct
$lng = $l->detectSimple($b['html']);
if ($lng == null) {
return;
}
if (!in_array($lng, $arr)) {
$found = true;
}
if ($lng == null) {
$found = false;
}
if ($found) {
$rnd = random_string(8);
$b['html'] = '<div id="langfilter-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'langfilter-' . $rnd . '\'); >' . sprintf(t('unspoken language %s - Click to open/close'), $lng) . '</div><div id="langfilter-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
}
}
示例12: change_channel
function change_channel($change_channel)
{
$ret = false;
if ($change_channel) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_account_id = %d and not ( channel_pageflags & %d) limit 1", intval($change_channel), intval(get_account_id()), intval(PAGE_REMOVED));
if ($r) {
$hash = $r[0]['channel_hash'];
$_SESSION['uid'] = intval($r[0]['channel_id']);
get_app()->set_channel($r[0]);
$_SESSION['theme'] = $r[0]['channel_theme'];
$_SESSION['mobile_theme'] = get_pconfig(local_user(), 'system', 'mobile_theme');
date_default_timezone_set($r[0]['channel_timezone']);
$ret = $r[0];
}
$x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hash));
if ($x) {
$_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
get_app()->set_observer($x[0]);
get_app()->set_perms(get_all_perms(local_user(), $hash));
}
if (!is_dir('store/' . $r[0]['channel_address'])) {
@os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
}
}
return $ret;
}
示例13: pdledit_content
function pdledit_content(&$a)
{
if (!local_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
if (argc() > 1) {
$module = 'mod_' . argv(1) . '.pdl';
} else {
$o .= '<h1>' . t('Edit System Page Description') . '</h1>';
$files = glob('mod/*');
if ($files) {
foreach ($files as $f) {
$name = basename($f, '.php');
$x = theme_include('mod_' . $name . '.pdl');
if ($x) {
$o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
}
}
}
// list module pdl files
return $o;
}
$t = get_pconfig(local_channel(), 'system', $module);
if (!$t) {
$t = file_get_contents(theme_include($module));
}
if (!$t) {
notice(t('Layout not found.') . EOL);
return '';
}
$o = replace_macros(get_markup_template('pdledit.tpl'), array('$header' => t('Edit System Page Description'), '$mname' => t('Module Name:'), '$help' => t('Layout Help'), '$module' => argv(1), '$content' => htmlspecialchars($t, ENT_COMPAT, 'UTF-8'), '$submit' => t('Submit')));
return $o;
}
示例14: search_doc_files
function search_doc_files($s)
{
$a = get_app();
$itemspage = get_pconfig(local_channel(), 'system', 'itemspage');
App::set_pager_itemspage(intval($itemspage) ? $itemspage : 20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
$regexop = db_getfunc('REGEXP');
$r = q("select item_id.sid, item.* from item left join item_id on item.id = item_id.iid where service = 'docfile' and\n\t\tbody {$regexop} '%s' and item_type = %d {$pager_sql}", dbesc($s), intval(ITEM_TYPE_DOC));
$r = fetch_post_tags($r, true);
for ($x = 0; $x < count($r); $x++) {
$r[$x]['text'] = $r[$x]['body'];
$r[$x]['rank'] = 0;
if ($r[$x]['term']) {
foreach ($r[$x]['term'] as $t) {
if (stristr($t['term'], $s)) {
$r[$x]['rank']++;
}
}
}
if (stristr($r[$x]['sid'], $s)) {
$r[$x]['rank']++;
}
$r[$x]['rank'] += substr_count(strtolower($r[$x]['text']), strtolower($s));
// bias the results to the observer's native language
if ($r[$x]['lang'] === App::$language) {
$r[$x]['rank'] = $r[$x]['rank'] + 10;
}
}
usort($r, 'doc_rank_sort');
return $r;
}
示例15: snautofollow_settings
function snautofollow_settings(&$a, &$s)
{
if (!local_user()) {
return;
}
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/snautofollow/snautofollow.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$snautofollow = get_pconfig(local_user(), 'system', 'ostatus_autofriend');
if ($snautofollow === false) {
$snautofollow = false;
}
$snautofollow_checked = $snautofollow ? ' checked="checked" ' : '';
/* Add some HTML to the existing form */
$s .= '<span id="settings_snautofollow_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
$s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
$s .= '</span>';
$s .= '<div id="settings_snautofollow_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
$s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
$s .= '</span>';
$s .= '<div id="snautofollow-wrapper">';
$s .= '<label id="snautofollow-label" for="snautofollow-checkbox">' . t('Automatically follow any StatusNet followers/mentioners') . '</label>';
$s .= '<input id="snautofollow-checkbox" type="checkbox" name="snautofollow" value="1" ' . $snautofollow_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="snautofollow-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}