本文整理汇总了PHP中build_parent_list函数的典型用法代码示例。如果您正苦于以下问题:PHP build_parent_list函数的具体用法?PHP build_parent_list怎么用?PHP build_parent_list使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_parent_list函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
global $portlist;
$list = array();
foreach ($portlist as $ifn => $ifinfo) {
if (is_jumbo_capable($ifn)) {
$list[$ifn] = $ifn . ' (' . $ifinfo['mac'] . ')';
}
}
return $list;
}
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form(new Form_Button('Submit', gettext("Save")));
$section = new Form_Section('QinQ Configuration');
$section->addInput(new Form_Select('if', 'Parent interface', $pconfig['if'], build_parent_list()))->setHelp('Only QinQ capable interfaces will be shown.');
$section->addInput(new Form_Input('tag', 'First level tag', 'number', $pconfig['tag'], ['max' => '4094', 'min' => '1']))->setHelp('This is the first level VLAN tag. On top of this are stacked the member VLANs defined below.');
$section->addInput(new Form_Checkbox('autogroup', 'Option(s)', 'Adds interface to QinQ interface groups', $pconfig['autogroup']))->setHelp('Allows rules to be written more easily');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
$section->addInput(new Form_StaticText('Member(s)', 'You can specify ranges in the inputs below. Enter a range (2-3) or individual numbers.' . '<br />' . 'Click "Duplicate" as many times as needed to add new inputs'));
if (isset($id) && $a_qinqs[$id]) {
$section->addInput(new Form_Input('id', null, 'hidden', $id));
}
$counter = 0;
$members = $pconfig['members'];
// List each of the member tags from the space-separated list
if ($members != "") {
$item = explode(" ", $members);
} else {
$item = array('');
}
示例2: build_parent_list
function build_parent_list()
{
$parentlist = array();
$portlist = get_possible_listen_ips();
foreach ($portlist as $ifn => $ifinfo) {
$parentlist[$ifn] = $ifinfo;
}
return $parentlist;
}
$pgtitle = array(gettext("Interfaces"), gettext("GRE"), gettext("Edit"));
$shortcut_section = "interfaces";
include "head.inc";
require_once 'classes/Form.class.php';
$form = new Form();
$section = new Form_Section('GRE Configuration');
$section->addInput(new Form_Select('if', 'Parent Interface', $pconfig['if'], build_parent_list()))->setHelp('This interface serves as the local address to be used for the GRE tunnel.');
$section->addInput(new Form_IpAddress('remote-addr', 'GRE Remote Address', $pconfig['remote-addr']))->setHelp('Peer address where encapsulated GRE packets will be sent.');
$section->addInput(new Form_IpAddress('tunnel-local-addr', 'GRE tunnel local address', $pconfig['tunnel-local-addr']))->setHelp('Local GRE tunnel endpoint.');
$section->addInput(new Form_IpAddress('tunnel-remote-addr', 'GRE tunnel remote address', $pconfig['tunnel-remote-addr']))->setHelp('Remote GRE address endpoint.');
$section->addInput(new Form_Select('tunnel-remote-net', 'GRE tunnel remote subnet', $pconfig['tunnel-remote-net'], array_combine(range(128, 1, -1), range(128, 1, -1))))->setHelp('The subnet is used for determining the network that is tunnelled');
$section->addInput(new Form_Checkbox('link0', 'Route Caching', 'Specify if route caching can be enabled. (Be careful with these settings on dynamic networks.)', $pconfig['link0']));
$section->addInput(new Form_Checkbox('link1', 'ECN friendly behavior', 'ECN friendly behavior violates RFC2893. This should be used in mutual agreement with the peer. ', $pconfig['link1']));
$section->addInput(new Form_Checkbox('link2', 'WCCP Version', 'Check this box for WCCP encapsulation version 2, or leave unchecked for version 1.', $pconfig['link2']));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
$section->addInput(new Form_Input('greif', null, 'hidden', $pconfig['greif']));
if (isset($id) && $a_gres[$id]) {
$section->addInput(new Form_Input('id', null, 'hidden', $id));
}
$form->add($section);
print $form;
include "foot.inc";
示例3: get_possible_listen_ips
$portlist = get_possible_listen_ips();
$count = 0;
foreach ($portlist as $ifn => $ifinfo) {
if (preg_match($g['wireless_regex'], $ifn)) {
$parentlist[$ifn] = htmlspecialchars($ifn . '(' . $ifinfo['mac'] . ')');
$count++;
}
}
if ($count > 0) {
return $parentlist;
} else {
return array('0' => gettext('None available'));
}
}
$pgtitle = array(gettext("Interfaces"), gettext("Wireless"), gettext("Edit"));
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Wireless Interface Configuration');
$section->addInput(new Form_Select('if', 'Parent Interface', $pconfig['if'], build_parent_list()));
$section->addInput(new Form_Select('mode', 'Mode', $pconfig['mode'], array('bss' => gettext('Infrastructure (BSS)'), 'adhoc' => gettext('Ad-hoc (IBSS)'), 'hostap' => gettext('Access Point'))));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
$section->addInput(new Form_Input('cloneif', null, 'hidden', $pconfig['cloneif']));
if (isset($id) && $a_clones[$id]) {
$section->addInput(new Form_Input('id', null, 'hidden', $id));
}
$form->add($section);
print $form;
include "foot.inc";
示例4: makeprintablenav
function makeprintablenav($pid = "0", $depth = "--")
{
global $db, $pforumcache, $fid, $forum, $lang;
if (!is_array($pforumcache)) {
$parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']);
$query = $db->simple_select("forums", "name, fid, pid", "{$parlist}", array('order_by' => 'pid, disporder'));
while ($forumnav = $db->fetch_array($query)) {
$pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav;
}
unset($forumnav);
}
if (is_array($pforumcache[$pid])) {
foreach ($pforumcache[$pid] as $key => $forumnav) {
$forums .= "+" . $depth . " {$lang->forum} {$forumnav['name']} (<i>" . $mybb->settings['bburl'] . "/" . get_forum_link($forumnav['fid']) . "</i>)<br />\n";
if ($pforumcache[$forumnav['fid']]) {
$newdepth = $depth . "-";
$forums .= makeprintablenav($forumnav['fid'], $newdepth);
}
}
}
return $forums;
}
示例5: build_archive_forumbits
}
// Show subforums.
$query = $db->simple_select("forums", "COUNT(fid) AS subforums", "pid='{$id}' AND status='1'");
$subforumcount = $db->fetch_field($query, "subforums");
if ($subforumcount > 0) {
echo "<div class=\"forumlist\">\n";
echo "<h3>{$lang->subforums}</h3>\n";
echo "<ol>\n";
$forums = build_archive_forumbits($forum['fid']);
echo $forums;
echo "</ol>\n</div>\n";
}
archive_multipage($threadcount, $perpage, $page, "{$base_url}forum-{$id}");
// Get the announcements if the forum is not a category.
if ($forum['type'] == 'f') {
$sql = build_parent_list($forum['fid'], "fid", "OR", $forum['parentlist']);
$time = TIME_NOW;
$query = $db->simple_select("announcements", "*", "startdate < '{$time}' AND (enddate > '{$time}' OR enddate=0) AND ({$sql} OR fid='-1')");
if ($db->num_rows($query) > 0) {
echo "<div class=\"announcementlist\">\n";
echo "<h3>{$lang->forumbit_announcements}</h3>";
echo "<ol>\n";
while ($announcement = $db->fetch_array($query)) {
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
echo "<li><a href=\"{$base_url}announcement-{$announcement['aid']}.html\">" . htmlspecialchars_uni($announcement['subject']) . "</a></li>";
}
echo "</ol>\n</div>\n";
}
}
// Get the stickies if the forum is not a category.
if ($forum['type'] == 'f') {
示例6: build_parent_list
$permission_data = $db->fetch_array($query);
if (!$fid) {
$fid = $permission_data['fid'];
}
if (!$gid) {
$gid = $permission_data['gid'];
}
if (!$pid) {
$pid = $permission_data['pid'];
}
$query = $db->simple_select("usergroups", "*", "gid='{$gid}'");
$usergroup = $db->fetch_array($query);
$query = $db->simple_select("forums", "*", "fid='{$fid}'");
$forum = $db->fetch_array($query);
$sperms = $permission_data;
$sql = build_parent_list($fid);
$query = $db->simple_select("forumpermissions", "*", "{$sql} AND gid='{$gid}'");
$customperms = $db->fetch_array($query);
if ($permission_data['pid']) {
$permission_data['usecustom'] = 1;
echo $form->generate_hidden_field("pid", $pid);
} else {
echo $form->generate_hidden_field("fid", $fid);
echo $form->generate_hidden_field("gid", $gid);
if (!$customperms['pid']) {
$permission_data = usergroup_permissions($gid);
} else {
$permission_data = forum_permissions($fid, 0, $gid);
}
}
}
示例7: get_announcement_list
function get_announcement_list($foruminfo, $fid)
{
// Gather forum stats
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $time, $mybbgroups, $cache;
$has_announcements = $has_modtools = false;
$forum_stats = $cache->read("forumsdisplay");
$parser = new postParser();
if (is_array($forum_stats)) {
if (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools'])) {
// Mod tools are specific to forums, not parents
$has_modtools = true;
}
if (!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements'])) {
// Global or forum-specific announcements
$has_announcements = true;
}
}
$parentlist = $foruminfo['parentlist'];
$parentlistexploded = explode(",", $parentlist);
foreach ($parentlistexploded as $mfid) {
if (!empty($forum_stats[$mfid]['announcements'])) {
$has_announcements = true;
}
}
$announcementlist = $topic_list = array();
if ($has_announcements == true) {
$limit = '';
$announcements = '';
if ($mybb->settings['announcementlimit']) {
$limit = "LIMIT 0, " . $mybb->settings['announcementlimit'];
}
$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("\n\t\t\tSELECT a.*, u.username\n\t\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND ({$sql} OR fid='-1')\n\t\t\tORDER BY a.startdate DESC {$limit}\n\t\t");
// See if this announcement has been read in our announcement array
$cookie = array();
if (isset($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
}
$announcementlist = '';
$bgcolor = alt_trow(true);
// Reset the trow colors
while ($announcement = $db->fetch_array($query)) {
if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
$new_class = ' class="subject_new"';
$folder = "newfolder";
} else {
$new_class = ' class="subject_old"';
$folder = "folder";
}
// Mmm, eat those announcement cookies if they're older than our last visit
if (isset($cookie[$announcement['aid']]) && $cookie[$announcement['aid']] < $mybb->user['lastvisit']) {
unset($cookie[$announcement['aid']]);
}
$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date('relative', $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
$announcementlist[] = $announcement;
}
if (empty($cookie)) {
// Clean up cookie crumbs
my_setcookie('mybb[announcements]', 0, TIME_NOW - 60 * 60 * 24 * 365);
} else {
if (!empty($cookie)) {
my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
}
}
foreach ($announcementlist as $announce) {
$user_info = get_user($announce['uid']);
$icon_url = absolute_url($user_info['avatar']);
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($fid, 'string'), 'topic_id' => new xmlrpcval('ann_' . $announce['aid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($announce['subject']), 'base64'), 'topic_author_id' => new xmlrpcval($announce['uid'], 'string'), 'topic_author_name' => new xmlrpcval(basic_clean($announce['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url), 'string'), 'reply_number' => new xmlrpcval(0, 'int'), 'view_number' => new xmlrpcval(0, 'int'), 'short_content' => new xmlrpcval(process_short_content($announce['message'], $parser), 'base64')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
}
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval(count($announcementlist), 'int'), 'forum_id' => new xmlrpcval($fid), 'forum_name' => new xmlrpcval(basic_clean($foruminfo['name']), 'base64'), 'can_post' => new xmlrpcval(false, 'boolean'), 'can_upload' => new xmlrpcval(false, 'boolean'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例8: build_parent_list
$ratingadd = '';
$lpbackground = "trow1";
$colspan = "6";
}
if ($ismod) {
++$colspan;
}
// Get Announcements
$announcementlist = '';
if ($has_announcements == true) {
$limit = '';
$announcements = '';
if ($mybb->settings['announcementlimit']) {
$limit = "LIMIT 0, " . $mybb->settings['announcementlimit'];
}
$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("\n\t\tSELECT a.*, u.username\n\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND ({$sql} OR fid='-1')\n\t\tORDER BY a.startdate DESC {$limit}\n\t");
// See if this announcement has been read in our announcement array
$cookie = array();
if (isset($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
}
$announcementlist = '';
$bgcolor = alt_trow(true);
// Reset the trow colors
while ($announcement = $db->fetch_array($query)) {
if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
$new_class = ' class="subject_new"';
$folder = "newfolder";
} else {
示例9: xthreads_breadcrumb_hack_printthread
function xthreads_breadcrumb_hack_printthread()
{
global $pforumcache;
//if(!is_array($pforumcache)) {
// need to override because we want the 'xthreads_hidebreadcrumb' field
global $forum, $db, $fid;
$parlist = build_parent_list($fid, 'fid', 'OR', $forum['parentlist']);
$query = $db->simple_select('forums', 'name, fid, pid, xthreads_hidebreadcrumb', $parlist, array('order_by' => 'pid, disporder'));
while ($forumnav = $db->fetch_array($query)) {
$pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav;
}
unset($forumnav, $forum, $fid);
// unsetting the global references
//}
if (!is_array($pforumcache[0])) {
return;
}
// do the same as xthreads_breadcrumb_hack() but in reverse
foreach ($pforumcache[0] as &$pforum) {
// will only ever loop once
if ($pforum['pid']) {
continue;
}
// paranoia
// firstly, skip any hidden top-level parents
$prevforum =& $pforum;
while ($prevforum && $prevforum['xthreads_hidebreadcrumb'] && !empty($pforumcache[$prevforum['fid']])) {
$prevforum =& xthreads_get_array_first($pforumcache[$prevforum['fid']]);
}
if ($prevforum) {
if ($prevforum['pid']) {
$prevforum['pid'] = 0;
$pforum = $prevforum;
}
$forum = null;
if ($pforumcache[$prevforum['fid']]) {
$forum =& xthreads_get_array_first($pforumcache[$prevforum['fid']]);
}
while ($forum) {
if (!$forum['xthreads_hidebreadcrumb']) {
// rewrite parent fid (won't actually change if there's no hidden breadcrumbs in-between)
$forum['pid'] = $prevforum['fid'];
$pforumcache[$forum['pid']] = array($forum['fid'] => $forum);
$prevforum =& $forum;
}
if (!$pforumcache[$forum['fid']]) {
// we always display the active breadcrumb, so set this if hidden
if ($forum['xthreads_hidebreadcrumb']) {
$forum['pid'] = $prevforum['fid'];
$pforumcache[$forum['pid']] = array($forum['fid'] => $forum);
}
break;
}
$forum =& xthreads_get_array_first($pforumcache[$forum['fid']]);
}
}
}
}
示例10: get_moderator_permissions
/**
* Return the permissions for a moderator in a specific forum
*
* @param fid The forum ID
* @param uid The user ID to fetch permissions for (0 assumes current logged in user)
* @param string The parent list for the forum (if blank, will be fetched)
* @return array Array of moderator permissions for the specific forum
*/
function get_moderator_permissions($fid, $uid = "0", $parentslist = "")
{
global $mybb, $db;
static $modpermscache;
if ($uid < 1) {
$uid = $mybb->user['uid'];
}
if ($uid == 0) {
return false;
}
if (!isset($modpermscache[$fid][$uid])) {
if (!$parentslist) {
$parentslist = get_parent_list($fid);
}
$sql = build_parent_list($fid, "fid", "OR", $parentslist);
$query = $db->simple_select("moderators", "*", "uid='{$uid}' AND {$sql}");
$perms = $db->fetch_array($query);
if (!$perms) {
return false;
}
$modpermscache[$fid][$uid] = $perms;
} else {
$perms = $modpermscache[$fid][$uid];
}
return $perms;
}