[geeklog-cvs] geeklog-1.3/public_html/admin/install install.php,1.42,1.43

dhaun at geeklog.net dhaun at geeklog.net
Sun Mar 9 06:47:24 EST 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin/install
In directory internal.geeklog.net:/tmp/cvs-serv30721/public_html/admin/install

Modified Files:
	install.php 
Log Message:
Integrated Static Pages 1.3


Index: install.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/install/install.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** install.php	17 Feb 2003 21:18:44 -0000	1.42
--- install.php	9 Mar 2003 11:47:22 -0000	1.43
***************
*** 47,51 ****
  }
  if (!defined ('VERSION')) {
!     define('VERSION', '1.3.7');
  }
  
--- 47,51 ----
  }
  if (!defined ('VERSION')) {
!     define('VERSION', '1.3.8');
  }
  
***************
*** 138,142 ****
          $db_templates->set_var('upgrade',1);
          // They already have a lib-database file...they can't change their tables names
!         $old_versions = array('1.2.5-1','1.3','1.3.1','1.3.2','1.3.2-1','1.3.3','1.3.4','1.3.5','1.3.6');
          $versiondd = '<tr><td align="right"><b>Current Geeklog Version:</b></td><td><select name="version">';
          for ($j = 1; $j <= count($old_versions); $j++) {
--- 138,142 ----
          $db_templates->set_var('upgrade',1);
          // They already have a lib-database file...they can't change their tables names
!         $old_versions = array('1.2.5-1','1.3','1.3.1','1.3.2','1.3.2-1','1.3.3','1.3.4','1.3.5','1.3.6','1.3.7');
          $versiondd = '<tr><td align="right"><b>Current Geeklog Version:</b></td><td><select name="version">';
          for ($j = 1; $j <= count($old_versions); $j++) {
***************
*** 211,214 ****
--- 211,240 ----
  }
  
+ 
+ /*
+ * Checks for Static Pages Version
+ *
+ * @return   1 if Static Pages 1.1 by Phill or 1.2 by Tom, 0 if original Static Pages
+ *
+ */
+ function get_SP_Ver()
+ {
+     global $_TABLES;
+ 
+     $result = DB_query ("SELECT * FROM {$_TABLES['staticpage']}");
+     $A = DB_fetchArray ($result);
+     $fields = array ();
+     foreach ($A as $name => $value) {
+         $fields[] = $name;
+     }
+     if (in_array ('sp_pos',$fields,true)) {  
+         $retval = 1;
+     } else {
+         $retval = 0;
+     }
+ 
+     return $retval;
+ }
+ 
  function INST_doDatabaseUpgrades($current_gl_version, $table_prefix) {
      global $_TABLES, $_CONF, $_DB_dbms, $_DB_table_prefix;
***************
*** 361,364 ****
--- 387,424 ----
  
              $current_gl_version = '1.3.7';
+             $_SQL = '';
+             break;
+         case '1.3.7':
+             // upgrade Static Pages plugin
+             $spversion = get_SP_ver ();
+             if ($spversion == 0) { // original version
+                 DB_query ("ALTER TABLE {$_TABLES['staticpage']} "
+                     . "ADD COLUMN group_id mediumint(8) unsigned DEFAULT '1',"
+                     . "ADD COLUMN owner_id mediumint(8) unsigned DEFAULT '1',"
+                     . "ADD COLUMN perm_owner tinyint(1) unsigned DEFAULT '3',"
+                     . "ADD COLUMN perm_group tinyint(1) unsigned DEFAULT '3',"
+                     . "ADD COLUMN perm_members tinyint(1) unsigned DEFAULT '2',"
+                     . "ADD COLUMN perm_anon tinyint(1) unsigned DEFAULT '2',"
+                     . "ADD COLUMN sp_php tinyint(1) unsigned DEFAULT '0',"
+                     . "ADD COLUMN sp_nf tinyint(1) unsigned DEFAULT '0'");
+                 DB_query ("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) VALUES ('staticpages.php','Ability to use PHP in static pages')");
+                 $php_id = DB_insertId ();
+                 $group_id = DB_getItem ($_TABLES['groups'], 'grp_id', "grp_name = 'Static Page Admin'");
+                 DB_query ("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($php_id, $group_id)");
+             } else { // extended version by Phill or Tom
+                 DB_query ("ALTER TABLE {$_TABLES['staticpage']} "
+                     . "DROP COLUMN sp_pos,"
+                     . "DROP COLUMN sp_search_keywords,"
+                     . "ADD COLUMN sp_nf tinyint(1) unsigned DEFAULT '0'");
+             }
+             DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '1.3' WHERE pi_name = 'staticpages'");
+ 
+             // remove Static Pages 'lock' flag
+             DB_query ("DELETE FROM {$_TABLES['vars']} WHERE name = 'staticpages'");
+ 
+             // remove Static Pages Admin group id
+             DB_query ("DELETE FROM {$_TABLES['vars']} WHERE name = 'sp_group_id'");
+ 
+             $current_gl_version = '1.3.8';
              $_SQL = '';
              break;





More information about the geeklog-cvs mailing list