diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-02-15 03:03:16 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-02-15 03:03:16 +0000 |
commit | ceb77253c30a0d0fb37d883685f0501d588caf78 (patch) | |
tree | 07cb5609ed2c7a075f0555ce7369e6d575a5ac1e | |
parent | 11714951b33d340f13400aa8fc9a2b971f8d8e8b (diff) |
- plugins: added new action user_init
- put in a new admin_multi_view:allows admins to change on the fly language/theme and view gallery as guest (useful for developers and just to show a 'new' way of using plugins)
- removed some warnings from history.php and increased table width to 99%
- remove unused admin language strings
git-svn-id: http://piwigo.org/svn/trunk@1821 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/history.php | 12 | ||||
-rw-r--r-- | include/user.inc.php | 1 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 40 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/admin.lang.php | 40 | ||||
-rw-r--r-- | plugins/admin_multi_view/controller.php | 113 | ||||
-rw-r--r-- | plugins/admin_multi_view/is_admin.inc.php | 42 | ||||
-rw-r--r-- | plugins/admin_multi_view/main.inc.php | 17 | ||||
-rw-r--r-- | template/yoga/admin/default-layout.css | 2 |
8 files changed, 194 insertions, 73 deletions
diff --git a/admin/history.php b/admin/history.php index 516e940cf..a4e2fddaa 100644 --- a/admin/history.php +++ b/admin/history.php @@ -258,7 +258,7 @@ SELECT $result = pwg_query($query); $history_lines = $user_ids = $category_ids = $image_ids = array(); - while ($row = mysql_fetch_array($result)) + while ($row = mysql_fetch_assoc($result)) { $user_ids[$row['user_id']] = 1; @@ -340,13 +340,17 @@ SELECT id, IF(name IS NULL, file, name) AS label , 'IP' => $line['IP'], 'IMAGE' => isset($line['image_id']) - ? $label_of_image[$line['image_id']] + ? ( isset($label_of_image[$line['image_id']]) + ? $label_of_image[$line['image_id']] + : 'deleted '.$line['image_id']) : $line['image_id'], 'SECTION' => $line['section'], 'CATEGORY' => isset($line['category_id']) - ? $name_of_category[$line['category_id']] + ? ( isset($name_of_category[$line['category_id']]) + ? $name_of_category[$line['category_id']] + : 'deleted '.$line['category_id'] ) : '', - 'TAG' => $line['tag_ids'], + 'TAGS' => $line['tag_ids'], 'T_CLASS' => ($i++ % 2) ? 'row1' : 'row2', ) ); diff --git a/include/user.inc.php b/include/user.inc.php index b67d6e3e4..001a2a267 100644 --- a/include/user.inc.php +++ b/include/user.inc.php @@ -74,4 +74,5 @@ $user = build_user( $user['id'], ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true // use cache ? ); +trigger_action('user_init', $user); ?>
\ No newline at end of file diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index b0f01991f..8425ef9e5 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -504,7 +504,6 @@ $lang['is_default_group'] = 'default'; $lang['toggle_is_default_group'] = 'Toggle \'default group\' property'; $lang['Advanced_features'] = 'Advanced features'; $lang['Elements_not_linked'] = 'Not linked elements'; - $lang['web_services'] = 'Web services '; $lang['title_wscheck'] = ' Access management '; $lang['ws_set_status'] = ' Environment '; @@ -516,25 +515,7 @@ $lang['ws_success_upd'] = ' -> Successfully completed '; $lang['ws_adding_legend'] = ' Add a new partner access to Web Services '; $lang['ws_update_legend'] = ' Revoke / Update selected partner access '; $lang['ws_delete_legend'] = ' Revoke selected partner access '; -// $lang['ws_default_legend'] = ' Assumed defaults parameters in any missing cases '; -// $lang['ws_default'] = ' Default '; $lang['ws_Methods'] = ' Methods '; -// $lang['ws_requested_nbr'] = ' Number of images per request '; -$lang['ws_random'] = 'Random'; /* Random order */ -$lang['ws_list'] = 'Id list'; /* list on MBt & z0rglub request */ -$lang['ws_maxviewed'] = 'Most viewed'; /* hit > 0 and hit desc order */ -$lang['ws_recent'] = 'Most recent'; /* recent = Date_available desc order */ -$lang['ws_highrated'] = 'Best rated'; /* avg_rate > 0 and desc order */ -$lang['ws_oldest'] = 'Oldest'; /* Date_available asc order */ -$lang['ws_lessviewed'] = 'Less viewed'; /* hit asc order */ -$lang['ws_lowrated'] = 'Lowest rated'; /* avg_rate asc order */ -$lang['ws_undescribed'] = 'Undescribed'; /* description missing */ -$lang['ws_unnamed'] = 'Unnamed'; /* new name missing */ -$lang['ws_portraits'] = 'Portraits'; /* width < height (portrait oriented) */ -$lang['ws_landscapes'] = 'Landscapes'; /* width > height (landscape oriented) */ -$lang['ws_squares'] = 'Squares'; /* width ~ height (square form) */ -$lang['ws_high_auth'] = ' Authorize high resolution '; -$lang['ws_normal_auth'] = ' Authorize normal size '; $lang['ws_KeyName'] = ' Partner '; $lang['ws_Access'] = ' Access '; $lang['ws_Start'] = ' Start '; @@ -545,33 +526,24 @@ $lang['ws_Normal'] = ' Normal '; $lang['ws_Limit'] = ' Limit '; $lang['ws_Comment'] = ' Comment '; $lang['ws_disallowed'] = 'This change is disallowed or already done'; -// $lang['Reset filter(s)'] = ' Reset filter(s) '; -// $lang['New filter(s)'] = ' New filter(s) '; -// $lang['Not selected / Not confirmed'] = 'Access not selected or unconfirmed action'; $lang['Modify End from Now +'] = 'Modify End from Now + '; -$lang['Free comment, use it to identify your partner clearly'] = - ' Free comment, use it to identify your partner clearly '; +$lang['Free comment, use it to identify your partner clearly'] = ' Free comment, use it to identify your partner clearly '; $lang['Confirmation'] = ' Confirmation '; $lang['Delete'] = ' Remove '; $lang['Confidential partner key'] = 'Confidential partner key'; $lang['Basis of access key calculation'] = 'Basis of access key calculation'; $lang['Target'] = 'Target'; $lang['Access: see help text for more'] = 'Access: see help text for more'; -$lang['Facultative and restrictive option'] = - 'Facultative and restrictive option'; +$lang['Facultative and restrictive option'] = 'Facultative and restrictive option'; $lang['Postponed availability in days'] = 'Postponed availability in days'; $lang['Duration in days'] = 'Duration in days'; $lang['Restrict access to'] = 'Restrict access to'; -$lang['High resolution information will be returned to your partner'] = - 'High resolution information will be returned to your partner'; -$lang['Normal size information will be returned to your partner'] = - 'Normal size information will be returned to your partner'; +$lang['High resolution information will be returned to your partner'] = 'High resolution information will be returned to your partner'; +$lang['Normal size information will be returned to your partner'] = 'Normal size information will be returned to your partner'; $lang['Returned images limit'] = 'Returned images limit'; -$lang['Comment to identify your partner clearly'] = - 'Comment to identify your partner clearly'; +$lang['Comment to identify your partner clearly'] = 'Comment to identify your partner clearly'; $lang['Add this access definition'] = 'Add this access definition'; -$lang['Web Services availability duration in days'] = - 'Web Services availability duration in days'; +$lang['Web Services availability duration in days'] = 'Web Services availability duration in days'; $lang['special_admin_menu'] = 'Specials'; $lang['pictures_menu'] = 'Pictures'; $lang['note_check_exif'] = '%s must be to set to false in your config_local.inc.php file because exif are not supported.'; diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index c060ea908..a3a342913 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -515,25 +515,7 @@ $lang['ws_success_upd'] = ' -> Action réalisée correctement '; $lang['ws_adding_legend'] = ' Ajout d\'un accès partenaire aux Services Web '; $lang['ws_update_legend'] = ' Supprimer / Modifier l\'accès du partenaire sélectionné '; $lang['ws_delete_legend'] = ' Supprimer définitivement l\'accès du partenaire sélectionné '; -// $lang['ws_default_legend'] = ' Valeurs par défaut en situation de paramètre manquant '; -// $lang['ws_default'] = ' Défauts '; $lang['ws_Methods'] = ' Méthodes '; -// $lang['ws_requested_nbr'] = ' Nombre d\'images renvoyées '; -$lang['ws_random'] = 'Aléatoires'; /* Random order */ -$lang['ws_list'] = 'Liste d\'id'; /* list on MBt & z0rglub request */ -$lang['ws_maxviewed'] = 'Plus vues'; /* hit > 0 and hit desc order */ -$lang['ws_recent'] = 'Plus récentes'; /* recent = Date_available desc order */ -$lang['ws_highrated'] = 'Mieux notées'; /* avg_rate > 0 and desc order */ -$lang['ws_oldest'] = 'Plus anciennes'; /* Date_available asc order */ -$lang['ws_lessviewed'] = 'Moins vues'; /* hit asc order */ -$lang['ws_lowrated'] = 'Moins bien notées'; /* avg_rate asc order */ -$lang['ws_undescribed'] = 'Non décrites'; /* description missing */ -$lang['ws_unnamed'] = 'Non renommées'; /* new name missing */ -$lang['ws_portraits'] = 'Portraits'; /* width < height (portrait oriented) */ -$lang['ws_landscapes'] = 'Paysages'; /* width > height (landscape oriented) */ -$lang['ws_squares'] = 'Carrées'; /* width ~ height (square form) */ -$lang['ws_high_auth'] = ' Autoriser la haute résolution '; -$lang['ws_normal_auth'] = ' Autoriser la dimension normale '; $lang['ws_KeyName'] = ' Partenaire '; $lang['ws_Access'] = ' Access '; $lang['ws_Start'] = ' Début '; @@ -543,9 +525,6 @@ $lang['ws_High'] = ' High '; $lang['ws_Normal'] = ' Normal '; $lang['ws_Limit'] = ' Limite '; $lang['ws_Comment'] = ' Commentaire '; -// $lang['Reset filter(s)'] = ' Filtres désactivés '; -// $lang['New filter(s)'] = ' Nouveau(x) filtre(s)activé(s) '; -// $lang['Not selected / Not confirmed'] = 'Accès non sélectionné ou opération non confirmée'; $lang['Modify End from Now +'] = 'Modifier la Fin par cet instant + '; $lang['Confirmation'] = ' Confirmation '; $lang['Delete'] = ' Retrait '; @@ -554,30 +533,23 @@ $lang['Confidential partner key'] = 'Clé confidentielle'; $lang['Basis of access key calculation'] = 'Base de calcul de la clé'; $lang['Target'] = 'Cible'; $lang['Access: see help text for more'] = 'Accès: voir l\'aide en ligne'; -$lang['Facultative and restrictive option'] = - 'Option facultative et restrictive'; +$lang['Facultative and restrictive option'] = 'Option facultative et restrictive'; $lang['Postponed availability in days'] = 'Report de disponibilité en jours'; $lang['Duration in days'] = 'Durée en jours'; $lang['Restrict access to'] = 'Accès restreint à'; -$lang['High resolution information will be returned to your partner'] = - 'Les informations de la haute résolution seront transmises' . - ' à votre partenaire'; -$lang['Normal size information will be returned to your partner'] = - 'Les informations de l\'image normale seront transmises à votre partenaire'; +$lang['High resolution information will be returned to your partner'] = 'Les informations de la haute résolution seront transmises à votre partenaire'; +$lang['Normal size information will be returned to your partner'] = 'Les informations de l\'image normale seront transmises à votre partenaire'; $lang['Returned images limit'] = 'Limite de transmision'; -$lang['Comment to identify your partner clearly'] = - 'Commentaire vous permettant d\'identifier votre partenaire facilement'; +$lang['Comment to identify your partner clearly'] = 'Commentaire vous permettant d\'identifier votre partenaire facilement'; $lang['Add this access definition']= 'Ajouter cette définition d\'accès'; -$lang['Web Services availability duration in days'] = - 'Durée d\'ouverture des Services Web en jours'; +$lang['Web Services availability duration in days'] = 'Durée d\'ouverture des Services Web en jours'; $lang['special_admin_menu'] = 'Spécials'; $lang['pictures_menu'] = 'Images'; $lang['note_check_exif'] = '%s doit être mis à "false" dans votre fichier config_local.inc.php parce que l\'exif n\'est pas supporté.'; $lang['note_check_more_info'] = 'Allez sur %s ou %s pour plus d\'informations.'; $lang['note_check_more_info_forum'] = 'le forum'; $lang['note_check_more_info_wiki'] = 'le wiki'; -$lang['Duplicates'] = 'Fichiers portant le même nom dans plusieurs' . - ' catégories physiques'; +$lang['Duplicates'] = 'Fichiers portant le même nom dans plusieurs catégories physiques'; $lang['DEMO'] = 'DÉMO'; $lang['HOME'] = 'ACCUEIL PWG'; $lang['FORUM'] = 'FORUM'; diff --git a/plugins/admin_multi_view/controller.php b/plugins/admin_multi_view/controller.php new file mode 100644 index 000000000..a4566ed69 --- /dev/null +++ b/plugins/admin_multi_view/controller.php @@ -0,0 +1,113 @@ +<?php +define('MULTIVIEW_CONTROLLER', 1); +define('PHPWG_ROOT_PATH','../../'); +include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); + +if (!is_admin() or !function_exists('multiview_user_init') ) +{ + pwg_unset_session_var( 'multiview_as' ); + pwg_unset_session_var( 'multiview_theme' ); + pwg_unset_session_var( 'multiview_lang' ); +?> +<script type="text/javascript"> + window.close(); +</script> +<?php + exit(); +} + +$refresh_main = false; + +if ( isset($_GET['view_guest']) ) +{ + pwg_set_session_var( 'multiview_as', $conf['guest_id'] ); + $refresh_main = true; +} +elseif ( isset($_GET['view_admin']) ) +{ + pwg_unset_session_var('multiview_as'); + $refresh_main = true; +} +$view_as = pwg_get_session_var( 'multiview_as', 0 ); + + +if ( isset($_GET['theme']) ) +{ + pwg_set_session_var( 'multiview_theme', $_GET['theme'] ); + $refresh_main = true; +} + +if ( isset($_GET['lang']) ) +{ + pwg_set_session_var( 'multiview_lang', $_GET['lang'] ); + $refresh_main = true; +} + +$my_url = get_root_url().'plugins/'.basename(dirname(__FILE__)).'/'.basename(__FILE__); + +$themes_html='Theme: <select onchange="document.location = this.options[this.selectedIndex].value;">'; +foreach (get_pwg_themes() as $pwg_template) +{ + $selected = $pwg_template == pwg_get_session_var( 'multiview_theme', $user['template'].'/'.$user['theme'] ) ? 'selected="selected"' : ''; + $themes_html .= + '<option value="' + .$my_url.'?theme='.$pwg_template + .'" '.$selected.'>' + .$pwg_template + .'</option>'; +} +$themes_html .= '</select>'; + +$lang_html='Language: <select onchange="document.location = this.options[this.selectedIndex].value;">'; +foreach (get_languages() as $language_code => $language_name) +{ + $selected = $language_code == pwg_get_session_var( 'multiview_lang', $user['language'] ) ? 'selected="selected"' : ''; + $lang_html .= + '<option value="' + .$my_url.'?lang='.$language_code + .'" '.$selected.'>' + .$language_name + .'</option>'; +} +$lang_html .= '</select>'; +?> + +<html> +<head> +<title>Controller</title> +</head> + +<body> + +<script type="text/javascript"> +if (window.opener==null) { + window.close(); + document.write("<h2>How did you get here ???</h2>"); +} +</script> + +View as: +<?php + if ($view_as) + echo '<a href="'.$my_url.'?view_admin">admin</a>'; + else + echo '<a href="'.$my_url.'?view_guest">guest</a>'; +?> + +<br /> +<?php echo $themes_html; ?> + +<br /> +<?php echo $lang_html; ?> + + +<script type="text/javascript"> +<?php + if ($refresh_main) echo ' +window.opener.location = window.opener.location;'; +?> +</script> + +</body> + +</html>
\ No newline at end of file diff --git a/plugins/admin_multi_view/is_admin.inc.php b/plugins/admin_multi_view/is_admin.inc.php new file mode 100644 index 000000000..7dbedf8f3 --- /dev/null +++ b/plugins/admin_multi_view/is_admin.inc.php @@ -0,0 +1,42 @@ +<?php +if (! defined('MULTIVIEW_CONTROLLER') ) +{ + global $user; + $view_as = pwg_get_session_var( 'multiview_as', 0 ); + if ($view_as) + { + $user = build_user( $view_as, true); + } + $theme = pwg_get_session_var( 'multiview_theme', '' ); + if ( !empty($theme) ) + { + list($user['template'], $user['theme']) = explode('/', $theme); + } + $lang = pwg_get_session_var( 'multiview_lang', '' ); + if ( !empty($theme) ) + { + $user['language'] = $lang; + } +} + +add_event_handler('loc_end_page_header', 'multiview_loc_end_page_header'); + +function multiview_loc_end_page_header() +{ + global $template; + $my_root_url = get_root_url().'plugins/'. basename(dirname(__FILE__)).'/'; + $js = +'<script type="text/javascript"> +var theController = window.open("", "mview_controller", "alwaysRaised=yes,dependent=yes,toolbar=no,height=200,width=220,menubar=no,resizable=yes,scrollbars=yes,status=no"); +if ( theController.location.toString()=="about:blank" || !theController.location.toString().match(/^(https?.*\/)controller\.php(\?.+)?$/)) +{ + theController.location = "'.$my_root_url.'controller.php"; +} +</script>'; + + $template->assign_block_vars( 'head_element', array( + 'CONTENT' => $js + ) + ); +} +?> diff --git a/plugins/admin_multi_view/main.inc.php b/plugins/admin_multi_view/main.inc.php new file mode 100644 index 000000000..f0ed7a74d --- /dev/null +++ b/plugins/admin_multi_view/main.inc.php @@ -0,0 +1,17 @@ +<?php /* +Plugin Name: Multi view +Version: 1.0 +Description: Allows administrators to view gallery as guests and/or change the language and/or theme on the fly. Practical to debug changes ... +Plugin URI: http://www.phpwebgallery.net +*/ + +add_event_handler('user_init', 'multiview_user_init' ); + +function multiview_user_init() +{ + if (!is_admin()) + return; + include_once( dirname(__FILE__).'/is_admin.inc.php' ); +} + +?> diff --git a/template/yoga/admin/default-layout.css b/template/yoga/admin/default-layout.css index 6d916d555..fda57c497 100644 --- a/template/yoga/admin/default-layout.css +++ b/template/yoga/admin/default-layout.css @@ -35,7 +35,7 @@ TABLE#dailyStats { } TABLE#detailedStats { - width: 80%; + width: 99%; } /* categoryOrdering */ |