-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinnova.php
84 lines (71 loc) · 2.51 KB
/
innova.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
79
80
81
82
83
84
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");
require_once("include/dbcommon.php");
$shortTable = postvalue("table");
$table = GetTableByShort( $shortTable );
if( !$table )
exit(0);
$pageName = postvalue('page');
$ptype = postvalue("ptype");
$field = postvalue("field");
if( !Security::userHasFieldPermissions( $table, $field, $ptype, $pageName, true ) )
return;
$pSet = new ProjectSettings($table, $ptype, $pageName);
$gQuery = $pSet->getSQLQuery();
$_connection = $cman->byTable( $table );
// construct sql
$data = false;
if( @$_GET["action"]<>"add" )
{
$keysArr = $pSet->getTableKeys();
$keys = array();
foreach ($keysArr as $ind=>$k)
$keys[$k] = postvalue("key".($ind+1));
$where = KeyWhere($keys, $table);
if($pSet->getAdvancedSecurityType() == ADVSECURITY_VIEW_OWN)
$where = whereAdd($where,SecuritySQL("Search", $table ));
$sql = $gQuery->gSQLWhere($where);
$qResult = $_connection->query( $sql );
if(!$qResult)
return;
$data = $qResult->fetchAssoc();
}
else
{
$data = array();
$data[$field] = @$_SESSION[$table."_".$field."_rte"];
}
$nWidth = $pSet->getNCols($field);
$nHeight = $pSet->getNRows($field);
if( $nHeight< 300 )
$nHeight = 300;
$id = postvalue_number("id");
$cfieldname = GoodFieldName($field)."_".($id!=='' ? $id : '1');
$cfield = "value_".GoodFieldName($field)."_".($id!=='' ? $id : '1');
$onsubmit = "";
if(@$_REQUEST["browser"]!="ie")
$onsubmit = "onsubmit = \"return document.getElementById('".$cfield."').value;\"";
echo '<html>
<body style="margin:0;">
<form name="innovaform" '.$onsubmit.'>
<script type="text/javascript" src="'. GetFullSiteUrl() . ("plugins/innovaeditor/scripts/innovaeditor.js").'"></script>
<textarea id="'.$cfield.'" name="'.$cfield.'" style="width:100%; height:'.($nHeight).'px;">';
if($data)
echo runner_htmlspecialchars($data[$field]);
echo' </textarea>
<script>
oEdit'.$cfieldname.' = new InnovaEditor("oEdit'.$cfieldname.'");
oEdit'.$cfieldname.'.mode = "HTMLBody";
oEdit'.$cfieldname.'.width = "100%";
oEdit'.$cfieldname.'.height = "'.($nHeight).'px";
oEdit'.$cfieldname.'.cmdAssetManager = "modalDialogShow(\"'. GetFullSiteUrl() .'plugins/innovaeditor/assetmanager/'.GetTableLink("assetmanager").'\",640,445);";
oEdit'.$cfieldname.'.arrCustomButtons = [["AssetManager", oEdit'.$cfieldname.'.cmdAssetManager, "Asset Manager", "btnCustom1.gif"]];
//oEdit'.$cfieldname.'.features = ["Preview"];
oEdit'.$cfieldname.'.REPLACE("'.$cfield.'");
</script>
</form>
</body>
</html>';
return;
?>