public function onBeginRequest($event) { // Register controller Yii::app()->controllerMap['communityBans'] = $this->getPathAlias('controllers.CommunityBansController'); // Add permissions SourceBans::app()->permissions->add('BAN_COMMUNITY_FRIENDS', Yii::t('CommunityBansPlugin.main', 'Ban Community friends')); SourceBans::app()->permissions->add('BAN_COMMUNITY_GROUPS', Yii::t('CommunityBansPlugin.main', 'Ban Community groups')); }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->compare('t.type', $this->type, true); $criteria->compare('t.name', $this->name, true); $criteria->compare('t.flags', $this->flags, true); return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => SourceBans::app()->settings->items_per_page), 'sort' => array('defaultOrder' => array('type' => CSort::SORT_ASC, 'name' => CSort::SORT_ASC)))); }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->with = array('ban', 'server'); $criteria->compare('t.ban_id', $this->ban_id); $criteria->compare('t.name', $this->name, true); $criteria->compare('t.server_id', $this->server_id); $criteria->compare('t.create_time', $this->create_time); return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => SourceBans::app()->settings->items_per_page), 'sort' => array('defaultOrder' => array('create_time' => CSort::SORT_DESC)))); }
protected function _onAfterSave($event) { SourceBans::app()->trigger('games.saveGame', $event); }
/** * @return array validation rules for model attributes. */ public function rules() { return array(array('language, theme, timezone', 'default', 'setOnEmpty' => true, 'on' => 'settings'), array('new_email, confirm_email', 'required', 'on' => 'email'), array('new_email, confirm_email', 'email', 'on' => 'email'), array('confirm_email', 'compare', 'compareAttribute' => 'new_email', 'message' => Yii::t('yii', '{attribute} must be repeated exactly.', array('{attribute}' => '{compareAttribute}')), 'on' => 'email'), array('current_password, new_password, confirm_password', 'required', 'on' => 'password'), array('current_password, new_password, confirm_password', 'length', 'min' => SourceBans::app()->settings->password_min_length, 'on' => 'password'), array('current_password', 'validateCurrentPassword', 'message' => Yii::t('yii', '{attribute} is invalid.'), 'on' => 'password'), array('confirm_password', 'compare', 'compareAttribute' => 'new_password', 'message' => Yii::t('yii', '{attribute} must be repeated exactly.', array('{attribute}' => '{compareAttribute}')), 'on' => 'email'), array('new_server_password, confirm_server_password', 'required', 'on' => 'server_password'), array('new_server_password, confirm_server_password', 'length', 'min' => SourceBans::app()->settings->password_min_length, 'on' => 'server_password'), array('confirm_server_password', 'compare', 'compareAttribute' => 'new_server_password', 'message' => Yii::t('yii', '{attribute} must be repeated exactly.', array('{attribute}' => '{compareAttribute}')), 'on' => 'email')); }
echo $form->label($model, 'language', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'language', SourceBans::app()->languages); ?> </div> </div> <div class="control-group"> <?php echo $form->label($model, 'theme', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'theme', SourceBans::app()->themes); ?> </div> </div> <div class="control-group"> <?php echo $form->label($model, 'default_page', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'default_page', array('dashboard' => Yii::t('sourcebans', 'controllers.default.dashboard.title'), 'bans' => Yii::t('sourcebans', 'controllers.default.bans.title'), 'servers' => Yii::t('sourcebans', 'controllers.default.servers.title'), 'report' => Yii::t('sourcebans', 'controllers.default.report.title'), 'appeal' => Yii::t('sourcebans', 'controllers.default.appeal.title'))); ?> </div> </div>
protected function _onAfterSave($event) { SourceBans::app()->trigger('servers.saveServer', $event); }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->with = 'admin'; $criteria->compare('t.id', $this->id); $criteria->compare('t.type', $this->type); $criteria->compare('t.title', $this->title, true); $criteria->compare('t.message', $this->message, true); $criteria->compare('t.function', $this->function, true); $criteria->compare('t.query', $this->query, true); $criteria->compare('t.admin_id', $this->admin_id); $criteria->compare('t.admin_ip', $this->admin_ip, true); $criteria->compare('t.create_time', $this->create_time); return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => SourceBans::app()->settings->items_per_page), 'sort' => array('defaultOrder' => array('create_time' => CSort::SORT_DESC)))); }
protected function _onAfterSave($event) { SourceBans::app()->trigger('groups.saveWebGroup', $event); }
/** * Raised right AFTER the application processes the request. * @param CEvent $event the event parameter */ public static function onEndRequest($event) { SourceBans::app()->trigger('app.endRequest', $event); }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { $defaultAction = 'action' . ucfirst(SourceBans::app()->settings->default_page); $this->{$defaultAction}(); }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search($criteria = array()) { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria($criteria); $criteria->compare('t.id', $this->id); $criteria->compare('t.name', $this->name, true); $criteria->compare('t.steam', $this->steam, true); $criteria->compare('t.ip', $this->ip, true); $criteria->compare('t.reason', $this->reason, true); $criteria->compare('t.server_id', $this->server_id); $criteria->compare('t.user_name', $this->user_name, true); $criteria->compare('t.user_email', $this->user_email, true); $criteria->compare('t.user_ip', $this->user_ip, true); $criteria->compare('t.archived', $this->archived); $criteria->compare('t.create_time', $this->create_time); return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => SourceBans::app()->settings->items_per_page), 'sort' => array('defaultOrder' => array('create_time' => CSort::SORT_DESC)))); }
echo $form->label($model, 'language', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'language', SourceBans::app()->languages, array('empty' => '- ' . Yii::t('sourcebans', 'Default setting') . ' -')); ?> </div> </div> <div class="control-group"> <?php echo $form->label($model, 'theme', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'theme', SourceBans::app()->themes, array('empty' => '- ' . Yii::t('sourcebans', 'Default setting') . ' -')); ?> </div> </div> <div class="control-group"> <?php echo $form->label($model, 'timezone', array('class' => 'control-label')); ?> <div class="controls"> <?php echo $form->dropDownList($model, 'timezone', LocaleData::getTimezones(), array('class' => 'span6', 'empty' => '- ' . Yii::t('sourcebans', 'Default setting') . ' -')); ?> </div> </div>
<tr> <th><?php echo $ban->getAttributeLabel('length'); ?> </th> <td><%=header.data("length") %></td> </tr> <tr> <th><?php echo $ban->getAttributeLabel('reason'); ?> </th> <td><%=header.data("reason") || nullDisplay %></td> </tr> <?php if (!(Yii::app()->user->isGuest && SourceBans::app()->settings->bans_hide_admin)) { ?> <tr> <th><?php echo $ban->getAttributeLabel('admin.name'); ?> </th> <td><%=header.data("adminName") %></td> </tr> <?php } ?> <% if(header.data("serverId")) { %> <tr> <th><?php echo $ban->getAttributeLabel('server_id');
/** * This method is invoked after the specified is rendered by calling {@link CController::render()}. * Note that this method is invoked BEFORE {@link CController::processOutput()}. * You may override this method to do some postprocessing for the view rendering. * @param string $view the view that has been rendered * @param string $output the rendering result of the view. Note that this parameter is passed * as a reference. That means you can modify it within this method. */ protected function afterRender($view, &$output) { SourceBans::app()->trigger('app.afterRender', new CEvent($this, array('view' => $view, 'output' => &$output))); parent::afterRender($view, $output); }
protected function _onAfterSave($event) { SourceBans::app()->trigger('admins.saveAdmin', $event); }
/* @var $total_blocks integer */ ?> <div class="row"> <section class="span12 intro"> <?php if (!empty(SourceBans::app()->settings->dashboard_title)) { ?> <h3><?php echo CHtml::encode(SourceBans::app()->settings->dashboard_title); ?> </h3> <?php } ?> <?php echo SourceBans::app()->settings->dashboard_text; ?> </section> </div> <?php $this->renderPartial('servers', array('isDashboard' => true, 'servers' => $servers)); ?> <div class="row"> <section class="bans span6"> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'bans-grid', 'dataProvider' => $bans, 'columns' => array(array('header' => Yii::t('sourcebans', 'Game'), 'headerHtmlOptions' => array('class' => 'icon'), 'htmlOptions' => array('class' => 'icon'), 'name' => 'server.game.name', 'type' => 'html', 'value' => 'CHtml::image(Yii::app()->baseUrl . "/images/games/" . (isset($data->server) ? $data->server->game->icon : "web.png"), isset($data->server) ? $data->server->game->name : "SourceBans")'), array('headerHtmlOptions' => array('class' => 'datetime'), 'htmlOptions' => array('class' => 'datetime'), 'name' => 'create_time', 'type' => 'datetime'), 'name', array('headerHtmlOptions' => array('class' => 'length'), 'htmlOptions' => array('class' => 'length'), 'name' => 'length', 'value' => '$data->isPermanent ? Yii::t("sourcebans", "Permanent") : Yii::app()->format->formatLength($data->length*60)')), 'cssFile' => false, 'enablePagination' => false, 'enableSorting' => false, 'itemsCssClass' => 'items table table-condensed table-hover', 'nullDisplay' => CHtml::tag('span', array('class' => 'null'), Yii::t('zii', 'Not set')), 'rowHtmlOptionsExpression' => 'array( "class"=>($data->isExpired ? "expired" : ($data->isUnbanned ? "unbanned" : "")), "data-key"=>$data->primaryKey, )', 'selectionChanged' => 'js:function(grid) {
<?php echo $form->numberField($model, 'immunity'); ?> <?php echo $form->error($model, 'immunity'); ?> </div> </div> <div class="flags control-group"> <?php echo $form->label($model, 'flags', array('class' => 'control-label')); ?> <div class="controls"> <?php foreach (SourceBans::app()->flags as $flag => $description) { ?> <?php $checkbox = CHtml::checkBox('SBServerGroup[flags][' . $flag . ']', strpos($model->flags, $flag) !== false, array('value' => $flag)) . $description; ?> <?php echo CHtml::label($checkbox, 'SBServerGroup_flags_' . $flag, array('class' => 'checkbox')); } ?> <?php echo CHtml::hiddenField('SBServerGroup[flags]'); ?> <?php echo $form->error($model, 'flags'); ?> </div>
<a href="http://sourcebans.net" target="_blank"><img alt="SourceBans" src="<?php echo Yii::app()->theme->baseUrl; ?> /images/logo_footer.png" /></a> <br /><strong><?php echo Yii::t('sourcebans', 'Version'); ?> <?php echo SourceBans::getVersion(); ?> </strong> <br />"<?php echo SourceBans::app()->quote->text; ?> " - <em><?php echo SourceBans::app()->quote->name; ?> </em> </p> <?php if (YII_DEBUG) { ?> <p><em><?php echo Yii::app()->db->stats[0]; ?> database queries performed in <?php echo number_format(Yii::getLogger()->executionTime, 2); ?> seconds.</em></p> <?php }
echo $form->textField($model, 'name', array('size' => 32, 'maxlength' => 32)); ?> <?php echo $form->error($model, 'name'); ?> </div> </div> <div class="permissions control-group"> <?php echo $form->label($model, 'permissions', array('class' => 'control-label')); ?> <div class="controls"> <?php $permissions = CHtml::listData($model->permissions, 'name', 'name'); foreach (SourceBans::app()->permissions as $name => $description) { ?> <?php $checkbox = CHtml::checkBox('SBGroup[permissions][' . $name . ']', in_array($name, $permissions), array('value' => $name)) . $description; ?> <?php echo CHtml::label($checkbox, 'SBGroup_permissions_' . $name, array('class' => 'checkbox')); } ?> <?php echo $form->error($model, 'permissions'); ?> </div> </div> <div class="control-group buttons">
<% for(var permission in permissions) { %> <% if(permission != "OWNER" && (header.data("permissions").indexOf("OWNER") != -1 || header.data("permissions").indexOf(permission) != -1)) { %> <li><%=permissions[permission] %></li> <% } %> <% } %> </ul> <% } else { %> <p><%=nullDisplay %></p> <% } %> </div> </script> <?php Yii::app()->clientScript->registerScript('admin_admins_createSections', ' var flags = ' . CJavaScript::encode(SourceBans::app()->flags->toArray()) . ', permissions = ' . CJavaScript::encode(SourceBans::app()->permissions->toArray()) . '; function createSections() { var nullDisplay = "' . addslashes($grid->nullDisplay) . '"; $("#admins-grid tr[data-key]").each(function(i, header) { $section = $("<tr class=\\"section\\"><td colspan=\\"" + header.cells.length + "\\"><div></div></td></tr>").insertAfter($(header)); $section.find("div").html($("#admins-section").template({ header: $(header), nullDisplay: nullDisplay })); $section.find("a").each(function() { this.href = this.href.replace("__ID__", $(header).data("key")); }); });