source: extensions/Front2Back/Front2Back.php @ 10165

Last change on this file since 10165 was 9784, checked in by mistic100, 13 years ago

[extensions] Front2Back

  • new admin page
  • some changes in config
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1<?php 
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4function Front2Back_content($content, $image)
5{
6        global $template, $conf;
7        $conf['Front2Back'] = explode(',', $conf['Front2Back']);
8        load_language('plugin.lang', F2B_PATH);
9
10        /* dirs and files */
11        if (empty($conf['Front2Back'][0])) {
12                $verso_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][1];
13                $hd_dir = str_replace($image['file'], null, $image['path']) . $conf['Front2Back'][2];
14        } else {
15                $verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1];
16                $hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2];
17        }
18        $verso_file = get_filename_wo_extension($image['file']) . $conf['Front2Back'][3] . '.' . get_extension($image['file']);
19        $rotat_file = get_filename_wo_extension($image['file']) . '-r.' . get_extension($image['file']);
20
21        $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') );
22        $template->assign('F2B_PATH', F2B_PATH);
23
24        /* Is there a verso file ? */
25        if (is_file($verso_dir.$verso_file)) 
26        {
27                $template->assign('VERSO_URL', $verso_dir.$verso_file);
28
29                if (is_file($hd_dir.$verso_file)) {
30                        $template->assign('VERSO_HD', $hd_dir.$verso_file);
31                }
32        }
33        /* useless section, just for retrocompatibility */
34        else if (is_file($verso_dir.$rotat_file)) 
35        {           
36                $template->assign('VERSO_URL', $verso_dir.$rotat_file); 
37               
38                if (is_file($hd_dir.$rotat_file)) {
39                        $template->assign('VERSO_HD', $hd_dir.$rotat_file);
40                }
41        }
42        /* otherwise */
43        else 
44        {
45                return $content;
46        }
47       
48        return $content . $template->parse('Front2Back', true);   
49} 
50
51?>
Note: See TracBrowser for help on using the repository browser.