[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/administrator/components/com_checkin/ -> admin.checkin.php (source)

   1  <?php
   2  /**
   3  * @version $Id: admin.checkin.php 5030 2006-09-14 00:03:34Z friesengeist $
   4  * @package Joomla
   5  * @subpackage Checkin
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  if (!$acl->acl_check( 'administration', 'config', 'users', $my->usertype )) {
  19      mosRedirect( 'index2.php?', _NOT_AUTH );
  20  }
  21  $nullDate = $database->getNullDate();
  22  ?>
  23  <table class="adminheading">
  24      <tr>
  25          <th class="checkin">
  26              Global Check-in
  27          </th>
  28      </tr>
  29  </table>
  30  <table class="adminform">
  31      <tr>
  32          <th class="title">
  33              Database Table
  34          </th>
  35          <th class="title">
  36              # of Items
  37          </th>
  38          <th class="title">
  39              Checked-In
  40          </th>
  41          <th class="title">
  42          </th>
  43      </tr>
  44  <?php
  45  $tables = $database->getTableList();
  46  $k = 0;
  47  foreach ($tables as $tn) {
  48      // make sure we get the right tables based on prefix
  49      if (!preg_match( "/^".$mosConfig_dbprefix."/i", $tn )) {
  50          continue;
  51      }
  52      $fields = $database->getTableFields( array( $tn ) );
  53  
  54      $foundCO = false;
  55      $foundCOT = false;
  56      $foundE = false;
  57  
  58      $foundCO    = isset( $fields[$tn]['checked_out'] );
  59      $foundCOT    = isset( $fields[$tn]['checked_out_time'] );
  60      $foundE        = isset( $fields[$tn]['editor'] );
  61  
  62      if ($foundCO && $foundCOT) {
  63          if ($foundE) {
  64              $query = "SELECT checked_out, editor"
  65              . "\n FROM $tn"
  66              . "\n WHERE checked_out > 0"
  67              ;
  68          } else {
  69              $query = "SELECT checked_out"
  70              . "\n FROM $tn"
  71              . "\n WHERE checked_out > 0"
  72              ;
  73          }
  74          $database->setQuery( $query );
  75          $res = $database->query();
  76          $num = $database->getNumRows( $res );
  77  
  78          if ($foundE) {
  79              $query = "UPDATE $tn"
  80              . "\n SET checked_out = 0, checked_out_time = " . $database->Quote( $nullDate ) . ", editor = NULL"
  81              . "\n WHERE checked_out > 0"
  82              ;
  83          } else {
  84              $query = "UPDATE $tn"
  85              . "\n SET checked_out = 0, checked_out_time = " . $database->Quote( $nullDate )
  86              . "\n WHERE checked_out > 0"
  87              ;
  88          }
  89          $database->setQuery( $query );
  90          $res = $database->query();
  91  
  92          if ($res == 1) {
  93              if ($num > 0) {
  94                  echo "<tr class=\"row$k\">";
  95                  echo "\n    <td width=\"350\">Checking table - $tn</td>";
  96                  echo "\n    <td width=\"150\">Checked in <b>$num</b> items</td>";
  97                  echo "\n    <td width=\"100\" align=\"center\"><img src=\"images/tick.png\" border=\"0\" alt=\"tick\" /></td>";
  98                  echo "\n    <td>&nbsp;</td>";
  99                  echo "\n</tr>";
 100              } else {
 101                  echo "<tr class=\"row$k\">";
 102                  echo "\n    <td width=\"350\">Checking table - $tn</td>";
 103                  echo "\n    <td width=\"150\">Checked in <b>$num</b> items</td>";
 104                  echo "\n    <td width=\"100\">&nbsp;</td>";
 105                  echo "\n    <td>&nbsp;</td>";
 106                  echo "\n</tr>";
 107              }
 108              $k = 1 - $k;
 109          }
 110      }
 111  }
 112  ?>
 113      <tr>
 114          <td colspan="4">
 115              <strong>Checked out items have now been all checked in</strong>
 116          </td>
 117      </tr>
 118  </table>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics