home.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of Homomm.
  6. *
  7. * Homomm 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. * Homomm 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 Homomm. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * Homomm home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $msgHistory = [];
  28. $cmd = PHP_STR;
  29. $opt = PHP_STR;
  30. $param1 = PHP_STR;
  31. $param2 = PHP_STR;
  32. $param3 = PHP_STR;
  33. $user = PHP_STR;
  34. $userName = PHP_STR;
  35. $userHint = PHP_STR;
  36. $userHintResolved = PHP_STR;
  37. $picPath = PHP_STR;
  38. function showHistory() {
  39. global $msgHistory;
  40. global $user;
  41. global $curPath;
  42. global $picPath;
  43. $i = 1;
  44. //echo "curPath=$curPath<br>";
  45. $oldDate = "";
  46. foreach($msgHistory as $val) {
  47. if ((mb_stripos($val, "-master") !== false) && ($user == "MASTER")) {
  48. $float = "right";
  49. } else if ((mb_stripos($val, "-master") === false) && ($user != "MASTER")) {
  50. $float = "right";
  51. } else {
  52. $float = "left";
  53. }
  54. echo("<div style='width:100%;height:auto;border:0px solid red;margin-bottom:12px;'>");
  55. $val = rtrim($val,"\n");
  56. // grab the date
  57. $date = left($val, 8);
  58. $date = date("l j F", mktime(0,0,0,substr($date,4,2),right($date,2),left($date,4)));
  59. if ($date!=$oldDate) {
  60. echo("<div style='text-align:center;'><span style='background-color:gray;color:#FFFFFF'>$date</span></div><br>");
  61. $oldDate = $date;
  62. }
  63. // grab the time
  64. preg_match('/^.+-(\d{4})-/i', $val, $matches);
  65. $time = $matches[1];
  66. $time = ltrim(left($time,2),"0") . ":" . right($time,2);
  67. // parsing for file ext
  68. $fileext = strtolower(pathinfo($val, PATHINFO_EXTENSION));
  69. if ($fileext === "png" || $fileext === "jpg" || $fileext === "jpeg" || $fileext === "gif") {
  70. // display the img
  71. $img = substr($picPath, strlen(APP_PATH)) . DIRECTORY_SEPARATOR . $val;
  72. echo("<div style='background-color:#EEEEEE;float:$float;padding:5px;max-width:300px;min-width:260px;'><img src='$img' style='width:100%;'><div style='float:right;font-size:9px;'>$time</div></div><br><br><br>");
  73. } else {
  74. // display the msg
  75. $msg = HTMLencode(file_get_contents($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $val));
  76. echo("<div style='background-color:#EEEEEE;float:$float;padding:5px;max-width:300px;min-width:260px;'>".str_replace("\n", "<br>", $msg)."<div style='float:right;font-size:9px;'>$time</div></div><br><br><br>");
  77. }
  78. echo("<div style='clear:both;'></div>");
  79. echo("</div>");
  80. $i++;
  81. }
  82. }
  83. function updateHistory(&$update, $maxItems) {
  84. global $msgHistory;
  85. global $curPath;
  86. global $picPath;
  87. // Making enough space in $msgHistory for the update..
  88. $shift = (count($msgHistory) + count($update)) - $maxItems;
  89. if ($shift > 0) {
  90. $msgHistory = array_slice($msgHistory, $shift, $maxItems);
  91. }
  92. // Adding $msgHistory update..
  93. if (count($update) > $maxItems) {
  94. $beginUpd = count($update) - ($maxItems-1);
  95. } else {
  96. $beginUpd = 0;
  97. }
  98. $update = array_slice($update, $beginUpd, $maxItems);
  99. foreach($update as $val) {
  100. $msgHistory[] = $val;
  101. }
  102. // Deleting unused message files..
  103. foreach (glob($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . "*.msg") as $msgFilePath) {
  104. $msgFileName = basename($msgFilePath);
  105. if (!in_array($msgFileName."\n", $msgHistory)) {
  106. unlink($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $msgFileName);
  107. }
  108. }
  109. // Deleting unused pic files..
  110. foreach (glob($picPath . DIRECTORY_SEPARATOR . "*") as $imgFilePath) {
  111. $imgFileName = basename($imgFilePath);
  112. if (!in_array($imgFileName."\n", $msgHistory)) {
  113. unlink($picPath . DIRECTORY_SEPARATOR . $imgFileName);
  114. }
  115. }
  116. // Writing out $msgHistory on disk..
  117. $filepath = $curPath . DIRECTORY_SEPARATOR . ".HMM_history";
  118. file_put_contents($filepath, implode('', $msgHistory));
  119. }
  120. function parseCommand() {
  121. global $command;
  122. global $cmd;
  123. global $opt;
  124. global $param1;
  125. global $param2;
  126. global $param3;
  127. $str = trim($command);
  128. $ipos = stripos($str, PHP_SPACE);
  129. if ($ipos > 0) {
  130. $cmd = left($str, $ipos);
  131. $str = substr($str, $ipos+1);
  132. } else {
  133. $cmd = $str;
  134. return;
  135. }
  136. if (left($str, 1) === "-") {
  137. $ipos = stripos($str, PHP_SPACE);
  138. if ($ipos > 0) {
  139. $opt = left($str, $ipos);
  140. $str = substr($str, $ipos+1);
  141. } else {
  142. $opt = $str;
  143. return;
  144. }
  145. }
  146. $ipos = stripos($str, PHP_SPACE);
  147. if ($ipos > 0) {
  148. $param1 = left($str, $ipos);
  149. $str = substr($str, $ipos+1);
  150. } else {
  151. $param1 = $str;
  152. return;
  153. }
  154. $ipos = stripos($str, PHP_SPACE);
  155. if ($ipos > 0) {
  156. $param2 = left($str, $ipos);
  157. $str = substr($str, $ipos+1);
  158. } else {
  159. $param2 = $str;
  160. return;
  161. }
  162. $ipos = stripos($str, PHP_SPACE);
  163. if ($ipos > 0) {
  164. $param3 = left($str, $ipos);
  165. $str = substr($str, $ipos+1);
  166. } else {
  167. $param3 = $str;
  168. return;
  169. }
  170. }
  171. function upload() {
  172. global $curPath;
  173. global $user;
  174. global $userName;
  175. global $picPath;
  176. //if (trim($message,"\n")!==PHP_STR) {
  177. // myExecSendMessage();
  178. //}
  179. //if (!empty($_FILES['files'])) {
  180. if (!empty($_FILES['files']['tmp_name'][0])) {
  181. $uploads = (array)fixMultipleFileUpload($_FILES['files']);
  182. //no file uploaded
  183. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  184. //updateHistoryWithErr("No file uploaded.", false);
  185. return;
  186. }
  187. foreach($uploads as &$upload) {
  188. switch ($upload['error']) {
  189. case PHP_UPLOAD_ERR_OK:
  190. break;
  191. case PHP_UPLOAD_ERR_NO_FILE:
  192. //updateHistoryWithErr("One or more uploaded files are missing.", false);
  193. return;
  194. case PHP_UPLOAD_ERR_INI_SIZE:
  195. //updateHistoryWithErr("File exceeded INI size limit.", false);
  196. return;
  197. case PHP_UPLOAD_ERR_FORM_SIZE:
  198. //updateHistoryWithErr("File exceeded form size limit.", false);
  199. return;
  200. case PHP_UPLOAD_ERR_PARTIAL:
  201. //updateHistoryWithErr("File only partially uploaded.", false);
  202. return;
  203. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  204. //updateHistoryWithErr("TMP dir doesn't exist.", false);
  205. return;
  206. case PHP_UPLOAD_ERR_CANT_WRITE:
  207. //updateHistoryWithErr("Failed to write to the disk.", false);
  208. return;
  209. case PHP_UPLOAD_ERR_EXTENSION:
  210. //updateHistoryWithErr("A PHP extension stopped the file upload.", false);
  211. return;
  212. default:
  213. //updateHistoryWithErr("Unexpected error happened.", false);
  214. return;
  215. }
  216. if (!is_uploaded_file($upload['tmp_name'])) {
  217. //updateHistoryWithErr("One or more file have not been uploaded.", false);
  218. return;
  219. }
  220. // name
  221. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  222. if ($name == PHP_STR) {
  223. //updateHistoryWithErr("Invalid file name: " . $name, false);
  224. return;
  225. }
  226. $upload['name'] = $name;
  227. // fileType
  228. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  229. $upload['type'] = $fileType;
  230. // tmp_name
  231. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  232. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  233. //updateHistoryWithErr("Invalid file temp path: " . $tmp_name, false);
  234. return;
  235. }
  236. $upload['tmp_name'] = $tmp_name;
  237. //size
  238. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  239. if ($size == "") {
  240. //updateHistoryWithErr("Invalid file size.", false);
  241. return;
  242. }
  243. $upload["size"] = $size;
  244. $tmpFullPath = $upload["tmp_name"];
  245. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  246. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  247. $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  248. if ($originalFileExt!==PHP_STR) {
  249. //$destFileName = $originalFilename . "." . $fileExt;
  250. if ($user === "master") {
  251. $destFileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-master.$fileExt";
  252. } else {
  253. $destFileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-$userName.$fileExt";
  254. }
  255. } else {
  256. return;
  257. }
  258. $destFullPath = $picPath . DIRECTORY_SEPARATOR . $destFileName;
  259. if (file_exists($destFullPath)) {
  260. //updateHistoryWithErr("destination already exists", false);
  261. return;
  262. }
  263. copy($tmpFullPath, $destFullPath);
  264. // Updating history..
  265. $output = [];
  266. $output[] = $destFileName . "\n";
  267. updateHistory($output, HISTORY_MAX_ITEMS);
  268. // Cleaning up..
  269. // Delete the tmp file..
  270. unlink($tmpFullPath);
  271. }
  272. }
  273. }
  274. function myExecSendMessage() {
  275. global $curPath;
  276. global $message;
  277. global $user;
  278. global $userName;
  279. global $sendSMS;
  280. global $CONFIG;
  281. global $userHintResolved;
  282. if (!empty($message)) {
  283. if ($user == "MASTER") {
  284. $fileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-master.msg";
  285. } else {
  286. $fileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-$userName.msg";
  287. }
  288. $msg = HTMLencode($message);
  289. if (right($msg,1)!="\n") {
  290. $msg = $msg . "\n";
  291. }
  292. // Creating the msg file..
  293. file_put_contents($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $fileName, $msg);
  294. // Updating message history..
  295. $output = [];
  296. $output[] = $fileName . "\n";
  297. updateHistory($output, HISTORY_MAX_ITEMS);
  298. if ($user == "MASTER") {
  299. $smsUser = $userHintResolved;
  300. } else {
  301. $smsUser = "MASTER";
  302. }
  303. // Sending out the sms notifcation..
  304. if ($sendSMS && SMS_USERNAME!=PHP_STR) {
  305. $message = array(
  306. 'To'=>$CONFIG['AUTH'][$smsUser]['PHONE'],
  307. 'MessagingServiceSid'=>SMS_MESSAGING_SERVICE,
  308. 'Body'=>SMS_BODY
  309. );
  310. sendSMS($message, SMS_API_URL, SMS_USERNAME, SMS_PASSWORD);
  311. }
  312. }
  313. }
  314. $password = filter_input(INPUT_POST, "Password");
  315. $command = filter_input(INPUT_POST, "CommandLine");
  316. $message = filter_input(INPUT_POST, "MessageLine");
  317. $sendSMS1 = filter_input(INPUT_POST, "chkSMS");
  318. if ($sendSMS1!="") {
  319. $sendSMS = true;
  320. } else {
  321. $sendSMS = false;
  322. }
  323. $pwd = PHP_STR;
  324. $userHint = filter_input(INPUT_POST, "userHint");
  325. $userHintResolved = PHP_STR;
  326. if ($userHint!=PHP_STR) {
  327. $found=false;
  328. foreach ($CONFIG['AUTH'] as $key => $val) {
  329. if ($userHint==$val['USERNAME']) {
  330. $userHintResolved = $key;
  331. $found=true;
  332. break;
  333. }
  334. }
  335. if (!$found) {
  336. die("Invalid chat!");
  337. }
  338. }
  339. $hideSplash = filter_input(INPUT_POST, "hideSplash");
  340. $hideHCSplash = filter_input(INPUT_POST, "hideHCSplash");
  341. //echo "password=*$password*<br>";
  342. if ($password != PHP_STR) {
  343. $hash = hash("sha256", $password . APP_SALT, false);
  344. $found=false;
  345. foreach ($CONFIG['AUTH'] as $key => $val) {
  346. //echo ("username=".$val['USERNAME']."<br>");
  347. if ($hash==$val['HASH']) {
  348. $user = $key;
  349. if ($userHintResolved==PHP_STR) {
  350. $userHintResolved = $key;
  351. }
  352. $found=true;
  353. break;
  354. }
  355. }
  356. if (!$found) {
  357. $password=PHP_STR;
  358. }
  359. if ($password != PHP_STR) {
  360. $userName = $CONFIG['AUTH'][$user]['USERNAME'];
  361. $pwd = APP_REPO_PATH . DIRECTORY_SEPARATOR . $CONFIG['AUTH'][$userHintResolved]['REPO_FOLDER'];
  362. $picPath = APP_PIC_PATH . DIRECTORY_SEPARATOR . $CONFIG['AUTH'][$userHintResolved]['PIC_FOLDER'];
  363. }
  364. }
  365. $curPath = APP_REPO_PATH;
  366. if ($pwd!==PHP_STR) {
  367. if (left($pwd, strlen(APP_REPO_PATH)) === APP_REPO_PATH) {
  368. $curPath = $pwd;
  369. chdir($curPath);
  370. if (!file_exists($curPath . DIRECTORY_SEPARATOR . ".HMM_history")) {
  371. $output = [];
  372. file_put_contents($curPath . DIRECTORY_SEPARATOR . ".HMM_history", $output);
  373. }
  374. if (!file_exists($curPath . DIRECTORY_SEPARATOR . "msgs")) {
  375. mkdir("msgs", 0777);
  376. }
  377. }
  378. }
  379. $ipos = strripos($curPath, PHP_SLASH);
  380. $curDir = substr($curPath, $ipos);
  381. if ($password !== PHP_STR) {
  382. $msgHistory = file($curPath . DIRECTORY_SEPARATOR . ".HMM_history");
  383. parseCommand($command);
  384. //echo("cmd=" . $cmd . "<br>");
  385. //echo("opt=" . $opt . "<br>");
  386. //echo("param1=" . $param1 . "<br>");
  387. //echo("param2=" . $param2 . "<br>");
  388. //upload();
  389. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  390. if ($command === "sendmsg") {
  391. if (trim($message,"\n")!==PHP_STR) {
  392. myExecSendMessage();
  393. upload();
  394. }
  395. }
  396. } else if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  397. } else {
  398. // if I'm not saving data..
  399. //if (empty($editBoardParams) || $editBoardParams[0]['location']===PHP_STR) {
  400. // if (empty($_FILES['files']['tmp_name'][0])) {
  401. // updateHistoryWithErr("invalid command");
  402. // }
  403. //}
  404. }
  405. } else {
  406. $msgHistory = [];
  407. }
  408. ?>
  409. <!DOCTYPE html>
  410. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  411. <head>
  412. <meta charset="UTF-8"/>
  413. <meta name="style" content="day1"/>
  414. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  415. <!--
  416. Copyright 2021, 2024 5 Mode
  417. This file is part of Homomm.
  418. Homomm is free software: you can redistribute it and/or modify
  419. it under the terms of the GNU General Public License as published by
  420. the Free Software Foundation, either version 3 of the License, or
  421. (at your option) any later version.
  422. Homomm is distributed in the hope that it will be useful,
  423. but WITHOUT ANY WARRANTY; without even the implied warranty of
  424. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  425. GNU General Public License for more details.
  426. You should have received a copy of the GNU General Public License
  427. along with Homomm. If not, see <https://www.gnu.org/licenses/>.
  428. -->
  429. <title>Homomm: every person its messages..</title>
  430. <link rel="shortcut icon" href="./res/favicon.ico?v=<?php echo(time()); ?>" />
  431. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  432. <meta name="author" content="5 Mode"/>
  433. <meta name="robots" content="noindex"/>
  434. <script src="./js/jquery-3.1.0.min.js" type="text/javascript"></script>
  435. <script src="./js/common.js" type="text/javascript"></script>
  436. <script src="./js/bootstrap.min.js" type="text/javascript"></script>
  437. <script src="./js/sha.js" type="text/javascript"></script>
  438. <script src="./js/home.js" type="text/javascript" defer></script>
  439. <link href="./css/bootstrap.min.css" type="text/css" rel="stylesheet">
  440. <link href="./css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  441. <script>
  442. function upload() {
  443. <?PHP if ($password!==PHP_STR): ?>
  444. $("input#files").click();
  445. <?PHP endif; ?>
  446. }
  447. window.addEventListener("load", function() {
  448. <?php if($password===PHP_STR):?>
  449. $("#Password").addClass("emptyfield");
  450. <?php endif; ?>
  451. maxY = document.getElementById("Console").scrollHeight;
  452. //alert(maxY);
  453. document.getElementById("MessageLine").focus();
  454. document.getElementById("Console").scrollTop=maxY;
  455. }, true);
  456. function hideTitle() {
  457. $("#myh1").hide("slow");
  458. }
  459. function startApp() {
  460. $("#HCsplash").hide("slow");
  461. $(document.body).css("background","#ffffff");
  462. $("#frmHC").show();
  463. <?php if (APP_SPLASH): ?>
  464. $(document.body).css("overflow-y","auto");
  465. <?php endif; ?>
  466. }
  467. <?php if($hideHCSplash!=="1"): ?>
  468. window.addEventListener("load", function() {
  469. //$("#HCsplash").show();
  470. //setTimeout("startApp()", 5000);
  471. $(document.body).css("background","#000000");
  472. $("#HCsplash").show("slow");
  473. setTimeout("hideTitle()", 2000);
  474. setTimeout("startApp()", 4000);
  475. }, true);
  476. <?php else: ?>
  477. window.addEventListener("load", function() {
  478. startApp();
  479. });
  480. <?php endif; ?>
  481. </script>
  482. </head>
  483. <body>
  484. <div id="HCsplash" style="padding-top: 160px; text-align:center;color:#ffffff;display:none;">
  485. <div id="myh1"><H1>Homomm</H1></div><br>
  486. <img src="./Public/static/res/HMMlogo2.png" style="width:310px;">
  487. </div>
  488. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data" style="display:<?php echo(($hideHCSplash==="1"?"inline":"none"));?>;">
  489. <div class="header">
  490. <a href="http://homomm.org" target="_blank" style="color:black; text-decoration: none;"><img src="/res/HMMlogo2.png" style="width:48px;">&nbsp;Homomm</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/Homomm" style="color:#000000"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@homomm.com" style="color:#000000"><span style="color:#119fe2">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-331-4029415" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:black;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  491. </div>
  492. <div style="clear:both; float:left; padding:8px; width:15%; height:100%; text-align:center;">
  493. <?php if ($user!="MASTER"): ?>
  494. <br><br>
  495. <img src="/res/HMMgenius.png" alt="HC Genius" title="HC Genius" style="position:relative; left:+6px; width:90%; border: 1px dashed #EEEEEE;">
  496. <?php else: ?>
  497. <div style="text-align:left;">&nbsp;Friends</div><br>
  498. <div style="position:relative;top:-10px;left:+6px; width:90%; overflow-y:auto; height:244px; border: 1px dashed #EEEEEE;">
  499. <?php foreach($CONFIG['AUTH'] as $key => $val):
  500. $myusername = $val['USERNAME'];
  501. echo("<div class=\"friend\" onclick=\"changeChat('$myusername')\" style=\"text-align:left;cursor:pointer;\">&nbsp;&nbsp;$myusername</div>");
  502. endforeach; ?>
  503. </div>
  504. <?php endif; ?>
  505. <div id="upload-cont"><input id="files" name="files[]" type="file" accept=".gif,.png,.jpg,.jpeg" style="visibility: hidden;"></div>
  506. &nbsp;<br><br>
  507. &nbsp;<input type="text" id="Password" name="Password" placeholder="password" style="font-size:10px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" value="<?php echo($password);?>" autocomplete="off"><br>
  508. &nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:10px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" autocomplete="off"><br>
  509. &nbsp;<a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; color:#000000; font-size:12px;">Hash Me!</a>
  510. </div>
  511. <div style="float:left; width:85%;height:600px; padding:8px; border-left: 1px solid #2c2f34;">
  512. <?php if (APP_SPLASH): ?>
  513. <?php if ($hideSplash !== PHP_STR): ?>
  514. <div id="splash" style="border-radius:20px; position:relative; left:+3px; width:98%; background-color: #33aced; padding: 20px; margin-bottom:8px;">
  515. <button type="button" class="close" aria-label="Close" onclick="closeSplash();" style="position:relative; left:-10px;">
  516. <span aria-hidden="true">&times;</span>
  517. </button>
  518. Hello and welcome to Homomm!<br><br>
  519. Homomm is a light and simple software on premise to exchange multimedia messages with friends.<br><br>
  520. Homomm is released under GPLv3 license, it is supplied AS-IS and we do not take any responsibility for its misusage.<br><br>
  521. Homomm name comes from the two words, "homines" meaning our choise to give chance to the human beings to come first,
  522. and "mm" for "multimedia messaging".<br><br>
  523. Homomm doesn't want to be a replacement of Whats App, Telegram, Wechat, etc. but simply want to be their alter ago.<br><br>
  524. 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>
  525. As you are going to run Homomm 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>
  526. <ol>
  527. <li>Check the permissions of your "Repo" folder in your web app private path; and set its path in the config file.</li>
  528. <li>In the Repo path create a "user" folder for each user and give to this folder the write permission. Set it appropriately in the config file.</li>
  529. <li>In the config file, set every "user" information appropriately like in the examples given.</li>
  530. <li>Configure your Twilio account information appropriately to send out sms notification.</li>
  531. <li>Configure the max history items and max recall history items as required (default: 50).</li>
  532. </ol>
  533. <br>
  534. Hope you can enjoy it and let us know about any feedback: <a href="mailto:info@homemm.org" style="color:#e6d236;">info@homemm.org</a>
  535. </div>
  536. <?php endif; ?>
  537. <?php endif; ?>
  538. &nbsp;Message board<br>
  539. <div id="Console" style="height:433px; overflow-y:auto; margin-top:10px;">
  540. <!--<div id="Console" style="height:493px; margin-top:10px;">-->
  541. <pre id="Consolep" style="min-height:433px;margin-left:5px;padding:10px;border:0px;background:url('/res/console-bg.png'); background-size:cover; color: #000000;">
  542. <?php showHistory($msgHistory); ?>
  543. <div style="clear:both"></div>
  544. </pre>
  545. </div>
  546. <pre id="Messagep" style="position:relative;top:-10px;margin-left:5px;padding:10px;padding-top:0px;border:0px;background:url('/res/console-bg.png'); background-size:cover; color: #000000;">
  547. <div id="MessageL" style="position:relative;top:-23px;border:0px solid black;"><div style="float:left;width:93%; position:relative; top:+40px;border:0px solid black;"><textarea id="MessageLine" name="MessageLine" type="text" autocomplete="off" rows="3" placeholder="Message" style="float:left;width:86%;resize:none; background-color: white; color:black; border:0px; border-bottom: 1px dashed #EEEEEE;"></textarea><div id="sendOptions" style="float:left;position:relative;top:-1px;width:14%;background-color:#49a1d6;height:59px;white-space:nowrap;padding:3px;border:0px solid green;background:url('/res/send-opts-bg.png');font-weight:900;"><input type="checkbox" name="chkSMS" value="sms">&nbsp;SMS&nbsp;<br><div onclick="upload();" style="position:relative;top:+5px;left:+45px;cursor:pointer;"><img src="/res/upload.png" style="width:28px;"></div><div id="del-attach" onclick="clearUpload()" style="position:relative;top:-48px;left:-60px;display:none;cursor:pointer;"><img src="/res/del-attach.png" style="width:48px;"></div></div></div><div style="float:left;width:7%;position:relative;top:+39px;cursor:pointer;border:0px solid red;" onclick="sendMessage()"><img src="/res/send.png" style="float:left;width:63px"></div></div>
  548. <div style="clear:both"></div>
  549. </pre>
  550. </div>
  551. <div class="footer">
  552. <div id="footerCont">&nbsp;</div>
  553. <div id="footer"><span style="background:#FFFFFF;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com">5 Mode</a> project and <a href="http://wysiwyg.systems">WYSIWYG</a> system. Some rights reserved.</span></div>
  554. </div>
  555. <input type="hidden" id="CommandLine" name="CommandLine">
  556. <input type="hidden" name="pwd" value="<?php echo($curPath); ?>" style="color:black">
  557. <input type="hidden" id="userHint" name="userHint" value="<?php echo($userHint); ?>">
  558. <input type="hidden" name="hideSplash" value="<?php echo($hideSplash); ?>">
  559. <input type="hidden" name="hideHCSplash" value="1">
  560. </form>
  561. </body>
  562. </html>