phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: wiki/action admin.php,1.3,1.4 history.php,1.3,1.


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: wiki/action admin.php,1.3,1.4 history.php,1.3,1.4
Date: Tue, 04 Mar 2003 15:55:18 -0500

Update of /cvsroot/phpgroupware/wiki/action
In directory subversions:/tmp/cvs-serv14680/action

Modified Files:
        admin.php history.php 
Log Message:
moved to new sowiki class which relies completly on our db-abstraction


Index: admin.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/action/admin.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** admin.php   3 Mar 2003 14:16:23 -0000       1.3
--- admin.php   4 Mar 2003 20:55:15 -0000       1.4
***************
*** 1,141 ****
! <?php
! // $Id$
! 
! // Don't freak out lib/init.php.
! $document = $categories = $comment = $page = '';
! 
! require('lib/init.php');
! require('parse/html.php');
! require('parse/transforms.php');
! require('template/admin.php');
! 
! if($AdminEnabled != 1)
!   { die($ErrorAdminDisabled); }
! 
! // Harvest script parameters.
! 
! $REMOTE_ADDR = isset($HTTP_SERVER_VARS['REMOTE_ADDR'])
!                ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : '';
! 
! if(isset($HTTP_GET_VARS['locking']))
!   { $locking = $HTTP_GET_VARS['locking']; }
! if(isset($HTTP_GET_VARS['blocking']))
!   { $blocking = $HTTP_GET_VARS['blocking']; }
! if(!isset($locking))
! {
!   $locking  = isset($HTTP_POST_VARS['locking'])
!               ? $HTTP_POST_VARS['locking'] : '';
! }
! if(!isset($blocking))
! {
!   $blocking = isset($HTTP_POST_VARS['blocking'])
!               ? $HTTP_POST_VARS['blocking'] : '';
! }
! 
! $Block   = isset($HTTP_POST_VARS['Block'])
!            ? $HTTP_POST_VARS['Block'] : '';
! $Unblock = isset($HTTP_POST_VARS['Unblock'])
!            ? $HTTP_POST_VARS['Unblock'] : '';
! $Save    = isset($HTTP_POST_VARS['Save'])
!            ? $HTTP_POST_VARS['Save'] : '';
! $address = isset($HTTP_POST_VARS['address'])
!            ? $HTTP_POST_VARS['address'] : '';
! 
! $count = isset($HTTP_POST_VARS['count']) ? $HTTP_POST_VARS['count'] : 0;
! 
! if($locking && $count > 0)
! {
!   for($i = 1; $i <= $count; $i++)
!   {
!     $var = 'name' + $i;
!     $$var = isset($HTTP_POST_VARS[$var]) ? $HTTP_POST_VARS[$var] : '';
!     $var = 'lock' + $i;
!     $$var = isset($HTTP_POST_VARS[$var]) ? $HTTP_POST_VARS[$var] : '';
!   }
! }
! 
! if($locking)                            // Locking/unlocking pages.
! {
!   if(empty($Save))                      // Not saving results; display form.
!   {
!     $html = html_lock_start();
!     $pagelist = $pagestore->allpages();
!     foreach($pagelist as $page)
!       { $html = $html . html_lock_page($page[1], $page[6]); }
!     template_admin(array('html' => $html . html_lock_end(count($pagelist))));
!   }
!   else                                  // Lock/unlock pages at admin's 
request.
!   {
!     $pagestore->lock();                 // Exclusive access to database.
!     for($i = 1; $i <= $count; $i++)
!     {
!       $page = urldecode($HTTP_POST_VARS['name' . $i]);
!       if(isset($HTTP_POST_VARS['lock' . $i]))
!         { $lock = $HTTP_POST_VARS['lock' . $i]; }
!       else
!         { $lock = 0; }
!       $pg = $pagestore->page($page);
!       $pg->read();
!       $pg->version++;
!       $pg->hostname = gethostbyaddr($REMOTE_ADDR);
!       $pg->username = $UserName;
!       $pg->comment = '';
!       $pg->text = str_replace('\\', '\\\\', $pg->text);
!       $pg->text = str_replace('\'', '\\\'', $pg->text);
!       if($pg->exists && $pg->mutable && $lock)
!       {
!         $pg->mutable = 0;
!         $pg->write();
!       }
!       else if($pg->exists && !$pg->mutable && !$lock)
!       {
!         $pg->mutable = 1;
!         $pg->write();
!       }
!     }
! 
!     $pagestore->unlock();
!     header('Location: ' . $AdminScript);
!   }
! }
! else if($blocking)                      // Blocking/unblocking IP addrs.
! {
!   if(empty($Block) && empty($Unblock))  // Not saving results; display form.
!   {
!     $html = '';
!     if($RatePeriod == 0)
!     {
!       $html = $html . html_bold_start() .
!               'Rate control / IP blocking disabled' .
!               html_bold_end() . html_newline();
!     }
! 
!     $html = $html . html_rate_start();
!     $blocklist = rateBlockList($pagestore->dbh);
!     foreach($blocklist as $block)
!       { $html = $html . html_rate_entry($block); }
!     $html = $html . html_rate_end();
! 
!     template_admin(array('html' => $html));
!   }
!   else                                  // Block/unblock an address group.
!   {
!     if(!empty($Block))
!       { rateBlockAdd($pagestore->dbh, $address); }
!     else if(!empty($Unblock))
!       { rateBlockRemove($pagestore->dbh, $address); }
! 
!     header('Location: ' . $AdminScript);
!   }
! }
! else                                    // Display main menu for admin.
! {
!   template_admin(array('html' => html_url($AdminScript . '?locking=1',
!                                           'Lock / unlock pages') .
!                                  html_newline() .
!                                  html_url($AdminScript . '?blocking=1',
!                                           'Block / unblock hosts') .
!                                  html_newline()));
! }
! 
! ?>
--- 1,141 ----
! <?php
! // $Id$
! 
! // Don't freak out lib/init.php.
! $document = $categories = $comment = $page = '';
! 
! require('lib/init.php');
! require('parse/html.php');
! require('parse/transforms.php');
! require('template/admin.php');
! 
! if($AdminEnabled != 1)
!   { die($ErrorAdminDisabled); }
! 
! // Harvest script parameters.
! 
! $REMOTE_ADDR = isset($HTTP_SERVER_VARS['REMOTE_ADDR'])
!                ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : '';
! 
! if(isset($HTTP_GET_VARS['locking']))
!   { $locking = $HTTP_GET_VARS['locking']; }
! if(isset($HTTP_GET_VARS['blocking']))
!   { $blocking = $HTTP_GET_VARS['blocking']; }
! if(!isset($locking))
! {
!   $locking  = isset($HTTP_POST_VARS['locking'])
!               ? $HTTP_POST_VARS['locking'] : '';
! }
! if(!isset($blocking))
! {
!   $blocking = isset($HTTP_POST_VARS['blocking'])
!               ? $HTTP_POST_VARS['blocking'] : '';
! }
! 
! $Block   = isset($HTTP_POST_VARS['Block'])
!            ? $HTTP_POST_VARS['Block'] : '';
! $Unblock = isset($HTTP_POST_VARS['Unblock'])
!            ? $HTTP_POST_VARS['Unblock'] : '';
! $Save    = isset($HTTP_POST_VARS['Save'])
!            ? $HTTP_POST_VARS['Save'] : '';
! $address = isset($HTTP_POST_VARS['address'])
!            ? $HTTP_POST_VARS['address'] : '';
! 
! $count = isset($HTTP_POST_VARS['count']) ? $HTTP_POST_VARS['count'] : 0;
! 
! if($locking && $count > 0)
! {
!   for($i = 1; $i <= $count; $i++)
!   {
!     $var = 'name' + $i;
!     $$var = isset($HTTP_POST_VARS[$var]) ? $HTTP_POST_VARS[$var] : '';
!     $var = 'lock' + $i;
!     $$var = isset($HTTP_POST_VARS[$var]) ? $HTTP_POST_VARS[$var] : '';
!   }
! }
! 
! if($locking)                            // Locking/unlocking pages.
! {
!   if(empty($Save))                      // Not saving results; display form.
!   {
!     $html = html_lock_start();
!     $pagelist = $pagestore->allpages();
!     foreach($pagelist as $page)
!       { $html = $html . html_lock_page($page[1], $page[6]); }
!     template_admin(array('html' => $html . html_lock_end(count($pagelist))));
!   }
!   else                                  // Lock/unlock pages at admin's 
request.
!   {
!     $pagestore->lock();                 // Exclusive access to database.
!     for($i = 1; $i <= $count; $i++)
!     {
!       $page = urldecode($HTTP_POST_VARS['name' . $i]);
!       if(isset($HTTP_POST_VARS['lock' . $i]))
!         { $lock = $HTTP_POST_VARS['lock' . $i]; }
!       else
!         { $lock = 0; }
!       $pg = $pagestore->page($page);
!       $pg->read();
!       $pg->version++;
!       $pg->hostname = gethostbyaddr($REMOTE_ADDR);
!       $pg->username = $UserName;
!       $pg->comment = '';
!       $pg->text = str_replace('\\', '\\\\', $pg->text);
!       $pg->text = str_replace('\'', '\\\'', $pg->text);
!       if($pg->exists && $pg->mutable && $lock)
!       {
!         $pg->mutable = 0;
!         $pg->write();
!       }
!       else if($pg->exists && !$pg->mutable && !$lock)
!       {
!         $pg->mutable = 1;
!         $pg->write();
!       }
!     }
! 
!     $pagestore->unlock();
!     header('Location: ' . $AdminScript);
!   }
! }
! else if($blocking)                      // Blocking/unblocking IP addrs.
! {
!   if(empty($Block) && empty($Unblock))  // Not saving results; display form.
!   {
!     $html = '';
!     if($RatePeriod == 0)
!     {
!       $html = $html . html_bold_start() .
!               'Rate control / IP blocking disabled' .
!               html_bold_end() . html_newline();
!     }
! 
!     $html = $html . html_rate_start();
!     $blocklist = $pagestore->rateBlockList();
!     foreach($blocklist as $block)
!       { $html = $html . html_rate_entry($block); }
!     $html = $html . html_rate_end();
! 
!     template_admin(array('html' => $html));
!   }
!   else                                  // Block/unblock an address group.
!   {
!     if(!empty($Block))
!       { $pagestore->rateBlockAdd($address); }
!     else if(!empty($Unblock))
!       { $pagestore->rateBlockRemove($address); }
! 
!     header('Location: ' . $AdminScript);
!   }
! }
! else                                    // Display main menu for admin.
! {
!   template_admin(array('html' => html_url($AdminScript . '?locking=1',
!                                           'Lock / unlock pages') .
!                                  html_newline() .
!                                  html_url($AdminScript . '?blocking=1',
!                                           'Block / unblock hosts') .
!                                  html_newline()));
! }
! 
! ?>

Index: history.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/action/history.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** history.php 3 Mar 2003 14:16:23 -0000       1.3
--- history.php 4 Mar 2003 20:55:15 -0000       1.4
***************
*** 1,64 ****
! <?php
! // $Id$
! 
! require('parse/main.php');
! require('parse/macros.php');
! require('parse/html.php');
! require('lib/diff.php');
! require(TemplateDir . '/history.php');
! require('lib/headers.php');
! 
! // Display the known history of a page's edits.
! function action_history()
! {
!   global $pagestore, $page, $full, $HistMax;
! 
!   $history = $pagestore->history($page);
! 
!   gen_headers($history[0][0]);
! 
!   $text = '';
!   $latest_auth = '';
!   $previous_ver = 0;
!   $is_latest = 1;
! 
!   for($i = 0; $i < count($history); $i++)
!   {
!     if($latest_auth == '')
!     {
!       $latest_auth = ($history[$i][3] == '' ? $history[$i][1]
!                                               : $history[$i][3]);
!       $latest_ver = $history[$i][2];
!     }
! 
!     if($previous_ver == 0
!        && $latest_auth != ($history[$i][3] == '' ? $history[$i][1]
!                                                    : $history[$i][3]))
!       { $previous_ver = $history[$i][2]; }
! 
!     if($i < $HistMax || $full)
!     {
!       $text = $text . html_history_entry($page, $history[$i][2],
!                                          $history[$i][0], $history[$i][1],
!                                          $history[$i][3],
!                                          $previous_ver == $history[$i][2],
!                                          $is_latest, $history[$i][4]);
!     }
! 
!     $is_latest = 0;
!   }
! 
!   if($i >= $HistMax && !$full)
!     { $text = $text . html_fullhistory($page, count($history)); }
! 
!   $p1 = $pagestore->page($page);
!   $p1->version = $previous_ver;
!   $p2 = $pagestore->page($page);
!   $p2->version = $latest_ver;
! 
!   $diff = diff_compute($p1->read(), $p2->read());
!   template_history(array('page'    => $page,
!                          'history' => $text,
!                          'diff'    => diff_parse($diff)));
! }
! ?>
--- 1,65 ----
! <?php
! // $Id$
! 
! require('parse/main.php');
! require('parse/macros.php');
! require('parse/html.php');
! require('lib/diff.php');
! require(TemplateDir . '/history.php');
! require('lib/headers.php');
! 
! // Display the known history of a page's edits.
! function action_history()
! {
!   global $pagestore, $page, $full, $HistMax;
! 
!   $history = $pagestore->history($page);
! 
!   gen_headers($history[0][0]);
! 
! 
!   $text = '';
!   $latest_auth = '';
!   $previous_ver = 0;
!   $is_latest = 1;
! 
!   for($i = 0; $i < count($history); $i++)
!   {
!     if($latest_auth == '')
!     {
!       $latest_auth = ($history[$i][3] == '' ? $history[$i][1]
!                                               : $history[$i][3]);
!       $latest_ver = $history[$i][2];
!     }
! 
!     if($previous_ver == 0
!        && $latest_auth != ($history[$i][3] == '' ? $history[$i][1]
!                                                    : $history[$i][3]))
!       { $previous_ver = $history[$i][2]; }
! 
!     if($i < $HistMax || $full)
!     {
!       $text = $text . html_history_entry($page, $history[$i][2],
!                                          $history[$i][0], $history[$i][1],
!                                          $history[$i][3],
!                                          $previous_ver == $history[$i][2] || 
!$full && $i == count($history)-1,
!                                          $is_latest, $history[$i][4]);
!     }
! 
!     $is_latest = 0;
!   }
! 
!   if($i >= $HistMax && !$full)
!     { $text = $text . html_fullhistory($page, count($history)); }
! 
!   $p1 = $pagestore->page($page);
!   $p1->version = $previous_ver;
!   $p2 = $pagestore->page($page);
!   $p2->version = $latest_ver;
! 
!   $diff = diff_compute($p1->read(), $p2->read());
!   template_history(array('page'    => $page,
!                          'history' => $text,
!                          'diff'    => diff_parse($diff)));
! }
! ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]