本文整理汇总了PHP中assemble函数的典型用法代码示例。如果您正苦于以下问题:PHP assemble函数的具体用法?PHP assemble怎么用?PHP assemble使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assemble函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assemble
function assemble($params)
{
if (!is_array($params)) {
return null;
}
ksort($params, SORT_STRING);
$sign = '';
foreach ($params as $key => $val) {
$sign .= $key . (is_array($val) ? assemble($val) : $val);
}
return $sign;
}
示例2: assemble
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
if ($reg = $this->getChannelReg($chan_name)) {
$this->removeChannelReg($reg);
$reg->delete();
$reason = 'So long, and thanks for all the fish!';
if ($cmd_num_args > 1) {
$reason = assemble($pargs, 2);
}
if (($chan = $this->getChannel($chan_name)) && $chan->isOn($bot->getNumeric())) {
$bot->mode($chan->getName(), '-R');
$bot->part($chan->getName(), $reason);
}
}
示例3: assemble
/*
* ircPlanet Services for ircu
* Copyright (c) 2005 Brian Cline.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$quote_stuff = assemble($pargs, 1);
$this->sendf($quote_stuff);
示例4: getHostMask
function getHostMask()
{
$mask = '*!*' . right($this->ident, IDENT_LEN) . '@';
$host = $this->host;
if ($this->hasFakehost()) {
$host = $this->fakehost;
} elseif ($this->isHostHidden()) {
$host = $this->getAccountName() . '.' . HIDDEN_HOST;
}
$levels = explode('.', $host);
$num_levels = count($levels);
if (isIp($host)) {
$host = assemble($levels, 0, 3, '.');
$host .= '.*';
} elseif ($num_levels > 2) {
for ($n = $num_levels - 1; $n > 0; $n--) {
if (preg_match('/[0-9]/', $levels[$n])) {
break;
}
}
$host = '*.';
$host .= assemble($levels, $n + 1, -1, '.');
}
$mask = fixHostMask($mask);
return $mask . $host;
}
示例5: assemble
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
if (!($chan = $this->getChannel($chan_name))) {
$bot->noticef($user, "Nobody is on channel %s.", $chan_name);
return false;
}
if (!$chan->isOn($bot->getNumeric())) {
$bot->noticef($user, 'I am not on %s.', $chan->getName());
return false;
}
$text = assemble($pargs, 2);
$bot->message($chan->getName(), $text);
示例6: assemble
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$chan_name = $pargs[1];
$owner_nick = $pargs[2];
$purpose = '';
if ($cmd_num_args > 2) {
$purpose = assemble($pargs, 3);
}
if ($chan_name[0] != '#') {
$bot->notice($user, 'Channel names must begin with the # character.');
return false;
}
if (!($owner = $this->getAccount($owner_nick))) {
$bot->noticef($user, '%s is not a known account name!', $owner_nick);
return false;
}
if (!($reg = $this->getChannelReg($chan_name))) {
$reg = new DB_Channel($chan_name, $owner->getId());
$reg->setPurpose($purpose);
$reg->save();
$reg = $this->addChannelReg($reg);
$bot->join($chan_name);
示例7: assemble
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$is_public = false;
$is_private = false;
$cmd_msg = assemble($args, 3);
$cmd_target = $privmsg_target;
$this->loadCommandInfo();
if (empty($chan_key) && array_key_exists($cmd_target, $this->users) && $this->users[$cmd_target]->isBot()) {
$bot = $this->users[$cmd_target];
$is_private = true;
}
if (!empty($chan_key) && $cmd_msg[0] == '!') {
$cmd_msg = substr($cmd_msg, 1);
$bot = $this->default_bot;
$is_public = true;
}
if ($is_public || $is_private) {
$user_numeric = $args[0];
$user = $this->getUser($user_numeric);
$pargs = lineGetArgs($cmd_msg, false);
示例8: strtoupper
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$option = strtoupper($pargs[2]);
$value = '';
if ($cmd_num_args >= 3) {
$value = assemble($pargs, 3);
}
if ($option == 'PURPOSE') {
if (strlen($value) >= MAXLEN_CHAN_PURPOSE) {
$bot->notice($user, 'The channel purpose you provided is too long. Please try something shorter.');
return false;
}
$chan_reg->setPurpose($value);
$bot->notice($user, 'Updated channel purpose.');
} elseif ($option == 'URL') {
if (strlen($value) >= MAXLEN_CHAN_URL) {
$bot->notice($user, 'The channel URL you provided is too long. Please try something shorter.');
return false;
}
$chan_reg->setUrl($value);
$bot->notice($user, 'Updated channel URL.');
示例9: assemble
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
if (!($chan = $this->getChannel($chan_name))) {
$bot->noticef($user, "Nobody is on channel %s.", $chan_name);
return false;
}
if (!$chan->isOn($bot->getNumeric())) {
$bot->noticef($user, 'I am not on %s.', $chan->getName());
return false;
}
$text = "ACTION " . assemble($pargs, 2) . "";
$bot->message($chan->getName(), $text);
示例10: assemble
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$topic_arg = 3;
if (TOPIC_BURSTING) {
$topic_arg = 5;
}
$topic = assemble($args, $topic_arg);
if ($chan = $this->getChannel($chan_key)) {
$chan->setTopic($topic);
}
示例11: assemble
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$help_topic = 'help';
$help_level = 0;
if ($cmd_num_args > 0) {
$help_topic = assemble($pargs, 1);
$help_topic_first = $pargs[1];
$help_level = $this->getCommandLevel($help_topic_first);
}
$res = db_query("select text from help where service = 'CS' and topic = '{$help_topic}' and minlevel <= {$user_level}");
if ($res && mysql_num_rows($res) > 0) {
$row = mysql_fetch_assoc($res);
$lines = explode("\n", $row['text']);
$spacing = str_repeat(' ', 30 - strlen($help_topic));
$help_syntax = $this->getCommandSyntax($help_topic);
$bot->noticef($user, "%sHELP on %s %s %10s%s", BOLD_START, $help_topic, $spacing, 'Level ' . $help_level, BOLD_END);
$bot->noticef($user, "");
if (!preg_match('/syntax:/i', $row['text'])) {
$bot->noticef($user, "%sSyntax:%s %s %s", BOLD_START, BOLD_END, $help_topic, $help_syntax);
$bot->noticef($user, "");
}
示例12: assemble
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
if (!($chan = $this->getChannel($chan_name))) {
$bot->noticef($user, "Nobody is on channel %s.", $chan_name);
return false;
}
if ($cmd_num_args < 2) {
$bot->noticef($user, 'Topic on %s%s%s is currently: %s', BOLD_START, $chan->getName(), BOLD_END, $chan->getTopic());
} else {
$new_topic = assemble($pargs, 2);
$bot->topic($chan->getName(), $new_topic, $chan->getTs());
$chan->topic = $new_topic;
}
示例13: assemble
/*
* ircPlanet Services for ircu
* Copyright (c) 2005 Brian Cline.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of ircPlanet nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
$ping_text = assemble($pargs, 1);
$bot->noticef($user->numeric, "%sPING %s", CTCP_START, $ping_text);
示例14: strtoupper
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
if (!($reg = $this->getChannelReg($chan_name))) {
$bot->noticef($user, '%s is not registered!', $chan_name);
return false;
}
$mod_uid = $pargs[2];
$option = strtoupper($pargs[3]);
$value = '';
if ($cmd_num_args >= 4) {
$value = assemble($pargs, 4);
}
if ($mod_user = $this->getAccount($mod_uid)) {
if (!($access = $this->getChannelAccessAccount($chan_name, $mod_user))) {
$bot->noticef($user, '%s is not in the %s access list.', $mod_user->getName(), $reg->getName());
return false;
}
if ($option == 'LEVEL') {
$new_level = $value;
if ($new_level < 1 || $new_level > 500) {
$bot->notice($user, 'Access level must range from 1 to 500.');
return false;
}
$access->setLevel($new_level);
$bot->noticef($user, '%s\'s level on %s has has been changed to %d.', $mod_user->getName(), $reg->getName(), $new_level);
} elseif ($option == 'AUTOOP') {
示例15: count
$user_level = $this->getUserLevel($user);
$cmd_level = $this->getCommandLevel($cmd_name);
$cmd_req_args = $this->getCommandArgCount($cmd_name);
$cmd_num_args = count($pargs) - 1;
if ($user->isService() && $cmd_name == 'gline') {
$user_level = $cmd_level;
}
if ($cmd_num_args > 0) {
$chan_name = $pargs[1];
$chan_key = strtolower($chan_name);
}
if ($user_level >= $cmd_level) {
if ($cmd_num_args >= $cmd_req_args) {
$chan_name = $chan_key;
$cmd_result = (include $cmd_handler_file);
if ($cmd_result == false) {
return false;
}
$report_cmd = str_replace("_", " ", $cmd_name);
$report_cmd = strtoupper($report_cmd);
$this->reportCommand($report_cmd, $user, assemble($pargs, 1));
} else {
$bot->noticef($user, "%sSyntax:%s %s %s", BOLD_START, BOLD_END, $cmd_name, $this->getCommandSyntax($cmd_name));
}
} else {
$bot->noticef($user, "You do not have enough access to use that command!");
}
} elseif (!$is_public) {
$bot->noticef($user->numeric, "Invalid command! Use %sshowcommands%s to get a list of available commands.", BOLD_START, BOLD_END);
}
}