示例#1
0
 public function actionAdmin()
 {
     $model = new Ban('search');
     $model->unsetAttributes();
     if (isset($_GET['Ban'])) {
         $model->setAttributes($_GET['Ban']);
     }
     $this->render('admin', array('model' => $model));
 }
示例#2
0
文件: Ban.php 项目: ngdvan/lntguitar
 public function addTags($tags)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('title', $tags);
     $this->updateCounters(array('frequency' => 1), $criteria);
     foreach ($tags as $name) {
         if (!$this->exists('title=:name', array(':name' => $name))) {
             $tag = new Ban();
             $tag->title = $name;
             $tag->frequency = 1;
             $tag->save();
         }
     }
 }
示例#3
0
 protected function set_current_user()
 {
     $user = null;
     $AnonymousUser = array('id' => 0, 'level' => 0, 'name' => "Anonymous", 'show_samples' => true, 'language' => '', 'secondary_languages' => '', 'pool_browse_mode' => 1, 'always_resize_images' => true, 'ip_addr' => $this->request()->remoteIp());
     if (!current_user() && $this->session()->user_id) {
         $user = User::where(['id' => $this->session()->user_id])->first();
     } else {
         if ($this->cookies()->login && $this->cookies()->pass_hash) {
             $user = User::authenticate_hash($this->cookies()->login, $this->cookies()->pass_hash);
         } elseif (isset($this->params()->login) && isset($this->params()->password_hash)) {
             $user = User::authenticate($this->params()->login, $this->params()->password_hash);
         } elseif (isset($this->params()->user['name']) && isset($this->params()->user['password'])) {
             $user = User::authenticate($this->params()->user['name'], $this->params()->user['password']);
         }
         $user && $user->updateAttribute('last_logged_in_at', date('Y-m-d H:i:s'));
     }
     if ($user) {
         if ($user->is_blocked() && $user->ban && $user->ban->expires_at < date('Y-m-d H:i:s')) {
             $user->updateAttribute('level', CONFIG()->starting_level);
             Ban::destroyAll("user_id = " . $user->id);
         }
         $this->session()->user_id = $user->id;
     } else {
         $user = new User();
         $user->assignAttributes($AnonymousUser, ['without_protection' => true]);
     }
     User::set_current_user($user);
     $this->current_user = $user;
     # For convenient access in activerecord models
     $user->ip_addr = $this->request()->remoteIp();
     Moebooru\Versioning\Versioning::init_history();
     if (!current_user()->is_anonymous()) {
         current_user()->log($this->request()->remoteIp());
     }
 }
示例#4
0
 public function testIndefiniteExpiry()
 {
     $victim = $this->getNewPlayer();
     $ban = Ban::addBan($victim->getId(), $this->getNewPlayer()->getId(), null, "Reason");
     $this->assertTrue($victim->isBanned());
     $this->assertEquals(Ban::getBan($victim->getId())->getId(), $ban->getId());
 }
示例#5
0
 public function post_ban()
 {
     if (Request::ajax()) {
         $error = '';
         $get = Input::all();
         $banUsername = $get['bUsername'];
         $banReason = $get['bReason'];
         $user = User::where('username', '=', $banUsername)->first();
         // belki kullanıcı zaten banlı olabilir.admin değğilse tekrar banlayamasın
         if ($user->username == Sentry::user()->username) {
             $error = 'Lütfen kendinizi banlamayınız.';
             die("ban");
         }
         $ban = $user->bans()->first();
         // Kullanıcı Zaten Banlıysa,bitiş tarihini geri döndür.
         if ($ban) {
             die($ban->ban_end);
         }
         // Güvenlik Koaaaaaaaaaaaaaaaaaaaaaaaaantrolü
         $date = date('Y-m-d H:i:s');
         $bandate = date('Y-m-d H:i:s', strtotime('+1 day', strtotime($date)));
         $banData = Ban::create(array('user_id' => $user->id, 'ban_ip' => $user->ip_address, 'ban_email' => $user->user_email, 'ban_start' => $date, 'ban_end' => $bandate, 'ban_reason' => $banReason, 'ban_moderatorid' => Sentry::user()->id));
         die("OK");
     }
 }
示例#6
0
 /**
  * This is invoked after the record is deleted.
  */
 protected function afterDelete()
 {
     parent::afterDelete();
     //Comment::model()->deleteAll('post_id='.$this->id);
     HopamTag::model()->updateFrequency($this->tags, '');
     Ban::model()->updateFrequency($this->ban_artist, '');
 }
示例#7
0
 /**
  * 
  * Checks if username and password is not empty
  * Checks if user exists and password matches
  * Logs the user in
  * remember_me() is called
  * 
  * @return type
  */
 public function process_login()
 {
     //don't neeed much validation since we use prepared queries
     $username = strip_tags(trim($this->username));
     $hasher = new \CODOF\Pass(8, false);
     $password = $this->password;
     $errors = array();
     if (strlen($username) == 0) {
         $errors[]["msg"] = _t("username field cannot be left empty");
     }
     if (strlen($password) == 0) {
         $errors[]["msg"] = _t("password field cannot be left empty");
     }
     if (strlen($password) < 72 && empty($errors)) {
         $user = User::getByUsername($username);
         $ip = $_SERVER['REMOTE_ADDR'];
         //cannot be trusted at all ;)
         $ban = new Ban($this->db);
         if ($user && $ban->is_banned(array($ip, $username, $user->mail))) {
             $ban_len = '';
             if ($ban->expires > 0) {
                 $ban_len = _t("until ") . date('d-m-Y h:m:s', $ban->expires);
             }
             return json_encode(array("msg" => _t("You have been banned ") . $ban_len));
         }
         if ($user && $hasher->CheckPassword($password, $user->pass)) {
             User::login($user->id);
             $user = User::get();
             $user->rememberMe();
             return json_encode(array("msg" => "success", "uid" => $user->id, "rid" => $user->rid, "role" => User::getRoleName($user->rid)));
         } else {
             \CODOF\Log::info('failed login attempt by ' . $username . 'wrong username/password');
             return json_encode(array("msg" => _t("Wrong username or password")));
         }
     } else {
         return json_encode($errors);
     }
 }
示例#8
0
 public function execute()
 {
     global $gvPath, $gvPhoneCodeLength;
     if ($this->redirect) {
         return $this->redirect;
     }
     $this->message = '';
     $phone = gfPostVar('phone');
     if (!$phone) {
         $this->message = 'Il campo è obbligatorio.';
         return true;
     }
     // Check only digits have been typed
     if (!preg_match('/^[0-9]{5,}$/', $phone)) {
         $this->message = 'Il valore inserito non è valido.';
         return true;
     }
     // Remove international prefix if present
     $phone = preg_replace('/^(00|\\+)?39/', '', $phone);
     $phone = '39' . $phone;
     // Check no ticket is reserved with this phone number
     $ticket = Ticket::fromDatabaseBySourceId($phone);
     if ($ticket) {
         $this->message = 'Hai già prenotato un ticket con questo numero.';
         return true;
     }
     // Check phone number is not banned
     if (Ban::isBanned($phone)) {
         $this->message = 'Questo numero di telefono è stato bloccato.';
         return true;
     }
     $hashRandom = (string) mt_rand(0, 100000);
     $hashRandom .= (string) mt_rand(0, 100000);
     $hashRandom = strtoupper(sha1($hashRandom));
     $positionRandom = mt_rand(0, 40 - $gvPhoneCodeLength);
     $phone_code = substr($hashRandom, $positionRandom, $gvPhoneCodeLength);
     $_SESSION['phone_code'] = $phone_code;
     $_SESSION['phone'] = $phone;
     // Send SMS
     $sender = new SmsSender($phone);
     if (!$sender->sendVerificationCode($phone_code)) {
         $this->message = 'Errore nell\'invio del messaggio. Verificare che il numero di telefono sia corretto.';
         return true;
     }
     $_SESSION['step'] = 2;
     $redirect = new RedirectOutput("{$gvPath}/web/checkPhone");
     return $redirect;
 }
示例#9
0
 protected function __construct($identity, $db = null)
 {
     if (!$db) {
         $db = Db::primary();
     }
     $this->db = $db;
     if (mt_rand(1, 200) === 1) {
         $this->maintenance();
     }
     $this->identity = $identity;
     $bans = unserialize(Cache::get('bans-' . $this->identity));
     if ($bans) {
         $this->banned($bans);
     }
     self::$banTypes = unserialize(Cache::get('table_ban_types'));
     if (!self::$banTypes) {
         self::$banTypes = $this->db->columnKey('name', 'ban_type', '1=1');
     }
 }
 public function getChuyenHang($id)
 {
     $cthd = Ban::select("ban.id_sp", "ban.soluong", "sanpham.tensp")->join("sanpham", "sanpham.id", '=', "ban.id_sp")->where("id_dh", '=', $id)->get();
     $error = array();
     foreach ($cthd as $v) {
         $kho = DB::table('ton_kho')->where("id", '=', $v->id_sp)->where("soluong", ">=", $v->soluong)->count();
         if ($kho == 0) {
             $error[$v->id_sp] = "Sản phẩm \"{$v->tensp}\" có ID= {$v->id_sp} đã hết hàng hoặc không đủ số lượng.";
         }
     }
     if (empty($error)) {
         date_default_timezone_set("Asia/Bangkok");
         $date = new DateTime();
         $dh = Donhang::find($id);
         $dh->xem = 1;
         $dh->ngaygiao = $date;
         $dh->id_trangthai = 3;
         $dh->save();
         return Redirect::to("dat_hang/donhang-dachuyen");
     } else {
         return Redirect::to("dat_hang/xemdon-dathang")->with("error", $error);
     }
 }
示例#11
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Ban the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Ban::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#12
0
<?php

$this->breadcrumbs = array(Ban::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Ban::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Ban::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Ban::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
示例#13
0
 public function unblock()
 {
     foreach (array_keys($this->params()->user) as $user_id) {
         Ban::destroyAll("user_id = ?", $user_id);
     }
     $this->redirectTo('#show_blocked_users');
 }
 public function unban($hash)
 {
     $user = User::where('public_hash', $hash)->firstOrFail();
     Ban::unbanComments(self::userFp(), $user->user_fp);
     return Redirect::to('@' . $user->public_hash);
 }
示例#15
0
 public static function createPost($user_fp, $input, $timestamp = false)
 {
     $timestamp = $timestamp ? $timestamp : date('Y-m-d H:i:s');
     if ($input['parent_id'] != 0) {
         $parent_post = Post::findOrFail($input['parent_id']);
         if ($parent_post->parent_id != 0) {
             App::abort(500, "Illegal post_id");
         }
         if (Ban::isBanned($parent_post->user_fp, $user_fp)) {
             App::abort(500, "You are banned");
         }
         if ($parent_post->group_name != "" && Group::where('group_name', $parent_post->group_name)->first()->is_private == 1) {
             if (!Gsub::membership($user_fp, $parent_post->group_name)) {
                 App::abort(500, 'Only members of group can leave comments.');
             }
         }
     } else {
         if ($input['group_name']) {
             $group = Group::where('group_name', $input['group_name'])->firstOrFail();
             if ($group->is_private == 1) {
                 if (!Gsub::membership($user_fp, $input['group_name'])) {
                     App::abort(500, 'Membership required to post.');
                 }
             }
         }
     }
     $message = rtrim($input['message']);
     $plaintext = BaseController::isSigned($message);
     $post = new Post();
     $post->parent_id = $input['parent_id'] ? $input['parent_id'] : 0;
     $post->user_fp = $user_fp;
     $post->timestamp = $timestamp;
     if ($input['source_link']) {
         $post->source_link = $input['source_link'];
     }
     if ($input['title']) {
         $post->title = $input['title'];
     }
     if ($plaintext) {
         $post->clear_message = self::convertEmoji($plaintext);
         $post->message = $message;
     } else {
         $post->clear_message = "";
         $post->message = self::convertEmoji($message);
     }
     if (!isset($parent_post)) {
         if ($input['chan']) {
             $post->chan = $input['chan'];
         }
         if ($input['group_name']) {
             $post->group_name = $input['group_name'];
         }
     }
     $post->save();
     if (isset($parent_post)) {
         $parent_post->replies += 1;
         $parent_post->save();
     }
     return $post;
 }
示例#16
0
<?php

$this->breadcrumbs = array('Bản nhạc' => array('admin'), 'Quản lý');
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
?>

<h1>Quản lý bản nhạc</h1>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'song-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'title', array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=4'))), 'view', array('name' => 'ban_id', 'value' => 'GxHtml::valueEx($data->ban)', 'filter' => GxHtml::listDataEx(Ban::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
示例#17
0
 public function banlist()
 {
     $bl = Ban::where('user_fp', self::userFp())->lists('ban_fp');
     $users = User::whereIn('user_fp', $bl)->get();
     return View::make('user.banlist', ["users" => $users]);
 }
示例#18
0
	<div class="row">
		<?php 
echo $form->label($model, 'view');
?>
		<?php 
echo $form->textField($model, 'view');
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'ban_id');
?>
		<?php 
echo $form->dropDownList($model, 'ban_id', GxHtml::listDataEx(Ban::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'user_id');
?>
		<?php 
echo $form->dropDownList($model, 'user_id', GxHtml::listDataEx(XfUser::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'create_time');
示例#19
0
文件: acc.php 项目: FastLizard4/waca
            $type = "Name";
        } else {
            BootstrapSkin::displayAlertBox("Unknown ban type.", "alert-error");
            BootstrapSkin::displayInternalFooter();
            die;
        }
        if (count(Ban::getActiveBans($target))) {
            BootstrapSkin::displayAlertBox("This target is already banned!", "alert-error");
            BootstrapSkin::displayInternalFooter();
            die;
        }
        $smarty->assign("bantype", $type);
        $smarty->assign("bantarget", trim($target));
        $smarty->display("bans/banform.tpl");
    } else {
        $bans = Ban::getActiveBans();
        $smarty->assign("activebans", $bans);
        $smarty->display("bans/banlist.tpl");
    }
    BootstrapSkin::displayInternalFooter();
    die;
} elseif ($action == "defer" && $_GET['id'] != "" && $_GET['sum'] != "") {
    global $availableRequestStates;
    if (array_key_exists($_GET['target'], $availableRequestStates)) {
        $request = Request::getById($_GET['id'], gGetDb());
        if ($request == false) {
            BootstrapSkin::displayAlertBox("Could not find the specified request!", "alert-error", "Error!", true, false);
            BootstrapSkin::displayInternalFooter();
            die;
        }
        if ($request->getChecksum() != $_GET['sum']) {
示例#20
0
 public function actionBans()
 {
     if (isset($_GET['q']) && ($keyword = trim($_GET['q'])) !== '') {
         $tags = Ban::model()->suggestTags($keyword);
         if ($tags !== array()) {
             echo implode("\n", $tags);
         }
     }
 }
示例#21
0
文件: ban.php 项目: manelio/woolr
function del_ban($ban_id)
{
    $ban = new Ban();
    $ban->ban_id = $ban_id;
    $ban->remove();
}
示例#22
0
 public function viewPost($id)
 {
     $post = Post::getOne($id);
     $banned = Ban::isBanned($post->user_fp, self::userFp());
     return View::make('board.thread_view', ['op_post' => $post, 'banned' => $banned, 'replies' => Post::replies($post, self::getBL())]);
 }
示例#23
0
 }
 echo '>Add Ban</a></li>';
 echo '<li><a href="?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=edit-ban"';
 if ($_GET['do'] == 'edit-ban') {
     echo ' class="current"';
 }
 echo '>Edit Ban</a></li>';
 echo '<li><a href="?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=delete-ban"';
 if ($_GET['do'] == 'delete-ban') {
     echo ' class="current"';
 }
 echo '>Delete Ban</a></li>';
 echo '</ul>';
 echo '</div>
     <div style="float: right; width: 750px;">';
 $ban = new Ban();
 if ($_GET['do'] == 'add-ban' || empty($_GET['do'])) {
     echo '<p>On this page you can add someone to the banlist.</p>';
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         if (!empty($_POST['ban_ip']) && !empty($_POST['ban_reason'])) {
             if ($ban->addBan($_POST['ban_ip'], $_POST['ban_reason'])) {
                 if (strlen($_POST['ban_ip']) > 15) {
                     echo '<p class="notification red">The IP can not contain more than 15 characters (only IP4 support yet).</p>';
                 } else {
                     echo '<p class="notification green">You have successfully added a new ban.</p>';
                     $log->addLog($_SESSION['loggedIn']['id'], "Added a new ban.");
                     $hideform = true;
                 }
             } else {
                 echo '<p class="notification red">Something went wrong while adding the new ban. Please try again.</p>';
             }
示例#24
0
 public function add($reason = null, $host = null, $player_id = null, $expire = null)
 {
     $ban = new Ban($reason, $host, $player_id, $expire);
     $this->list[] = $ban;
     $this->observer->say('Ban #' . $ban->id . ' added : ' . $ban->reason . '(' . $ban->mask() . ')');
 }
示例#25
0
 /**
  * {@inheritdoc}
  */
 public function enter($form)
 {
     return \Ban::addBan($form->get('player')->getData()->getId(), $this->me->getId(), $this->getExpiration($form), $form->get('reason')->getData(), $form->get('server_message')->getData(), $form->get('ip_addresses')->getData(), $form->get('server_join_allowed')->getData());
 }
示例#26
0
function admin_bans($ban_type)
{
    global $db, $globals, $offset, $page_size, $ban_text_length, $ban_comment_length, $current_user;
    require_once mnminclude . 'ban.php';
    $key = get_security_key();
    if ($current_user->user_level == "god" && check_security_key($_REQUEST["key"])) {
        if (!empty($_REQUEST["new_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"]);
        } elseif (!empty($_REQUEST["edit_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"], $_POST["ban_id"]);
        } elseif (!empty($_REQUEST["new_bans"])) {
            $array = preg_split("/\\s+/", $_POST["ban_text"]);
            $size = count($array);
            for ($i = 0; $i < $size; $i++) {
                insert_ban($ban_type, $array[$i], $_POST["ban_comment"], $_POST["ban_expire"]);
            }
        } elseif (!empty($_REQUEST["del_ban"])) {
            del_ban($_REQUEST["del_ban"]);
        }
    }
    // ex container-wide
    echo '<div class="genericform" style="margin:0">';
    echo '<div style="float:right;">' . "\n";
    echo '<form method="get" action="' . $globals['base_url'] . 'admin/bans.php">';
    echo '<input type="hidden" name="admin" value="' . $ban_type . '" />';
    echo '<input type="hidden" name="key" value="' . $key . '" />';
    echo '<input type="text" name="s" ';
    if ($_REQUEST["s"]) {
        $_REQUEST["s"] = clean_text($_REQUEST["s"]);
        echo ' value="' . $_REQUEST["s"] . '" ';
    } else {
        echo ' value="' . _('buscar') . '..." ';
    }
    echo 'onblur="if(this.value==\'\') this.value=\'' . _('buscar') . '...\';" onfocus="if(this.value==\'' . _('buscar') . '...\') this.value=\'\';" />';
    echo '&nbsp;<input style="padding:2px;" type="image" align="top" value="' . _('buscar') . '" alt="' . _('buscar') . '" src="' . $globals['base_static'] . 'img/common/search-03.png" />';
    echo '</form>';
    echo '</div>';
    if ($current_user->user_level == "god") {
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=new">' . _('Nuevo ban') . '</a> ]';
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=news">' . _('Múltiples bans') . '</a> ]';
    }
    if (!empty($_REQUEST["op"])) {
        echo '<form method="post" name="newban" action="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '">';
        echo '<input type="hidden" name="key" value="' . $key . '" />';
    }
    echo '<table class="decorated" style="font-size: 10pt">';
    echo '<tr><th width="25%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_text">' . $ban_type . '</a></th>';
    echo '<th width="30%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_comment">' . _('comentario') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_date">' . _('fecha creación') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_expire">' . _('fecha caducidad') . '</a></th>';
    echo '<th>' . _('Editar / Borrar') . '</th></tr>';
    switch ($_REQUEST["op"]) {
        case 'new':
            echo '<tr><td>';
            echo '<input type="text" id="ban_text" name="ban_text" size="30" maxlength="' . $ban_text_length . '" value="" />';
            echo '&nbsp;<span id="checkit"><input type="button" id="checkbutton1" value="' . _('verificar') . '" onclick="checkfield(\'ban_' . $ban_type . '\', this.form, this.form.ban_text)"/></span>' . "\n";
            echo '<br /><span id="ban_' . $ban_type . 'checkitvalue"></span>' . "\n";
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_ban" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear ban') . '" />';
            echo '</td></tr>';
            break;
        case 'news':
            echo '<tr><td>';
            echo '<textarea id="ban_text" name="ban_text" /></textarea>';
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_bans" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear bans') . '" />';
            echo '</td></tr>';
            break;
        case 'edit':
            $ban = new Ban();
            $ban->ban_id = (int) $_REQUEST["id"];
            $ban->read();
            echo '<tr><td>';
            echo '<input type="text" name="ban_text" id="ban_text" size="30" maxlength="' . $ban_text_length . '" value="' . $ban->ban_text . '" />';
            echo '</td><td>';
            echo '<input type="text" class="form-full" name="ban_comment" id="ban_comment" value="' . $ban->ban_comment . '" />';
            echo '</td><td>';
            echo $ban->ban_date;
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            echo '<option value="' . $ban->ban_expire . '">' . $ban->ban_expire . '</option>';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="ban_id" value="' . $ban->ban_id . '" />';
            echo '<input type="submit" name="edit_ban" value="' . _('Editar ban') . '" />';
            echo '</td></tr>';
            break;
    }
    if (empty($_REQUEST["op"])) {
        //listado de bans
        if (empty($_REQUEST["orderby"])) {
            $_REQUEST["orderby"] = "ban_text";
        } else {
            $_REQUEST["orderby"] = preg_replace('/[^a-z_]/i', '', $_REQUEST["orderby"]);
            if ($_REQUEST["orderby"] == 'ban_date') {
                $order = "DESC";
            }
        }
        $where = "WHERE ban_type='" . $ban_type . "'";
        if ($_REQUEST["s"]) {
            $search_text = $db->escape($_REQUEST["s"]);
            $where .= " AND (ban_text LIKE '%{$search_text}%' OR ban_comment LIKE '%{$search_text}%')";
        }
        $bans = $db->get_col("SELECT ban_id FROM bans " . $where . " ORDER BY " . $_REQUEST["orderby"] . " {$order} LIMIT {$offset},{$page_size}");
        $rows = $db->get_var("SELECT count(*) FROM bans " . $where);
        if ($bans) {
            $ban = new Ban();
            foreach ($bans as $ban_id) {
                $ban->ban_id = $ban_id;
                $ban->read();
                echo '<tr>';
                echo '<td onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);" >' . clean_text($ban->ban_text) . '</td>';
                echo '<td style="overflow: hidden;white-space: nowrap;" onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);">' . clean_text(txt_shorter($ban->ban_comment, 50)) . '</td>';
                echo '<td>' . $ban->ban_date . '</td>';
                echo '<td>' . $ban->ban_expire . '</td>';
                echo '<td>';
                if ($current_user->user_level == "god") {
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=edit&amp;id=' . $ban->ban_id . '" title="' . _('Editar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-edit-notice01.png" alt="' . 'Editar' . '" /></a>';
                    echo '&nbsp;/&nbsp;';
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;del_ban=' . $ban->ban_id . '&amp;key=' . $key . '" title="' . _('Eliminar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-reject01.png" alt="' . 'Eliminar' . '" /></a>';
                }
                echo '</td>';
                echo '</tr>';
            }
        }
    }
    echo '</table>';
    if (!empty($_REQUEST["op"])) {
        echo "</form>\n";
    }
    do_pages($rows, $page_size, false);
}
示例#27
0
// David Martín :: Suki_ :: <david at sukiweb dot net>.
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// The code below was made by Beldar <beldar at gmail dot com>
if (!defined('mnmpath')) {
    include_once '../config.php';
    header('Content-Type: text/html; charset=utf-8');
}
//include_once(mnminclude.'user.php');
//include_once(mnminclude.'post.php');
stats_increment('ajax');
if (empty($_GET['id']) || $current_user->user_level != 'god' && $current_user->user_level != 'admin') {
    die;
}
$id = intval($_GET['id']);
require_once mnminclude . 'ban.php';
$ban = new Ban();
$ban->ban_id = $id;
if (!$ban->read()) {
    die;
}
echo '<strong>' . _($ban->ban_type) . ':</strong>&nbsp;' . $ban->ban_text . '<br/>';
if ($ban->ban_comment) {
    echo '<strong>' . _('Comentario') . ':</strong>&nbsp;' . $ban->ban_comment . '<br/>';
}
if ($ban->ban_expire) {
    echo '<strong>' . _('Expira') . ':</strong>&nbsp;' . $ban->ban_expire . '<br/>';
}
示例#28
0
文件: Player.php 项目: bchhun/bzion
 /**
  * Find out if a player is banned
  */
 public function isBanned()
 {
     return Ban::getBan($this->id) !== null;
 }
示例#29
0
$conversation->sendMessage($blast, "so I assume you're the correlative still always_ goes down history\"'s for anything");
$conversation->sendMessage($kierra, "I had a page. No addon, plugin to windows it...");
$conversation->sendMessage($allejo, "so I'm the world  (which was amazing :)");
$event = new ConversationKickEvent($conversation, $lweak, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$event = new ConversationKickEvent($conversation, $brad, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$conversation->sendMessage($autoreport, "she also going to essential command and to https://github Releases?\"  \"No!\"  \"STOP! IT!\"  \"*pbbbttt*\"  \"That's interesting I want help");
$conversation->sendMessage($autoreport, "I wonder 600KB) screenshot here. but how much I know all I was doing to debug, visual studio");
$conversation->sendMessage($autoreport, "and night night!");
echo " done!";
echo "\nAdding bans...";
Ban::addBan($snake->getId(), $alezakos->getId(), "2014-09-15", "Snarke 12534 has been barned again", "Cuz you're snake", "256.512.104.1");
Ban::addBan($allejo->getId(), $tw1sted->getId(), "2014-05-17", "for using 'dope'", "dope", array("127.0.2.1", "128.0.3.2"));
Ban::addBan($tw1sted->getId(), $alezakos->getId(), "2014-06-12", "tw1sted banned for being too awesome");
Ban::addBan($alezakos->getId(), $tw1sted->getId(), "2014-11-01", "alezakos banned for breaking the build", "For breaking the build", array("256.512.124.1", "256.512.124.3"));
echo " done!";
echo "\nAdding pages...";
Page::addPage("Rules", "<p>This is a test page.</p>\n<p>Let's hope this works!</p>", $tw1sted->getId());
Page::addPage("Contact", "<p>If you find anything wrong, please stop by irc.freenode.net channel #sujevo and let a developer know.<br /><br />Thanks", $tw1sted->getId());
echo " done!";
echo "\nAdding news categories...";
$announcements = NewsCategory::addCategory("Announcements");
$administration = NewsCategory::addCategory("Administration");
$events = NewsCategory::addCategory("Events");
$newFeatures = NewsCategory::addCategory("New Features");
echo " done!";
echo "\nAdding news entries...";
News::addNews("Announcement", "Very important Announcement", $kierra->getId(), $newFeatures->getId());
News::addNews("Cats think we are bigger cats", "In order for your indess recognizes where this whole mistake has come, and why one accuses the pleasure and praise the pain, and I will open to you all and set apart, what those founders of the truth and, as builders of the happy life himself has said about it. No one, he says, despise, or hate, or flee the desire as such, but because great pain to follow, if you do not pursue pleasure rationally. Similarly, the pain was loved as such by no one or pursues or desires, but because occasionally circumstances occur that one means of toil and pain can procure him some great pleasure to look verschaften be. To stay here are a trivial, so none of us would ever undertakes laborious physical exercise, except to obtain some advantage from it. But who is probably the blame, which requires an appetite, has no annoying consequences, or one who avoids a pain, which shows no desire? In contrast, blames and you hate with the law, which can soften and seduced by the allurements of present pleasure, without seeing in his blind desire which pain and inconvenience wait his reason. Same debt meet Those who from weakness, i.e to escape the work and the pain, neglect their duties. A person can easily and quickly make the real difference, to a quiet time where the choice of the decision is completely free and nothing prevents them from doing what we like best, you have to grasp every pleasure and every pain avoided, but to times it hits in succession of duties or guilty of factual necessity that you reject the desire and complaints must not reject. Why then the way will make a selection so that it Achieve a greater rejection by a desire for it or by taking over some pains to spare larger.", $alezakos->getId());
echo " done!";
示例#30
0
 /**
  * Summary of unbanned
  * @param Ban $ban
  * @param string $unbanreason
  */
 public static function unbanned(Ban $ban, $unbanreason)
 {
     self::send($ban->getTarget() . " unbanned by " . User::getCurrent()->getUsername() . " (" . $unbanreason . ")");
 }