本文整理汇总了PHP中account_service_class_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP account_service_class_fetch函数的具体用法?PHP account_service_class_fetch怎么用?PHP account_service_class_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了account_service_class_fetch函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_channel_content
function new_channel_content(&$a)
{
$acc = App::get_account();
if (!$acc || $acc['account_id'] != get_account_id()) {
notice(t('Permission denied.') . EOL);
return;
}
$default_role = '';
$aid = get_account_id();
if ($aid) {
$r = q("select count(channel_id) as total from channel where channel_account_id = %d", intval($aid));
if ($r && !intval($r[0]['total'])) {
$default_role = get_config('system', 'default_permissions_role');
}
$limit = account_service_class_fetch(get_account_id(), 'total_identities');
if ($r && $limit !== false) {
$channel_usage_message = sprintf(t("You have created %1\$.0f of %2\$.0f allowed channels."), $r[0]['total'], $limit);
} else {
$channel_usage_message = '';
}
}
$name = array('name', t('Name or caption'), x($_REQUEST, 'name') ? $_REQUEST['name'] : '', t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'));
$nickhub = '@' . App::get_hostname();
$nickname = array('nickname', t('Choose a short nickname'), x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : '', sprintf(t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub));
$privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
$role = array('permissions_role', t('Channel role and privacy'), $privacy_role ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', get_roles());
$o = replace_macros(get_markup_template('new_channel.tpl'), array('$title' => t('Create Channel'), '$desc' => t('A channel is your identity on this network. It can represent a person, a blog, or a forum to name a few. Channels can make connections with other channels to share information with highly detailed permissions.'), '$label_import' => t('or <a href="import">import an existing channel</a> from another location.'), '$name' => $name, '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create'), '$channel_usage_message' => $channel_usage_message));
return $o;
}
示例2: get
function get()
{
if (!get_account_id() || $_SESSION['delegate']) {
notice(t('Permission denied.') . EOL);
return;
}
require_once 'include/security.php';
$change_channel = argc() > 1 ? intval(argv(1)) : 0;
if (argc() > 2 && argv(2) === 'default') {
$r = q("select channel_id from channel where channel_id = %d and channel_account_id = %d limit 1", intval($change_channel), intval(get_account_id()));
if ($r) {
q("update account set account_default_channel = %d where account_id = %d", intval($change_channel), intval(get_account_id()));
}
goaway(z_root() . '/manage');
}
if ($change_channel) {
$r = change_channel($change_channel);
if (argc() > 2 && !(argv(2) === 'default')) {
goaway(z_root() . '/' . implode('/', array_slice(\App::$argv, 2)));
// Go to whatever is after /manage/, but with the new channel
} else {
if ($r && $r['channel_startpage']) {
goaway(z_root() . '/' . $r['channel_startpage']);
}
// If nothing extra is specified, go to the default page
}
goaway(z_root());
}
$channels = null;
if (local_channel()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and channel_removed = 0 order by channel_name ", intval(get_account_id()));
$account = \App::get_account();
if ($r && count($r)) {
$channels = $r;
for ($x = 0; $x < count($channels); $x++) {
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
$channels[$x]['default'] = $channels[$x]['channel_id'] == $account['account_default_channel'] ? "1" : '';
$channels[$x]['default_links'] = '1';
$c = q("SELECT id, item_wall FROM item\n\t\t\t\t\t\tWHERE item_unseen = 1 and uid = %d " . item_normal(), intval($channels[$x]['channel_id']));
if ($c) {
foreach ($c as $it) {
if (intval($it['item_wall'])) {
$channels[$x]['home']++;
} else {
$channels[$x]['network']++;
}
}
}
$intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ", intval($channels[$x]['channel_id']));
if ($intr) {
$channels[$x]['intros'] = intval($intr[0]['total']);
}
$mails = q("SELECT count(id) as total from mail WHERE channel_id = %d AND mail_seen = 0 and from_xchan != '%s' ", intval($channels[$x]['channel_id']), dbesc($channels[$x]['channel_hash']));
if ($mails) {
$channels[$x]['mail'] = intval($mails[0]['total']);
}
$events = q("SELECT type, start, adjust FROM `event`\n\t\t\t\t\t\tWHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0\n\t\t\t\t\t\tORDER BY `start` ASC ", intval($channels[$x]['channel_id']), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + 7 days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')));
if ($events) {
$channels[$x]['all_events'] = count($events);
if ($channels[$x]['all_events']) {
$str_now = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d');
foreach ($events as $e) {
$bd = false;
if ($e['type'] === 'birthday') {
$channels[$x]['birthdays']++;
$bd = true;
} else {
$channels[$x]['events']++;
}
if (datetime_convert('UTC', intval($e['adjust']) ? date_default_timezone_get() : 'UTC', $e['start'], 'Y-m-d') === $str_now) {
$channels[$x]['all_events_today']++;
if ($bd) {
$channels[$x]['birthdays_today']++;
} else {
$channels[$x]['events_today']++;
}
}
}
}
}
}
}
$r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0", intval(get_account_id()));
$limit = account_service_class_fetch(get_account_id(), 'total_identities');
if ($limit !== false) {
$channel_usage_message = sprintf(t("You have created %1\$.0f of %2\$.0f allowed channels."), $r[0]['total'], $limit);
} else {
$channel_usage_message = '';
}
}
$create = array('new_channel', t('Create a new channel'), t('Create New'));
$delegates = q("select * from abook left join xchan on abook_xchan = xchan_hash where \n\t\t\tabook_channel = %d and (abook_their_perms & %d) > 0", intval(local_channel()), intval(PERMS_A_DELEGATE));
if ($delegates) {
for ($x = 0; $x < count($delegates); $x++) {
$delegates[$x]['link'] = 'magic?f=&dest=' . urlencode($delegates[$x]['xchan_url']) . '&delegate=' . urlencode($delegates[$x]['xchan_addr']);
$delegates[$x]['channel_name'] = $delegates[$x]['xchan_name'];
$delegates[$x]['delegate'] = 1;
}
} else {
$delegates = null;
//.........这里部分代码省略.........
示例3: process_channel_sync_delivery
/**
* @brief
*
* @param array $sender
* @param array $arr
* @param array $deliveries
* @return array
*/
function process_channel_sync_delivery($sender, $arr, $deliveries)
{
require_once 'include/import.php';
/** @FIXME this will sync red structures (channel, pconfig and abook). Eventually we need to make this application agnostic. */
$result = array();
foreach ($deliveries as $d) {
$r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']));
if (!$r) {
$result[] = array($d['hash'], 'not found');
continue;
}
$channel = $r[0];
$max_friends = service_class_fetch($channel['channel_id'], 'total_channels');
$max_feeds = account_service_class_fetch($channel['channel_account_id'], 'total_feeds');
if ($channel['channel_hash'] != $sender['hash']) {
logger('process_channel_sync_delivery: possible forgery. Sender ' . $sender['hash'] . ' is not ' . $channel['channel_hash']);
$result[] = array($d['hash'], 'channel mismatch', $channel['channel_name'], '');
continue;
}
if (array_key_exists('config', $arr) && is_array($arr['config']) && count($arr['config'])) {
foreach ($arr['config'] as $cat => $k) {
foreach ($arr['config'][$cat] as $k => $v) {
set_pconfig($channel['channel_id'], $cat, $k, $v);
}
}
}
if (array_key_exists('obj', $arr) && $arr['obj']) {
sync_objs($channel, $arr['obj']);
}
if (array_key_exists('likes', $arr) && $arr['likes']) {
import_likes($channel, $arr['likes']);
}
if (array_key_exists('app', $arr) && $arr['app']) {
sync_apps($channel, $arr['app']);
}
if (array_key_exists('chatroom', $arr) && $arr['chatroom']) {
sync_chatrooms($channel, $arr['chatroom']);
}
if (array_key_exists('conv', $arr) && $arr['conv']) {
import_conv($channel, $arr['conv']);
}
if (array_key_exists('mail', $arr) && $arr['mail']) {
import_mail($channel, $arr['mail']);
}
if (array_key_exists('event', $arr) && $arr['event']) {
sync_events($channel, $arr['event']);
}
if (array_key_exists('event_item', $arr) && $arr['event_item']) {
sync_items($channel, $arr['event_item']);
}
if (array_key_exists('item', $arr) && $arr['item']) {
sync_items($channel, $arr['item']);
}
if (array_key_exists('item_id', $arr) && $arr['item_id']) {
sync_items($channel, $arr['item_id']);
}
if (array_key_exists('menu', $arr) && $arr['menu']) {
sync_menus($channel, $arr['menu']);
}
if (array_key_exists('channel', $arr) && is_array($arr['channel']) && count($arr['channel'])) {
if (array_key_exists('channel_pageflags', $arr['channel']) && intval($arr['channel']['channel_pageflags'])) {
// These flags cannot be sync'd.
// remove the bits from the incoming flags.
// These correspond to PAGE_REMOVED and PAGE_SYSTEM on redmatrix
if ($arr['channel']['channel_pageflags'] & 0x8000) {
$arr['channel']['channel_pageflags'] = $arr['channel']['channel_pageflags'] - 0x8000;
}
if ($arr['channel']['channel_pageflags'] & 0x1000) {
$arr['channel']['channel_pageflags'] = $arr['channel']['channel_pageflags'] - 0x1000;
}
}
$disallowed = array('channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey', 'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted', 'channel_system');
$clean = array();
foreach ($arr['channel'] as $k => $v) {
if (in_array($k, $disallowed)) {
continue;
}
$clean[$k] = $v;
}
if (count($clean)) {
foreach ($clean as $k => $v) {
$r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v) . "' where channel_id = " . intval($channel['channel_id']));
}
}
}
if (array_key_exists('abook', $arr) && is_array($arr['abook']) && count($arr['abook'])) {
$total_friends = 0;
$total_feeds = 0;
$r = q("select abook_id, abook_feed from abook where abook_channel = %d", intval($channel['channel_id']));
if ($r) {
// don't count yourself
$total_friends = count($r) > 0 ? count($r) - 1 : 0;
//.........这里部分代码省略.........
示例4: import_account
function import_account($account_id)
{
if (!$account_id) {
logger("import_account: No account ID supplied");
return;
}
$max_identities = account_service_class_fetch($account_id, 'total_identities');
$max_friends = account_service_class_fetch($account_id, 'total_channels');
$max_feeds = account_service_class_fetch($account_id, 'total_feeds');
if ($max_identities !== false) {
$r = q("select channel_id from channel where channel_account_id = %d", intval($account_id));
if ($r && count($r) > $max_identities) {
notice(sprintf(t('Your service plan only allows %d channels.'), $max_identities) . EOL);
return;
}
}
$data = null;
$seize = x($_REQUEST, 'make_primary') ? intval($_REQUEST['make_primary']) : 0;
$import_posts = x($_REQUEST, 'import_posts') ? intval($_REQUEST['import_posts']) : 0;
$src = $_FILES['filename']['tmp_name'];
$filename = basename($_FILES['filename']['name']);
$filesize = intval($_FILES['filename']['size']);
$filetype = $_FILES['filename']['type'];
$completed = array_key_exists('import_step', $_SESSION) ? intval($_SESSION['import_step']) : 0;
if ($completed) {
logger('saved import step: ' . $_SESSION['import_step']);
}
if ($src) {
// This is OS specific and could also fail if your tmpdir isn't very large
// mostly used for Diaspora which exports gzipped files.
if (strpos($filename, '.gz')) {
@rename($src, $src . '.gz');
@system('gunzip ' . escapeshellarg($src . '.gz'));
}
if ($filesize) {
$data = @file_get_contents($src);
}
unlink($src);
}
if (!$src) {
$old_address = x($_REQUEST, 'old_address') ? $_REQUEST['old_address'] : '';
if (!$old_address) {
logger('mod_import: nothing to import.');
notice(t('Nothing to import.') . EOL);
return;
}
$email = x($_REQUEST, 'email') ? $_REQUEST['email'] : '';
$password = x($_REQUEST, 'password') ? $_REQUEST['password'] : '';
$channelname = substr($old_address, 0, strpos($old_address, '@'));
$servername = substr($old_address, strpos($old_address, '@') + 1);
$scheme = 'https://';
$api_path = '/api/red/channel/export/basic?f=&channel=' . $channelname;
if ($import_posts) {
$api_path .= '&posts=1';
}
$binary = false;
$redirects = 0;
$opts = array('http_auth' => $email . ':' . $password);
$url = $scheme . $servername . $api_path;
$ret = z_fetch_url($url, $binary, $redirects, $opts);
if (!$ret['success']) {
$ret = z_fetch_url('http://' . $servername . $api_path, $binary, $redirects, $opts);
}
if ($ret['success']) {
$data = $ret['body'];
} else {
notice(t('Unable to download data from old server') . EOL);
}
}
if (!$data) {
logger('mod_import: empty file.');
notice(t('Imported file is empty.') . EOL);
return;
}
$data = json_decode($data, true);
// logger('import: data: ' . print_r($data,true));
// print_r($data);
if (array_key_exists('user', $data) && array_key_exists('version', $data)) {
require_once 'include/Import/import_diaspora.php';
import_diaspora($data);
return;
}
$moving = false;
if (array_key_exists('compatibility', $data) && array_key_exists('database', $data['compatibility'])) {
$v1 = substr($data['compatibility']['database'], -4);
$v2 = substr(DB_UPDATE_VERSION, -4);
if ($v2 > $v1) {
$t = sprintf(t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1);
notice($t);
}
if (array_key_exists('server_role', $data['compatibility']) && $data['compatibility']['server_role'] == 'basic') {
$moving = true;
}
}
if ($moving) {
$seize = 1;
}
// import channel
$relocate = array_key_exists('relocate', $data) ? $data['relocate'] : null;
if (array_key_exists('channel', $data)) {
//.........这里部分代码省略.........
示例5: account_service_class_allows
/**
* @brief Check service class restrictions by account.
*
* If there are no service_classes defined, everything is allowed.
* If $usage is supplied, we check against a maximum count and return true if
* the current usage is less than the subscriber plan allows. Otherwise we
* return boolean true or false if the property is allowed (or not) in this
* subscriber plan. An unset property for this service plan means the property
* is allowed, so it is only necessary to provide negative properties for each
* plan, or what the subscriber is not allowed to do.
*
* Like service_class_allows() but queries directly by account rather than channel.
*
* @see service_class_allows() if you have a channel_id instead of an account_id
* @see account_service_class_fetch()
*
* @param int $aid The account_id to check
* @param string $property The service class property to check for
* @param int|boolean $usage (optional) The value to check against
* @return boolean
*/
function account_service_class_allows($aid, $property, $usage = false)
{
$limit = account_service_class_fetch($aid, $property);
if ($limit === false) {
return true;
}
// No service class is set => everything is allowed
if ($usage === false) {
// We use negative values for not allowed properties in a subscriber plan
return x($limit) ? (bool) $limit : true;
} else {
return intval($usage) < intval($limit) ? true : false;
}
}
示例6: import_post
function import_post(&$a)
{
$account_id = get_account_id();
if (!$account_id) {
return;
}
$max_identities = account_service_class_fetch($account_id, 'total_identities');
$max_friends = account_service_class_fetch($account_id, 'total_channels');
$max_feeds = account_service_class_fetch($account_id, 'total_feeds');
if ($max_identities !== false) {
$r = q("select channel_id from channel where channel_account_id = %d", intval($account_id));
if ($r && count($r) > $max_identities) {
notice(sprintf(t('Your service plan only allows %d channels.'), $max_identities) . EOL);
return;
}
}
$data = null;
$seize = x($_REQUEST, 'make_primary') ? intval($_REQUEST['make_primary']) : 0;
$import_posts = x($_REQUEST, 'import_posts') ? intval($_REQUEST['import_posts']) : 0;
$src = $_FILES['filename']['tmp_name'];
$filename = basename($_FILES['filename']['name']);
$filesize = intval($_FILES['filename']['size']);
$filetype = $_FILES['filename']['type'];
if ($src) {
if ($filesize) {
$data = @file_get_contents($src);
}
unlink($src);
}
if (!$src) {
$old_address = x($_REQUEST, 'old_address') ? $_REQUEST['old_address'] : '';
if (!$old_address) {
logger('mod_import: nothing to import.');
notice(t('Nothing to import.') . EOL);
return;
}
$email = x($_REQUEST, 'email') ? $_REQUEST['email'] : '';
$password = x($_REQUEST, 'password') ? $_REQUEST['password'] : '';
$channelname = substr($old_address, 0, strpos($old_address, '@'));
$servername = substr($old_address, strpos($old_address, '@') + 1);
$scheme = 'https://';
$api_path = '/api/red/channel/export/basic?f=&channel=' . $channelname;
if ($import_posts) {
$api_path .= '&posts=1';
}
$binary = false;
$redirects = 0;
$opts = array('http_auth' => $email . ':' . $password);
$url = $scheme . $servername . $api_path;
$ret = z_fetch_url($url, $binary, $redirects, $opts);
if (!$ret['success']) {
$ret = z_fetch_url('http://' . $servername . $api_path, $binary, $redirects, $opts);
}
if ($ret['success']) {
$data = $ret['body'];
} else {
notice(t('Unable to download data from old server') . EOL);
}
}
if (!$data) {
logger('mod_import: empty file.');
notice(t('Imported file is empty.') . EOL);
return;
}
$data = json_decode($data, true);
// logger('import: data: ' . print_r($data,true));
// print_r($data);
// import channel
$channel = $data['channel'];
$r = q("select * from channel where (channel_guid = '%s' or channel_hash = '%s' or channel_address = '%s' ) limit 1", dbesc($channel['channel_guid']), dbesc($channel['channel_hash']), dbesc($channel['channel_address']));
// We should probably also verify the hash
if ($r) {
if ($r[0]['channel_guid'] === $channel['channel_guid'] || $r[0]['channel_hash'] === $channel['channel_hash']) {
logger('mod_import: duplicate channel. ', print_r($channel, true));
notice(t('Cannot create a duplicate channel identifier on this system. Import failed.') . EOL);
return;
} else {
// try at most ten times to generate a unique address.
$x = 0;
$found_unique = false;
do {
$tmp = $channel['channel_address'] . mt_rand(1000, 9999);
$r = q("select * from channel where channel_address = '%s' limit 1", dbesc($tmp));
if (!$r) {
$channel['channel_address'] = $tmp;
$found_unique = true;
break;
}
$x++;
} while ($x < 10);
if (!$found_unique) {
logger('mod_import: duplicate channel. randomisation failed.', print_r($channel, true));
notice(t('Unable to create a unique channel address. Import failed.') . EOL);
return;
}
}
}
unset($channel['channel_id']);
$channel['channel_account_id'] = get_account_id();
$channel['channel_primary'] = $seize ? 1 : 0;
//.........这里部分代码省略.........
示例7: process_channel_sync_delivery
function process_channel_sync_delivery($sender, $arr, $deliveries)
{
/** @FIXME this will sync red structures (channel, pconfig and abook). Eventually we need to make this application agnostic. */
$result = array();
foreach ($deliveries as $d) {
$r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']));
if (!$r) {
$result[] = array($d['hash'], 'not found');
continue;
}
$channel = $r[0];
$max_friends = service_class_fetch($channel['channel_id'], 'total_channels');
$max_feeds = account_service_class_fetch($channel['channel_account_id'], 'total_feeds');
if ($channel['channel_hash'] != $sender['hash']) {
logger('process_channel_sync_delivery: possible forgery. Sender ' . $sender['hash'] . ' is not ' . $channel['channel_hash']);
$result[] = array($d['hash'], 'channel mismatch', $channel['channel_name'], '');
continue;
}
if (array_key_exists('config', $arr) && is_array($arr['config']) && count($arr['config'])) {
foreach ($arr['config'] as $cat => $k) {
foreach ($arr['config'][$cat] as $k => $v) {
set_pconfig($channel['channel_id'], $cat, $k, $v);
}
}
}
if (array_key_exists('channel', $arr) && is_array($arr['channel']) && count($arr['channel'])) {
$disallowed = array('channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey', 'channel_address', 'channel_notifyflags');
$clean = array();
foreach ($arr['channel'] as $k => $v) {
if (in_array($k, $disallowed)) {
continue;
}
$clean[$k] = $v;
}
if (count($clean)) {
foreach ($clean as $k => $v) {
$r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v) . "' where channel_id = " . intval($channel['channel_id']));
}
}
}
if (array_key_exists('abook', $arr) && is_array($arr['abook']) && count($arr['abook'])) {
$total_friends = 0;
$total_feeds = 0;
$r = q("select abook_id, abook_flags from abook where abook_channel = %d", intval($channel['channel_id']));
if ($r) {
// don't count yourself
$total_friends = count($r) > 0 ? count($r) - 1 : 0;
foreach ($r as $rr) {
if ($rr['abook_flags'] & ABOOK_FLAG_FEED) {
$total_feeds++;
}
}
}
$disallowed = array('abook_id', 'abook_account', 'abook_channel');
foreach ($arr['abook'] as $abook) {
$clean = array();
if ($abook['abook_xchan'] && $abook['entry_deleted']) {
logger('process_channel_sync_delivery: removing abook entry for ' . $abook['abook_xchan']);
require_once 'include/Contact.php';
$r = q("select abook_id, abook_flags from abook where abook_xchan = '%s' and abook_channel = %d and not ( abook_flags & %d )>0 limit 1", dbesc($abook['abook_xchan']), intval($channel['channel_id']), intval(ABOOK_FLAG_SELF));
if ($r) {
contact_remove($channel['channel_id'], $r[0]['abook_id']);
if ($total_friends) {
$total_friends--;
}
if ($r[0]['abook_flags'] & ABOOK_FLAG_FEED) {
$total_feeds--;
}
}
continue;
}
// Perform discovery if the referenced xchan hasn't ever been seen on this hub.
// This relies on the undocumented behaviour that red sites send xchan info with the abook
if ($abook['abook_xchan'] && $abook['xchan_address']) {
$h = zot_get_hublocs($abook['abook_xchan']);
if (!$h) {
$f = zot_finger($abook['xchan_address'], $channel);
if (!$f['success']) {
logger('process_channel_sync_delivery: abook not probe-able' . $abook['xchan_address']);
continue;
}
$j = json_decode($f['body'], true);
if (!($j['success'] && $j['guid'])) {
logger('process_channel_sync_delivery: probe failed.');
continue;
}
$x = import_xchan($j);
if (!$x['success']) {
logger('process_channel_sync_delivery: import failed.');
continue;
}
}
}
foreach ($abook as $k => $v) {
if (in_array($k, $disallowed) || strpos($k, 'abook') !== 0) {
continue;
}
$clean[$k] = $v;
}
if (!array_key_exists('abook_xchan', $clean)) {
//.........这里部分代码省略.........