kenken999 commited on
Commit
da4884a
0 Parent(s):
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +36 -0
  2. .idea/inspectionProfiles/profiles_settings.xml +6 -0
  3. .idea/misc.xml +4 -0
  4. .idea/modules.xml +8 -0
  5. .idea/php.iml +15 -0
  6. .idea/vcs.xml +6 -0
  7. .idea/workspace.xml +49 -0
  8. php/.gitattributes +35 -0
  9. php/ConnectionManager.php +206 -0
  10. php/Dockerfile +17 -0
  11. php/README.md +10 -0
  12. php/admin_comments_edit.php +107 -0
  13. php/admin_comments_list.php +163 -0
  14. php/admin_comments_search.php +95 -0
  15. php/admin_members_list.php +56 -0
  16. php/admin_members_search.php +95 -0
  17. php/admin_rights_list.php +609 -0
  18. php/admin_rights_search.php +95 -0
  19. php/admin_users_add.php +108 -0
  20. php/admin_users_edit.php +107 -0
  21. php/admin_users_export.php +53 -0
  22. php/admin_users_import.php +53 -0
  23. php/admin_users_list.php +163 -0
  24. php/admin_users_print.php +46 -0
  25. php/admin_users_search.php +95 -0
  26. php/admin_users_view.php +67 -0
  27. php/api/api.php +148 -0
  28. php/api/v1.php +278 -0
  29. php/appointments_add.php +108 -0
  30. php/appointments_edit.php +107 -0
  31. php/appointments_export.php +53 -0
  32. php/appointments_import.php +53 -0
  33. php/appointments_list.php +163 -0
  34. php/appointments_print.php +46 -0
  35. php/appointments_search.php +95 -0
  36. php/appointments_view.php +67 -0
  37. php/autocomplete.php +60 -0
  38. php/autofillfields.php +42 -0
  39. php/buildpdf.php +17 -0
  40. php/buttonhandler.php +982 -0
  41. php/callVideo.mp3 +0 -0
  42. php/chat_files1_add.php +108 -0
  43. php/chat_files1_edit.php +107 -0
  44. php/chat_files1_export.php +53 -0
  45. php/chat_files1_import.php +53 -0
  46. php/chat_files1_list.php +163 -0
  47. php/chat_files1_print.php +46 -0
  48. php/chat_files1_search.php +95 -0
  49. php/chat_files1_view.php +67 -0
  50. php/chat_files_list.php +163 -0
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.png filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar filter=lfs diff=lfs merge=lfs -text
30
+ *.tflite filter=lfs diff=lfs merge=lfs -text
31
+ *.tgz filter=lfs diff=lfs merge=lfs -text
32
+ *.wasm filter=lfs diff=lfs merge=lfs -text
33
+ *.xz filter=lfs diff=lfs merge=lfs -text
34
+ *.zip filter=lfs diff=lfs merge=lfs -text
35
+ *.zst filter=lfs diff=lfs merge=lfs -text
36
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/php.iml" filepath="$PROJECT_DIR$/.idea/php.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/php.iml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ <component name="TemplatesService">
9
+ <option name="TEMPLATE_FOLDERS">
10
+ <list>
11
+ <option value="$MODULE_DIR$/php/templates" />
12
+ </list>
13
+ </option>
14
+ </component>
15
+ </module>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
.idea/workspace.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="a633230f-2c76-4f36-847b-ef0c12374f6a" name="Changes" comment="" />
5
+ <option name="SHOW_DIALOG" value="false" />
6
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
8
+ <option name="LAST_RESOLUTION" value="IGNORE" />
9
+ </component>
10
+ <component name="Git.Settings">
11
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
12
+ </component>
13
+ <component name="ProjectColorInfo"><![CDATA[{
14
+ "associatedIndex": 6
15
+ }]]></component>
16
+ <component name="ProjectId" id="2i4f07ljfOw2SZTkDEeaTPmU2Cc" />
17
+ <component name="ProjectViewState">
18
+ <option name="hideEmptyMiddlePackages" value="true" />
19
+ <option name="showLibraryContents" value="true" />
20
+ </component>
21
+ <component name="PropertiesComponent"><![CDATA[{
22
+ "keyToString": {
23
+ "RunOnceActivity.ShowReadmeOnStart": "true",
24
+ "git-widget-placeholder": "main",
25
+ "nodejs_package_manager_path": "npm",
26
+ "vue.rearranger.settings.migration": "true"
27
+ }
28
+ }]]></component>
29
+ <component name="SharedIndexes">
30
+ <attachedChunks>
31
+ <set>
32
+ <option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-PY-241.17890.14" />
33
+ <option value="bundled-python-sdk-5b207ade9991-7e9c3bbb6e34-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-241.17890.14" />
34
+ </set>
35
+ </attachedChunks>
36
+ </component>
37
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
38
+ <component name="TaskManager">
39
+ <task active="true" id="Default" summary="Default task">
40
+ <changelist id="a633230f-2c76-4f36-847b-ef0c12374f6a" name="Changes" comment="" />
41
+ <created>1718754548763</created>
42
+ <option name="number" value="Default" />
43
+ <option name="presentableId" value="Default" />
44
+ <updated>1718754548763</updated>
45
+ <workItem from="1718754552248" duration="107000" />
46
+ </task>
47
+ <servers />
48
+ </component>
49
+ </project>
php/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
php/ConnectionManager.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once(getabspath("connections/ConnectionManager_base.php"));
4
+
5
+ class ConnectionManager extends ConnectionManager_Base
6
+ {
7
+ /**
8
+ * @param String connId
9
+ * @return Connection
10
+ */
11
+ protected function getConnection( $connId )
12
+ {
13
+ include_once getabspath("connections/Connection.php");
14
+
15
+ $data = $this->_connectionsData[ $connId ];
16
+ switch( $data["connStringType"] )
17
+ {
18
+ case "mysql":
19
+ if( useMySQLiLib() )
20
+ {
21
+ include_once getabspath("connections/MySQLiConnection.php");
22
+ return new MySQLiConnection( $data );
23
+ }
24
+
25
+ include_once getabspath("connections/MySQLConnection.php");
26
+ return new MySQLConnection( $data );
27
+
28
+ case "mssql":
29
+ case "compact":
30
+ if( useMSSQLWinConnect() )
31
+ {
32
+ include_once getabspath("connections/MSSQLWinConnection.php");
33
+ return new MSSQLWinConnection( $data );
34
+ }
35
+ if( isSqlsrvExtLoaded() )
36
+ {
37
+ include_once getabspath("connections/MSSQLSrvConnection.php");
38
+ return new MSSQLSrvConnection( $data );
39
+ }
40
+
41
+ if( function_exists("mssql_connect") ) {
42
+ include_once getabspath("connections/MSSQLUnixConnection.php");
43
+ return new MSSQLUnixConnection( $data );
44
+ }
45
+
46
+ if( class_exists("PDO") ) {
47
+ include_once getabspath("connections/PDOConnection.php");
48
+ $drivers = pdo_drivers();
49
+ if( in_array( "sqlsrv", $drivers) )
50
+ {
51
+ $data["PDOString"] = "sqlsrv:Server=" . $data["connInfo"][0] . ";Database=" . $data["connInfo"][3];
52
+ $data["PDOUser"] = $data["connInfo"][1];
53
+ $data["PDOPass"] = $data["connInfo"][2];
54
+ return new PDOConnection( $data );
55
+ }
56
+ if( in_array( "dblib", $drivers) )
57
+ {
58
+ $data["PDOString"] = "dblib:host=" . $data["connInfo"][0] . ";dbname=" . $data["connInfo"][3];
59
+ $data["PDOUser"] = $data["connInfo"][1];
60
+ $data["PDOPass"] = $data["connInfo"][2];
61
+ return new PDOConnection( $data );
62
+ }
63
+ }
64
+ echo "No SQL Server driver found in your PHP settings.";
65
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
66
+ echo "<br>To enable SQL Server support add the following line to php.ini file:";
67
+ echo "<br>extension=php_com_dotnet.dll";
68
+ }
69
+ exit();
70
+
71
+ case "msaccess":
72
+ case "odbc":
73
+ case "odbcdsn":
74
+ case "custom":
75
+ case "file":
76
+ if( stripos($data["ODBCString"], 'Provider=') !== false )
77
+ {
78
+ include_once getabspath("connections/ADOConnection.php");
79
+ return new ADOConnection( $data );
80
+ }
81
+
82
+ include_once getabspath("connections/ODBCConnection.php");
83
+ return new ODBCConnection( $data );
84
+
85
+ case "oracle":
86
+ include_once getabspath("connections/OracleConnection.php");
87
+ return new OracleConnection( $data );
88
+
89
+ case "postgre":
90
+ include_once getabspath("connections/PostgreConnection.php");
91
+ return new PostgreConnection( $data );
92
+
93
+ case "db2":
94
+ include_once getabspath("connections/DB2Connection.php");
95
+ return new DB2Connection( $data );
96
+
97
+ case "informix":
98
+ include_once getabspath("connections/InformixConnection.php");
99
+ return new InformixConnection( $data );
100
+
101
+ case "sqlite":
102
+ include_once getabspath("connections/SQLite3Connection.php");
103
+ return new SQLite3Connection( $data );
104
+ case "pdo":
105
+ include_once getabspath("connections/PDOConnection.php");
106
+ return new PDOConnection( $data );
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Set the data representing the project's
112
+ * db connection properties
113
+ */
114
+ protected function _setConnectionsData()
115
+ {
116
+ // content of this function can be modified on demo account
117
+ // variable names $data and $connectionsData are important
118
+
119
+ $connectionsData = array();
120
+
121
+ $data = array();
122
+ $data["dbType"] = 4;
123
+ $data["connId"] = "KnowledgeBase2_at_localhost";
124
+ $data["connName"] = "KnowledgeBase2 at localhost";
125
+ $data["connStringType"] = "postgre";
126
+ $postgre_url = getenv("postgre_url");
127
+ $data["connectionString"] = $postgre_url; //currently unused
128
+
129
+ $this->_connectionsIdByName["KnowledgeBase2 at localhost"] = "KnowledgeBase2_at_localhost";
130
+
131
+ $data["connInfo"] = array();
132
+ $data["ODBCUID"] = "";
133
+ $data["ODBCPWD"] = "";
134
+ $data["leftWrap"] = "\"";
135
+ $data["rightWrap"] = "\"";
136
+
137
+ $data["DBPath"] = "db"; //currently unused
138
+ $data["useServerMapPath"] = 1; //currently unused
139
+
140
+ $host="ep-odd-mode-93794521.us-east-2.aws.neon.tech";
141
+ $user="miyataken999";
142
+ $password="yz1wPf4KrWTm";
143
+ $options="options=endpoint=ep-odd-mode-93794521 port=5432";
144
+ $dbname="neondb";
145
+ $data["connInfo"][0] = $host;
146
+ $data["connInfo"][1] = $user;
147
+ $data["connInfo"][2] = $password;
148
+ $data["connInfo"][3] = $options;
149
+ $data["connInfo"][4] = $dbname;
150
+ ;
151
+ // encription set
152
+ $data["EncryptInfo"] = array();
153
+ $data["EncryptInfo"]["mode"] = 0;
154
+ $data["EncryptInfo"]["alg"] = 128;
155
+ $data["EncryptInfo"]["key"] = "";
156
+
157
+ $connectionsData["KnowledgeBase2_at_localhost"] = $data;
158
+ $data = array();
159
+ $data["dbType"] = 4;
160
+ $data["connId"] = "neondbatuseast2awsneontech";
161
+ $data["connName"] = "neondb at us-east-2.aws.neon.t";
162
+ $data["connStringType"] = "postgre";
163
+ $data["connectionString"] = $postgre_url; //currently unused
164
+
165
+ $this->_connectionsIdByName["neondb at us-east-2.aws.neon.t"] = "neondbatuseast2awsneontech";
166
+
167
+ $data["connInfo"] = array();
168
+ $data["ODBCUID"] = "";
169
+ $data["ODBCPWD"] = "";
170
+ $data["leftWrap"] = "\"";
171
+ $data["rightWrap"] = "\"";
172
+
173
+ $data["DBPath"] = "db"; //currently unused
174
+ $data["useServerMapPath"] = 1; //currently unused
175
+
176
+ $host="ep-odd-mode-93794521.us-east-2.aws.neon.tech";
177
+ $user="miyataken999";
178
+ $password="yz1wPf4KrWTm";
179
+ $options="options=endpoint=ep-odd-mode-93794521 port=5432";
180
+ $dbname="neondb";
181
+ $data["connInfo"][0] = $host;
182
+ $data["connInfo"][1] = $user;
183
+ $data["connInfo"][2] = $password;
184
+ $data["connInfo"][3] = $options;
185
+ $data["connInfo"][4] = $dbname;
186
+ ;
187
+ // encription set
188
+ $data["EncryptInfo"] = array();
189
+ $data["EncryptInfo"]["mode"] = 0;
190
+ $data["EncryptInfo"]["alg"] = 256;
191
+ $data["EncryptInfo"]["key"] = "";
192
+
193
+ $connectionsData["neondbatuseast2awsneontech"] = $data;
194
+ $this->_connectionsData = &$connectionsData;
195
+ }
196
+
197
+ /**
198
+ * Close db connections
199
+ * @destructor
200
+ */
201
+ function __desctruct()
202
+ {
203
+ $this->CloseConnections();
204
+ }
205
+ }
206
+ ?>
php/Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official phpMyAdmin image
2
+ # Use the official phpMyAdmin image
3
+ FROM phpmyadmin/phpmyadmin:latest
4
+ RUN chmod -R 777 /var/
5
+ RUN chmod -R 777 /etc/phpmyadmin/
6
+ RUN chmod -R 777 /etc/apache2/
7
+ # Set correct permissions for phpMyAdmin configuration file
8
+ RUN chmod 644 /etc/phpmyadmin/config.inc.php
9
+ COPY test.php /var/www/html/test.php
10
+ # Set environment variables
11
+ ENV PMA_HOST=mysql-7364790-localbugtv.l.aivencloud.com
12
+ ENV PMA_PORT=10490
13
+ ENV MYSQL_ROOT_PASSWORD=root
14
+ ENV APACHE_PORT=7860
15
+ # Add test.php to the phpMyAdmin root directory
16
+
17
+
php/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: php
3
+ emoji: 🚀
4
+ colorFrom: blue
5
+ colorTo: blue
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
php/admin_comments_edit.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ @ini_set("display_errors","1");
4
+ @ini_set("display_startup_errors","1");
5
+
6
+ require_once("include/dbcommon.php");
7
+ require_once("classes/searchclause.php");
8
+ require_once("include/admin_comments_variables.php");
9
+ require_once('include/xtempl.php');
10
+ require_once('classes/editpage.php');
11
+
12
+ add_nocache_headers();
13
+
14
+ if( Security::hasLogin() ) {
15
+ if( !EditPage::processEditPageSecurity( $strTableName ) )
16
+ return;
17
+ }
18
+
19
+ EditPage::handleBrokenRequest();
20
+
21
+ // render all necessary layouts
22
+
23
+
24
+ // parse control parameters
25
+ $pageMode = EditPage::readEditModeFromRequest();
26
+
27
+ $xt = new Xtempl();
28
+
29
+ $id = postvalue_number("id");
30
+ $id = intval($id) == 0 ? 1 : $id;
31
+
32
+
33
+ // $keys could not be set properly if editid params were no passed
34
+ $keys = array();
35
+ $keys["CommentID"] = postvalue("editid1");
36
+
37
+ //array of params for classes
38
+ $params = array();
39
+ $params["id"] = $id;
40
+ $params["xt"] = &$xt;
41
+ $params["keys"] = $keys;
42
+ $params["mode"] = $pageMode;
43
+ $params["pageType"] = PAGE_EDIT;
44
+ $params["pageName"] = postvalue("page");
45
+ $params["tName"] = $strTableName;
46
+ $params["action"] = postvalue("a");
47
+ $params["selectedFields"] = postvalue("fields");
48
+
49
+ ;
50
+ $params["captchaName"] = "captcha_1209xre";
51
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
52
+ $params["selection"] = postvalue("selection");
53
+ $params["rowIds"] = my_json_decode( postvalue("rowIds") );
54
+
55
+ $params["masterTable"] = postvalue("mastertable");
56
+ if( $params["masterTable"] )
57
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
58
+
59
+ // locking parameters
60
+ $params["lockingAction"] = postvalue("action");
61
+ $params["lockingSid"] = postvalue("sid");
62
+ $params["lockingKeys"] = postvalue("keys");
63
+ $params["lockingStart"] = postvalue("startEdit");
64
+
65
+ if( $pageMode == EDIT_INLINE )
66
+ {
67
+ $params["screenWidth"] = postvalue("screenWidth");
68
+ $params["screenHeight"] = postvalue("screenHeight");
69
+ $params["orientation"] = postvalue("orientation");
70
+ }
71
+
72
+ if( $pageMode == EDIT_DASHBOARD )
73
+ {
74
+ $params["dashElementName"] = postvalue("dashelement");
75
+ $params["dashTName"] = postvalue("table");
76
+ $params["dashPage"] = postvalue("dashPage");
77
+
78
+ if( postvalue("mapRefresh") )
79
+ {
80
+ $params["mapRefresh"] = true;
81
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
82
+ }
83
+ }
84
+
85
+ if(( $pageMode == EDIT_POPUP || $pageMode == EDIT_INLINE ) && postvalue("dashTName"))
86
+ {
87
+ $params["dashTName"] = postvalue("dashTName");
88
+ $params["dashElementName"] = postvalue("dashelement");
89
+ $params["dashPage"] = postvalue("dashPage");
90
+ }
91
+
92
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
93
+ $params["hostPageName"] = postvalue("hostPageName");
94
+ $params["listPage"] = postvalue("listPage");
95
+
96
+ $pageObject = EditPage::EditPageFactory($params);
97
+
98
+ if( $pageObject->isLockingRequest() )
99
+ {
100
+ $pageObject->doLockingAction();
101
+ exit();
102
+ }
103
+
104
+ $pageObject->init();
105
+
106
+ $pageObject->process();
107
+ ?>
php/admin_comments_list.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ $requestTable = "admin_comments";
6
+ $requestPage = "list";
7
+
8
+ require_once("include/dbcommon.php");
9
+ add_nocache_headers();
10
+
11
+ require_once('include/xtempl.php');
12
+
13
+ require_once("classes/searchcontrol.php");
14
+ require_once("classes/searchclause.php");
15
+ require_once("classes/panelsearchcontrol.php");
16
+ require_once("include/admin_comments_variables.php");
17
+ require_once('classes/listpage.php');
18
+ require_once('include/lookuplinks.php');
19
+
20
+ // Check whether the page was called as a part of Lookup wizard - List page with search.
21
+ // Verify the eligibility of such a call.
22
+
23
+ InitLookupLinks();
24
+ if( Security::hasLogin() ) {
25
+ if( !ListPage::processListPageSecurity( $strTableName ) )
26
+ return;
27
+ }
28
+
29
+ if( ListPage::processSaveParams( $strTableName ) )
30
+ return;
31
+
32
+ $options = array();
33
+ //array of params for classes
34
+
35
+ // Include necessary files in accordance with the page displaying mode
36
+ $mode = ListPage::readListModeFromRequest();
37
+ if( $mode == LIST_SIMPLE )
38
+ {
39
+ require_once('classes/listpage_simple.php');
40
+ require_once("classes/searchpanelsimple.php");
41
+ }
42
+ elseif( $mode == LIST_AJAX )
43
+ {
44
+ require_once('classes/listpage_simple.php');
45
+ require_once('classes/listpage_ajax.php');
46
+ require_once("classes/searchpanelsimple.php");
47
+ }
48
+ elseif( $mode == LIST_LOOKUP )
49
+ {
50
+ require_once('classes/listpage_embed.php');
51
+ require_once('classes/listpage_lookup.php');
52
+
53
+ $options["mainTable"] = postvalue("table");
54
+ $options["mainField"] = postvalue("field");
55
+ $options["mainPageType"] = postvalue("pageType");
56
+
57
+ $options["mainRecordData"] = my_json_decode( postvalue('data') );
58
+ $options["mainRecordMasterTable"] = postvalue('mainRecordMasterTable');
59
+
60
+ if( postvalue("parentsExist") )
61
+ $options["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
62
+ }
63
+ elseif( $mode == LIST_POPUPDETAILS )
64
+ {
65
+ require_once('classes/listpage_embed.php');
66
+ require_once('classes/listpage_dpinline.php');
67
+ require_once('classes/listpage_dppopup.php');
68
+ }
69
+ elseif( $mode == LIST_DETAILS )
70
+ {
71
+ require_once('classes/listpage_embed.php');
72
+ require_once('classes/listpage_dpinline.php');
73
+ require_once('classes/listpage_dplist.php');
74
+ }
75
+ elseif( $mode == LIST_DASHDETAILS )
76
+ {
77
+ require_once('classes/listpage_embed.php');
78
+ require_once('classes/listpage_dashboard.php');
79
+ require_once('classes/listpage_dpdash.php');
80
+ }
81
+ elseif( $mode == LIST_DASHBOARD )
82
+ {
83
+ require_once('classes/listpage_embed.php');
84
+ require_once('classes/listpage_dashboard.php');
85
+ }
86
+ elseif( $mode == MAP_DASHBOARD )
87
+ {
88
+ require_once('classes/listpage_embed.php');
89
+ require_once('classes/listpage_dashboard.php');
90
+ require_once('classes/map_dashboard.php');
91
+ }
92
+
93
+ $xt = new Xtempl( $mode != LIST_SIMPLE ); //#9607 1. Temporary fix
94
+
95
+ $options["pageName"] = postvalue("page");
96
+ $options["pageType"] = PAGE_LIST;
97
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
98
+ $options["flyId"] = (int)postvalue("recordId");
99
+ $options["mode"] = $mode;
100
+ $options["xt"] = &$xt;
101
+ $options["firstTime"] = postvalue("firstTime");
102
+ $options["sortBy"] = postvalue("sortby");
103
+ $options["requestGoto"] = postvalue_number("goto");
104
+
105
+
106
+ $options["masterPageType"] = postvalue("masterpagetype");
107
+ $options["masterPage"] = postvalue("masterpage");
108
+ $options["masterId"] = postvalue("masterid");
109
+
110
+ $options["masterTable"] = postvalue("mastertable");
111
+ if( $options["masterTable"] )
112
+ $options["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
113
+
114
+
115
+ if( $mode == LIST_DASHBOARD && postvalue("nodata") && strlen($options["masterTable"]) )
116
+ $options["showNoData"] = true;
117
+
118
+ if( $mode != LIST_LOOKUP )
119
+ {
120
+ $options["dashElementName"] = postvalue("dashelement");
121
+ $options["dashTName"] = postvalue("table");
122
+ $options["dashPage"] = postvalue("dashPage");
123
+ }
124
+
125
+ if( postvalue("mapRefresh") )
126
+ {
127
+ $options["mapRefresh"] = true;
128
+ $options["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
129
+ }
130
+
131
+ if( postvalue("firstTime") )
132
+ $options["firstTime"] = true;
133
+
134
+ // Create $pageObject
135
+ $pageObject = ListPage::createListPage($strTableName, $options);
136
+
137
+ if( $pageObject->processSaveSearch() )
138
+ exit();
139
+
140
+ if( $pageObject->updateRowOrder() )
141
+ exit();
142
+
143
+ if ( $pageObject->processFieldFilter() )
144
+ exit();
145
+
146
+ if( $pageObject->processTotals() )
147
+ exit();
148
+
149
+ if( $mode != LIST_DETAILS && $mode != MAP_DASHBOARD && $mode != LIST_DASHBOARD )
150
+ {
151
+ //maps
152
+ }
153
+
154
+ unset($_SESSION["message_add"]);
155
+ unset($_SESSION["message_edit"]);
156
+
157
+ // prepare code for build page
158
+ $pageObject->prepareForBuildPage();
159
+
160
+ // show page depends of mode
161
+ $pageObject->showPage();
162
+
163
+ ?>
php/admin_comments_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/admin_comments_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'admin_comments';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/admin_members_list.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
7
+
8
+ require_once("include/admin_members_variables.php");
9
+
10
+ if( !Security::processAdminPageSecurity( false ) )
11
+ return;
12
+
13
+ require_once('include/xtempl.php');
14
+ require_once("classes/searchclause.php");
15
+
16
+ require_once("classes/searchcontrol.php");
17
+ require_once("classes/panelsearchcontrol.php");
18
+
19
+ require_once("classes/searchpanelsimple.php");
20
+
21
+ require_once('classes/listpage.php');
22
+ require_once('classes/listpage_simple.php');
23
+ require_once('classes/memberspage.php');
24
+
25
+
26
+ $xt = new Xtempl();
27
+
28
+ $options = array();
29
+ $options["pageType"] = PAGE_ADMIN_MEMBERS;
30
+ $options["pageTable"] = GLOBAL_PAGES;
31
+ $options["id"] = postvalue_number("id");
32
+ $options["mode"] = MEMBERS_PAGE;
33
+ $options["xt"] = &$xt;
34
+ $options["requestGoto"] = postvalue_number("goto");
35
+ $options["providerType"] = stDB;
36
+
37
+
38
+ $pageObject = ListPage::createListPage( $strTableName, $options );
39
+ if( postvalue("a") == "saveMembers" )
40
+ {
41
+ // CSRF protection
42
+ if( !isPostRequest() )
43
+ return;
44
+ $modifiedMembers = my_json_decode( postvalue('values') );
45
+ $pageObject->saveMembers( $modifiedMembers );
46
+ return;
47
+ }
48
+
49
+ // add button events if exist
50
+
51
+ // prepare code for build page
52
+ $pageObject->prepareForBuildPage();
53
+
54
+ // show page depends of mode
55
+ $pageObject->showPage();
56
+ ?>
php/admin_members_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/admin_members_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'admin_members';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/admin_rights_list.php ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
7
+
8
+ require_once("include/admin_rights_variables.php");
9
+
10
+ if( !Security::processAdminPageSecurity( false ) )
11
+ return;
12
+
13
+
14
+ $tables = array();
15
+ $pageMask = array();
16
+ $table = "kbarticles";
17
+ $mask="";
18
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
19
+ $mask .= "A";
20
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
21
+ $mask .= "E";
22
+ if( pageEnabled($table, 'delete') )
23
+ $mask .= "D";
24
+ if( pageEnabled($table, 'import') )
25
+ $mask .= "I";
26
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
27
+ $mask .= "S";
28
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
29
+ $mask .= "P";
30
+
31
+ $pageMask[$table] = $mask;
32
+ $tables[$table] = array("kbarticles", " " . "Articles");
33
+ $table = "kbcategories";
34
+ $mask="";
35
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
36
+ $mask .= "A";
37
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
38
+ $mask .= "E";
39
+ if( pageEnabled($table, 'delete') )
40
+ $mask .= "D";
41
+ if( pageEnabled($table, 'import') )
42
+ $mask .= "I";
43
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
44
+ $mask .= "S";
45
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
46
+ $mask .= "P";
47
+
48
+ $pageMask[$table] = $mask;
49
+ $tables[$table] = array("kbcategories", " " . "Categories");
50
+ $table = "kbcomments";
51
+ $mask="";
52
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
53
+ $mask .= "A";
54
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
55
+ $mask .= "E";
56
+ if( pageEnabled($table, 'delete') )
57
+ $mask .= "D";
58
+ if( pageEnabled($table, 'import') )
59
+ $mask .= "I";
60
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
61
+ $mask .= "S";
62
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
63
+ $mask .= "P";
64
+ $mask .= "M";
65
+
66
+ $pageMask[$table] = $mask;
67
+ $tables[$table] = array("kbcomments", " " . "Comments");
68
+ $table = "public.kbusers";
69
+ $mask="";
70
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
71
+ $mask .= "A";
72
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
73
+ $mask .= "E";
74
+ if( pageEnabled($table, 'delete') )
75
+ $mask .= "D";
76
+ if( pageEnabled($table, 'import') )
77
+ $mask .= "I";
78
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
79
+ $mask .= "S";
80
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
81
+ $mask .= "P";
82
+
83
+ $pageMask[$table] = $mask;
84
+ $tables[$table] = array("public_kbusers", " " . "Users");
85
+ $table = "main";
86
+ $mask="";
87
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
88
+ $mask .= "A";
89
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
90
+ $mask .= "E";
91
+ if( pageEnabled($table, 'delete') )
92
+ $mask .= "D";
93
+ if( pageEnabled($table, 'import') )
94
+ $mask .= "I";
95
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
96
+ $mask .= "S";
97
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
98
+ $mask .= "P";
99
+
100
+ $pageMask[$table] = $mask;
101
+ $tables[$table] = array("main", " " . "");
102
+ $table = "faicons";
103
+ $mask="";
104
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
105
+ $mask .= "A";
106
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
107
+ $mask .= "E";
108
+ if( pageEnabled($table, 'delete') )
109
+ $mask .= "D";
110
+ if( pageEnabled($table, 'import') )
111
+ $mask .= "I";
112
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
113
+ $mask .= "S";
114
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
115
+ $mask .= "P";
116
+
117
+ $pageMask[$table] = $mask;
118
+ $tables[$table] = array("faicons", " " . "Faicons");
119
+ $table = "admin_comments";
120
+ $mask="";
121
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
122
+ $mask .= "A";
123
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
124
+ $mask .= "E";
125
+ if( pageEnabled($table, 'delete') )
126
+ $mask .= "D";
127
+ if( pageEnabled($table, 'import') )
128
+ $mask .= "I";
129
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
130
+ $mask .= "S";
131
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
132
+ $mask .= "P";
133
+
134
+ $pageMask[$table] = $mask;
135
+ $tables[$table] = array("admin_comments", " " . "Admin Comments");
136
+ $table = "public.fasis_chat_history";
137
+ $mask="";
138
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
139
+ $mask .= "A";
140
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
141
+ $mask .= "E";
142
+ if( pageEnabled($table, 'delete') )
143
+ $mask .= "D";
144
+ if( pageEnabled($table, 'import') )
145
+ $mask .= "I";
146
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
147
+ $mask .= "S";
148
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
149
+ $mask .= "P";
150
+
151
+ $pageMask[$table] = $mask;
152
+ $tables[$table] = array("fasis_chat_history", " " . "Fasis Chat History");
153
+ $table = "public.diamondprice";
154
+ $mask="";
155
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
156
+ $mask .= "A";
157
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
158
+ $mask .= "E";
159
+ if( pageEnabled($table, 'delete') )
160
+ $mask .= "D";
161
+ if( pageEnabled($table, 'import') )
162
+ $mask .= "I";
163
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
164
+ $mask .= "S";
165
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
166
+ $mask .= "P";
167
+
168
+ $pageMask[$table] = $mask;
169
+ $tables[$table] = array("diamondprice", " " . "Diamondprice");
170
+ $table = "public.products";
171
+ $mask="";
172
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
173
+ $mask .= "A";
174
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
175
+ $mask .= "E";
176
+ if( pageEnabled($table, 'delete') )
177
+ $mask .= "D";
178
+ if( pageEnabled($table, 'import') )
179
+ $mask .= "I";
180
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
181
+ $mask .= "S";
182
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
183
+ $mask .= "P";
184
+
185
+ $pageMask[$table] = $mask;
186
+ $tables[$table] = array("products", " " . "Products");
187
+ $table = "public.items";
188
+ $mask="";
189
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
190
+ $mask .= "A";
191
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
192
+ $mask .= "E";
193
+ if( pageEnabled($table, 'delete') )
194
+ $mask .= "D";
195
+ if( pageEnabled($table, 'import') )
196
+ $mask .= "I";
197
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
198
+ $mask .= "S";
199
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
200
+ $mask .= "P";
201
+
202
+ $pageMask[$table] = $mask;
203
+ $tables[$table] = array("items", " " . "Items");
204
+ $table = "public.appointments";
205
+ $mask="";
206
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
207
+ $mask .= "A";
208
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
209
+ $mask .= "E";
210
+ if( pageEnabled($table, 'delete') )
211
+ $mask .= "D";
212
+ if( pageEnabled($table, 'import') )
213
+ $mask .= "I";
214
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
215
+ $mask .= "S";
216
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
217
+ $mask .= "P";
218
+
219
+ $pageMask[$table] = $mask;
220
+ $tables[$table] = array("appointments", " " . "Appointments");
221
+ $table = "chat_history";
222
+ $mask="";
223
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
224
+ $mask .= "A";
225
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
226
+ $mask .= "E";
227
+ if( pageEnabled($table, 'delete') )
228
+ $mask .= "D";
229
+ if( pageEnabled($table, 'import') )
230
+ $mask .= "I";
231
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
232
+ $mask .= "S";
233
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
234
+ $mask .= "P";
235
+
236
+ $pageMask[$table] = $mask;
237
+ $tables[$table] = array("chat_history", " " . "Chat History");
238
+ $table = "chat_users";
239
+ $mask="";
240
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
241
+ $mask .= "A";
242
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
243
+ $mask .= "E";
244
+ if( pageEnabled($table, 'delete') )
245
+ $mask .= "D";
246
+ if( pageEnabled($table, 'import') )
247
+ $mask .= "I";
248
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
249
+ $mask .= "S";
250
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
251
+ $mask .= "P";
252
+
253
+ $pageMask[$table] = $mask;
254
+ $tables[$table] = array("chat_users", " " . "Chat Users");
255
+ $table = "chat_settings";
256
+ $mask="";
257
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
258
+ $mask .= "A";
259
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
260
+ $mask .= "E";
261
+ if( pageEnabled($table, 'delete') )
262
+ $mask .= "D";
263
+ if( pageEnabled($table, 'import') )
264
+ $mask .= "I";
265
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
266
+ $mask .= "S";
267
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
268
+ $mask .= "P";
269
+
270
+ $pageMask[$table] = $mask;
271
+ $tables[$table] = array("chat_settings", " " . "Chat Settings");
272
+ $table = "chat_files";
273
+ $mask="";
274
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
275
+ $mask .= "A";
276
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
277
+ $mask .= "E";
278
+ if( pageEnabled($table, 'delete') )
279
+ $mask .= "D";
280
+ if( pageEnabled($table, 'import') )
281
+ $mask .= "I";
282
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
283
+ $mask .= "S";
284
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
285
+ $mask .= "P";
286
+
287
+ $pageMask[$table] = $mask;
288
+ $tables[$table] = array("chat_files", " " . "Chat Files");
289
+ $table = "chat_groups";
290
+ $mask="";
291
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
292
+ $mask .= "A";
293
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
294
+ $mask .= "E";
295
+ if( pageEnabled($table, 'delete') )
296
+ $mask .= "D";
297
+ if( pageEnabled($table, 'import') )
298
+ $mask .= "I";
299
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
300
+ $mask .= "S";
301
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
302
+ $mask .= "P";
303
+
304
+ $pageMask[$table] = $mask;
305
+ $tables[$table] = array("chat_groups", " " . "Chat Groups");
306
+ $table = "chat_peopletype";
307
+ $mask="";
308
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
309
+ $mask .= "A";
310
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
311
+ $mask .= "E";
312
+ if( pageEnabled($table, 'delete') )
313
+ $mask .= "D";
314
+ if( pageEnabled($table, 'import') )
315
+ $mask .= "I";
316
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
317
+ $mask .= "S";
318
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
319
+ $mask .= "P";
320
+
321
+ $pageMask[$table] = $mask;
322
+ $tables[$table] = array("chat_peopletype", " " . "Chat Peopletype");
323
+ $table = "chat_timezone";
324
+ $mask="";
325
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
326
+ $mask .= "A";
327
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
328
+ $mask .= "E";
329
+ if( pageEnabled($table, 'delete') )
330
+ $mask .= "D";
331
+ if( pageEnabled($table, 'import') )
332
+ $mask .= "I";
333
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
334
+ $mask .= "S";
335
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
336
+ $mask .= "P";
337
+
338
+ $pageMask[$table] = $mask;
339
+ $tables[$table] = array("chat_timezone", " " . "Chat Timezone");
340
+ $table = "public.chat_files";
341
+ $mask="";
342
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
343
+ $mask .= "A";
344
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
345
+ $mask .= "E";
346
+ if( pageEnabled($table, 'delete') )
347
+ $mask .= "D";
348
+ if( pageEnabled($table, 'import') )
349
+ $mask .= "I";
350
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
351
+ $mask .= "S";
352
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
353
+ $mask .= "P";
354
+
355
+ $pageMask[$table] = $mask;
356
+ $tables[$table] = array("chat_files1", " " . "Chat Files");
357
+ $table = "public.chat_groups";
358
+ $mask="";
359
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
360
+ $mask .= "A";
361
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
362
+ $mask .= "E";
363
+ if( pageEnabled($table, 'delete') )
364
+ $mask .= "D";
365
+ if( pageEnabled($table, 'import') )
366
+ $mask .= "I";
367
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
368
+ $mask .= "S";
369
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
370
+ $mask .= "P";
371
+
372
+ $pageMask[$table] = $mask;
373
+ $tables[$table] = array("chat_groups1", " " . "Chat Groups");
374
+ $table = "public.chat_history";
375
+ $mask="";
376
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
377
+ $mask .= "A";
378
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
379
+ $mask .= "E";
380
+ if( pageEnabled($table, 'delete') )
381
+ $mask .= "D";
382
+ if( pageEnabled($table, 'import') )
383
+ $mask .= "I";
384
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
385
+ $mask .= "S";
386
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
387
+ $mask .= "P";
388
+
389
+ $pageMask[$table] = $mask;
390
+ $tables[$table] = array("chat_history1", " " . "Chat History");
391
+ $table = "public.chat_peopletype";
392
+ $mask="";
393
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
394
+ $mask .= "A";
395
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
396
+ $mask .= "E";
397
+ if( pageEnabled($table, 'delete') )
398
+ $mask .= "D";
399
+ if( pageEnabled($table, 'import') )
400
+ $mask .= "I";
401
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
402
+ $mask .= "S";
403
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
404
+ $mask .= "P";
405
+
406
+ $pageMask[$table] = $mask;
407
+ $tables[$table] = array("chat_peopletype1", " " . "Chat Peopletype");
408
+ $table = "public.chat_settings";
409
+ $mask="";
410
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
411
+ $mask .= "A";
412
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
413
+ $mask .= "E";
414
+ if( pageEnabled($table, 'delete') )
415
+ $mask .= "D";
416
+ if( pageEnabled($table, 'import') )
417
+ $mask .= "I";
418
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
419
+ $mask .= "S";
420
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
421
+ $mask .= "P";
422
+
423
+ $pageMask[$table] = $mask;
424
+ $tables[$table] = array("chat_settings1", " " . "Chat Settings");
425
+ $table = "public.identity";
426
+ $mask="";
427
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
428
+ $mask .= "A";
429
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
430
+ $mask .= "E";
431
+ if( pageEnabled($table, 'delete') )
432
+ $mask .= "D";
433
+ if( pageEnabled($table, 'import') )
434
+ $mask .= "I";
435
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
436
+ $mask .= "S";
437
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
438
+ $mask .= "P";
439
+
440
+ $pageMask[$table] = $mask;
441
+ $tables[$table] = array("identity", " " . "Identity");
442
+ $table = "public.dataset_info";
443
+ $mask="";
444
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
445
+ $mask .= "A";
446
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
447
+ $mask .= "E";
448
+ if( pageEnabled($table, 'delete') )
449
+ $mask .= "D";
450
+ if( pageEnabled($table, 'import') )
451
+ $mask .= "I";
452
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
453
+ $mask .= "S";
454
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
455
+ $mask .= "P";
456
+
457
+ $pageMask[$table] = $mask;
458
+ $tables[$table] = array("dataset_info", " " . "Dataset Info");
459
+ $table = "public.history";
460
+ $mask="";
461
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
462
+ $mask .= "A";
463
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
464
+ $mask .= "E";
465
+ if( pageEnabled($table, 'delete') )
466
+ $mask .= "D";
467
+ if( pageEnabled($table, 'import') )
468
+ $mask .= "I";
469
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
470
+ $mask .= "S";
471
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
472
+ $mask .= "P";
473
+
474
+ $pageMask[$table] = $mask;
475
+ $tables[$table] = array("history", " " . "History");
476
+ $table = "public.zendesk__dataszz";
477
+ $mask="";
478
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
479
+ $mask .= "A";
480
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
481
+ $mask .= "E";
482
+ if( pageEnabled($table, 'delete') )
483
+ $mask .= "D";
484
+ if( pageEnabled($table, 'import') )
485
+ $mask .= "I";
486
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
487
+ $mask .= "S";
488
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
489
+ $mask .= "P";
490
+
491
+ $pageMask[$table] = $mask;
492
+ $tables[$table] = array("zendesk__dataszz", " " . "Zendesk");
493
+ $table = "public.view_zendesk";
494
+ $mask="";
495
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
496
+ $mask .= "A";
497
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
498
+ $mask .= "E";
499
+ if( pageEnabled($table, 'delete') )
500
+ $mask .= "D";
501
+ if( pageEnabled($table, 'import') )
502
+ $mask .= "I";
503
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
504
+ $mask .= "S";
505
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
506
+ $mask .= "P";
507
+
508
+ $pageMask[$table] = $mask;
509
+ $tables[$table] = array("view_zendesk", " " . "View Zendesk");
510
+ $table = "public.prompts";
511
+ $mask="";
512
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
513
+ $mask .= "A";
514
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
515
+ $mask .= "E";
516
+ if( pageEnabled($table, 'delete') )
517
+ $mask .= "D";
518
+ if( pageEnabled($table, 'import') )
519
+ $mask .= "I";
520
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
521
+ $mask .= "S";
522
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
523
+ $mask .= "P";
524
+
525
+ $pageMask[$table] = $mask;
526
+ $tables[$table] = array("prompts", " " . "Prompts");
527
+ $table = "public.view_faisis_chat_history";
528
+ $mask="";
529
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
530
+ $mask .= "A";
531
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
532
+ $mask .= "E";
533
+ if( pageEnabled($table, 'delete') )
534
+ $mask .= "D";
535
+ if( pageEnabled($table, 'import') )
536
+ $mask .= "I";
537
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
538
+ $mask .= "S";
539
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
540
+ $mask .= "P";
541
+
542
+ $pageMask[$table] = $mask;
543
+ $tables[$table] = array("view_faisis_chat_history", " " . "View Faisis Chat History");
544
+ $table = "public.server_setting";
545
+ $mask="";
546
+ if( pageEnabled($table, 'add') || pageEnabled($table, 'inline_add') )
547
+ $mask .= "A";
548
+ if( pageEnabled($table, 'edit') || pageEnabled($table, 'inline_edit') )
549
+ $mask .= "E";
550
+ if( pageEnabled($table, 'delete') )
551
+ $mask .= "D";
552
+ if( pageEnabled($table, 'import') )
553
+ $mask .= "I";
554
+ if( pageEnabled($table, 'view') || pageEnabled($table, 'list') || pageEnabled($table, 'chart') || pageEnabled($table, 'report') || pageEnabled($table, 'dashboard') )
555
+ $mask .= "S";
556
+ if( pageEnabled($table, 'print') || pageEnabled($table, 'rprint') || pageEnabled($table, 'export') )
557
+ $mask .= "P";
558
+
559
+ $pageMask[$table] = $mask;
560
+ $tables[$table] = array("server_setting", " " . "Server Setting");
561
+
562
+ if ( pageEnabled(GLOBAL_PAGES, 'menu') )
563
+ $pageMask[GLOBAL_PAGES] = "S";
564
+ else
565
+ $pageMask[GLOBAL_PAGES] = "";
566
+ $tables[GLOBAL_PAGES] = array(GoodFieldName(GLOBAL_PAGES_SHORT), " " . GLOBAL_PAGES);
567
+
568
+ require_once('include/xtempl.php');
569
+ require_once('classes/listpage.php');
570
+ require_once('classes/rightspage.php');
571
+
572
+ $xt = new Xtempl();
573
+
574
+ $options = array();
575
+ $options["pageType"] = "admin_rights_list";
576
+ $options["pageTable"] = GLOBAL_PAGES;
577
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
578
+ $options["mode"] = RIGHTS_PAGE;
579
+ $options['xt'] = &$xt;
580
+ $options["requestGoto"] = postvalue_number("goto");
581
+
582
+
583
+ $options["tables"] = $tables;
584
+ $options["pageMasks"] = $pageMask;
585
+
586
+ $pageObject = ListPage::createListPage($strTableName, $options);
587
+
588
+ if( postvalue("a") == "saveRights" )
589
+ {
590
+ // CSRF protection
591
+ if( !isPostRequest() )
592
+ return;
593
+ $modifiedRights = my_json_decode(postvalue('data'));
594
+ $pageObject->saveRights( $modifiedRights );
595
+ return;
596
+ }
597
+
598
+
599
+ // add buttons if exist
600
+
601
+ // prepare code for build page
602
+ $pageObject->prepareForBuildPage();
603
+
604
+ // show page depends of mode
605
+ $pageObject->showPage();
606
+
607
+
608
+
609
+ ?>
php/admin_rights_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/admin_rights_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'admin_rights';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/admin_users_add.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+
4
+ require_once("include/dbcommon.php");
5
+ require_once("classes/searchclause.php");
6
+ require_once("include/admin_users_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/addpage.php');
9
+ require_once('include/lookuplinks.php');
10
+
11
+ add_nocache_headers();
12
+
13
+ InitLookupLinks();
14
+
15
+ if( Security::hasLogin() ) {
16
+ if( !AddPage::processAddPageSecurity( $strTableName ) )
17
+ return;
18
+ }
19
+
20
+ AddPage::handleBrokenRequest();
21
+
22
+
23
+ $pageMode = AddPage::readAddModeFromRequest();
24
+
25
+ $xt = new Xtempl();
26
+
27
+ $id = postvalue_number("id");
28
+ $id = $id ? $id : 1;
29
+
30
+ //an array of AddPage constructor's params
31
+ $params = array();
32
+ $params["id"] = $id;
33
+ $params["xt"] = &$xt;
34
+ $params["mode"] = $pageMode;
35
+ $params["pageType"] = PAGE_ADD;
36
+ $params["tName"] = $strTableName;
37
+ $params["pageName"] = postvalue("page");
38
+ $params["action"] = postvalue("a");
39
+ $params["needSearchClauseObj"] = false;
40
+ $params["afterAdd_id"] = postvalue("afteradd");
41
+
42
+ $params["hostPageName"] = postvalue("hostPageName");
43
+ $params["listPage"] = postvalue("listPage");
44
+
45
+ $params["newRowId"] = postvalue("newRowId");
46
+
47
+ $params["masterTable"] = postvalue("mastertable");
48
+ if( $params["masterTable"] )
49
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
50
+
51
+
52
+
53
+ ;
54
+ $params["captchaName"] = "captcha_1209xre";
55
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
56
+ $params["dashElementName"] = postvalue("dashelement");
57
+ $params["fromDashboard"] = postvalue("fromDashboard");
58
+ $params["dashTName"] = $params["fromDashboard"] ? $params["fromDashboard"] : postvalue("dashTName");
59
+ $params["dashPage"] = postvalue("dashPage");
60
+
61
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
62
+
63
+ if ( $pageMode == ADD_POPUP ) {
64
+ $params["forListPageLookup"] = postvalue('forLookup');
65
+ }
66
+
67
+ if( $pageMode == ADD_DASHBOARD )
68
+ {
69
+ $params["dashElementName"] = postvalue("dashelement");
70
+ $params["dashTName"] = postvalue("table");
71
+ $params["dashPage"] = postvalue("dashPage");
72
+ }
73
+
74
+
75
+ if( $pageMode == ADD_INLINE )
76
+ {
77
+ // Inline add in a 'List page with search' lookup
78
+ $params["forListPageLookup"] = postvalue('forLookup');
79
+
80
+ $params["screenWidth"] = postvalue("screenWidth");
81
+ $params["screenHeight"] = postvalue("screenHeight");
82
+ $params["orientation"] = postvalue("orientation");
83
+
84
+ $params["masterPageType"] = postvalue("masterpagetype");
85
+ }
86
+
87
+
88
+ if( $pageMode == ADD_ONTHEFLY || ( $pageMode == ADD_INLINE || $pageMode == ADD_POPUP ) && postvalue('forLookup') )
89
+ {
90
+ //table where lookup is set
91
+ $params["lookupTable"] = postvalue("table");
92
+ //field with lookup is set
93
+ $params["lookupField"] = postvalue("field");
94
+ //the ptype od the page where lookup is set
95
+ $params["lookupPageType"] = postvalue("pageType");
96
+
97
+ if( postvalue('parentsExist') )
98
+ {
99
+ //the parent controls values data
100
+ $params["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
101
+ }
102
+ }
103
+
104
+ $pageObject = new AddPage($params);
105
+ $pageObject->init();
106
+
107
+ $pageObject->process();
108
+ ?>
php/admin_users_edit.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ @ini_set("display_errors","1");
4
+ @ini_set("display_startup_errors","1");
5
+
6
+ require_once("include/dbcommon.php");
7
+ require_once("classes/searchclause.php");
8
+ require_once("include/admin_users_variables.php");
9
+ require_once('include/xtempl.php');
10
+ require_once('classes/editpage.php');
11
+
12
+ add_nocache_headers();
13
+
14
+ if( Security::hasLogin() ) {
15
+ if( !EditPage::processEditPageSecurity( $strTableName ) )
16
+ return;
17
+ }
18
+
19
+ EditPage::handleBrokenRequest();
20
+
21
+ // render all necessary layouts
22
+
23
+
24
+ // parse control parameters
25
+ $pageMode = EditPage::readEditModeFromRequest();
26
+
27
+ $xt = new Xtempl();
28
+
29
+ $id = postvalue_number("id");
30
+ $id = intval($id) == 0 ? 1 : $id;
31
+
32
+
33
+ // $keys could not be set properly if editid params were no passed
34
+ $keys = array();
35
+ $keys["email"] = postvalue("editid1");
36
+
37
+ //array of params for classes
38
+ $params = array();
39
+ $params["id"] = $id;
40
+ $params["xt"] = &$xt;
41
+ $params["keys"] = $keys;
42
+ $params["mode"] = $pageMode;
43
+ $params["pageType"] = PAGE_EDIT;
44
+ $params["pageName"] = postvalue("page");
45
+ $params["tName"] = $strTableName;
46
+ $params["action"] = postvalue("a");
47
+ $params["selectedFields"] = postvalue("fields");
48
+
49
+ ;
50
+ $params["captchaName"] = "captcha_1209xre";
51
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
52
+ $params["selection"] = postvalue("selection");
53
+ $params["rowIds"] = my_json_decode( postvalue("rowIds") );
54
+
55
+ $params["masterTable"] = postvalue("mastertable");
56
+ if( $params["masterTable"] )
57
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
58
+
59
+ // locking parameters
60
+ $params["lockingAction"] = postvalue("action");
61
+ $params["lockingSid"] = postvalue("sid");
62
+ $params["lockingKeys"] = postvalue("keys");
63
+ $params["lockingStart"] = postvalue("startEdit");
64
+
65
+ if( $pageMode == EDIT_INLINE )
66
+ {
67
+ $params["screenWidth"] = postvalue("screenWidth");
68
+ $params["screenHeight"] = postvalue("screenHeight");
69
+ $params["orientation"] = postvalue("orientation");
70
+ }
71
+
72
+ if( $pageMode == EDIT_DASHBOARD )
73
+ {
74
+ $params["dashElementName"] = postvalue("dashelement");
75
+ $params["dashTName"] = postvalue("table");
76
+ $params["dashPage"] = postvalue("dashPage");
77
+
78
+ if( postvalue("mapRefresh") )
79
+ {
80
+ $params["mapRefresh"] = true;
81
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
82
+ }
83
+ }
84
+
85
+ if(( $pageMode == EDIT_POPUP || $pageMode == EDIT_INLINE ) && postvalue("dashTName"))
86
+ {
87
+ $params["dashTName"] = postvalue("dashTName");
88
+ $params["dashElementName"] = postvalue("dashelement");
89
+ $params["dashPage"] = postvalue("dashPage");
90
+ }
91
+
92
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
93
+ $params["hostPageName"] = postvalue("hostPageName");
94
+ $params["listPage"] = postvalue("listPage");
95
+
96
+ $pageObject = EditPage::EditPageFactory($params);
97
+
98
+ if( $pageObject->isLockingRequest() )
99
+ {
100
+ $pageObject->doLockingAction();
101
+ exit();
102
+ }
103
+
104
+ $pageObject->init();
105
+
106
+ $pageObject->process();
107
+ ?>
php/admin_users_export.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ require_once("classes/searchclause.php");
8
+ require_once("classes/sql.php");
9
+
10
+ require_once("include/admin_users_variables.php");
11
+
12
+ if( Security::hasLogin() ) {
13
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
14
+ return;
15
+ }
16
+
17
+
18
+ require_once("include/export_functions.php");
19
+ require_once("classes/exportpage.php");
20
+ require_once("include/xtempl.php");
21
+
22
+ $xt = new Xtempl();
23
+
24
+ //array of params for classes
25
+ $params = array();
26
+ $params["id"] = postvalue_number("id");
27
+ $params["xt"] = &$xt;
28
+ $params["tName"] = $strTableName;
29
+ $params["pageType"] = PAGE_EXPORT;
30
+ $params["pageName"] = postvalue("page");
31
+
32
+ $params["selectedFields"] = postvalue("exportFields");
33
+ $params["exportType"] = postvalue("type");
34
+
35
+ $params["allPagesMode"] = postvalue("records") == "all";
36
+ $params["currentPageMode"] = postvalue("records") == "page";
37
+ $params["selection"] = postvalue("selection");
38
+ $params["csvDelimiter"] = postvalue("delimiter");
39
+
40
+ if( postvalue("txtformatting") == "raw" )
41
+ $params["useRawValues"] = true;
42
+
43
+ $params["mode"] = ExportPage::readModeFromRequest();
44
+
45
+ $params["masterTable"] = postvalue("mastertable");
46
+ if( $params["masterTable"] )
47
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
48
+
49
+ $pageObject = new ExportPage( $params );
50
+ $pageObject->init();
51
+
52
+ $pageObject->process();
53
+ ?>
php/admin_users_import.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ set_time_limit(600);
8
+
9
+ require_once("include/admin_users_variables.php");
10
+ require_once("include/import_functions.php");
11
+ require_once('classes/importpage.php');
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !Security::processPageSecurity( $strtablename, 'I' ) )
15
+ return;
16
+ }
17
+
18
+
19
+ require_once('include/xtempl.php');
20
+ $xt = new Xtempl();
21
+
22
+ //an array of params for ImportPage constructor
23
+ $params = array();
24
+ $params["id"] = postvalue_number("id");
25
+ $params["xt"] = &$xt;
26
+ $params["tName"] = $strTableName;
27
+ $params["action"] = postvalue("a");
28
+ $params["pageType"] = PAGE_IMPORT;
29
+ $params["pageName"] = postvalue("page");
30
+ $params["needSearchClauseObj"] = false;
31
+ $params["strOriginalTableName"] = $strOriginalTableName;
32
+
33
+ if( $params["action"] == "importPreview" )
34
+ {
35
+ $params["importType"] = postvalue("importType");
36
+ $params["importText"] = postvalue("importText");
37
+ $params["useXHR"] = postvalue("useXHR");
38
+ }
39
+ elseif( $params["action"] == "importData" )
40
+ {
41
+ $params["importData"] = my_json_decode( postvalue("importData") );
42
+ }
43
+
44
+ $params["masterTable"] = postvalue("mastertable");
45
+ if( $params["masterTable"] )
46
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
47
+
48
+ $pageObject = new ImportPage($params);
49
+ $pageObject->init();
50
+
51
+ $pageObject->process();
52
+
53
+ ?>
php/admin_users_list.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ $requestTable = "admin_users";
6
+ $requestPage = "list";
7
+
8
+ require_once("include/dbcommon.php");
9
+ add_nocache_headers();
10
+
11
+ require_once('include/xtempl.php');
12
+
13
+ require_once("classes/searchcontrol.php");
14
+ require_once("classes/searchclause.php");
15
+ require_once("classes/panelsearchcontrol.php");
16
+ require_once("include/admin_users_variables.php");
17
+ require_once('classes/listpage.php');
18
+ require_once('include/lookuplinks.php');
19
+
20
+ // Check whether the page was called as a part of Lookup wizard - List page with search.
21
+ // Verify the eligibility of such a call.
22
+
23
+ InitLookupLinks();
24
+ if( Security::hasLogin() ) {
25
+ if( !ListPage::processListPageSecurity( $strTableName ) )
26
+ return;
27
+ }
28
+
29
+ if( ListPage::processSaveParams( $strTableName ) )
30
+ return;
31
+
32
+ $options = array();
33
+ //array of params for classes
34
+
35
+ // Include necessary files in accordance with the page displaying mode
36
+ $mode = ListPage::readListModeFromRequest();
37
+ if( $mode == LIST_SIMPLE )
38
+ {
39
+ require_once('classes/listpage_simple.php');
40
+ require_once("classes/searchpanelsimple.php");
41
+ }
42
+ elseif( $mode == LIST_AJAX )
43
+ {
44
+ require_once('classes/listpage_simple.php');
45
+ require_once('classes/listpage_ajax.php');
46
+ require_once("classes/searchpanelsimple.php");
47
+ }
48
+ elseif( $mode == LIST_LOOKUP )
49
+ {
50
+ require_once('classes/listpage_embed.php');
51
+ require_once('classes/listpage_lookup.php');
52
+
53
+ $options["mainTable"] = postvalue("table");
54
+ $options["mainField"] = postvalue("field");
55
+ $options["mainPageType"] = postvalue("pageType");
56
+
57
+ $options["mainRecordData"] = my_json_decode( postvalue('data') );
58
+ $options["mainRecordMasterTable"] = postvalue('mainRecordMasterTable');
59
+
60
+ if( postvalue("parentsExist") )
61
+ $options["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
62
+ }
63
+ elseif( $mode == LIST_POPUPDETAILS )
64
+ {
65
+ require_once('classes/listpage_embed.php');
66
+ require_once('classes/listpage_dpinline.php');
67
+ require_once('classes/listpage_dppopup.php');
68
+ }
69
+ elseif( $mode == LIST_DETAILS )
70
+ {
71
+ require_once('classes/listpage_embed.php');
72
+ require_once('classes/listpage_dpinline.php');
73
+ require_once('classes/listpage_dplist.php');
74
+ }
75
+ elseif( $mode == LIST_DASHDETAILS )
76
+ {
77
+ require_once('classes/listpage_embed.php');
78
+ require_once('classes/listpage_dashboard.php');
79
+ require_once('classes/listpage_dpdash.php');
80
+ }
81
+ elseif( $mode == LIST_DASHBOARD )
82
+ {
83
+ require_once('classes/listpage_embed.php');
84
+ require_once('classes/listpage_dashboard.php');
85
+ }
86
+ elseif( $mode == MAP_DASHBOARD )
87
+ {
88
+ require_once('classes/listpage_embed.php');
89
+ require_once('classes/listpage_dashboard.php');
90
+ require_once('classes/map_dashboard.php');
91
+ }
92
+
93
+ $xt = new Xtempl( $mode != LIST_SIMPLE ); //#9607 1. Temporary fix
94
+
95
+ $options["pageName"] = postvalue("page");
96
+ $options["pageType"] = PAGE_LIST;
97
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
98
+ $options["flyId"] = (int)postvalue("recordId");
99
+ $options["mode"] = $mode;
100
+ $options["xt"] = &$xt;
101
+ $options["firstTime"] = postvalue("firstTime");
102
+ $options["sortBy"] = postvalue("sortby");
103
+ $options["requestGoto"] = postvalue_number("goto");
104
+
105
+
106
+ $options["masterPageType"] = postvalue("masterpagetype");
107
+ $options["masterPage"] = postvalue("masterpage");
108
+ $options["masterId"] = postvalue("masterid");
109
+
110
+ $options["masterTable"] = postvalue("mastertable");
111
+ if( $options["masterTable"] )
112
+ $options["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
113
+
114
+
115
+ if( $mode == LIST_DASHBOARD && postvalue("nodata") && strlen($options["masterTable"]) )
116
+ $options["showNoData"] = true;
117
+
118
+ if( $mode != LIST_LOOKUP )
119
+ {
120
+ $options["dashElementName"] = postvalue("dashelement");
121
+ $options["dashTName"] = postvalue("table");
122
+ $options["dashPage"] = postvalue("dashPage");
123
+ }
124
+
125
+ if( postvalue("mapRefresh") )
126
+ {
127
+ $options["mapRefresh"] = true;
128
+ $options["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
129
+ }
130
+
131
+ if( postvalue("firstTime") )
132
+ $options["firstTime"] = true;
133
+
134
+ // Create $pageObject
135
+ $pageObject = ListPage::createListPage($strTableName, $options);
136
+
137
+ if( $pageObject->processSaveSearch() )
138
+ exit();
139
+
140
+ if( $pageObject->updateRowOrder() )
141
+ exit();
142
+
143
+ if ( $pageObject->processFieldFilter() )
144
+ exit();
145
+
146
+ if( $pageObject->processTotals() )
147
+ exit();
148
+
149
+ if( $mode != LIST_DETAILS && $mode != MAP_DASHBOARD && $mode != LIST_DASHBOARD )
150
+ {
151
+ //maps
152
+ }
153
+
154
+ unset($_SESSION["message_add"]);
155
+ unset($_SESSION["message_edit"]);
156
+
157
+ // prepare code for build page
158
+ $pageObject->prepareForBuildPage();
159
+
160
+ // show page depends of mode
161
+ $pageObject->showPage();
162
+
163
+ ?>
php/admin_users_print.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("classes/searchclause.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/printpage.php');
9
+ require_once('classes/printpage_details.php');
10
+ require_once('classes/reportpage.php');
11
+ require_once('classes/reportprintpage.php');
12
+
13
+ add_nocache_headers();
14
+
15
+ require_once("include/admin_users_variables.php");
16
+
17
+ if( Security::hasLogin() ) {
18
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
19
+ return;
20
+ }
21
+
22
+
23
+ $xt = new Xtempl();
24
+
25
+ //array of params for classes
26
+ $params = array();
27
+ $params["id"] = postvalue_number("id");
28
+ $params["xt"] = &$xt;
29
+ $params["pageType"] = PAGE_PRINT;
30
+ $params["pageName"] = postvalue("page");
31
+ $params["tName"] = $strTableName;
32
+ $params["selection"] = postvalue("selection"); //PrintPage::readSelectedRecordsFromRequest( "admin_users" );
33
+ $params["allPagesMode"] = postvalue("all");
34
+ $params["detailTables"] = postvalue("details");
35
+ $params["splitByRecords"] = postvalue("records");
36
+ $params["mode"] = postvalue( "pdfjson" ) ? PRINT_PDFJSON : PRINT_SIMPLE;
37
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
38
+
39
+ $params["masterTable"] = postvalue("mastertable");
40
+ if( $params["masterTable"] )
41
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
42
+
43
+ $pageObject = new PrintPage($params);
44
+ $pageObject->init();
45
+ $pageObject->process();
46
+ ?>
php/admin_users_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/admin_users_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'admin_users';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/admin_users_view.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("include/admin_users_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/viewpage.php');
9
+ require_once("classes/searchclause.php");
10
+
11
+ add_nocache_headers();
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !ViewPage::processEditPageSecurity( $strTableName ) )
15
+ return;
16
+ }
17
+
18
+ $pageMode = ViewPage::readViewModeFromRequest();
19
+
20
+ $xt = new Xtempl();
21
+
22
+ // $keys could not be set properly if editid params were no passed
23
+ $keys = array();
24
+ $keys["email"] = postvalue("editid1");
25
+
26
+ //array of params for classes
27
+ $params = array();
28
+ $params["id"] = postvalue_number("id");
29
+ $params["xt"] = &$xt;
30
+ $params["keys"] = $keys;
31
+ $params["mode"] = $pageMode;
32
+ $params["pageType"] = PAGE_VIEW;
33
+ $params["pageName"] = postvalue("page");
34
+ $params["tName"] = $strTableName;
35
+
36
+ $params["pdfMode"] = postvalue("pdf") !== "";
37
+
38
+ $params["masterTable"] = postvalue("mastertable");
39
+ if( $params["masterTable"] )
40
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
41
+
42
+ if( $pageMode == VIEW_DASHBOARD )
43
+ {
44
+ $params["dashElementName"] = postvalue("dashelement");
45
+ $params["dashTName"] = postvalue("table");
46
+ $params["dashPage"] = postvalue("dashPage");
47
+ if( postvalue("mapRefresh") )
48
+ {
49
+ $params["mapRefresh"] = true;
50
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
51
+ }
52
+ }
53
+ if( $pageMode == VIEW_POPUP )
54
+ {
55
+ $params["dashElementName"] = postvalue("dashelement");
56
+ $params["dashTName"] = postvalue("dashTName");
57
+ $params["dashPage"] = postvalue("dashPage");
58
+ }
59
+
60
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
61
+
62
+ $pageObject = new ViewPage($params);
63
+ $pageObject->init();
64
+
65
+ $pageObject->process();
66
+
67
+ ?>
php/api/api.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class API {
4
+ public static function sendError( $text, $responseCode = 500 ) {
5
+ API::sendResponse( false, array(
6
+ "error" => $text
7
+ ), $responseCode );
8
+ }
9
+
10
+ public static function sendResponse( $success, $data, $responseCode = 0 ) {
11
+ if( !$responseCode ) {
12
+ $responseCode = $success ? 200 : 500;
13
+ }
14
+ http_response_code( $responseCode );
15
+ $data["success"] = $success;
16
+ echo my_json_encode( $data );
17
+ exit();
18
+ }
19
+
20
+ // read one record from the result
21
+ public static function readRecord( $result, $pSet ) {
22
+ $data = $result->fetchAssoc();
23
+ if( !$data ) {
24
+ return null;
25
+ }
26
+ foreach( array_keys( $data ) as $f ) {
27
+ if( IsBinaryType( $pSet->getFieldType( $f ) ) && GetGlobalData("restReturnEncodedBinary") ) {
28
+ $data[ $f ] = base64_encode( $data[ $f ] );
29
+ }
30
+ }
31
+ return $data;
32
+ }
33
+
34
+ // read result into array of records
35
+ public static function readResult( $result, $pSet, $recordLimit = 0 ) {
36
+ $ret = array();
37
+ while( ( !$recordLimit || count( $ret ) < $recordLimit ) && ( $data = API::readRecord( $result, $pSet ) ) ) {
38
+ $ret[] = $data;
39
+ }
40
+ return $ret;
41
+ }
42
+
43
+ public static function login() {
44
+ if( !Security::hasLogin() ) {
45
+ return true;
46
+ }
47
+ $authType = GetGlobalData("restAuth");
48
+ if( $authType == REST_BASIC ) {
49
+ // Authorization: Basic <base64_encode(username:password)>
50
+ $username = "";
51
+ $password = "";
52
+ $username = $_SERVER["PHP_AUTH_USER"];
53
+ $password = $_SERVER["PHP_AUTH_PW"];
54
+ if( !$username ) {
55
+ $loginHeader = getHttpHeader('Authorization') . "";
56
+ if( substr( $loginHeader, 0, 6 ) !== 'Basic ' ) {
57
+ header( 'WWW-Authenticate: Basic realm="REST API"');
58
+ return false;
59
+ }
60
+ $token = base64_decode( substr( $loginHeader, 6) );
61
+ $colonPos = strpos( $token, ':' );
62
+ if( $colonPos === false ) {
63
+ return false;
64
+ }
65
+ $username = substr( $token, 0, $colonPos );
66
+ $password = substr( $token, $colonPos + 1 );
67
+ }
68
+ return Security::login( $username, $password, false, true );
69
+ }
70
+
71
+ if ( $authType == REST_APIKEY ) {
72
+ $APIkey = "";
73
+ if( isset( $_SERVER["HTTP_X_AUTH_TOKEN"] ) )
74
+ $APIkey = $_SERVER["HTTP_X_AUTH_TOKEN"];
75
+ else
76
+ $APIkey = postvalue("apikey");
77
+
78
+ if( !strlen( $APIkey ) )
79
+ return false;
80
+
81
+ if( Security::hardcodedLogin() ) {
82
+ if( GetGlobalData("APIkey", "") == $APIkey ) {
83
+ Security::createHardcodedSession();
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+
89
+ $dataSource = getLoginDataSource();
90
+
91
+ $dc = new DsCommand();
92
+ $dc->filter = DataCondition::FieldEquals( GetGlobalData("APIkeyField"), $APIkey );
93
+ $rs = $dataSource->getSingle( $dc );
94
+ if( !$rs )
95
+ return false;
96
+
97
+ $loginSet = ProjectSettings::getForLogin();
98
+ $cipherer = RunnerCipherer::getForLogin( $loginSet );
99
+ $userData = $cipherer->DecryptFetchedArray( $rs->fetchAssoc() );
100
+
101
+ return Security::login( $userData[ Security::usernameField() ], $userData[ Security::passwordField() ], true, true );
102
+ }
103
+
104
+ return false;
105
+ }
106
+
107
+ public static function keysFromRequest( $pSet ) {
108
+ $keys = array();
109
+ foreach( $pSet->getTableKeys() as $i => $k ) {
110
+ $keys[ $k ] = postvalue( "editid" . ( $i + 1 ) );
111
+ }
112
+ return $keys;
113
+ }
114
+
115
+ public static function valuesFromRequest( $pSet ) {
116
+ $values = array();
117
+ foreach( $pSet->getFieldsList() as $f ) {
118
+ if( postvalue( $f ) || GetUploadedFileName( $f ) ) {
119
+ $values[ $f ] = API::processRequestValue( $f, postvalue( $f ), $pSet );
120
+ }
121
+ }
122
+
123
+ return $values;
124
+ }
125
+
126
+ protected static function processRequestValue( $fieldName, $value, $pSet ) {
127
+ if( IsBinaryType( $pSet->getFieldType( $fieldName ) ) ) {
128
+ if( $value && GetGlobalData("restAcceptEncodedBinary") ) {
129
+ $decodedValue = base64_decode_binary( $value );
130
+
131
+ // invalid base64 value passed
132
+ if( !$decodedValue ) {
133
+ API::sendError( "Unable to decode " . $fieldName . " value from base64" );
134
+ }
135
+
136
+ return $decodedValue;
137
+ }
138
+
139
+ // data passed as file
140
+ if( GetUploadedFileName( $fieldName ) ) {
141
+ return GetUploadedFileContents( $fieldName );
142
+ }
143
+ }
144
+
145
+ return $value;
146
+ }
147
+ }
148
+ ?>
php/api/v1.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ $restApiCall = true;
4
+
5
+ require_once("../include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ storeJSONDataFromRequest();
9
+
10
+ require_once(getabspath( "api/api.php"));
11
+
12
+ if( !GetGlobalData("restCreate") ) {
13
+ return;
14
+ }
15
+
16
+ header("Content-Type: application/json");
17
+
18
+ if( !API::login() ) {
19
+ API::sendError( 'Access denied', 401 );
20
+ }
21
+
22
+ // dont' remember anything
23
+ session_destroy();
24
+
25
+ $table = findTable( postvalue("table") );
26
+ if( !$table ) {
27
+ API::sendError( 'Unknown table name', 403 );
28
+ }
29
+
30
+ $pSet = new ProjectSettings( $table );
31
+ $eventsObject = &getEventObject( $table );
32
+ $cipherer = new RunnerCipherer( $table, $pSet );
33
+
34
+ $action = postvalue("action");
35
+
36
+ if( $action === "list" ) {
37
+ if( !$pSet->pageTypeAvailable("list") ) {
38
+ API::sendError( "operation not supported" );
39
+ }
40
+ if( !Security::userCan( "S", $table ) ) {
41
+ API::sendError( "operation not allowed" );
42
+ }
43
+ $dataSource = getDataSource( $table, $pSet );
44
+ $srchObj = SearchClause::getSearchObject( $table );
45
+
46
+ $dc = new DsCommand();
47
+ $dc->filter = DataCondition::_And( array(
48
+ Security::SelectCondition( "S", $pSet ),
49
+ $srchObj->getSearchDataCondition()
50
+ ));
51
+
52
+ $order = postvalue("orderby");
53
+ if( $order ) {
54
+ $orderFields = explode( ";", $order );
55
+ $projectFields = $pSet->getFieldsList();
56
+ $dc->order[] = array();
57
+
58
+ foreach( $orderFields as $f ) {
59
+ $dir = substr( $f, 0, 1 ) == "d" ? "desc": "asc";
60
+ $field = trim( substr( $f, 1 ) );
61
+ if( in_array( $field, $projectFields ) ) {
62
+ $dc->order[] = array("column" => $field, "dir" => $dir);
63
+ }
64
+ }
65
+ }
66
+
67
+ if( postvalue( "skip" ) ) {
68
+ $dc->startRecord = (int)postvalue( "skip" );
69
+ }
70
+ if( postvalue( "records" ) ) {
71
+ $dc->reccount = (int)postvalue( "records" );
72
+ } else {
73
+ $dc->reccount = 200;
74
+ }
75
+ $rs = $dataSource->getList( $dc );
76
+ if( !$rs ) {
77
+ API::sendError( $dataSource->lastError() );
78
+ }
79
+ API::sendResponse( true, array("data" => API::readResult( $rs, $pSet, $dc->reccount ) ) );
80
+ }
81
+
82
+ if( $action === "view" ) {
83
+ if( !$pSet->pageTypeAvailable("view") ) {
84
+ API::sendError( "operation not supported" );
85
+ }
86
+ if( !Security::userCan( "S", $table ) ) {
87
+ API::sendError( "operation not allowed" );
88
+ }
89
+ $dataSource = getDataSource( $table, $pSet );
90
+ $dc = new DsCommand();
91
+ $dc->keys = API::keysFromRequest( $pSet );
92
+ $dc->filter = Security::SelectCondition( "S", $pSet );
93
+ $rs = $dataSource->getSingle( $dc );
94
+ if( !$rs ) {
95
+ API::sendError( $dataSource->lastError() );
96
+ }
97
+ API::sendResponse( true, array("data" => API::readRecord( $rs, $pSet ) ) );
98
+ }
99
+
100
+ if( $action === "update" ) {
101
+ if( !$pSet->pageTypeAvailable("edit") ) {
102
+ API::sendError( "operation not supported" );
103
+ }
104
+ if( !Security::userCan( "E", $table ) ) {
105
+ API::sendError( "operation not allowed" );
106
+ }
107
+
108
+ $dataSource = getDataSource( $table, $pSet );
109
+
110
+ $oldKeys = API::keysFromRequest( $pSet );
111
+ $newRecordData = API::valuesFromRequest( $pSet );
112
+
113
+ $oldRecordData = null;
114
+ if( $eventsObject->exists("BeforeEdit") || $eventsObject->exists("AfterEdit") ) {
115
+ $dc = new DsCommand();
116
+ $dc->filter = Security::SelectCondition( "E", $pSet );
117
+ $dc->keys = $oldKeys;
118
+ $fetchedArray = $dataSource->getSingle( $dc )->fetchAssoc();
119
+ $oldRecordData = $cipherer->DecryptFetchedArray( $fetchedArray );
120
+ }
121
+
122
+ $sqlValues = array();
123
+ if( $eventsObject->exists("BeforeEdit") ) {
124
+ $usermessage = "";
125
+ $keyWhereClause = KeyWhere( $oldKeys, $table );
126
+ $pageObj = null;
127
+
128
+ $beforeEdit = $eventsObject->BeforeEdit( $newRecordData,
129
+ $sqlValues,
130
+ $keyWhereClause,
131
+ $oldRecordData,
132
+ $oldKeys,
133
+ $usermessage,
134
+ false,
135
+ $pageObj );
136
+
137
+ if( !$beforeEdit ) {
138
+ API::sendResponse( false, array( "success" => false, "error" => $usermessage ) );
139
+ }
140
+ }
141
+
142
+ $dc = new DsCommand();
143
+ $dc->keys = $oldKeys;
144
+ $dc->filter = Security::SelectCondition( "E", $pSet );
145
+ $dc->values = $newRecordData;
146
+
147
+ $dc->advValues = array();
148
+ foreach( $sqlValues as $field => $sqlValue ) {
149
+ $dc->advValues[ $field ] = new DsOperand( dsotSQL, $sqlValue );
150
+ }
151
+
152
+ $ret = $dataSource->updateSingle( $dc );
153
+
154
+ if( $ret && $eventsObject->exists("AfterEdit") ) {
155
+ $keys = $oldKeys;
156
+ foreach( $newRecordData as $f => $v ) {
157
+ if( isset( $keys[ $f ] ) ) {
158
+ $keys[ $f ] = $v;
159
+ }
160
+ }
161
+
162
+ $keyWhereClause = KeyWhere( $keys, $table );
163
+ $pageObj = null;
164
+
165
+ $eventsObject->AfterEdit( $newRecordData,
166
+ $keyWhereClause,
167
+ $oldRecordData,
168
+ $keys,
169
+ false,
170
+ $pageObj );
171
+ }
172
+
173
+ if( $ret ) {
174
+ API::sendResponse( true, array( "success" => true ) );
175
+ } else {
176
+ API::sendResponse( false, array( "success" => false, "error" => $dataSource->lastError() ) );
177
+ }
178
+ API::sendResponse( $ret["success"], $ret );
179
+ }
180
+
181
+ if( $action === "insert" ) {
182
+ if( !$pSet->pageTypeAvailable("add") ) {
183
+ API::sendError( "operation not supported" );
184
+ }
185
+
186
+ if( !Security::userCan( "A", $table ) ) {
187
+ API::sendError( "operation not allowed" );
188
+ }
189
+
190
+ $newRecordData = API::valuesFromRequest( $pSet );
191
+
192
+ $sqlValues = array();
193
+ if( $eventsObject->exists("BeforeAdd") ) {
194
+ $usermessage = "";
195
+ $pageObj = null;
196
+
197
+ if( !$eventsObject->BeforeAdd( $newRecordData, $sqlValues, $usermessage, false, $pageObj ) ) {
198
+ API::sendResponse( false, array( "success" => false, "error" => $usermessage ) );
199
+ }
200
+ }
201
+
202
+ $dataSource = getDataSource( $table, $pSet );
203
+ $dc = new DsCommand();
204
+ $dc->values = $newRecordData;
205
+
206
+ $dc->advValues = array();
207
+ foreach( $sqlValues as $field => $sqlValue ) {
208
+ $dc->advValues[ $field ] = new DsOperand( dsotSQL, $sqlValue );
209
+ }
210
+
211
+ $ret = $dataSource->insertSingle( $dc );
212
+
213
+ if( $ret && $eventsObject->exists("AfterAdd") ) {
214
+ $pageObj = null;
215
+ $newRecordData = $ret;
216
+ $keys = array();
217
+ foreach( $pSet->getTableKeys() as $kf ) {
218
+ $keys[ $kf ] = $newRecordData[ $kf ];
219
+ }
220
+
221
+ $eventsObject->AfterAdd( $newRecordData, $keys, false, $pageObj );
222
+ }
223
+
224
+ if( $ret !== false ) {
225
+ API::sendResponse( true, array( "success" => true, "data" => $ret ) );
226
+ } else {
227
+ API::sendResponse( false, array( "success" => false, "error" => $dataSource->lastError() ) );
228
+ }
229
+ }
230
+
231
+ if( $action === "delete" ) {
232
+ if( !$pSet->pageTypeAvailable("list") ) {
233
+ API::sendError( "operation not supported" );
234
+ }
235
+ if( !Security::userCan( "D", $table ) ) {
236
+ API::sendError( "operation not allowed" );
237
+ }
238
+
239
+ $dataSource = getDataSource( $table, $pSet );
240
+ $dc = new DsCommand();
241
+ $dc->keys = API::keysFromRequest( $pSet );
242
+ $dc->filter = Security::SelectCondition( "D", $pSet );
243
+
244
+ $whereClause = "";
245
+ $deletedValues = array();
246
+ if( $eventsObject->exists("BeforeDelete") || $eventsObject->exists("AfterDelete") ) {
247
+ $deletedResult = $dataSource->getSingle( $dc );
248
+ if( $deletedResult )
249
+ $deletedValues = $cipherer->DecryptFetchedArray( $deletedResult->fetchAssoc() );
250
+
251
+ $whereClause = KeyWhere( $dc->keys, $table );
252
+ }
253
+
254
+ if( $eventsObject->exists("BeforeDelete") ) {
255
+ $userMessage = "";
256
+ $pageObj = null;
257
+ if( !$eventsObject->BeforeDelete( $whereClause, $deletedValues, $userMessage, $pageObj ) ) {
258
+ API::sendResponse( false, array( "success" => false, "error" => $userMessage ) );
259
+ }
260
+ }
261
+
262
+ $ret = $dataSource->deleteSingle( $dc );
263
+
264
+ if( $ret && $eventsObject->exists("AfterDelete") ) {
265
+ $userMessage = "";
266
+ $pageObj = null;
267
+ $eventsObject->AfterDelete( $whereClause, $deletedValues, $userMessage, $pageObj );
268
+ }
269
+
270
+ if( $ret ) {
271
+ API::sendResponse( true, array( "success" => true ) );
272
+ } else {
273
+ API::sendResponse( false, array( "success" => false, "error" => $dataSource->lastError() ) );
274
+ }
275
+ }
276
+
277
+ API::sendError( "unknown operation" );
278
+
php/appointments_add.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+
4
+ require_once("include/dbcommon.php");
5
+ require_once("classes/searchclause.php");
6
+ require_once("include/appointments_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/addpage.php');
9
+ require_once('include/lookuplinks.php');
10
+
11
+ add_nocache_headers();
12
+
13
+ InitLookupLinks();
14
+
15
+ if( Security::hasLogin() ) {
16
+ if( !AddPage::processAddPageSecurity( $strTableName ) )
17
+ return;
18
+ }
19
+
20
+ AddPage::handleBrokenRequest();
21
+
22
+
23
+ $pageMode = AddPage::readAddModeFromRequest();
24
+
25
+ $xt = new Xtempl();
26
+
27
+ $id = postvalue_number("id");
28
+ $id = $id ? $id : 1;
29
+
30
+ //an array of AddPage constructor's params
31
+ $params = array();
32
+ $params["id"] = $id;
33
+ $params["xt"] = &$xt;
34
+ $params["mode"] = $pageMode;
35
+ $params["pageType"] = PAGE_ADD;
36
+ $params["tName"] = $strTableName;
37
+ $params["pageName"] = postvalue("page");
38
+ $params["action"] = postvalue("a");
39
+ $params["needSearchClauseObj"] = false;
40
+ $params["afterAdd_id"] = postvalue("afteradd");
41
+
42
+ $params["hostPageName"] = postvalue("hostPageName");
43
+ $params["listPage"] = postvalue("listPage");
44
+
45
+ $params["newRowId"] = postvalue("newRowId");
46
+
47
+ $params["masterTable"] = postvalue("mastertable");
48
+ if( $params["masterTable"] )
49
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
50
+
51
+
52
+
53
+ ;
54
+ $params["captchaName"] = "captcha_1209xre";
55
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
56
+ $params["dashElementName"] = postvalue("dashelement");
57
+ $params["fromDashboard"] = postvalue("fromDashboard");
58
+ $params["dashTName"] = $params["fromDashboard"] ? $params["fromDashboard"] : postvalue("dashTName");
59
+ $params["dashPage"] = postvalue("dashPage");
60
+
61
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
62
+
63
+ if ( $pageMode == ADD_POPUP ) {
64
+ $params["forListPageLookup"] = postvalue('forLookup');
65
+ }
66
+
67
+ if( $pageMode == ADD_DASHBOARD )
68
+ {
69
+ $params["dashElementName"] = postvalue("dashelement");
70
+ $params["dashTName"] = postvalue("table");
71
+ $params["dashPage"] = postvalue("dashPage");
72
+ }
73
+
74
+
75
+ if( $pageMode == ADD_INLINE )
76
+ {
77
+ // Inline add in a 'List page with search' lookup
78
+ $params["forListPageLookup"] = postvalue('forLookup');
79
+
80
+ $params["screenWidth"] = postvalue("screenWidth");
81
+ $params["screenHeight"] = postvalue("screenHeight");
82
+ $params["orientation"] = postvalue("orientation");
83
+
84
+ $params["masterPageType"] = postvalue("masterpagetype");
85
+ }
86
+
87
+
88
+ if( $pageMode == ADD_ONTHEFLY || ( $pageMode == ADD_INLINE || $pageMode == ADD_POPUP ) && postvalue('forLookup') )
89
+ {
90
+ //table where lookup is set
91
+ $params["lookupTable"] = postvalue("table");
92
+ //field with lookup is set
93
+ $params["lookupField"] = postvalue("field");
94
+ //the ptype od the page where lookup is set
95
+ $params["lookupPageType"] = postvalue("pageType");
96
+
97
+ if( postvalue('parentsExist') )
98
+ {
99
+ //the parent controls values data
100
+ $params["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
101
+ }
102
+ }
103
+
104
+ $pageObject = new AddPage($params);
105
+ $pageObject->init();
106
+
107
+ $pageObject->process();
108
+ ?>
php/appointments_edit.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ @ini_set("display_errors","1");
4
+ @ini_set("display_startup_errors","1");
5
+
6
+ require_once("include/dbcommon.php");
7
+ require_once("classes/searchclause.php");
8
+ require_once("include/appointments_variables.php");
9
+ require_once('include/xtempl.php');
10
+ require_once('classes/editpage.php');
11
+
12
+ add_nocache_headers();
13
+
14
+ if( Security::hasLogin() ) {
15
+ if( !EditPage::processEditPageSecurity( $strTableName ) )
16
+ return;
17
+ }
18
+
19
+ EditPage::handleBrokenRequest();
20
+
21
+ // render all necessary layouts
22
+
23
+
24
+ // parse control parameters
25
+ $pageMode = EditPage::readEditModeFromRequest();
26
+
27
+ $xt = new Xtempl();
28
+
29
+ $id = postvalue_number("id");
30
+ $id = intval($id) == 0 ? 1 : $id;
31
+
32
+
33
+ // $keys could not be set properly if editid params were no passed
34
+ $keys = array();
35
+ $keys["id"] = postvalue("editid1");
36
+
37
+ //array of params for classes
38
+ $params = array();
39
+ $params["id"] = $id;
40
+ $params["xt"] = &$xt;
41
+ $params["keys"] = $keys;
42
+ $params["mode"] = $pageMode;
43
+ $params["pageType"] = PAGE_EDIT;
44
+ $params["pageName"] = postvalue("page");
45
+ $params["tName"] = $strTableName;
46
+ $params["action"] = postvalue("a");
47
+ $params["selectedFields"] = postvalue("fields");
48
+
49
+ ;
50
+ $params["captchaName"] = "captcha_1209xre";
51
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
52
+ $params["selection"] = postvalue("selection");
53
+ $params["rowIds"] = my_json_decode( postvalue("rowIds") );
54
+
55
+ $params["masterTable"] = postvalue("mastertable");
56
+ if( $params["masterTable"] )
57
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
58
+
59
+ // locking parameters
60
+ $params["lockingAction"] = postvalue("action");
61
+ $params["lockingSid"] = postvalue("sid");
62
+ $params["lockingKeys"] = postvalue("keys");
63
+ $params["lockingStart"] = postvalue("startEdit");
64
+
65
+ if( $pageMode == EDIT_INLINE )
66
+ {
67
+ $params["screenWidth"] = postvalue("screenWidth");
68
+ $params["screenHeight"] = postvalue("screenHeight");
69
+ $params["orientation"] = postvalue("orientation");
70
+ }
71
+
72
+ if( $pageMode == EDIT_DASHBOARD )
73
+ {
74
+ $params["dashElementName"] = postvalue("dashelement");
75
+ $params["dashTName"] = postvalue("table");
76
+ $params["dashPage"] = postvalue("dashPage");
77
+
78
+ if( postvalue("mapRefresh") )
79
+ {
80
+ $params["mapRefresh"] = true;
81
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
82
+ }
83
+ }
84
+
85
+ if(( $pageMode == EDIT_POPUP || $pageMode == EDIT_INLINE ) && postvalue("dashTName"))
86
+ {
87
+ $params["dashTName"] = postvalue("dashTName");
88
+ $params["dashElementName"] = postvalue("dashelement");
89
+ $params["dashPage"] = postvalue("dashPage");
90
+ }
91
+
92
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
93
+ $params["hostPageName"] = postvalue("hostPageName");
94
+ $params["listPage"] = postvalue("listPage");
95
+
96
+ $pageObject = EditPage::EditPageFactory($params);
97
+
98
+ if( $pageObject->isLockingRequest() )
99
+ {
100
+ $pageObject->doLockingAction();
101
+ exit();
102
+ }
103
+
104
+ $pageObject->init();
105
+
106
+ $pageObject->process();
107
+ ?>
php/appointments_export.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ require_once("classes/searchclause.php");
8
+ require_once("classes/sql.php");
9
+
10
+ require_once("include/appointments_variables.php");
11
+
12
+ if( Security::hasLogin() ) {
13
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
14
+ return;
15
+ }
16
+
17
+
18
+ require_once("include/export_functions.php");
19
+ require_once("classes/exportpage.php");
20
+ require_once("include/xtempl.php");
21
+
22
+ $xt = new Xtempl();
23
+
24
+ //array of params for classes
25
+ $params = array();
26
+ $params["id"] = postvalue_number("id");
27
+ $params["xt"] = &$xt;
28
+ $params["tName"] = $strTableName;
29
+ $params["pageType"] = PAGE_EXPORT;
30
+ $params["pageName"] = postvalue("page");
31
+
32
+ $params["selectedFields"] = postvalue("exportFields");
33
+ $params["exportType"] = postvalue("type");
34
+
35
+ $params["allPagesMode"] = postvalue("records") == "all";
36
+ $params["currentPageMode"] = postvalue("records") == "page";
37
+ $params["selection"] = postvalue("selection");
38
+ $params["csvDelimiter"] = postvalue("delimiter");
39
+
40
+ if( postvalue("txtformatting") == "raw" )
41
+ $params["useRawValues"] = true;
42
+
43
+ $params["mode"] = ExportPage::readModeFromRequest();
44
+
45
+ $params["masterTable"] = postvalue("mastertable");
46
+ if( $params["masterTable"] )
47
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
48
+
49
+ $pageObject = new ExportPage( $params );
50
+ $pageObject->init();
51
+
52
+ $pageObject->process();
53
+ ?>
php/appointments_import.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ set_time_limit(600);
8
+
9
+ require_once("include/appointments_variables.php");
10
+ require_once("include/import_functions.php");
11
+ require_once('classes/importpage.php');
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !Security::processPageSecurity( $strtablename, 'I' ) )
15
+ return;
16
+ }
17
+
18
+
19
+ require_once('include/xtempl.php');
20
+ $xt = new Xtempl();
21
+
22
+ //an array of params for ImportPage constructor
23
+ $params = array();
24
+ $params["id"] = postvalue_number("id");
25
+ $params["xt"] = &$xt;
26
+ $params["tName"] = $strTableName;
27
+ $params["action"] = postvalue("a");
28
+ $params["pageType"] = PAGE_IMPORT;
29
+ $params["pageName"] = postvalue("page");
30
+ $params["needSearchClauseObj"] = false;
31
+ $params["strOriginalTableName"] = $strOriginalTableName;
32
+
33
+ if( $params["action"] == "importPreview" )
34
+ {
35
+ $params["importType"] = postvalue("importType");
36
+ $params["importText"] = postvalue("importText");
37
+ $params["useXHR"] = postvalue("useXHR");
38
+ }
39
+ elseif( $params["action"] == "importData" )
40
+ {
41
+ $params["importData"] = my_json_decode( postvalue("importData") );
42
+ }
43
+
44
+ $params["masterTable"] = postvalue("mastertable");
45
+ if( $params["masterTable"] )
46
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
47
+
48
+ $pageObject = new ImportPage($params);
49
+ $pageObject->init();
50
+
51
+ $pageObject->process();
52
+
53
+ ?>
php/appointments_list.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ $requestTable = "public.appointments";
6
+ $requestPage = "list";
7
+
8
+ require_once("include/dbcommon.php");
9
+ add_nocache_headers();
10
+
11
+ require_once('include/xtempl.php');
12
+
13
+ require_once("classes/searchcontrol.php");
14
+ require_once("classes/searchclause.php");
15
+ require_once("classes/panelsearchcontrol.php");
16
+ require_once("include/appointments_variables.php");
17
+ require_once('classes/listpage.php');
18
+ require_once('include/lookuplinks.php');
19
+
20
+ // Check whether the page was called as a part of Lookup wizard - List page with search.
21
+ // Verify the eligibility of such a call.
22
+
23
+ InitLookupLinks();
24
+ if( Security::hasLogin() ) {
25
+ if( !ListPage::processListPageSecurity( $strTableName ) )
26
+ return;
27
+ }
28
+
29
+ if( ListPage::processSaveParams( $strTableName ) )
30
+ return;
31
+
32
+ $options = array();
33
+ //array of params for classes
34
+
35
+ // Include necessary files in accordance with the page displaying mode
36
+ $mode = ListPage::readListModeFromRequest();
37
+ if( $mode == LIST_SIMPLE )
38
+ {
39
+ require_once('classes/listpage_simple.php');
40
+ require_once("classes/searchpanelsimple.php");
41
+ }
42
+ elseif( $mode == LIST_AJAX )
43
+ {
44
+ require_once('classes/listpage_simple.php');
45
+ require_once('classes/listpage_ajax.php');
46
+ require_once("classes/searchpanelsimple.php");
47
+ }
48
+ elseif( $mode == LIST_LOOKUP )
49
+ {
50
+ require_once('classes/listpage_embed.php');
51
+ require_once('classes/listpage_lookup.php');
52
+
53
+ $options["mainTable"] = postvalue("table");
54
+ $options["mainField"] = postvalue("field");
55
+ $options["mainPageType"] = postvalue("pageType");
56
+
57
+ $options["mainRecordData"] = my_json_decode( postvalue('data') );
58
+ $options["mainRecordMasterTable"] = postvalue('mainRecordMasterTable');
59
+
60
+ if( postvalue("parentsExist") )
61
+ $options["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
62
+ }
63
+ elseif( $mode == LIST_POPUPDETAILS )
64
+ {
65
+ require_once('classes/listpage_embed.php');
66
+ require_once('classes/listpage_dpinline.php');
67
+ require_once('classes/listpage_dppopup.php');
68
+ }
69
+ elseif( $mode == LIST_DETAILS )
70
+ {
71
+ require_once('classes/listpage_embed.php');
72
+ require_once('classes/listpage_dpinline.php');
73
+ require_once('classes/listpage_dplist.php');
74
+ }
75
+ elseif( $mode == LIST_DASHDETAILS )
76
+ {
77
+ require_once('classes/listpage_embed.php');
78
+ require_once('classes/listpage_dashboard.php');
79
+ require_once('classes/listpage_dpdash.php');
80
+ }
81
+ elseif( $mode == LIST_DASHBOARD )
82
+ {
83
+ require_once('classes/listpage_embed.php');
84
+ require_once('classes/listpage_dashboard.php');
85
+ }
86
+ elseif( $mode == MAP_DASHBOARD )
87
+ {
88
+ require_once('classes/listpage_embed.php');
89
+ require_once('classes/listpage_dashboard.php');
90
+ require_once('classes/map_dashboard.php');
91
+ }
92
+
93
+ $xt = new Xtempl( $mode != LIST_SIMPLE ); //#9607 1. Temporary fix
94
+
95
+ $options["pageName"] = postvalue("page");
96
+ $options["pageType"] = PAGE_LIST;
97
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
98
+ $options["flyId"] = (int)postvalue("recordId");
99
+ $options["mode"] = $mode;
100
+ $options["xt"] = &$xt;
101
+ $options["firstTime"] = postvalue("firstTime");
102
+ $options["sortBy"] = postvalue("sortby");
103
+ $options["requestGoto"] = postvalue_number("goto");
104
+
105
+
106
+ $options["masterPageType"] = postvalue("masterpagetype");
107
+ $options["masterPage"] = postvalue("masterpage");
108
+ $options["masterId"] = postvalue("masterid");
109
+
110
+ $options["masterTable"] = postvalue("mastertable");
111
+ if( $options["masterTable"] )
112
+ $options["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
113
+
114
+
115
+ if( $mode == LIST_DASHBOARD && postvalue("nodata") && strlen($options["masterTable"]) )
116
+ $options["showNoData"] = true;
117
+
118
+ if( $mode != LIST_LOOKUP )
119
+ {
120
+ $options["dashElementName"] = postvalue("dashelement");
121
+ $options["dashTName"] = postvalue("table");
122
+ $options["dashPage"] = postvalue("dashPage");
123
+ }
124
+
125
+ if( postvalue("mapRefresh") )
126
+ {
127
+ $options["mapRefresh"] = true;
128
+ $options["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
129
+ }
130
+
131
+ if( postvalue("firstTime") )
132
+ $options["firstTime"] = true;
133
+
134
+ // Create $pageObject
135
+ $pageObject = ListPage::createListPage($strTableName, $options);
136
+
137
+ if( $pageObject->processSaveSearch() )
138
+ exit();
139
+
140
+ if( $pageObject->updateRowOrder() )
141
+ exit();
142
+
143
+ if ( $pageObject->processFieldFilter() )
144
+ exit();
145
+
146
+ if( $pageObject->processTotals() )
147
+ exit();
148
+
149
+ if( $mode != LIST_DETAILS && $mode != MAP_DASHBOARD && $mode != LIST_DASHBOARD )
150
+ {
151
+ //maps
152
+ }
153
+
154
+ unset($_SESSION["message_add"]);
155
+ unset($_SESSION["message_edit"]);
156
+
157
+ // prepare code for build page
158
+ $pageObject->prepareForBuildPage();
159
+
160
+ // show page depends of mode
161
+ $pageObject->showPage();
162
+
163
+ ?>
php/appointments_print.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("classes/searchclause.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/printpage.php');
9
+ require_once('classes/printpage_details.php');
10
+ require_once('classes/reportpage.php');
11
+ require_once('classes/reportprintpage.php');
12
+
13
+ add_nocache_headers();
14
+
15
+ require_once("include/appointments_variables.php");
16
+
17
+ if( Security::hasLogin() ) {
18
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
19
+ return;
20
+ }
21
+
22
+
23
+ $xt = new Xtempl();
24
+
25
+ //array of params for classes
26
+ $params = array();
27
+ $params["id"] = postvalue_number("id");
28
+ $params["xt"] = &$xt;
29
+ $params["pageType"] = PAGE_PRINT;
30
+ $params["pageName"] = postvalue("page");
31
+ $params["tName"] = $strTableName;
32
+ $params["selection"] = postvalue("selection"); //PrintPage::readSelectedRecordsFromRequest( "public.appointments" );
33
+ $params["allPagesMode"] = postvalue("all");
34
+ $params["detailTables"] = postvalue("details");
35
+ $params["splitByRecords"] = postvalue("records");
36
+ $params["mode"] = postvalue( "pdfjson" ) ? PRINT_PDFJSON : PRINT_SIMPLE;
37
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
38
+
39
+ $params["masterTable"] = postvalue("mastertable");
40
+ if( $params["masterTable"] )
41
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
42
+
43
+ $pageObject = new PrintPage($params);
44
+ $pageObject->init();
45
+ $pageObject->process();
46
+ ?>
php/appointments_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/appointments_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'appointments';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/appointments_view.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("include/appointments_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/viewpage.php');
9
+ require_once("classes/searchclause.php");
10
+
11
+ add_nocache_headers();
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !ViewPage::processEditPageSecurity( $strTableName ) )
15
+ return;
16
+ }
17
+
18
+ $pageMode = ViewPage::readViewModeFromRequest();
19
+
20
+ $xt = new Xtempl();
21
+
22
+ // $keys could not be set properly if editid params were no passed
23
+ $keys = array();
24
+ $keys["id"] = postvalue("editid1");
25
+
26
+ //array of params for classes
27
+ $params = array();
28
+ $params["id"] = postvalue_number("id");
29
+ $params["xt"] = &$xt;
30
+ $params["keys"] = $keys;
31
+ $params["mode"] = $pageMode;
32
+ $params["pageType"] = PAGE_VIEW;
33
+ $params["pageName"] = postvalue("page");
34
+ $params["tName"] = $strTableName;
35
+
36
+ $params["pdfMode"] = postvalue("pdf") !== "";
37
+
38
+ $params["masterTable"] = postvalue("mastertable");
39
+ if( $params["masterTable"] )
40
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
41
+
42
+ if( $pageMode == VIEW_DASHBOARD )
43
+ {
44
+ $params["dashElementName"] = postvalue("dashelement");
45
+ $params["dashTName"] = postvalue("table");
46
+ $params["dashPage"] = postvalue("dashPage");
47
+ if( postvalue("mapRefresh") )
48
+ {
49
+ $params["mapRefresh"] = true;
50
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
51
+ }
52
+ }
53
+ if( $pageMode == VIEW_POPUP )
54
+ {
55
+ $params["dashElementName"] = postvalue("dashelement");
56
+ $params["dashTName"] = postvalue("dashTName");
57
+ $params["dashPage"] = postvalue("dashPage");
58
+ }
59
+
60
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
61
+
62
+ $pageObject = new ViewPage($params);
63
+ $pageObject->init();
64
+
65
+ $pageObject->process();
66
+
67
+ ?>
php/autocomplete.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ $shortTableName = postvalue("shortTName");
8
+ $table = GetTableByShort( $shortTableName );
9
+ if( !$table )
10
+ exit(0);
11
+
12
+
13
+ $field = postvalue("field");
14
+
15
+ $pageType = postvalue('pageType');
16
+ $pageName = postvalue('page');
17
+
18
+ if( !Security::userHasFieldPermissions( $table, $field, $pageType, $pageName, true ) )
19
+ return;
20
+
21
+ $cipherer = new RunnerCipherer( $table );
22
+ $pSet = new ProjectSettings( $table, $pageType, $pageName );
23
+
24
+ include_once getabspath("classes/controls/EditControlsContainer.php");
25
+ $editControls = new EditControlsContainer( null, $pSet, $pageType, $cipherer );
26
+ $control = $editControls->getControl( $field );
27
+
28
+
29
+ $contextParams = array();
30
+ $contextParams["data"] = my_json_decode( postvalue('data') );
31
+
32
+ $masterTable = postvalue('masterTable');
33
+ if ( $masterTable != "" && isset($_SESSION[ $masterTable . "_masterRecordData" ] ) || postvalue('masterData') )
34
+ {
35
+ $masterData = $_SESSION[ $masterTable . "_masterRecordData" ];
36
+ if( !is_array($masterData) ) {
37
+ $masterData = array();
38
+ }
39
+ $masterControlsData = my_json_decode( postvalue('masterData') );
40
+ foreach( $masterControlsData as $mField => $mValue )
41
+ {
42
+ $masterData[ $mField ] = $mValue;
43
+ }
44
+
45
+ $contextParams["masterData"] = $masterData;
46
+ }
47
+
48
+ RunnerContext::push( new RunnerContextItem( CONTEXT_ROW, $contextParams ) );
49
+
50
+
51
+ $parentCtrlsData = my_json_decode( postvalue('parentCtrlsData') );
52
+ $isExistParent = postvalue('isExistParent');
53
+ $mode = intval( postvalue('mode') );
54
+
55
+ $respObj = array( 'success' => true, 'data' => $control->getLookupContentToReload( $isExistParent === '1', $mode, $parentCtrlsData ) );
56
+ echo printJSON( $respObj );
57
+
58
+ RunnerContext::pop();
59
+ exit();
60
+ ?>
php/autofillfields.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+
8
+ $shortTableName = postvalue("shortTName");
9
+ $table = GetTableByShort( $shortTableName );
10
+ if( !$table )
11
+ exit(0);
12
+
13
+ $mainField = postvalue('mainField');
14
+ $linkFieldVal = postvalue('linkFieldVal');
15
+ $pageName = postvalue('page');
16
+ $pageType = postvalue('pageType');
17
+
18
+ if( !Security::userHasFieldPermissions( $table, $mainField, $pageType, $pageName, true ) )
19
+ return;
20
+
21
+ $cipherer = new RunnerCipherer( $table );
22
+ $pSet = new ProjectSettings( $table, $pageType, $pageName );
23
+
24
+ include_once getabspath("classes/controls/EditControlsContainer.php");
25
+ $editControls = new EditControlsContainer( null, $pSet, $pageType, $cipherer );
26
+ $control = $editControls->getControl( $mainField );
27
+
28
+
29
+ $contextParams = array();
30
+ $contextParams["data"] = my_json_decode( postvalue('data') );
31
+
32
+ $masterTable = postvalue('masterTable');
33
+ if ( $masterTable != "" && isset($_SESSION[ $masterTable . "_masterRecordData" ]) )
34
+ $contextParams["masterData"] = $_SESSION[ $masterTable . "_masterRecordData" ];
35
+
36
+ RunnerContext::push( new RunnerContextItem( CONTEXT_ROW, $contextParams ) );
37
+
38
+ echo printJSON( array( 'success'=> true, 'data' => $control->getAutoFillData( $linkFieldVal ) ) );
39
+
40
+ RunnerContext::pop();
41
+ exit();
42
+ ?>
php/buildpdf.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ ?>
7
+ <!DOCTYPE html>
8
+ <html lang="en-US">
9
+ <head>
10
+ <title>PDF Building</title>
11
+ </head>
12
+ <body>
13
+ <div class="printpdf"></div>
14
+ <?php echo GetBaseScriptsForPage(false); ?>
15
+ <script type='text/javascript' src="<?php echo GetRootPathForResources("include/pdfnewwindow.js"); ?>"></script>
16
+ </body>
17
+ </html>
php/buttonhandler.php ADDED
@@ -0,0 +1,982 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("classes/button.php");
7
+
8
+ // CSRF protection
9
+ if( !isPostRequest() )
10
+ return;
11
+
12
+ $params = (array)my_json_decode(postvalue('params'));
13
+
14
+ if( $params["_base64fields"] ) {
15
+ foreach( $params["_base64fields"] as $f ) {
16
+ $params[$f] = base64_str2bin( $params[$f] );
17
+ }
18
+ }
19
+
20
+ $buttId = $params['buttId'];
21
+ $eventId = postvalue('event');
22
+ $table = $params['table'];
23
+ if( !GetTableURL( $table ) ) {
24
+ exit;
25
+ }
26
+ $page = $params['page'];
27
+ if( !Security::userCanSeePage($table, $page ) ) {
28
+ exit;
29
+ }
30
+
31
+ $pSet = new ProjectSettings( $table, "", $page );
32
+ if( $buttId ) {
33
+ $pageButtons = $pSet->customButtons();
34
+ if( array_search( $buttId , $pageButtons ) === false ) {
35
+ exit;
36
+ }
37
+ }
38
+
39
+ $params["masterTable"] = postValue("masterTable");;
40
+ $params["masterKeys"] = array();
41
+ // RunnerPage::readMasterKeysFromRequest
42
+ $i = 1;
43
+ while( isset( $_REQUEST["masterkey".$i] ) ) {
44
+ $params["masterKeys"][ $i ] = $_REQUEST["masterkey".$i];
45
+ $i++;
46
+ }
47
+
48
+
49
+ if($buttId=='Add_Comment')
50
+ {
51
+ // for login page users table can be turned off
52
+ if( $table != GLOBAL_PAGES )
53
+ {
54
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
55
+ $cipherer = new RunnerCipherer( $table );
56
+ }
57
+ buttonHandler_Add_Comment($params);
58
+ }
59
+ if($buttId=='Create_chart')
60
+ {
61
+ // for login page users table can be turned off
62
+ if( $table != GLOBAL_PAGES )
63
+ {
64
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
65
+ $cipherer = new RunnerCipherer( $table );
66
+ }
67
+ buttonHandler_Create_chart($params);
68
+ }
69
+ if($buttId=='Send')
70
+ {
71
+ // for login page users table can be turned off
72
+ if( $table != GLOBAL_PAGES )
73
+ {
74
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
75
+ $cipherer = new RunnerCipherer( $table );
76
+ }
77
+ buttonHandler_Send($params);
78
+ }
79
+ if($buttId=='New_Button')
80
+ {
81
+ // for login page users table can be turned off
82
+ if( $table != GLOBAL_PAGES )
83
+ {
84
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
85
+ $cipherer = new RunnerCipherer( $table );
86
+ }
87
+ buttonHandler_New_Button($params);
88
+ }
89
+ if($buttId=='select_user_button')
90
+ {
91
+ // for login page users table can be turned off
92
+ if( $table != GLOBAL_PAGES )
93
+ {
94
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
95
+ $cipherer = new RunnerCipherer( $table );
96
+ }
97
+ buttonHandler_select_user_button($params);
98
+ }
99
+ if($buttId=='New_Button1')
100
+ {
101
+ // for login page users table can be turned off
102
+ if( $table != GLOBAL_PAGES )
103
+ {
104
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
105
+ $cipherer = new RunnerCipherer( $table );
106
+ }
107
+ buttonHandler_New_Button1($params);
108
+ }
109
+ if($buttId=='Audio')
110
+ {
111
+ // for login page users table can be turned off
112
+ if( $table != GLOBAL_PAGES )
113
+ {
114
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
115
+ $cipherer = new RunnerCipherer( $table );
116
+ }
117
+ buttonHandler_Audio($params);
118
+ }
119
+ if($buttId=='stopAudio')
120
+ {
121
+ // for login page users table can be turned off
122
+ if( $table != GLOBAL_PAGES )
123
+ {
124
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
125
+ $cipherer = new RunnerCipherer( $table );
126
+ }
127
+ buttonHandler_stopAudio($params);
128
+ }
129
+ if($buttId=='video_chat')
130
+ {
131
+ // for login page users table can be turned off
132
+ if( $table != GLOBAL_PAGES )
133
+ {
134
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
135
+ $cipherer = new RunnerCipherer( $table );
136
+ }
137
+ buttonHandler_video_chat($params);
138
+ }
139
+ if($buttId=='clip')
140
+ {
141
+ // for login page users table can be turned off
142
+ if( $table != GLOBAL_PAGES )
143
+ {
144
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
145
+ $cipherer = new RunnerCipherer( $table );
146
+ }
147
+ buttonHandler_clip($params);
148
+ }
149
+ if($buttId=='audiotest')
150
+ {
151
+ // for login page users table can be turned off
152
+ if( $table != GLOBAL_PAGES )
153
+ {
154
+ require_once("include/". GetTableURL( $table ) ."_variables.php");
155
+ $cipherer = new RunnerCipherer( $table );
156
+ }
157
+ buttonHandler_audiotest($params);
158
+ }
159
+
160
+ if( $eventId == 'select_provider' && "chat_settings" == $table )
161
+ {
162
+ require_once("include/chat_settings_variables.php");
163
+ $cipherer = new RunnerCipherer("chat_settings");
164
+ fieldEventHandler_select_provider( $params );
165
+ }
166
+ if( $eventId == 'check_video' && "chat_settings" == $table )
167
+ {
168
+ require_once("include/chat_settings_variables.php");
169
+ $cipherer = new RunnerCipherer("chat_settings");
170
+ fieldEventHandler_check_video( $params );
171
+ }
172
+ if( $eventId == 'tmp_file_event' && "chat_history" == $table )
173
+ {
174
+ require_once("include/chat_history_variables.php");
175
+ $cipherer = new RunnerCipherer("chat_history");
176
+ fieldEventHandler_tmp_file_event( $params );
177
+ }
178
+
179
+
180
+
181
+
182
+ // create table and non table handlers
183
+ function buttonHandler_Add_Comment($params)
184
+ {
185
+ global $strTableName;
186
+ $result = array();
187
+
188
+ // create new button object for get record data
189
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
190
+ $params["isManyKeys"] = postvalue('isManyKeys');
191
+ $params["location"] = postvalue('location');
192
+
193
+ $button = new Button($params);
194
+ $ajax = $button; // for examle from HELP
195
+ $keys = $button->getKeys();
196
+
197
+ $masterData = false;
198
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
199
+ {
200
+ $masterData = $params['masterData'];
201
+ }
202
+ else if ( isset($params["masterTable"]) )
203
+ {
204
+ $masterData = $button->getMasterData($params["masterTable"]);
205
+ }
206
+
207
+ $contextParams = array();
208
+ if ( $params["location"] == PAGE_VIEW )
209
+ {
210
+ $contextParams["data"] = $button->getRecordData();
211
+ $contextParams["masterData"] = $masterData;
212
+ }
213
+ else if ( $params["location"] == PAGE_EDIT )
214
+ {
215
+ $contextParams["data"] = $button->getRecordData();
216
+ $contextParams["newData"] = $params['fieldsData'];
217
+ $contextParams["masterData"] = $masterData;
218
+ }
219
+ else if ( $params["location"] == "grid" )
220
+ {
221
+ $params["location"] = "list";
222
+ $contextParams["data"] = $button->getRecordData();
223
+ $contextParams["newData"] = $params['fieldsData'];
224
+ $contextParams["masterData"] = $masterData;
225
+ }
226
+ else
227
+ {
228
+ $contextParams["masterData"] = $masterData;
229
+ }
230
+
231
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
232
+ // Put your code here.
233
+ $result["txt"] = $params["txt"]." world!";
234
+ ;
235
+ RunnerContext::pop();
236
+ echo my_json_encode($result);
237
+ $button->deleteTempFiles();
238
+ }
239
+ function buttonHandler_Create_chart($params)
240
+ {
241
+ global $strTableName;
242
+ $result = array();
243
+
244
+ // create new button object for get record data
245
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
246
+ $params["isManyKeys"] = postvalue('isManyKeys');
247
+ $params["location"] = postvalue('location');
248
+
249
+ $button = new Button($params);
250
+ $ajax = $button; // for examle from HELP
251
+ $keys = $button->getKeys();
252
+
253
+ $masterData = false;
254
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
255
+ {
256
+ $masterData = $params['masterData'];
257
+ }
258
+ else if ( isset($params["masterTable"]) )
259
+ {
260
+ $masterData = $button->getMasterData($params["masterTable"]);
261
+ }
262
+
263
+ $contextParams = array();
264
+ if ( $params["location"] == PAGE_VIEW )
265
+ {
266
+ $contextParams["data"] = $button->getRecordData();
267
+ $contextParams["masterData"] = $masterData;
268
+ }
269
+ else if ( $params["location"] == PAGE_EDIT )
270
+ {
271
+ $contextParams["data"] = $button->getRecordData();
272
+ $contextParams["newData"] = $params['fieldsData'];
273
+ $contextParams["masterData"] = $masterData;
274
+ }
275
+ else if ( $params["location"] == "grid" )
276
+ {
277
+ $params["location"] = "list";
278
+ $contextParams["data"] = $button->getRecordData();
279
+ $contextParams["newData"] = $params['fieldsData'];
280
+ $contextParams["masterData"] = $masterData;
281
+ }
282
+ else
283
+ {
284
+ $contextParams["masterData"] = $masterData;
285
+ }
286
+
287
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
288
+ /*global $loginKeyFields;
289
+ $userdata = Security::currentUserData();
290
+ $rs = DB::Query("select count(id) as cnt from chat_history where ownerid='".$userdata[$loginKeyFields[0]]."' and targetid='".$params["id"]."' and isread=0");
291
+ $data = $rs->fetchAssoc();
292
+ if($data["cnt"]==0){
293
+ DB::Exec("insert into chat_history (messages, created, isread, targetid, ownerid) values ('','".date("Y-m-d- h:i:s")."',0,".$params["id"].",'".$userdata[$loginKeyFields[0]]."')");
294
+ }
295
+ $result["id"] = $params["id"];*/;
296
+ RunnerContext::pop();
297
+ echo my_json_encode($result);
298
+ $button->deleteTempFiles();
299
+ }
300
+ function buttonHandler_Send($params)
301
+ {
302
+ global $strTableName;
303
+ $result = array();
304
+
305
+ // create new button object for get record data
306
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
307
+ $params["isManyKeys"] = postvalue('isManyKeys');
308
+ $params["location"] = postvalue('location');
309
+
310
+ $button = new Button($params);
311
+ $ajax = $button; // for examle from HELP
312
+ $keys = $button->getKeys();
313
+
314
+ $masterData = false;
315
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
316
+ {
317
+ $masterData = $params['masterData'];
318
+ }
319
+ else if ( isset($params["masterTable"]) )
320
+ {
321
+ $masterData = $button->getMasterData($params["masterTable"]);
322
+ }
323
+
324
+ $contextParams = array();
325
+ if ( $params["location"] == PAGE_VIEW )
326
+ {
327
+ $contextParams["data"] = $button->getRecordData();
328
+ $contextParams["masterData"] = $masterData;
329
+ }
330
+ else if ( $params["location"] == PAGE_EDIT )
331
+ {
332
+ $contextParams["data"] = $button->getRecordData();
333
+ $contextParams["newData"] = $params['fieldsData'];
334
+ $contextParams["masterData"] = $masterData;
335
+ }
336
+ else if ( $params["location"] == "grid" )
337
+ {
338
+ $params["location"] = "list";
339
+ $contextParams["data"] = $button->getRecordData();
340
+ $contextParams["newData"] = $params['fieldsData'];
341
+ $contextParams["masterData"] = $masterData;
342
+ }
343
+ else
344
+ {
345
+ $contextParams["masterData"] = $masterData;
346
+ }
347
+
348
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
349
+ /*include_once("chat_functions.php");
350
+ global $loginKeyFields;
351
+ $mess = $params["msg"];
352
+ if(strlen($mess)>4000)
353
+ $mess = substr($mess,0,4000);
354
+ $userdata = Security::currentUserData();
355
+ $t = explode(" ",this_microtime());
356
+ $sql = DB::PrepareSQL("insert into chat_history (messages, created, isread, targetid, ownerid, status) values (':1',':2','0','".$_SESSION["targetid"]."','".$userdata[$loginKeyFields[0]]."','')", $mess, date("Y-m-d H:i:s",$t[1]).substr((string)$t[0],1,4));
357
+ //echo $sql;
358
+ DB::Exec($sql);
359
+ $_SESSION["message_id"] = DB::LastId();
360
+
361
+ **/;
362
+ RunnerContext::pop();
363
+ echo my_json_encode($result);
364
+ $button->deleteTempFiles();
365
+ }
366
+ function buttonHandler_New_Button($params)
367
+ {
368
+ global $strTableName;
369
+ $result = array();
370
+
371
+ // create new button object for get record data
372
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
373
+ $params["isManyKeys"] = postvalue('isManyKeys');
374
+ $params["location"] = postvalue('location');
375
+
376
+ $button = new Button($params);
377
+ $ajax = $button; // for examle from HELP
378
+ $keys = $button->getKeys();
379
+
380
+ $masterData = false;
381
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
382
+ {
383
+ $masterData = $params['masterData'];
384
+ }
385
+ else if ( isset($params["masterTable"]) )
386
+ {
387
+ $masterData = $button->getMasterData($params["masterTable"]);
388
+ }
389
+
390
+ $contextParams = array();
391
+ if ( $params["location"] == PAGE_VIEW )
392
+ {
393
+ $contextParams["data"] = $button->getRecordData();
394
+ $contextParams["masterData"] = $masterData;
395
+ }
396
+ else if ( $params["location"] == PAGE_EDIT )
397
+ {
398
+ $contextParams["data"] = $button->getRecordData();
399
+ $contextParams["newData"] = $params['fieldsData'];
400
+ $contextParams["masterData"] = $masterData;
401
+ }
402
+ else if ( $params["location"] == "grid" )
403
+ {
404
+ $params["location"] = "list";
405
+ $contextParams["data"] = $button->getRecordData();
406
+ $contextParams["newData"] = $params['fieldsData'];
407
+ $contextParams["masterData"] = $masterData;
408
+ }
409
+ else
410
+ {
411
+ $contextParams["masterData"] = $masterData;
412
+ }
413
+
414
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
415
+ ;
416
+ RunnerContext::pop();
417
+ echo my_json_encode($result);
418
+ $button->deleteTempFiles();
419
+ }
420
+ function buttonHandler_select_user_button($params)
421
+ {
422
+ global $strTableName;
423
+ $result = array();
424
+
425
+ // create new button object for get record data
426
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
427
+ $params["isManyKeys"] = postvalue('isManyKeys');
428
+ $params["location"] = postvalue('location');
429
+
430
+ $button = new Button($params);
431
+ $ajax = $button; // for examle from HELP
432
+ $keys = $button->getKeys();
433
+
434
+ $masterData = false;
435
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
436
+ {
437
+ $masterData = $params['masterData'];
438
+ }
439
+ else if ( isset($params["masterTable"]) )
440
+ {
441
+ $masterData = $button->getMasterData($params["masterTable"]);
442
+ }
443
+
444
+ $contextParams = array();
445
+ if ( $params["location"] == PAGE_VIEW )
446
+ {
447
+ $contextParams["data"] = $button->getRecordData();
448
+ $contextParams["masterData"] = $masterData;
449
+ }
450
+ else if ( $params["location"] == PAGE_EDIT )
451
+ {
452
+ $contextParams["data"] = $button->getRecordData();
453
+ $contextParams["newData"] = $params['fieldsData'];
454
+ $contextParams["masterData"] = $masterData;
455
+ }
456
+ else if ( $params["location"] == "grid" )
457
+ {
458
+ $params["location"] = "list";
459
+ $contextParams["data"] = $button->getRecordData();
460
+ $contextParams["newData"] = $params['fieldsData'];
461
+ $contextParams["masterData"] = $masterData;
462
+ }
463
+ else
464
+ {
465
+ $contextParams["masterData"] = $masterData;
466
+ }
467
+
468
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
469
+ ;
470
+ RunnerContext::pop();
471
+ echo my_json_encode($result);
472
+ $button->deleteTempFiles();
473
+ }
474
+ function buttonHandler_New_Button1($params)
475
+ {
476
+ global $strTableName;
477
+ $result = array();
478
+
479
+ // create new button object for get record data
480
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
481
+ $params["isManyKeys"] = postvalue('isManyKeys');
482
+ $params["location"] = postvalue('location');
483
+
484
+ $button = new Button($params);
485
+ $ajax = $button; // for examle from HELP
486
+ $keys = $button->getKeys();
487
+
488
+ $masterData = false;
489
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
490
+ {
491
+ $masterData = $params['masterData'];
492
+ }
493
+ else if ( isset($params["masterTable"]) )
494
+ {
495
+ $masterData = $button->getMasterData($params["masterTable"]);
496
+ }
497
+
498
+ $contextParams = array();
499
+ if ( $params["location"] == PAGE_VIEW )
500
+ {
501
+ $contextParams["data"] = $button->getRecordData();
502
+ $contextParams["masterData"] = $masterData;
503
+ }
504
+ else if ( $params["location"] == PAGE_EDIT )
505
+ {
506
+ $contextParams["data"] = $button->getRecordData();
507
+ $contextParams["newData"] = $params['fieldsData'];
508
+ $contextParams["masterData"] = $masterData;
509
+ }
510
+ else if ( $params["location"] == "grid" )
511
+ {
512
+ $params["location"] = "list";
513
+ $contextParams["data"] = $button->getRecordData();
514
+ $contextParams["newData"] = $params['fieldsData'];
515
+ $contextParams["masterData"] = $masterData;
516
+ }
517
+ else
518
+ {
519
+ $contextParams["masterData"] = $masterData;
520
+ }
521
+
522
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
523
+ // Put your code here.
524
+ $result["txt"] = $params["txt"]." world!";
525
+ ;
526
+ RunnerContext::pop();
527
+ echo my_json_encode($result);
528
+ $button->deleteTempFiles();
529
+ }
530
+ function buttonHandler_Audio($params)
531
+ {
532
+ global $strTableName;
533
+ $result = array();
534
+
535
+ // create new button object for get record data
536
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
537
+ $params["isManyKeys"] = postvalue('isManyKeys');
538
+ $params["location"] = postvalue('location');
539
+
540
+ $button = new Button($params);
541
+ $ajax = $button; // for examle from HELP
542
+ $keys = $button->getKeys();
543
+
544
+ $masterData = false;
545
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
546
+ {
547
+ $masterData = $params['masterData'];
548
+ }
549
+ else if ( isset($params["masterTable"]) )
550
+ {
551
+ $masterData = $button->getMasterData($params["masterTable"]);
552
+ }
553
+
554
+ $contextParams = array();
555
+ if ( $params["location"] == PAGE_VIEW )
556
+ {
557
+ $contextParams["data"] = $button->getRecordData();
558
+ $contextParams["masterData"] = $masterData;
559
+ }
560
+ else if ( $params["location"] == PAGE_EDIT )
561
+ {
562
+ $contextParams["data"] = $button->getRecordData();
563
+ $contextParams["newData"] = $params['fieldsData'];
564
+ $contextParams["masterData"] = $masterData;
565
+ }
566
+ else if ( $params["location"] == "grid" )
567
+ {
568
+ $params["location"] = "list";
569
+ $contextParams["data"] = $button->getRecordData();
570
+ $contextParams["newData"] = $params['fieldsData'];
571
+ $contextParams["masterData"] = $masterData;
572
+ }
573
+ else
574
+ {
575
+ $contextParams["masterData"] = $masterData;
576
+ }
577
+
578
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
579
+ // Put your code here.
580
+ $result["txt"] = $params["txt"]." world!";
581
+ ;
582
+ RunnerContext::pop();
583
+ echo my_json_encode($result);
584
+ $button->deleteTempFiles();
585
+ }
586
+ function buttonHandler_stopAudio($params)
587
+ {
588
+ global $strTableName;
589
+ $result = array();
590
+
591
+ // create new button object for get record data
592
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
593
+ $params["isManyKeys"] = postvalue('isManyKeys');
594
+ $params["location"] = postvalue('location');
595
+
596
+ $button = new Button($params);
597
+ $ajax = $button; // for examle from HELP
598
+ $keys = $button->getKeys();
599
+
600
+ $masterData = false;
601
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
602
+ {
603
+ $masterData = $params['masterData'];
604
+ }
605
+ else if ( isset($params["masterTable"]) )
606
+ {
607
+ $masterData = $button->getMasterData($params["masterTable"]);
608
+ }
609
+
610
+ $contextParams = array();
611
+ if ( $params["location"] == PAGE_VIEW )
612
+ {
613
+ $contextParams["data"] = $button->getRecordData();
614
+ $contextParams["masterData"] = $masterData;
615
+ }
616
+ else if ( $params["location"] == PAGE_EDIT )
617
+ {
618
+ $contextParams["data"] = $button->getRecordData();
619
+ $contextParams["newData"] = $params['fieldsData'];
620
+ $contextParams["masterData"] = $masterData;
621
+ }
622
+ else if ( $params["location"] == "grid" )
623
+ {
624
+ $params["location"] = "list";
625
+ $contextParams["data"] = $button->getRecordData();
626
+ $contextParams["newData"] = $params['fieldsData'];
627
+ $contextParams["masterData"] = $masterData;
628
+ }
629
+ else
630
+ {
631
+ $contextParams["masterData"] = $masterData;
632
+ }
633
+
634
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
635
+ // Put your code here.
636
+ $result["txt"] = $params["txt"]." world!";
637
+ ;
638
+ RunnerContext::pop();
639
+ echo my_json_encode($result);
640
+ $button->deleteTempFiles();
641
+ }
642
+ function buttonHandler_video_chat($params)
643
+ {
644
+ global $strTableName;
645
+ $result = array();
646
+
647
+ // create new button object for get record data
648
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
649
+ $params["isManyKeys"] = postvalue('isManyKeys');
650
+ $params["location"] = postvalue('location');
651
+
652
+ $button = new Button($params);
653
+ $ajax = $button; // for examle from HELP
654
+ $keys = $button->getKeys();
655
+
656
+ $masterData = false;
657
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
658
+ {
659
+ $masterData = $params['masterData'];
660
+ }
661
+ else if ( isset($params["masterTable"]) )
662
+ {
663
+ $masterData = $button->getMasterData($params["masterTable"]);
664
+ }
665
+
666
+ $contextParams = array();
667
+ if ( $params["location"] == PAGE_VIEW )
668
+ {
669
+ $contextParams["data"] = $button->getRecordData();
670
+ $contextParams["masterData"] = $masterData;
671
+ }
672
+ else if ( $params["location"] == PAGE_EDIT )
673
+ {
674
+ $contextParams["data"] = $button->getRecordData();
675
+ $contextParams["newData"] = $params['fieldsData'];
676
+ $contextParams["masterData"] = $masterData;
677
+ }
678
+ else if ( $params["location"] == "grid" )
679
+ {
680
+ $params["location"] = "list";
681
+ $contextParams["data"] = $button->getRecordData();
682
+ $contextParams["newData"] = $params['fieldsData'];
683
+ $contextParams["masterData"] = $masterData;
684
+ }
685
+ else
686
+ {
687
+ $contextParams["masterData"] = $masterData;
688
+ }
689
+
690
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
691
+ include_once("chat_functions.php");
692
+ global $loginKeyFields, $cDisplayNameField, $cUserNameField;
693
+ $result["message"] = "";
694
+ $rs = DB::Select("chat_history", array("isVideo"=>1,"ownerid"=>$userdata[$loginKeyFields[0]]));
695
+ if(!($data = $rs->fetchAssoc())){
696
+ if(!$cDisplayNameField)
697
+ $cDisplayNameField = $cUserNameField;
698
+ $userdata = Security::currentUserData();
699
+ $username = $userdata[$cDisplayNameField];
700
+ if(!$username)
701
+ $username = $userdata[$cUserNameField];
702
+ $t = explode(" ",this_microtime());
703
+ //--- create meeting
704
+ $values["name"] = "Video chat";
705
+ $values["schedule"] = date("Y-m-d H:i:s");
706
+ $values["password"] = "";
707
+
708
+ /*$rs = DB::Select("chat_settings");
709
+ $data = $rs->fetchAssoc();
710
+ $rs2 = DB::Select("chat_timezone", array("id"=>$data["timezone"]));
711
+ $data2 = $rs2->fetchAssoc();
712
+ $rctimezone = $data2["rc"];
713
+ $zoomtimezone = $data2["zoom"];*/
714
+
715
+ $rs = DB::Select("chat_settings");
716
+ $data = $rs->fetchAssoc();
717
+
718
+ $OAuoh = base64_encode($data["Z_APIKey"].":".$data["Z_APISecret"]);
719
+ $url = "https://zoom.us/oauth/token";
720
+ $headers = array("Authorization"=>" Basic ".$OAuoh, "Host"=>"zoom.us","Content-Type"=>"application/x-www-form-urlencoded");
721
+ $postFields = "grant_type=account_credentials&account_id=".$data["Z_Token"]."&redirect_uri=https://zoom.us";
722
+ $response = runner_http_request( $url, $postFields, "POST", $headers, true );
723
+ $arrresponse = my_json_decode($response["content"]);
724
+ if($arrresponse["message"]){
725
+ $result["message"] = $arrresponse["message"];
726
+ }
727
+ else{
728
+ $token = $arrresponse["access_token"];
729
+
730
+ $createAMeetingArray['topic'] = $values["name"];
731
+ $createAMeetingArray['agenda'] = "";
732
+ $dt = "";
733
+ if($values["schedule"]){
734
+ $datetime = date("Y-m-d\TH:i:s", strtotime($values["schedule"]));
735
+ $createAMeetingArray['type'] = 2;
736
+ $createAMeetingArray['start_time'] = $datetime;
737
+ $dt = date("m/d/Y H:i:s", strtotime($values["schedule"]));
738
+ }
739
+ else
740
+ $createAMeetingArray['type'] = 1;
741
+
742
+ //$createAMeetingArray['timezone'] = $zoomtimezone;
743
+ if($values["password"])
744
+ $createAMeetingArray['password'] = $values["password"];
745
+ else
746
+ $createAMeetingArray['password'] = "";
747
+ $createAMeetingArray['duration'] = 60;
748
+ $createAMeetingArray['settings'] = array(
749
+ 'join_before_host' => false,
750
+ 'host_video' => true,
751
+ 'participant_video' => true,
752
+ 'mute_upon_entry' => false,
753
+ 'enforce_login' => false,
754
+ 'alternative_hosts' => ""
755
+ );
756
+ if($data["saveInCloud"])
757
+ $createAMeetingArray['settings']['auto_recording'] = true;
758
+
759
+ $postFields = my_json_encode($createAMeetingArray);
760
+ $url = "https://api.zoom.us/v2/users/me/meetings";
761
+ $headers = array("authorization"=>" Bearer ".$token, "content-type"=>"application/json");
762
+ $response = runner_http_request( $url, $postFields, "POST", $headers, true );
763
+ $arrresponse = my_json_decode($response["content"]);
764
+ $result["createlink"] = "";
765
+ if($arrresponse["message"]){
766
+ $result["message"] = $arrresponse["message"];
767
+ }
768
+ else{
769
+ $values["createlink"] = $arrresponse["start_url"];
770
+ $values["joinlink"] = $arrresponse["join_url"];
771
+
772
+
773
+ $result["createlink"] = $values["createlink"];
774
+ DB::Insert("chat_history", array("messages"=>$values["joinlink"],"created"=>date("Y-m-d H:i:s",$t[1]).substr((string)$t[0],1,4),"isread"=>0,"targetid"=>$_SESSION["targetid"], "isVideo"=>1, "ownerid"=>$userdata[$loginKeyFields[0]]));
775
+ //DB::Insert("chat_history", array("messages"=>"<i>".$username." create video chat</i>","created"=>date("Y-m-d H:i:s",$t[1]).substr((string)$t[0],1,4),"isread"=>0,"targetid"=>$_SESSION["targetid"], "isVideo"=>0, "ownerid"=>$userdata[$loginKeyFields[0]]));
776
+ }
777
+ }
778
+ }
779
+
780
+ ;
781
+ RunnerContext::pop();
782
+ echo my_json_encode($result);
783
+ $button->deleteTempFiles();
784
+ }
785
+ function buttonHandler_clip($params)
786
+ {
787
+ global $strTableName;
788
+ $result = array();
789
+
790
+ // create new button object for get record data
791
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
792
+ $params["isManyKeys"] = postvalue('isManyKeys');
793
+ $params["location"] = postvalue('location');
794
+
795
+ $button = new Button($params);
796
+ $ajax = $button; // for examle from HELP
797
+ $keys = $button->getKeys();
798
+
799
+ $masterData = false;
800
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
801
+ {
802
+ $masterData = $params['masterData'];
803
+ }
804
+ else if ( isset($params["masterTable"]) )
805
+ {
806
+ $masterData = $button->getMasterData($params["masterTable"]);
807
+ }
808
+
809
+ $contextParams = array();
810
+ if ( $params["location"] == PAGE_VIEW )
811
+ {
812
+ $contextParams["data"] = $button->getRecordData();
813
+ $contextParams["masterData"] = $masterData;
814
+ }
815
+ else if ( $params["location"] == PAGE_EDIT )
816
+ {
817
+ $contextParams["data"] = $button->getRecordData();
818
+ $contextParams["newData"] = $params['fieldsData'];
819
+ $contextParams["masterData"] = $masterData;
820
+ }
821
+ else if ( $params["location"] == "grid" )
822
+ {
823
+ $params["location"] = "list";
824
+ $contextParams["data"] = $button->getRecordData();
825
+ $contextParams["newData"] = $params['fieldsData'];
826
+ $contextParams["masterData"] = $masterData;
827
+ }
828
+ else
829
+ {
830
+ $contextParams["masterData"] = $masterData;
831
+ }
832
+
833
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
834
+ ;
835
+ RunnerContext::pop();
836
+ echo my_json_encode($result);
837
+ $button->deleteTempFiles();
838
+ }
839
+ function buttonHandler_audiotest($params)
840
+ {
841
+ global $strTableName;
842
+ $result = array();
843
+
844
+ // create new button object for get record data
845
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
846
+ $params["isManyKeys"] = postvalue('isManyKeys');
847
+ $params["location"] = postvalue('location');
848
+
849
+ $button = new Button($params);
850
+ $ajax = $button; // for examle from HELP
851
+ $keys = $button->getKeys();
852
+
853
+ $masterData = false;
854
+ if ( isset($params['masterData']) && count($params['masterData']) > 0 )
855
+ {
856
+ $masterData = $params['masterData'];
857
+ }
858
+ else if ( isset($params["masterTable"]) )
859
+ {
860
+ $masterData = $button->getMasterData($params["masterTable"]);
861
+ }
862
+
863
+ $contextParams = array();
864
+ if ( $params["location"] == PAGE_VIEW )
865
+ {
866
+ $contextParams["data"] = $button->getRecordData();
867
+ $contextParams["masterData"] = $masterData;
868
+ }
869
+ else if ( $params["location"] == PAGE_EDIT )
870
+ {
871
+ $contextParams["data"] = $button->getRecordData();
872
+ $contextParams["newData"] = $params['fieldsData'];
873
+ $contextParams["masterData"] = $masterData;
874
+ }
875
+ else if ( $params["location"] == "grid" )
876
+ {
877
+ $params["location"] = "list";
878
+ $contextParams["data"] = $button->getRecordData();
879
+ $contextParams["newData"] = $params['fieldsData'];
880
+ $contextParams["masterData"] = $masterData;
881
+ }
882
+ else
883
+ {
884
+ $contextParams["masterData"] = $masterData;
885
+ }
886
+
887
+ RunnerContext::push( new RunnerContextItem( $params["location"], $contextParams));
888
+ // Put your code here.
889
+ $result["txt"] = $params["txt"]." world!";
890
+ ;
891
+ RunnerContext::pop();
892
+ echo my_json_encode($result);
893
+ $button->deleteTempFiles();
894
+ }
895
+
896
+
897
+
898
+ function fieldEventHandler_select_provider( $params )
899
+ {
900
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
901
+ $params["isManyKeys"] = false;
902
+ $params["location"] = postvalue('pageType');
903
+
904
+ $button = new Button($params);
905
+ $keys = $button->getKeys();
906
+ $ajax = $button; // for examle from HELP
907
+ $result = array();
908
+
909
+ $pageType = postvalue("pageType");
910
+ $fieldsData = my_json_decode( postvalue("fieldsData") );
911
+
912
+ $contextParams = array(
913
+ "data" => $fieldsData,
914
+ "masterData" => $_SESSION[ $masterTable . "_masterRecordData" ]
915
+ );
916
+
917
+ RunnerContext::push( new RunnerContextItem( CONTEXT_ROW, $contextParams ) );
918
+ ;
919
+ RunnerContext::pop();
920
+
921
+ echo my_json_encode( $result );
922
+ $button->deleteTempFiles();
923
+ }
924
+ function fieldEventHandler_check_video( $params )
925
+ {
926
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
927
+ $params["isManyKeys"] = false;
928
+ $params["location"] = postvalue('pageType');
929
+
930
+ $button = new Button($params);
931
+ $keys = $button->getKeys();
932
+ $ajax = $button; // for examle from HELP
933
+ $result = array();
934
+
935
+ $pageType = postvalue("pageType");
936
+ $fieldsData = my_json_decode( postvalue("fieldsData") );
937
+
938
+ $contextParams = array(
939
+ "data" => $fieldsData,
940
+ "masterData" => $_SESSION[ $masterTable . "_masterRecordData" ]
941
+ );
942
+
943
+ RunnerContext::push( new RunnerContextItem( CONTEXT_ROW, $contextParams ) );
944
+
945
+ // Sample:
946
+ $result["upper"] = strtoupper( $params["value"] );
947
+ ;
948
+ RunnerContext::pop();
949
+
950
+ echo my_json_encode( $result );
951
+ $button->deleteTempFiles();
952
+ }
953
+ function fieldEventHandler_tmp_file_event( $params )
954
+ {
955
+ $params["keys"] = (array)my_json_decode(postvalue('keys'));
956
+ $params["isManyKeys"] = false;
957
+ $params["location"] = postvalue('pageType');
958
+
959
+ $button = new Button($params);
960
+ $keys = $button->getKeys();
961
+ $ajax = $button; // for examle from HELP
962
+ $result = array();
963
+
964
+ $pageType = postvalue("pageType");
965
+ $fieldsData = my_json_decode( postvalue("fieldsData") );
966
+
967
+ $contextParams = array(
968
+ "data" => $fieldsData,
969
+ "masterData" => $_SESSION[ $masterTable . "_masterRecordData" ]
970
+ );
971
+
972
+ RunnerContext::push( new RunnerContextItem( CONTEXT_ROW, $contextParams ) );
973
+
974
+ // Sample:
975
+ $result["upper"] = strtoupper( $params["value"] );
976
+ ;
977
+ RunnerContext::pop();
978
+
979
+ echo my_json_encode( $result );
980
+ $button->deleteTempFiles();
981
+ }
982
+ ?>
php/callVideo.mp3 ADDED
Binary file (61.3 kB). View file
 
php/chat_files1_add.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+
4
+ require_once("include/dbcommon.php");
5
+ require_once("classes/searchclause.php");
6
+ require_once("include/chat_files1_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/addpage.php');
9
+ require_once('include/lookuplinks.php');
10
+
11
+ add_nocache_headers();
12
+
13
+ InitLookupLinks();
14
+
15
+ if( Security::hasLogin() ) {
16
+ if( !AddPage::processAddPageSecurity( $strTableName ) )
17
+ return;
18
+ }
19
+
20
+ AddPage::handleBrokenRequest();
21
+
22
+
23
+ $pageMode = AddPage::readAddModeFromRequest();
24
+
25
+ $xt = new Xtempl();
26
+
27
+ $id = postvalue_number("id");
28
+ $id = $id ? $id : 1;
29
+
30
+ //an array of AddPage constructor's params
31
+ $params = array();
32
+ $params["id"] = $id;
33
+ $params["xt"] = &$xt;
34
+ $params["mode"] = $pageMode;
35
+ $params["pageType"] = PAGE_ADD;
36
+ $params["tName"] = $strTableName;
37
+ $params["pageName"] = postvalue("page");
38
+ $params["action"] = postvalue("a");
39
+ $params["needSearchClauseObj"] = false;
40
+ $params["afterAdd_id"] = postvalue("afteradd");
41
+
42
+ $params["hostPageName"] = postvalue("hostPageName");
43
+ $params["listPage"] = postvalue("listPage");
44
+
45
+ $params["newRowId"] = postvalue("newRowId");
46
+
47
+ $params["masterTable"] = postvalue("mastertable");
48
+ if( $params["masterTable"] )
49
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
50
+
51
+
52
+
53
+ ;
54
+ $params["captchaName"] = "captcha_1209xre";
55
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
56
+ $params["dashElementName"] = postvalue("dashelement");
57
+ $params["fromDashboard"] = postvalue("fromDashboard");
58
+ $params["dashTName"] = $params["fromDashboard"] ? $params["fromDashboard"] : postvalue("dashTName");
59
+ $params["dashPage"] = postvalue("dashPage");
60
+
61
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
62
+
63
+ if ( $pageMode == ADD_POPUP ) {
64
+ $params["forListPageLookup"] = postvalue('forLookup');
65
+ }
66
+
67
+ if( $pageMode == ADD_DASHBOARD )
68
+ {
69
+ $params["dashElementName"] = postvalue("dashelement");
70
+ $params["dashTName"] = postvalue("table");
71
+ $params["dashPage"] = postvalue("dashPage");
72
+ }
73
+
74
+
75
+ if( $pageMode == ADD_INLINE )
76
+ {
77
+ // Inline add in a 'List page with search' lookup
78
+ $params["forListPageLookup"] = postvalue('forLookup');
79
+
80
+ $params["screenWidth"] = postvalue("screenWidth");
81
+ $params["screenHeight"] = postvalue("screenHeight");
82
+ $params["orientation"] = postvalue("orientation");
83
+
84
+ $params["masterPageType"] = postvalue("masterpagetype");
85
+ }
86
+
87
+
88
+ if( $pageMode == ADD_ONTHEFLY || ( $pageMode == ADD_INLINE || $pageMode == ADD_POPUP ) && postvalue('forLookup') )
89
+ {
90
+ //table where lookup is set
91
+ $params["lookupTable"] = postvalue("table");
92
+ //field with lookup is set
93
+ $params["lookupField"] = postvalue("field");
94
+ //the ptype od the page where lookup is set
95
+ $params["lookupPageType"] = postvalue("pageType");
96
+
97
+ if( postvalue('parentsExist') )
98
+ {
99
+ //the parent controls values data
100
+ $params["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
101
+ }
102
+ }
103
+
104
+ $pageObject = new AddPage($params);
105
+ $pageObject->init();
106
+
107
+ $pageObject->process();
108
+ ?>
php/chat_files1_edit.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ @ini_set("display_errors","1");
4
+ @ini_set("display_startup_errors","1");
5
+
6
+ require_once("include/dbcommon.php");
7
+ require_once("classes/searchclause.php");
8
+ require_once("include/chat_files1_variables.php");
9
+ require_once('include/xtempl.php');
10
+ require_once('classes/editpage.php');
11
+
12
+ add_nocache_headers();
13
+
14
+ if( Security::hasLogin() ) {
15
+ if( !EditPage::processEditPageSecurity( $strTableName ) )
16
+ return;
17
+ }
18
+
19
+ EditPage::handleBrokenRequest();
20
+
21
+ // render all necessary layouts
22
+
23
+
24
+ // parse control parameters
25
+ $pageMode = EditPage::readEditModeFromRequest();
26
+
27
+ $xt = new Xtempl();
28
+
29
+ $id = postvalue_number("id");
30
+ $id = intval($id) == 0 ? 1 : $id;
31
+
32
+
33
+ // $keys could not be set properly if editid params were no passed
34
+ $keys = array();
35
+ $keys["id"] = postvalue("editid1");
36
+
37
+ //array of params for classes
38
+ $params = array();
39
+ $params["id"] = $id;
40
+ $params["xt"] = &$xt;
41
+ $params["keys"] = $keys;
42
+ $params["mode"] = $pageMode;
43
+ $params["pageType"] = PAGE_EDIT;
44
+ $params["pageName"] = postvalue("page");
45
+ $params["tName"] = $strTableName;
46
+ $params["action"] = postvalue("a");
47
+ $params["selectedFields"] = postvalue("fields");
48
+
49
+ ;
50
+ $params["captchaName"] = "captcha_1209xre";
51
+ $params["captchaValue"] = postvalue("value_captcha_1209xre_" . $id);
52
+ $params["selection"] = postvalue("selection");
53
+ $params["rowIds"] = my_json_decode( postvalue("rowIds") );
54
+
55
+ $params["masterTable"] = postvalue("mastertable");
56
+ if( $params["masterTable"] )
57
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
58
+
59
+ // locking parameters
60
+ $params["lockingAction"] = postvalue("action");
61
+ $params["lockingSid"] = postvalue("sid");
62
+ $params["lockingKeys"] = postvalue("keys");
63
+ $params["lockingStart"] = postvalue("startEdit");
64
+
65
+ if( $pageMode == EDIT_INLINE )
66
+ {
67
+ $params["screenWidth"] = postvalue("screenWidth");
68
+ $params["screenHeight"] = postvalue("screenHeight");
69
+ $params["orientation"] = postvalue("orientation");
70
+ }
71
+
72
+ if( $pageMode == EDIT_DASHBOARD )
73
+ {
74
+ $params["dashElementName"] = postvalue("dashelement");
75
+ $params["dashTName"] = postvalue("table");
76
+ $params["dashPage"] = postvalue("dashPage");
77
+
78
+ if( postvalue("mapRefresh") )
79
+ {
80
+ $params["mapRefresh"] = true;
81
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
82
+ }
83
+ }
84
+
85
+ if(( $pageMode == EDIT_POPUP || $pageMode == EDIT_INLINE ) && postvalue("dashTName"))
86
+ {
87
+ $params["dashTName"] = postvalue("dashTName");
88
+ $params["dashElementName"] = postvalue("dashelement");
89
+ $params["dashPage"] = postvalue("dashPage");
90
+ }
91
+
92
+ $params["forSpreadsheetGrid"] = postvalue("spreadsheetGrid");
93
+ $params["hostPageName"] = postvalue("hostPageName");
94
+ $params["listPage"] = postvalue("listPage");
95
+
96
+ $pageObject = EditPage::EditPageFactory($params);
97
+
98
+ if( $pageObject->isLockingRequest() )
99
+ {
100
+ $pageObject->doLockingAction();
101
+ exit();
102
+ }
103
+
104
+ $pageObject->init();
105
+
106
+ $pageObject->process();
107
+ ?>
php/chat_files1_export.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ require_once("classes/searchclause.php");
8
+ require_once("classes/sql.php");
9
+
10
+ require_once("include/chat_files1_variables.php");
11
+
12
+ if( Security::hasLogin() ) {
13
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
14
+ return;
15
+ }
16
+
17
+
18
+ require_once("include/export_functions.php");
19
+ require_once("classes/exportpage.php");
20
+ require_once("include/xtempl.php");
21
+
22
+ $xt = new Xtempl();
23
+
24
+ //array of params for classes
25
+ $params = array();
26
+ $params["id"] = postvalue_number("id");
27
+ $params["xt"] = &$xt;
28
+ $params["tName"] = $strTableName;
29
+ $params["pageType"] = PAGE_EXPORT;
30
+ $params["pageName"] = postvalue("page");
31
+
32
+ $params["selectedFields"] = postvalue("exportFields");
33
+ $params["exportType"] = postvalue("type");
34
+
35
+ $params["allPagesMode"] = postvalue("records") == "all";
36
+ $params["currentPageMode"] = postvalue("records") == "page";
37
+ $params["selection"] = postvalue("selection");
38
+ $params["csvDelimiter"] = postvalue("delimiter");
39
+
40
+ if( postvalue("txtformatting") == "raw" )
41
+ $params["useRawValues"] = true;
42
+
43
+ $params["mode"] = ExportPage::readModeFromRequest();
44
+
45
+ $params["masterTable"] = postvalue("mastertable");
46
+ if( $params["masterTable"] )
47
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
48
+
49
+ $pageObject = new ExportPage( $params );
50
+ $pageObject->init();
51
+
52
+ $pageObject->process();
53
+ ?>
php/chat_files1_import.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+ require_once("include/dbcommon.php");
5
+ header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
6
+
7
+ set_time_limit(600);
8
+
9
+ require_once("include/chat_files1_variables.php");
10
+ require_once("include/import_functions.php");
11
+ require_once('classes/importpage.php');
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !Security::processPageSecurity( $strtablename, 'I' ) )
15
+ return;
16
+ }
17
+
18
+
19
+ require_once('include/xtempl.php');
20
+ $xt = new Xtempl();
21
+
22
+ //an array of params for ImportPage constructor
23
+ $params = array();
24
+ $params["id"] = postvalue_number("id");
25
+ $params["xt"] = &$xt;
26
+ $params["tName"] = $strTableName;
27
+ $params["action"] = postvalue("a");
28
+ $params["pageType"] = PAGE_IMPORT;
29
+ $params["pageName"] = postvalue("page");
30
+ $params["needSearchClauseObj"] = false;
31
+ $params["strOriginalTableName"] = $strOriginalTableName;
32
+
33
+ if( $params["action"] == "importPreview" )
34
+ {
35
+ $params["importType"] = postvalue("importType");
36
+ $params["importText"] = postvalue("importText");
37
+ $params["useXHR"] = postvalue("useXHR");
38
+ }
39
+ elseif( $params["action"] == "importData" )
40
+ {
41
+ $params["importData"] = my_json_decode( postvalue("importData") );
42
+ }
43
+
44
+ $params["masterTable"] = postvalue("mastertable");
45
+ if( $params["masterTable"] )
46
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
47
+
48
+ $pageObject = new ImportPage($params);
49
+ $pageObject->init();
50
+
51
+ $pageObject->process();
52
+
53
+ ?>
php/chat_files1_list.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ $requestTable = "public.chat_files";
6
+ $requestPage = "list";
7
+
8
+ require_once("include/dbcommon.php");
9
+ add_nocache_headers();
10
+
11
+ require_once('include/xtempl.php');
12
+
13
+ require_once("classes/searchcontrol.php");
14
+ require_once("classes/searchclause.php");
15
+ require_once("classes/panelsearchcontrol.php");
16
+ require_once("include/chat_files1_variables.php");
17
+ require_once('classes/listpage.php');
18
+ require_once('include/lookuplinks.php');
19
+
20
+ // Check whether the page was called as a part of Lookup wizard - List page with search.
21
+ // Verify the eligibility of such a call.
22
+
23
+ InitLookupLinks();
24
+ if( Security::hasLogin() ) {
25
+ if( !ListPage::processListPageSecurity( $strTableName ) )
26
+ return;
27
+ }
28
+
29
+ if( ListPage::processSaveParams( $strTableName ) )
30
+ return;
31
+
32
+ $options = array();
33
+ //array of params for classes
34
+
35
+ // Include necessary files in accordance with the page displaying mode
36
+ $mode = ListPage::readListModeFromRequest();
37
+ if( $mode == LIST_SIMPLE )
38
+ {
39
+ require_once('classes/listpage_simple.php');
40
+ require_once("classes/searchpanelsimple.php");
41
+ }
42
+ elseif( $mode == LIST_AJAX )
43
+ {
44
+ require_once('classes/listpage_simple.php');
45
+ require_once('classes/listpage_ajax.php');
46
+ require_once("classes/searchpanelsimple.php");
47
+ }
48
+ elseif( $mode == LIST_LOOKUP )
49
+ {
50
+ require_once('classes/listpage_embed.php');
51
+ require_once('classes/listpage_lookup.php');
52
+
53
+ $options["mainTable"] = postvalue("table");
54
+ $options["mainField"] = postvalue("field");
55
+ $options["mainPageType"] = postvalue("pageType");
56
+
57
+ $options["mainRecordData"] = my_json_decode( postvalue('data') );
58
+ $options["mainRecordMasterTable"] = postvalue('mainRecordMasterTable');
59
+
60
+ if( postvalue("parentsExist") )
61
+ $options["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
62
+ }
63
+ elseif( $mode == LIST_POPUPDETAILS )
64
+ {
65
+ require_once('classes/listpage_embed.php');
66
+ require_once('classes/listpage_dpinline.php');
67
+ require_once('classes/listpage_dppopup.php');
68
+ }
69
+ elseif( $mode == LIST_DETAILS )
70
+ {
71
+ require_once('classes/listpage_embed.php');
72
+ require_once('classes/listpage_dpinline.php');
73
+ require_once('classes/listpage_dplist.php');
74
+ }
75
+ elseif( $mode == LIST_DASHDETAILS )
76
+ {
77
+ require_once('classes/listpage_embed.php');
78
+ require_once('classes/listpage_dashboard.php');
79
+ require_once('classes/listpage_dpdash.php');
80
+ }
81
+ elseif( $mode == LIST_DASHBOARD )
82
+ {
83
+ require_once('classes/listpage_embed.php');
84
+ require_once('classes/listpage_dashboard.php');
85
+ }
86
+ elseif( $mode == MAP_DASHBOARD )
87
+ {
88
+ require_once('classes/listpage_embed.php');
89
+ require_once('classes/listpage_dashboard.php');
90
+ require_once('classes/map_dashboard.php');
91
+ }
92
+
93
+ $xt = new Xtempl( $mode != LIST_SIMPLE ); //#9607 1. Temporary fix
94
+
95
+ $options["pageName"] = postvalue("page");
96
+ $options["pageType"] = PAGE_LIST;
97
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
98
+ $options["flyId"] = (int)postvalue("recordId");
99
+ $options["mode"] = $mode;
100
+ $options["xt"] = &$xt;
101
+ $options["firstTime"] = postvalue("firstTime");
102
+ $options["sortBy"] = postvalue("sortby");
103
+ $options["requestGoto"] = postvalue_number("goto");
104
+
105
+
106
+ $options["masterPageType"] = postvalue("masterpagetype");
107
+ $options["masterPage"] = postvalue("masterpage");
108
+ $options["masterId"] = postvalue("masterid");
109
+
110
+ $options["masterTable"] = postvalue("mastertable");
111
+ if( $options["masterTable"] )
112
+ $options["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
113
+
114
+
115
+ if( $mode == LIST_DASHBOARD && postvalue("nodata") && strlen($options["masterTable"]) )
116
+ $options["showNoData"] = true;
117
+
118
+ if( $mode != LIST_LOOKUP )
119
+ {
120
+ $options["dashElementName"] = postvalue("dashelement");
121
+ $options["dashTName"] = postvalue("table");
122
+ $options["dashPage"] = postvalue("dashPage");
123
+ }
124
+
125
+ if( postvalue("mapRefresh") )
126
+ {
127
+ $options["mapRefresh"] = true;
128
+ $options["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
129
+ }
130
+
131
+ if( postvalue("firstTime") )
132
+ $options["firstTime"] = true;
133
+
134
+ // Create $pageObject
135
+ $pageObject = ListPage::createListPage($strTableName, $options);
136
+
137
+ if( $pageObject->processSaveSearch() )
138
+ exit();
139
+
140
+ if( $pageObject->updateRowOrder() )
141
+ exit();
142
+
143
+ if ( $pageObject->processFieldFilter() )
144
+ exit();
145
+
146
+ if( $pageObject->processTotals() )
147
+ exit();
148
+
149
+ if( $mode != LIST_DETAILS && $mode != MAP_DASHBOARD && $mode != LIST_DASHBOARD )
150
+ {
151
+ //maps
152
+ }
153
+
154
+ unset($_SESSION["message_add"]);
155
+ unset($_SESSION["message_edit"]);
156
+
157
+ // prepare code for build page
158
+ $pageObject->prepareForBuildPage();
159
+
160
+ // show page depends of mode
161
+ $pageObject->showPage();
162
+
163
+ ?>
php/chat_files1_print.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("classes/searchclause.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/printpage.php');
9
+ require_once('classes/printpage_details.php');
10
+ require_once('classes/reportpage.php');
11
+ require_once('classes/reportprintpage.php');
12
+
13
+ add_nocache_headers();
14
+
15
+ require_once("include/chat_files1_variables.php");
16
+
17
+ if( Security::hasLogin() ) {
18
+ if( !Security::processPageSecurity( $strtablename, 'P' ) )
19
+ return;
20
+ }
21
+
22
+
23
+ $xt = new Xtempl();
24
+
25
+ //array of params for classes
26
+ $params = array();
27
+ $params["id"] = postvalue_number("id");
28
+ $params["xt"] = &$xt;
29
+ $params["pageType"] = PAGE_PRINT;
30
+ $params["pageName"] = postvalue("page");
31
+ $params["tName"] = $strTableName;
32
+ $params["selection"] = postvalue("selection"); //PrintPage::readSelectedRecordsFromRequest( "public.chat_files" );
33
+ $params["allPagesMode"] = postvalue("all");
34
+ $params["detailTables"] = postvalue("details");
35
+ $params["splitByRecords"] = postvalue("records");
36
+ $params["mode"] = postvalue( "pdfjson" ) ? PRINT_PDFJSON : PRINT_SIMPLE;
37
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
38
+
39
+ $params["masterTable"] = postvalue("mastertable");
40
+ if( $params["masterTable"] )
41
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
42
+
43
+ $pageObject = new PrintPage($params);
44
+ $pageObject->init();
45
+ $pageObject->process();
46
+ ?>
php/chat_files1_search.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ add_nocache_headers();
7
+
8
+ require_once("classes/searchclause.php");
9
+ require_once("include/chat_files1_variables.php");
10
+ require_once("classes/searchcontrol.php");
11
+ require_once("classes/advancedsearchcontrol.php");
12
+ require_once("classes/panelsearchcontrol.php");
13
+
14
+
15
+ Security::processLogoutRequest();
16
+
17
+ if( !isLogged() )
18
+ {
19
+ Security::saveRedirectURL();
20
+ redirectToLogin();
21
+ }
22
+
23
+ require_once( "include/reportfunctions.php" );
24
+ $cname = postvalue("cname");
25
+ $rname = postvalue("rname");
26
+ if( $rname || $cname ) {
27
+ $rpt_array = wrGetEntityArray(
28
+ $rname ? $rname : $cname,
29
+ $rname ? WR_REPORT : WR_CHART
30
+ );
31
+ $accessGranted = @$rpt_array['status'] != "private" || @$rpt_array['owner'] != Security::getUserName();
32
+ } else {
33
+ $accessGranted = CheckTablePermissions( $strTableName, "S" );
34
+ }
35
+ if(!$accessGranted)
36
+ {
37
+ HeaderRedirect("menu");
38
+ }
39
+
40
+
41
+ require_once('include/xtempl.php');
42
+ require_once('classes/searchpage.php');
43
+ require_once('classes/searchpage_dash.php');
44
+
45
+ $xt = new Xtempl();
46
+ $pageMode = SearchPage::readSearchModeFromRequest();
47
+
48
+ if( $pageMode == SEARCH_LOAD_CONTROL )
49
+ $layoutVersion = postvalue("layoutVersion");
50
+
51
+
52
+ $params = array();
53
+ $params['xt'] = &$xt;
54
+ $params['id'] = postvalue_number("id");
55
+ $params['mode'] = $pageMode;
56
+ $params['tName'] = $strTableName;
57
+ $params["pageName"] = postvalue("page");
58
+ $params['pageType'] = PAGE_SEARCH;
59
+ $params['chartName'] = $cname;
60
+ $params['reportName'] = $rname;
61
+ $params['templatefile'] = $templatefile;
62
+ $params['shortTableName'] = 'chat_files1';
63
+ $params['layoutVersion'] = $layoutVersion;
64
+
65
+ $params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
66
+ $params['ctrlField'] = postvalue('ctrlField');
67
+
68
+ $params['needSettings'] = postvalue('isNeedSettings');
69
+
70
+ if( $pageMode == SEARCH_DASHBOARD )
71
+ {
72
+ $params["dashTName"] = postvalue("table");
73
+ $params["dashElementName"] = postvalue("dashelement");
74
+ $params["dashPage"] = postvalue("dashPage");
75
+ }
76
+
77
+ // e.g. crosstable params
78
+ $params["extraPageParams"] = SearchPage::getExtraPageParams();
79
+
80
+ $params["masterTable"] = postvalue("mastertable");
81
+ if( $params["masterTable"] )
82
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
83
+
84
+
85
+ $pageObject = new SearchPage($params);
86
+
87
+ if( $pageMode == SEARCH_LOAD_CONTROL )
88
+ {
89
+ $pageObject->displaySearchControl();
90
+ return;
91
+ }
92
+
93
+ $pageObject->init();
94
+ $pageObject->process();
95
+ ?>
php/chat_files1_view.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ require_once("include/dbcommon.php");
6
+ require_once("include/chat_files1_variables.php");
7
+ require_once('include/xtempl.php');
8
+ require_once('classes/viewpage.php');
9
+ require_once("classes/searchclause.php");
10
+
11
+ add_nocache_headers();
12
+
13
+ if( Security::hasLogin() ) {
14
+ if( !ViewPage::processEditPageSecurity( $strTableName ) )
15
+ return;
16
+ }
17
+
18
+ $pageMode = ViewPage::readViewModeFromRequest();
19
+
20
+ $xt = new Xtempl();
21
+
22
+ // $keys could not be set properly if editid params were no passed
23
+ $keys = array();
24
+ $keys["id"] = postvalue("editid1");
25
+
26
+ //array of params for classes
27
+ $params = array();
28
+ $params["id"] = postvalue_number("id");
29
+ $params["xt"] = &$xt;
30
+ $params["keys"] = $keys;
31
+ $params["mode"] = $pageMode;
32
+ $params["pageType"] = PAGE_VIEW;
33
+ $params["pageName"] = postvalue("page");
34
+ $params["tName"] = $strTableName;
35
+
36
+ $params["pdfMode"] = postvalue("pdf") !== "";
37
+
38
+ $params["masterTable"] = postvalue("mastertable");
39
+ if( $params["masterTable"] )
40
+ $params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
41
+
42
+ if( $pageMode == VIEW_DASHBOARD )
43
+ {
44
+ $params["dashElementName"] = postvalue("dashelement");
45
+ $params["dashTName"] = postvalue("table");
46
+ $params["dashPage"] = postvalue("dashPage");
47
+ if( postvalue("mapRefresh") )
48
+ {
49
+ $params["mapRefresh"] = true;
50
+ $params["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
51
+ }
52
+ }
53
+ if( $pageMode == VIEW_POPUP )
54
+ {
55
+ $params["dashElementName"] = postvalue("dashelement");
56
+ $params["dashTName"] = postvalue("dashTName");
57
+ $params["dashPage"] = postvalue("dashPage");
58
+ }
59
+
60
+ $params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");
61
+
62
+ $pageObject = new ViewPage($params);
63
+ $pageObject->init();
64
+
65
+ $pageObject->process();
66
+
67
+ ?>
php/chat_files_list.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ @ini_set("display_errors","1");
3
+ @ini_set("display_startup_errors","1");
4
+
5
+ $requestTable = "chat_files";
6
+ $requestPage = "list";
7
+
8
+ require_once("include/dbcommon.php");
9
+ add_nocache_headers();
10
+
11
+ require_once('include/xtempl.php');
12
+
13
+ require_once("classes/searchcontrol.php");
14
+ require_once("classes/searchclause.php");
15
+ require_once("classes/panelsearchcontrol.php");
16
+ require_once("include/chat_files_variables.php");
17
+ require_once('classes/listpage.php');
18
+ require_once('include/lookuplinks.php');
19
+
20
+ // Check whether the page was called as a part of Lookup wizard - List page with search.
21
+ // Verify the eligibility of such a call.
22
+
23
+ InitLookupLinks();
24
+ if( Security::hasLogin() ) {
25
+ if( !ListPage::processListPageSecurity( $strTableName ) )
26
+ return;
27
+ }
28
+
29
+ if( ListPage::processSaveParams( $strTableName ) )
30
+ return;
31
+
32
+ $options = array();
33
+ //array of params for classes
34
+
35
+ // Include necessary files in accordance with the page displaying mode
36
+ $mode = ListPage::readListModeFromRequest();
37
+ if( $mode == LIST_SIMPLE )
38
+ {
39
+ require_once('classes/listpage_simple.php');
40
+ require_once("classes/searchpanelsimple.php");
41
+ }
42
+ elseif( $mode == LIST_AJAX )
43
+ {
44
+ require_once('classes/listpage_simple.php');
45
+ require_once('classes/listpage_ajax.php');
46
+ require_once("classes/searchpanelsimple.php");
47
+ }
48
+ elseif( $mode == LIST_LOOKUP )
49
+ {
50
+ require_once('classes/listpage_embed.php');
51
+ require_once('classes/listpage_lookup.php');
52
+
53
+ $options["mainTable"] = postvalue("table");
54
+ $options["mainField"] = postvalue("field");
55
+ $options["mainPageType"] = postvalue("pageType");
56
+
57
+ $options["mainRecordData"] = my_json_decode( postvalue('data') );
58
+ $options["mainRecordMasterTable"] = postvalue('mainRecordMasterTable');
59
+
60
+ if( postvalue("parentsExist") )
61
+ $options["parentCtrlsData"] = my_json_decode( postvalue("parentCtrlsData") );
62
+ }
63
+ elseif( $mode == LIST_POPUPDETAILS )
64
+ {
65
+ require_once('classes/listpage_embed.php');
66
+ require_once('classes/listpage_dpinline.php');
67
+ require_once('classes/listpage_dppopup.php');
68
+ }
69
+ elseif( $mode == LIST_DETAILS )
70
+ {
71
+ require_once('classes/listpage_embed.php');
72
+ require_once('classes/listpage_dpinline.php');
73
+ require_once('classes/listpage_dplist.php');
74
+ }
75
+ elseif( $mode == LIST_DASHDETAILS )
76
+ {
77
+ require_once('classes/listpage_embed.php');
78
+ require_once('classes/listpage_dashboard.php');
79
+ require_once('classes/listpage_dpdash.php');
80
+ }
81
+ elseif( $mode == LIST_DASHBOARD )
82
+ {
83
+ require_once('classes/listpage_embed.php');
84
+ require_once('classes/listpage_dashboard.php');
85
+ }
86
+ elseif( $mode == MAP_DASHBOARD )
87
+ {
88
+ require_once('classes/listpage_embed.php');
89
+ require_once('classes/listpage_dashboard.php');
90
+ require_once('classes/map_dashboard.php');
91
+ }
92
+
93
+ $xt = new Xtempl( $mode != LIST_SIMPLE ); //#9607 1. Temporary fix
94
+
95
+ $options["pageName"] = postvalue("page");
96
+ $options["pageType"] = PAGE_LIST;
97
+ $options["id"] = postvalue_number("id") ? postvalue_number("id") : 1;
98
+ $options["flyId"] = (int)postvalue("recordId");
99
+ $options["mode"] = $mode;
100
+ $options["xt"] = &$xt;
101
+ $options["firstTime"] = postvalue("firstTime");
102
+ $options["sortBy"] = postvalue("sortby");
103
+ $options["requestGoto"] = postvalue_number("goto");
104
+
105
+
106
+ $options["masterPageType"] = postvalue("masterpagetype");
107
+ $options["masterPage"] = postvalue("masterpage");
108
+ $options["masterId"] = postvalue("masterid");
109
+
110
+ $options["masterTable"] = postvalue("mastertable");
111
+ if( $options["masterTable"] )
112
+ $options["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();
113
+
114
+
115
+ if( $mode == LIST_DASHBOARD && postvalue("nodata") && strlen($options["masterTable"]) )
116
+ $options["showNoData"] = true;
117
+
118
+ if( $mode != LIST_LOOKUP )
119
+ {
120
+ $options["dashElementName"] = postvalue("dashelement");
121
+ $options["dashTName"] = postvalue("table");
122
+ $options["dashPage"] = postvalue("dashPage");
123
+ }
124
+
125
+ if( postvalue("mapRefresh") )
126
+ {
127
+ $options["mapRefresh"] = true;
128
+ $options["vpCoordinates"] = my_json_decode( postvalue("vpCoordinates") );
129
+ }
130
+
131
+ if( postvalue("firstTime") )
132
+ $options["firstTime"] = true;
133
+
134
+ // Create $pageObject
135
+ $pageObject = ListPage::createListPage($strTableName, $options);
136
+
137
+ if( $pageObject->processSaveSearch() )
138
+ exit();
139
+
140
+ if( $pageObject->updateRowOrder() )
141
+ exit();
142
+
143
+ if ( $pageObject->processFieldFilter() )
144
+ exit();
145
+
146
+ if( $pageObject->processTotals() )
147
+ exit();
148
+
149
+ if( $mode != LIST_DETAILS && $mode != MAP_DASHBOARD && $mode != LIST_DASHBOARD )
150
+ {
151
+ //maps
152
+ }
153
+
154
+ unset($_SESSION["message_add"]);
155
+ unset($_SESSION["message_edit"]);
156
+
157
+ // prepare code for build page
158
+ $pageObject->prepareForBuildPage();
159
+
160
+ // show page depends of mode
161
+ $pageObject->showPage();
162
+
163
+ ?>