Changeset 17658
- Timestamp:
- Aug 29, 2012, 5:33:08 PM (12 years ago)
- Location:
- extensions/ContactForm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContactForm/include/functions.inc.php
r17518 r17658 48 48 )); 49 49 } 50 }51 52 /**53 * admin plugins menu link54 */55 function contact_form_admin_menu($menu)56 {57 array_push($menu, array(58 'URL' => CONTACT_FORM_ADMIN,59 'NAME' => 'Contact Form',60 ));61 return $menu;62 50 } 63 51 -
extensions/ContactForm/main.inc.php
r17518 r17658 11 11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 12 12 13 define('CONTACT_FORM_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');14 define('CONTACT_FORM_ADMIN', get_root_url() . 'admin.php?page=plugin- ' . basename(dirname(__FILE__)));13 define('CONTACT_FORM_PATH', PHPWG_PLUGINS_PATH . 'ContactForm/'); 14 define('CONTACT_FORM_ADMIN', get_root_url() . 'admin.php?page=plugin-ContactForm'); 15 15 define('CONTACT_FORM_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/'); 16 define('CONTACT_FORM_VERSION', '2.4.d'); 16 17 17 18 18 19 add_event_handler('init', 'contact_form_init'); 20 19 21 add_event_handler('loc_end_section_init', 'contact_form_section_init'); 20 22 add_event_handler('loc_end_index', 'contact_form_page'); 21 23 add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 24 22 25 if (defined('IN_ADMIN')) 23 26 { … … 28 31 29 32 33 /** 34 * update & unserialize conf & load language & init emails 35 */ 30 36 function contact_form_init() 31 37 { 32 global $conf, $template; 38 global $conf, $template, $pwg_loaded_plugins; 39 40 if ( 41 $pwg_loaded_plugins['ContactForm']['version'] == 'auto' or 42 version_compare($pwg_loaded_plugins['ContactForm']['version'], CONTACT_FORM_VERSION, '<') 43 ) 44 { 45 include_once(CONTACT_FORM_PATH . 'include/install.inc.php'); 46 contact_form_install(); 47 48 if ($pwg_loaded_plugins['ContactForm']['version'] != 'auto') 49 { 50 $query = ' 51 UPDATE '. PLUGINS_TABLE .' 52 SET version = "'. CONTACT_FORM_VERSION .'" 53 WHERE id = "ContactForm"'; 54 pwg_query($query); 55 56 $pwg_loaded_plugins['ContactForm']['version'] = CONTACT_FORM_VERSION; 57 58 if (defined('IN_ADMIN')) 59 { 60 $_SESSION['page_infos'][] = 'ContactForm updated to version '. CONTACT_FORM_VERSION; 61 } 62 } 63 } 64 33 65 $conf['ContactForm'] = unserialize($conf['ContactForm']); 34 35 66 load_language('plugin.lang', CONTACT_FORM_PATH); 36 67 … … 43 74 } 44 75 76 /** 77 * admin plugins menu link 78 */ 79 function contact_form_admin_menu($menu) 80 { 81 array_push($menu, array( 82 'URL' => CONTACT_FORM_ADMIN, 83 'NAME' => 'Contact Form', 84 )); 85 return $menu; 86 } 87 45 88 ?> -
extensions/ContactForm/maintain.inc.php
r17498 r17658 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 define('contact_form_default_config', 5 serialize(array( 6 'cf_must_initialize' => true, 7 'cf_menu_link' => true, 8 'cf_subject_prefix' => '%gallery_title%', 9 'cf_default_subject' => 'A comment on your site', 10 'cf_allow_guest' => true, 11 'cf_mandatory_mail' => true, 12 'cf_mandatory_name' => true, 13 'cf_redirect_delay' => 5, 14 'cf_mail_type' => 'text/html', 15 'cf_admin_mails' => array(), 16 )) 17 ); 18 4 include_once(PHPWG_PLUGINS_PATH . 'ContactForm/include/install.inc.php'); 19 5 20 6 function plugin_install() 21 7 { 22 conf_update_param('ContactForm', contact_form_default_config); 23 conf_update_param('ContactForm_before', null); 24 conf_update_param('ContactForm_after', null); 8 contact_form_install(); 9 define('contact_form_installed', true); 25 10 } 26 11 27 12 function plugin_activate() 28 13 { 29 global $conf; 30 31 if (!isset($conf['ContactForm'])) 14 if (!defined('contact_form_installed')) 32 15 { 33 plugin_install(); 34 } 35 else 36 { 37 $new_conf = unserialize($conf['ContactForm']); 38 39 // migration 2.4 -> 2.5 40 if (!isset($new_conf['cf_must_initialize'])) 41 { 42 $new_conf['cf_must_initialize'] = false; 43 $new_conf['cf_default_subject'] = 'A comment on your site'; 44 $new_conf['cf_mail_type'] = 'text/html'; 45 unset($new_conf['comment'], $new_conf['cf_redirect_delay']); 46 unset($new_conf['cf_separator'], $new_conf['cf_separator_length']); 47 48 foreach ($new_conf['cf_admin_mails'] as $email => $data) 49 { 50 $new_conf['cf_admin_mails'][] = array( 51 'email' => $email, 52 'name' => $data['NAME'], 53 'active' => $data['ACTIVE'], 54 ); 55 unset($new_conf['cf_admin_mails'][ $email ]); 56 } 57 58 conf_update_param('ContactForm', serialize($new_conf)); 59 conf_update_param('ContactForm_before', stripslashes($conf['persoformtop'])); 60 conf_update_param('ContactForm_after', stripslashes($conf['persoformbottom'])); 61 62 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param IN("persoformtop", "persoformbottom") LIMIT 2;'); 63 } 16 contact_form_install(); 64 17 } 65 18 }
Note: See TracChangeset
for help on using the changeset viewer.