/
openpopup.php
executable file
·78 lines (62 loc) · 1.42 KB
/
openpopup.php
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
<?
#This program is copyright by Andre Coetzee email: ac@main.me
#and is licensed under the GPL v3
#
#
#
#
#Please add yourself to: http://www.accounting-123.com
#Developers, Software Vendors, Support, Accountants, Users
#
#
#The full software license can be found here:
#http://www.accounting-123.com/a.php?a=153/GPLv3
#
#
#
#
#
#
#
#
#
#
#
require ("settings.php");
if(!isset($_GET["redir"]) OR (strlen($_GET["redir"]) < 1)){
return "Invalid use of module.";
}
$redir = $_GET["redir"];
$navlink_target = getNavLinkTarget();
$OUTPUT = "
<script>
function link(url) {
if ($navlink_target == 0) {
document.location.href = url;
} else {
popupSized(url, 'popup' + url, 800, 600,'');
}
}
link('$redir');
</script>";
require ("template.php");
function getNavLinkTarget()
{
db_conn("cubit");
$sql = "SELECT LOWER(SUBSTR(value, 1, 1)) FROM settings WHERE constant='NAVLINK_TARGET'";
$rslt = db_exec($sql) or errDie("Error reading navigation link target.");
if (pg_num_rows($rslt) <= 0) {
$sql = "
INSERT INTO settings (
constant, label, value, type, datatype, minlen, maxlen, div, readonly
) VALUES (
'NAVLINK_TARGET', 'Home Navigation Opens in New Window', 'Yes', 'layout', 'string', '2', '3', 0, 't'
)";
$rslt = db_exec($sql) or errDie("Error updating navigation link target (INS).");
$nlt = "y";
} else {
$nlt = pg_fetch_result($rslt, 0, 0);
}
return (($nlt == "y") ? "1" : "0");
}
?>