home.php 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of Homogram.
  6. *
  7. * Homogram is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Homogram is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Homogram. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * Homogram home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $contextType = PUBLIC_CONTEXT_TYPE;
  28. $cmd = PHP_STR;
  29. $opt = PHP_STR;
  30. $param1 = PHP_STR;
  31. $param2 = PHP_STR;
  32. $param3 = PHP_STR;
  33. $curPicture = "";
  34. $prevPicture = "";
  35. $nextPicture = "";
  36. $curLocale = APP_LOCALE;
  37. function parseCommand() {
  38. global $command;
  39. global $cmd;
  40. global $opt;
  41. global $param1;
  42. global $param2;
  43. global $param3;
  44. $str = trim($command);
  45. $ipos = stripos($str, PHP_SPACE);
  46. if ($ipos > 0) {
  47. $cmd = left($str, $ipos);
  48. $str = substr($str, $ipos+1);
  49. } else {
  50. $cmd = $str;
  51. return;
  52. }
  53. if (left($str, 1) === "-") {
  54. $ipos = stripos($str, PHP_SPACE);
  55. if ($ipos > 0) {
  56. $opt = left($str, $ipos);
  57. $str = substr($str, $ipos+1);
  58. } else {
  59. $opt = $str;
  60. return;
  61. }
  62. }
  63. if (left($str, 1) === "'") {
  64. $ipos = stripos($str, "'", 1);
  65. if ($ipos > 0) {
  66. $param1 = substr($str, 0, $ipos+1);
  67. $str = substr($str, $ipos+1);
  68. } else {
  69. $param1 = $str;
  70. return;
  71. }
  72. } else {
  73. $ipos = stripos($str, PHP_SPACE);
  74. if ($ipos > 0) {
  75. $param1 = left($str, $ipos);
  76. $str = substr($str, $ipos+1);
  77. } else {
  78. $param1 = $str;
  79. return;
  80. }
  81. }
  82. $ipos = stripos($str, PHP_SPACE);
  83. if ($ipos > 0) {
  84. $param2 = left($str, $ipos);
  85. $str = substr($str, $ipos+1);
  86. } else {
  87. $param2 = $str;
  88. return;
  89. }
  90. $ipos = stripos($str, PHP_SPACE);
  91. if ($ipos > 0) {
  92. $param3 = left($str, $ipos);
  93. $str = substr($str, $ipos+1);
  94. } else {
  95. $param3 = $str;
  96. return;
  97. }
  98. }
  99. function is_subfolderdest(string $path): bool
  100. {
  101. global $curPath;
  102. $ret=false;
  103. if ($path === "../") {
  104. return $ret;
  105. }
  106. if ($path!=PHP_STR) {
  107. $folderName = left($path, strlen($path)-1);
  108. if (!is_word($folderName)) {
  109. return $ret;
  110. }
  111. if (is_dir($curPath . PHP_SLASH . $folderName) && (right($path,1)==="/")) {
  112. $ret=true;
  113. }
  114. }
  115. return $ret;
  116. }
  117. function privatifyparamValidation() {
  118. global $curPath;
  119. global $opt;
  120. global $param1;
  121. global $param2;
  122. global $param3;
  123. //opt!=""
  124. if ($opt!==PHP_STR) {
  125. echo("WARNING: invalid options<br>");
  126. return false;
  127. }
  128. //param1!="" and isword
  129. $test_param1 = trim($param1,"'");
  130. if (($test_param1===PHP_STR) || !is_word($test_param1)) {
  131. echo("WARNING: invalid image file<br>");
  132. return false;
  133. }
  134. //param2==""
  135. if ($param2!==PHP_STR) {
  136. echo("WARNING: invalid parameters<br>");
  137. return false;
  138. }
  139. //param3==""
  140. if ($param3!==PHP_STR) {
  141. echo("WARNING: invalid parameters<br>");
  142. return false;
  143. }
  144. //param1 exist
  145. $path = $curPath . DIRECTORY_SEPARATOR . $test_param1;
  146. if (!file_exists($path)) {
  147. echo("WARNING: file must exists<br>");
  148. return false;
  149. }
  150. //param1 is_file
  151. if (!is_file($path)) {
  152. echo("WARNING: invalid image file<br>");
  153. return false;
  154. }
  155. //param1 file extension == gif | png | jpg | jpeg
  156. if (!is_image($test_param1)) {
  157. echo("WARNING: invalid image file<br>");
  158. return false;
  159. }
  160. return true;
  161. }
  162. function myExecPrivatifyCommand() {
  163. global $param1;
  164. global $curPath;
  165. $privateData = [];
  166. $publicData = [];
  167. $real_param1 = trim($param1, "'");
  168. $curFile = substr($curPath, strlen(APP_REPO_PATH)) . DIRECTORY_SEPARATOR . $real_param1;
  169. //echo "curFile=$curFile";
  170. if (APP_DEFAULT_CONTEXT === "PUBLIC") {
  171. // Insert in .public
  172. $privateFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".private";
  173. //echo "curFile=$privateFile";
  174. if (file_exists($privateFile)) {
  175. $privateData = file($privateFile);
  176. }
  177. if (!in_array($curFile . "\n", $privateData)) {
  178. $privateData[] = $curFile . "\n";
  179. file_put_contents($privateFile, implode('', $privateData));
  180. }
  181. } else {
  182. // Cut off from .private
  183. $publicFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".public";
  184. //echo "curFile=$publicFile";
  185. if (file_exists($publicFile)) {
  186. $publicData = file($publicFile);
  187. }
  188. $key = array_search($curFile . "\n", $publicData);
  189. if ($key!==false) {
  190. unset($publicData[$key]);
  191. file_put_contents($publicFile, implode('', $publicData));
  192. }
  193. }
  194. }
  195. function publicifyparamValidation() {
  196. global $curPath;
  197. global $opt;
  198. global $param1;
  199. global $param2;
  200. global $param3;
  201. //opt!=""
  202. if ($opt!==PHP_STR) {
  203. echo("WARNING: invalid options<br>");
  204. return false;
  205. }
  206. //param1!="" and isword
  207. $test_param1 = trim($param1,"'");
  208. if (($test_param1===PHP_STR) || !is_word($test_param1)) {
  209. echo("WARNING: invalid image file<br>");
  210. return false;
  211. }
  212. //param2==""
  213. if ($param2!==PHP_STR) {
  214. echo("WARNING: invalid parameters<br>");
  215. return false;
  216. }
  217. //param3==""
  218. if ($param3!==PHP_STR) {
  219. echo("WARNING: invalid parameters<br>");
  220. return false;
  221. }
  222. //param1 exist
  223. $path = $curPath . DIRECTORY_SEPARATOR . $test_param1;
  224. if (!file_exists($path)) {
  225. echo("WARNING: file must exists<br>");
  226. return false;
  227. }
  228. //param1 is_file
  229. if (!is_file($path)) {
  230. echo("WARNING: invalid image file<br>");
  231. return false;
  232. }
  233. //param1 file extension == gif | png | jpg | jpeg
  234. if (!is_image($test_param1)) {
  235. echo("WARNING: invalid image file<br>");
  236. return false;
  237. }
  238. return true;
  239. }
  240. function myExecPublicifyCommand() {
  241. global $param1;
  242. global $curPath;
  243. $privateData = [];
  244. $publicData = [];
  245. $real_param1 = trim($param1, "'");
  246. $curFile = substr($curPath, strlen(APP_REPO_PATH)) . DIRECTORY_SEPARATOR . $real_param1;
  247. //echo "curFile=$curFile";
  248. if (APP_DEFAULT_CONTEXT === "PRIVATE") {
  249. // Insert in .public
  250. $publicFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".public";
  251. //echo "curFile=$publicFile";
  252. if (file_exists($publicFile)) {
  253. $publicData = file($publicFile);
  254. }
  255. if (!in_array($curFile . "\n", $publicData)) {
  256. $publicData[] = $curFile . "\n";
  257. file_put_contents($publicFile, implode('', $publicData));
  258. }
  259. } else {
  260. // Cut off from .private
  261. $privateFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".private";
  262. //echo "curFile=$privateFile";
  263. if (file_exists($privateFile)) {
  264. $privateData = file($privateFile);
  265. }
  266. $key = array_search($curFile . "\n", $privateData);
  267. if ($key!==false) {
  268. unset($privateData[$key]);
  269. file_put_contents($privateFile, implode('', $privateData));
  270. }
  271. }
  272. }
  273. function delparamValidation() {
  274. global $curPath;
  275. global $opt;
  276. global $param1;
  277. global $param2;
  278. global $param3;
  279. //opt!=""
  280. if ($opt!==PHP_STR) {
  281. echo("WARNING: invalid options<br>");
  282. return false;
  283. }
  284. //param1!="" and isword
  285. $test_param1 = trim($param1,"'");
  286. //echo("WARNING: ".$test_param1."<br>");
  287. if (($test_param1===PHP_STR) || !is_word($test_param1)) {
  288. echo("WARNING: invalid image file<br>");
  289. return false;
  290. }
  291. //param2==""
  292. if ($param2!==PHP_STR) {
  293. echo("WARNING: invalid parameters<br>");
  294. return false;
  295. }
  296. //param3==""
  297. if ($param3!==PHP_STR) {
  298. echo("WARNING: invalid parameters<br>");
  299. return false;
  300. }
  301. //param1 exist
  302. $path = $curPath . DIRECTORY_SEPARATOR . $test_param1;
  303. if (!file_exists($path)) {
  304. echo("WARNING: file must exists<br>");
  305. return false;
  306. }
  307. //param1 is_file
  308. if (!is_file($path)) {
  309. echo("WARNING: invalid image file<br>");
  310. return false;
  311. }
  312. //param1 file extension == gif | png | jpg | jpeg
  313. if (!is_image($test_param1)) {
  314. echo("WARNING: invalid image file<br>");
  315. return false;
  316. }
  317. return true;
  318. }
  319. function myExecDelCommand() {
  320. global $param1;
  321. global $curPath;
  322. $real_param1 = trim($param1, "'");
  323. $curFile = $curPath . DIRECTORY_SEPARATOR . $real_param1;
  324. unlink($curFile);
  325. }
  326. function makedirparamValidation() {
  327. global $curPath;
  328. global $opt;
  329. global $param1;
  330. global $param2;
  331. global $param3;
  332. //opt!=""
  333. if ($opt!==PHP_STR) {
  334. echo("WARNING: invalid options<br>");
  335. return false;
  336. }
  337. //param1!="" and isword
  338. $test_param1 = trim($param1,"'");
  339. if (($test_param1===PHP_STR) || !is_word($test_param1)) {
  340. echo("WARNING: invalid folder name<br>");
  341. return false;
  342. }
  343. //param2==""
  344. if ($param2!==PHP_STR) {
  345. echo("WARNING: invalid parameters<br>");
  346. return false;
  347. }
  348. //param3==""
  349. if ($param3!==PHP_STR) {
  350. echo("WARNING: invalid parameters<br>");
  351. return false;
  352. }
  353. //param1 exist
  354. $path = $curPath . DIRECTORY_SEPARATOR . $test_param1;
  355. if (file_exists($path)) {
  356. echo("WARNING: file must not exists<br>");
  357. return false;
  358. }
  359. //param1 file extension != gif | png | jpg | jpeg
  360. if (is_image($test_param1)) {
  361. echo("WARNING: invalid folder name<br>");
  362. return false;
  363. }
  364. return true;
  365. }
  366. function myExecMakeDirCommand() {
  367. global $param1;
  368. global $curPath;
  369. $real_param1 = trim($param1, "'");
  370. $newpath = $curPath . DIRECTORY_SEPARATOR . $real_param1;
  371. mkdir($newpath, 0777);
  372. }
  373. function upload() {
  374. global $curPath;
  375. global $prompt;
  376. //if (!empty($_FILES['files'])) {
  377. if (!empty($_FILES['files']['tmp_name'][0])) {
  378. // Updating history..
  379. //$output = [];
  380. //$output[] = $prompt . " " . "File upload" . "\n";
  381. //updateHistory($output, HISTORY_MAX_ITEMS);
  382. $uploads = (array)fixMultipleFileUpload($_FILES['files']);
  383. //no file uploaded
  384. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  385. echo("WARNING: No file uploaded.<br>");
  386. return;
  387. }
  388. foreach($uploads as &$upload) {
  389. switch ($upload['error']) {
  390. case PHP_UPLOAD_ERR_OK:
  391. break;
  392. case PHP_UPLOAD_ERR_NO_FILE:
  393. echo("WARNING: One or more uploaded files are missing.<br>");
  394. return;
  395. case PHP_UPLOAD_ERR_INI_SIZE:
  396. echo("WARNING: File exceeded INI size limit.<br>");
  397. return;
  398. case PHP_UPLOAD_ERR_FORM_SIZE:
  399. echo("WARNING: File exceeded form size limit.<br>");
  400. return;
  401. case PHP_UPLOAD_ERR_PARTIAL:
  402. echo("WARNING: File only partially uploaded.<br>");
  403. return;
  404. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  405. echo("WARNING: TMP dir doesn't exist.<br>");
  406. return;
  407. case PHP_UPLOAD_ERR_CANT_WRITE:
  408. echo("WARNING: Failed to write to the disk.<br>");
  409. return;
  410. case PHP_UPLOAD_ERR_EXTENSION:
  411. echo("WARNING: A PHP extension stopped the file upload.<br>");
  412. return;
  413. default:
  414. echo("WARNING: Unexpected error happened.<br>");
  415. return;
  416. }
  417. if (!is_uploaded_file($upload['tmp_name'])) {
  418. echo("WARNING: One or more file have not been uploaded.<br>");
  419. return;
  420. }
  421. // name
  422. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  423. if ($name == PHP_STR) {
  424. echo("WARNING: Invalid file name: " . $name."<br>");
  425. return;
  426. }
  427. $upload['name'] = $name;
  428. // fileType
  429. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  430. $upload['type'] = $fileType;
  431. // tmp_name
  432. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  433. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  434. echo("WARNING: Invalid file temp path: " . $tmp_name."<br>");
  435. return;
  436. }
  437. $upload['tmp_name'] = $tmp_name;
  438. //size
  439. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  440. if ($size == "") {
  441. echo("WARNING: Invalid file size.<br>");
  442. return;
  443. }
  444. $upload["size"] = $size;
  445. $tmpFullPath = $upload["tmp_name"];
  446. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  447. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  448. $FileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  449. if ($originalFileExt!==PHP_STR) {
  450. $destFileName = $originalFilename . "." . $originalFileExt;
  451. } else {
  452. $destFileName = $originalFilename;
  453. }
  454. $destFullPath = $curPath . DIRECTORY_SEPARATOR . $destFileName;
  455. if (file_exists($destFullPath)) {
  456. echo("WARNING: destination already exists.<br>");
  457. return;
  458. }
  459. copy($tmpFullPath, $destFullPath);
  460. chmod($destFullPath, 0766);
  461. // Updating history..
  462. //$output = [];
  463. //$output[] = $destFileName . " " . "uploaded" . "\n";
  464. //updateHistory($output, HISTORY_MAX_ITEMS);
  465. // Cleaning up..
  466. // Delete the tmp file..
  467. unlink($tmpFullPath);
  468. }
  469. }
  470. }
  471. function showImages() {
  472. global $curPath;
  473. global $contextType;
  474. global $curLocale;
  475. $exclData = [];
  476. if (APP_DEFAULT_CONTEXT === "PUBLIC") {
  477. $exclFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".private";
  478. } else {
  479. $exclFile = APP_DATA_PATH . DIRECTORY_SEPARATOR . ".public";
  480. }
  481. if (file_exists($exclFile)) {
  482. $exclData = file($exclFile);
  483. }
  484. ///$root = "img";
  485. $root = APP_REPO_PATH;
  486. //subpath
  487. ///$subpath = mb_substr((string)filter_input(INPUT_GET, "path", FILTER_SANITIZE_STRING), 0, 500);
  488. $subpath = $curPath;
  489. if ($subpath!=="" && is_dir($subpath)) {
  490. $path = $subpath;
  491. } else {
  492. $path = $root;
  493. }
  494. /*
  495. * Display Link to Home
  496. */
  497. if ($path!==$root) {
  498. $title = getResource("Parent", $curLocale);
  499. $ipos = mb_strripos($subpath, "/");
  500. $parentPath = substr($subpath, 0, $ipos);
  501. $relPath = substr($parentPath, strlen(APP_REPO_PATH));
  502. $cdate = date("d-m-Y", filectime($parentPath));
  503. echo "<table style='float:left;width:235px;height:200px;margin-top:5px;margin-right:4px;border:0px solid #D2D2D2'>";
  504. echo "<tr><td style='text-align:center;font-size:11px'>{$title}</td><tr>";
  505. echo "<tr><td style='padding:3px;'><a href='#' onclick='changePath(\"{$relPath}\")'><img src='/res/folder-home.png' width='100%' height='200px'></a></td><tr>";
  506. echo "<tr><td style='text-align:center;font-size:11px'>{$cdate}</td><tr>";
  507. echo "</table>";
  508. } else {
  509. $title = getResource("Parent", $curLocale);
  510. $cdate = date("d-m-Y", filectime($root));
  511. echo "<table style='float:left;width:235px;height:200px;margin-top:5px;margin-right:4px;border:0px solid #D2D2D2'>";
  512. echo "<tr><td style='text-align:center;font-size:11px'>{$title}</td><tr>";
  513. echo "<tr><td style='padding:3px;'><img src='/res/folder-home-dis.png' width='100%' height='200px'></td><tr>";
  514. echo "<tr><td style='text-align:center;font-size:11px'>{$cdate}</td><tr>";
  515. echo "</table>";
  516. }
  517. if ($contextType === PERSONAL_CONTEXT_TYPE) {
  518. $title = getResource("Add folder", $curLocale);
  519. $cdate = date("d-m-Y");
  520. echo "<table style='float:left;width:235px;height:200px;margin-top:5px;margin-right:4px;border:0px solid #D2D2D2'>";
  521. echo "<tr><td style='text-align:center;font-size:11px'>{$title}</td><tr>";
  522. echo "<tr><td style='padding:3px;cursor:pointer;' onclick='makeNewFolder()'><img src='/res/new-folder.png' width='100%' height='200px'></td><tr>";
  523. echo "<tr><td style='text-align:center;font-size:11px'>{$cdate}</td><tr>";
  524. echo "</table>";
  525. }
  526. $pattern = $path . "/*";
  527. /*
  528. * Display subfolders
  529. */
  530. $aDirs = glob($pattern, GLOB_ONLYDIR);
  531. sort($aDirs);
  532. foreach ($aDirs as &$fsEntry) {
  533. $relPath = substr($fsEntry, strlen(APP_REPO_PATH));
  534. $ipos = mb_strripos($fsEntry, "/");
  535. $title = substr($fsEntry, $ipos+1);
  536. $cdate = date("d-m-Y", filectime($fsEntry));
  537. echo "<table style='float:left;width:235px;height:200px;margin-top:5px;margin-right:4px;border:0px solid #D2D2D2'>";
  538. echo "<tr><td style='text-align:center;font-size:11px'>{$title}</td><tr>";
  539. echo "<tr><td style='padding:3px;'><a href='#' onclick='changePath(\"{$relPath}\")'><img src='/res/folder.png' width='100%' height='200px'></a></td><tr>";
  540. echo "<tr><td style='text-align:center;font-size:11px'>{$cdate}</td><tr>";
  541. echo "</table>";
  542. }
  543. /*
  544. * Display images
  545. */
  546. $aImages = glob($pattern);
  547. sort($aImages);
  548. $serverName = filter_input(INPUT_SERVER, "SERVER_NAME");
  549. $i=1;
  550. foreach ($aImages as &$fsEntry) {
  551. if (!is_dir($fsEntry)) {
  552. $relPath = "/" . substr(APP_REPO_PATH, strlen(APP_PATH)+1) . substr($fsEntry, strlen(APP_REPO_PATH));
  553. $fileName = basename($fsEntry);
  554. $curFile = substr($curPath, strlen(APP_REPO_PATH)) . DIRECTORY_SEPARATOR . $fileName;
  555. if (APP_DEFAULT_CONTEXT === "PUBLIC") {
  556. $isPrivateFile = false;
  557. $imgLock = "/res/public.png";
  558. if (in_array($curFile . "\n",$exclData)) {
  559. $isPrivateFile = true;
  560. $imgLock = "/res/private.png";
  561. }
  562. } else {
  563. $isPrivateFile = true;
  564. $imgLock = "/res/private.png";
  565. if (in_array($curFile . "\n",$exclData)) {
  566. $isPrivateFile = false;
  567. $imgLock = "/res/public.png";
  568. }
  569. }
  570. $ipos = mb_strripos($fsEntry, "/");
  571. $title = substr($fsEntry, $ipos+1);
  572. $ipos = mb_stripos($title, ".");
  573. $title = substr($title, 0, $ipos);
  574. if (strlen($title)>22) {
  575. $title = left($title,22) . "..";
  576. }
  577. $cdate = date("d-m-Y", filectime($fsEntry));
  578. if ((!$isPrivateFile && ($contextType === PUBLIC_CONTEXT_TYPE)) || ($contextType === PERSONAL_CONTEXT_TYPE)) {
  579. echo "<div class=\"image-cont\" style='float:left;width:235px;margin-right:4px;display:none;'>";
  580. echo "<table style='width:235px;height:230px;margin-top:5px;margin-right:4px;background-color:#e1e1e1;border:1px solid #D2D2D2;'>";
  581. echo "<tr>";
  582. if ($contextType === PERSONAL_CONTEXT_TYPE) {
  583. echo "<td style='width:23px;cursor:pointer; vertical-align:bottom;' ondblclick='delImg(\"{$i}\",\"{$fileName}\")'><img id='del-{$i}' class='imgdel' src='/res/del.png' style='height:19px;'></td>";
  584. echo "<td style='width:45px;cursor:pointer' ondblclick='changeVisibility(\"{$i}\",\"{$fileName}\")'><img id='lock-{$i}' class='imglock' src='{$imgLock}' style='height:23px;'></td>";
  585. } else {
  586. echo "<td style='width:1px;cursor:pointer; vertical-align:bottom;'><img id='del-{$i}' class='imgdel' src='/res/pxl.gif' style='height:1px;'></td>";
  587. echo "<td style='width:1px;cursor:pointer'><img id='lock-{$i}' class='imglock' src='/res/pxl.gif' style='height:1px;'></td>";
  588. }
  589. //echo "<td style='height:23px;text-align:center;font-size:11px;'>";
  590. if ($contextType === PERSONAL_CONTEXT_TYPE) {
  591. echo "<td style='height:23px;text-align:right;font-size:11px;'>";
  592. echo "{$title}&nbsp;";
  593. } else {
  594. echo "<td style='height:23px;text-align:center;font-size:11px;'>";
  595. echo "{$title}&nbsp;";
  596. }
  597. echo "</td>";
  598. echo "<tr>";
  599. echo "<tr><td style='padding:3px;width:235px;height:200px;background-image:url(\"{$relPath}\");background-size:235px 200px;cursor:zoom-in;' colspan='3' onclick=\"openPic('$fileName')\"'>&nbsp;</td><tr>";
  600. echo "<tr><td style='text-align:left;font-size:11px' colspan='3'>&nbsp;{$cdate}</td><tr>";
  601. echo "</table>";
  602. echo "<div style='position:relative;top:-35px;text-align:right;padding-right:1.5px;'>";
  603. echo "<a href=\"https://www.facebook.com/sharer/sharer.php?u=http://{$serverName}{$relPath}&t=\" onclick=\"javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');return false;\" target=\"_blank\" title=\"Share on Facebook\"><img src='/res/fb.png'></a>";
  604. echo "<a href=\"https://twitter.com/share?url=http://{$serverName}{$relPath}&text=\" onclick=\"javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');return false;\" target=\"_blank\" title=\"Share on Twitter\"><img src='/res/twitter.png'></a>";
  605. echo "<a href=\"whatsapp://send?text=http://{$serverName}{$relPath}\" data-action=\"share/whatsapp/share\" onClick=\"javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');return false;\" target=\"_blank\" title=\"Share on whatsapp\"><img src='/res/whatsapp.png'></a>";
  606. echo "</div>";
  607. echo "</div>";
  608. }
  609. $i++;
  610. }
  611. }
  612. }
  613. function openPicParamValidation()
  614. {
  615. global $curPath;
  616. global $opt;
  617. global $param1;
  618. global $param2;
  619. global $param3;
  620. //opt!=""
  621. if ($opt!==PHP_STR) {
  622. echo("invalid options");
  623. return false;
  624. }
  625. //param1!="" and isword
  626. if (($param1===PHP_STR) || !is_word($param1)) {
  627. echo("invalid image file");
  628. return false;
  629. }
  630. //param2==""
  631. if ($param2!==PHP_STR) {
  632. echo("invalid parameters");
  633. return false;
  634. }
  635. //param3==""
  636. if ($param3!==PHP_STR) {
  637. echo("invalid parameters");
  638. return false;
  639. }
  640. //param1 exist
  641. $path = $curPath . DIRECTORY_SEPARATOR . $param1;
  642. if (!file_exists($path)) {
  643. echo("file must exists");
  644. return false;
  645. }
  646. //param1 is_file
  647. if (!is_file($path)) {
  648. echo("invalid image file:" . $param1);
  649. return false;
  650. }
  651. //param1 is_image
  652. if (!is_image($param1)) {
  653. echo("invalid image file" . $param1);
  654. return false;
  655. }
  656. return true;
  657. }
  658. function myExecOpenPicCommand() {
  659. global $curPath;
  660. global $curPicture;
  661. global $param1;
  662. $curPicture = substr($curPath.DIRECTORY_SEPARATOR.$param1, strlen(dirname(APP_REPO_PATH)));
  663. }
  664. $password = filter_input(INPUT_POST, "Password");
  665. if ($password==PHP_STR) {
  666. $password = filter_input(INPUT_POST, "Password2");
  667. }
  668. $command = filter_input(INPUT_POST, "CommandLine");
  669. $pwd = filter_input(INPUT_POST, "pwd");
  670. $hideSplash = filter_input(INPUT_POST, "hideSplash");
  671. $hideHCSplash = filter_input(INPUT_POST, "hideHCSplash");
  672. if ($password !== PHP_STR) {
  673. $hash = hash("sha256", $password . APP_SALT, false);
  674. if ($hash !== APP_HASH) {
  675. $password=PHP_STR;
  676. }
  677. }
  678. $curPath = APP_REPO_PATH;
  679. if ($pwd!==PHP_STR) {
  680. ///if (left($pwd, strlen(APP_REPO_PATH)) === APP_REPO_PATH) {
  681. if (file_exists(APP_REPO_PATH . $pwd) && is_dir(APP_REPO_PATH . $pwd)) {
  682. $curPath = APP_REPO_PATH . $pwd;
  683. }
  684. }
  685. chdir($curPath);
  686. $ipos = strripos($curPath, PHP_SLASH);
  687. $curDir = substr($curPath, $ipos);
  688. parseCommand($command);
  689. //echo("cmd=" . $cmd . "<br>");
  690. //echo("opt=" . $opt . "<br>");
  691. //echo("param1=" . $param1 . "<br>");
  692. //echo("param2=" . $param2 . "<br>");
  693. if ($password !== PHP_STR) {
  694. upload();
  695. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  696. if ($command === "refresh") {
  697. // refreshing Msg Board..
  698. }
  699. } else if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  700. if ($cmd === "privatify") {
  701. if (privatifyparamValidation()) {
  702. myExecPrivatifyCommand();
  703. }
  704. } else if ($cmd === "publicify") {
  705. if (publicifyparamValidation()) {
  706. myExecPublicifyCommand();
  707. }
  708. } else if ($cmd === "del") {
  709. if (delparamValidation()) {
  710. myExecDelCommand();
  711. }
  712. } else if ($cmd === "makedir") {
  713. if (makedirparamValidation()) {
  714. myExecMakeDirCommand();
  715. }
  716. } else if ($cmd === "openpic") {
  717. if (openPicParamValidation()) {
  718. myExecOpenPicCommand();
  719. }
  720. }
  721. } else {
  722. }
  723. $contextType = PERSONAL_CONTEXT_TYPE;
  724. } else {
  725. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  726. if ($cmd === "openpic") {
  727. if (openPicParamValidation()) {
  728. myExecOpenPicCommand();
  729. }
  730. }
  731. }
  732. }
  733. ?>
  734. <!DOCTYPE html>
  735. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  736. <head>
  737. <meta charset="UTF-8"/>
  738. <meta name="style" content="day1"/>
  739. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  740. <!--
  741. Copyright 2021, 2024 5 Mode
  742. This file is part of Homogram.
  743. Homogram is free software: you can redistribute it and/or modify
  744. it under the terms of the GNU General Public License as published by
  745. the Free Software Foundation, either version 3 of the License, or
  746. (at your option) any later version.
  747. Homogram is distributed in the hope that it will be useful,
  748. but WITHOUT ANY WARRANTY; without even the implied warranty of
  749. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  750. GNU General Public License for more details.
  751. You should have received a copy of the GNU General Public License
  752. along with Homogram. If not, see <https://www.gnu.org/licenses/>.
  753. -->
  754. <title>Homogram: every person its pictures..</title>
  755. <link rel="shortcut icon" href="./res/favicon.ico?v=<?php echo(time()); ?>" />
  756. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  757. <meta name="author" content="5 Mode"/>
  758. <meta name="robots" content="index,follow"/>
  759. <script src="./js/jquery-3.1.0.min.js" type="text/javascript"></script>
  760. <script src="./js/common.js" type="text/javascript"></script>
  761. <script src="./js/bootstrap.min.js" type="text/javascript"></script>
  762. <script src="./js/sha.js" type="text/javascript"></script>
  763. <script src="./js/home.js" type="text/javascript" defer></script>
  764. <link href="./css/bootstrap.min.css" type="text/css" rel="stylesheet">
  765. <link href="./css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  766. </head>
  767. <body>
  768. <div id="HCsplash" style="padding-top: 160px; text-align:center;color:#ffffff;display:none;">
  769. <div id="myh1"><H1>Homogram</H1></div><br>
  770. <img src="res/HGlogo2.png" style="width:310px;">
  771. </div>
  772. <?php
  773. //echo ("curPicture=**$curPicture**");
  774. if ($curPicture != PHP_STR) {
  775. $apic = glob($curPath . DIRECTORY_SEPARATOR . "*");
  776. $i=0;
  777. foreach($apic as &$path) {
  778. $fileName = basename($path);
  779. if (is_file($curPath . DIRECTORY_SEPARATOR . $fileName)) {
  780. $path=$fileName;
  781. } else {
  782. unset($apic[$i]);
  783. }
  784. $i++;
  785. }
  786. $i=array_search(basename($curPicture), $apic);
  787. // if the only one
  788. if (count($apic)==1) {
  789. $prevPicture = basename($apic[0]);
  790. $nextPicture = basename($apic[0]);
  791. // if first
  792. } else if ($i==0) {
  793. $prevPicture = basename($apic[count($apic)-1]);
  794. $nextPicture = basename($apic[1]);
  795. // if last
  796. } else if ($i==(count($apic)-1)) {
  797. $prevPicture = basename($apic[$i-1]);
  798. $nextPicture = basename($apic[0]);
  799. } else {
  800. $prevPicture = basename($apic[$i-1]);
  801. $nextPicture = basename($apic[$i+1]);
  802. }
  803. $hidePlayer = "0";
  804. } else {
  805. $hidePlayer = "1";
  806. }
  807. ?>
  808. <div id="picPlayer" style="width:100%;height:1900px;vertical-align:middle;text-align:center;background:#000000;display:<?php echo(($hidePlayer==="1"? "none": "inline"));?>;">
  809. <div id="closePlayer" style="position: absolute; top:20px; left:20px; cursor:pointer;" onclick="closePlayer()"><img src="/res/parent.png" style="width:64px;"></div>
  810. <div id="myPicCont" style="width:100%;max-width:100%;clear:both;margin:auto;vertical-align:middle;background:#000000;"><img id="myPic" src="<?php echo($curPicture);?>" style="width:100%;vertical-align:middle;display:none;;background:#000000;"></div>
  811. <div id="navPlayer1" style="position:absolute;top:3000px;width:175px;cursor:pointer;overflow-x:hidden;border:0px solid red;" onclick="openPic('<?php echo($prevPicture);?>')"><img src="/res/picPrev.png" style="width:200px;position:relative;left:-125px;"></div>
  812. <div id="navPlayer2" style="position:absolute;top:3000px;width:175px;cursor:pointer;overflow-x:hidden;border:0px solid red;" onclick="openPic('<?php echo($nextPicture);?>')"><img src="/res/picNext.png" style="width:200px;position:relative;left:+100px;"></div>
  813. </div>
  814. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data" style="display:<?php echo((($hideHCSplash == "1") && ($hidePlayer == "1")?"inline":"none"));?>;">
  815. <div class="header">
  816. <a id="burger-menu" href="#" style="display:none;"><img src="/res/burger-menu2.png" style="width:58px;"></a><a id="ahome" href="http://homogram.org" target="_blank" style="color:#000000; text-decoration: none;"><img id="logo-hg" src="res/HGlogo2.png" style="width:45px;">&nbsp;Homogram</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="agithub" href="https://github.com/par7133/Homogram" style="color:#000000;"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="afeedback" href="mailto:info@homogram.org" style="color:#000000;"><span style="color:#119fe2">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="asupport" href="tel:+39-331-4029415" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a><div id="pwd2" style="float:right;position:relative;top:+13px;display:none"><input type="password" id="Password2" name="Password2" placeholder="password" style="font-size:13px; background:#393939; color:#ffffff; width: 125px; border-radius:3px;" value="<?php echo($password);?>" autocomplete="off"></div>
  817. </div>
  818. <div style="clear:both;"></div>
  819. <table class="burger-header" style="width:100%;border:3px solid #e4f5f7;display:none;">
  820. <tr>
  821. <td style="width:100%;background:#e4f5f7;">
  822. <?php if ($password!==PHP_STR): ?>
  823. <div class="burger-header-ve" style="float:left;width:31%;font-size:14px;padding:4px;border:3px solid #e4f5f7;margin-top:2px;margin-right:2px;margin-bottom:2px;text-align:left;cursor:pointer;">&nbsp;&nbsp;<a href="#" style="text-decoration:none;color:black;" onclick="upload()"><?php echo(strtolower(getResource("Upload", $curLocale)));?></a></div>
  824. <?php endif; ?>
  825. <div class="burger-header-ve" style="float:left;width:31%;font-size:14px;padding:4px;border:3px solid #e4f5f7;margin-top:2px;margin-right:2px;margin-bottom:2px;text-align:left;cursor:pointer;">&nbsp;&nbsp;<a href="https://github.com/par7133/Homogram" style="text-decoration:none;color:black;">on github</a></div>
  826. <div class="burger-header-ve" style="float:left;width:31%;font-size:14px;padding:4px;border:3px solid #e4f5f7;margin-top:2px;margin-right:2px;margin-bottom:2px;text-align:left;cursor:pointer;">&nbsp;&nbsp;<a href="mailto:info@homogram.org" style="text-decoration:none;color:black;">for feedback</a></div>
  827. <div class="burger-header-ve" style="float:left;width:31%;font-size:14px;padding:4px;border:3px solid #e4f5f7;margin-top:2px;margin-right:2px;margin-bottom:2px;text-align:left;cursor:pointer;">&nbsp;&nbsp;<a href="tel:+39-331-4029415" style="text-decoration:none;color:black;">get support</a></div>
  828. </td>
  829. </tr>
  830. </table>
  831. <div style="clear:both;"></div>
  832. <div id="sidebar" style="clear:both; float:left; padding:8px; width:25%; max-width:250px; height:100%; text-align:center; border-right: 1px solid #2c2f34;">
  833. <div style="padding-left:12px;text-align: left;">
  834. &nbsp;
  835. <?php if ($password!==PHP_STR): ?>
  836. <a href="#" id="upload" style="color:#5ab5e4;" onclick="upload()"><?php echo(getResource("Upload", $curLocale));?></a>
  837. <input id="files" name="files[]" type="file" accept=".gif,.png,.jpg,.jpeg" style="visibility: hidden;" multiple>
  838. <?php else: ?>
  839. <br>
  840. <?php endif; ?>
  841. </div>
  842. <br><br>
  843. <img src="res/HGgenius.png" alt="HG Genius" title="HG Genius" style="position:relative; left:+6px; width:90%; border: 1px dashed #EEEEEE;">
  844. &nbsp;<br><br><br>
  845. <div style="text-align:left;white-space:nowrap;">
  846. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" style="font-size:13px; background:#393939; color:#ffffff; width: 60%; border-radius:3px;" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="<?php echo(getResource(" Go ", $curLocale));?>" style="text-align:left;width:25%;"><br>
  847. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:13px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" autocomplete="off"><br>
  848. <div style="text-align:center;">
  849. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; color:#000000; font-size:12px;"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
  850. </div>
  851. </div>
  852. <input type="hidden" id="CommandLine" name="CommandLine">
  853. <input type="hidden" id="pwd" name="pwd" value="<?php echo(substr($curPath, strlen(APP_REPO_PATH))); ?>" style="color:black">
  854. <input type="hidden" name="hideSplash" value="<?php echo($hideSplash); ?>">
  855. <input type="hidden" name="hideHCSplash" value="1">
  856. </div>
  857. <div id="contentbar" style="float:left; width:75%;height:100%; padding:8px;">
  858. <?php if (APP_SPLASH): ?>
  859. <?php if ($hideSplash !== PHP_STR): ?>
  860. <div id="splash" style="border-radius:20px; position:relative; left:+3px; width:98%; background-color: #33aced; padding: 20px; margin-bottom:8px;">
  861. <button type="button" class="close" aria-label="Close" onclick="closeSplash();" style="position:relative; left:-10px;">
  862. <span aria-hidden="true">&times;</span>
  863. </button>
  864. Hello and welcome to Homogram!<br><br>
  865. Homogram is a light and simple software on premise to share your images. And it can be used as a private repository (screenshots, private shots, etc).<br><br>
  866. Homogram is released under GPLv3 license, it is supplied AS-IS and we do not take any responsibility for its misusage.<br><br>
  867. The name *Homogram* comes from a prank on the name 'instagram', in fact differently from the latter Homogram gives priorities to homines. However Homogram doesn't birth as a replacement but just like its alter ego.<br><br>
  868. First step, use the left side panel password and salt fields to create the hash to insert in the config file. Remember to manually set there also the salt value.<br><br>
  869. As you are going to run Homogram in the PHP process context, using a limited web server or phpfpm user, you must follow some simple directives for an optimal first setup:<br>
  870. <ol>
  871. <li>Check the write permissions of your "HGRepo" folder in your web app public path; and set its path in the config file.</li>
  872. <li>Check the write permissions of your "data" folder in your web app private path; and set its path in the config file.</li>
  873. <li>Set the default Locale.</li>
  874. <li>Set the default Context to PUBLIC or PRIVATE (for a private repository).</li>
  875. </ol>
  876. <br>
  877. Hope you can enjoy it and let us know about any feedback: <a href="mailto:info@homogram.org" style="color:#e6d236;">info@homogram.org</a>
  878. </div>
  879. <?php endif; ?>
  880. <?php endif; ?>
  881. <?php
  882. if ($contextType === PUBLIC_CONTEXT_TYPE) {
  883. echo("&nbsp;" . getResource("You are in ", $curLocale) . "<span style='color:orange;'>~/" . substr($curPath, strlen(APP_REPO_PATH)+1) . "</span>" . getResource(" as ", $curLocale) . "<span style='color:black;'>" . getResource("guest", $curLocale) . "</span><br>");
  884. } else {
  885. echo("&nbsp;" . getResource("You are in ", $curLocale) . "<span style='color:orange;'>~/" . substr($curPath, strlen(APP_REPO_PATH)+1) . "</span>" . getResource(" as ", $curLocale) . "<span style='color:green;'>" . getResource("owner", $curLocale) . "</span><br>");
  886. }
  887. ?><br>
  888. <div id="Console" style="hei-ght:493px; over-flow-y:auto; margin-top:10px;">
  889. <?php showImages(); ?>
  890. </div>
  891. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
  892. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
  893. </div>
  894. </form>
  895. <div class="footer">
  896. <div id="footerCont">&nbsp;</div>
  897. <div id="footer"><span style="background:#E1E1E1;color:black;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com">5 Mode</a> project and <a href="http://demo.5mode.com">WYSIWYG</a> system. Some rights reserved.</span></div>
  898. </div>
  899. <script>
  900. function setPPlayer() {
  901. $("#picPlayer").css("height", parseInt(window.innerHeight)+"px");
  902. $("#myPicCont").css("height", parseInt(window.innerHeight)+"px");
  903. $("#myPicCont").css("max-width", parseInt(window.innerWidth)+"px");
  904. $("#closePlayer").css("left", "10px");
  905. $("#navPlayer1").css("top", parseInt((window.innerHeight-200)/2)+"px");
  906. $("#navPlayer2").css("top", parseInt((window.innerHeight-200)/2)+"px");
  907. $("#navPlayer2").css("left", parseInt(window.innerWidth-175)+"px");
  908. if (document.getElementById("myPic").src!="") {
  909. if ($("#myPic").width() > $("#myPic").height()) {
  910. f = $("#myPic").width() / $("#myPic").height();
  911. $("#myPic").css("padding-top", parseInt((window.innerHeight - $("#myPic").height()) / 2)+"px");
  912. $("#myPic").css("width", "100%"); //parseInt(window.innerWidth)+"px");
  913. $("#myPic").css("height", "");
  914. $("#myPic").css("max-height", parseInt(window.innerHeight)+"px");
  915. } else {
  916. $("#myPic").css("width", "");
  917. $("#myPic").css("max-width", parseInt(window.innerWidth)+"px");
  918. $("#myPic").css("height", "100%"); //parseInt(window.innerHeight)+"px");
  919. $("#myPicCont").css("max-width", parseInt(window.innerWidth)+"px");
  920. }
  921. $("#myPic").css("display", "inline");
  922. }
  923. $(document.body).css("overflow-x","hidden");
  924. }
  925. function hideTitle() {
  926. $("#myh1").hide("slow");
  927. }
  928. function startApp() {
  929. $("#HCsplash").hide("slow");
  930. $(document.body).css("background","#ffffff");
  931. $("#frmHC").show();
  932. }
  933. <?php if($hideHCSplash!=="1"): ?>
  934. window.addEventListener("load", function() {
  935. $(document.body).css("background","#000000");
  936. $("#HCsplash").show("slow");
  937. setTimeout("hideTitle()", 2000);
  938. setTimeout("startApp()", 4000);
  939. }, true);
  940. <?php else: ?>
  941. window.addEventListener("load", function() {
  942. <?php if ($hidePlayer == "1"): ?>
  943. startApp();
  944. <?php endif; ?>
  945. });
  946. <?php endif; ?>
  947. window.addEventListener("load", function() {
  948. <?php if ($hideHCSplash != "1" || $hidePlayer != "1"): ?>
  949. $(document.body).css("backgrond","#000000");
  950. <?php else: ?>
  951. $(document.body).css("backgrond","#FFFFFF");
  952. <?php endif; ?>
  953. });
  954. window.addEventListener("load", function() {
  955. <?php if($password===PHP_STR):?>
  956. $("#Password").addClass("emptyfield");
  957. <?php endif; ?>
  958. //maxY = document.getElementById("Console").scrollHeight;
  959. //alert(maxY);
  960. <?php if ($hidePlayer == "0"): ?>
  961. setPPlayer();
  962. <?php endif; ?>
  963. }, true);
  964. window.addEventListener("resize", function() {
  965. <?php if ($hidePlayer == "0"): ?>
  966. setPPlayer();
  967. <?php endif; ?>
  968. }, true);
  969. </script>
  970. </body>
  971. </html>