Changeset 24889
- Timestamp:
- Oct 14, 2013, 6:35:28 PM (11 years ago)
- Location:
- extensions/GuestBook
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GuestBook/admin.php
r16347 r24889 24 24 25 25 $template->assign_var_from_handle('ADMIN_CONTENT', 'guestbook'); 26 27 28 ?> -
extensions/GuestBook/admin/config.php
r15948 r24889 1 1 <?php 2 if (!defined(' PHPWG_ROOT_PATH')) die('Hacking attempt!');2 if (!defined('GUESTBOOK_PATH')) die('Hacking attempt!'); 3 3 4 4 if (isset($_POST['submit'])) … … 10 10 'nb_comment_page' => $_POST['nb_comment_page'], 11 11 'activate_rating' => isset($_POST['activate_rating']), 12 'guest_can_view' => isset($_POST['guest_can_view']), 13 'guest_can_add' => isset($_POST['guest_can_add']), 12 14 ); 13 15 … … 18 20 $template->assign($conf['guestbook']); 19 21 20 $template->set_filename('guestbook', dirname(__FILE__).'/template/config.tpl'); 21 22 ?> 22 $template->set_filename('guestbook', realpath(GUESTBOOK_PATH . 'admin/template/config.tpl')); -
extensions/GuestBook/admin/pending.php
r15940 r24889 1 1 <?php 2 if (!defined(' PHPWG_ROOT_PATH')) die('Hacking attempt!');2 if (!defined('GUESTBOOK_PATH')) die('Hacking attempt!'); 3 3 4 4 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); … … 109 109 110 110 111 $template->set_filename('guestbook', dirname(__FILE__).'/template/pending.tpl');111 $template->set_filename('guestbook', realpath(GUESTBOOK_PATH . 'admin/template/pending.tpl')); 112 112 113 113 ?> -
extensions/GuestBook/admin/template/config.tpl
r15948 r24889 1 1 {combine_css path=$GUESTBOOK_PATH|@cat:'template/style.css'} 2 3 {footer_script}{literal} 4 $('input[name="comments_validation"]').on('change', function() { 5 $('#email_admin_on_comment_validation').toggle($(this).is(':checked')); 6 }) 7 .trigger('change'); 8 9 $('input[name="guest_can_view"]').on('change', function() { 10 $('#guest_can_add').toggle($(this).is(':checked')); 11 }) 12 .trigger('change'); 13 {/literal}{/footer_script} 2 14 3 15 <div class="titrePage"> … … 30 42 </li> 31 43 32 <li id="notifyAdmin">44 <li> 33 45 <strong>{'Notify administrators when a comment is'|@translate}</strong> 46 47 <label> 48 <input type="checkbox" name="email_admin_on_comment" {if ($email_admin_on_comment)}checked="checked"{/if}> {'added'|@translate} 49 </label> 34 50 35 51 <label id="email_admin_on_comment_validation"> 36 52 <input type="checkbox" name="email_admin_on_comment_validation" {if ($email_admin_on_comment_validation)}checked="checked"{/if}> {'pending validation'|@translate} 37 53 </label> 54 </li> 55 56 <li> 57 <strong>{'Guests (not registered) permissions :'|@translate}</strong> 38 58 39 59 <label> 40 <input type="checkbox" name="email_admin_on_comment" {if ($email_admin_on_comment)}checked="checked"{/if}> {'added'|@translate} 60 <input type="checkbox" name="guest_can_view" {if ($guest_can_view)}checked="checked"{/if}> {'view comments'|@translate} 61 </label> 62 63 <label id="guest_can_add"> 64 <input type="checkbox" name="guest_can_add" {if ($guest_can_add)}checked="checked"{/if}> {'add comment'|@translate} 41 65 </label> 42 66 </li> -
extensions/GuestBook/include/functions.inc.php
r21542 r24889 39 39 return $html; 40 40 } 41 42 ?> -
extensions/GuestBook/include/functions_comment.inc.php
r21542 r24889 168 168 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 169 169 170 $comment_url = get_absolute_root_url().add_url_params(GUESTBOOK_URL, array('comment_id'=>$comm['id']));170 $comment_url = add_url_params(GUESTBOOK_URL, array('comment_id'=>$comm['id'])); 171 171 172 172 $keyargs_content = array … … 237 237 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 238 238 239 $comment_url = get_absolute_root_url().add_url_params(GUESTBOOK_URL, array('comment_id'=>$comm['id']));239 $comment_url = add_url_params(GUESTBOOK_URL, array('comment_id'=>$comm['id'])); 240 240 241 241 $keyargs_content = array … … 322 322 pwg_query($query); 323 323 } 324 325 ?> -
extensions/GuestBook/include/guestbook.inc.php
r20181 r24889 106 106 // | add comment | 107 107 // +-----------------------------------------------------------------------+ 108 if ( isset( $_POST['content'] ) )108 if ( isset( $_POST['content'] ) && (!is_a_guest() || $conf['guestbook']['guest_can_add'])) 109 109 { 110 110 $comm = array( … … 289 289 } 290 290 291 $show_add_comment_form = true;291 $show_add_comment_form = !is_a_guest() || $conf['guestbook']['guest_can_add']; 292 292 if (isset($edit_comment)) 293 293 { … … 329 329 } 330 330 331 $template->assign('ABS_GUESTBOOK_PATH', dirname(__FILE__).'/../');331 $template->assign('ABS_GUESTBOOK_PATH', realpath(GUESTBOOK_PATH) . '/'); 332 332 $template->assign('GUESTBOOK_PATH', GUESTBOOK_PATH); 333 333 334 $template->set_filename('index', dirname(__FILE__).'/../template/guestbook.tpl'); 335 336 ?> 334 $template->set_filename('index', realpath(GUESTBOOK_PATH . 'template/guestbook.tpl')); -
extensions/GuestBook/include/import_tool.php
r16347 r24889 1 1 <?php 2 2 define('PHPWG_ROOT_PATH','../../../'); 3 include_once( PHPWG_ROOT_PATH.'include/common.inc.php');3 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 4 4 5 5 if (!is_admin()) die('Access denied'); 6 6 ?> 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 8 "http://www.w3.org/TR/html4/strict.dtd"> 9 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> 7 <!DOCTYPE html> 8 <html lang="en" dir="ltr"> 10 9 <head> 11 10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> … … 58 57 { 59 58 ?> 60 Just enter the id of your old guestbook picture (the Idcan be found a the picture edition page, near the thumbnail) and click the <b>import</b> button.59 Just enter the ID of your old guestbook picture (the ID can be found a the picture edition page, near the thumbnail) and click the <b>import</b> button. 61 60 <form action="" method="post"> 62 <label>Image id.<input type="text" size="5" name="image_id"></label><br>61 <label>Image ID : <input type="text" size="5" name="image_id"></label><br> 63 62 <input type="submit" value="import"> 64 63 </form> -
extensions/GuestBook/language/en_UK/plugin.lang.php
r20181 r24889 13 13 $lang['Activate rating'] = 'Activate rating'; 14 14 $lang['%s says on %s :'] = '%s says on %s :'; 15 $lang['Guests (not registered) permissions :'] = 'Guests (not registered) permissions :'; 16 $lang['view comments'] = 'view comments'; 17 $lang['add comment'] = 'add comment'; 15 18 16 19 ?> -
extensions/GuestBook/language/fr_FR/plugin.lang.php
r20504 r24889 13 13 $lang['Activate rating'] = 'Activer la notation'; 14 14 $lang['%s says on %s :'] = '%s a dit le %s :'; 15 $lang['Guests (not registered) permissions :'] = 'Droits des visiteurs (non enregistrés) :'; 16 $lang['view comments'] = 'voir les commentaires'; 17 $lang['add comment'] = 'ajouter un commentaire'; 15 18 16 19 ?> -
extensions/GuestBook/main.inc.php
r21292 r24889 4 4 Version: auto 5 5 Description: Add a guestbook to the gallery 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=6096 Plugin URI: auto 7 7 Author: Mistic 8 8 Author URI: http://www.strangeplanet.fr … … 14 14 15 15 16 define('GUESTBOOK_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 17 define('GUESTBOOK_TABLE' , $prefixeTable . 'guestbook'); 18 define('GUESTBOOK_ADMIN', get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__))); 19 define('GUESTBOOK_URL', get_absolute_root_url() . make_index_url(array('section' => 'guestbook'))); 16 defined('GUESTBOOK_ID') or define('GUESTBOOK_ID', basename(dirname(__FILE__))); 17 define('GUESTBOOK_PATH' , PHPWG_PLUGINS_PATH . GUESTBOOK_ID . '/'); 18 define('GUESTBOOK_TABLE' , $prefixeTable . 'guestbook'); 19 define('GUESTBOOK_ADMIN', get_root_url().'admin.php?page=plugin-' . GUESTBOOK_ID); 20 define('GUESTBOOK_URL', get_absolute_root_url() . make_index_url(array('section' => 'guestbook'))); 21 define('GUESTBOOK_VERSION', 'auto'); 20 22 21 add_event_handler('init', 'gb_init');22 23 23 function gb_init() 24 include_once(GUESTBOOK_PATH . 'include/events.inc.php'); 25 26 add_event_handler('init', 'guestbook_init'); 27 28 // admin page 29 if (defined('IN_ADMIN')) 24 30 { 25 global $conf; 31 add_event_handler('get_admin_plugin_menu_links', 'gb_admin_menu'); 32 } 33 34 // menu entry 35 add_event_handler('blockmanager_apply', 'gb_menubar_apply', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 36 37 // guestbook section 38 add_event_handler('loc_end_section_init', 'gb_section_init'); 39 add_event_handler('loc_end_index', 'gb_index'); 40 41 // stuff 42 // add_event_handler('get_stuffs_modules', 'gb_register_stuffs_module') 43 44 45 function guestbook_init() 46 { 47 global $conf, $pwg_loaded_plugins; 26 48 27 load_language('plugin.lang', GUESTBOOK_PATH); 28 $conf['guestbook'] = unserialize($conf['guestbook']); 29 30 // menubar 31 if (script_basename() != 'admin') 49 // apply upgrade if needed 50 if ( 51 GUESTBOOK_VERSION == 'auto' or 52 $pwg_loaded_plugins[GUESTBOOK_ID]['version'] == 'auto' or 53 version_compare($pwg_loaded_plugins[GUESTBOOK_ID]['version'], GUESTBOOK_VERSION, '<') 54 ) 32 55 { 33 add_event_handler('blockmanager_apply', 'gb_menubar_apply', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 34 } 35 else 36 { 37 add_event_handler('get_admin_plugin_menu_links', 'gb_admin_menu'); 56 // call install function 57 include_once(GUESTBOOK_PATH . 'include/install.inc.php'); 58 guestbook_install(); 59 60 // update plugin version in database 61 if ( $pwg_loaded_plugins[GUESTBOOK_ID]['version'] != 'auto' and GUESTBOOK_VERSION != 'auto' ) 62 { 63 $query = ' 64 UPDATE '. PLUGINS_TABLE .' 65 SET version = "'. GUESTBOOK_VERSION .'" 66 WHERE id = "'. GUESTBOOK_ID .'"'; 67 pwg_query($query); 68 69 $pwg_loaded_plugins[GUESTBOOK_ID]['version'] = GUESTBOOK_VERSION; 70 71 if (defined('IN_ADMIN')) 72 { 73 $_SESSION['page_infos'][] = 'GuestBook updated to version '. GUESTBOOK_VERSION; 74 } 75 } 38 76 } 39 77 40 // guestbook section 41 add_event_handler('loc_end_section_init', 'gb_section_init'); 42 add_event_handler('loc_end_index', 'gb_index'); 78 // load plugin language file 79 load_language('plugin.lang', GUESTBOOK_PATH); 43 80 44 // stuff45 // add_event_handler('get_stuffs_modules', 'gb_register_stuffs_module')81 // prepare plugin configuration 82 $conf['guestbook'] = unserialize($conf['guestbook']); 46 83 } 47 48 function gb_menubar_apply($menu_ref_arr)49 {50 $menu = &$menu_ref_arr[0];51 52 if ( ($block = $menu->get_block('mbMenu')) != null )53 {54 array_push($block->data, array(55 'URL' => GUESTBOOK_URL,56 'TITLE' => l10n('GuestBook'),57 'NAME' => l10n('GuestBook')58 ));59 }60 }61 62 function gb_section_init()63 {64 global $tokens, $page, $conf;65 66 if ($tokens[0] == 'guestbook')67 {68 add_event_handler('loc_begin_page_header', 'gb_page_header');69 70 $page['section'] = 'guestbook';71 $page['title'] = l10n('GuestBook');72 $page['section_title'] = '<a href="'.get_gallery_home_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('GuestBook');73 }74 }75 76 function gb_page_header()77 {78 global $page;79 $page['body_id'] = 'theGuestBook';80 }81 82 function gb_index()83 {84 global $template, $page, $conf;85 86 if (isset($page['section']) and $page['section'] == 'guestbook')87 {88 include(GUESTBOOK_PATH . '/include/guestbook.inc.php');89 }90 }91 92 /*function gb_register_stuffs_module($modules)93 {94 array_push($modules, array(95 'path' => GUESTBOOK_PATH . '/stuffs_module',96 'name' => GB_NAME,97 'description' => l10n('gb_stuffs_desc'),98 ));99 100 return $modules;101 }*/102 103 function gb_admin_menu($menu)104 {105 array_push($menu, array(106 'NAME' => 'GuestBook',107 'URL' => GUESTBOOK_ADMIN,108 ));109 return $menu;110 }111 112 ?> -
extensions/GuestBook/maintain.inc.php
r15948 r24889 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 // Default config 5 define('default_guestbook_config', serialize(array( 6 'comments_validation' => false, 7 'email_admin_on_comment' => false, 8 'email_admin_on_comment_validation' => false, 9 'nb_comment_page' => 15, 10 'activate_rating' => true, 11 ))); 4 defined('GUESTBOOK_ID') or define('GUESTBOOK_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . GUESTBOOK_ID . '/include/install.inc.php'); 12 6 13 7 // Installation 14 8 function plugin_install() 15 9 { 16 global $prefixeTable; 17 18 pwg_query(" 19 CREATE TABLE `" . $prefixeTable . "guestbook` ( 20 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 21 `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 22 `author` varchar(255) NOT NULL, 23 `author_id` smallint(5) DEFAULT NULL, 24 `anonymous_id` varchar(45) NOT NULL, 25 `email` varchar(255) DEFAULT NULL, 26 `website` varchar(255) DEFAULT NULL, 27 `content` longtext NOT NULL, 28 `rate` float(5,2) unsigned DEFAULT NULL, 29 `validated` enum('true','false') NOT NULL DEFAULT 'false', 30 `validation_date` datetime DEFAULT NULL, 31 PRIMARY KEY (`id`) 32 ) DEFAULT CHARSET=utf8 33 ;"); 34 35 conf_update_param('guestbook', default_guestbook_config); 10 guestbook_install(); 11 define('guestbook_installed', true 36 12 } 37 13 … … 39 15 function plugin_activate() 40 16 { 41 global $conf; 42 43 if (!isset($conf['guestbook'])) 17 if (!defined('guestbook_installed')) 44 18 { 45 conf_update_param('guestbook', default_guestbook_config);19 guestbook_install(); 46 20 } 47 21 } … … 50 24 function plugin_uninstall() 51 25 { 52 global $prefixeTable; 53 54 pwg_query("DROP TABLE `" . $prefixeTable . "guestbook`;"); 55 pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'guestbook';"); 26 guestbook_uninstall(); 56 27 } 57 ?>
Note: See TracChangeset
for help on using the changeset viewer.