Ignore:
Timestamp:
Dec 18, 2013, 6:48:06 PM (10 years ago)
Author:
mistic100
Message:

update for 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/EasyCaptcha/main.inc.php

    r24234 r26025  
    1111defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1212
    13 // TODO : test on mobile
     13// TODO : captcha on mobile
    1414if (mobile_theme())
    1515{
     
    1717}
    1818
    19 defined('EASYCAPTCHA_ID') or define('EASYCAPTCHA_ID', basename(dirname(__FILE__)));
    20 define('EASYCAPTCHA_PATH' , PHPWG_PLUGINS_PATH . EASYCAPTCHA_ID . '/');
    21 define('EASYCAPTCHA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . EASYCAPTCHA_ID);
     19define('EASYCAPTCHA_ID',      basename(dirname(__FILE__)));
     20define('EASYCAPTCHA_PATH' ,   PHPWG_PLUGINS_PATH . EASYCAPTCHA_ID . '/');
     21define('EASYCAPTCHA_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . EASYCAPTCHA_ID);
    2222define('EASYCAPTCHA_VERSION', 'auto');
    2323
     
    4040  global $conf, $pwg_loaded_plugins;
    4141
    42   if (
    43     EASYCAPTCHA_VERSION == 'auto' or
    44     $pwg_loaded_plugins[EASYCAPTCHA_ID]['version'] == 'auto' or
    45     version_compare($pwg_loaded_plugins[EASYCAPTCHA_ID]['version'], EASYCAPTCHA_VERSION, '<')
    46   )
    47   {
    48     include_once(EASYCAPTCHA_PATH . 'include/install.inc.php');
    49     easycaptcha_install();
    50 
    51     if ( $pwg_loaded_plugins[EASYCAPTCHA_ID]['version'] != 'auto' && EASYCAPTCHA_VERSION != 'auto' )
    52     {
    53       $query = '
    54 UPDATE '. PLUGINS_TABLE .'
    55 SET version = "'. EASYCAPTCHA_VERSION .'"
    56 WHERE id = "'. EASYCAPTCHA_ID .'"';
    57       pwg_query($query);
    58 
    59       $pwg_loaded_plugins[EASYCAPTCHA_ID]['version'] = EASYCAPTCHA_VERSION;
    60     }
    61   }
     42  include_once(EASYCAPTCHA_PATH . 'maintain.inc.php');
     43  $maintain = new EasyCaptcha_maintain(EASYCAPTCHA_ID);
     44  $maintain->autoUpdate(EASYCAPTCHA_VERSION, 'install');
    6245
    6346  load_language('plugin.lang', EASYCAPTCHA_PATH);
     
    7154  global $conf, $pwg_loaded_plugins, $page;
    7255
    73   if (!is_a_guest()) return;
     56  if (!is_a_guest())
     57  {
     58    return;
     59  }
    7460
    75   if ( script_basename() == 'register' && $conf['EasyCaptcha']['activate_on']['register'] )
     61  if (script_basename() == 'register' && $conf['EasyCaptcha']['activate_on']['register'])
    7662  {
    7763    $conf['EasyCaptcha']['template'] = 'register';
    7864    include(EASYCAPTCHA_PATH . 'include/register.inc.php');
    7965  }
    80   else if ( script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture'] )
     66  else if (script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture'])
    8167  {
    8268    $conf['EasyCaptcha']['template'] = 'comment';
     
    9581      include(EASYCAPTCHA_PATH . 'include/category.inc.php');
    9682    }
    97     else if ( $page['section'] == 'contact' && $conf['EasyCaptcha']['activate_on']['contactform'] )
     83    else if ($page['section'] == 'contact' && $conf['EasyCaptcha']['activate_on']['contactform'])
    9884    {
    9985      $conf['EasyCaptcha']['template'] = 'contactform';
    10086      include(EASYCAPTCHA_PATH . 'include/contactform.inc.php');
    10187    }
    102     else if ( $page['section'] == 'guestbook' && $conf['EasyCaptcha']['activate_on']['guestbook'] )
     88    else if ($page['section'] == 'guestbook' && $conf['EasyCaptcha']['activate_on']['guestbook'])
    10389    {
    10490      $conf['EasyCaptcha']['template'] = 'guestbook';
     
    11298function easycaptcha_plugin_admin_menu($menu)
    11399{
    114   array_push($menu, array(
     100  $menu[] = array(
    115101    'NAME' => 'Easy Captcha',
    116102    'URL' => EASYCAPTCHA_ADMIN,
    117     ));
     103    );
    118104  return $menu;
    119105}
Note: See TracChangeset for help on using the changeset viewer.