Exemplo n.º 1
0
 /**
  * Sets the admin password and optionally saves it to the database.
  *
  * @param string $password the password
  * @param string $salt default '' a random security salt to prevent dictionary lookups of the hashed value
  * @param boolean $save default false set to true if you want to update the database
  * @return object Admin returns a reference to this object for method chaining.
  */
 public function setPassword($password, $salt = '', $save = false)
 {
     $this->password = AdminTable::hashPassword($password, $salt);
     if ($save) {
         $this->save();
     }
     return $this;
 }
Exemplo n.º 2
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Languages');
$page = 'admin/table';
$table = new AdminTable('languages', 'language');
$table->add([['name' => 'language_name', 'label' => 'Name'], ['name' => 'language_code', 'label' => 'Code']]);
$table->prepare($db);
Exemplo n.º 3
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Customers');
$page = 'admin/table';
$table = new AdminTable('customers', 'customer');
$table->new_link_label = t('New Customer');
$table->add([['name' => 'customer_name', 'label' => 'Name'], ['name' => 'customer_email', 'label' => 'E-mail'], ['name' => 'customer_failed_attempts', 'label' => 'Failed Logins']]);
$table->prepare($db);
Exemplo n.º 4
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Currencies');
$page = 'admin/table';
$table = new AdminTable('currencies', 'currency');
$table->add([['name' => 'currency_name', 'label' => 'Name'], ['name' => 'currency_format', 'label' => 'Format'], ['name' => 'currency_value', 'label' => 'Value']]);
$table->prepare($db);
Exemplo n.º 5
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Administrators');
$page = 'admin/table';
$table = new AdminTable('users', 'user');
$table->add([['name' => 'user_login', 'label' => 'Login'], ['name' => 'user_email', 'label' => 'E-mail'], ['name' => 'user_last_login', 'label' => 'Last Login']]);
$table->prepare($db);
Exemplo n.º 6
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Categories');
$page = 'admin/table';
$table = new AdminTable('categories', 'category');
$table->add([['name' => 'category_name', 'label' => 'Name']]);
$table->prepare($db);
Exemplo n.º 7
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Roles');
$page = 'admin/table';
$table = new AdminTable('roles', 'role');
$table->add([['name' => 'role_name', 'label' => 'Name'], ['name' => 'role_description', 'label' => 'Description']]);
$table->prepare($db);
Exemplo n.º 8
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Orders');
$page = 'admin/table';
$table = new AdminTable('viewOrders', 'order');
$table->add([['name' => 'order_created', 'label' => 'Date', 'type' => 'date'], ['name' => 'order_state_name', 'label' => 'Status'], ['name' => 'customer_name', 'label' => 'Customer'], ['name' => 'order_payment_code', 'label' => 'Payment Code']]);
$table->prepare($db);
Exemplo n.º 9
0
<?php

require_once $home_dir . 'models/translation.m.php';
require_once $home_dir . 'classes/tables.php';
$page_title = t('Translations');
$page = 'admin/table';
$table = new AdminTable('viewTranslations', 'translation');
$table->addLink('admin/trans_import', 'Import');
$table->add([['name' => 'translation_name', 'label' => 'Name'], ['name' => 'translation_translation', 'label' => 'Translation'], ['name' => 'language_name', 'label' => 'Language']]);
$table->prepare($db);
Exemplo n.º 10
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Failed Attempts');
$page = 'admin/table';
$table = new AdminTable('ip_failed_attempts', 'ip_failed_attempt');
$table->add([['name' => 'ip_failed_attempt_ip', 'label' => 'IP'], ['name' => 'ip_failed_attempt_count', 'label' => 'Counter'], ['name' => 'ip_failed_attempt_first', 'label' => 'First failed attempt'], ['name' => 'ip_failed_attempt_last', 'label' => 'Last failed attempt']]);
$table->prepare($db);
Exemplo n.º 11
0
 public function setupAction()
 {
     $form = new ViMbAdmin_Form_Admin_Edit();
     $form->removeElement('active');
     $form->removeElement('super');
     $form->removeElement('welcome_email');
     if ($this->getAuth()->getIdentity()) {
         $this->addMessage(_('You are already logged in.'), ViMbAdmin_Message::INFO);
         $this->_redirect('domain/list');
     }
     if ($this->_options['securitysalt'] == '') {
         $charSet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $randomSalt = substr(str_shuffle("{$charSet}{$charSet}"), 0, 31);
         // please note this is not UTF-8 compatible
         $this->view->saltSet = false;
         $this->view->randomSalt = $randomSalt;
         $form->getElement('salt')->setValue($randomSalt);
     } elseif (!AdminTable::isEmpty()) {
         $this->addMessage(_("Admins already exist in the system."), ViMbAdmin_Message::INFO);
         $this->_redirect('auth/login');
     } else {
         $this->view->saltSet = true;
         if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
             if ($form->getElement('salt')->getValue() != $this->_options['securitysalt']) {
                 $this->addMessage(_("Incorrect security salt provided. Please copy and paste it from the <code>application.ini</code> file."), ViMbAdmin_Message::INFO);
             } else {
                 $admin = new Admin();
                 $admin['username'] = $form->getValue('username');
                 $admin->setPassword($form->getValue('password'), $this->_options['securitysalt'], false);
                 $admin->super = true;
                 $admin->active = true;
                 $admin->save();
                 try {
                     $mailer = new Zend_Mail();
                     $mailer->setSubject(_('ViMbAdmin :: Your New Administrator Account'));
                     $mailer->addTo($admin['username']);
                     $mailer->setFrom($this->_options['server']['email']['address'], $this->_options['server']['email']['name']);
                     $this->view->username = $admin['username'];
                     $this->view->password = $form->getValue('password');
                     $mailer->setBodyText($this->view->render('admin/email/new_admin.phtml'));
                     $mailer->send();
                 } catch (Exception $e) {
                 }
                 $this->addMessage(_('Your administrator account has been added. Please log in below.'), ViMbAdmin_Message::SUCCESS);
             }
             // Try and track new installs to see if it is worthwhile continueing development
             include_once APPLICATION_PATH . '/../public/PiwikTracker.php';
             if (class_exists('PiwikTracker')) {
                 if ($_SERVER['HTTPS'] == 'on') {
                     PiwikTracker::$URL = 'https://stats.opensolutions.ie/';
                 } else {
                     PiwikTracker::$URL = 'http://stats.opensolutions.ie/';
                 }
                 $piwikTracker = new PiwikTracker($idSite = 5);
                 $piwikTracker->doTrackPageView('Nes Install Completed');
                 $piwikTracker->doTrackGoal($idGoal = 1, $revenue = 0);
             }
             $this->_helper->viewRenderer->setNoRender(true);
             $this->_redirect('auth/login');
         }
     }
     $this->view->form = $form;
 }
Exemplo n.º 12
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Aliases');
$page = 'admin/table';
$table = new AdminTable('aliases', 'alias');
$table->add([['name' => 'alias_url', 'label' => 'URL'], ['name' => 'alias_path', 'label' => 'Path']]);
$table->prepare($db);
Exemplo n.º 13
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Delivery types');
$page = 'admin/table';
$table = new AdminTable('delivery_types', 'delivery_type');
$table->add([['name' => 'delivery_type_name', 'label' => 'Name']]);
$table->prepare($db);
Exemplo n.º 14
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Payment types');
$page = 'admin/table';
$table = new AdminTable('payment_types', 'payment_type');
$table->add([['name' => 'payment_type_name', 'label' => 'Name']]);
$table->prepare($db);
Exemplo n.º 15
0
<?php

require_once $home_dir . 'classes/tables.php';
$page_title = t('Products');
$page = 'admin/table';
$table = new AdminTable('viewProducts', 'product');
$table->add([['name' => 'product_id', 'label' => 'ID'], ['name' => 'product_name', 'label' => 'Name'], ['name' => 'category_name', 'label' => 'Category']]);
$table->prepare($db);