1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
<?php /** * SPAW Editor v.2 Standard dialog window * * Standard dialog window * @package spaw2 * @subpackage Dialogs * @author Alan Mendelevich <alan@solmetra.lt> * @copyright UAB Solmetra */ session_start(); if (!isset($_SESSION['logged_'])) { header('location:/index.php'); exit(); } error_reporting(E_ALL); include_once("../spaw.inc.php"); $module = SpawVars::getGetVar("module"); if (strpos($module, '/') || strpos($module, "\\")) die("illegal module name"); $dialog = SpawVars::getGetVar("dialog"); if (strpos($dialog, '/') || strpos($dialog, "\\")) die("illegal dialog name"); $lang = new SpawLang(SpawVars::getGetVar("lang")); $charset = $lang->getCharset(); if (SpawVars::getGetVar('charset') != '') { $charset = SpawVars::getGetVar('charset'); $lang->setOutputCharset($charset); }
if (SpawVars::getGetVar("scid") != '' && session_id() == '') session_start(); $config = new SpawConfig(); $config->restoreSecureConfig(SpawVars::getGetVar("scid"));
$theme = SpawTheme::getTheme(SpawVars::getGetVar("theme")); $htpl = $theme->getTemplateDialogHeader(); $htpl = str_replace('{SPAW DIALOG TITLE}', $lang->m('title', $dialog, $module), $htpl); $htpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $htpl); $ftpl = $theme->getTemplateDialogFooter(); $ftpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $ftpl);
ob_start(); ?> <html> <head> <title><?php echo $lang->m('title', $dialog, $module) ?></title> <meta http-equiv="content-type" content="text/html;charset=<?php echo $charset ?>" /> <script type="text/javascript" src="../js/spaw.js.php"></script> <script type="text/javascript"> <!-- SpawEngine.spaw_dir = "<?php echo SpawConfig::getStaticConfigValue('SPAW_DIR') ?>"; SpawEngine.setPlatform('php');
function SpawDialog() { } SpawDialog.resizeDialogToContent = function() { if (window.sizeToContent) { // gecko window.sizeToContent(); } else { // resize window so there are no scrollbars visible if (!spawEditor._dialog_chrome_width) { // do these calculations only once for each spaw instance on a page window.resizeTo(600, 500); spawEditor._dialog_chrome_width = 600 - document.body.clientWidth; spawEditor._dialog_chrome_height = 500 - document.body.clientHeight; } window.resizeTo(50, 40); window.resizeTo(document.body.scrollWidth + spawEditor._dialog_chrome_width, document.body.scrollHeight + spawEditor._dialog_chrome_height); } }
var spawArgs; var spawEditor; var spawArguments;
SpawDialog.dialogInit = function() { if (window.opener) { spawArgs = window.opener.dialogArguments; if (spawArgs == null) window.close(); spawEditor = spawArgs.editor; spawArguments = spawArgs.arguments; }
if (window.history.length == 0 || (window.sizeToContent && window.history.length == 1 /* Gecko */) || (navigator.vendor && navigator.vendor.indexOf('Apple')>-1 && window.history.length == 1) /* Safari */) // no need to resize and center on reloads { SpawDialog.resizeDialogToContent(); // center according to new dimensions window.moveTo(screen.availWidth/2 - document.body.clientWidth/2, screen.availHeight/2 - document.body.clientHeight/2); } }
SpawDialog.returnValue = function(result) { if (spawArgs.callback) { eval('window.opener.'+spawArgs.callback + '(spawEditor, result, spawArgs.tbi, spawArgs.sender)'); } } //--> </script> </head> <body onload="SpawDialog.dialogInit();" dir="<?php echo $lang->getDir() ?>"> <?php echo $htpl ?> <?php include(SpawConfig::getStaticConfigValue('SPAW_ROOT').'plugins/'.$module.'/dialogs/'.$dialog.'.inc.php'); ?> <?php echo $ftpl ?> </body> </html> <?php ob_end_flush(); ?>
|