function consoleWriteVerbose($args) { global $VERBOSE; if ("true" == $VERBOSE) { consoleWrite($args); } return 0; }
public function cleanTemp() { $array[0] = 'Clean session temp items:'; if (isset($_SESSION['temp_life_time'])) { foreach ($_SESSION as $key => $value) { if (strpos($key, 'temp_') === 0) { consoleWrite('Clean temp session ' . $key); $this->temp = array_merge($this->temp, array($key => $value)); unset($_SESSION[$key]); } } } return array_merge($array, $this->temp); }
public function getUser($string) { foreach ($this->activeDirectory as $activeDirectory) { // Bind to the directory server. $bd = ldap_bind($activeDirectory['ad'], $activeDirectory['admin_user'] . "@" . $activeDirectory['domain'], $activeDirectory['admin_pass']); if ($bd) { $filter = "(&(objectCategory=user)(objectCategory=person)({$string}))"; $search = ldap_search($activeDirectory['ad'], $activeDirectory['ldapDN'], $filter); $search = ldap_search($activeDirectory['ad'], $activeDirectory['ldapDN'], $filter); $info = ldap_get_entries($activeDirectory['ad'], $search); $return = ldap_get_entries($activeDirectory['ad'], $search); if ($return['count'] > 0) { $return[0]['domain'] = $activeDirectory['domain']; return $return[0]; //RETURN THE FIRST ONE } } else { consoleWrite("Cant BIND to Active Directory!"); return false; } } }
public function execute() { $this->query = $this->query . ';'; try { //TO READ A VALUE FROM DB (SELECT) if (strpos($this->query, 'SELECT') > -1 || strpos($this->query, 'JOIN') > -1) { $data = $this->pdo->query($this->query, \PDO::FETCH_ASSOC); $data = $data->fetchAll(); if (count($data) == 0) { consoleWrite($this->query . '<br />' . 'Empty Set. Nothing returned from database.<br />'); return false; } else { consoleWrite($this->query . '<br />' . count($data) . ' row was displayed.<br />'); return $data; } } else { //TO WRITE A VALUE TO DB (UPDADE, INSERT, DELETE...) $data = $this->pdo->exec($this->query); consoleWrite($this->query . '<br />' . $data . ' rows was affecteds.<br />'); // if ($data == 0) { return false; } else { return $data; } } } catch (\PDOException $e) { consoleWrite($e); return false; } }