[geeklog-cvs] journal/admin install.php,1.2,1.3

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Thu Jul 31 13:58:42 EDT 2003


Update of /usr/cvs/geeklog/journal/admin
In directory geeklog_prod:/tmp/cvs-serv6552/admin

Modified Files:
	install.php 
Log Message:
This upgrade adds the ability to have RSS feeds for individual journals (plus various cleanups, moving text to the language file). Also includes and installs the Journal block now.


Index: install.php
===================================================================
RCS file: /usr/cvs/geeklog/journal/admin/install.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** install.php	30 Jul 2003 10:00:44 -0000	1.2
--- install.php	31 Jul 2003 17:58:40 -0000	1.3
***************
*** 34,40 ****
  // $Id$
  
! require_once('../../../lib-common.php');
! require_once($_CONF['path'] . 'plugins/journal/language/english.php');
! require_once($_CONF['path'] . 'plugins/journal/journal.cfg');
  
  // Only let Root users access this page
--- 34,45 ----
  // $Id$
  
! require_once ('../../../lib-common.php');
! $langfile = $_CONF['path'] . 'plugins/journal/language/' . $_CONF['language'] . '.php';
! if (file_exists ($langfile)) {
!     require_once ($langfile);
! } else {
!     require_once ($_CONF['path'] . 'plugins/journal/language/english.php');     
! }
! require_once ($_CONF['path'] . 'plugins/journal/journal.cfg');
  
  // Only let Root users access this page
***************
*** 51,54 ****
--- 56,67 ----
  }
   
+ function insert_plugin ()
+ {
+     global $_TABLES;
+ 
+     DB_delete ($_TABLES['plugins'], 'pi_name', 'journal');
+     DB_query ("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) VALUES ('journal', '" . JRN_VERSION . "', '1.3.8', 'http://project.geeklog.net/projects/journal/', 1)");
+ }
+ 
  /**
  * Puts the datastructures for this plugin into the Geeklog database
***************
*** 57,61 ****
  function plugin_install_journal()
  {
!     global $_TABLES, $_CONF, $_SP_CONF;
  
      COM_errorLog('Attempting to install the Journal Plugin',1);
--- 70,74 ----
  function plugin_install_journal()
  {
!     global $_TABLES, $_CONF, $LANG_JOURNAL;
  
      COM_errorLog('Attempting to install the Journal Plugin',1);
***************
*** 71,74 ****
--- 84,88 ----
          . "jrn_date datetime,"
          . "jrn_iscurrent tinyint(3) unsigned DEFAULT '0' NOT NULL,"
+         . "jrn_feed tinyint(1) unsigned DEFAULT '0' NOT NULL,"
          . "PRIMARY KEY (jrn_id)"
          . ")";
***************
*** 127,131 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 141,144 ----
***************
*** 137,141 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 150,153 ----
***************
*** 150,154 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      $edit_id = DB_insertId();
--- 162,165 ----
***************
*** 161,165 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      $delete_id = DB_insertId();
--- 172,175 ----
***************
*** 172,176 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 182,185 ----
***************
*** 181,185 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 190,193 ----
***************
*** 191,198 ****
          plugin_uninstall_journal();
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
  
      // Register the plugin with Geeklog
      if (DB_count($_TABLES['plugins'],'pi_name','journal') > 0) {
--- 199,213 ----
          plugin_uninstall_journal();
          return false;
      }
      COM_errorLog('...success',1);
  
+     COM_errorLog ('Attempting to add the Journal block', 1);
+     DB_query ("INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, tid, onleft, phpblockfn) VALUES (1, 'journal_block', 'phpblock', '{$LANG_JOURNAL['block_title']}', 'all', 0, 'phpblock_journal')");
+     if (DB_error ()) {
+         plugin_uninstall_journal ();
+         return false;
+     }
+     COM_errorLog ('...success', 1);
+ 
      // Register the plugin with Geeklog
      if (DB_count($_TABLES['plugins'],'pi_name','journal') > 0) {
***************
*** 211,219 ****
  
      COM_errorLog('Registering Journal plugin with Geeklog', 1);
!     DB_delete($_TABLES['plugins'],'pi_name','journal');
!     DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) "
!         . "VALUES ('journal', '" . JRN_VERSION . "', '1.3.8', 'http://project.geeklog.net/projects/journal/', 1)");
!     DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('journal','1')");
! 
      if (DB_error()) {
          plugin_uninstall_journal();
--- 226,230 ----
  
      COM_errorLog('Registering Journal plugin with Geeklog', 1);
!     insert_plugin ();
      if (DB_error()) {
          plugin_uninstall_journal();
***************
*** 227,230 ****
--- 238,268 ----
  }
  
+ function plugin_upgrade_journal ($current)
+ {
+     global $_TABLES, $LANG_JOURNAL;
+ 
+     $version = $current;
+ 
+     while ($version != JRN_VERSION) {
+         switch ($version) {
+             case '0.1':
+             case '0.1.1':
+             case '0.1.2': {
+                 DB_query ("ALTER TABLE {$_TABLES['journal']} ADD jrn_feed tinyint(1) unsigned DEFAULT '0' NOT NULL");
+                 DB_query ("INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, tid, onleft, phpblockfn) VALUES (1, 'journal_block', 'phpblock', '{$LANG_JOURNAL['block_title']}', 'all', 0, 'phpblock_journal')");
+                 $version = '0.2';
+             }
+             break;
+ 
+             default: {
+                 $version = JRN_VERSION;
+             }
+         }
+     }
+ 
+     // upgrade entry in 'plugins' table
+     insert_plugin ();
+ }
+ 
  function showMessage ($msg)
  {        
***************
*** 265,271 ****
  } else {
      // plugin already installed
!     $display .= COM_startBlock ($LANG32[6])
!              . '<p>' . $LANG32[7] . '</p>'
!              . COM_endBlock ();
  }
  
--- 303,319 ----
  } else {
      // plugin already installed
!     $v = DB_getItem ($_TABLES['plugins'], 'pi_version', "pi_name = 'journal'");
!     $vx = explode ('.', $v);
!     $vn = explode ('.', JRN_VERSION);
!     if (($vn[0] > $vx[0]) || (($vn[0] == $vx[0]) && ($vn[1] > $vx[1])) ||
!         (($vn[0] == $vx[0]) && ($vn[1] == $vx[1]) && ($vn[2] > $vx[2]))) {
!         plugin_upgrade_journal ($v);
!         $display = COM_refresh ($_CONF['site_admin_url']
!                                 . '/plugins.php?msg=44');
!     } else {
!         $display .= COM_startBlock ($LANG32[6])
!                  . '<p>' . $LANG32[7] . '</p>'
!                  . COM_endBlock ();
!     }
  }
  





More information about the geeklog-cvs mailing list