[geeklog-cvs] geeklog-1.3/public_html/admin/plugins/staticpages index.php,1.14,1.15 install.php,1.8,1.9

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/plugins/staticpages
In directory internal.geeklog.net:/tmp/cvs-serv30721/public_html/admin/plugins/staticpages

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


Index: index.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/plugins/staticpages/index.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** index.php	29 Jan 2003 17:08:52 -0000	1.14
--- index.php	9 Mar 2003 11:47:22 -0000	1.15
***************
*** 3,7 ****
  /* Reminder: always indent with 4 spaces (no tabs). */
  // +---------------------------------------------------------------------------+
! // | Static Pages Geeklog Plugin 0.1                                           |
  // +---------------------------------------------------------------------------+
  // | index.php                                                                 |
--- 3,7 ----
  /* Reminder: always indent with 4 spaces (no tabs). */
  // +---------------------------------------------------------------------------+
! // | Static Pages Geeklog Plugin 1.3                                           |
  // +---------------------------------------------------------------------------+
  // | index.php                                                                 |
***************
*** 9,15 ****
  // |                                                                           |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000,2001 by the following authors:                         |
  // |                                                                           |
  // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 9,17 ----
  // |                                                                           |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2003 by the following authors:                         |
  // |                                                                           |
  // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
+ // |          Phill Gillespie  - phill at mediaaustralia.com.au                   |
+ // |          Tom Willett      - twillett at users.sourceforge.net
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 55,62 ****
  function form($A, $error=false) 
  {
! 	global $_TABLES, $PHP_SELF, $_CONF, $HTTP_POST_VARS, $_USER, $LANG_STATIC,$_SP_CONF;
  
      $retval = '';
  
      if ($error) {
          $retval .= $error . "<br><br>";
--- 57,81 ----
  function form($A, $error=false) 
  {
! 	global $_TABLES, $PHP_SELF, $_CONF, $HTTP_POST_VARS, $_USER, $LANG_STATIC,$_SP_CONF, $LANG_ACCESS, $mode, $sp_id;
  
+ 	if (!empty($sp_id) && $mode=='edit') {
+     	$access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
+ 	} else {
+     	$A['owner_id'] = $_USER['uid'];
+ 		$A['group_id'] = DB_getItem($_TABLES['groups'],'grp_id',"grp_name = 'Static Page Admin'");
+ 		$A['perm_owner'] = 3;
+ 		$A['perm_group'] = 3;
+ 		$A['perm_members'] = 2;
+ 		$A['perm_anon'] = 2;
+ 		$access = 3;
+ 	}
      $retval = '';
  
+     if (empty($A['owner_id'])) {
+ 	    $error = COM_startBlock($LANG_ACCESS['accessdenied']);
+     	$error .= $LANG_STATIC['deny_msg'];
+ 	    $error .= COM_endBlock();
+     }
+     
      if ($error) {
          $retval .= $error . "<br><br>";
***************
*** 64,71 ****
          $sp_template = new Template($_CONF['path'] . 'plugins/staticpages/templates/admin');
          if (($_CONF['advanced_editor'] == 1) && file_exists ($_CONF['path'] . 'plugins/staticpages/templates/admin/editor_advanced.thtml')) {
!             $sp_template->set_file('form','editor_advanced.thtml');
          } else {
!             $sp_template->set_file('form','editor.thtml');
          }
          $sp_template->set_var('site_url', $_CONF['site_url']);
          $sp_template->set_var('site_admin_url', $_CONF['site_admin_url']);
--- 83,118 ----
          $sp_template = new Template($_CONF['path'] . 'plugins/staticpages/templates/admin');
          if (($_CONF['advanced_editor'] == 1) && file_exists ($_CONF['path'] . 'plugins/staticpages/templates/admin/editor_advanced.thtml')) {
!             $sp_template->set_file ('form', 'editor_advanced.thtml');
          } else {
!             $sp_template->set_file ('form', 'editor.thtml');
          }
+         $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
+     	$sp_template->set_var('lang_owner', $LANG_ACCESS['owner']);
+ 		$sp_template->set_var('owner_username', DB_getItem($_TABLES['users'],'username',"uid = {$A['owner_id']}"));
+ 		$sp_template->set_var('owner_id', $A['owner_id']);
+    		$sp_template->set_var('lang_group', $LANG_ACCESS['group']);
+     	$usergroups = SEC_getUserGroups();
+     	if ($access == 3) {
+ 			$groupdd .= '<select name="group_id">';
+         	for ($i = 0; $i < count($usergroups); $i++) {
+             	$groupdd .= '<option value="' . $usergroups[key($usergroups)] . '"';
+             	if ($A['group_id'] == $usergroups[key($usergroups)]) {
+                 	$groupdd .= ' SELECTED';
+             	}
+             	$groupdd .= '>' . key($usergroups) . '</option>';
+             	next($usergroups);
+         	}
+         	$groupdd .= '</select>';
+     	} else {
+         	// they can't set the group then
+         	$groupdd .= DB_getItem($_TABLES['groups'],'grp_name',"grp_id = {$A['group_id']}");
+         	$groupdd .= '<input type="hidden" name="group_id" value="' . $A['group_id'] . '">';
+     	}
+     	$sp_template->set_var('group_dropdown', $groupdd);
+     	$sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));
+     	$sp_template->set_var('lang_permissions', $LANG_ACCESS['permissions']);
+     	$sp_template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
+     	$sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));
+ 		$sp_template->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
          $sp_template->set_var('site_url', $_CONF['site_url']);
          $sp_template->set_var('site_admin_url', $_CONF['site_admin_url']);
***************
*** 81,86 ****
          $sp_template->set_var('username', DB_getItem($_TABLES['users'],'username',"uid = {$A["sp_uid"]}"));
          $sp_template->set_var('sp_uid', $A['sp_uid']);
  
! 		$curtime = COM_getUserDateTimeFormat();
  
          $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']);
--- 128,156 ----
          $sp_template->set_var('username', DB_getItem($_TABLES['users'],'username',"uid = {$A["sp_uid"]}"));
          $sp_template->set_var('sp_uid', $A['sp_uid']);
+         if (SEC_hasRights ('staticpages.PHP')) {
+             if ($A['sp_php'] == 1) {
+     	        $sp_template->set_var('php_checked','checked');
+     	        $sp_template->set_var('php_type','checkbox');
+             } else {
+                 $sp_template->set_var('php_checked','');
+             }
+             $sp_template->set_var('php_type','checkbox');
+             $sp_template->set_var('php_warn',$LANG_STATIC['php_warn']);
+             $sp_template->set_var('php_msg',$LANG_STATIC['php_msg']);
+         } else {
+   	    $sp_template->set_var('php_type','hidden');
+             $sp_template->set_var('php_warn','');
+             $sp_template->set_var('php_msg','');
+             $sp_template->set_var('php_checked','');
+         }
+         $sp_template->set_var('exit_msg',$LANG_STATIC['exit_msg']);
+         if ($A['sp_nf'] == 1) {
+             $sp_template->set_var('exit_checked','checked');
+         } else {
+             $sp_template->set_var('exit_checked','');
+         }
+         $sp_template->set_var('exit_info',$LANG_STATIC['exit_info']);
  
!         $curtime = COM_getUserDateTimeFormat();
  
          $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']);
***************
*** 156,160 ****
  
  	if (!empty($sp_id) && $mode == 'edit') {
! 		$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '$sp_id'");
  		$A = DB_fetchArray($result);
  	} elseif ($mode == 'edit') {
--- 226,230 ----
  
  	if (!empty($sp_id) && $mode == 'edit') {
! 		$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE sp_id = '$sp_id' AND " . SP_getPerms('','3'));
  		$A = DB_fetchArray($result);
  	} elseif ($mode == 'edit') {
***************
*** 195,199 ****
  	//$limit = (50 * $page) - 50;
  	//$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} ORDER BY sp_date DESC LIMIT $limit,50");
! 	$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} ORDER BY sp_date DESC");
  	$nrows = DB_numRows($result);
  	if ($nrows > 0) {
--- 265,269 ----
  	//$limit = (50 * $page) - 50;
  	//$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} ORDER BY sp_date DESC LIMIT $limit,50");
! 	$result = DB_query("SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate FROM {$_TABLES['staticpage']} WHERE " . SP_getPerms('','3') . " ORDER BY sp_date DESC");
  	$nrows = DB_numRows($result);
  	if ($nrows > 0) {
***************
*** 248,254 ****
  * @sp_hits      int         Number of page views
  * @sp_format    string      HTML or plain text
  *
  */
! function submitstaticpage($sp_id,$sp_uid,$sp_title,$sp_content,$unixdate,$sp_hits,$sp_format, $sp_onmenu, $sp_label)
  {
  	global $_CONF, $LANG12, $LANG_STATIC, $_SP_CONF, $_TABLES;
--- 318,333 ----
  * @sp_hits      int         Number of page views
  * @sp_format    string      HTML or plain text
+ * @sp_onmenu    int         Flag to place entry on menu
+ * @sp_label     string      Menu Entry
+ * @owner_id     int         Permission bits
+ * @group_id     int
+ * @perm_owner   int
+ * @perm_members int
+ * @perm_anon    int
+ * @sp_php       int         Flag to indicate PHP usage
+ * @sp_nf        int         Flag to indicate type of not found message
  *
  */
! function submitstaticpage($sp_id,$sp_uid,$sp_title,$sp_content,$unixdate,$sp_hits,$sp_format, $sp_onmenu, $sp_label, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon, $sp_php, $sp_nf)
  {
  	global $_CONF, $LANG12, $LANG_STATIC, $_SP_CONF, $_TABLES;
***************
*** 284,288 ****
  		//$sp_label = addslashes(htmlspecialchars(strip_tags(COM_checkWords($sp_label))));
  
! 		DB_save($_TABLES['staticpage'],'sp_id,sp_uid,sp_title,sp_content,sp_date,sp_hits,sp_format,sp_onmenu,sp_label',"'$sp_id',$sp_uid,'$sp_title','$sp_content','$date',$sp_hits,'$sp_format',$sp_onmenu,'$sp_label'",$_CONF['site_admin_url'] . '/plugins/staticpages/index.php');
  
  	} else {
--- 363,372 ----
  		//$sp_label = addslashes(htmlspecialchars(strip_tags(COM_checkWords($sp_label))));
  
!         //If user does not have php edit perms, then set php flag to 0.
!         if (!SEC_hasRights('staticpages.PHP')) {
! 	        $sp_php='0';
!         }
!         list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);		
! 		DB_save($_TABLES['staticpage'],'sp_id,sp_uid,sp_title,sp_content,sp_date,sp_hits,sp_format,sp_onmenu,sp_label,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,sp_php,sp_nf',"'$sp_id',$sp_uid,'$sp_title','$sp_content','$date',$sp_hits,'$sp_format',$sp_onmenu,'$sp_label',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,'$sp_php','$sp_nf'",$_CONF['site_admin_url'] . '/plugins/staticpages/index.php');
  
  	} else {
***************
*** 315,319 ****
      $display .= COM_siteFooter();
  } else if (($mode == $LANG_STATIC['save']) && !empty ($LANG_STATIC['save'])) {
!     submitstaticpage($sp_id,$sp_uid,$sp_title,$sp_content,$unixdate,$sp_hits,$sp_format,$sp_onmenu,$sp_label);
  } else {
      $display .= COM_siteHeader('menu');
--- 399,404 ----
      $display .= COM_siteFooter();
  } else if (($mode == $LANG_STATIC['save']) && !empty ($LANG_STATIC['save'])) {
!     submitstaticpage($sp_id,$sp_uid,$sp_title,$sp_content,$unixdate,$sp_hits,$sp_format,$sp_onmenu,$sp_label, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon, $sp_php, $sp_nf);
!     COM_errorlog("Saved Static Page " . $sp_id,1);
  } else {
      $display .= COM_siteHeader('menu');

Index: install.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/plugins/staticpages/install.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** install.php	27 Nov 2002 19:45:24 -0000	1.8
--- install.php	9 Mar 2003 11:47:22 -0000	1.9
***************
*** 3,7 ****
  /* Reminder: always indent with 4 spaces (no tabs). */
  // +---------------------------------------------------------------------------+
! // | Static Pages Plugin 0.2 for Geeklog - The Ultimate Weblog                 |
  // +---------------------------------------------------------------------------+
  // | install.php                                                               |
--- 3,7 ----
  /* Reminder: always indent with 4 spaces (no tabs). */
  // +---------------------------------------------------------------------------+
! // | Static Pages Plugin 1.3 for Geeklog - The Ultimate Weblog                 |
  // +---------------------------------------------------------------------------+
  // | install.php                                                               |
***************
*** 10,16 ****
  // | plugin for Geeklog.                                                       |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2002 by the following authors:                              |
  // |                                                                           |
  // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 10,17 ----
  // | plugin for Geeklog.                                                       |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2002,2003 by the following authors:                         |
  // |                                                                           |
  // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
+ // |          Tom Willett      - twillett at users.sourceforge.net
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 77,82 ****
          . "sp_onmenu tinyint(1) unsigned NOT NULL DEFAULT '0',"
          . "sp_label varchar(64),"
!         . "PRIMARY KEY (sp_id)"
!         . ")";
  
      COM_errorLog("Attempting to create table staticpage for Static Page plugin", 1);
--- 78,94 ----
          . "sp_onmenu tinyint(1) unsigned NOT NULL DEFAULT '0',"
          . "sp_label varchar(64),"
!         . "group_id mediumint(8) unsigned NOT NULL default '1',"
!         . "owner_id mediumint(8) unsigned NOT NULL default '1',"
!         . "perm_owner tinyint(1) unsigned NOT NULL default '3',"
!         . "perm_group tinyint(1) unsigned NOT NULL default '3',"
!         . "perm_members tinyint(1) unsigned NOT NULL default '2',"
!         . "perm_anon tinyint(1) unsigned NOT NULL default '2',"
!         . "sp_php tinyint(1) unsigned NOT NULL default '0',"
!         . "sp_nf tinyint(1) unsigned default '0',"
!         . "PRIMARY KEY (sp_id),"
!         . "KEY staticpage_sp_uid (sp_uid),"
!         . "KEY staticpage_sp_date (sp_date),"
!         . "KEY staticpage_sp_onmenu (sp_onmenu)"
!         . ") TYPE=MyISAM";
  
      COM_errorLog("Attempting to create table staticpage for Static Page plugin", 1);
***************
*** 97,117 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
      $steps['insertgroup'] = 1;
  
!     // Save the grp id for later uninstall
!     COM_errorLog('About to save group_id to vars table for use during uninstall',1);
!     DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('sp_group_id', LAST_INSERT_ID())",1);
!     if (DB_error()) {
!         plugin_uninstall_staticpages($steps);
!         return false;
!         exit;
!     }
!     COM_errorLog('...success',1);
!     $steps['savedgroupid'] = 1;
! 
!     $group_id = DB_getItem($_TABLES['vars'], 'value', "name = 'sp_group_id'");
  
      // Add static page features
--- 109,117 ----
          plugin_uninstall_staticpages($steps);
          return false;
      }
      COM_errorLog('...success',1);
      $steps['insertgroup'] = 1;
  
!     $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Static Page Admin'");
  
      // Add static page features
***************
*** 122,126 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      $edit_id = DB_insertId();
--- 122,125 ----
***************
*** 134,138 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      $delete_id = DB_insertId();
--- 133,136 ----
***************
*** 140,143 ****
--- 138,152 ----
      $steps['insertedfeaturedelete'] = 1;
  
+     COM_errorLog('Attempting to add staticpages.PHP feature',1);
+     DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) "
+         . "VALUES ('staticpages.PHP','Ability use PHP in static pages')",1);
+     if (DB_error()) {
+         plugin_uninstall_staticpages($steps);
+         return false;
+     }
+     $php_id = DB_insertId();
+     COM_errorLog('...success',1);
+     $steps['insertedphpfeature'] = 1;
+     
      // Now add the features to the group
      COM_errorLog('Attempting to give Static Page Admin group access to staticpages.edit feature',1);
***************
*** 146,150 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 155,158 ----
***************
*** 156,164 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
      $steps['addeddeletetogroup'] = 1;
  
      // OK, now give Root users access to this plugin now! NOTE: Root group should always be 1
      COM_errorLog('Attempting to give all users in Root group access static page admin group',1);
--- 164,180 ----
          plugin_uninstall_staticpages($steps);
          return false;
      }
      COM_errorLog('...success',1);
      $steps['addeddeletetogroup'] = 1;
  
+     COM_errorLog('Attempting to give Static Page Admin group access to staticpages.PHP feature',1);
+     DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($php_id, $group_id)",1);
+     if (DB_error()) {
+         plugin_uninstall_staticpages($steps);
+         return false;
+     }
+     COM_errorLog('...success',1);
+     $steps['addedphptogroup']=1;
+     
      // OK, now give Root users access to this plugin now! NOTE: Root group should always be 1
      COM_errorLog('Attempting to give all users in Root group access static page admin group',1);
***************
*** 167,171 ****
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 183,186 ----
***************
*** 174,183 ****
      // Register the plugin with Geeklog
      if (DB_count($_TABLES['plugins'],'pi_name','staticpages') > 0) {
!         COM_errorLog('Attempting to remove staticpage rentry prior to adding an updated entry',1);
          DB_query("DELETE FROM {$_TABLES['plugins']} WHERE pi_name = 'staticpages'");
          if (DB_error()) {
              plugin_uninstall_staticpages($steps);
              return false;
-             exit;
          }
          COM_errorLog('...success',1);
--- 189,197 ----
      // Register the plugin with Geeklog
      if (DB_count($_TABLES['plugins'],'pi_name','staticpages') > 0) {
!         COM_errorLog('Attempting to remove staticpage entry prior to adding an updated entry',1);
          DB_query("DELETE FROM {$_TABLES['plugins']} WHERE pi_name = 'staticpages'");
          if (DB_error()) {
              plugin_uninstall_staticpages($steps);
              return false;
          }
          COM_errorLog('...success',1);
***************
*** 190,200 ****
      DB_delete($_TABLES['plugins'],'pi_name','staticpages');
      DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) "
!         . "VALUES ('staticpages', '{$_SP_CONF['version']}', '1.3.7', 'http://www.tonybibbs.com', 1)");
!     DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('staticpages','1')");
  
      if (DB_error()) {
          plugin_uninstall_staticpages($steps);
          return false;
-         exit;
      }
      COM_errorLog('...success',1);
--- 204,212 ----
      DB_delete($_TABLES['plugins'],'pi_name','staticpages');
      DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) "
!         . "VALUES ('staticpages', '{$_SP_CONF['version']}', '1.3.8', 'http://www.tonybibbs.com', 1)");
  
      if (DB_error()) {
          plugin_uninstall_staticpages($steps);
          return false;
      }
      COM_errorLog('...success',1);
***************
*** 204,252 ****
  }
  
- /* 
- MAIN:  OK, I wanted to keep this simple so this is how this works.  When ran for the first
- time, this file will attempt to install the datastructures immediately.  When that is complete,
- it will insert a record into the Geeklog vars table (name = 'staticpages', value = 1) which will
- lock this file from being executed at by anyone.
- 
- If you want to remove this plugin you would set the value in that record to 0 and then this script
- will uninstall the plugin.  All this is outlined in the INSTALL and UNINSTALL documents.
- */
- 
  $display = COM_siteHeader();
  
! if (DB_count($_TABLES['vars'], 'name', 'staticpages') == 0) {
!     // Record in vars table doesn' exit, install this plugin
!     if (plugin_install_staticpages()) {
!         $display .= COM_startBlock($LANG_STATIC['installation_complete']);
!         $display .= $LANG_STATIC['installation_complete_msg'];
!         $display .= COM_endBlock();
      } else {
!         // Error occured
!         $display .= COM_startBlock($LANG_STATIC['installation_failed']);
!         $display .= $LANG_STATIC['installation_failed_msg'];
!         $display .= COM_endBlock();
!     }   
! } else {
!     // This plugin is installed, see if it is locked or not
!     if (DB_getItem($_TABLES['vars'],'value',"name = 'staticpages'") == 1) {
!         // This is locked, do nothing
!         $display .= COM_startBlock($LANG_STATIC['system_locked']);
!         $display .= $LANG_STATIC['system_locked_msg'];
!         $display .= COM_endBlock();
      } else {
!         // Uninstall plugin
!         if (plugin_uninstall_staticpages()) {
!             // Uninstall worked
!             $display .= COM_startBlock($LANG_STATIC['uninstall_complete']);
!             $display .= $LANG_STATIC['uninstall_complete_msg'];
!             $display .= COM_endBlock();
!         } else {
!             // Uninstall failed
!             $display .= COM_startBlock($LANG_STATIC['uninstall_failed']);
!             $display .= $LANG_STATIC['uninstall_failed_msg'];
!             $display .= COM_endBlock();
!         }
      }
  }
  
--- 216,248 ----
  }
  
  $display = COM_siteHeader();
  
! if ($action == 'uninstall') {
!     if (plugin_uninstall_staticpages ()) {
!         $display .= COM_showMessage (45);
      } else {
!         $timestamp = strftime($_CONF['daytime']);
!         $display .= COM_startBlock ($MESSAGE[40] . ' - ' . $timestamp)
!                  . '<p><img src="' . $_CONF['layout_url']
!                  . '/images/sysmessage.gif" border="0" align="top" alt="">'
!                  . $LANG08[6] . '</p>' . COM_endBlock ();
!     }
! } else if (DB_count ($_TABLES['plugins'], 'pi_name', 'staticpages') == 0) {
!     // plugin not installed - do it now
!     if (plugin_install_staticpages ()) {
!         $display = COM_refresh ($_CONF['site_admin_url']
!                                 . '/plugins.php?msg=44');
      } else {
!         $timestamp = strftime($_CONF['daytime']);
!         $display .= COM_startBlock ($MESSAGE[40] . ' - ' . $timestamp)
!                  . '<p><img src="' . $_CONF['layout_url']
!                  . '/images/sysmessage.gif" border="0" align="top" alt="">'
!                  . $LANG08[6] . '</p>' . COM_endBlock ();
      }
+ } else {
+     // plugin already installed
+     $display .= COM_startBlock ($LANG32[6])
+              . '<p>' . $LANG32[7] . '</p>'
+              . COM_endBlock ();
  }
  





More information about the geeklog-cvs mailing list