Ignore:
Timestamp:
Jan 6, 2014, 4:41:55 PM (10 years ago)
Author:
mistic100
Message:

Update for Piwigo 2.6
TODO: button on Admin Tools bar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/admin/photo.php

    r20804 r26470  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2012 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 
    24 if(!defined("PHPWG_ROOT_PATH")) die ("Hacking attempt!");
     2defined('GVIDEO_PATH') or die ("Hacking attempt!");
    253
    264include_once(GVIDEO_PATH.'include/functions.inc.php');
     5include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    276
    287
     
    309// | Basic checks                                                          |
    3110// +-----------------------------------------------------------------------+
    32 
    3311check_status(ACCESS_ADMINISTRATOR);
    3412
     
    4725$tabsheet->assign();
    4826
     27$page['active_menu'] = get_active_menu('photo');
     28
    4929// +-----------------------------------------------------------------------+
    5030// | Picture infos                                                         |
    5131// +-----------------------------------------------------------------------+
    52 global $gvideo;
     32global $gvideo; // request from GVIDEO_TABLE done when building tabsheet
    5333
    5434$query = '
     
    6848  if (empty($_POST['url']))
    6949  {
    70     array_push($page['errors'], l10n('Please fill the video URL'));
     50    $page['errors'][] = l10n('Please fill the video URL');
    7151  }
    7252  else if ($gvideo['url']!=$_POST['url'])
    7353  {
    74     if( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
     54    if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
    7555    {
    7656      if (isset($_POST['safe_mode']))
    7757      {
    78         array_push($page['errors'], l10n('an error happened'));
     58        $page['errors'][] = l10n('an error happened');
    7959      }
    8060      else
    8161      {
    82         array_push($page['errors'], l10n('Unable to contact host server'));
    83         array_push($page['errors'], l10n('Try in safe-mode'));
     62        $page['errors'][] = l10n('Unable to contact host server');
     63        $page['errors'][] = l10n('Try in safe-mode');
    8464      }
    8565    }
     
    9272  if (count($page['errors']) == 0)
    9373  {
    94     include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    9574
    9675    if ( $gvideo['url'] != $video['url'] )
     
    10079      $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
    10180      $thumb_source = $conf['data_location'].$thumb_name;
    102       if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true )
     81     
     82      if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true)
    10383      {
    10484        $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
     
    11595        );
    11696       
    117       if ( $_POST['sync_description'] and !empty($video['description']) )
     97      if ($_POST['sync_description'] and !empty($video['description']))
    11898      {
    11999        $updates['comment'] = pwg_db_real_escape_string($video['description']);
     
    123103        $updates['comment'] = null;
    124104      }
    125       if ( $_POST['sync_tags'] and !empty($video['tags']) )
     105      if ($_POST['sync_tags'] and !empty($video['tags']))
    126106      {
    127107        set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
     
    141121      $_POST['width'] = $_POST['height'] = '';
    142122    }
    143     else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) )
    144     {
    145       array_push($page['errors'], l10n('Width and height must be integers'));
     123    else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))
     124    {
     125      $page['errors'][] = l10n('Width and height must be integers');
    146126      $_POST['width'] = $_POST['height'] = '';
    147127    }
     
    167147      );
    168148     
    169     array_push($page['infos'], l10n('Video successfully updated'));
     149    $page['infos'][] = l10n('Video successfully updated');
    170150    $gvideo = array_merge($gvideo, $updates);
    171151  }
     
    177157if (isset($_FILES['photo_update']))
    178158{
    179   include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    180  
    181159  if ($_FILES['photo_update']['error'] !== UPLOAD_ERR_OK)
    182160  {
    183     array_push($page['errors'],
    184       file_upload_error_message($_FILES['photo_update']['error'])
    185       );
     161    $page['errors'][] = file_upload_error_message($_FILES['photo_update']['error']);
    186162  }
    187163  else
     
    195171      );
    196172
    197     array_push($page['infos'], l10n('The thumbnail was updated'));
     173    $page['infos'][] = l10n('The thumbnail was updated');
    198174  }
    199175}
     
    202178// | Add film frame                                                        |
    203179// +-----------------------------------------------------------------------+
    204 if ( function_exists('imagecreatetruecolor') and isset($_GET['add_film_frame']) )
    205 {
    206   include_once(GVIDEO_PATH . '/include/functions.inc.php');
    207   include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    208  
     180if (function_exists('imagecreatetruecolor') and isset($_GET['add_film_frame']))
     181{
    209182  $thumb_source = $conf['data_location'].$picture['file'];
    210183 
     
    242215));
    243216
    244 $template->set_filename('gvideo_content', dirname(__FILE__).'/template/photo.tpl');
    245 
    246 ?>
     217$template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'admin/template/photo.tpl'));
Note: See TracChangeset for help on using the changeset viewer.