fixes for releasetool
Dieser Commit ist enthalten in:
Ursprung
926c88ead7
Commit
e42cb01978
|
@ -378,6 +378,7 @@ class DB_Sql extends DB_Sql_Abstract {
|
||||||
// made this IF due to performance (one if is faster than $count if's)
|
// made this IF due to performance (one if is faster than $count if's)
|
||||||
for ($i = 0; $i < $count; $i ++) {
|
for ($i = 0; $i < $count; $i ++) {
|
||||||
$finfo = mysqli_fetch_field($id);
|
$finfo = mysqli_fetch_field($id);
|
||||||
|
if (is_object($finfo)) {
|
||||||
$res[$i]['table'] = $finfo->table;
|
$res[$i]['table'] = $finfo->table;
|
||||||
$res[$i]['name'] = $finfo->name;
|
$res[$i]['name'] = $finfo->name;
|
||||||
$res[$i]['type'] = $this->_aDataTypes[$finfo->type];
|
$res[$i]['type'] = $this->_aDataTypes[$finfo->type];
|
||||||
|
@ -387,6 +388,7 @@ class DB_Sql extends DB_Sql_Abstract {
|
||||||
$res['meta'][$res[$i]['name']] = $i;
|
$res['meta'][$res[$i]['name']] = $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($full) {
|
if ($full) {
|
||||||
$res['num_fields'] = $count;
|
$res['num_fields'] = $count;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +397,8 @@ class DB_Sql extends DB_Sql_Abstract {
|
||||||
if ($table) {
|
if ($table) {
|
||||||
mysqli_free_result($id);
|
mysqli_free_result($id);
|
||||||
}
|
}
|
||||||
return $res;
|
|
||||||
|
return (count($res) > 0) ? $res : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -497,4 +500,5 @@ class DB_Sql extends DB_Sql_Abstract {
|
||||||
public function getClientInfo() {
|
public function getClientInfo() {
|
||||||
return mysqli_get_client_info();
|
return mysqli_get_client_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -465,6 +465,15 @@ abstract class DB_Sql_Abstract {
|
||||||
* @return array Depends on used database and on parameter $full
|
* @return array Depends on used database and on parameter $full
|
||||||
*/
|
*/
|
||||||
public function metadata($table = '', $full = false) {
|
public function metadata($table = '', $full = false) {
|
||||||
|
if(empty($table)) {
|
||||||
|
$aMeta = $this->_metaData(NULL, true);
|
||||||
|
if(is_array($aMeta) && isset($aMeta[0]['table'])) {
|
||||||
|
$table = $aMeta[0]['table'];
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$key = (string) $this->Database . '_' . $table . '_' . (($full) ? '1' : '0');
|
$key = (string) $this->Database . '_' . $table . '_' . (($full) ? '1' : '0');
|
||||||
|
|
||||||
if (!isset(self::$_metaCache[$key])) {
|
if (!isset(self::$_metaCache[$key])) {
|
||||||
|
|
185
conlib/local.php
185
conlib/local.php
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('CON_FRAMEWORK')) {
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ if (!defined('CON_FRAMEWORK')) {
|
||||||
/**
|
/**
|
||||||
* DB-class for all DB handling
|
* DB-class for all DB handling
|
||||||
*/
|
*/
|
||||||
class DB_ConLite extends DB_Sql
|
class DB_ConLite extends DB_Sql {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Constructor of database class.
|
* Constructor of database class.
|
||||||
*
|
*
|
||||||
|
@ -58,8 +58,7 @@ class DB_ConLite extends DB_Sql
|
||||||
* - $options['enableProfiling'] (bool) Optional, flag to enable profiling
|
* - $options['enableProfiling'] (bool) Optional, flag to enable profiling
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options = array())
|
public function __construct(array $options = array()) {
|
||||||
{
|
|
||||||
global $cachemeta;
|
global $cachemeta;
|
||||||
|
|
||||||
parent::__construct($options);
|
parent::__construct($options);
|
||||||
|
@ -70,19 +69,16 @@ class DB_ConLite extends DB_Sql
|
||||||
|
|
||||||
// TODO check this out
|
// TODO check this out
|
||||||
// HerrB: Checked and disabled. Kills umlauts, if tables are latin1_general.
|
// HerrB: Checked and disabled. Kills umlauts, if tables are latin1_general.
|
||||||
|
|
||||||
// try to use the new connection and get the needed encryption
|
// try to use the new connection and get the needed encryption
|
||||||
//$this->query("SET NAMES 'utf8'");
|
//$this->query("SET NAMES 'utf8'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the next recordset from result set
|
* Fetches the next recordset from result set
|
||||||
*
|
*
|
||||||
* @param bool
|
* @param bool
|
||||||
*/
|
*/
|
||||||
public function next_record()
|
public function next_record() {
|
||||||
{
|
|
||||||
global $cCurrentModule;
|
global $cCurrentModule;
|
||||||
// FIXME For what reason is NoRecord used???
|
// FIXME For what reason is NoRecord used???
|
||||||
$this->NoRecord = false;
|
$this->NoRecord = false;
|
||||||
|
@ -99,7 +95,6 @@ class DB_ConLite extends DB_Sql
|
||||||
return parent::next_record();
|
return parent::next_record();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the metada of passed table
|
* Returns the metada of passed table
|
||||||
*
|
*
|
||||||
|
@ -108,22 +103,13 @@ class DB_ConLite extends DB_Sql
|
||||||
* or false in case of an error
|
* or false in case of an error
|
||||||
* @deprecated Use db drivers toArray() method instead
|
* @deprecated Use db drivers toArray() method instead
|
||||||
*/
|
*/
|
||||||
public function copyResultToArray($sTable = '')
|
public function copyResultToArray($sTable = '') {
|
||||||
{
|
|
||||||
global $cachemeta;
|
|
||||||
|
|
||||||
$aValues = array();
|
$aValues = array();
|
||||||
|
|
||||||
if ($sTable != '') {
|
|
||||||
if (array_key_exists($sTable, $cachemeta)) {
|
|
||||||
$aMetadata = $cachemeta[$sTable];
|
|
||||||
} else {
|
|
||||||
$cachemeta[$sTable] = $this->metadata($sTable);
|
|
||||||
$aMetadata = $cachemeta[$sTable];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$aMetadata = $this->metadata($sTable);
|
$aMetadata = $this->metadata($sTable);
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_array($aMetadata) || count($aMetadata) == 0) {
|
if (!is_array($aMetadata) || count($aMetadata) == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -135,6 +121,7 @@ class DB_ConLite extends DB_Sql
|
||||||
|
|
||||||
return $aValues;
|
return $aValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,11 +139,11 @@ class DB_Contenido extends DB_ConLite {
|
||||||
public function __construct(array $options = array()) {
|
public function __construct(array $options = array()) {
|
||||||
parent::__construct($options);
|
parent::__construct($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Contenido_CT_Sql extends CT_Sql {
|
||||||
|
|
||||||
class Contenido_CT_Sql extends CT_Sql
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Database class name
|
* Database class name
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -169,8 +156,7 @@ class Contenido_CT_Sql extends CT_Sql
|
||||||
*/
|
*/
|
||||||
public $database_table = '';
|
public $database_table = '';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
$this->database_table = $cfg['tab']['phplib_active_sessions'];
|
$this->database_table = $cfg['tab']['phplib_active_sessions'];
|
||||||
}
|
}
|
||||||
|
@ -189,8 +175,7 @@ class Contenido_CT_Sql extends CT_Sql
|
||||||
* @param string $str The value to store
|
* @param string $str The value to store
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function ac_store($id, $name, $str)
|
public function ac_store($id, $name, $str) {
|
||||||
{
|
|
||||||
switch ($this->encoding_mode) {
|
switch ($this->encoding_mode) {
|
||||||
case 'slashes':
|
case 'slashes':
|
||||||
$str = addslashes($name . ':' . $str);
|
$str = addslashes($name . ':' . $str);
|
||||||
|
@ -204,21 +189,20 @@ class Contenido_CT_Sql extends CT_Sql
|
||||||
$now = date('YmdHis', time());
|
$now = date('YmdHis', time());
|
||||||
|
|
||||||
$iquery = sprintf(
|
$iquery = sprintf(
|
||||||
"REPLACE INTO %s (sid, name, val, changed) VALUES ('%s', '%s', '%s', '%s')",
|
"REPLACE INTO %s (sid, name, val, changed) VALUES ('%s', '%s', '%s', '%s')", $this->database_table, $id, $name, $str, $now
|
||||||
$this->database_table, $id, $name, $str, $now
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return ($this->db->query($iquery)) ? true : false;
|
return ($this->db->query($iquery)) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the interface class for storing session data to disk using file
|
* Implements the interface class for storing session data to disk using file
|
||||||
* session container of phplib.
|
* session container of phplib.
|
||||||
*/
|
*/
|
||||||
class Contenido_CT_File extends CT_File
|
class Contenido_CT_File extends CT_File {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* The maximum length for one line in session file.
|
* The maximum length for one line in session file.
|
||||||
* @var int
|
* @var int
|
||||||
|
@ -233,8 +217,7 @@ class Contenido_CT_File extends CT_File
|
||||||
*
|
*
|
||||||
* @author Holger Librenz <holger.librenz@4fb.de>
|
* @author Holger Librenz <holger.librenz@4fb.de>
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
|
||||||
if (isset($cfg['session_line_length']) && !empty($cfg['session_line_length'])) {
|
if (isset($cfg['session_line_length']) && !empty($cfg['session_line_length'])) {
|
||||||
|
@ -253,8 +236,7 @@ class Contenido_CT_File extends CT_File
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function ac_get_value($sId, $sName)
|
public function ac_get_value($sId, $sName) {
|
||||||
{
|
|
||||||
if (file_exists($this->file_path . "$sId$sName")) {
|
if (file_exists($this->file_path . "$sId$sName")) {
|
||||||
$f = fopen($this->file_path . "$sId$sName", 'r');
|
$f = fopen($this->file_path . "$sId$sName", 'r');
|
||||||
if ($f < 0) {
|
if ($f < 0) {
|
||||||
|
@ -269,16 +251,16 @@ class Contenido_CT_File extends CT_File
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contenido_CT_Shm extends CT_Shm
|
class Contenido_CT_Shm extends CT_Shm {
|
||||||
{
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
$this->ac_start();
|
$this->ac_start();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contenido session container, uses PHP's session implementation.
|
* Contenido session container, uses PHP's session implementation.
|
||||||
|
@ -292,10 +274,9 @@ class Contenido_CT_Shm extends CT_Shm
|
||||||
*
|
*
|
||||||
* @author Murat Purc <murat@purc.de>
|
* @author Murat Purc <murat@purc.de>
|
||||||
*/
|
*/
|
||||||
class Contenido_CT_Session extends CT_Session
|
class Contenido_CT_Session extends CT_Session {
|
||||||
{
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
$this->ac_start(array(
|
$this->ac_start(array(
|
||||||
'namespace' => 'contenido_ct_session_ns',
|
'namespace' => 'contenido_ct_session_ns',
|
||||||
'session.hash_function' => '1', // use sha-1 function
|
'session.hash_function' => '1', // use sha-1 function
|
||||||
|
@ -305,10 +286,11 @@ class Contenido_CT_Session extends CT_Session
|
||||||
# 'session.gc_maxlifetime' => 'your lifetime in seconds',
|
# 'session.gc_maxlifetime' => 'your lifetime in seconds',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contenido_Session extends Session
|
class Contenido_Session extends Session {
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Session';
|
public $classname = 'Contenido_Session';
|
||||||
public $cookiename = 'contenido'; ## defaults to classname
|
public $cookiename = 'contenido'; ## defaults to classname
|
||||||
public $magic = '934ComeOnEileen'; ## ID seed
|
public $magic = '934ComeOnEileen'; ## ID seed
|
||||||
|
@ -318,8 +300,7 @@ class Contenido_Session extends Session
|
||||||
public $that_class = 'Contenido_CT_Sql'; ## name of data storage container
|
public $that_class = 'Contenido_CT_Sql'; ## name of data storage container
|
||||||
public $gc_probability = 5;
|
public $gc_probability = 5;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
|
|
||||||
$sFallback = 'sql';
|
$sFallback = 'sql';
|
||||||
|
@ -336,17 +317,16 @@ class Contenido_Session extends Session
|
||||||
$this->that_class = $sClass;
|
$this->that_class = $sClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete() {
|
||||||
{
|
|
||||||
$oCol = new InUseCollection();
|
$oCol = new InUseCollection();
|
||||||
$oCol->removeSessionMarks($this->id);
|
$oCol->removeSessionMarks($this->id);
|
||||||
parent::delete();
|
parent::delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Contenido_Frontend_Session extends Session {
|
||||||
|
|
||||||
class Contenido_Frontend_Session extends Session
|
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Frontend_Session';
|
public $classname = 'Contenido_Frontend_Session';
|
||||||
public $cookiename = 'sid'; ## defaults to classname
|
public $cookiename = 'sid'; ## defaults to classname
|
||||||
public $magic = 'Phillipip'; ## ID seed
|
public $magic = 'Phillipip'; ## ID seed
|
||||||
|
@ -356,8 +336,7 @@ class Contenido_Frontend_Session extends Session
|
||||||
public $that_class = 'Contenido_CT_Sql'; ## name of data storage container
|
public $that_class = 'Contenido_CT_Sql'; ## name of data storage container
|
||||||
public $gc_probability = 5;
|
public $gc_probability = 5;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $load_lang, $load_client, $cfg;
|
global $load_lang, $load_client, $cfg;
|
||||||
|
|
||||||
$this->cookiename = 'sid_' . $load_client . '_' . $load_lang;
|
$this->cookiename = 'sid_' . $load_client . '_' . $load_lang;
|
||||||
|
@ -380,23 +359,22 @@ class Contenido_Frontend_Session extends Session
|
||||||
|
|
||||||
$this->that_class = $sClass;
|
$this->that_class = $sClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contenido_Auth extends Auth
|
class Contenido_Auth extends Auth {
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Auth';
|
public $classname = 'Contenido_Auth';
|
||||||
public $lifetime = 15;
|
public $lifetime = 15;
|
||||||
public $database_class = 'DB_Contenido';
|
public $database_class = 'DB_Contenido';
|
||||||
public $database_table = 'con_phplib_auth_user';
|
public $database_table = 'con_phplib_auth_user';
|
||||||
|
|
||||||
public function auth_loginform()
|
public function auth_loginform() {
|
||||||
{
|
|
||||||
global $sess, $_PHPLIB;
|
global $sess, $_PHPLIB;
|
||||||
include($_PHPLIB['libdir'] . 'loginform.ihtml');
|
include($_PHPLIB['libdir'] . 'loginform.ihtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_validatelogin()
|
public function auth_validatelogin() {
|
||||||
{
|
|
||||||
global $username, $password;
|
global $username, $password;
|
||||||
|
|
||||||
if ($password == '') {
|
if ($password == '') {
|
||||||
|
@ -412,8 +390,7 @@ class Contenido_Auth extends Auth
|
||||||
$uid = false;
|
$uid = false;
|
||||||
|
|
||||||
$this->db->query(
|
$this->db->query(
|
||||||
sprintf("SELECT user_id, perms FROM %s WHERE username = '%s' AND password = '%s'",
|
sprintf("SELECT user_id, perms FROM %s WHERE username = '%s' AND password = '%s'", $this->database_table, addslashes($username), addslashes($password))
|
||||||
$this->database_table, addslashes($username), addslashes($password))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($this->db->next_record()) {
|
while ($this->db->next_record()) {
|
||||||
|
@ -422,33 +399,31 @@ class Contenido_Auth extends Auth
|
||||||
}
|
}
|
||||||
return $uid;
|
return $uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Contenido_Default_Auth extends Contenido_Auth {
|
||||||
|
|
||||||
class Contenido_Default_Auth extends Contenido_Auth
|
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Default_Auth';
|
public $classname = 'Contenido_Default_Auth';
|
||||||
public $lifetime = 1;
|
public $lifetime = 1;
|
||||||
public $nobody = true;
|
public $nobody = true;
|
||||||
|
|
||||||
public function auth_loginform()
|
public function auth_loginform() {
|
||||||
{
|
|
||||||
global $sess, $_PHPLIB;
|
global $sess, $_PHPLIB;
|
||||||
include($_PHPLIB['libdir'] . 'defloginform.ihtml');
|
include($_PHPLIB['libdir'] . 'defloginform.ihtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Contenido_Challenge_Auth extends Auth {
|
||||||
|
|
||||||
class Contenido_Challenge_Auth extends Auth
|
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Challenge_Auth';
|
public $classname = 'Contenido_Challenge_Auth';
|
||||||
public $lifetime = 1;
|
public $lifetime = 1;
|
||||||
public $magic = 'Simsalabim'; ## Challenge seed
|
public $magic = 'Simsalabim'; ## Challenge seed
|
||||||
public $database_class = 'DB_Contenido';
|
public $database_class = 'DB_Contenido';
|
||||||
public $database_table = 'con_phplib_auth_user';
|
public $database_table = 'con_phplib_auth_user';
|
||||||
|
|
||||||
public function auth_loginform()
|
public function auth_loginform() {
|
||||||
{
|
|
||||||
global $sess, $challenge, $_PHPLIB;
|
global $sess, $challenge, $_PHPLIB;
|
||||||
|
|
||||||
$challenge = md5(uniqid($this->magic));
|
$challenge = md5(uniqid($this->magic));
|
||||||
|
@ -457,8 +432,7 @@ class Contenido_Challenge_Auth extends Auth
|
||||||
include($_PHPLIB['libdir'] . 'crloginform.ihtml');
|
include($_PHPLIB['libdir'] . 'crloginform.ihtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_validatelogin()
|
public function auth_validatelogin() {
|
||||||
{
|
|
||||||
global $username, $password, $challenge, $response, $timestamp;
|
global $username, $password, $challenge, $response, $timestamp;
|
||||||
|
|
||||||
if ($password == '') {
|
if ($password == '') {
|
||||||
|
@ -476,8 +450,7 @@ class Contenido_Challenge_Auth extends Auth
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->db->query(
|
$this->db->query(
|
||||||
sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s'",
|
sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s'", $this->database_table, addslashes($username))
|
||||||
$this->database_table, addslashes($username))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($this->db->next_record()) {
|
while ($this->db->next_record()) {
|
||||||
|
@ -505,6 +478,7 @@ class Contenido_Challenge_Auth extends Auth
|
||||||
return $uid;
|
return $uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -512,8 +486,8 @@ class Contenido_Challenge_Auth extends Auth
|
||||||
## than cleartext in database
|
## than cleartext in database
|
||||||
## Author: Jim Zajkowski <jim@jimz.com>
|
## Author: Jim Zajkowski <jim@jimz.com>
|
||||||
|
|
||||||
class Contenido_Challenge_Crypt_Auth extends Auth
|
class Contenido_Challenge_Crypt_Auth extends Auth {
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Challenge_Crypt_Auth';
|
public $classname = 'Contenido_Challenge_Crypt_Auth';
|
||||||
public $lifetime = 15;
|
public $lifetime = 15;
|
||||||
public $magic = 'Frrobo123xxica'; ## Challenge seed
|
public $magic = 'Frrobo123xxica'; ## Challenge seed
|
||||||
|
@ -522,8 +496,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
public $group_table = '';
|
public $group_table = '';
|
||||||
public $member_table = '';
|
public $member_table = '';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
$this->database_table = $cfg['tab']['phplib_auth_user_md5'];
|
$this->database_table = $cfg['tab']['phplib_auth_user_md5'];
|
||||||
$this->group_table = $cfg['tab']['groups'];
|
$this->group_table = $cfg['tab']['groups'];
|
||||||
|
@ -535,8 +508,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_loginform()
|
public function auth_loginform() {
|
||||||
{
|
|
||||||
global $sess, $challenge, $_PHPLIB, $cfg;
|
global $sess, $challenge, $_PHPLIB, $cfg;
|
||||||
|
|
||||||
$challenge = md5(uniqid($this->magic));
|
$challenge = md5(uniqid($this->magic));
|
||||||
|
@ -545,8 +517,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
include($cfg['path']['contenido'] . 'main.loginform.php');
|
include($cfg['path']['contenido'] . 'main.loginform.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_loglogin($uid)
|
public function auth_loglogin($uid) {
|
||||||
{
|
|
||||||
global $cfg, $client, $lang, $auth, $sess, $saveLoginTime;
|
global $cfg, $client, $lang, $auth, $sess, $saveLoginTime;
|
||||||
|
|
||||||
$perm = new Contenido_Perm();
|
$perm = new Contenido_Perm();
|
||||||
|
@ -610,8 +581,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
$saveLoginTime = true;
|
$saveLoginTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_validatelogin()
|
public function auth_validatelogin() {
|
||||||
{
|
|
||||||
global $username, $password, $challenge, $response, $formtimestamp, $auth_handlers;
|
global $username, $password, $challenge, $response, $formtimestamp, $auth_handlers;
|
||||||
|
|
||||||
$gperm = array();
|
$gperm = array();
|
||||||
|
@ -639,9 +609,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
|
|
||||||
$this->db->query(sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s' AND
|
$this->db->query(sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s' AND
|
||||||
(valid_from <= '" . $sDate . "' OR valid_from = '0000-00-00' OR valid_from is NULL) AND
|
(valid_from <= '" . $sDate . "' OR valid_from = '0000-00-00' OR valid_from is NULL) AND
|
||||||
(valid_to >= '".$sDate."' OR valid_to = '0000-00-00' OR valid_to is NULL)",
|
(valid_to >= '" . $sDate . "' OR valid_to = '0000-00-00' OR valid_to is NULL)", $this->database_table, Contenido_Security::escapeDB($username, $this->db)
|
||||||
$this->database_table,
|
|
||||||
Contenido_Security::escapeDB($username, $this->db)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
$sMaintenanceMode = getSystemProperty('maintenance', 'mode');
|
$sMaintenanceMode = getSystemProperty('maintenance', 'mode');
|
||||||
|
@ -682,10 +650,7 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$this->db->query(sprintf("SELECT a.group_id AS group_id, a.perms AS perms " .
|
$this->db->query(sprintf("SELECT a.group_id AS group_id, a.perms AS perms " .
|
||||||
"FROM %s AS a, %s AS b WHERE a.group_id = b.group_id AND b.user_id = '%s'",
|
"FROM %s AS a, %s AS b WHERE a.group_id = b.group_id AND b.user_id = '%s'", $this->group_table, $this->member_table, $uid
|
||||||
$this->group_table,
|
|
||||||
$this->member_table,
|
|
||||||
$uid
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($perm != '') {
|
if ($perm != '') {
|
||||||
|
@ -723,10 +688,11 @@ class Contenido_Challenge_Crypt_Auth extends Auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
class Contenido_Frontend_Challenge_Crypt_Auth extends Auth {
|
||||||
{
|
|
||||||
public $classname = 'Contenido_Frontend_Challenge_Crypt_Auth';
|
public $classname = 'Contenido_Frontend_Challenge_Crypt_Auth';
|
||||||
public $lifetime = 15;
|
public $lifetime = 15;
|
||||||
public $magic = 'Frrobo123xxica'; ## Challenge seed
|
public $magic = 'Frrobo123xxica'; ## Challenge seed
|
||||||
|
@ -737,8 +703,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
public $member_table = '';
|
public $member_table = '';
|
||||||
public $nobody = true;
|
public $nobody = true;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
global $cfg;
|
global $cfg;
|
||||||
$this->database_table = $cfg['tab']['phplib_auth_user_md5'];
|
$this->database_table = $cfg['tab']['phplib_auth_user_md5'];
|
||||||
$this->fe_database_table = $cfg['tab']['frontendusers'];
|
$this->fe_database_table = $cfg['tab']['frontendusers'];
|
||||||
|
@ -746,8 +711,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
$this->member_table = $cfg['tab']['groupmembers'];
|
$this->member_table = $cfg['tab']['groupmembers'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_preauth()
|
public function auth_preauth() {
|
||||||
{
|
|
||||||
global $password;
|
global $password;
|
||||||
|
|
||||||
if ($password == '') {
|
if ($password == '') {
|
||||||
|
@ -759,8 +723,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
return $this->auth_validatelogin();
|
return $this->auth_validatelogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_loginform()
|
public function auth_loginform() {
|
||||||
{
|
|
||||||
global $sess, $challenge, $_PHPLIB, $client, $cfgClient;
|
global $sess, $challenge, $_PHPLIB, $client, $cfgClient;
|
||||||
|
|
||||||
$challenge = md5(uniqid($this->magic));
|
$challenge = md5(uniqid($this->magic));
|
||||||
|
@ -769,8 +732,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
include($cfgClient[$client]['path']['frontend'] . 'front_crcloginform.inc.php');
|
include($cfgClient[$client]['path']['frontend'] . 'front_crcloginform.inc.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth_validatelogin()
|
public function auth_validatelogin() {
|
||||||
{
|
|
||||||
global $username, $password, $challenge, $response, $auth_handlers, $client;
|
global $username, $password, $challenge, $response, $auth_handlers, $client;
|
||||||
|
|
||||||
$client = (int) $client;
|
$client = (int) $client;
|
||||||
|
@ -785,9 +747,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
$uid = false;
|
$uid = false;
|
||||||
|
|
||||||
/* Authentification via frontend users */
|
/* Authentification via frontend users */
|
||||||
$this->db->query(sprintf("SELECT idfrontenduser, password FROM %s WHERE username = '%s' AND idclient='$client' AND active='1'",
|
$this->db->query(sprintf("SELECT idfrontenduser, password FROM %s WHERE username = '%s' AND idclient='$client' AND active='1'", $this->fe_database_table, Contenido_Security::escapeDB(urlencode($username), $this->db)
|
||||||
$this->fe_database_table,
|
|
||||||
Contenido_Security::escapeDB(urlencode($username), $this->db)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($this->db->next_record()) {
|
if ($this->db->next_record()) {
|
||||||
|
@ -798,9 +758,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
|
|
||||||
if ($uid == false) {
|
if ($uid == false) {
|
||||||
/* Authentification via backend users */
|
/* Authentification via backend users */
|
||||||
$this->db->query(sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s'",
|
$this->db->query(sprintf("SELECT user_id, perms, password FROM %s WHERE username = '%s'", $this->database_table, Contenido_Security::escapeDB($username, $this->db)));
|
||||||
$this->database_table,
|
|
||||||
Contenido_Security::escapeDB($username, $this->db) ));
|
|
||||||
|
|
||||||
while ($this->db->next_record()) {
|
while ($this->db->next_record()) {
|
||||||
$uid = $this->db->f('user_id');
|
$uid = $this->db->f('user_id');
|
||||||
|
@ -821,10 +779,7 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
if ($uid !== false) {
|
if ($uid !== false) {
|
||||||
$this->db->query(sprintf("SELECT a.group_id AS group_id, a.perms AS perms " .
|
$this->db->query(sprintf("SELECT a.group_id AS group_id, a.perms AS perms " .
|
||||||
"FROM %s AS a, %s AS b WHERE a.group_id = b.group_id AND " .
|
"FROM %s AS a, %s AS b WHERE a.group_id = b.group_id AND " .
|
||||||
"b.user_id = '%s'",
|
"b.user_id = '%s'", $this->group_table, $this->member_table, $uid
|
||||||
$this->group_table,
|
|
||||||
$this->member_table,
|
|
||||||
$uid
|
|
||||||
));
|
));
|
||||||
|
|
||||||
/* Deactivated: Backend user would be sysadmin when logged on as frontend user
|
/* Deactivated: Backend user would be sysadmin when logged on as frontend user
|
||||||
|
@ -869,13 +824,13 @@ class Contenido_Frontend_Challenge_Crypt_Auth extends Auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an external auth handler
|
* Registers an external auth handler
|
||||||
*/
|
*/
|
||||||
function register_auth_handler($aHandlers)
|
function register_auth_handler($aHandlers) {
|
||||||
{
|
|
||||||
global $auth_handlers;
|
global $auth_handlers;
|
||||||
|
|
||||||
if (!is_array($auth_handlers)) {
|
if (!is_array($auth_handlers)) {
|
||||||
|
|
Laden…
In neuem Issue referenzieren