示例#1
0
 public function initialize()
 {
     $this->setDefaultProperties(array('class_key' => $this->classKey, 'blocked' => false, 'active' => false));
     $this->classKey = $this->getProperty('class_key', 'modUser');
     $this->setProperty('blocked', $this->getProperty('blocked') ? true : false);
     return parent::initialize();
 }
示例#2
0
 /** {@inheritDoc} */
 public function initialize()
 {
     if (!$this->modx->hasPermission($this->permission)) {
         return $this->modx->lexicon('access_denied');
     }
     return parent::initialize();
 }
示例#3
0
 public function initialize()
 {
     if (!(int) $this->getProperty('product_id')) {
         return 'Не был указан ID товара';
     }
     return parent::initialize();
 }
示例#4
0
 public function initialize()
 {
     $this->setUserId();
     $this->setCreateTime();
     $this->setCreatedByName();
     return parent::initialize();
 }
 public function initialize()
 {
     if (!($this->historyFile = $this->modx->msrevaluation->process())) {
         $this->failure($this->modx->msrevaluation->error);
     }
     return parent::initialize();
 }
示例#6
0
 /** {@inheritDoc} */
 public function initialize()
 {
     /** @var mlmsystem $mlmsystem */
     $this->MlmSystem = $this->modx->getService('mlmsystem');
     $this->MlmSystem->initialize($this->getProperty('context', $this->modx->context->key));
     return parent::initialize();
 }
示例#7
0
 public function initialize()
 {
     $classKey = $this->getProperty('class_key');
     if (empty($classKey)) {
         $this->setProperty('class_key', 'sources.modFileMediaSource');
     }
     return parent::initialize();
 }
示例#8
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $name = $this->getProperty('name');
     if (empty($name)) {
         $this->addFieldError('name', $this->modx->lexicon('virtunewsletter.category_err_ns_name'));
     }
     return parent::initialize();
 }
示例#9
0
 public function initialize()
 {
     if (!$this->getProperty('username')) {
         return 'Не указан пользователь';
     }
     $this->setDefaultProperties(array('userid' => $this->modx->user->id, "rank" => 0));
     return parent::initialize();
 }
示例#10
0
 public function initialize()
 {
     $this->setUserId();
     $this->setCreateTime();
     $this->setProperty('contact_id', $this->getProperty('contactId'));
     $this->modx->log(modX::LOG_LEVEL_DEBUG, $this->getProperty('contactId'));
     return parent::initialize();
 }
示例#11
0
 public function initialize()
 {
     $this->classKey = $this->getProperty('type');
     if (!$this->classKey) {
         return $this->modx->lexicon($this->objectType . '_type_err_ns');
     }
     return parent::initialize();
 }
示例#12
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $this->context = $this->modx->getContext($this->getProperty('fk'));
     if (empty($this->context)) {
         return $this->modx->lexicon('setting_err_nf');
     }
     return parent::initialize();
 }
示例#13
0
 public function initialize()
 {
     $this->setDefaultProperties(array("target_class" => "modResource"));
     if (!(int) $this->getProperty('target_id')) {
         return 'Не был указан ID целевого объекта';
     }
     if (!$this->getProperty('target_class')) {
         return 'Не был указан класс целевого объекта';
     }
     return parent::initialize();
 }
示例#14
0
 public function initialize()
 {
     $this->BillingProcessorsPath = MODX_CORE_PATH . 'components/billing/processors/';
     $this->setDefaultProperties(array('currency_id' => $this->modx->getOption('shopmodx.default_currency')));
     if (!$this->getProperty('paysystem_id')) {
         $error = "Не был получен ID платежной системы";
         $this->error($error);
         return $this->getResponseError($error);
     }
     $this->setProperties(array("allow_partial_payment" => $this->modx->getOption('shop.allow_partial_payment', null, false)));
     return parent::initialize();
 }
示例#15
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $name = $this->getProperty('name');
     if (empty($name)) {
         return $this->modx->lexicon('bbbx.config_err_ns_name');
     }
     $configs = $this->getProperty('configs');
     if (empty($configs)) {
         return $this->modx->lexicon('bbbx.config_err_ns_configs');
     }
     $this->unsetProperty('action');
     return parent::initialize();
 }
示例#16
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $subject = $this->getProperty('subject');
     if (empty($subject)) {
         $this->addFieldError('subject', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_subject'));
         return FALSE;
     }
     $resourceId = $this->getProperty('resource_id');
     if (empty($resourceId)) {
         $this->addFieldError('resource_id', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_resource_id'));
         return FALSE;
     }
     $scheduledFor = $this->getProperty('scheduled_for');
     if (empty($scheduledFor)) {
         $this->addFieldError('scheduled_for', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_scheduled_for'));
         return FALSE;
     }
     $categories = $this->getProperty('categories');
     $categories = @explode(',', $categories);
     if (empty($categories) || isset($categories[0]) && empty($categories[0])) {
         $this->addFieldError('categories', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_categories'));
         return FALSE;
     }
     $content = $this->modx->virtunewsletter->outputContent($resourceId);
     $isRecurring = $this->getProperty('is_recurring');
     if (!$isRecurring) {
         $content = $this->modx->virtunewsletter->prepareEmailContent($content);
     } else {
         $recurrenceNumber = $this->getProperty('recurrence_number');
         if (empty($recurrenceNumber)) {
             $this->addFieldError('recurrence_number', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_recurrence_number'));
             return FALSE;
         }
         $recurrenceRange = $this->getProperty('recurrence_range');
         if (empty($recurrenceRange)) {
             $this->addFieldError('recurrence_range', $this->modx->lexicon('virtunewsletter.newsletter_err_ns_recurrence_range'));
             return FALSE;
         }
     }
     $content = str_replace(array('%5B%5B%2B', '%5D%5D'), array('[[+', ']]'), $content);
     $this->setProperty('content', $content);
     $this->setProperty('created_on', time());
     $userId = $this->modx->user->get('id');
     $this->setProperty('created_by', $userId);
     $schedule = $this->getProperty('scheduled_for');
     date_default_timezone_set('UTC');
     $schedule = strtotime($schedule);
     $this->setProperty('scheduled_for', $schedule);
     return parent::initialize();
 }
示例#17
0
 public function initialize()
 {
     $this->xmlFiles = array('treeWithoutProducts.xml', 'stock.xml', 'filters.xml', 'catalogue.xml');
     $api_user = $this->modx->getOption('msgiftsrusynch_api_user', null, '');
     $api_password = $this->modx->getOption('msgiftsrusynch_api_password', null, '');
     if ($api_user == '' || $api_password == '') {
         return $this->modx->lexicon('msgiftsrusynch_item_err_api_login');
     }
     $this->url_gifts_api = "http://" . $api_user . ":" . $api_password . "@api2.gifts.ru/export/v2/catalogue/";
     $api_page_content = file_get_contents($this->url_gifts_api . $this->xmlFiles[0]);
     if (strstr($api_page_content, '<title>401</title>') || strstr($api_page_content, 'You can change')) {
         return $this->modx->lexicon('msgiftsrusynch_item_err_api_ip');
     }
     return parent::initialize();
 }
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $this->object = $this->modx->newObject($this->classKey);
     $props = $this->getProperties();
     $properties = array();
     foreach ($props as $k => $v) {
         if (!preg_match('/^property_/', $k)) {
             continue;
         }
         $properties[preg_replace('/^property_/', '', $k)] = $v;
         $this->unsetProperty($k);
     }
     $this->setProperty('properties', json_encode($properties));
     return parent::initialize();
 }
示例#19
0
 public function initialize()
 {
     if (!$this->modx->user->id) {
         return 'Необходимо авторизоваться';
     }
     $this->setDefaultProperties(array('vote_direction' => 0, 'vote_value' => 0.0));
     $vote_value = (double) $this->getProperty('vote_value');
     if ($vote_value > 0) {
         $this->setProperty('vote_direction', '1');
     } else {
         if ($vote_value < 0) {
             $this->setProperty('vote_direction', '-1');
         }
     }
     $this->setProperties(array("user_id" => $this->modx->user->id, "vote_date" => time()));
     return parent::initialize();
 }
示例#20
0
 public function initialize()
 {
     if (!$this->modx->user->id) {
         return 'Необходимо авторизоваться';
     }
     $this->setDefaultProperties(array('vote_direction' => 0, 'vote_value' => 0.0, "voted_message" => "Вы не можете голосовать дважды за один и тот же объект"));
     $vote_value = (double) $this->getProperty('vote_value');
     if ($vote_value > 0) {
         $this->setProperty('vote_direction', '1');
     } else {
         if ($vote_value < 0) {
             $this->setProperty('vote_direction', '-1');
         }
     }
     $this->setProperties(array("user_id" => $this->modx->user->id, 'type' => $this->getTypeFromRequest(), "vote_date" => time()));
     return parent::initialize();
 }
示例#21
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $this->unsetProperty('action');
     $meetingId = intval($this->getProperty('meeting_id'));
     if (empty($meetingId)) {
         return $this->modx->lexicon('bbbx.join_err_ns_meeting_id');
     }
     $classKey = $this->getProperty('classkey');
     if (empty($classKey)) {
         return $this->modx->lexicon('bbbx.join_err_ns_class_key');
     }
     $objectId = intval($this->getProperty('object_id'));
     if (empty($objectId)) {
         return $this->modx->lexicon('bbbx.join_err_ns_object_id');
     }
     return parent::initialize();
 }
示例#22
0
 public function initialize()
 {
     $this->setProperties(array('createdby' => $this->modx->user->id ? $this->modx->user->id : null, 'contractor' => $this->modx->user->id ? $this->modx->user->id : null));
     return parent::initialize();
 }
示例#23
0
 /**
  * {@inheritDoc}
  * @return boolean|string
  */
 public function initialize()
 {
     $this->setProperties(array('user_id' => $this->modx->user->id, 'validate' => 0, 'ip' => $this->modx->request->getClientIp(), 'createdon' => date('Y-m-d H:i:s'), 'updatedon' => date('Y-m-d H:i:s')));
     return parent::initialize();
 }
示例#24
0
 public function initialize()
 {
     $this->setDefaultProperties(array('automatic_access' => false));
     return parent::initialize();
 }
示例#25
0
 public function initialize()
 {
     $this->setDefaultProperties(array('haslayout' => true, 'lang_topics' => ''));
     return parent::initialize();
 }
示例#26
0
 public function initialize()
 {
     $this->modx->getParser();
     return parent::initialize();
 }
示例#27
0
 /**
  * Create the modResource object for manipulation
  * @return string|modResource
  */
 public function initialize()
 {
     /* get the class_key to determine classKey and resourceDir */
     $classKey = $this->getProperty('class_key', 'modDocument');
     $this->classKey = !empty($classKey) ? $classKey : 'modDocument';
     $initialized = parent::initialize();
     if (!$initialized) {
         return $this->modx->lexicon('resource_err_create');
     }
     if (!$this->object instanceof $this->classKey) {
         return $this->modx->lexicon('resource_err_class', array('class' => $this->classKey));
     }
     return $initialized;
 }
示例#28
0
 public function initialize()
 {
     $this->setDefaultProperties(array('parent' => 0));
     return parent::initialize();
 }
示例#29
0
 public function initialize()
 {
     $this->setDefaultProperties(array('status' => $this->modx->getOption('shop.order_default_status', null, 1), 'products' => array(), 'created_by' => $this->modx->user->id, 'ip' => $this->getUserIp(), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'order_address' => '', 'ShopProcessorsPath' => MODX_CORE_PATH . 'components/modxsite/processors/'));
     return parent::initialize();
 }