function init() { load_theme_textdomain('p2', get_template_directory() . '/languages'); add_filter('the_content', 'make_clickable'); if (isset($_REQUEST['p2ajax'])) { require_once P2_INC_PATH . '/ajax.php'; P2Ajax::dispatch(); die; } if (function_exists('is_site_admin') && !is_site_admin()) { return; } $is_media_upload = isset($_REQUEST['p2-upload']); // don't redirect to https version when uploading files, since the domain may be different // and we don't have SSL certificates for blog domain, only for admin if ($is_media_upload && isset($GLOBALS['pagenow']) && 'media-upload.php' == $GLOBALS['pagenow']) { force_ssl_admin(is_ssl()); add_filter('get_user_option_use_ssl', returner(false)); } if ($is_media_upload) { add_filter('flash_uploader', returner(false)); add_filter('auth_redirect_scheme', returner('logged_in')); add_filter('admin_url', array('P2', 'url_filter')); add_filter('includes_url', array('P2', 'url_filter')); add_filter('script_loader_src', array('P2', 'url_filter')); add_filter('wp_get_attachment_url', lambda('$url', 'str_replace(get_bloginfo("url")."/", site_url("/"), $url);'), 11); add_filter('media_upload_form_url', lambda('$url', 'add_query_arg( array( "p2-upload" => "true" ), $url );')); } }
function fortunate_install() { register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch'); if (FORTUNATE_SERVER == 'hostname.com' && is_site_admin()) { notice('Fortunate plugin requires configuration. See README'); } }
function bp_activity_template($type, $user_id, $per_page, $max, $timeframe) { global $bp; $this->pag_page = isset($_REQUEST['acpage']) ? intval($_REQUEST['acpage']) : 1; $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page; $this->filter_content = false; $this->activity_type = $type; if ($type == 'sitewide') { $this->activities = bp_activity_get_sitewide_activity($max, $this->pag_num, $this->pag_page); } if ($type == 'personal') { $this->activities = bp_activity_get_user_activity($user_id, $timeframe, $this->page_num, $this->pag_page); } if ($type == 'friends' && (bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id)) { $this->activities = bp_activity_get_friends_activity($user_id, $timeframe, $this->pag_num, $this->pag_page); } if (!$max) { $this->total_activity_count = (int) $this->activities['total']; } else { $this->total_activity_count = (int) $max; } $this->activities = $this->activities['activities']; if ($max) { if ($max >= count($this->activities)) { $this->activity_count = count($this->activities); } else { $this->activity_count = (int) $max; } } else { $this->activity_count = count($this->activities); } $this->full_name = $bp->displayed_user->fullname; $this->pag_links = paginate_links(array('base' => add_query_arg('acpage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_activity_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1)); }
function rendertime_page_end(&$a, &$o) { $duration = microtime(true) - $a->performance["start"]; if (is_site_admin() and $_GET["mode"] != "minimal" and !$a->is_mobile and !$a->is_tablet) { $o = $o . '<div class="renderinfo">' . sprintf(t("Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"), round($a->performance["database"], 3), round($a->performance["network"], 3), round($a->performance["rendering"], 3), round($a->performance["parser"], 3), round($a->performance["file"], 3), round($duration - $a->performance["database"] - $a->performance["network"] - $a->performance["rendering"] - $a->performance["parser"] - $a->performance["file"], 3), round($duration, 3)) . "</div>"; } }
function get() { $o .= '<h3>Probe Diagnostic</h3>'; $o .= '<form action="probe" method="get">'; $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />'; $o .= '<input type="submit" name="submit" value="Submit" /></form>'; $o .= '<br /><br />'; if (x($_GET, 'addr')) { $channel = \App::get_channel(); $addr = trim($_GET['addr']); $do_import = intval($_GET['import']) && is_site_admin() ? true : false; $j = \Zotlabs\Zot\Finger::run($addr, $channel, false); // $res = zot_finger($addr,$channel,false); $o .= '<pre>'; if (!$j['success']) { $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n"); $o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n"; $j = \Zotlabs\Zot\Finger::run($addr, $channel, true); if (!$j['success']) { $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n"); } } if ($do_import && $j) { $x = import_xchan($j); } if ($j && $j['permissions'] && $j['permissions']['iv']) { $j['permissions'] = json_decode(crypto_unencapsulate($j['permissions'], $channel['channel_prvkey']), true); } $o .= str_replace("\n", '<br />', print_r($j, true)); $o .= '</pre>'; } return $o; }
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; }
/** * @return string */ function get() { logger('admin_content', LOGGER_DEBUG); if (!is_site_admin()) { return login(false); } /* * Page content */ $o = ''; if (argc() > 1) { $o = $this->sm->call('get'); if ($o === false) { notice(t('Item not found.')); } } else { $o = $this->admin_page_summary(); } if (is_ajax()) { echo $o; killme(); return ''; } else { return $o; } }
function regmod_content(&$a) { global $lang; $_SESSION['return_url'] = $a->cmd; if (!local_user()) { info(t('Please login.') . EOL); $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); return $o; } if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { notice(t('Permission denied.') . EOL); return ''; } if ($a->argc != 3) { killme(); } $cmd = $a->argv[1]; $hash = $a->argv[2]; if ($cmd === 'deny') { user_deny($hash); goaway($a->get_baseurl() . "/admin/users/"); killme(); } if ($cmd === 'allow') { user_allow($hash); goaway($a->get_baseurl() . "/admin/users/"); killme(); } }
function regmod_content(&$a) { global $lang; $_SESSION['return_url'] = $a->cmd; if (!local_user()) { info(t('Please login.') . EOL); $o .= '<br /><br />' . login($a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); return $o; } if (!is_site_admin()) { notice(t('Permission denied.') . EOL); return ''; } if ($a->argc != 3) { killme(); } $cmd = $a->argv[1]; $hash = $a->argv[2]; if ($cmd === 'deny') { if (!user_deny($hash)) { killme(); } } if ($cmd === 'allow') { if (!user_allow($hash)) { killme(); } } }
/** * @param App &$a * @return string */ function admin_content(&$a) { logger('admin_content', LOGGER_DEBUG); if (!is_site_admin()) { return login(false); } /* * Page content */ $o = ''; // urls if (argc() > 1) { switch (argv(1)) { case 'site': $o = admin_page_site($a); break; case 'users': $o = admin_page_users($a); break; case 'channels': $o = admin_page_channels($a); break; case 'plugins': $o = admin_page_plugins($a); break; case 'themes': $o = admin_page_themes($a); break; // case 'hubloc': // $o = admin_page_hubloc($a); // break; // case 'hubloc': // $o = admin_page_hubloc($a); // break; case 'logs': $o = admin_page_logs($a); break; case 'dbsync': $o = admin_page_dbsync($a); break; case 'profs': $o = admin_page_profs($a); break; case 'queue': $o = admin_page_queue($a); break; default: notice(t('Item not found.')); } } else { $o = admin_page_summary($a); } if (is_ajax()) { echo $o; killme(); return ''; } else { return $o; } }
function tehnik_filter_buddypress_activities($a, $activities) { //if admin we want to know if (is_site_admin()) { return $activities; } foreach ($activities->activities as $key => $activity) { //new_member is the type name (component is 'profile') if ($activity->type == 'bbp_topic_create' || $activity->type == 'bbp_reply_create') { $post_id = $activity->secondary_item_id; if ($activity->type == 'bbp_reply_create') { $post_id = bbp_get_topic_forum_id($post_id); } if (!tehnik_bpp_can_user_view_post_id($post_id)) { unset($activities->activities[$key]); $activities->activity_count = $activities->activity_count - 1; $activities->total_activity_count = $activities->total_activity_count - 1; $activities->pag_num = $activities->pag_num - 1; } } } /* Renumber the array keys to account for missing items */ $activities_new = array_values($activities->activities); $activities->activities = $activities_new; return $activities; }
function regmod_content(&$a) { global $lang; $_SESSION['return_url'] = App::$cmd; if (!local_channel()) { info(t('Please login.') . EOL); $o .= '<br /><br />' . login(App::$config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1); return $o; } if (!is_site_admin()) { notice(t('Permission denied.') . EOL); return ''; } if (argc() != 3) { killme(); } $cmd = argv(1); $hash = argv(2); if ($cmd === 'deny') { if (!account_deny($hash)) { killme(); } } if ($cmd === 'allow') { if (!account_allow($hash)) { killme(); } } }
/** * @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 not ( channel_pageflags & %d)>0 limit 1", intval($change_channel), intval(get_account_id()), intval(PAGE_REMOVED)); // 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_pageflags & %d) and not (channel_pageflags & %d )>0 limit 1", intval($change_channel), intval(PAGE_SYSTEM), 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_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; }
function rendertime_page_end(&$a, &$o) { $duration = microtime(true) - $a->performance["start"]; if (is_site_admin() and $_GET["mode"] != "minimal" and !$a->is_mobile and !$a->is_tablet) { $o = $o . '<div class="renderinfo">' . sprintf(t("Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"), round($a->performance["database"], 3), round($a->performance["network"], 3), round($a->performance["rendering"], 3), round($a->performance["parser"], 3), round($a->performance["file"], 3), round($duration - $a->performance["database"] - $a->performance["network"] - $a->performance["rendering"] - $a->performance["parser"] - $a->performance["file"], 3), round($duration, 3)) . "</div>"; if (get_config("rendertime", "callstack")) { $o .= "<pre>"; $o .= "\nDatabase:\n"; foreach ($a->callstack["database"] as $func => $time) { $time = round($time, 3); if ($time > 0) { $o .= $func . ": " . $time . "\n"; } } $o .= "\nNetwork:\n"; foreach ($a->callstack["network"] as $func => $time) { $time = round($time, 3); if ($time > 0) { $o .= $func . ": " . $time . "\n"; } } $o .= "</pre>"; } } }
function regmod_content(&$a) { global $lang; $_SESSION['return_url'] = $a->cmd; if (!local_user()) { info(t('Please login.') . EOL); $o .= '<br /><br />' . login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1); return $o; } if (!is_site_admin() || x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { notice(t('Permission denied.') . EOL); return ''; } if (argc() != 3) { killme(); } $cmd = argv(1); $hash = argv(2); if ($cmd === 'deny') { if (!user_deny($hash)) { killme(); } } if ($cmd === 'allow') { if (!user_allow($hash)) { killme(); } } }
function get() { if (!\App::$profile) { notice(t('Requested profile is not available.') . EOL); \App::$error = 404; return; } $which = argv(1); $uid = local_channel(); $owner = 0; $channel = null; $observer = \App::get_observer(); $channel = \App::get_channel(); if (\App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if ($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); $channel = $sys; $observer = $sys; } } if (!$owner) { // Figure out who the page owner is. $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which)); if ($r) { $owner = intval($r[0]['channel_id']); } } $ob_hash = $observer ? $observer['xchan_hash'] : ''; if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) { notice(t('Permission denied.') . EOL); return; } $is_owner = $uid && $uid == $owner ? true : false; $o = ''; // Figure out which post we're editing $post_id = argc() > 2 ? intval(argv(2)) : 0; if (!$post_id) { notice(t('Item not found') . EOL); return; } // Now we've got a post and an owner, let's find out if we're allowed to edit it $ob_hash = $observer ? $observer['xchan_hash'] : ''; $perms = get_all_perms($owner, $ob_hash); if (!$perms['write_pages']) { notice(t('Permission denied.') . EOL); return; } $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner)); $item_id = q("select * from item_id where service = 'PDL' and iid = %d limit 1", intval($itm[0]['id'])); if ($item_id) { $layout_title = $item_id[0]['sid']; } $rp = 'layouts/' . $which; $x = array('webpage' => ITEM_TYPE_PDL, 'nickname' => $channel['channel_address'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'comanche', 'return_path' => $rp, 'button' => t('Edit'), 'hide_voting' => true, 'hide_future' => true, 'hide_expire' => true, 'hide_location' => true, 'hide_weblink' => true, 'hide_attach' => true, 'hide_preview' => true, 'ptyp' => $itm[0]['obj_type'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'pagetitle' => $layout_title, 'ptlabel' => t('Layout Name'), 'placeholdertitle' => t('Layout Description (Optional)'), 'showacl' => false, 'profile_uid' => intval($owner)); $editor = status_editor($a, $x); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Layout'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor)); return $o; }
function migrator_content(&$a) { // It's not an API call. Check login. if (!is_site_admin()) { json_error_die(401, 'Unauthorized', 'Only admin accounts may use this endpoint.'); } return "Migrator version " . MIGRATOR_VERSION; }
function bp_forums_add_admin_menu() { global $wpdb, $bp; if (is_site_admin()) { /* Add the administration tab under the "Site Admin" tab for site administrators */ add_submenu_page('bp-core.php', __('Forums Setup', 'buddypress'), __('Forums Setup', 'buddypress'), 2, __FILE__, "bp_forums_bbpress_admin"); } }
/** * bp_zoneideas_add_admin_menu() * * Registers the component admin menu into the admin menu array. */ function bp_zoneideas_add_admin_menu() { global $wpdb, $bp; if (is_site_admin()) { /* Add the administration tab under the "Site Admin" tab for site administrators */ add_submenu_page('wpmu-admin.php', __('zoneideas Admin', 'bp-zoneideas'), __('zoneideas Admin', 'bp-zoneideas'), 1, "bp_zoneideas_settings", "bp_zoneideas_admin"); } }
function get() { if (!\App::$profile) { notice(t('Requested profile is not available.') . EOL); \App::$error = 404; return; } $which = argv(1); $uid = local_channel(); $owner = 0; $channel = null; $observer = \App::get_observer(); $channel = \App::get_channel(); if (\App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if ($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); $channel = $sys; $observer = $sys; } } if (!$owner) { // Figure out who the page owner is. $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which)); if ($r) { $owner = intval($r[0]['channel_id']); } } $ob_hash = $observer ? $observer['xchan_hash'] : ''; if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) { notice(t('Permission denied.') . EOL); return; } $is_owner = $uid && $uid == $owner ? true : false; $o = ''; // Figure out which post we're editing $post_id = argc() > 2 ? intval(argv(2)) : 0; if (!($post_id && $owner)) { notice(t('Item not found') . EOL); return; } $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner)); if ($itm) { $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1", intval($itm[0]['id'])); if ($item_id) { $block_title = $item_id[0]['sid']; } } else { notice(t('Item not found') . EOL); return; } $mimetype = $itm[0]['mimetype']; $rp = 'blocks/' . $channel['channel_address']; $x = array('nickname' => $channel['channel_address'], 'bbco_autocomplete' => $mimetype == 'text/bbcode' ? 'bbcode' : 'comanche-block', 'return_path' => $rp, 'webpage' => ITEM_TYPE_BLOCK, 'ptlabel' => t('Block Name'), 'button' => t('Edit'), 'writefiles' => $mimetype == 'text/bbcode' ? perm_is_allowed($owner, get_observer_hash(), 'write_storage') : false, 'weblink' => $mimetype == 'text/bbcode' ? t('Insert web link') : false, 'hide_voting' => true, 'hide_future' => true, 'hide_location' => true, 'hide_expire' => true, 'showacl' => false, 'ptyp' => $itm[0]['type'], 'mimeselect' => true, 'mimetype' => $itm[0]['mimetype'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'visitor' => true, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'placeholdertitle' => t('Title (optional)'), 'pagetitle' => $block_title, 'profile_uid' => intval($channel['channel_id']), 'bbcode' => $mimetype == 'text/bbcode' ? true : false); $editor = status_editor($a, $x); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Block'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor)); return $o; }
function hubwall_content(&$a) { if (!is_site_admin()) { return; } $title = t('Send email to all hub members.'); $o = replace_macros(get_markup_template('hubwall_form.tpl', 'addon/hubwall/'), array('$title' => $title, '$text' => htmlspecialchars($_REQUEST['text']), '$subject' => array('subject', t('Message subject'), $_REQUEST['subject'], ''), '$test' => array('test', t('Test mode (only send to hub administrator)'), 0, ''), '$submit' => t('Submit'))); return $o; }
function swt_add_pages() { global $wpmu_version, $wp_version; if (version_compare($wp_version, '3.0.9', '<=') && version_compare($wp_version, '3.0', '>=') && is_multisite() && is_super_admin()) { add_submenu_page('ms-admin.php', 'Sitewide Tags', 'Sitewide Tags', 'manage_options', 'sitewidetags', 'swt_manager'); } elseif (isset($wpmu_version) && is_site_admin()) { add_submenu_page('wpmu-admin.php', 'Sitewide Tags', 'Sitewide Tags', 'manage_options', 'sitewidetags', 'swt_manager'); } }
function dashboard_delete_wg_cache() { if (function_exists('is_site_admin') && !is_site_admin()) { return false; } if (function_exists('current_user_can') && !current_user_can('manage_options')) { return false; } echo "<li><a href='" . wp_nonce_url('options-general.php?page=widget-cache.php&clear=1', 'widget-cache') . "' title='Clear widget cache'>Clear widget cache</a></li>"; }
function bp_blogs_check_installed() { global $wpdb, $bp, $userdata; if (is_site_admin()) { /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ if (get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION) { bp_blogs_install(); } } }
function pageheader_addon_settings_post(&$a, &$b) { if (!is_site_admin()) { return; } if ($_POST['pageheader-submit']) { set_config('pageheader', 'text', trim(strip_tags($_POST['pageheader-words']))); info(t('pageheader Settings saved.') . EOL); } }
function hubwall_content(&$a) { if (!is_site_admin()) { return; } $title = t('Send email to all hub members.'); $senders = ['noreply@' . \App::get_hostname() => 'noreply@' . \App::get_hostname(), 'postmaster@' . \App::get_hostname() => 'postmaster@' . \App::get_hostname(), get_config('system', 'admin_email') => get_config('system', 'admin_email')]; $o = replace_macros(get_markup_template('hubwall_form.tpl', 'addon/hubwall/'), array('$title' => $title, '$text' => htmlspecialchars($_REQUEST['text']), '$subject' => array('subject', t('Message subject'), $_REQUEST['subject'], ''), '$sender' => array('sender', t('Sender Email address'), $_REQUEST['sender'] ? $_REQUEST['sender'] : 'noreply@' . \App::get_hostname(), '', $senders), '$test' => array('test', t('Test mode (only send to hub administrator)'), array_key_exists('test', $_REQUEST) ? intval($_REQUEST['test']) : 0, ''), '$submit' => t('Submit'))); return $o; }
function mitem_content(&$a) { $uid = local_channel(); $channel = $a->get_channel(); $observer = $a->get_observer(); $ob_hash = $observer ? $observer['xchan_hash'] : ''; if ($a->is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); $channel = $sys; $ob_hash = $sys['xchan_hash']; } if (!$uid) { notice(t('Permission denied.') . EOL); return ''; } if (argc() < 2 || !$a->data['menu']) { notice(t('Not found.') . EOL); return ''; } $m = menu_fetch($a->data['menu']['menu_name'], $uid, $ob_hash); $a->data['menu_item'] = $m; if (argc() == 2) { $r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc", intval($a->data['menu']['menu_id']), intval($uid)); $o .= replace_macros(get_markup_template('mitemlist.tpl'), array('$title' => t('Manage Menu Elements'), '$menuname' => $a->data['menu']['menu_name'], '$menudesc' => $a->data['menu']['menu_desc'], '$edmenu' => t('Edit menu'), '$menu_id' => $a->data['menu']['menu_id'], '$mlist' => $r, '$edit' => t('Edit element'), '$drop' => t('Drop element'), '$new' => t('New element'), '$hintmenu' => t('Edit this menu container'), '$hintnew' => t('Add menu element'), '$hintdrop' => t('Delete this menu item'), '$hintedit' => t('Edit this menu item'))); return $o; } if (argc() > 2) { if (argv(2) === 'new') { $perm_defaults = array('allow_cid' => $channel['channel_allow_cid'], 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid']); $o = replace_macros(get_markup_template('mitemedit.tpl'), array('$header' => t('New Menu Element'), '$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($perm_defaults, false), '$mitem_desc' => array('mitem_desc', t('Link text'), '', '', '*'), '$mitem_link' => array('mitem_link', t('URL of link'), '', '', '*'), '$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), true, ''), '$newwin' => array('newwin', t('Open link in new window'), false, ''), '$mitem_order' => array('mitem_order', t('Order in list'), '0', t('Higher numbers will sink to bottom of listing')), '$submit' => t('Create'))); return $o; } elseif (intval(argv(2))) { $m = q("select * from menu_item where mitem_id = %d and mitem_channel_id = %d limit 1", intval(argv(2)), intval($uid)); if (!$m) { notice(t('Menu item not found.') . EOL); goaway(z_root() . '/menu' . ($a->is_sys ? '?f=&sys=1' : '')); } $mitem = $m[0]; if (argc() == 4 && argv(3) == 'drop') { $r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2))); if ($r) { info(t('Menu item deleted.') . EOL); } else { notice(t('Menu item could not be deleted.') . EOL); } goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . ($a->is_sys ? '?f=&sys=1' : '')); } else { // edit menu item $o = replace_macros(get_markup_template('mitemedit.tpl'), array('$header' => t('Edit Menu Element'), '$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($mitem, false), '$mitem_id' => intval(argv(2)), '$mitem_desc' => array('mitem_desc', t('Link text'), $mitem['mitem_desc'], '', '*'), '$mitem_link' => array('mitem_link', t('URL of link'), $mitem['mitem_link'], '', '*'), '$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), $mitem['mitem_flags'] & MENU_ITEM_ZID ? 1 : 0, ''), '$newwin' => array('newwin', t('Open link in new window'), $mitem['mitem_flags'] & MENU_ITEM_NEWWIN ? 1 : 0, ''), '$mitem_order' => array('mitem_order', t('Order in list'), $mitem['mitem_order'], t('Higher numbers will sink to bottom of listing')), '$submit' => t('Modify'))); return $o; } } } }
/** @file */ function findpeople_widget() { if (get_config('system', 'invitation_only')) { $x = get_pconfig(local_channel(), 'system', 'invites_remaining'); if ($x || is_site_admin()) { App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">' . sprintf(tt('%d invitation available', '%d invitations available', $x), $x) . '</div>' . $inv; } } $advanced_search = local_channel() && feature_enabled(local_channel(), 'advanced_dirsearch') ? t('Advanced') : false; return replace_macros(get_markup_template('peoplefind.tpl'), array('$findpeople' => t('Find Channels'), '$desc' => t('Enter name or interest'), '$label' => t('Connect/Follow'), '$hint' => t('Examples: Robert Morgenstein, Fishing'), '$findthem' => t('Find'), '$suggest' => t('Channel Suggestions'), '$similar' => '', '$random' => t('Random Profile'), '$inv' => t('Invite Friends'), '$advanced_search' => $advanced_search, '$advanced_hint' => "\r\n" . t('Advanced example: name=fred and country=iceland'), '$loggedin' => local_channel())); }
function check_account_admin($arr) { if (is_site_admin()) { return true; } $admin_email = trim(get_config('system', 'admin_email')); if (strlen($admin_email) && $admin_email === trim($arr['email'])) { return true; } return false; }
function SetCaps() { // Create capabilities if they are not installed if (!current_user_can(MF_CAPABILITY_PANELS)) { $role = get_role('administrator'); if (!RCCWP_Application::IsWordpressMu() || is_site_admin()) { $role->add_cap(MF_CAPABILITY_PANELS); $role->add_cap(MAGIC_FIELDS_CAPABILITY_MODULES); } } }