Changeset 31456


Ignore:
Timestamp:
Mar 18, 2016, 9:18:56 PM (8 years ago)
Author:
ddtddt
Message:

[extensions] - title - 2.8

Location:
extensions/title
Files:
4 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/title/initadmin.php

    r22676 r31456  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Title plugin for piwigo                                               |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2011 - 2016 ddtddt             http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
     21
    222if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    3 load_language('plugin.lang', TITLE_PATH);
     23//load_language('plugin.lang', TITLE_PATH);
    424
    525//Add link menu
     
    929  array_push($menu, array(
    1030        'NAME' => l10n('Page title'),
    11     'URL' => get_admin_plugin_menu_link(TITLE_PATH . 'admin/admin.php')));
     31    'URL' => get_admin_plugin_menu_link(TITLE_PATH . 'admin.php')));
    1232  return $menu;
    1333}
     
    2646function titlePadminfT($content, &$smarty)
    2747        {
    28   $search = '#</form>#';
     48  $search = '#<p style="margin:40px 0 0 0">#';
    2949 
    3050  $replacement = '
    31         <div>
    32                 <fieldset>
    33                   <br>
    34                         <legend>{\'Title - Plugin title\'|@translate}</legend>
    35                                 {\'title_photo\'|@translate}&nbsp;:&nbsp;<input type="text" name="insertitleP" value="{$titleCONTENT}" size="110" maxlenght="110">
    36                         <br>   
    37                         <br>
    38                                 <div style="text-align:center;">
    39                                 <input class="submit" name="subtitlephoto" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
    40                                 </div>
    41                 </fieldset>
    42         </div> 
    43 </form>';
     51    <p>
     52      <strong>{\'title_photo\'|@translate}</strong>
     53      <br>
     54      <textarea rows="4" cols="80" {if $useED==1}placeholder="{\'Use Extended Description tags...\'|@translate}"{/if} name="insertitleP" id="insertitleP" class="insertitleP">{$titleCONTENT}</textarea>
     55    </p>
     56       
     57<p style="margin:40px 0 0 0">';
    4458
    4559  return preg_replace($search, $replacement, $content);
    4660        }
    4761 
    48 function titlePadminA()
    49         {
    50                 load_language('plugin.lang', TITLE_PATH);
    51 if (isset($_GET['image_id']))
    52  {
    53         global $template, $prefixeTable;
    54 $query = '
    55 select id,title
    56   FROM ' . TITLE_PHOTO_TABLE . '
    57   WHERE id = '.$_GET['image_id'].'
    58   ;';
    59 $result = pwg_query($query);
    60 $row = pwg_db_fetch_assoc($result);
    61 $titleP=$row['title'];
    62   $template->assign(
    63     array(
    64       'titleCONTENT' => $titleP,
    65       ));
    66  }
    67  
    68 if (isset($_POST['subtitlephoto']))
    69  {
    70         $query = '
    71 DELETE
    72   FROM ' . TITLE_PHOTO_TABLE . '
    73   WHERE id = '.$_GET['image_id'].'
    74   ;';
    75 $result = pwg_query($query);
    76         $q = '
    77 INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['insertitleP'].'");';
    78     pwg_query($q);
    79  
    80   $template->assign(
    81     array(
    82       'titleCONTENT' => $_POST['insertitleP'],
    83       ));
     62function titlePadminA(){
     63  if (isset($_GET['image_id'])){
     64        global $template, $prefixeTable;
     65        $query = 'select id,title FROM ' . TITLE_PHOTO_TABLE . ' WHERE id = '.$_GET['image_id'].';';
     66        $result = pwg_query($query);
     67        $row = pwg_db_fetch_assoc($result);
     68    $titleP=$row['title'];
     69    $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
     70        if($PAED['state'] == 'active'){
     71          $template->assign('useED',1);
     72    }else{
     73      $template->assign('useED',0);
     74    }
     75    $template->assign(
     76      array(
     77        'titleCONTENT' => $titleP,
     78    ));
    8479  }
    85         }
     80  if (isset($_POST['insertitleP'])){
     81        $query = 'DELETE FROM ' . TITLE_PHOTO_TABLE . ' WHERE id = '.$_GET['image_id'].';';
     82        $result = pwg_query($query);
     83        $q = 'INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['insertitleP'].'");';
     84        pwg_query($q);
     85        $template->assign(
     86          array(
     87                'titleCONTENT' => $_POST['insertitleP'],
     88        ));
     89  }
     90}
    8691       
    8792//add prefiltre album
    88 add_event_handler('loc_end_cat_modify', 'titleAadminf', 60);
    89 add_event_handler('loc_end_cat_modify', 'titleAadminA', 60);
     93add_event_handler('loc_begin_admin', 'titleAadminf', 60);
     94add_event_handler('loc_begin_admin_page', 'titleAadminA', 60);
    9095
    9196function titleAadminf()
     
    97102function titleAadminfT($content, &$smarty)
    98103 {
    99   $search = '#</form>#';
     104  $search = '#<p style="margin:0">#';
    100105 
    101106  $replacement = '
    102         <div>
    103                 <fieldset>
    104                   <br>
    105                         <legend>{\'Title - Plugin title\'|@translate}</legend>
    106                                 {\'title_album\'|@translate}&nbsp;:&nbsp;<input type="text" name="insertitleA" value="{$titleCONTENT}" size="110" maxlenght="110">
    107                         <br>   
    108                         <br>
    109                                 <div style="text-align:center;">
    110                                 <input class="submit" name="subtitlealbum" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
    111                                 </div>
    112                 </fieldset>
    113         </div>
    114 </form>';
     107    <p>
     108      <strong>{\'title_album\'|@translate}</strong>
     109      <br>
     110      <textarea rows="4" cols="80" {if $useED==1}placeholder="{\'Use Extended Description tags...\'|@translate}"{/if} name="insertitleA" id="insertitleA" class="insertitleA">{$titleCONTENT}</textarea>
     111    </p>       
     112       
     113       
     114<p style="margin:0">';
    115115
    116116  return preg_replace($search, $replacement, $content);
    117117 }
    118118
    119  function titleAadminA()
    120         {
    121                 load_language('plugin.lang', TITLE_PATH);
    122 if (isset($_GET['cat_id']))
    123  {
     119function titleAadminA(){
     120  if (isset($_GET['cat_id'])){
    124121        global $template, $prefixeTable;
    125 $query = '
    126 select id,title
    127   FROM ' . TITLE_ALBUM_TABLE . '
    128   WHERE id = '.$_GET['cat_id'].'
    129   ;';
    130 $result = pwg_query($query);
    131 $row = pwg_db_fetch_assoc($result);
    132 $titleA=$row['title'];
    133 
    134   $template->assign(
    135     array(
    136       'titleCONTENT' => $titleA,
    137       ));
    138  }
    139  
    140 if (isset($_POST['subtitlealbum']))
    141  {
    142         $query = '
    143 DELETE
    144   FROM ' . TITLE_ALBUM_TABLE . '
    145   WHERE id = '.$_GET['cat_id'].'
    146   ;';
    147 $result = pwg_query($query);
    148         $q = '
    149 INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['insertitleA'].'");';
     122        $query = 'select id,title FROM ' . TITLE_ALBUM_TABLE . ' WHERE id = '.$_GET['cat_id'].';';
     123        $result = pwg_query($query);
     124        $row = pwg_db_fetch_assoc($result);
     125        $titleA=$row['title'];
     126    $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
     127        if($PAED['state'] == 'active'){
     128          $template->assign('useED',1);
     129    }else{
     130      $template->assign('useED',0);
     131    }
     132        $template->assign(
     133      array(
     134        'titleCONTENT' => $titleA,
     135    ));
     136  }
     137  if (isset($_POST['insertitleA'])){
     138        $query = 'DELETE FROM ' . TITLE_ALBUM_TABLE . ' WHERE id = '.$_GET['cat_id'].';';
     139        $result = pwg_query($query);
     140        $q = 'INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['insertitleA'].'");';
    150141    pwg_query($q);
    151                
    152   $template->assign(
    153     array(
    154       'titleCONTENT' => $_POST['insertitleA'],
    155       ));
     142        $template->assign(
     143      array(
     144        'titleCONTENT' => $_POST['insertitleA'],
     145    ));
    156146  }
    157         }
     147}
    158148
    159149?>
  • extensions/title/language/en_UK/index.php

    r9407 r31456  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    242// Recursive call
    253$url = '../';
  • extensions/title/language/en_UK/plugin.lang.php

    r22678 r31456  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Title plugin for piwigo                                               |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2011 - 2016 ddtddt             http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221
    3 $lang['Title - Plugin title'] = 'Page Title - Plugin title';
    422$lang['title_insbase'] = 'Saves title in the database';
    523$lang['title_photo'] = 'Page title for the photo';
  • extensions/title/language/fr_FR/index.php

    r9407 r31456  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    242// Recursive call
    253$url = '../';
  • extensions/title/language/fr_FR/plugin.lang.php

    r22678 r31456  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Title plugin for piwigo                                               |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2011 - 2016 ddtddt             http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221
    3 $lang['Title - Plugin title'] = 'Titre de la page - Plugin title';
    422$lang['title_insbase'] = 'Enregistrer le titre dans la base';
    523$lang['title_photo'] = 'Titre de la page pour la photo';
  • extensions/title/main.inc.php

    r29793 r31456  
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=507
    77Author: ddtddt
    8 Author URI: http://piwigo.org/
     8Author URI: http://temmii.com/piwigo/
    99*/
     10
     11// +-----------------------------------------------------------------------+
     12// | Title plugin for piwigo                                               |
     13// +-----------------------------------------------------------------------+
     14// | Copyright(C) 2011 - 2016 ddtddt             http://temmii.com/piwigo/ |
     15// +-----------------------------------------------------------------------+
     16// | This program is free software; you can redistribute it and/or modify  |
     17// | it under the terms of the GNU General Public License as published by  |
     18// | the Free Software Foundation                                          |
     19// |                                                                       |
     20// | This program is distributed in the hope that it will be useful, but   |
     21// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     22// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     23// | General Public License for more details.                              |
     24// |                                                                       |
     25// | You should have received a copy of the GNU General Public License     |
     26// | along with this program; if not, write to the Free Software           |
     27// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     28// | USA.                                                                  |
     29// +-----------------------------------------------------------------------+
    1030
    1131if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     
    1838define('TITLE_PHOTO_TABLE' , $prefixeTable . 'title_photo');
    1939define('TITLE_ALBUM_TABLE' , $prefixeTable . 'title_album');
     40define('TITLE_ADMIN',get_root_url().'admin.php?page=plugin-'.TITLE_DIR);
     41
     42add_event_handler('loading_lang', 'title_loading_lang');         
     43function title_loading_lang(){
     44  load_language('plugin.lang', TITLE_PATH);
     45}
    2046
    2147//prefiltre for change <title>
Note: See TracChangeset for help on using the changeset viewer.