コード例 #1
0
 public function actionTransfer()
 {
     $model = new Domain();
     $model->scenario = 'transfer';
     $transferDataProvider = null;
     if (Yii::$app->request->isPost) {
         $post = Yii::$app->request->post($model->formName(), []);
         if (!empty($post[0]['domains'])) {
             $domains = [];
             foreach (StringHelper::explode($post[0]['domains'], "\n") as $line) {
                 preg_match('/^([a-z0-9][0-9a-z.-]+)(?:[,;\\s]+)(.*)/i', $line, $matches);
                 if ($matches) {
                     $domain = strtolower($matches[1]);
                     $password = $matches[2];
                     $domains[] = compact('domain', 'password');
                 }
             }
             $post = $domains;
         }
         $collection = (new Collection(['model' => $model]))->load($post);
         $models = $collection->getModels();
         foreach ($models as $model) {
             try {
                 Domain::perform('CheckTransfer', $model->getAttributes(['domain', 'password']));
             } catch (ErrorResponseException $e) {
                 $model->addError('password', $e->getMessage());
             }
         }
         Yii::$app->session->setFlash('transferGrid', 1);
         $transferDataProvider = new ArrayDataProvider(['models' => $models]);
     }
     return $this->render('index', ['model' => $model, 'transferDataProvider' => $transferDataProvider]);
 }
コード例 #2
0
ファイル: Part.php プロジェクト: hiqdev/hipanel-module-stock
 public function transformToSymbols($currencyCodes = [])
 {
     $result = [];
     foreach ($currencyCodes as $code) {
         $result[] = StringHelper::getCurrencySymbol($code);
     }
     return $result;
 }
コード例 #3
0
ファイル: Host.php プロジェクト: hiqdev/hipanel-module-domain
 /** {@inheritdoc} */
 public function rules()
 {
     return [[['host'], 'safe'], [['id'], 'safe'], [['id'], 'integer', 'on' => 'delete'], [['seller_id', 'client_id', 'domain_id'], 'safe'], [['seller', 'client'], 'safe'], [['domain', 'host'], 'safe'], [['ip'], 'safe'], [['ips'], 'safe'], [['host', 'ips'], 'required', 'on' => 'create'], [['host'], DomainValidator::class], [['ips'], 'filter', 'filter' => function ($value) {
         if (!is_array($value)) {
             return mb_strlen($value) > 0 ? StringHelper::mexplode($value) : true;
         } else {
             return $value;
         }
     }, 'on' => ['create', 'update']], [['ips'], 'each', 'rule' => ['ip'], 'on' => ['create', 'update']]];
 }
コード例 #4
0
ファイル: Ns.php プロジェクト: hiqdev/hipanel-module-domain
 public function rules()
 {
     return [[['name', 'domain_name'], 'filter', 'filter' => 'trim'], [['name'], FqdnValueValidator::className()], [['ip'], 'filter', 'filter' => function ($value) {
         return StringHelper::explode($value, ',', true, true);
     }, 'skipOnArray' => true], [['ip'], 'each', 'rule' => ['ip']], [['ip'], function ($attribute, $params) {
         if (!StringHelper::endsWith($this->name, $this->domain_name)) {
             $this->addError($attribute, Yii::t('hipanel:domain', 'To assign the IP, NS must be a child from main domain'));
         }
     }]];
 }
コード例 #5
0
 /** {@inheritdoc} */
 public function rules()
 {
     return [[['id', 'zone_id', 'seller_id', 'client_id', 'remoteid', 'daysleft', 'prem_daysleft'], 'integer'], [['domain', 'statuses', 'name', 'zone', 'state', 'lastop', 'state_label'], 'safe'], [['seller', 'seller_name', 'client', 'client_name'], 'safe'], [['created_date', 'updated_date', 'transfer_date', 'expiration_date', 'expires', 'since', 'prem_expires'], 'date'], [['registered', 'operated'], 'date'], [['is_expired', 'is_served', 'is_holded', 'is_premium', 'is_secured', 'is_freezed', 'wp_freezed'], 'boolean'], [['premium_autorenewal', 'expires_soon', 'autorenewal', 'whois_protected'], 'boolean'], [['foa_sent_to'], 'email'], [['url_fwval', 'mailval', 'parkval', 'soa', 'dns', 'counters'], 'safe'], [['block', 'epp_client_id', 'nameservers', 'nsips'], 'safe'], [['note'], 'safe', 'on' => ['set-note', 'default']], [['enable'], 'safe', 'on' => ['set-lock', 'set-whois-protect']], [['domain', 'autorenewal'], 'safe', 'on' => 'set-autorenewal'], [['domain', 'whois_protected'], 'safe', 'on' => 'set-whois-protect'], [['domain', 'is_secured'], 'safe', 'on' => 'set-lock'], [['domain'], 'safe', 'on' => ['sync', 'only-object']], [['id'], 'required', 'on' => ['enable-freeze', 'disable-freeze', 'sync', 'regen-password', 'set-note', 'set-autorenewal', 'set-whois-protect', 'set-lock', 'push-with-pincode', 'enable-hold', 'disable-hold', 'enable-w-p-freeze', 'disable-w-p-freeze']], [['domain'], DomainPartValidator::className(), 'message' => Yii::t('hipanel:domain', '\'{value}\' is not valid domain name'), 'on' => ['check-domain']], [['domain'], 'filter', 'filter' => function ($value) {
         if (strpos($value, '.') !== false) {
             return substr($value, 0, strpos($value, '.'));
         } else {
             return $value;
         }
     }, 'on' => 'check-domain'], [['domain'], 'required', 'on' => ['check-domain']], [['zone'], 'safe', 'on' => ['check-domain']], [['zone'], 'trim', 'on' => ['check-domain']], [['zone'], 'default', 'value' => static::DEFAULT_ZONE, 'on' => ['check-domain']], [['is_available'], 'boolean', 'on' => ['check-domain']], [['resource'], 'safe', 'on' => ['check-domain']], [['domain', 'password'], 'required', 'when' => function ($model) {
         return empty($model->domains);
     }, 'on' => ['transfer']], [['domains'], 'required', 'when' => function ($model) {
         return empty($model->domain) && empty($model->password);
     }, 'on' => ['transfer']], [['domain'], DomainValidator::class, 'on' => ['transfer']], [['domain', 'password'], 'trim', 'on' => ['transfer']], [['domain', 'nameservers', 'nsips'], 'safe', 'on' => 'set-nss'], [['nameservers', 'nsips'], 'filter', 'filter' => function ($value) {
         return !is_array($value) ? StringHelper::mexplode($value) : $value;
     }, 'on' => 'OLD-set-ns'], [['nameservers'], 'each', 'rule' => [DomainValidator::class], 'on' => 'OLD-set-ns'], [['nsips'], 'each', 'rule' => [NsValidator::class], 'on' => 'OLD-set-ns'], [['dumb'], 'safe', 'on' => ['get-zones']], [['receiver'], 'required', 'on' => ['push', 'push-with-pincode']], [['pincode'], 'required', 'on' => ['push-with-pincode']], [['pincode'], function ($attribute, $params) {
         try {
             $response = Client::perform('CheckPincode', [$attribute => $this->{$attribute}, 'id' => Yii::$app->user->id]);
         } catch (Exception $e) {
             $this->addError($attribute, Yii::t('hipanel:client', 'Wrong pincode'));
         }
     }, 'on' => ['push-with-pincode']], [['domain', 'sender', 'pincode'], 'safe', 'on' => ['push', 'push-with-pincode']], [['id', 'domain'], 'safe', 'on' => ['bulk-set-contacts']]];
 }
コード例 #6
0
 public function rules()
 {
     return [[['id', 'seller_id', 'state_id', 'type_id', 'tariff_id', 'profile_id'], 'integer'], [['login', 'seller', 'state', 'type', 'tariff', 'profile'], 'safe'], [['state_label', 'type_label'], 'safe'], [['balance', 'credit'], 'number'], [['count', 'confirm_url', 'language', 'comment', 'name', 'currency'], 'safe'], [['create_time', 'update_time'], 'date'], [['id', 'note'], 'safe', 'on' => 'set-note'], [['id', 'credit'], 'required', 'on' => 'set-credit'], [['id', 'type', 'comment'], 'required', 'on' => ['set-block', 'enable-block']], [['id'], 'required', 'on' => ['disable-block']], [['comment'], 'safe', 'on' => ['disable-block']], [['id', 'language'], 'required', 'on' => 'set-language'], [['id', 'seller_id'], 'required', 'on' => 'set-seller'], [['password', 'login', 'seller_id', 'email'], 'required', 'on' => ['create', 'update']], [['type'], 'required', 'on' => ['create', 'update']], [['type'], 'default', 'value' => self::TYPE_CLIENT, 'on' => ['create', 'update']], [['type'], 'in', 'range' => array_keys(self::getTypeOptions()), 'on' => ['create', 'update']], [['email'], 'email', 'on' => ['create', 'update']], [['login'], 'match', 'pattern' => '/^[a-z][a-z0-9_]{2,31}$/', 'message' => Yii::t('hipanel:client', 'Field "{attribute}" can contain Latin characters written in lower case, and it may contain numbers and underscores'), 'on' => ['create', 'update']], [['login', 'email'], 'unique', 'on' => ['create', 'update']], [['ticket_emails'], 'string', 'max' => 128, 'on' => 'ticket-settings'], [['ticket_emails'], 'email', 'on' => 'ticket-settings'], [['send_message_text', 'new_messages_first'], 'boolean', 'on' => 'ticket-settings'], [['nss'], 'filter', 'filter' => function ($value) {
         return mb_strlen($value) > 0 ? StringHelper::mexplode($value) : [];
     }, 'on' => 'domain-settings'], [['nss'], 'each', 'rule' => [DomainValidator::class], 'on' => 'domain-settings'], [['autorenewal', 'whois_protected'], 'boolean', 'on' => 'domain-settings'], [['registrant', 'admin', 'tech', 'billing'], 'safe', 'on' => 'domain-settings'], [['notify_important_actions', 'domain_registration', 'newsletters', 'commercial'], 'boolean', 'on' => ['mailing-settings']], [['allowed_ips', 'sshftp_ips'], 'filter', 'filter' => function ($value) {
         if (!is_array($value)) {
             return mb_strlen($value) > 0 ? StringHelper::mexplode($value) : true;
         } else {
             return $value;
         }
     }, 'skipOnEmpty' => true, 'on' => ['ip-restrictions']], [['allowed_ips', 'sshftp_ips'], 'each', 'rule' => ['ip'], 'on' => ['ip-restrictions']], [['login', 'old_password', 'new_password', 'confirm_password'], 'required', 'on' => ['change-password']], [['old_password'], function ($attribute, $params) {
         $response = $this->perform('CheckPassword', ['password' => $this->{$attribute}, 'login' => $this->login]);
         if (!$response['matches']) {
             $this->addError($attribute, Yii::t('hipanel:client', 'The password is incorrect'));
         }
     }, 'on' => ['change-password']], [['confirm_password'], 'compare', 'compareAttribute' => 'new_password', 'enableClientValidation' => false, 'on' => ['change-password']], [['id'], 'integer', 'on' => 'delete'], [['id'], 'integer', 'on' => 'set-tmp-password'], [['enable', 'disable', 'pincode_enabled'], 'boolean', 'on' => ['pincode-settings']], [['question', 'answer'], 'string', 'on' => ['pincode-settings']], [['pincode'], 'string', 'min' => 4, 'max' => 4], [['pincode', 'answer', 'question'], 'required', 'enableClientValidation' => false, 'when' => function ($model) {
         return $model->pincode_enabled === false;
     }, 'on' => ['pincode-settings']], [['pincode'], 'required', 'when' => function ($model) {
         return empty($model->answer) && $model->pincode_enabled ? true : false;
     }, 'enableClientValidation' => false, 'message' => Yii::t('hipanel:client', 'Fill the Pincode or answer to the question.'), 'on' => ['pincode-settings']], [['answer'], 'required', 'when' => function ($model) {
         return empty($model->pincode) && $model->pincode_enabled ? true : false;
     }, 'enableClientValidation' => false, 'message' => Yii::t('hipanel:client', 'Fill the Answer or enter the Pincode.'), 'on' => ['pincode-settings']]];
 }
コード例 #7
0
    <div class="input-group-btn">
        <button type="button" class="btn btn-default iwd-label dropdown-toggle" data-toggle="dropdown">
            <?php 
echo StringHelper::getCurrencySymbol(Html::getAttributeValue($model, $currencyAttributeName));
?>
        </button>
        <button type=button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
            <span class="caret"></span> <span class="sr-only"><?php 
echo Yii::t('hipanel', 'Toggle dropdown');
?>
</span>
        </button>
        <ul class="dropdown-menu">
            <?php 
foreach (ArrayHelper::remove($currencyAttributeOptions, 'items', []) as $k => $v) {
    ?>
                <li>
                    <?php 
    echo Html::a(StringHelper::getCurrencySymbol($k), '#', ['data-value' => $k, 'data-label' => StringHelper::getCurrencySymbol($k)]);
    ?>
                </li>
            <?php 
}
?>
        </ul>
    </div>
    <?php 
echo Html::activeInput('text', $model, $attribute, ['class' => 'form-control']);
?>
</div>
コード例 #8
0
ファイル: ns.php プロジェクト: hiqdev/hipanel-module-domain
                         <?php 
 echo Html::activeHiddenInput($nsModel, "[{$i}]domain_name", ['value' => $model->domain, 'class' => 'domain_name']);
 ?>
                         <div class="item">
                             <div class="row" style="margin-bottom: 5pt">
                                 <div class="col-md-5">
                                     <?php 
 echo $form->field($nsModel, "[{$i}]name")->textInput(['placeholder' => $nsModel->getAttributeLabel('name'), 'data-attribute' => 'name'])->label(false);
 ?>
                                 </div>
                                 <div class="col-md-5">
                                     <?php 
 if (!is_array($model)) {
     ?>
                                         <?php 
     echo $form->field($nsModel, "[{$i}]ip")->widget(StaticCombo::class, ['formElementSelector' => '.item', 'inputOptions' => ['disabled' => !StringHelper::endsWith($nsModel->name, $model->domain), 'placeholder' => $nsModel->getAttributeLabel('ip'), 'data-attribute' => 'ip', 'value' => implode(',', (array) $nsModel->ip)], 'pluginOptions' => ['select2Options' => ['tags' => [], 'multiple' => true, 'tokenSeparator' => [';', ',', ' '], 'minimumResultsForSearch' => -1, 'createSearchChoice' => new JsExpression('
                                                         function(term, data) {
                                                             return {id:term, text:term};
                                                         }
                                                     '), 'formatNoMatches' => new JsExpression('
                                                         function (term) {
                                                             return "' . Yii::t('hipanel:domain', 'Up to 13 IPv4 or IPv6 addresses separated with comma') . '";
                                                         }
                                                     ')]]])->label(false);
     ?>
                                     <?php 
 }
 ?>
                                 </div>
                                 <div class="col-md-2 text-right">
                                     <div class="btn-group" role="group">