diff options
author | rub <rub@piwigo.org> | 2007-03-12 22:33:53 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2007-03-12 22:33:53 +0000 |
commit | 4577278acc361facfbd70c6172355ee12e1b80e4 (patch) | |
tree | b3dd0bad7db7c0874002b8cf46ebe9dc18d34cc7 /plugins/admin_advices/main.inc.php | |
parent | 590b03a3e5685932fa86355bb48bc5a5f962cc88 (diff) |
Apply property svn:eol-style Value: LF
git-svn-id: http://piwigo.org/svn/trunk@1900 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | plugins/admin_advices/main.inc.php | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/plugins/admin_advices/main.inc.php b/plugins/admin_advices/main.inc.php index 6db9b358a..18600e4b1 100644 --- a/plugins/admin_advices/main.inc.php +++ b/plugins/admin_advices/main.inc.php @@ -1,119 +1,119 @@ -<?php /*
-Plugin Name: Admin Advices
-Version: 1.0
-Description: Give you an advice on the administration page.
-Plugin URI: http://www.phpwebgallery.net
-Author: PhpWebGallery team
-Author URI: http://www.phpwebgallery.net
-*/
-
-add_event_handler('loc_end_page_header', 'set_admin_advice_add_css' );
-
-// Add a XHTML tag in HEAD section
-function set_admin_advice_add_css()
-{
- global $template, $page;
- if ( isset($page['body_id']) and $page['body_id']=='theAdminPage'
- and $page['page'] == 'intro'
- )
- {// This Plugin works only on the Admin page
- $template->assign_block_vars(
- 'head_element',
- array(
- 'CONTENT' => '<link rel="stylesheet" type="text/css" '
- . 'href="'.PHPWG_PLUGINS_PATH.'admin_advices/default-layout.css">',
- )
- );
- add_event_handler('loc_begin_page_tail', 'set_admin_advice' );
- }
-}
-
-// Build an advice on the Admin Intro page
-function set_admin_advice()
-{
- global $page, $user, $template, $conf;
-
-// Setup Advice Language (Maybe there is already a variable)
- $advlang = ( isset($user['language']) ) ?
- $user['language'] : $conf['default_language']; // en_UK.iso-8859-1
- $my_path = dirname(__FILE__).'/';
- $adv = array();
- if ( !@file_exists($my_path."$advlang/lang.adv.php") )
- {
- $advlang = 'en_UK.iso-8859-1';
- }
-// Include language advices
- @include_once( $my_path."$advlang/lang.adv.php" );
-
-// If there is an advice
- if ( $cond )
- {
- $template->set_filenames(array(
- 'admin_advice' => $my_path.'admin_advices.tpl')
- );
-
-// Random Thumbnail
- $query = '
-SELECT *
-FROM '.IMAGES_TABLE.'
-ORDER BY RAND(NOW())
-LIMIT 0, 1
-;';
- $result = pwg_query($query);
- $row = mysql_fetch_assoc($result);
- if ( is_array($row) )
- {
- $url_modify = get_root_url().'admin.php?page=picture_modify'
- .'&image_id='.$row['id'];
- $url_check = get_themeconf('icon_dir').'/';
- $url_uncheck = $url_check . 'uncheck';
- $url_check .= 'check';
- $picture_id = $row['id'];
- $query = '
-SELECT * FROM '.IMAGE_TAG_TABLE.'
-WHERE image_id = ' . $picture_id .'
-;';
- $tag_count = mysql_num_rows(mysql_query($query));
- $template->assign_block_vars(
- 'thumbnail',
- array(
- 'IMAGE' => get_thumbnail_url($row),
- 'IMAGE_ALT' => $row['file'],
- 'IMAGE_TITLE' => $row['name'],
- 'METADATA' => (empty($row['date_metadata_update'])) ?
- $url_uncheck : $url_check,
- 'NAME' => (empty($row['name'])) ?
- $url_uncheck : $url_check,
- 'COMMENT' => (empty($row['comment'])) ?
- $url_uncheck : $url_check,
- 'AUTHOR' => (empty($row['author'])) ?
- $url_uncheck : $url_check,
- 'CREATE_DATE' => (empty($row['date_creation'])) ?
- $url_uncheck : $url_check,
- 'TAGS' => ($tag_count == 0) ?
- $url_uncheck : $url_check,
- 'NUM_TAGS' => (string) $tag_count,
- 'U_MODIFY' => $url_modify,
- )
- );
- }
- $advice_text = array_shift($adv);
- $template->assign_vars(
- array(
- 'ADVICE_ABOUT' => '$conf[' . "'$confk'] ",
- 'ADVICE_TEXT' => $advice_text,
- )
- );
- foreach ($adv as $advice)
- {
- $template->assign_block_vars(
- 'More',
- array(
- 'ADVICE' => $advice
- )
- );
- }
- $template->parse('admin_advice');
- }
-}
-?>
+<?php /* +Plugin Name: Admin Advices +Version: 1.0 +Description: Give you an advice on the administration page. +Plugin URI: http://www.phpwebgallery.net +Author: PhpWebGallery team +Author URI: http://www.phpwebgallery.net +*/ + +add_event_handler('loc_end_page_header', 'set_admin_advice_add_css' ); + +// Add a XHTML tag in HEAD section +function set_admin_advice_add_css() +{ + global $template, $page; + if ( isset($page['body_id']) and $page['body_id']=='theAdminPage' + and $page['page'] == 'intro' + ) + {// This Plugin works only on the Admin page + $template->assign_block_vars( + 'head_element', + array( + 'CONTENT' => '<link rel="stylesheet" type="text/css" ' + . 'href="'.PHPWG_PLUGINS_PATH.'admin_advices/default-layout.css">', + ) + ); + add_event_handler('loc_begin_page_tail', 'set_admin_advice' ); + } +} + +// Build an advice on the Admin Intro page +function set_admin_advice() +{ + global $page, $user, $template, $conf; + +// Setup Advice Language (Maybe there is already a variable) + $advlang = ( isset($user['language']) ) ? + $user['language'] : $conf['default_language']; // en_UK.iso-8859-1 + $my_path = dirname(__FILE__).'/'; + $adv = array(); + if ( !@file_exists($my_path."$advlang/lang.adv.php") ) + { + $advlang = 'en_UK.iso-8859-1'; + } +// Include language advices + @include_once( $my_path."$advlang/lang.adv.php" ); + +// If there is an advice + if ( $cond ) + { + $template->set_filenames(array( + 'admin_advice' => $my_path.'admin_advices.tpl') + ); + +// Random Thumbnail + $query = ' +SELECT * +FROM '.IMAGES_TABLE.' +ORDER BY RAND(NOW()) +LIMIT 0, 1 +;'; + $result = pwg_query($query); + $row = mysql_fetch_assoc($result); + if ( is_array($row) ) + { + $url_modify = get_root_url().'admin.php?page=picture_modify' + .'&image_id='.$row['id']; + $url_check = get_themeconf('icon_dir').'/'; + $url_uncheck = $url_check . 'uncheck'; + $url_check .= 'check'; + $picture_id = $row['id']; + $query = ' +SELECT * FROM '.IMAGE_TAG_TABLE.' +WHERE image_id = ' . $picture_id .' +;'; + $tag_count = mysql_num_rows(mysql_query($query)); + $template->assign_block_vars( + 'thumbnail', + array( + 'IMAGE' => get_thumbnail_url($row), + 'IMAGE_ALT' => $row['file'], + 'IMAGE_TITLE' => $row['name'], + 'METADATA' => (empty($row['date_metadata_update'])) ? + $url_uncheck : $url_check, + 'NAME' => (empty($row['name'])) ? + $url_uncheck : $url_check, + 'COMMENT' => (empty($row['comment'])) ? + $url_uncheck : $url_check, + 'AUTHOR' => (empty($row['author'])) ? + $url_uncheck : $url_check, + 'CREATE_DATE' => (empty($row['date_creation'])) ? + $url_uncheck : $url_check, + 'TAGS' => ($tag_count == 0) ? + $url_uncheck : $url_check, + 'NUM_TAGS' => (string) $tag_count, + 'U_MODIFY' => $url_modify, + ) + ); + } + $advice_text = array_shift($adv); + $template->assign_vars( + array( + 'ADVICE_ABOUT' => '$conf[' . "'$confk'] ", + 'ADVICE_TEXT' => $advice_text, + ) + ); + foreach ($adv as $advice) + { + $template->assign_block_vars( + 'More', + array( + 'ADVICE' => $advice + ) + ); + } + $template->parse('admin_advice'); + } +} +?> |