示例#1
0
 function serviceLoad()
 {
     $this->loadGlines();
     $this->loadBadchans();
     if (defined('TOR_GLINE') && TOR_GLINE == true) {
         if (!defined('TOR_DURATION')) {
             die('tor_gline is enabled, but tor_duration was not defined!');
         }
         if (convertDuration(TOR_DURATION) == false) {
             die('The duration specified in tor_duration is invalid!');
         }
         if (!defined('TOR_REASON') || TOR_REASON == '') {
             die('tor_gline is enabled, but tor_reason was not defined!');
         }
     }
     if (defined('COMP_GLINE') && COMP_GLINE == true) {
         if (!defined('COMP_DURATION')) {
             die('comp_gline is enabled, but comp_duration was not defined!');
         }
         if (convertDuration(COMP_DURATION) == false) {
             die('The duration specified in comp_duration is invalid!');
         }
         if (!defined('COMP_REASON') || COMP_REASON == '') {
             die('comp_gline is enabled, but comp_reason was not defined!');
         }
     }
     if (defined('CLONE_GLINE') && CLONE_GLINE == true) {
         if (!defined('CLONE_MAX')) {
             die('clone_gline is enabled, but clone_max was not defined!');
         }
         if (!is_numeric(CLONE_MAX) || CLONE_MAX == 0) {
             die('Invalid value specified for clone_max!');
         }
         if (!defined('CLONE_DURATION')) {
             die('clone_gline is enabled, but clone_duration was not defined!');
         }
         if (convertDuration(CLONE_DURATION) == false) {
             die('The duration specified in clone_duration is invalid!');
         }
         if (!defined('CLONE_REASON') || CLONE_REASON == '') {
             die('clone_gline is enabled, but clone_reason was not defined!');
         }
     }
 }
 * 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.
 */
$channel = $pargs[1];
$duration = $pargs[2];
$reason = assemble($pargs, 3);
if (!preg_match('/^#/', $channel)) {
    $bot->noticef($user, '%s is not a valid channel name.', $channel);
    return false;
}
if (!($duration_secs = convertDuration($duration))) {
    $bot->notice($user, 'Invalid duration specified! See help for more details.');
    return false;
}
$max_ts = 2147483647;
$expire_ts = time() + $duration_secs;
if ($expire_ts > $max_ts || $expire_ts < 0) {
    $bot->noticef($user, 'The duration you specified is too large. Please try something more sensible.');
    return false;
}
$gline = $this->addGline($channel, $duration_secs, time(), $reason);
$this->enforceGline($gline);
示例#3
0
        ?>

                
            <!-- Javascript link to get a link to the song listed -->
			<div class="track sixteen columns">


                <div class="track-name padding">
                	<!-- Displays the track information -->
                    <h4><?php 
        echo $trackReturn['track_name'];
        ?>
</h4>

                    <span class="right"><?php 
        echo convertDuration($trackReturn['duration']);
        ?>
</span>
                    <br />
                    by <a href="albumlist.php?artist=<?php 
        echo urlencode($artistInfo['artist_name']);
        ?>
"><?php 
        echo $artistInfo['artist_name'];
        ?>
</a> 
                    in album <a href="tracklist.php?album=<?php 
        echo urlencode($albumInfo['album_title']);
        ?>
"><?php 
        echo $albumInfo['album_title'];
        $gline_mask = '*@' . $user->getIp();
        $gline_secs = convertDuration(CLONE_DURATION);
        $new_gl = $this->addGline($gline_mask, $gline_secs, time(), CLONE_REASON);
        $this->enforceGline($new_gl);
        $gline_set = true;
    }
    if (defined('TOR_GLINE') && TOR_GLINE == true && !$gline_set && $this->isTorHost($user->getIp())) {
        $gline_mask = '*@' . $user->getIp();
        $gline_secs = convertDuration(TOR_DURATION);
        $new_gl = $this->addGline($gline_mask, $gline_secs, time(), TOR_REASON);
        $this->enforceGline($new_gl);
        $gline_set = true;
    }
    if (defined('COMP_GLINE') && COMP_GLINE == true && !$gline_set && $this->isCompromisedHost($user->getIp())) {
        $gline_mask = '*@' . $user->getIp();
        $gline_secs = convertDuration(COMP_DURATION);
        $new_gl = $this->addGline($gline_mask, $gline_secs, time(), COMP_REASON);
        $this->enforceGline($new_gl);
        $gline_set = true;
    }
}
// Don't log new users during the initial burst, as it could flood the log channel.
if ($this->finished_burst) {
    if ($is_new_user) {
        // new user
        $server = $this->getServer($args[0]);
        $rest = irc_sprintf('%H (%s@%s) [%s]', $user, $user->getIdent(), $user->getHost(), $user->getName());
        $this->reportEvent('NICK', $server, $rest);
    } else {
        // nick change
        $this->reportEvent('NICK', $old_nick, $new_nick);
示例#5
0
 function performGline($gline_mask, $gline_duration, $gline_reason)
 {
     if (defined('OS_GLINE') && OS_GLINE == true && defined('OS_NICK')) {
         $oper_service = $this->getUserByNick(OS_NICK);
         $gline_command = irc_sprintf('GLINE %s %s %s', $gline_mask, $gline_duration, $gline_reason);
         if (!$oper_service) {
             $pending_commands[] = $gline_command;
             return;
         }
         $this->default_bot->message($oper_service, $gline_command);
     } else {
         $gline_secs = convertDuration($gline_duration);
         $new_gl = $this->addGline($gline_mask, $gline_secs, time(), $gline_reason);
         $this->enforceGline($new_gl);
     }
 }
示例#6
0
if ($devoice_users) {
    $this->devoice($chan->getName(), $chan->getVoiceList());
}
if ($clearBans) {
    $this->unban($chan->getName(), $chan->getMatchingBans());
}
if ($clearModes) {
    $this->clearModes($chan->getName());
}
if ($gline_users) {
    $users = $chan->getUserList();
    $gline_duration = '1h';
    if ($cmd_num_args >= 3 && convertDuration($pargs[3]) !== false) {
        $gline_duration = $pargs[3];
    }
    $gline_duration = convertDuration($gline_duration);
    $lifetime = time() + $gline_duration;
    foreach ($users as $numeric) {
        $tmp_user = $this->getUser($numeric);
        if ($tmp_user != $user && !$tmp_user->isBot()) {
            $gline = $this->addGline($tmp_user->getGlineMask(), $gline_duration, time(), time(), $lifetime, "Channel g-line for " . $chan->getName());
            $this->enforceGline($gline);
        }
    }
}
if ($kick_users) {
    $users = $chan->getUserList();
    foreach ($users as $numeric) {
        $tmp_user = $this->getUser($numeric);
        if ($tmp_user != $user && !$tmp_user->isBot()) {
            $this->kick($chan->getName(), $numeric, "Clearing channel " . $chan->getName());
示例#7
0
文件: jeeCron.php 项目: jimibi/core
             $cron->save();
             $cron->setEnable(0);
             log::add('cron', 'error', __('[Erreur] Non trouvée ', __FILE__) . $cron->getName());
             die;
         }
     }
     if ($cron->getOnce() == 1) {
         $cron->remove(false);
     } else {
         if (!$cron->refresh()) {
             die;
         }
         $cron->setState('stop');
         $cron->setPID();
         $cron->setServer('');
         $cron->setDuration(convertDuration(strtotime('now') - $datetimeStart));
         $cron->save();
     }
     die;
 } catch (Exception $e) {
     $cron->setState('error');
     $cron->setPID('');
     $cron->setServer('');
     $cron->setDuration(-1);
     $cron->save();
     $logicalId = config::genKey();
     if ($e->getCode() != 0) {
         $logicalId = $cron->getName() . '::' . $e->getCode();
     }
     echo '[Erreur] ' . $cron->getName() . ' : ' . print_r($e, true);
     log::add('cron', 'error', __('Erreur sur ', __FILE__) . $cron->getName() . ' : ' . print_r($e, true), $logicalId);