Zikula_System_Modules
[ class tree: Zikula_System_Modules ] [ index: Zikula_System_Modules ] [ all elements ]

Source for file pninit.php

Documentation is available at pninit.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2001, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: pninit.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_System_Modules
  10.  * @subpackage AntiCracker
  11. */
  12.  
  13. /**
  14.  * initialise the anticracker module
  15.  * This function is only ever called once during the lifetime of a particular
  16.  * module instance
  17.  * @author Mark West
  18.  * @return bool true on success, false otherwise
  19.  */
  20. {
  21.     // create table
  22.     if (!DBUtil::createTable('sc_anticracker')) {
  23.         return false;
  24.     }
  25.  
  26.     // create table
  27.     if (!DBUtil::createTable('sc_logevent')) {
  28.         return false;
  29.     }
  30.  
  31.     // Set up an initial value for a module variable.
  32.     pnModSetVar('SecurityCenter''itemsperpage'10);
  33.  
  34.     // We use config vars for the rest of the configuration as config vars
  35.     // are available earlier in the PN initialisation process
  36.     pnConfigSetVar('enableanticracker'1);
  37.     pnConfigSetVar('emailhackattempt'1);
  38.     pnConfigSetVar('loghackattempttodb'1);
  39.     pnConfigSetVar('onlysendsummarybyemail'1);
  40.     pnConfigSetVar('usehtaccessbans'0);
  41.     pnConfigSetVar('filtergetvars'1);
  42.     pnConfigSetVar('filtercookievars'1);
  43.     pnConfigSetVar('filterpostvars'1);
  44.     pnConfigSetVar('filterarrays'1);
  45.     pnConfigSetVar('extrapostprotection'0);
  46.     pnConfigSetVar('extragetprotection'0);
  47.     pnConfigSetVar('checkmultipost'0);
  48.     pnConfigSetVar('maxmultipost'4);
  49.     pnConfigSetVar('zipcompress'0);
  50.     pnConfigSetVar('compresslevel'9);
  51.     pnConfigSetVar('cpuloadmonitor'0);
  52.     pnConfigSetVar('cpumaxload'10.0);
  53.     pnConfigSetVar('ccisessionpath''');
  54.     pnConfigSetVar('htaccessfilelocation''.htaccess');
  55.     pnConfigSetVar('nocookiebanthreshold'10);
  56.     pnConfigSetVar('nocookiewarningthreshold'2);
  57.     pnConfigSetVar('fastaccessbanthreshold'40);
  58.     pnConfigSetVar('fastaccesswarnthreshold'10);
  59.     pnConfigSetVar('javababble'0);
  60.     pnConfigSetVar('javaencrypt'0);
  61.     pnConfigSetVar('preservehead'0);
  62.     pnConfigSetVar('outputfilter'1);
  63.  
  64.     // now lets set the default mail message contents
  65.     // file is read from pnincludes directory
  66.     $summarycontent implode(''file(getcwd('/system/SecurityCenter/pnincludes/summary.txt'));
  67.     pnConfigSetVar('summarycontent'$summarycontent);
  68.     $fullcontent implode(''file(getcwd('/system/SecurityCenter/pnincludes/full.txt'));
  69.     pnConfigSetVar('fullcontent'$fullcontent);
  70.  
  71.     // Initialisation successful
  72.     return true;
  73. }
  74.  
  75. /**
  76.  * upgrade the anticracker module from an old version
  77.  * This function can be called multiple times
  78.  * @author Mark West
  79.  * @param int $oldversion version number to upgrade from
  80.  * @return bool true on success, false otherwise
  81.  */
  82. function securitycenter_upgrade($oldversion)
  83. {
  84.     if (!DBUtil::changeTable('sc_anticracker')) {
  85.         return false;
  86.     }
  87.  
  88.     if (!DBUtil::changeTable('sc_logevent')) {
  89.         return false;
  90.     }
  91.  
  92.     // Update successful
  93.     return true;
  94. }
  95.  
  96. /**
  97.  * delete the anticracker module
  98.  * This function is only ever called once during the lifetime of a particular
  99.  * module instance
  100.  * @author Mark West
  101.  * @return bool true on success, false otherwise
  102.  */
  103. {
  104.     if (!DBUtil::dropTable('sc_anticracker')) {
  105.         return false;
  106.     }
  107.  
  108.     if (!DBUtil::dropTable('sc_logevent')) {
  109.         return false;
  110.     }
  111.  
  112.     // Delete any module variables
  113.     pnConfigDelVar('enableanticracker');
  114.     pnConfigDelVar('emailhackattempt');
  115.     pnConfigDelVar('loghackattempttodb');
  116.     pnConfigDelVar('onlysendsummarybyemail');
  117.     pnConfigDelVar('itemsperpage');
  118.     pnConfigDelVar('summarycontent');
  119.     pnConfigDelVar('fullcontent');
  120.     pnConfigDelVar('usehtaccessbans');
  121.     pnConfigDelVar('filtergetvars');
  122.     pnConfigDelVar('filtercookievars');
  123.     pnConfigDelVar('filterpostvars');
  124.     pnConfigDelVar('filterarrays');
  125.     pnConfigDelVar('extrapostprotection');
  126.     pnConfigDelVar('extragetprotection');
  127.     pnConfigDelVar('checkmultipost');
  128.     pnConfigDelVar('maxmultipost');
  129.     pnConfigDelVar('zipcompress');
  130.     pnConfigDelVar('compresslevel');
  131.     pnConfigDelVar('cpuloadmonitor');
  132.     pnConfigDelVar('cpumaxload');
  133.     pnConfigDelVar('ccisessionpath');
  134.     pnConfigDelVar('htaccessfilelocation');
  135.     pnConfigDelVar('nocookiebanthreshold');
  136.     pnConfigDelVar('nocookiewarningthreshold');
  137.     pnConfigDelVar('fastaccessbanthreshold');
  138.     pnConfigDelVar('fastaccesswarnthreshold');
  139.     pnConfigDelVar('javababble');
  140.     pnConfigDelVar('javaencrypt');
  141.     pnConfigDelVar('preservehead');
  142.     pnConfigDelVar('outputfilter');
  143.  
  144.     // Deletion successful
  145.     return true;
  146. }

Documentation generated on Fri, 18 Jul 2008 21:53:10 +0200 by phpDocumentor 1.4.1