source: extensions/akBookStyle/trunk/ak_loader.php @ 3781

Last change on this file since 3781 was 3781, checked in by vdigital, 15 years ago

First version of ak_loader.php

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | akBookStyle  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2009      Nicolas Roudaire        http://www.nikrou.net  |
6// | Copyright(C) 2009      vdigital                                       |
7// +-----------------------------------------------------------------------+
8// | This program is free software; you can redistribute it and/or modify  |
9// | it under the terms of the GNU General Public License as published by  |
10// | the Free Software Foundation                                          |
11// |                                                                       |
12// | This program is distributed in the hope that it will be useful, but   |
13// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
14// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
15// | General Public License for more details.                              |
16// |                                                                       |
17// | You should have received a copy of the GNU General Public License     |
18// | along with this program; if not, write to the Free Software           |
19// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
20// | USA.                                                                  |
21// +-----------------------------------------------------------------------+
22
23if (!defined('AK_PLUGIN_ROOT')) {
24  die('Hacking attempt!');
25}
26// This part of code is intended to be included in the akBookStyle plugin
27// But the reload parameter might be coded in any jQuery load statement of any existing .tpl
28// So the associated .tpl to picture_reload will be parsed and reloaded in the reload div of the page.
29
30// By default the associated template is ak_reloaded_image.tpl
31
32// Logic:
33// basename should be picture.php
34// if $_GET['reload'] is NOT set return to normal picture.php process
35// else
36// parse the picture_reload template
37// end
38
39if ( !isset($_GET['reload']) or !isset($page['image_id']) ) {
40  return;
41}
42global $template;
43$ak_ids = pwg_get_session_var('image_ids', array());
44/* Fill in correctly */
45  $query = '
46SELECT img.*
47  FROM '.IMAGES_TABLE.' AS img INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
48  WHERE id='.$page['image_id']
49        . get_sql_condition_FandF(
50            array('forbidden_categories' => 'category_id'),
51            " AND"
52          ).'
53  LIMIT 1';
54$picture['current'] = mysql_fetch_array(pwg_query($query));
55if ($picture['current']['level']>$user['level'])
56{
57  access_denied();
58}
59
60
61/* On going */
62$AK_PIC_SRC = get_image_path( $picture['current'] );
63$AK_PIC_ALT = "Alt de l'image";
64$AK_PIC_TITLE = "Titre de l'image";
65$AK_PREVIOUS['U_PIC'] = "www.previous.com";
66$AK_PREVIOUS['TITLE'] = "Titre de Previous";
67$AK_PREVIOUS['load'] = 'load';
68
69$AK_NEXT['U_PIC'] = "www.next.com";
70$AK_NEXT['TITLE'] = "Titre de Next";
71$AK_NEXT['load'] = 'load';
72$template->set_filenames( array('picture_reload' => dirname(__FILE__) . '/ak_reloaded_image.tpl'));
73$template->assign( 'AK_PIC_SRC', $AK_PIC_SRC );
74$template->pparse('picture_reload');
75exit(0);
76
77?>
Note: See TracBrowser for help on using the repository browser.