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

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

2nd version close to the initial version (Not working currently).

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 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}
42define('PHPWG_ROOT_PATH','../../');
43define('IN_ADMIN', false);
44include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
45load_language('plugin.lang', WHOIS_ONLINE_PATH);
46include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
47include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
48
49$ak_ids = pwg_get_session_var('image_ids', array());
50/* Fill in correctly */
51  $query = '
52SELECT img.*
53  FROM '.IMAGES_TABLE.' AS img INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
54  WHERE id='.$page['image_id']
55        . get_sql_condition_FandF(
56            array('forbidden_categories' => 'category_id'),
57            " AND"
58          ).'
59  LIMIT 1';
60$picture['current'] = mysql_fetch_array(pwg_query($query));
61if ($picture['current']['level']>$user['level'])
62{
63  access_denied();
64}
65
66/* On going */
67$AK_PIC_SRC = get_image_path( $picture['current'] );
68$AK_PIC_ALT = "Alt de l'image";
69$AK_PIC_TITLE = "Titre de l'image";
70$AK_PREVIOUS['U_PIC'] = "www.previous.com";
71$AK_PREVIOUS['TITLE'] = "Titre de Previous";
72$AK_PREVIOUS['load'] = 'load';
73
74$AK_NEXT['U_PIC'] = "www.next.com";
75$AK_NEXT['TITLE'] = "Titre de Next";
76$AK_NEXT['load'] = 'load';
77$template->set_filenames( array('picture_reload' => dirname(__FILE__) . '/ak_reloaded_image.tpl'));
78$template->assign( 'AK_PIC_SRC', $AK_PIC_SRC );
79$template->pparse('picture_reload');
80exit(255);
81
82?>
Note: See TracBrowser for help on using the repository browser.