[3339] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
[9782] | 4 | function Front2Back_content($content, $image) |
---|
[3339] | 5 | { |
---|
[9782] | 6 | global $template, $conf; |
---|
[9784] | 7 | $conf['Front2Back'] = explode(',', $conf['Front2Back']); |
---|
| 8 | load_language('plugin.lang', F2B_PATH); |
---|
[3339] | 9 | |
---|
[9782] | 10 | /* dirs and files */ |
---|
[9784] | 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]; |
---|
[9782] | 14 | } else { |
---|
[9784] | 15 | $verso_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][1]; |
---|
| 16 | $hd_dir = PHPWG_ROOT_PATH . $conf['Front2Back'][0] . $conf['Front2Back'][2]; |
---|
[9782] | 17 | } |
---|
[9784] | 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']); |
---|
[9782] | 20 | |
---|
[9784] | 21 | $template->set_filenames(array('Front2Back' => dirname(__FILE__) . '/template/Front2Back.tpl') ); |
---|
[9782] | 22 | $template->assign('F2B_PATH', F2B_PATH); |
---|
| 23 | |
---|
| 24 | /* Is there a verso file ? */ |
---|
[9784] | 25 | if (is_file($verso_dir.$verso_file)) |
---|
[9782] | 26 | { |
---|
[9784] | 27 | $template->assign('VERSO_URL', $verso_dir.$verso_file); |
---|
[9782] | 28 | |
---|
[9784] | 29 | if (is_file($hd_dir.$verso_file)) { |
---|
| 30 | $template->assign('VERSO_HD', $hd_dir.$verso_file); |
---|
[9782] | 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 | ?> |
---|