Added better checking for wonky databases

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.1.0@42587 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-09-25 23:16:04 +00:00
parent c876c45f66
commit 55510e15fa
2 changed files with 4 additions and 3 deletions

View File

@ -269,15 +269,15 @@ class Controller extends ViewableData {
*/ */
function init() { function init() {
// Test and development sites should be secured, via basic-auth // Test and development sites should be secured, via basic-auth
if(ClassInfo::ready() && ClassInfo::hasTable("Member") && Director::isTest() && $this->basicAuthEnabled) { if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && Director::isTest() && $this->basicAuthEnabled) {
BasicAuth::requireLogin("SilverStripe test website. Use your CMS login", "ADMIN"); BasicAuth::requireLogin("SilverStripe test website. Use your CMS login", "ADMIN");
} }
// //
Cookie::set("PastVisitor", true); Cookie::set("PastVisitor", true);
// ClassInfo::ready() called to ensure that we're not in a very-first-setup stage // ClassInfo::hasTable() called to ensure that we're not in a very-first-setup stage
if(ClassInfo::ready() && ClassInfo::hasTable("Member") && ($member = Member::currentUser())) { if(ClassInfo::hasTable("Group") && ClassInfo::hasTable("Member") && ($member = Member::currentUser())) {
Cookie::set("PastMember", true); Cookie::set("PastMember", true);
DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null); DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null);
} }

View File

@ -167,6 +167,7 @@ class Folder extends File {
} }
if(Member::currentUser()) $ownerID = Member::currentUser()->ID; if(Member::currentUser()) $ownerID = Member::currentUser()->ID;
else $ownerID = 0;
$filename = addslashes($this->Filename . $name); $filename = addslashes($this->Filename . $name);
if($className == 'Folder' ) $filename .= '/'; if($className == 'Folder' ) $filename .= '/';