本文整理汇总了PHP中load_pconfig函数的典型用法代码示例。如果您正苦于以下问题:PHP load_pconfig函数的具体用法?PHP load_pconfig怎么用?PHP load_pconfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_pconfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
function get()
{
if (!local_channel()) {
return login();
}
$content = '<h3>' . t('Configuration Editor') . '</h3>';
$content .= '<div class="descriptive-paragraph">' . t('Warning: Changing some settings could render your channel inoperable. Please leave this page unless you are comfortable with and knowledgeable about how to correctly use this feature.') . '</div>' . EOL . EOL;
if (argc() == 3) {
$content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL;
$content .= '<a href="pconfig/' . escape_tags(argv(1)) . '">pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . ']</a>' . EOL . EOL;
$content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . escape_tags(argv(2)) . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . escape_tags(argv(2)) . ']</a> = ' . get_pconfig(local_channel(), escape_tags(argv(1)), escape_tags(argv(2))) . EOL;
if (in_array(argv(2), $this->disallowed_pconfig())) {
notice(t('This setting requires special processing and editing has been blocked.') . EOL);
return $content;
} else {
$content .= $this->pconfig_form(escape_tags(argv(1)), escape_tags(argv(2)));
}
}
if (argc() == 2) {
$content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL;
load_pconfig(local_channel(), escape_tags(argv(1)));
foreach (\App::$config[local_channel()][escape_tags(argv(1))] as $k => $x) {
$content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . $k . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . ']</a> = ' . escape_tags($x) . EOL;
}
}
if (argc() == 1) {
$r = q("select * from pconfig where uid = " . local_channel());
if ($r) {
foreach ($r as $rr) {
$content .= '<a href="' . 'pconfig/' . escape_tags($rr['cat']) . '/' . escape_tags($rr['k']) . '" >pconfig[' . local_channel() . '][' . escape_tags($rr['cat']) . '][' . escape_tags($rr['k']) . ']</a> = ' . escape_tags($rr['v']) . EOL;
}
}
}
return $content;
}
示例2: import_config
function import_config($channel, $configs)
{
if ($channel && $configs) {
foreach ($configs as $config) {
unset($config['id']);
$config['uid'] = $channel['channel_id'];
dbesc_array($config);
$r = dbq("INSERT INTO pconfig (`" . implode("`, `", array_keys($config)) . "`) VALUES ('" . implode("', '", array_values($config)) . "')");
}
load_pconfig($channel['channel_id']);
}
}
示例3: get
function get()
{
require_once 'include/acl_selectors.php';
require_once 'include/permissions.php';
$yes_no = array(t('No'), t('Yes'));
$p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_channel()));
if (count($p)) {
$profile = $p[0];
}
load_pconfig(local_channel(), 'expire');
$channel = \App::get_channel();
$global_perms = \Zotlabs\Access\Permissions::Perms();
$permiss = array();
$perm_opts = array(array(t('Nobody except yourself'), 0), array(t('Only those you specifically allow'), PERMS_SPECIFIC), array(t('Approved connections'), PERMS_CONTACTS), array(t('Any connections'), PERMS_PENDING), array(t('Anybody on this website'), PERMS_SITE), array(t('Anybody in this network'), PERMS_NETWORK), array(t('Anybody authenticated'), PERMS_AUTHED), array(t('Anybody on the internet'), PERMS_PUBLIC));
$limits = \Zotlabs\Access\PermissionLimits::Get(local_channel());
foreach ($global_perms as $k => $perm) {
$options = array();
foreach ($perm_opts as $opt) {
if (!strstr($k, 'view') && $opt[1] == PERMS_PUBLIC) {
continue;
}
$options[$opt[1]] = $opt[0];
}
$permiss[] = array($k, $perm, $limits[$k], '', $options);
}
$username = $channel['channel_name'];
$nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone'];
$notify = $channel['channel_notifyflags'];
$defloc = $channel['channel_location'];
$maxreq = $channel['channel_max_friend_req'];
$expire = $channel['channel_expire_days'];
$adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
$sys_expire = get_config('system', 'default_expire_days');
// $unkmail = \App::$user['unkmail'];
// $cntunkmail = \App::$user['cntunkmail'];
$hide_presence = intval(get_pconfig(local_channel(), 'system', 'hide_online_status'));
$expire_items = get_pconfig(local_channel(), 'expire', 'items');
$expire_items = $expire_items === false ? '1' : $expire_items;
// default if not set: 1
$expire_notes = get_pconfig(local_channel(), 'expire', 'notes');
$expire_notes = $expire_notes === false ? '1' : $expire_notes;
// default if not set: 1
$expire_starred = get_pconfig(local_channel(), 'expire', 'starred');
$expire_starred = $expire_starred === false ? '1' : $expire_starred;
// default if not set: 1
$expire_photos = get_pconfig(local_channel(), 'expire', 'photos');
$expire_photos = $expire_photos === false ? '0' : $expire_photos;
// default if not set: 0
$expire_network_only = get_pconfig(local_channel(), 'expire', 'network_only');
$expire_network_only = $expire_network_only === false ? '0' : $expire_network_only;
// default if not set: 0
$suggestme = get_pconfig(local_channel(), 'system', 'suggestme');
$suggestme = $suggestme === false ? '0' : $suggestme;
// default if not set: 0
$post_newfriend = get_pconfig(local_channel(), 'system', 'post_newfriend');
$post_newfriend = $post_newfriend === false ? '0' : $post_newfriend;
// default if not set: 0
$post_joingroup = get_pconfig(local_channel(), 'system', 'post_joingroup');
$post_joingroup = $post_joingroup === false ? '0' : $post_joingroup;
// default if not set: 0
$post_profilechange = get_pconfig(local_channel(), 'system', 'post_profilechange');
$post_profilechange = $post_profilechange === false ? '0' : $post_profilechange;
// default if not set: 0
$blocktags = get_pconfig(local_channel(), 'system', 'blocktags');
$blocktags = $blocktags === false ? '0' : $blocktags;
$timezone = date_default_timezone_get();
$opt_tpl = get_markup_template("field_checkbox.tpl");
if (get_config('system', 'publish_all')) {
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else {
$profile_in_dir = replace_macros($opt_tpl, array('$field' => array('profile_in_directory', t('Publish your default profile in the network directory'), $profile['publish'], '', $yes_no)));
}
$suggestme = replace_macros($opt_tpl, array('$field' => array('suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', $yes_no)));
$subdir = strlen(\App::get_path()) ? '<br />' . t('or') . ' ' . z_root() . '/channel/' . $nickname : '';
$tpl_addr = get_markup_template("settings_nick_set.tpl");
$prof_addr = replace_macros($tpl_addr, array('$desc' => t('Your channel address is'), '$nickname' => $nickname, '$subdir' => $subdir, '$basepath' => \App::get_hostname()));
$stpl = get_markup_template('settings.tpl');
$acl = new \Zotlabs\Access\AccessList($channel);
$perm_defaults = $acl->get();
require_once 'include/group.php';
$group_select = mini_group_select(local_channel(), $channel['channel_default_group']);
require_once 'include/menu.php';
$m1 = menu_list(local_channel());
$menu = false;
if ($m1) {
$menu = array();
$current = get_pconfig(local_channel(), 'system', 'channel_menu');
$menu[] = array('name' => '', 'selected' => !$current ? true : false);
foreach ($m1 as $m) {
$menu[] = array('name' => htmlspecialchars($m['menu_name'], ENT_COMPAT, 'UTF-8'), 'selected' => $m['menu_name'] === $current ? ' selected="selected" ' : false);
}
}
$evdays = get_pconfig(local_channel(), 'system', 'evdays');
if (!$evdays) {
$evdays = 3;
}
$permissions_role = get_pconfig(local_channel(), 'system', 'permissions_role');
if (!$permissions_role) {
$permissions_role = 'custom';
//.........这里部分代码省略.........
示例4: conversation
/**
* @brief "Render" a conversation or list of items for HTML display.
*
* There are two major forms of display:
* - Sequential or unthreaded ("New Item View" or search results)
* - conversation view
*
* The $mode parameter decides between the various renderings and also
* figures out how to determine page owner and other contextual items
* that are based on unique features of the calling module.
*
* @param App &$a
* @param array $items
* @param string $mode
* @param boolean $update
* @param string $page_mode default traditional
* @param string $prepared_item
* @return string
*/
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $prepared_item = '')
{
$content_html = '';
$o = '';
require_once 'bbcode.php';
$ssl_state = local_channel() ? true : false;
if (local_channel()) {
load_pconfig(local_channel(), '');
}
$arr_blocked = null;
if (local_channel()) {
$str_blocked = get_pconfig(local_channel(), 'system', 'blocked');
}
if (!local_channel() && $mode == 'network') {
$sys = get_sys_channel();
$id = $sys['channel_id'];
$str_blocked = get_pconfig($id, 'system', 'blocked');
}
if ($str_blocked) {
$arr_blocked = explode(',', $str_blocked);
for ($x = 0; $x < count($arr_blocked); $x++) {
$arr_blocked[$x] = trim($arr_blocked[$x]);
}
}
$profile_owner = 0;
$page_writeable = false;
$live_update_div = '';
$preview = $page_mode === 'preview' ? true : false;
$previewing = $preview ? ' preview ' : '';
if ($mode === 'network') {
$profile_owner = local_channel();
$page_writeable = true;
if (!$update) {
// The special div is needed for liveUpdate to kick in for this page.
// We only launch liveUpdate if you aren't filtering in some incompatible
// way and also you aren't writing a comment (discovered in javascript).
$live_update_div = '<div id="live-network"></div>' . "\r\n" . "<script> var profile_uid = " . $_SESSION['uid'] . "; var netargs = '" . substr($a->cmd, 8) . '?f=' . (x($_GET, 'cid') ? '&cid=' . $_GET['cid'] : '') . (x($_GET, 'search') ? '&search=' . $_GET['search'] : '') . (x($_GET, 'star') ? '&star=' . $_GET['star'] : '') . (x($_GET, 'order') ? '&order=' . $_GET['order'] : '') . (x($_GET, 'bmark') ? '&bmark=' . $_GET['bmark'] : '') . (x($_GET, 'liked') ? '&liked=' . $_GET['liked'] : '') . (x($_GET, 'conv') ? '&conv=' . $_GET['conv'] : '') . (x($_GET, 'spam') ? '&spam=' . $_GET['spam'] : '') . (x($_GET, 'nets') ? '&nets=' . $_GET['nets'] : '') . (x($_GET, 'cmin') ? '&cmin=' . $_GET['cmin'] : '') . (x($_GET, 'cmax') ? '&cmax=' . $_GET['cmax'] : '') . (x($_GET, 'file') ? '&file=' . $_GET['file'] : '') . (x($_GET, 'uri') ? '&uri=' . $_GET['uri'] : '') . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
} elseif ($mode === 'channel') {
$profile_owner = $a->profile['profile_uid'];
$page_writeable = $profile_owner == local_channel();
if (!$update) {
$tab = notags(trim($_GET['tab']));
if ($tab === 'posts') {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
$live_update_div = '<div id="live-channel"></div>' . "\r\n" . "<script> var profile_uid = " . $a->profile['profile_uid'] . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
}
} elseif ($mode === 'display') {
$profile_owner = local_channel();
$page_writeable = false;
$live_update_div = '<div id="live-display"></div>' . "\r\n";
} elseif ($mode === 'page') {
$profile_owner = $a->profile['uid'];
$page_writeable = $profile_owner == local_channel();
$live_update_div = '<div id="live-page"></div>' . "\r\n";
} elseif ($mode === 'search') {
$live_update_div = '<div id="live-search"></div>' . "\r\n";
} elseif ($mode === 'photos') {
$profile_onwer = $a->profile['profile_uid'];
$page_writeable = $profile_owner == local_channel();
$live_update_div = '<div id="live-photos"></div>' . "\r\n";
// for photos we've already formatted the top-level item (the photo)
$content_html = $a->data['photo_html'];
}
$page_dropping = local_channel() && local_channel() == $profile_owner ? true : false;
if (!feature_enabled($profile_owner, 'multi_delete')) {
$page_dropping = false;
}
$channel = $a->get_channel();
$observer = $a->get_observer();
if ($update) {
$return_url = $_SESSION['return_url'];
} else {
$return_url = $_SESSION['return_url'] = $a->query_string;
}
load_contact_links(local_channel());
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
call_hooks('conversation_start', $cb);
$items = $cb['items'];
//.........这里部分代码省略.........
示例5: rtof_post_hook
function rtof_post_hook(&$a, &$b)
{
/**
* Post to Friendica
*/
// for now, just top level posts.
if ($b['mid'] != $b['parent_mid']) {
return;
}
if (!is_item_normal($b) || $b['item_private'] || $b['created'] !== $b['edited']) {
return;
}
if (!perm_is_allowed($b['uid'], '', 'view_stream')) {
return;
}
if (!strstr($b['postopts'], 'rtof')) {
return;
}
logger('Red-to-Friendica post invoked');
load_pconfig($b['uid'], 'rtof');
$api = get_pconfig($b['uid'], 'rtof', 'baseapi');
if (substr($api, -1, 1) != '/') {
$api .= '/';
}
$username = get_pconfig($b['uid'], 'rtof', 'username');
$password = z_unobscure(get_pconfig($b['uid'], 'rtof', 'password'));
$msg = $b['body'];
$postdata = array('status' => $b['body'], 'title' => $b['title'], 'message_id' => $b['mid'], 'source' => 'Red Matrix');
if (strlen($b['body'])) {
$ret = z_post_url($api . 'statuses/update', $postdata, 0, array('http_auth' => $username . ':' . $password, 'novalidate' => 1));
if ($ret['success']) {
logger('rtof: returns: ' . print_r($ret['body'], true));
} else {
logger('rtof: z_post_url failed: ' . print_r($ret['debug'], true));
}
}
}
示例6: settings_content
//.........这里部分代码省略.........
$theme_selected = !x($_SESSION, 'theme') ? $default_theme : $_SESSION['theme'];
$mobile_theme_selected = !x($_SESSION, 'mobile_theme') ? $default_mobile_theme : $_SESSION['mobile_theme'];
$user_scalable = get_pconfig(local_channel(), 'system', 'user_scalable');
$user_scalable = $user_scalable === false ? '1' : $user_scalable;
// default if not set: 1
$browser_update = intval(get_pconfig(local_channel(), 'system', 'update_interval'));
$browser_update = $browser_update == 0 ? 80 : $browser_update / 1000;
// default if not set: 40 seconds
$itemspage = intval(get_pconfig(local_channel(), 'system', 'itemspage'));
$itemspage = $itemspage > 0 && $itemspage < 101 ? $itemspage : 20;
// default if not set: 20 items
$nosmile = get_pconfig(local_channel(), 'system', 'no_smilies');
$nosmile = $nosmile === false ? '0' : $nosmile;
// default if not set: 0
$title_tosource = get_pconfig(local_channel(), 'system', 'title_tosource');
$title_tosource = $title_tosource === false ? '0' : $title_tosource;
// default if not set: 0
$theme_config = "";
if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
require_once $themeconfigfile;
$theme_config = theme_content($a);
}
$tpl = get_markup_template("settings_display.tpl");
$o = replace_macros($tpl, array('$ptitle' => t('Display Settings'), '$d_tset' => t('Theme Settings'), '$d_ctset' => t('Custom Theme Settings'), '$d_cset' => t('Content Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$uid' => local_channel(), '$theme' => $themes ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false, '$mobile_theme' => $mobile_themes ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false, '$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1 - intval($nosmile), '', $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, '$expert' => feature_enabled(local_channel(), 'expert'), '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(), 'system', 'channel_list_mode'), t('(comments displayed separately)'), $yes_no), '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(), 'system', 'network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'channel_divmore_height') ? get_pconfig(local_channel(), 'system', 'channel_divmore_height') : 400, t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'network_divmore_height') ? get_pconfig(local_channel(), 'system', 'network_divmore_height') : 400, t('click to expand content exceeding this height'))));
return $o;
}
if (argv(1) === 'channel') {
require_once 'include/acl_selectors.php';
require_once 'include/permissions.php';
$p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_channel()));
if (count($p)) {
$profile = $p[0];
}
load_pconfig(local_channel(), 'expire');
$channel = $a->get_channel();
$global_perms = get_perms();
$permiss = array();
$perm_opts = array(array(t('Nobody except yourself'), 0), array(t('Only those you specifically allow'), PERMS_SPECIFIC), array(t('Approved connections'), PERMS_CONTACTS), array(t('Any connections'), PERMS_PENDING), array(t('Anybody on this website'), PERMS_SITE), array(t('Anybody in this network'), PERMS_NETWORK), array(t('Anybody authenticated'), PERMS_AUTHED), array(t('Anybody on the internet'), PERMS_PUBLIC));
foreach ($global_perms as $k => $perm) {
$options = array();
foreach ($perm_opts as $opt) {
if (!$perm[2] && $opt[1] == PERMS_PUBLIC) {
continue;
}
$options[$opt[1]] = $opt[0];
}
$permiss[] = array($k, $perm[3], $channel[$perm[0]], $perm[4], $options);
}
// logger('permiss: ' . print_r($permiss,true));
$username = $channel['channel_name'];
$nickname = $channel['channel_address'];
$timezone = $channel['channel_timezone'];
$notify = $channel['channel_notifyflags'];
$defloc = $channel['channel_location'];
$maxreq = $channel['channel_max_friend_req'];
$expire = $channel['channel_expire_days'];
$adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
$sys_expire = get_config('system', 'default_expire_days');
// $unkmail = $a->user['unkmail'];
// $cntunkmail = $a->user['cntunkmail'];
$hide_presence = intval(get_pconfig(local_channel(), 'system', 'hide_online_status'));
$expire_items = get_pconfig(local_channel(), 'expire', 'items');
$expire_items = $expire_items === false ? '1' : $expire_items;
// default if not set: 1
$expire_notes = get_pconfig(local_channel(), 'expire', 'notes');
$expire_notes = $expire_notes === false ? '1' : $expire_notes;
示例7: diabook_init
function diabook_init(&$a)
{
set_template_engine($a, 'smarty3');
//print diabook-version for debugging
$diabook_version = "Diabook (Version: 1.028)";
$a->page['htmlhead'] .= sprintf('<META NAME=generator CONTENT="%s"/>', $diabook_version);
//init css on network and profilepages
$cssFile = null;
// Preload config
load_config("diabook");
load_pconfig(local_user(), "diabook");
// adjust nav-bar, depending state of user
if (local_user()) {
$a->page['htmlhead'] .= '
<script>
$(document).ready(function() {
$("li#nav-site-linkmenu.nav-menu-icon").attr("style","display: block;");
$("li#nav-directory-link.nav-menu").attr("style","margin-right: 0px;");
$("li#nav-home-link.nav-menu").attr("style","display: block;margin-right: 8px;");
});
</script>';
}
if ($a->argv[0] == "profile" && $a->argv[1] != $a->user['nickname']) {
$a->page['htmlhead'] .= '
<script>
$(document).ready(function() {
$("li#nav-site-linkmenu.nav-menu-icon").attr("style","display: block;");
$("li#nav-directory-link.nav-menu").attr("style","margin-right: 0px;");
$("li#nav-home-link.nav-menu").attr("style","display: block;margin-right: 8px;");
});
</script>';
}
//get statuses of boxes at right-hand-column
$close_pages = get_diabook_config("close_pages", 1);
$close_profiles = get_diabook_config("close_profiles", 0);
$close_helpers = get_diabook_config("close_helpers", 0);
$close_services = get_diabook_config("close_services", 0);
$close_friends = get_diabook_config("close_friends", 0);
$close_lastusers = get_diabook_config("close_lastusers", 0);
$close_lastphotos = get_diabook_config("close_lastphotos", 0);
$close_lastlikes = get_diabook_config("close_lastlikes", 0);
$close_mapquery = get_diabook_config("close_mapquery", 1);
//get resolution (wide/normal)
$resolution = false;
$resolution = get_pconfig(local_user(), "diabook", "resolution");
if ($resolution === false) {
$resolution = "normal";
}
//Add META viewport tag respecting the resolution to header for tablets
if ($resolution == "wide") {
$a->page['htmlhead'] .= '<meta name="viewport" content="width=1200" />';
} else {
$a->page['htmlhead'] .= '<meta name="viewport" content="width=980" />';
}
//get colour-scheme
$color = get_diabook_config("color", "diabook");
if ($color == "diabook") {
$color_path = "/";
}
if ($color == "aerith") {
$color_path = "/diabook-aerith/";
}
if ($color == "blue") {
$color_path = "/diabook-blue/";
}
if ($color == "red") {
$color_path = "/diabook-red/";
}
if ($color == "pink") {
$color_path = "/diabook-pink/";
}
if ($color == "green") {
$color_path = "/diabook-green/";
}
if ($color == "dark") {
$color_path = "/diabook-dark/";
}
// remove doubled checkboxes at contacts-edit-page
if ($a->argv[0] === "contacts" && $a->argv[1] != NULL && local_user()) {
$a->page['htmlhead'] .= '
<script>
$(document).ready(function() {
$("span.group_unselected").attr("style","display: none;");
$("span.group_selected").attr("style","display: none;");
$("input.unticked.action").attr("style","float: left; margin-top: 5px;-moz-appearance: none;");
$("li.menu-profile-list").attr("style","min-height: 22px;");
});
</script>';
}
//build personal menue at lefthand-col (id="profile_side") and boxes at right-hand-col at networkpages
if ($a->argv[0] === "network" && local_user()) {
// USER MENU
if (local_user()) {
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array('icon' => count($r) ? $r[0]['micro'] : $a->get_baseurl() . "/images/default-profile-mm.jpg", 'name' => $a->user['username']);
$ps = array('usermenu' => array());
$ps['usermenu']['status'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
$ps['usermenu']['profile'] = array('profile/' . $a->user['nickname'] . '?tab=profile', t('Profile'), "", t('Your profile page'));
$ps['usermenu']['contacts'] = array('contacts', t('Contacts'), "", t('Your contacts'));
$ps['usermenu']['photos'] = array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
//.........这里部分代码省略.........
示例8: twitter_post_hook
function twitter_post_hook(&$a, &$b)
{
/**
* Post to Twitter
*/
if (!is_item_normal($b) || $b['item_private'] || $b['created'] !== $b['edited']) {
return;
}
if (!perm_is_allowed($b['uid'], '', 'view_stream')) {
return;
}
if (!strstr($b['postopts'], 'twitter')) {
return;
}
if ($b['parent'] != $b['id']) {
return;
}
logger('twitter post invoked');
load_pconfig($b['uid'], 'twitter');
$ckey = get_config('twitter', 'consumerkey');
$csecret = get_config('twitter', 'consumersecret');
$otoken = get_pconfig($b['uid'], 'twitter', 'oauthtoken');
$osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret');
$intelligent_shortening = get_pconfig($b['uid'], 'twitter', 'intelligent_shortening');
// Global setting overrides this
if (get_config('twitter', 'intelligent_shortening')) {
$intelligent_shortening = get_config('twitter', 'intelligent_shortening');
}
if ($ckey && $csecret && $otoken && $osecret) {
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
// If it's a repeated message from twitter then do a native retweet and exit
// if (twitter_is_retweet($a, $b['uid'], $b['body']))
// return;
require_once 'library/twitteroauth.php';
require_once 'include/bbcode.php';
$tweet = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
// in theory max char is 140 but T. uses t.co to make links
// longer so we give them 10 characters extra
if (!$intelligent_shortening) {
$max_char = 130;
// max. length for a tweet
// we will only work with up to two times the length of the dent
// we can later send to Twitter. This way we can "gain" some
// information during shortening of potential links but do not
// shorten all the links in a 200000 character long essay.
if (!$b['title'] == '') {
$tmp = $b['title'] . ' : ' . $b['body'];
// $tmp = substr($tmp, 0, 4*$max_char);
} else {
$tmp = $b['body'];
// substr($b['body'], 0, 3*$max_char);
}
// if [url=bla][img]blub.png[/img][/url] get blub.png
$tmp = preg_replace('/\\[url\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\]\\[img\\](\\w+.*?)\\[\\/img\\]\\[\\/url\\]/i', '$2', $tmp);
$tmp = preg_replace('/\\[zrl\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\]\\[zmg\\](\\w+.*?)\\[\\/zmg\\]\\[\\/zrl\\]/i', '$2', $tmp);
// preserve links to images, videos and audios
$tmp = preg_replace('/\\[img\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/img\\]/ism', '$3', $tmp);
$tmp = preg_replace('/\\[\\/?img(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[zmg\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/zmg\\]/ism', '$3', $tmp);
$tmp = preg_replace('/\\[\\/?zmg(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?video(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?youtube(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?vimeo(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?audio(\\s+.*?\\]|\\])/i', '', $tmp);
$linksenabled = get_pconfig($b['uid'], 'twitter', 'post_taglinks');
// if a #tag is linked, don't send the [url] over to SN
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled == '0') {
// #-tags
$tmp = preg_replace('/#\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace('/@\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', '@$2', $tmp);
$tmp = preg_replace('/#\\[zrl\\=(\\w+.*?)\\](\\w+.*?)\\[\\/zrl\\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace('/@\\[zrl\\=(\\w+.*?)\\](\\w+.*?)\\[\\/zrl\\]/i', '@$2', $tmp);
// recycle 1
}
$tmp = preg_replace('/\\[url\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\](\\w+.*?)\\[\\/url\\]/i', '$2 $1', $tmp);
// find all http or https links in the body of the entry and
// apply the shortener if the link is longer then 20 characters
if (strlen($tmp) > $max_char && $max_char > 0) {
preg_match_all('/(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)/i', $tmp, $allurls);
foreach ($allurls as $url) {
foreach ($url as $u) {
if (strlen($u) > 20) {
$sl = short_link($u);
$tmp = str_replace($u, $sl, $tmp);
}
}
}
}
// ok, all the links we want to send out are save, now strip
// away the remaining bbcode
//$msg = strip_tags(bbcode($tmp, false, false));
$msg = bbcode($tmp, false, false);
$msg = str_replace(array('<br>', '<br />'), "\n", $msg);
$msg = strip_tags($msg);
// quotes not working - let's try this
$msg = html_entity_decode($msg);
//.........这里部分代码省略.........
示例9: get_theme_uid
<?php
if (!$a->install) {
// Get the UID of the channel owner
$uid = get_theme_uid();
if ($uid) {
load_pconfig($uid, 'redbasic');
}
// Load the owners pconfig
$nav_bg = get_pconfig($uid, "redbasic", "nav_bg");
$nav_gradient_top = get_pconfig($uid, "redbasic", "nav_gradient_top");
$nav_gradient_bottom = get_pconfig($uid, "redbasic", "nav_gradient_bottom");
$nav_active_gradient_top = get_pconfig($uid, "redbasic", "nav_active_gradient_top");
$nav_active_gradient_bottom = get_pconfig($uid, "redbasic", "nav_active_gradient_bottom");
$nav_bd = get_pconfig($uid, "redbasic", "nav_bd");
$nav_icon_colour = get_pconfig($uid, "redbasic", "nav_icon_colour");
$nav_active_icon_colour = get_pconfig($uid, "redbasic", "nav_active_icon_colour");
$narrow_navbar = get_pconfig($uid, 'redbasic', 'narrow_navbar');
$banner_colour = get_pconfig($uid, 'redbasic', 'banner_colour');
$link_colour = get_pconfig($uid, "redbasic", "link_colour");
$schema = get_pconfig($uid, 'redbasic', 'schema');
$bgcolour = get_pconfig($uid, "redbasic", "background_colour");
$background_image = get_pconfig($uid, "redbasic", "background_image");
$toolicon_colour = get_pconfig($uid, 'redbasic', 'toolicon_colour');
$toolicon_activecolour = get_pconfig($uid, 'redbasic', 'toolicon_activecolour');
$item_colour = get_pconfig($uid, "redbasic", "item_colour");
$comment_item_colour = get_pconfig($uid, "redbasic", "comment_item_colour");
$comment_border_colour = get_pconfig($uid, "redbasic", "comment_border_colour");
$comment_indent = get_pconfig($uid, "redbasic", "comment_indent");
$body_font_size = get_pconfig($uid, "redbasic", "body_font_size");
$font_size = get_pconfig($uid, "redbasic", "font_size");
示例10: twitter_post_hook
function twitter_post_hook(&$a, &$b)
{
/**
* Post to Twitter
*/
require_once "include/network.php";
if (!get_pconfig($b["uid"], 'twitter', 'import')) {
if ($b['deleted'] || $b['private'] || $b['created'] !== $b['edited']) {
return;
}
}
if ($b['parent'] != $b['id']) {
logger("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
// Looking if its a reply to a twitter post
if (substr($b["parent-uri"], 0, 9) != "twitter::" and substr($b["extid"], 0, 9) != "twitter::" and substr($b["thr-parent"], 0, 9) != "twitter::") {
logger("twitter_post_hook: no twitter post " . $b["parent"]);
return;
}
$r = q("SELECT * FROM item WHERE item.uri = '%s' AND item.uid = %d LIMIT 1", dbesc($b["thr-parent"]), intval($b["uid"]));
if (!count($r)) {
logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
$iscomment = true;
$orig_post = $r[0];
}
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "\$1", $orig_post["author-link"]);
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
$nicknameplain = "@" . $nicknameplain;
logger("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
if (strpos($b["body"], $nickname) === false and strpos($b["body"], $nicknameplain) === false) {
$b["body"] = $nickname . " " . $b["body"];
}
logger("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA);
} else {
$iscomment = false;
if ($b['private'] or !strstr($b['postopts'], 'twitter')) {
return;
}
}
if ($b['verb'] == ACTIVITY_POST and $b['deleted']) {
twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete");
}
if ($b['verb'] == ACTIVITY_LIKE) {
logger("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG);
if ($b['deleted']) {
twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike");
} else {
twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "like");
}
return;
}
if ($b['deleted'] || $b['created'] !== $b['edited']) {
return;
}
// if post comes from twitter don't send it back
if ($b['extid'] == NETWORK_TWITTER) {
return;
}
if ($b['app'] == "Twitter") {
return;
}
logger('twitter post invoked');
load_pconfig($b['uid'], 'twitter');
$ckey = get_config('twitter', 'consumerkey');
$csecret = get_config('twitter', 'consumersecret');
$otoken = get_pconfig($b['uid'], 'twitter', 'oauthtoken');
$osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret');
if ($ckey && $csecret && $otoken && $osecret) {
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
// If it's a repeated message from twitter then do a native retweet and exit
if (twitter_is_retweet($a, $b['uid'], $b['body'])) {
return;
}
require_once 'library/twitteroauth.php';
require_once 'include/bbcode.php';
$tweet = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$max_char = 140;
require_once "include/plaintext.php";
$msgarr = plaintext($a, $b, $max_char, true, 8);
$msg = $msgarr["text"];
if ($msg == "" and isset($msgarr["title"])) {
$msg = shortenmsg($msgarr["title"], $max_char - 50);
}
$image = "";
if (isset($msgarr["url"]) and $msgarr["type"] != "photo") {
$msg .= "\n" . $msgarr["url"];
} elseif (isset($msgarr["image"]) and $msgarr["type"] != "video") {
$image = $msgarr["image"];
}
// and now tweet it :-)
if (strlen($msg) and $image != "") {
$img_str = fetch_url($image);
$tempfile = tempnam(get_temppath(), "cache");
file_put_contents($tempfile, $img_str);
// Twitter had changed something so that the old library doesn't work anymore
// so we are using a new library for twitter
// To-Do:
// Switching completely to this library with all functions
require_once "addon/twitter/codebird.php";
//.........这里部分代码省略.........
示例11: statusnet_post_hook
function statusnet_post_hook(&$a, &$b)
{
/**
* Post to statusnet
*/
if (!strstr($b['postopts'], 'statusnet')) {
logger('crosspost not enabled.');
return;
}
if (!is_item_normal($b) || $b['item_private'] || $b['created'] !== $b['edited']) {
logger('not a usable post. ' . print_r($b, true), LOGGER_DEBUG);
return;
}
if (!perm_is_allowed($b['uid'], '', 'view_stream')) {
logger('permissions prevent crossposting.', LOGGER_DEBUG);
return;
}
if ($b['parent'] != $b['id']) {
logger('not a top level post.', LOGGER_DEBUG);
return;
}
// if posts comes from statusnet don't send it back
if ($b['app'] == "StatusNet") {
logger('potential recursion. Crosspost ignored.');
return;
}
logger('statusnet post invoked');
load_pconfig($b['uid'], 'statusnet');
$api = get_pconfig($b['uid'], 'statusnet', 'baseapi');
$ckey = get_pconfig($b['uid'], 'statusnet', 'consumerkey');
$csecret = get_pconfig($b['uid'], 'statusnet', 'consumersecret');
$otoken = get_pconfig($b['uid'], 'statusnet', 'oauthtoken');
$osecret = get_pconfig($b['uid'], 'statusnet', 'oauthsecret');
$intelligent_shortening = get_pconfig($b['uid'], 'statusnet', 'intelligent_shortening');
// Global setting overrides this
if (get_config('statusnet', 'intelligent_shortening')) {
$intelligent_shortening = get_config('statusnet', 'intelligent_shortening');
}
if ($ckey && $csecret && $otoken && $osecret) {
require_once 'include/bbcode.php';
$dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$max_char = $dent->get_maxlength();
// max. length for a dent
// we will only work with up to two times the length of the dent
// we can later send to GNU social. This way we can "gain" some
// information during shortening of potential links but do not
// shorten all the links in a 200000 character long essay.
$tempfile = "";
$intelligent_shortening = get_config('statusnet', 'intelligent_shortening');
if (!$intelligent_shortening) {
if (!$b['title'] == '') {
$tmp = $b['title'] . ": \n" . $b['body'];
// $tmp = substr($tmp, 0, 4*$max_char);
} else {
$tmp = $b['body'];
// substr($b['body'], 0, 3*$max_char);
}
// if [url=bla][img]blub.png[/img][/url] get blub.png
$tmp = preg_replace('/\\[url\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\]\\[img\\](\\w+.*?)\\[\\/img\\]\\[\\/url\\]/i', '$2', $tmp);
$tmp = preg_replace('/\\[zrl\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\]\\[zmg\\](\\w+.*?)\\[\\/zmg\\]\\[\\/zrl\\]/i', '$2', $tmp);
// preserve links to images, videos and audios
$tmp = preg_replace('/\\[img\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/img\\]/ism', '$3', $tmp);
$tmp = preg_replace('/\\[\\/?img(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[zmg\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/zmg\\]/ism', '$3', $tmp);
$tmp = preg_replace('/\\[\\/?zmg(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?video(\\s+.*?\\]|\\])/i', '', $tmp);
$tmp = preg_replace('/\\[\\/?audio(\\s+.*?\\]|\\])/i', '', $tmp);
$linksenabled = get_pconfig($b['uid'], 'statusnet', 'post_taglinks');
// if a #tag is linked, don't send the [url] over to SN
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled == '0') {
// #-tags
$tmp = preg_replace('/#\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace('/@\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', '@$2', $tmp);
// #-tags
$tmp = preg_replace('/#\\[zrl\\=(\\w+.*?)\\](\\w+.*?)\\[\\/zrl\\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace('/@\\[zrl\\=(\\w+.*?)\\](\\w+.*?)\\[\\/zrl\\]/i', '@$2', $tmp);
// recycle 1
$recycle = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8');
$tmp = preg_replace('/' . $recycle . '\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', $recycle . '$2', $tmp);
// recycle 2 (test)
$recycle = html_entity_decode("◌ ", ENT_QUOTES, 'UTF-8');
$tmp = preg_replace('/' . $recycle . '\\[url\\=(\\w+.*?)\\](\\w+.*?)\\[\\/url\\]/i', $recycle . '$2', $tmp);
}
// preserve links to webpages
$tmp = preg_replace('/\\[url\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\](\\w+.*?)\\[\\/url\\]/i', '$2 $1', $tmp);
$tmp = preg_replace('/\\[zrl\\=(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)\\](\\w+.*?)\\[\\/zrl\\]/i', '$2 $1', $tmp);
// find all http or https links in the body of the entry and
// apply the shortener if the link is longer then 20 characters
if (strlen($tmp) > $max_char && $max_char > 0) {
preg_match_all('/(https?\\:\\/\\/[a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\\$\\!\\+\\,]+)/i', $tmp, $allurls);
foreach ($allurls as $url) {
foreach ($url as $u) {
if (strlen($u) > 20) {
$sl = short_link($u);
$tmp = str_replace($u, $sl, $tmp);
}
//.........这里部分代码省略.........
示例12: statusnet_post_hook
function statusnet_post_hook(&$a, &$b)
{
/**
* Post to GNU Social
*/
if (!get_pconfig($b["uid"], 'statusnet', 'import')) {
if ($b['deleted'] || $b['private'] || $b['created'] !== $b['edited']) {
return;
}
}
$api = get_pconfig($b["uid"], 'statusnet', 'baseapi');
$hostname = preg_replace("=https?://([\\w\\.]*)/.*=ism", "\$1", $api);
if ($b['parent'] != $b['id']) {
logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
// Looking if its a reply to a GNU Social post
$hostlength = strlen($hostname) + 2;
if (substr($b["parent-uri"], 0, $hostlength) != $hostname . "::" and substr($b["extid"], 0, $hostlength) != $hostname . "::" and substr($b["thr-parent"], 0, $hostlength) != $hostname . "::") {
logger("statusnet_post_hook: no GNU Social post " . $b["parent"]);
return;
}
$r = q("SELECT `item`.`author-link`, `item`.`uri`, `contact`.`nick` AS contact_nick\n\t\t\tFROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\t\tWHERE `item`.`uri` = '%s' AND `item`.`uid` = %d LIMIT 1", dbesc($b["thr-parent"]), intval($b["uid"]));
if (!count($r)) {
logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
$iscomment = true;
$orig_post = $r[0];
}
//$nickname = "@[url=".$orig_post["author-link"]."]".$orig_post["contact_nick"]."[/url]";
//$nicknameplain = "@".$orig_post["contact_nick"];
$nick = preg_replace("=https?://(.*)/(.*)=ism", "\$2", $orig_post["author-link"]);
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
$nicknameplain = "@" . $nick;
logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
if (strpos($b["body"], $nickname) === false and strpos($b["body"], $nicknameplain) === false) {
$b["body"] = $nickname . " " . $b["body"];
}
logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
} else {
$iscomment = false;
if ($b['private'] or !strstr($b['postopts'], 'statusnet')) {
return;
}
}
if ($b['verb'] == ACTIVITY_POST and $b['deleted']) {
statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
}
if ($b['verb'] == ACTIVITY_LIKE) {
logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
if ($b['deleted']) {
statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
} else {
statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "like");
}
return;
}
if ($b['deleted'] || $b['created'] !== $b['edited']) {
return;
}
// if posts comes from GNU Social don't send it back
if ($b['extid'] == NETWORK_STATUSNET) {
return;
}
if ($b['app'] == "StatusNet") {
return;
}
logger('GNU Socialpost invoked');
load_pconfig($b['uid'], 'statusnet');
$api = get_pconfig($b['uid'], 'statusnet', 'baseapi');
$ckey = get_pconfig($b['uid'], 'statusnet', 'consumerkey');
$csecret = get_pconfig($b['uid'], 'statusnet', 'consumersecret');
$otoken = get_pconfig($b['uid'], 'statusnet', 'oauthtoken');
$osecret = get_pconfig($b['uid'], 'statusnet', 'oauthsecret');
if ($ckey && $csecret && $otoken && $osecret) {
// If it's a repeated message from GNU Social then do a native retweet and exit
if (statusnet_is_retweet($a, $b['uid'], $b['body'])) {
return;
}
require_once 'include/bbcode.php';
$dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$max_char = $dent->get_maxlength();
// max. length for a dent
set_pconfig($b['uid'], 'statusnet', 'max_char', $max_char);
$tempfile = "";
require_once "include/plaintext.php";
require_once "include/network.php";
$msgarr = plaintext($a, $b, $max_char, true, 7);
$msg = $msgarr["text"];
if ($msg == "" and isset($msgarr["title"])) {
$msg = shortenmsg($msgarr["title"], $max_char - 50);
}
$image = "";
if (isset($msgarr["url"]) and $msgarr["type"] != "photo") {
if (strlen($msgarr["url"]) > 20 and strlen($msg . " \n" . $msgarr["url"]) > $max_char) {
$msg .= " \n" . short_link($msgarr["url"]);
} else {
$msg .= " \n" . $msgarr["url"];
}
} elseif (isset($msgarr["image"]) and $msgarr["type"] != "video") {
$image = $msgarr["image"];
//.........这里部分代码省略.........
示例13: get_theme_uid
<?php
require_once 'view/theme/frio/php/PHPColors/Color.php';
if (!$a->install) {
// Get the UID of the channel owner
$uid = get_theme_uid();
if ($uid) {
load_pconfig($uid, 'frio');
}
// Load the owners pconfig
$schema = get_pconfig($uid, "frio", "schema");
$nav_bg = get_pconfig($uid, "frio", "nav_bg");
$nav_icon_color = get_pconfig($uid, "frio", "nav_icon_color");
$link_color = get_pconfig($uid, "frio", "link_color");
$bgcolor = get_pconfig($uid, "frio", "background_color");
$contentbg_transp = get_pconfig($uid, "frio", "contentbg_transp");
$background_image = get_pconfig($uid, "frio", "background_image");
$bg_image_option = get_pconfig($uid, "frio", "bg_image_option");
}
// Now load the scheme. If a value is changed above, we'll keep the settings
// If not, we'll keep those defined by the schema
// Setting $schema to '' wasn't working for some reason, so we'll check it's
// not --- like the mobile theme does instead.
// Allow layouts to over-ride the schema
if ($_REQUEST['schema']) {
$schema = $_REQUEST['schema'];
}
if ($schema && $schema != '---') {
// Check it exists, because this setting gets distributed to clones
if (file_exists('view/theme/frio/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/frio/schema/' . $schema . '.php';
示例14: get_pconfig
/**
* @brief Get a particular channel's config variable given the category name
* ($family) and a key.
*
* Get a particular channel's config value from the given category ($family)
* and the $key from a cached storage in $a->config[$uid].
*
* Returns false if not set.
*
* @param string $uid
* The channel_id
* @param string $family
* The category of the configuration value
* @param string $key
* The configuration key to query
* @param boolean $instore (deprecated, without function)
* @return mixed Stored value or false if it does not exist
*/
function get_pconfig($uid, $family, $key, $instore = false)
{
// logger('include/config.php: get_pconfig() deprecated instore param used', LOGGER_DEBUG);
global $a;
if ($uid === false) {
return false;
}
if (!array_key_exists($uid, $a->config)) {
load_pconfig($uid);
}
if (!array_key_exists($family, $a->config[$uid]) || !array_key_exists($key, $a->config[$uid][$family])) {
return false;
}
return !is_array($a->config[$uid][$family][$key]) && preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$uid][$family][$key]) ? unserialize($a->config[$uid][$family][$key]) : $a->config[$uid][$family][$key];
}
示例15: get_pconfig
function get_pconfig($uid, $family, $key, $instore = false)
{
global $a;
if ($uid === false) {
return false;
}
if (!array_key_exists($uid, $a->config)) {
load_pconfig($uid);
}
if (!array_key_exists($family, $a->config[$uid]) || !array_key_exists($key, $a->config[$uid][$family])) {
return false;
}
return !is_array($a->config[$uid][$family][$key]) && preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$uid][$family][$key]) ? unserialize($a->config[$uid][$family][$key]) : $a->config[$uid][$family][$key];
}