Changeset 20189
- Timestamp:
- Jan 16, 2013, 3:10:31 PM (11 years ago)
- Location:
- extensions/CryptograPHP
- Files:
-
- 3 added
- 6 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/CryptograPHP/include/common.inc.php
r19428 r20189 16 16 )); 17 17 18 $template->set_filename('cryptographp', realpath(CRYPTO_PATH.' include/'.$conf['cryptographp']['template'].'.tpl'));18 $template->set_filename('cryptographp', realpath(CRYPTO_PATH.'template/'.$conf['cryptographp']['template'].'.tpl')); 19 19 $template->assign_var_from_handle('CRYPTOGRAPHP', 'cryptographp'); 20 20 -
extensions/CryptograPHP/include/guestbook.inc.php
r19428 r20189 14 14 function prefilter_crypto($content, $smarty) 15 15 { 16 $search = '{$comment_add.CONTENT}</textarea> </p>';16 $search = '{$comment_add.CONTENT}</textarea>'; 17 17 return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content); 18 18 } -
extensions/CryptograPHP/language/en_UK/description.txt
r12617 r20189 1 Add a captcha to register, comment and ContactForm pages (thanks to P@t)1 Add a captcha to register, comment, GuestBook and ContactForm pages (thanks to P@t) -
extensions/CryptograPHP/language/fr_FR/description.txt
r12617 r20189 1 Ajoute un captcha à la page d'enregistrement, au formulaire de commentaire et sur la page de ContactForm(merci à P@t)1 Ajoute un captcha à la page d'enregistrement, aux formulaires de commentaire et sur les pages de ContactForm and GuestBook (merci à P@t) -
extensions/CryptograPHP/main.inc.php
r19428 r20189 3 3 Plugin Name: Crypto Captcha 4 4 Version: auto 5 Description: Add a captcha to register, comment and ContactForm pages (thanks to P@t)5 Description: Add a captcha to register, comment, GuestBook and ContactForm pages (thanks to P@t) 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=535 7 7 Author: Mistic … … 19 19 20 20 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 21 define('CRYPTO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 21 22 defined('CRYPTO_ID') or define('CRYPTO_ID', basename(dirname(__FILE__))); 23 define('CRYPTO_PATH' , PHPWG_PLUGINS_PATH . CRYPTO_ID . '/'); 24 define('CRYPTO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . CRYPTO_ID); 25 define('CRYPTO_VERSION', 'auto'); 26 22 27 23 28 add_event_handler('init', 'crypto_init'); 24 add_event_handler('loc_end_section_init', 'crypto_section_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30);25 29 30 if (defined('IN_ADMIN')) 31 { 32 add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu'); 33 } 34 else 35 { 36 add_event_handler('init', 'crypto_document_init'); 37 add_event_handler('loc_end_section_init', 'crypto_section_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30); 38 } 39 40 41 // plugin init 26 42 function crypto_init() 27 43 { 28 global $conf, $user; 44 global $conf, $pwg_loaded_plugins; 45 46 if ( 47 CRYPTO_VERSION == 'auto' or 48 $pwg_loaded_plugins[CRYPTO_ID]['version'] == 'auto' or 49 version_compare($pwg_loaded_plugins[CRYPTO_ID]['version'], CRYPTO_VERSION, '<') 50 ) 51 { 52 include_once(CRYPTO_PATH . 'include/install.inc.php'); 53 crypto_install(); 54 55 if ( $pwg_loaded_plugins[CRYPTO_ID]['version'] != 'auto' and CRYPTO_VERSION != 'auto' ) 56 { 57 $query = ' 58 UPDATE '. PLUGINS_TABLE .' 59 SET version = "'. CRYPTO_VERSION .'" 60 WHERE id = "'. CRYPTO_ID .'"'; 61 pwg_query($query); 62 63 $pwg_loaded_plugins[CRYPTO_ID]['version'] = CRYPTO_VERSION; 64 65 if (defined('IN_ADMIN')) 66 { 67 $_SESSION['page_infos'][] = 'Crypto Captcha updated to version '. CRYPTO_VERSION; 68 } 69 } 70 } 29 71 30 72 $conf['cryptographp'] = unserialize($conf['cryptographp']); 73 } 74 75 76 // modules : picture comment & register 77 function crypto_document_init() 78 { 79 global $conf, $user; 31 80 32 81 if (!is_a_guest()) return; 33 82 if ($user['theme'] == 'smartpocket') return; 34 83 35 if ( script_basename() == 'register' and $conf['cryptographp']['activate_on']['register'])84 if ( script_basename() == 'register' and $conf['cryptographp']['activate_on']['register'] ) 36 85 { 37 86 $conf['cryptographp']['template'] = 'register'; 38 87 include(CRYPTO_PATH.'include/register.inc.php'); 39 88 } 40 else if ( script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture'])89 else if ( script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture'] ) 41 90 { 42 91 $conf['cryptographp']['template'] = 'comment'; … … 46 95 } 47 96 97 // modules : album comment & contact & guestbook 48 98 function crypto_section_init() 49 99 { … … 62 112 include(CRYPTO_PATH.'include/category.inc.php'); 63 113 } 64 else if ( preg_match('#contact/?$#', $_SERVER['REQUEST_URI']) and $conf['cryptographp']['activate_on']['contactform'])114 else if ( isset($page['section']) and $page['section'] == 'contact' and $conf['cryptographp']['activate_on']['contactform'] ) 65 115 { 66 116 $conf['cryptographp']['template'] = 'contactform'; 67 117 include(CRYPTO_PATH.'include/contactform.inc.php'); 68 118 } 69 else if ( isset($page['section']) and $page['section'] == 'guestbook' and $conf['cryptographp']['activate_on']['guestbook'])119 else if ( isset($page['section']) and $page['section'] == 'guestbook' and $conf['cryptographp']['activate_on']['guestbook'] ) 70 120 { 71 $conf['cryptographp']['template'] = ' comment';121 $conf['cryptographp']['template'] = 'guestbook'; 72 122 include(CRYPTO_PATH.'include/guestbook.inc.php'); 73 123 } 74 124 } 75 125 76 if (script_basename() == 'admin') 126 127 // admin 128 function crypto_plugin_admin_menu($menu) 77 129 { 78 add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu'); 79 80 function crypto_plugin_admin_menu($menu) 81 { 82 array_push($menu, array( 83 'NAME' => 'Crypto Captcha', 84 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) 85 )); 86 return $menu; 87 } 130 array_push($menu, array( 131 'NAME' => 'Crypto Captcha', 132 'URL' => CRYPTO_ADMIN, 133 )); 134 return $menu; 88 135 } 89 136 -
extensions/CryptograPHP/maintain.inc.php
r19428 r20189 1 1 <?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 ))); 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 27 3 28 function plugin_install() 4 defined('CRYPTO_ID') or define('CRYPTO_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . CRYPTO_ID . '/include/install.inc.php'); 6 7 function plugin_install() 29 8 { 30 global $conf; 31 32 conf_update_param('cryptographp', crypto_default_config); 9 crypto_install(); 10 define('crypto_installed', true); 33 11 } 34 12 35 13 function plugin_activate() 36 14 { 37 global $conf; 38 39 if (isset($conf['cryptograph_theme'])) 15 if (!defined('crypto_installed')) 40 16 { 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(); 67 18 } 68 19 }
Note: See TracChangeset
for help on using the changeset viewer.