Ignore:
Timestamp:
Jan 16, 2013, 3:10:31 PM (11 years ago)
Author:
mistic100
Message:

fix for new guestbook template + code cleaning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/CryptograPHP/maintain.inc.php

    r19428 r20189  
    11<?php
    2 define('crypto_default_config', serialize(array(
    3   'activate_on'     => array(
    4         'picture'     => true,
    5         'category'    => true,
    6         'register'    => true,
    7         'contactform' => true,
    8         'guestbook'   => true,
    9         ),
    10   'comments_action' => 'reject',
    11   'theme'           => 'gray',
    12   'captcha_type'    => 'string',
    13   'case_sensitive'  => 'false',
    14   'code_length'     => 6,
    15   'width'           => 180,
    16   'height'          => 70,
    17   'perturbation'    => 1,
    18   'image_bg_color'  => 'ffffff',
    19   'text_color'      => '8a8a8a',
    20   'num_lines'       => 2,
    21   'line_color'      => '8a8a8a',
    22   'noise_level'     => 0.1,
    23   'noise_color'     => '8a8a8a',
    24   'ttf_file'        => 'TopSecret',
    25   'button_color'    => 'dark',
    26 )));
     2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    273
    28 function plugin_install()
     4defined('CRYPTO_ID') or define('CRYPTO_ID', basename(dirname(__FILE__)));
     5include_once(PHPWG_PLUGINS_PATH . CRYPTO_ID . '/include/install.inc.php');
     6
     7function plugin_install()
    298{
    30   global $conf;
    31  
    32   conf_update_param('cryptographp', crypto_default_config);
     9  crypto_install();
     10  define('crypto_installed', true);
    3311}
    3412
    3513function plugin_activate()
    3614{
    37   global $conf;
    38  
    39   if (isset($conf['cryptograph_theme']))
     15  if (!defined('crypto_installed'))
    4016  {
    41     pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1;');
    42   }
    43  
    44   if (!isset($conf['cryptographp']))
    45   {
    46     conf_update_param('cryptographp', crypto_default_config);
    47   }
    48   else
    49   {
    50     $conf['cryptographp'] = unserialize($conf['cryptographp']);
    51     if (!isset($conf['cryptographp']['activate_on']))
    52     {
    53       $conf['cryptographp']['activate_on'] = array(
    54         'picture'     => $conf['cryptographp']['comments_action'] != 'inactive',
    55         'category'    => $conf['cryptographp']['comments_action'] != 'inactive',
    56         'register'    => true,
    57         'contactform' => true,
    58         'guestbook'   => true,
    59         );
    60       conf_update_param('cryptographp', serialize($conf['cryptographp']));
    61     }
    62     if (!isset($conf['cryptographp']['button_color']))
    63     {
    64       $conf['cryptographp']['button_color'] = 'dark';
    65       conf_update_param('cryptographp', serialize($conf['cryptographp']));
    66     }
     17    crypto_install();
    6718  }
    6819}
Note: See TracChangeset for help on using the changeset viewer.