Example #1
0
 /**
  * Привязывает конфиг к определенному sitemap-документу
  * @param string $schema
  * @param int $sitemapId
  */
 public function setupLink($schema, $sitemapId)
 {
     $this->schema = CConfig::getSchema($schema);
     $this->schema->setupSitemapLink($sitemapId);
     $this->addAlert('Свазья с sitemap-документом установлена');
     $this->jumpBack();
 }
Example #2
0
 /**
  * Данный метод вызывается, при отсылке формы удаленя конфига
  * @param string $name
  */
 public function delete($name)
 {
     try {
         $schema = CConfig::getSchema($name);
         $schema->delete();
         $this->addAlert(sprintf('Конфиг "%s" успешно удален', $name));
     } catch (Exception $e) {
         $this->addError($e->getMessage());
     }
     $this->jumpBack();
 }
Example #3
0
 public function testRegistration()
 {
     $schema = \CConfig::getSchema(\UsersRegistration::RegistrationConfirmationConfigName);
     $api = new Registration($this->correctForm);
     $api->exec();
     $this->assertTrue($this->mailer->isSent());
     $lastEmail = \EmailLogModel::getLast();
     $this->assertEquals($lastEmail->to->getValue(), self::SomeCorrectEmail);
     $user = \UserAccount::getByLogin(self::NewLogin);
     $this->assertEquals($user->social_networks->getValue()['facebook'], self::NewUID);
 }
Example #4
0
 public static function resetPassword($user)
 {
     self::validateLoginAttempts($user->email->getValue());
     $password = substr(md5(time()), 0, 8);
     $user->password = $password;
     $user->update();
     //
     $parseData = $user->getData();
     $parseData['password'] = $password;
     //
     $schema = CConfig::getSchema(self::EmailConfigName);
     $values = $schema->getValues();
     //
     Email_Controller::parseAndSend($user->email->getValue(), $values['newpassword_subject'], $values['newpassword_content'], $parseData);
 }
Example #5
0
 public function testGetNameAndTitleAndId()
 {
     $schema = CConfig::getSchema('test');
     $this->assertEquals('test', $schema->getName());
     $this->assertEquals('Тестовый конфиг', $schema->getTitle());
     $this->assertEquals('1', $schema->getId());
 }
Example #6
0
}
Restorator::restore();
\SystemRegisterSample::createCache();
TestsHelper::dbFixture(ACL_TABLE, array());
ACL::create(ApiOperation::RightName);
// user record
TestsHelper::dbFixture(USERS_TABLE, array(array('login' => 'login', 'password' => passwordColumn::hash('testtest')), array('login' => 'guest', 'password' => passwordColumn::hash('testtest'))));
// grant user permission
$user = UserAccount::getByLogin('login');
ACL::grant(ApiOperation::RightName, $user->obj_rights->getEntity());
\UsersLogin::login('login', 'testtest');
// base logs
TestsHelper::dbFixture(Log::getTableName(), array(array('name' => 'Log1', 'critical' => 0, 'enable_logging' => 1), array('name' => 'Log2', 'critical' => 1, 'enable_logging' => 1)));
// base records
// - [different by user_id]
// - [different by date]
// - [different by content]
TestsHelper::dbFixture(Record::getTableName(), array(array('log_id' => 1, 'date' => '2001-01-01 00:00:00', 'short' => 'short log', 'full' => 'full_log', 'user_id' => 1, 'user_login' => 'login'), array('log_id' => 2, 'date' => '2001-01-02 00:00:00', 'short' => 'short log', 'full' => 'full_log', 'user_id' => 1, 'user_login' => 'login'), array('log_id' => 1, 'date' => '2001-01-03 00:00:00', 'short' => 'short log', 'full' => 'full_log')));
// Create custom config if it exists
$schemaName = 'Audit.CriticalEventName';
try {
    $config = \CConfig::getSchema($schemaName);
    $config->delete();
} catch (\Exception $e) {
} finally {
    $config = \CConfig::createSchema($schemaName);
    $config->addControl('to', 'inputfield', 'Получатели письма', array(), '*****@*****.**');
    $config->addControl('subject', 'inputfield', 'Тема письма', array(), 'Email Subject');
    $config->addControl('content', 'htmlfield', 'Шаблон письма', array(), 'Message body');
    $config->updateSchema($schemaName, 'Шаблон письма-оповещения о наступлении критического события аудита');
}
Example #7
0
 public function showForm($schema)
 {
     $this->schema = CConfig::getSchema($schema);
     $this->output();
 }
Example #8
0
 public function testGetLink()
 {
     $schema = CConfig::getSchema('test');
     $this->assertEquals(0, $schema->getSitemapLink());
 }