[Tutos-commits] SF.net SVN: tutos:[855] trunk/php
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
From: <gok...@us...> - 2012-12-04 08:41:16
|
Revision: 855 http://tutos.svn.sourceforge.net/tutos/?rev=855&view=rev Author: gokohnert Date: 2012-12-04 08:41:07 +0000 (Tue, 04 Dec 2012) Log Message: ----------- less errormessages with failed logins Modified Paths: -------------- trunk/php/database.pinc trunk/php/db/db.pinc trunk/php/login.pinc trunk/php/permission.p3 trunk/php/webelements.p3 Modified: trunk/php/database.pinc =================================================================== --- trunk/php/database.pinc 2012-12-03 12:11:51 UTC (rev 854) +++ trunk/php/database.pinc 2012-12-04 08:41:07 UTC (rev 855) @@ -137,8 +137,6 @@ * read a database result set */ function read_result (result $r, $pos ) { - global $g_hash; - $this->name = $r->get($pos, "name"); $this->alias = $r->get($pos, "dbalias"); $this->host = $r->get($pos, "dbhost"); @@ -170,7 +168,7 @@ /** */ function read($id,$obj) { - global $tutos, $current_user, $g_hash; + global $tutos; if ( -1 == $id ) return; @@ -331,6 +329,10 @@ function save() { global $tutos,$current_user,$table; + if ($this->type == DB_TYPE_FAKE) { + return; + } + $msg = $this->run_presave_hook(); if ( !is_object($this->dbconn) ) { Modified: trunk/php/db/db.pinc =================================================================== --- trunk/php/db/db.pinc 2012-12-03 12:11:51 UTC (rev 854) +++ trunk/php/db/db.pinc 2012-12-04 08:41:07 UTC (rev 855) @@ -342,6 +342,11 @@ /** * String Representation */ + abstract function getFullName(); + + /** + * String Representation + */ function __toString() { global $lang; @@ -844,6 +849,9 @@ } function Like2($fld,$name,$not=false) { } + function getFullName() { + return 'fake db'; + } } ?> \ No newline at end of file Modified: trunk/php/login.pinc =================================================================== --- trunk/php/login.pinc 2012-12-03 12:11:51 UTC (rev 854) +++ trunk/php/login.pinc 2012-12-04 08:41:07 UTC (rev 855) @@ -62,7 +62,7 @@ $r .= "\n<!-- PHP Version CHECK OK -->"; $r .= "\n<!-- ". phpversion() ." ". PHP_OS ." -->\n"; - $r .= '<form id="loginform" name="loginform" action="'. htmlentities($this->gotourl) ."\" method=\"post\">\n"; + $r .= '<form id="loginform" name="loginform" action="'. $this->gotourl ."\" method=\"post\">\n"; $r .= $this->SelectTableStart(); Modified: trunk/php/permission.p3 =================================================================== --- trunk/php/permission.p3 2012-12-03 12:11:51 UTC (rev 854) +++ trunk/php/permission.p3 2012-12-04 08:41:07 UTC (rev 855) @@ -179,7 +179,8 @@ // Problem with IE5 and download under https (mar...@us...) @session_cache_limiter('public'); if (session_id() == '') { - @session_start(); + $xxxx = @session_start(); + if (!$xxxx) error_log("session_start failed\n", 3, $tutos[errlog]); } // TODO: check ! @@ -443,6 +444,12 @@ $dbnr = 0; // default } $dbconn = DB_Open($dbnr); + if ($dbconn == null) { + $dbconn = DB_Open(-3); + $current_user = new tutos_user($dbconn); + ReadLang($lang); + $auth[0]->login_form($_SERVER['SCRIPT_NAME'],'No such database'); + } $current_user= new tutos_user($dbconn); // For login we use default language (via browser settings) @@ -745,9 +752,9 @@ $t2 = ' OR (t.adr_id='.$user_id.')'; } $query = 'SELECT DISTINCT i.* FROM ('.$query.') AS i' - .' left join '.$dbconn->prefix .'acl a on (i.'.$id_name.' = a.obj_id) ' - .$t1 - . 'WHERE (a.perm is null OR a.perm>='.$tutos[seeok].')' - .' AND ((a.adr_id is null) OR (a.adr_id='.$user_id.') OR (a.adr_id=0) OR (a.adr_id < 0)'. $t2 .' )'; + .' left join '.$dbconn->prefix .'acl a on (i.'.$id_name.' = a.obj_id) ' + .$t1 + . 'WHERE (a.perm is null OR a.perm>='.$tutos[seeok].')' + .' AND ((a.adr_id is null) OR (a.adr_id='.$user_id.') OR (a.adr_id=0) OR (a.adr_id < 0)'. $t2 .' )'; } ?> \ No newline at end of file Modified: trunk/php/webelements.p3 =================================================================== --- trunk/php/webelements.p3 2012-12-03 12:11:51 UTC (rev 854) +++ trunk/php/webelements.p3 2012-12-04 08:41:07 UTC (rev 855) @@ -55,8 +55,9 @@ } else { if ( isset($current_user->ly) && !empty($current_user->ly) ) { $ly = $current_user->ly; - } else - $ly = 'classic_layout'; + } else { + $ly = $tutos[layouts][0]; + } // use mobile layout if OK here if (isset($tutos['mobileok']) && $tutos['mobileok'] == 1 && $tutos['mobilely'] == 1) { @@ -223,24 +224,20 @@ * Read the language files. * Language is determined by looking at HTTP_ACCEPT_LANGUAGE in automatic mode */ -Function ReadLang1(array &$lang,$path,&$user) { +Function ReadLang1(array &$lang,$path,$user) { global $tutos,$dbconn; - // error_log($_SERVER["REQUEST_URI"] ." > ReadLang1:".count($lang)." ". $path ." ". $user->f_name ." ". $user->l_name ." ". $user->lang ."<br />\n",3,$tutos[errlog]); + if ( isset($user) ) { + if ($user->getType() != "user") { + echo "User Object required:".$user->getType() ." ". $user->getFullName() ."<br />\n"; + } - if (! isset($user) ) { - $user = new tutos_user($dbconn); + if ( isset($_REQUEST['lg']) ) { + $lg = strtolower($_REQUEST['lg']); + } else if ($user->lang != "auto" ) { + $lg = $user->lang; + } } - if ($user->getType() != "user") { - echo "User Object required:".$user->getType() ." ". $user->getFullName() ."<br />\n"; - } - - if ( isset($_REQUEST['lg']) ) { - $lg = strtolower($_REQUEST['lg']); - } else if ($user->lang != "auto" ) { - $lg = $user->lang; - } - if (isset($lg)) { $ok = false; if ( ("en-us" == $lg) && file_exists(getcwd()."/".$path ."/en.p3") && is_readable(getcwd()."/".$path ."/en.p3") ) { @@ -261,7 +258,7 @@ } } - $langs = ""; + $langs = ''; if ( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) { $langs = $_SERVER['HTTP_ACCEPT_LANGUAGE']; } @@ -328,16 +325,16 @@ ReadCustomLang($lang,"ru",$path); return ReadLangFinish($lang,$tok); } - if ( preg_match("#^pt#", $tok ) && file_exists(getcwd()."/".$path ."/pt-br.p3") ) { - include $path ."/pt-br.p3"; - ReadCustomLang($lang,"pt",$path); - return ReadLangFinish($lang,$tok); - } if ( preg_match("#^pt-br#", $tok ) && file_exists(getcwd()."/".$path ."/pt-br.p3") ) { include $path ."/pt-br.p3"; ReadCustomLang($lang,"pt-br",$path); return ReadLangFinish($lang,$tok); } + if ( preg_match("#^pt#", $tok ) && file_exists(getcwd()."/".$path ."/pt.p3") ) { + include $path ."/pt.p3"; + ReadCustomLang($lang,"pt",$path); + return ReadLangFinish($lang,$tok); + } if ( (preg_match("#^zh-tw#", $tok ) || preg_match("#^zh-hk#", $tok )) && file_exists(getcwd()."/".$path ."/tw.p3")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |