[geeklog-cvs] Geeklog-1.x/plugins/staticpages install_defaults.php, NONE, 1.1 functions.inc, 1.107, 1.108 config.php, 1.21, NONE

Blaine Lang blaine at qs1489.pair.com
Thu Jan 3 21:15:30 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/plugins/staticpages
In directory qs1489.pair.com:/tmp/cvs-serv24429

Modified Files:
	functions.inc 
Added Files:
	install_defaults.php 
Removed Files:
	config.php 
Log Message:
Upgrades to support ver1.5 installation and upgrade. Removed config.php so that if upgrading, sites config.php not over-written. Added new file install_defaults.php for initial installation defaults for the online config records.

Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/staticpages/functions.inc,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** functions.inc	3 Jan 2008 23:58:47 -0000	1.107
--- functions.inc	4 Jan 2008 02:15:28 -0000	1.108
***************
*** 15,19 ****
  // | Authors: Tony Bibbs       - tony AT tonybibbs DOT com                     |
  // |          Tom Willett      - twillett AT users DOT sourceforge DOT net     |
! // |          Blaine Lang      - langmail AT sympatico DOT ca                  |
  // |          Dirk Haun        - dirk AT haun-online DOT de                    |
  // +---------------------------------------------------------------------------+
--- 15,19 ----
  // | Authors: Tony Bibbs       - tony AT tonybibbs DOT com                     |
  // |          Tom Willett      - twillett AT users DOT sourceforge DOT net     |
! // |          Blaine Lang      - blaine AT portalparts DOT com                 |
  // |          Dirk Haun        - dirk AT haun-online DOT de                    |
  // +---------------------------------------------------------------------------+
***************
*** 50,63 ****
  }
  
  if (file_exists("{$plugin_path}config.php")) {
     include $plugin_path . 'config.php';
!    $_SP_CONF['version'] = '1.5';
! } else {
      require_once $_CONF['path_system'] . 'classes/config.class.php';
      $sp_config = config::get_instance();
      $sp_config->initConfig();
  
!     $LANG_configsubgroups['staticpages'][0] = 'Static Pages Main Settings';
!     $LANG_fs['staticpages'][0] = 'Static Pages Main Settings';
  
      $_SP_CONF = $sp_config->get_config('staticpages');
--- 50,66 ----
  }
  
+ /* As of version 1.5 - plugins config.php is not needed and should be removed after upgrading */
  if (file_exists("{$plugin_path}config.php")) {
     include $plugin_path . 'config.php';
! }
! 
! // Check and see if we need to load the plugin configuration
! if (!isset($_SP_CONF['allow_php'])) {
      require_once $_CONF['path_system'] . 'classes/config.class.php';
      $sp_config = config::get_instance();
      $sp_config->initConfig();
  
!     $LANG_configsubgroups['staticpages'][0] = $LANG_STATIC['config_menubar'];
!     $LANG_fs['staticpages'][0] = $LANG_STATIC['config_menu1'];
  
      $_SP_CONF = $sp_config->get_config('staticpages');
***************
*** 1029,1062 ****
  
      if ($pi_version == '1.4.3') {  // Need to initialize the config table - GL 1.5+ feature
!         require_once $_CONF['path_system'] . 'classes/config.class.php';
!         $sp_config = config::get_instance();
!         $sp_config->initConfig();
!         if(! $sp_config->group_exists('staticpages')){
!             $sp_config->add('version', '1.5', 'text', 0, 0, null, 0, true, 'staticpages');
!             $sp_config->add('allow_php', $_SP_CONF['allow_php'], 'text', 0, 0, null, 10, true, 'staticpages');
!             $sp_config->add('sort_by', $_SP_CONF['sort_by'],  'text', 0, 0, null, 20, true, 'staticpages');
!             $sp_config->add('sort_menu_by', $_SP_CONF['sort_menu_by'], 'text', 0, 0, null, 30, true, 'staticpages');
!             $sp_config->add('delete_pages', $_SP_CONF['delete_pages'] , 'text', 0, 0, null, 40, true, 'staticpages');
!             $sp_config->add('in_block', $_SP_CONF['in_block'], 'text', 0, 0, null, 50, true, 'staticpages');
!             $sp_config->add('show_hits', $_SP_CONF['show_hits'], 'text', 0, 0, null, 60, true, 'staticpages');
!             $sp_config->add('show_date', $_SP_CONF['show_date'], 'text', 0, 0, null, 70, true, 'staticpages');
!             $sp_config->add('filter_html', $_SP_CONF['filter_html'], 'text', 0, 0, null, 80, true, 'staticpages');
!             $sp_config->add('censor', $_SP_CONF['censor'], 'text', 0, 0, null, 90, true, 'staticpages');
!             $sp_config->add('default_permissions', $_SP_CONF['default_permissions'], '@text', 0, 0, null, 100, true, 'staticpages');
  
!             $sp_config->add('aftersave', 'item', 'text', 0, 0, null, 110, true, 'staticpages');
!             $sp_config->add('atom_max_items', 10, 'text', 0, 0, null, 120, true, 'staticpages');
  
!             // Rename the existing config.php as it's not needed now
!             $ret = @rename ("{$plugin_path}config.php","{$plugin_path}config-pre1.4.3.php");
!             if (!$ret) {
!                 COM_errorLog("Staticpages upgrade to 1.5 error - unable to rename plugins config.php to complete upgrade");
!                 return '3003';
!             } elseif($sp_config->group_exists('staticpages')){
!                 DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '1.5' WHERE pi_name = 'staticpages'");
!             } else {
!                 COM_errorLog("Staticpages upgrade to 1.5 failed");
!                 return '3001';
              }
          }
  
--- 1032,1070 ----
  
      if ($pi_version == '1.4.3') {  // Need to initialize the config table - GL 1.5+ feature
!         if (file_exists("{$plugin_path}config.php")) {
!             require_once $_CONF['path_system'] . 'classes/config.class.php';
!             $sp_config = config::get_instance();
!             $sp_config->initConfig();
!             if(! $sp_config->group_exists('staticpages')){
!                 $sp_config->add('version', '1.5', 'text', 0, 0, null, 0, true, 'staticpages');
!                 $sp_config->add('allow_php', $_SP_CONF['allow_php'], 'text', 0, 0, null, 10, true, 'staticpages');
!                 $sp_config->add('sort_by', $_SP_CONF['sort_by'],  'text', 0, 0, null, 20, true, 'staticpages');
!                 $sp_config->add('sort_menu_by', $_SP_CONF['sort_menu_by'], 'text', 0, 0, null, 30, true, 'staticpages');
!                 $sp_config->add('delete_pages', $_SP_CONF['delete_pages'] , 'text', 0, 0, null, 40, true, 'staticpages');
!                 $sp_config->add('in_block', $_SP_CONF['in_block'], 'text', 0, 0, null, 50, true, 'staticpages');
!                 $sp_config->add('show_hits', $_SP_CONF['show_hits'], 'text', 0, 0, null, 60, true, 'staticpages');
!                 $sp_config->add('show_date', $_SP_CONF['show_date'], 'text', 0, 0, null, 70, true, 'staticpages');
!                 $sp_config->add('filter_html', $_SP_CONF['filter_html'], 'text', 0, 0, null, 80, true, 'staticpages');
!                 $sp_config->add('censor', $_SP_CONF['censor'], 'text', 0, 0, null, 90, true, 'staticpages');
!                 $sp_config->add('default_permissions', $_SP_CONF['default_permissions'], '@text', 0, 0, null, 100, true, 'staticpages');
  
!                 $sp_config->add('aftersave', $_SP_CONF['aftersave'], 'text', 0, 0, null, 110, true, 'staticpages');
!                 $sp_config->add('atom_max_items', $_SP_CONF['atom_max_items'], 'text', 0, 0, null, 120, true, 'staticpages');
  
!                 // Rename the existing config.php as it's not needed now
!                 $ret = @rename ("{$plugin_path}config.php","{$plugin_path}config-pre1.4.3.php");
!                 if (!$ret) {
!                     COM_errorLog("Staticpages upgrade to 1.5 error - unable to rename plugins config.php to complete upgrade");
!                     return '3003';
!                 } elseif($sp_config->group_exists('staticpages')){
!                     DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '1.5' WHERE pi_name = 'staticpages'");
!                 } else {
!                     COM_errorLog("Staticpages upgrade to 1.5 failed");
!                     return '3001';
!                 }
              }
+         } else {
+             COM_errorLog("Staticpages upgrade to 1.5 failed - missing plugins config.php");
+             return '3004';
          }
  

--- config.php DELETED ---

--- NEW FILE: install_defaults.php ---
<?php
/* Intial Installation Defaults used when loading the online configuration records
*  These settings are only used during the initial installation and not referenced
*  once the plugin is installed
*/


// If you don't plan on using PHP code in static pages, you should set this
// to 0, thus disabling the execution of PHP.

$_SP_DEFAULT['allow_php'] = 1;


// If you have more than one static page that is to be displayed in Geeklog's
// center area, you can specify how to sort them:

$_SP_DEFAULT['sort_by'] = 'id'; // can be 'id', 'title', 'date'


// sort the static pages that are listed in the site's menu
// (assuming you're using a theme that uses the {plg_menu_elements} variable)

$_SP_DEFAULT['sort_menu_by'] = 'label'; // can be 'id', 'label', 'title', 'date'


// When a user is deleted, ownership of static pages created by that user can
// be transfered to a user in the Root group (= 0) or the pages can be
// deleted (= 1).
$_SP_DEFAULT['delete_pages'] = 0;

/** What to show after a page has been saved? Possible choices:
 * 'item' -> forward to the static page
 * 'list' -> display the admin-list of the static pages
 * 'home' -> display the site homepage
 * 'admin' -> display the site admin homepage
 */
$_SP_DEFAULT['aftersave'] = 'item';

// Static pages can optionally be wrapped in a block. This setting defines
// the default for that option (1 = wrap in a block, 0 = don't).
$_SP_DEFAULT['in_block'] = 1;

// Do you want to show the hits on static pages?
// the default for that option (1 = show hits, 0 = don't).
$_SP_DEFAULT['show_hits'] = 1;

// Do you want to show the last update date/time on static pages?
// the default for that option (1 = show date, 0 = don't).
$_SP_DEFAULT['show_date'] = 1;

// If you experience timeout issues, you may need to set both of the
// following values to 0 as they are intensive

// NOTE: using filter_html will render any blank pages useless
$_SP_DEFAULT['filter_html'] = 0;
$_SP_DEFAULT['censor'] = 1;

// Define default permissions for new pages created from the Admin panel.
// Permissions are perm_owner, perm_group, perm_members, perm_anon (in that
// order). Possible values:
// 3 = read + write permissions (perm_owner and perm_group only)
// 2 = read-only
// 0 = neither read nor write permissions
// (a value of 1, ie. write-only, does not make sense and is not allowed)
$_SP_DEFAULT['default_permissions'] = array (3, 2, 2, 2);

// The maximum number of items displayed when an Atom feed is requested
$_SP_DEFAULT['atom_max_items'] = 10;

?>



More information about the geeklog-cvs mailing list