2erlei/app/modules/basecontent/model.php

62 lines
1.6 KiB
PHP

<?php
/**
* basecontent-model
*
* Enthält die Basisfunktionen von basecontent.
*
* Klasse basecontent_model
*
* @package baseContent
* @subpackage basecontent
*/
class app_basecontent_model extends fl_model {
function login($fl) {
if ( isset($fl['username'], $fl['password'])
AND $this->login_right( addslashes($fl['username']), addslashes($fl['password']) )
AND !isset($_SESSION['username'])
) {
return TRUE;
} elseif ( $this->login_right( addslashes($fl['username']), addslashes($fl['password']) ) == 0) {
return FALSE;
}
if($_SESSION['IP'] != $_SERVER['REMOTE_ADDR'])
die('Falsche Sessiondaten, bitte erneut einloggen.');
}
function login_right($user, $pass) {
$result = $this->datamodel->retrieve('user','COUNT(*) as anzahl',"name = '".$user."' AND password = MD5('".$pass."')");
return $result['anzahl'];
}
function get_trashcan_data($modules) {
$trashcan_data = array();
foreach( $modules as $name => $module ) {
$controller = str_replace('_LANG', '', $module);
$controller = str_replace('_', '', $controller);
$module = str_replace('LANG', LANG, $module);
$sql = 'SELECT * FROM fl_'.$module.' WHERE status = 2;';
$data[$module] = $this->datamodel->_query_db($sql);
if ( isset($data[$module]['id']) ) {
$tmp = $data[$module];
unset($data);
$data[$module][] = $tmp;
}
$data[$module]['title'] = $name;
$data[$module]['controller'] = $controller;
if ( count( $data[$module] ) <= 2 ) continue;
$trashcan_data += $data;
}
return $trashcan_data;
}
}
?>