Пример #1
0
 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'));
 }
Пример #2
0
 /**
  * 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))));
 }
Пример #3
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $model = $this->loadModel($id);
     SourceBans::log('Game deleted', 'Game "' . $model . '" was deleted', SBLog::TYPE_WARNING);
     $model->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
Пример #4
0
 /**
  * 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))));
 }
Пример #5
0
 public function actionUninstall($id)
 {
     $plugin = $this->loadModel($id);
     try {
         $plugin->runUninstall();
         $plugin->status = 0;
         $plugin->save();
         SourceBans::log('Plugin uninstalled', 'Plugin "' . $plugin . '" was uninstalled', SBLog::TYPE_WARNING);
     } catch (Exception $e) {
         Yii::app()->end(CJSON::encode(array('error' => array('code' => $e->getCode(), 'message' => $e->getMessage()))));
     }
     Yii::app()->end(CJSON::encode(true));
 }
Пример #6
0
 protected function _onAfterSave($event)
 {
     SourceBans::app()->trigger('servers.saveServer', $event);
 }
Пример #7
0
 /**
  * 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))));
 }
Пример #8
0
 /**
  * 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);
 }
Пример #9
0
 protected function _onAfterSave($event)
 {
     SourceBans::app()->trigger('admins.saveAdmin', $event);
 }
Пример #10
0
 /**
  * @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'));
 }
Пример #11
0
 /**
  * Displays the appeal ban page
  */
 public function actionAppeal()
 {
     $this->pageTitle = Yii::t('sourcebans', 'controllers.default.appeal.title');
     $this->breadcrumbs = array(Yii::t('sourcebans', 'controllers.default.appeal.title'));
     $model = new SBAppeal();
     $model->ban_steam = 'STEAM_';
     $model->ban_ip = Yii::app()->request->userHostAddress;
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'appeal-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['SBAppeal'])) {
         $model->attributes = $_POST['SBAppeal'];
         if ($model->save()) {
             SourceBans::log('Appeal added', 'Ban against "' . $model->user_email . '" was appealed');
             Yii::app()->user->setFlash('success', Yii::t('sourcebans', 'Saved successfully'));
             $this->refresh();
         }
     }
     $this->render('appeal', array('model' => $model));
 }
Пример #12
0
 public function actionVersion()
 {
     $version = @file_get_contents('http://www.sourcebans.net/public/versionchecker/?type=rel');
     if (empty($version) || strlen($version) > 8) {
         Yii::app()->end(CJSON::encode(array('error' => Yii::t('sourcebans', 'controllers.admin.version.error'))));
     }
     Yii::app()->end(CJSON::encode(array('version' => $version, 'update' => version_compare($version, SourceBans::getVersion()) > 0)));
 }
Пример #13
0
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>
Пример #14
0
 public function actionImport()
 {
     $file = $_FILES['file'];
     $kv = new KeyValues('Groups');
     $kv->load($file['tmp_name']);
     foreach ($kv as $name => $data) {
         $server_group = new SBServerGroup();
         $server_group->name = $name;
         $server_group->flags = isset($data['flags']) ? $data['flags'] : '';
         $server_group->immunity = isset($data['immunity']) ? $data['immunity'] : 0;
         $server_group->save();
         if (isset($data['Overrides'])) {
             foreach ($data['Overrides'] as $name => $access) {
                 // Parse name
                 if ($name[0] == ':') {
                     $type = 'group';
                     $name = substr($name, 1);
                 } else {
                     $type = 'command';
                 }
                 $override = new SBServerGroupOverride();
                 $override->group_id = $server_group->id;
                 $override->type = $type;
                 $override->name = $name;
                 $override->access = $access;
                 $override->save();
             }
         }
     }
     SourceBans::log('Groups imported', 'Groups imported from ' . $file['name']);
     Yii::app()->user->setFlash('success', Yii::t('sourcebans', 'Imported successfully'));
     $this->redirect(array('admin/groups'));
 }
Пример #15
0
      <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');
Пример #16
0
 /**
  * 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);
 }
Пример #17
0
 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     $this->appOptions = array('fileTypes' => array('php'), 'exclude' => array('.svn', '/yiic.php', '/commands/docs', '/commands/DocsCommand', '/config', '/controllers', '/data', '/extensions', '/messages', '/migrations', '/modules', '/plugins', '/tests', '/vendors', '/views'));
     $this->yiiOptions = array('fileTypes' => array('php'), 'exclude' => array('.svn', '/yiilite.php', '/yiit.php', '/cli', '/i18n/data', '/messages', '/vendors', '/views', '/web/js', '/web/widgets/views', '/utils/mimeTypes.php', '/gii/assets', '/gii/components', '/gii/controllers', '/gii/generators', '/gii/models', '/gii/views', '/test'));
     if (!isset($args[0])) {
         $this->usageError('the output directory is not specified.');
     }
     if ($args[0] == 'check') {
         $checkFiles = CFileHelper::findFiles(BUILD_PATH, $this->appOptions);
         $model = new DocsModel();
         $model->check($checkFiles);
         exit;
     }
     if (!is_dir($docPath = $args[0])) {
         $this->usageError("the output directory {$docPath} does not exist.");
     }
     if (isset($args[1]) && $args[1] == "noviews") {
         $this->enableViews = false;
     }
     $offline = true;
     if (isset($args[1]) && $args[1] === 'online') {
         $offline = false;
     }
     $this->version = SourceBans::getVersion();
     /*
      * development version - link to trunk
      * release version link to tags
      */
     if (substr($this->version, -3) == 'dev') {
         $this->baseSourceUrl .= '/master/web/application';
     } else {
         $this->baseSourceUrl .= '/' . $this->version . '/web/application';
     }
     if (substr(Yii::getVersion(), -3) == 'dev') {
         $this->frameworkSourceUrl .= '/master/framework';
     } else {
         $this->frameworkSourceUrl .= '/' . Yii::getVersion() . '/framework';
     }
     $this->pageTitle = 'API « ' . Yii::app()->name;
     $themePath = dirname(__FILE__) . '/docs';
     echo "\nBuilding.. : " . Yii::app()->name . "\n";
     echo "Type...... : " . ($offline ? "offline" : "online") . "\n";
     echo "Version... : " . $this->version . " (using Yii " . Yii::getVersion() . ")\n";
     echo "Source URL : " . $this->baseSourceUrl . "\n\n";
     echo "Building model...\n";
     $model = $this->buildModel(BUILD_PATH);
     $this->classes = $model->classes;
     $this->packages = $model->packages;
     $this->views = $model->views;
     echo "Building pages...\n";
     if ($offline) {
         $this->buildOfflinePages($docPath . DIRECTORY_SEPARATOR . 'api', $themePath);
     } else {
         $this->buildOnlinePages($docPath . DIRECTORY_SEPARATOR . 'api', $themePath);
         $this->buildKeywords($docPath);
         $this->buildPackages($docPath);
     }
     echo "Done.\n\n";
 }
Пример #18
0
 public function actionImport()
 {
     $file = $_FILES['file'];
     switch ($file['name']) {
         // Source Dedicated Server
         case 'banned_ip.cfg':
         case 'banned_user.cfg':
             foreach (file($file['tmp_name']) as $line) {
                 list(, $length, $identity) = explode(' ', rtrim($line));
                 // If this is not a permanent ban, ignore
                 if ($length) {
                     continue;
                 }
                 // Steam ID
                 if (preg_match(SourceBans::PATTERN_STEAM, $identity)) {
                     $ban = new SBBan();
                     $ban->type = SBBan::TYPE_STEAM;
                     $ban->steam = $identity;
                     $ban->reason = 'Imported from banned_user.cfg';
                     $ban->length = 0;
                     $ban->save();
                 } else {
                     if (preg_match(SourceBans::PATTERN_IP, $identity)) {
                         $ban = new SBBan();
                         $ban->type = SBBan::TYPE_IP;
                         $ban->ip = $identity;
                         $ban->reason = 'Imported from banned_ip.cfg';
                         $ban->length = 0;
                         $ban->save();
                     }
                 }
             }
             break;
             // ESEA Ban List
         // ESEA Ban List
         case 'esea_ban_list.csv':
             $handle = fopen($file['tmp_name'], 'r');
             while (list($steam, $name) = fgetcsv($handle, 4096)) {
                 $steam = 'STEAM_' . trim($steam);
                 if (!preg_match(SourceBans::PATTERN_STEAM, $steam)) {
                     continue;
                 }
                 $ban = new SBBan();
                 $ban->type = SBBan::TYPE_STEAM;
                 $ban->steam = $steam;
                 $ban->name = $name;
                 $ban->reason = 'Imported from esea_ban_list.csv';
                 $ban->length = 0;
                 $ban->save();
             }
             fclose($handle);
             break;
         default:
             throw new CHttpException(500, Yii::t('sourcebans', 'controllers.bans.import.error'));
     }
     SourceBans::log('Bans imported', 'Bans imported from ' . $file['name']);
     Yii::app()->user->setFlash('success', Yii::t('sourcebans', 'Imported successfully'));
     $this->redirect(array('default/bans'));
 }
Пример #19
0
 public function actionImport()
 {
     $file = $_FILES['file'];
     switch ($file['name']) {
         // SourceMod
         case 'admins.cfg':
         case 'admins_simple.ini':
             $server_groups = CHtml::listData(SBServerGroup::model()->findAll(), 'name', 'id');
             // Detailed
             if ($file['name'] == 'admins.cfg') {
                 $kv = new KeyValues('Admins');
                 $kv->load($file['tmp_name']);
                 foreach ($kv as $name => $data) {
                     $admin = new SBAdmin();
                     $admin->name = $name;
                     $admin->auth = $data['auth'];
                     $admin->identity = $data['identity'];
                     if (isset($data['password'])) {
                         $admin->new_password = $data['password'];
                         $admin->server_password = $data['password'];
                     }
                     if (isset($data['group'])) {
                         $admin->server_groups = array();
                         foreach ((array) $data['group'] as $group) {
                             $admin->server_groups = array_merge($admin->server_groups, array($server_groups[$group]));
                         }
                     }
                     $admin->save();
                 }
             } else {
                 preg_match_all('/"(.+?)"[ \\t]*"(.+?)"([ \\t]*"(.+?)")?/', file_get_contents($file['tmp_name']), $admins);
                 for ($i = 0; $i < count($admins[0]); $i++) {
                     list($identity, $flags, $password) = array($admins[1][$i], $admins[2][$i], $admins[4][$i]);
                     // Parse authentication type depending on identity
                     if (preg_match(SourceBans::PATTERN_STEAM, $identity)) {
                         $auth = SBAdmin::AUTH_STEAM;
                     } else {
                         if ($identity[0] == '!' && preg_match(SourceBans::PATTERN_IP, $identity)) {
                             $auth = SBAdmin::AUTH_IP;
                         } else {
                             $auth = SBAdmin::AUTH_NAME;
                         }
                     }
                     // Parse flags
                     if ($flags[0] == '@') {
                         $group = substr($flags, 1);
                     } else {
                         if (strpos($flags, ':') !== false) {
                             list($immunity, $flags) = explode(':', $flags);
                         }
                     }
                     $admin = new SBAdmin();
                     $admin->name = $identity;
                     $admin->auth = $auth;
                     $admin->identity = $identity;
                     if (!empty($password)) {
                         $admin->new_password = $password;
                         $admin->server_password = $password;
                     }
                     if (isset($group)) {
                         $admin->server_groups = array($server_groups[$group]);
                     }
                     $admin->save();
                 }
             }
             break;
             // Mani Admin Plugin
         // Mani Admin Plugin
         case 'clients.txt':
             $kv = new KeyValues();
             $kv->load($file['tmp_name']);
             foreach ($kv['players'] as $name => $player) {
                 $admin = new SBAdmin();
                 $admin->auth = SBAdmin::AUTH_STEAM;
                 $admin->name = $name;
                 $admin->identity = $player['steam'];
                 $admin->save();
             }
             break;
         default:
             throw new CHttpException(500, Yii::t('sourcebans', 'controllers.admins.import.error'));
     }
     SourceBans::log('Admins imported', 'Admins imported from ' . $file['name']);
     Yii::app()->user->setFlash('success', Yii::t('sourcebans', 'Imported successfully'));
     $this->redirect(array('admin/admins'));
 }
Пример #20
0
 /**
  * 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))));
 }
Пример #21
0
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>
Пример #22
0
 protected function _onAfterSave($event)
 {
     SourceBans::app()->trigger('groups.saveWebGroup', $event);
 }
Пример #23
0
 protected function _onAfterSave($event)
 {
     SourceBans::app()->trigger('games.saveGame', $event);
 }
Пример #24
0
/* @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) {
Пример #25
0
      <?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>
Пример #26
0
          <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 
}
Пример #27
0
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">
Пример #28
0
<% 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"));
      });
    });