[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/plugins/badbehavior/ -> pluginbadbehavior.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
   5      
   6      /**
   7       * The Bad Behaviour Plugin
   8       * TODO: some useful documentation here
   9       */
  10      class PluginBadBehavior extends PluginBase
  11      {
  12          var $_logTable;
  13          var $_displayStatus;
  14          
  15  		function PluginBadBehavior()
  16          {
  17              $this->PluginBase();
  18              
  19              $this->id = "badbehavior";
  20              $this->desc = "Bad Behavior for LifeType";
  21              $this->author = "The Lifetype Project";
  22              $this->db =& Db::getDb();
  23              $this->version = "1.2";
  24          
  25              $config =& Config::getConfig();
  26              $prefix = Db::getPrefix();
  27              $this->_logTable = $prefix . $config->getValue( 'bb2_log_table' );
  28              $this->_displayStatus = $config->getValue( 'bb2_display_stats' );
  29          }
  30  
  31          /**
  32           * show bb2 javascript
  33           *
  34           * @return the bb2 javascript
  35           */
  36          function showBB2JavaScript()
  37          {
  38              global $bb2_javascript;
  39              return $bb2_javascript;
  40          }
  41  
  42          /**
  43           * show bb2 timer
  44           *
  45           * @return the bb2 timer
  46           */
  47          function showBB2Timer()
  48          {
  49              global $bb2_timer_total;
  50              return "<!-- Bad Behavior 2 " . BB2_VERSION . " run time: " . number_format(1000 * $bb2_timer_total, 3) . " ms -->";
  51          }
  52  
  53          /**
  54           * show bb2 status
  55           *
  56           * @return the bb2 status
  57           */
  58          function showBB2Status()
  59          {
  60              if( !$this->_displayStatus )
  61                  return false;
  62              
  63              $query = "SELECT COUNT(id) as counter FROM " . $this->_logTable . " WHERE `key` NOT LIKE '00000000'";
  64              
  65              $result = $this->db->Execute($query);
  66              if(!$result || ($result->RecordCount() == 0))
  67                  return false;
  68  
  69              // get the information from the article
  70              $row = $result->FetchRow();
  71  
  72              // get current user locale
  73              $locale =& $this->blogInfo->getLocale();
  74  
  75              return $locale->pr( 'bb2_status', $row['counter'] );
  76          }
  77      }
  78  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics