Changeset 27196


Ignore:
Timestamp:
02/04/14 23:14:14 (6 years ago)
Author:
mistic100
Message:

Update for Piwigo 2.6

Location:
extensions/MostCommented
Files:
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • extensions/MostCommented/language/cs_CZ/plugin.lang.php

    r9603 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Nejcasteji hodnocený'; 
    4 $lang['most_commented_cat_hint'] = 'Zobraz nejcasteji hodnocené fotky'; 
     3$lang['Most commented'] = 'Nejcasteji hodnocený'; 
     4$lang['displays most commented pictures'] = 'Zobraz nejcasteji hodnocené fotky'; 
    55 
    66?> 
  • extensions/MostCommented/language/de_DE/plugin.lang.php

    r7359 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Am häufigsten kommentiert'; 
    4 $lang['most_commented_cat_hint'] = 'Zeigt die am häufigsten kommentierte Bilder an'; 
     3$lang['Most commented'] = 'Am häufigsten kommentiert'; 
     4$lang['displays most commented pictures'] = 'Zeigt die am häufigsten kommentierte Bilder an'; 
    55 
    66?> 
  • extensions/MostCommented/language/en_UK/plugin.lang.php

    r3609 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Most commented'; 
    4 $lang['most_commented_cat_hint'] = 'displays most commented pictures'; 
     3$lang['Most commented'] = 'Most commented'; 
     4$lang['displays most commented pictures'] = 'displays most commented pictures'; 
    55 
    66?> 
  • extensions/MostCommented/language/es_ES/plugin.lang.php

    r5788 r27196  
    11<?php 
    2 $lang['most_commented_cat'] = 'Las más comentadas'; 
    3 $lang['most_commented_cat_hint'] = 'Visualizar las imágenes más comentadas'; 
     2$lang['Most commented'] = 'Las más comentadas'; 
     3$lang['displays most commented pictures'] = 'Visualizar las imágenes más comentadas'; 
    44?> 
  • extensions/MostCommented/language/fr_FR/plugin.lang.php

    r3609 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Plus commentées'; 
    4 $lang['most_commented_cat_hint'] = 'afficher les images les plus commentées'; 
     3$lang['Most commented'] = 'Plus commentées'; 
     4$lang['displays most commented pictures'] = 'afficher les images les plus commentées'; 
    55 
    66?> 
  • extensions/MostCommented/language/hu_HU/plugin.lang.php

    r7217 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Legtöbb hozzászólás'; 
    4 $lang['most_commented_cat_hint'] = 'Megjeleníti a legtöbb hozzászólással rendelkező képeket'; 
     3$lang['Most commented'] = 'Legtöbb hozzászólás'; 
     4$lang['displays most commented pictures'] = 'Megjeleníti a legtöbb hozzászólással rendelkező képeket'; 
    55 
    66?> 
  • extensions/MostCommented/language/it_IT/plugin.lang.php

    r3478 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Le più commentate'; 
    4 $lang['most_commented_cat_hint'] = 'visualizzare le immagini le più commentate'; 
     3$lang['Most commented'] = 'Le più commentate'; 
     4$lang['displays most commented pictures'] = 'visualizzare le immagini le più commentate'; 
    55 
    66?> 
  • extensions/MostCommented/language/lv_LV/plugin.lang.php

    r7859 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Visvairāk komentētais'; 
    4 $lang['most_commented_cat_hint'] = 'rāda visvairāk komentētos attēlus'; 
     3$lang['Most commented'] = 'Visvairāk komentētais'; 
     4$lang['displays most commented pictures'] = 'rāda visvairāk komentētos attēlus'; 
    55 
    66?> 
  • extensions/MostCommented/language/nb_NO/plugin.lang.php

    r9099 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Mest kommenterte'; 
    4 $lang['most_commented_cat_hint'] = 'vis de mest kommenterte bilder'; 
     3$lang['Most commented'] = 'Mest kommenterte'; 
     4$lang['displays most commented pictures'] = 'vis de mest kommenterte bilder'; 
    55 
    66?> 
  • extensions/MostCommented/language/nl_NL/plugin.lang.php

    r10593 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Meeste commentaar'; 
    4 $lang['most_commented_cat_hint'] = 'toont meest becommentarieerde afbeeldingen'; 
     3$lang['Most commented'] = 'Meeste commentaar'; 
     4$lang['displays most commented pictures'] = 'toont meest becommentarieerde afbeeldingen'; 
    55 
    66?> 
  • extensions/MostCommented/language/pl_PL/plugin.lang.php

    r9319 r27196  
    11<?php 
    2 $lang['most_commented_cat'] = 'Najczęściej komentowane'; 
    3 $lang['most_commented_cat_hint'] = 'wyświetla najczęściej komentowane zdjęcia'; 
     2$lang['Most commented'] = 'Najczęściej komentowane'; 
     3$lang['displays most commented pictures'] = 'wyświetla najczęściej komentowane zdjęcia'; 
    44?> 
  • extensions/MostCommented/language/ru_RU/plugin.lang.php

    r7695 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Самые комментируемые'; 
    4 $lang['most_commented_cat_hint'] = 'Смотреть часто комментируемые фотографии'; 
     3$lang['Most commented'] = 'Самые комментируемые'; 
     4$lang['displays most commented pictures'] = 'Смотреть часто комментируемые фотографии'; 
    55 
    66?> 
  • extensions/MostCommented/language/sk_SK/plugin.lang.php

    r9524 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Najviac komentované'; 
    4 $lang['most_commented_cat_hint'] = 'zobraziť najviac komentované fotografie'; 
     3$lang['Most commented'] = 'Najviac komentované'; 
     4$lang['displays most commented pictures'] = 'zobraziť najviac komentované fotografie'; 
    55 
    66?> 
  • extensions/MostCommented/language/sv_SE/plugin.lang.php

    r10495 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Mest kommenterade'; 
    4 $lang['most_commented_cat_hint'] = 'Visar mest kommenterade bilder'; 
     3$lang['Most commented'] = 'Mest kommenterade'; 
     4$lang['displays most commented pictures'] = 'Visar mest kommenterade bilder'; 
    55 
    66?> 
  • extensions/MostCommented/language/tr_TR/plugin.lang.php

    r9133 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'En çok yorumlananlar'; 
    4 $lang['most_commented_cat_hint'] = 'En çok yorumlanan resimleri gösterir'; 
     3$lang['Most commented'] = 'En çok yorumlananlar'; 
     4$lang['displays most commented pictures'] = 'En çok yorumlanan resimleri gösterir'; 
    55 
    66?> 
  • extensions/MostCommented/language/vi_VN/plugin.lang.php

    r10148 r27196  
    11<?php 
    22 
    3 $lang['most_commented_cat'] = 'Bình luận nhiều nhất'; 
    4 $lang['most_commented_cat_hint'] = 'hiển thị ảnh được bình luận nhiều nhất'; 
     3$lang['Most commented'] = 'Bình luận nhiều nhất'; 
     4$lang['displays most commented pictures'] = 'hiển thị ảnh được bình luận nhiều nhất'; 
    55 
    66?> 
  • extensions/MostCommented/main.inc.php

    r7198 r27196  
    22/* 
    33Plugin Name: Most Commented 
    4 Version: 2.0.a 
     4Version: auto 
    55Description: Add a "Most Commented" link in "Specials" menu. 
    6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=145 
     6Plugin URI: auto 
    77Author: P@t 
    88Author URI: http://www.gauchon.com 
    99*/ 
    1010 
    11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
     11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 
    1212 
    1313define('MOSTCOMMENTED_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 
     14 
     15 
     16add_event_handler('init', 'init_mostcommented'); 
     17 
     18 
     19function init_mostcommented() 
     20{ 
     21  global $conf; 
     22   
     23  if ($conf['activate_comments']) 
     24  { 
     25    load_language('plugin.lang', MOSTCOMMENTED_PATH); 
     26 
     27    add_event_handler('blockmanager_apply' , 'add_link_mostcommented'); 
     28    add_event_handler('loc_end_section_init', 'section_init_mostcommented'); 
     29  } 
     30} 
    1431 
    1532function add_link_mostcommented($menu_ref_arr) 
     
    1734  global $conf; 
    1835 
    19   $menu = & $menu_ref_arr[0]; 
     36  $menu = &$menu_ref_arr[0]; 
    2037  $position = (isset($conf['mostcommented_position']) and is_numeric($conf['mostcommented_position'])) ? $conf['mostcommented_position'] : 3; 
    2138   
    22   if (($block = $menu->get_block('mbSpecials')) != null ) 
     39  if (($block = $menu->get_block('mbSpecials')) != null) 
    2340  { 
    24     load_language('plugin.lang', MOSTCOMMENTED_PATH); 
    25  
    2641    array_splice($block->data, $position-1, 0, array('most_commented' => 
    2742      array( 
    2843        'URL' => make_index_url(array('section' => 'most_commented')), 
    29         'TITLE' => l10n('most_commented_cat_hint'), 
    30         'NAME' => l10n('most_commented_cat') 
     44        'TITLE' => l10n('displays most commented pictures'), 
     45        'NAME' => l10n('Most commented') 
    3146        ) 
    3247      ) 
     
    3550} 
    3651 
    37 function section_init_most_commented() 
     52function section_init_mostcommented() 
    3853{ 
    39   global $tokens; 
    40   if (in_array('most_commented', $tokens)) 
    41     include(MOSTCOMMENTED_PATH . 'most_commented.php'); 
     54  global $tokens, $page, $conf; 
     55   
     56  if (!in_array('most_commented', $tokens)) 
     57  { 
     58    return; 
     59  } 
     60   
     61  $page['section'] = 'most_commented'; 
     62  $page['title'] = '<a href="' . duplicate_index_url() . '">' . l10n('Most commented') . '</a>'; 
     63  $page['section_title'] = '<a href="'.get_gallery_home_url().'">' . l10n('Home') . '</a>' 
     64    . $conf['level_separator'] . $page['title']; 
     65 
     66  $query = ' 
     67SELECT DISTINCT image_id 
     68    FROM ' . IMAGE_CATEGORY_TABLE . ' 
     69    WHERE ' .   
     70      get_sql_condition_FandF( 
     71        array( 
     72          'forbidden_categories' => 'category_id', 
     73          'visible_categories' => 'category_id', 
     74          'visible_images' => 'image_id', 
     75          ), 
     76        '', true 
     77        ) 
     78    . ' 
     79;'; 
     80 
     81  $img = query2array($query, null, 'image_id'); 
     82 
     83  if (empty($img)) 
     84  { 
     85    $page['items'] = array(); 
     86  } 
     87  else 
     88  { 
     89    $query = ' 
     90SELECT 
     91    img.id, 
     92    COUNT(*) AS count 
     93  FROM ' . IMAGES_TABLE . ' AS img 
     94    INNER JOIN ' . COMMENTS_TABLE . ' AS com 
     95    ON com.image_id = img.id 
     96  WHERE 
     97    img.id IN (' . implode(',', $img) . ') 
     98    AND com.validated = "true" 
     99  GROUP BY img.id 
     100  ORDER BY count DESC, img.hit DESC 
     101  LIMIT ' . $conf['top_number'] . ' 
     102;'; 
     103    $page['items'] = query2array($query, null, 'id'); 
     104  } 
     105   
     106  add_event_handler('loc_end_index_thumbnails', 'add_nb_comments_mostcommented'); 
    42107} 
    43108 
    44 add_event_handler('blockmanager_apply' , 'add_link_mostcommented'); 
    45 add_event_handler('loc_end_section_init', 'section_init_most_commented'); 
     109function add_nb_comments_mostcommented($tpl_thumbnails_var) 
     110{ 
     111  global $template, $user, $selection; 
    46112 
    47 ?> 
     113  // unsed sort order 
     114  $template->clear_assign('image_orders'); 
     115 
     116  // display nb comments if hidden by user 
     117  if (!$user['show_nb_comments']) 
     118  { 
     119    $query = ' 
     120SELECT image_id, COUNT(*) AS nb_comments 
     121  FROM '.COMMENTS_TABLE.' 
     122  WHERE validated = \'true\' 
     123    AND image_id IN ('.implode(',', $selection).') 
     124  GROUP BY image_id 
     125;'; 
     126    $nb_comments_of = query2array($query, 'image_id', 'nb_comments'); 
     127     
     128    foreach ($tpl_thumbnails_var as &$row) 
     129    { 
     130      $row['NB_COMMENTS'] = $nb_comments_of[$row['id']]; 
     131    } 
     132    unset($row); 
     133  } 
     134 
     135  return $tpl_thumbnails_var; 
     136} 
  • extensions/MostCommented/maintain.inc.php

    r3609 r27196  
    44{ 
    55  $q = pwg_query('SHOW COLUMNS FROM ' . HISTORY_TABLE . ' LIKE "section"'); 
    6   $section = mysql_fetch_array($q); 
     6  $section = pwg_db_fetch_array($q); 
    77  $type = $section['Type']; 
    88 
    99  if (substr_count($type, 'most_commented') == 0) 
     10  { 
    1011    $type = strtr($type , array(')' => ',\'most_commented\')')); 
     12  } 
    1113 
    1214  pwg_query('ALTER TABLE ' . HISTORY_TABLE . ' CHANGE section section ' . $type . ' DEFAULT NULL'); 
    1315} 
    14  
    15 ?> 
Note: See TracChangeset for help on using the changeset viewer.