[pLog-svn] r4207 - plog/trunk

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Oct 29 16:41:31 GMT 2006


Author: oscar
Date: 2006-10-29 16:41:31 +0000 (Sun, 29 Oct 2006)
New Revision: 4207

Modified:
   plog/trunk/wizard.php
Log:
now the wizard will also load the list of permissions


Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-10-29 16:36:11 UTC (rev 4206)
+++ plog/trunk/wizard.php	2006-10-29 16:41:31 UTC (rev 4207)
@@ -981,6 +981,39 @@
             else
                 $message .= "The helper tool 'convert' (from the ImageMagick package) was found in $pathToConvert<br/>";
 
+            // Scan for locales
+            $locales = new Locales();
+            // find all the new locales that we have not yet stored
+            $f = new LocaleFinder();
+            $newLocaleCodes = $f->find();
+
+            foreach( $newLocaleCodes as $newLocaleCode ) {
+                $res = $locales->addLocale( $newLocaleCode );
+            }
+
+			// load the core permissions
+		    include_once( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
+
+		    // process permissions
+		    $total = 0;		
+		    foreach( $permissions as $perm ) {
+			    // check if it already exists
+			    $query = "SELECT * FROM ".Db::getPrefix()."permissions WHERE permission = '".$perm[0]."'";
+			    $result = $this->_db->Execute( $query );
+			    if( !$result || $result->RowCount() < 1 ) {
+				   	// permission needs to be added
+					$corePerm = ( $perm[2] == true ? 1 : 0 );
+					$adminOnly = ( $perm[3] == true ? 1 : 0 );
+
+					$query = "INSERT INTO ".Db::getPrefix()."permissions (permission,description,core_perm,admin_only) ".
+					          "VALUES ('".$perm[0]."','".$perm[1]."','".$corePerm."','".$adminOnly."')";
+
+					$this->_db->Execute( $query );
+					$total++;
+			    }
+		    }
+
+			// show some feedback
             if( $errors ) {
                 $this->_view = new WizardView( "step1" );
                 $this->setDbConfigValues( $this->_view );
@@ -992,18 +1025,6 @@
                 $this->_view = new WizardView( "step2" );
                 $this->_view->setValue( "message", $message );
             }
-
-            // Scan for locales
-            $locales = new Locales();
-            // find all the new locales that we have not yet stored
-            $f = new LocaleFinder();
-            $newLocaleCodes = $f->find();
-
-            foreach( $newLocaleCodes as $newLocaleCode ) {
-                $res = $locales->addLocale( $newLocaleCode );
-            }
-
-            return true;
         }
     }
 



More information about the pLog-svn mailing list