/** Setup index page
  */
 public function indexAction()
 {
     $content = new Content();
     $this->view->contents = $content->getFrontContent('database');
     $thumbs = new Slides();
     $this->view->thumbs = $thumbs->getLast10Thumbnails(4);
     $finds = new Finds();
     $this->view->counts = $finds->getCountAllFinds();
     $recent = new Logins();
     $this->view->logins = $recent->todayVisitors();
     $form = new SolrForm();
     $form->setMethod('post');
     $this->view->form = $form;
     $values = $form->getValues();
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         if ($form->isValid($form->getValues())) {
             $params = array_filter($form->getValues());
             $params = $this->array_cleanup($params);
             $this->_flashMessenger->addMessage('Your search is complete');
             $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
         } else {
             $form->populate($data);
         }
     }
 }
Example #2
0
 public function login()
 {
     /*
             $db = ECPFactory::getDbo();
              * */
     ecpimport("helpers.cryptology");
     $db = ECPFactory::getPDO("Logins");
     $pasw = 'c17a1a963e2b9ebb228030c0615fdb4bd91bd982';
     //$pasw = ECPFactory::getForm("login")->pasw->value;
     $login = '******';
     $loginpin = ECP_Cryptology::generateInteger(30);
     $pinhash = ECP_Cryptology::generateHash($loginpin);
     $log = new Logins();
     $log->setLogin($login)->setPaswoord($pasw);
     $results = Logins::findByExample($db, $log);
     if (empty($results)) {
         //email en ww komt niet overeen
         return false;
     } else {
         foreach ($results as $result) {
             $id = $result->getId();
             $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash);
             $count = $result->updateToDatabase($db);
             if ($count != l) {
                 return 2;
             } else {
                 return array("uid" => $id, "pin" => $loginpin);
             }
         }
     }
 }
 /** Work out how many people have used a certain IP address
  */
 public function iptousersAction()
 {
     if ($this->_getParam('ip', false)) {
         $ip = $this->_getParam('ip');
         $this->view->headTitle('Users who have used IP address: ' . $ip);
         $logins = new Logins();
         $this->view->logins = $logins->users2Ip($ip);
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }
Example #4
0
 /** Setup index page
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $content = new Content();
     $this->view->contents = $content->getFrontContent('database');
     $recent = new Logins();
     $this->view->logins = $recent->todayVisitors();
     $form = new SolrForm();
     $form->q->setLabel('Search our database: ');
     $form->setMethod('post');
     $this->view->form = $form;
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
         $functions = new Pas_ArrayFunctions();
         $params = $functions->array_cleanup($form->getValues());
         $params = $this->process($params);
         $this->getFlash()->addMessage('Your search is complete');
         $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
     } else {
         $form->populate($this->_request->getPost());
     }
 }
Example #5
0
 public function isValid($value, $context = null)
 {
     $value = (string) $value;
     $this->_setValue($value);
     if (is_array($context)) {
         if (!isset($context['password'])) {
             return false;
         }
     }
     $dbAdapter = Zend_Registry::get('db');
     $this->_authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $this->_authAdapter->setTableName('users')->setIdentityColumn('username')->setCredentialColumn('password');
     // get "salt" for better security
     $salt = $this->_config->auth->salt;
     $password = sha1($salt . $context['password']);
     $this->_authAdapter->setIdentity($value);
     $this->_authAdapter->setCredential($password);
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($this->_authAdapter);
     if (!$result->isValid()) {
         $this->_error(self::NOT_AUTHORISED);
         return false;
     }
     //Updated the user table - this needs moving to the users model
     $users = new Users();
     $updateArray = array('visits' => new Zend_Db_Expr('visits + 1'), 'lastLogin' => Zend_Date::now()->toString('yyyy-MM-dd HH:mm'));
     $where = array();
     $where[] = $users->getAdapter()->quoteInto('username = ?', $value);
     $users->update($updateArray, $where);
     //Update login table needs moving to the login model
     $logins = new Logins();
     $data['loginDate'] = Zend_Date::now()->toString('yyyy-MM-dd HH:mm');
     $data['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
     $data['ipAddress'] = $_SERVER['REMOTE_ADDR'];
     $data['username'] = $value;
     $insert = $logins->insert($data);
     return true;
 }
 /** List user's logins
  * @access public
  * @return void
  */
 public function loginsAction()
 {
     $logins = new Logins();
     $this->view->logins = $logins->myLogins($this->getUsername(), $this->getParam('page'));
     $this->view->ips = $logins->myIps($this->getUsername());
 }
 /**
  * Fetch Logins which references this Overlegbasis. Will return null in case reference is invalid.
  * `overlegbasis`.`coordinator_id` -> `logins`.`id`
  *
  * @param PDO $db a PDO Database instance
  * @param array $sort array of DSC instances
  * @return Logins
  */
 public function fetchLogins(PDO $db, $sort = null)
 {
     $filter = array(Logins::FIELD_ID => $this->getCoordinatorId());
     $result = Logins::findByFilter($db, $filter, true, $sort);
     return empty($result) ? null : $result[0];
 }
Example #8
0
 /**
  * get single Logins instance from a DOMElement
  *
  * @param DOMElement $node
  * @return Logins
  */
 public static function fromDOMElement(DOMElement $node)
 {
     $o = new Logins();
     $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES));
     $o->notifyPristine();
     return $o;
 }
Example #9
0
 /**
  * Fetch Logins's which this Gemeente references.
  * `gemeente`.`zip` -> `logins`.`overleg_gemeente`
  *
  * @param PDO $db a PDO Database instance
  * @param array $sort array of DSC instances
  * @return Logins[]
  */
 public function fetchLoginsCollection(PDO $db, $sort = null)
 {
     $filter = array(Logins::FIELD_OVERLEG_GEMEENTE => $this->getZip());
     return Logins::findByFilter($db, $filter, true, $sort);
 }
Example #10
0
 /**
  * Fetch Logins's which this TpProject references.
  * `tp_project`.`id` -> `logins`.`tp_project`
  *
  * @param PDO $db a PDO Database instance
  * @param array $sort array of DSC instances
  * @return Logins[]
  */
 public function fetchLoginsCollection(PDO $db, $sort = null)
 {
     $filter = array(Logins::FIELD_TP_PROJECT => $this->getId());
     return Logins::findByFilter($db, $filter, true, $sort);
 }
Example #11
0
 public function eid()
 {
     include "openid.php";
     $openid = new LightOpenID('localhost');
     if ($openid->mode) {
         $session = ECPFactory::getSession();
         ecpimport("helpers.cryptology");
         $loginpin = ECP_Cryptology::generateInteger(30);
         $pinhash = ECP_Cryptology::generateHash($loginpin);
         $user = $openid->getAttributes();
         $achternaam = $user["namePerson/last"];
         $postcode = $user["contact/postalCode/home"];
         $adres = $user["contact/postalAddress/home"];
         $db = ECPFactory::getPDO("Logins");
         $log = new Logins();
         $log->setAdres($adres)->setOverlegGemeente($postcode)->setNaam($achternaam);
         $results = Logins::findByExample($db, $log);
         if (empty($results)) {
             //email en ww komt niet overeen
             ecpexit("exit");
         } else {
             foreach ($results as $result) {
                 $id = $result->getId();
                 $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash);
                 $count = $result->updateToDatabase($db);
                 if ($count != l) {
                     return 2;
                 } else {
                     ecpexit("uid=>{$id},pin=>{$loginpin}");
                 }
             }
         }
     } else {
         //Step 2: Authentication, with requirements
         $openid->identity = 'https://www.e-contract.be/eid-idp/endpoints/openid/auth-ident';
         $openid->required = array('namePerson/first', 'namePerson/last', 'namePerson', 'person/gender', 'contact/postalCode/home', 'contact/postalAddress/home', 'contact/city/home', 'eid/nationality', 'eid/pob', 'birthDate', 'eid/card-number', 'eid/card-validity/begin', 'eid/card-validity/end');
         //$openid->optional = array('');
         header('Location: ' . $openid->authUrl());
     }
 }