index.php 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. <?php
  2. /**
  3. * Copyright 2021, 2026 5 Mode
  4. *
  5. * This file is part of DropInSound.
  6. *
  7. * DropInSound 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. * DropInSound 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 DropInSound. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * index.php
  21. *
  22. * DropInSound home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2026, 5 Mode
  26. */
  27. require "init.inc";
  28. $contextType = PUBLIC_CONTEXT_TYPE;
  29. $signHistory = [];
  30. $cmd = PHP_STR;
  31. $opt = PHP_STR;
  32. $param1 = PHP_STR;
  33. $param2 = PHP_STR;
  34. $param3 = PHP_STR;
  35. $curLocale = APP_LOCALE;
  36. $lastSign = PHP_STR;
  37. $msgSign = filter_input(INPUT_POST, "msg-sign")??"";
  38. $msgSign = strip_tags($msgSign);
  39. $q = filter_input(INPUT_POST, "q")??"";
  40. $q = strip_tags($q);
  41. $curPath = APP_DATA_PATH;
  42. chdir($curPath);
  43. $gdate = date("Y-m-d");
  44. $gtime = date("H:i:s");
  45. $signHistory = file($curPath . DIRECTORY_SEPARATOR . ".DI_history");
  46. $signHistoryDateTime = $signHistory;
  47. foreach($signHistoryDateTime as &$el) {
  48. $el = left($el,21);
  49. }
  50. $captchaHistory = file($curPath . DIRECTORY_SEPARATOR . ".DI_captchahistory");
  51. function showHistory() {
  52. global $signHistory;
  53. global $curPath;
  54. global $CONFIG;
  55. global $curLocale;
  56. global $LOCALE;
  57. global $lastSign;
  58. global $password;
  59. global $contextType;
  60. global $q;
  61. $signHistoryCopy = $signHistory;
  62. rsort($signHistoryCopy);
  63. echo("<div id='events'>");
  64. $m = 0;
  65. foreach($signHistoryCopy as $val) {
  66. $val = rtrim($val, "\n");
  67. $mydate = PHP_STR;
  68. $mytime = PHP_STR;
  69. $mydesc = PHP_STR;
  70. $myflag = PHP_STR;
  71. $aFields = explode(PHP_PIPE . PHP_PIPE. PHP_PIPE, $val);
  72. $mydate = $aFields[0]??PHP_STR;
  73. $mytime = $aFields[1]??PHP_STR;
  74. $myid = $mydate . PHP_PIPE . PHP_PIPE . PHP_PIPE . $mytime;
  75. $oriFilename = $aFields[2];
  76. $mytitle = explode("|", $aFields[2])[2]??PHP_STR;
  77. if ($q!=="") {
  78. if (mb_stripos($mytitle, $q) === false) {
  79. continue;
  80. }
  81. }
  82. $myflag = $aFields[3]??PHP_STR;
  83. if ($mydate==PHP_STR && $mytitle==PHP_STR) {
  84. continue;
  85. }
  86. // If I'm in admin
  87. if ($contextType === PERSONAL_CONTEXT_TYPE) {
  88. $adminFnc = PHP_STR;
  89. if ($myflag === "u") {
  90. $adminFnc = "<a href='#' onclick=\"confSign('" . $myid . "')\"><img src='/DIS_res/confirm.png' style='width:36px;'></a>";
  91. } else {
  92. $adminFnc = "<a href='#' onclick=\"delSign('" . $myid . "')\"><img src='/DIS_res/del.png' style='width:36px;'></a>";
  93. }
  94. echo("<table class='table-event' align='center'>");
  95. echo("<tr>");
  96. echo("<td class='td-data-date'>");
  97. echo("<span class='data-date' style='font-family:".DISPLAY_DATE_FONT.";'>".$mydate."</span>");
  98. echo("</td>");
  99. echo("<td class='td-data-time'>");
  100. echo("<span class='data-time' style='font-family:".DISPLAY_DATE_FONT.";'>".$mytime."</span>");
  101. echo("</td>");
  102. echo("<td class='td-data-title'>");
  103. echo("<span class='data-title'><a href='/open/?fn=".$oriFilename."'>".$mytitle."</a></span>");
  104. echo("</td>");
  105. echo("<td class='td-admin'>");
  106. echo($adminFnc);
  107. echo("</td>");
  108. echo("</tr>");
  109. echo("</table>");
  110. // If I'm not in admin
  111. } else {
  112. if ($myflag !== "u") {
  113. echo("<div id='res".$m."' class='res'>");
  114. echo("<span class='this-title'><a href='/open/?fn=".$oriFilename."' class='this-title'>".$mytitle."</a></span>");
  115. if (DISPLAY_SHOW_DATETIME) {
  116. echo("<br>");
  117. echo("<span class='data-date' style='font-family:".DISPLAY_DATE_FONT.";'>".$mydate."</span>");
  118. echo("&nbsp;");
  119. echo("<span class='data-time' style='font-family:".DISPLAY_DATE_FONT.";'>".$mytime."</span>");
  120. }
  121. echo("</span>");
  122. echo("</div>");
  123. }
  124. }
  125. $m++;
  126. }
  127. if (empty($signHistoryCopy) || $m === 0) {
  128. echo("No sound found!");
  129. }
  130. echo("</div>");
  131. }
  132. function updateHistory(&$update, $maxItems) {
  133. global $signHistory;
  134. global $curPath;
  135. // Making enough space in $signHistory for the update..
  136. $shift = (count($signHistory) + count($update)) - $maxItems;
  137. if ($shift > 0) {
  138. $signHistory = array_slice($signHistory, $shift, $maxItems);
  139. }
  140. // Adding $signHistory update..
  141. if (count($update) > $maxItems) {
  142. $beginUpd = count($update) - ($maxItems-1);
  143. } else {
  144. $beginUpd = 0;
  145. }
  146. $update = array_slice($update, $beginUpd, $maxItems);
  147. foreach($update as $val) {
  148. $signHistory[] = $val;
  149. }
  150. // Writing out $signHistory on disk..
  151. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_history";
  152. file_put_contents($filepath, implode('', $signHistory));
  153. }
  154. function updatecaptchaHistory(&$update) {
  155. global $captchaHistory;
  156. global $curPath;
  157. foreach($update as $val) {
  158. $captchaHistory[] = $val;
  159. }
  160. // Writing out $captchaHistory on disk..
  161. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_captchahistory";
  162. file_put_contents($filepath, implode('', $captchaHistory));
  163. }
  164. function upload() {
  165. global $curPath;
  166. global $signHistory;
  167. global $signHistoryDateTime;
  168. global $msgSign;
  169. //$t = filter_input(INPUT_POST, "t")??"";
  170. //$t = strip_tags($t);
  171. // Checking for repeated upload cause ie. caching prb..
  172. //$duplicateMsgs = glob($picPath . DIRECTORY_SEPARATOR . date("Ymd-H") . "*-$msgSign*.*");
  173. //if (!empty($duplicateMsgs)) {
  174. // echo("WARNING: destination already exists");
  175. // return;
  176. //}
  177. if (in_array($msgSign,$signHistoryDateTime)) {
  178. echo("WARNING: destination already exists");
  179. return;
  180. }
  181. if (!empty($_FILES['files']['tmp_name'][0]) || !empty($_FILES['filesdd']['tmp_name'][0])) {
  182. $uploads = (array)fixMultipleFileUpload($_FILES['files']);
  183. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  184. $uploads = (array)fixMultipleFileUpload($_FILES['filesdd']);
  185. }
  186. //no file uploaded
  187. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  188. echo("WARNING: No file uploaded.");
  189. return;
  190. }
  191. $google = "abcdefghijklmnopqrstuvwxyz";
  192. if (count($uploads)>strlen($google)) {
  193. echo("WARNING: Too many uploaded files.");
  194. return;
  195. }
  196. $i=1;
  197. foreach($uploads as &$upload) {
  198. switch ($upload['error']) {
  199. case PHP_UPLOAD_ERR_OK:
  200. break;
  201. case PHP_UPLOAD_ERR_NO_FILE:
  202. echo("WARNING: One or more uploaded files are missing.");
  203. return;
  204. case PHP_UPLOAD_ERR_INI_SIZE:
  205. echo("WARNING: File exceeded INI size limit.");
  206. return;
  207. case PHP_UPLOAD_ERR_FORM_SIZE:
  208. echo("WARNING: File exceeded form size limit.");
  209. return;
  210. case PHP_UPLOAD_ERR_PARTIAL:
  211. echo("WARNING: File only partially uploaded.");
  212. return;
  213. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  214. echo("WARNING: TMP dir doesn't exist.");
  215. return;
  216. case PHP_UPLOAD_ERR_CANT_WRITE:
  217. echo("WARNING: Failed to write to the disk.");
  218. return;
  219. case PHP_UPLOAD_ERR_EXTENSION:
  220. echo("WARNING: A PHP extension stopped the file upload.");
  221. return;
  222. default:
  223. echo("WARNING: Unexpected error happened.");
  224. return;
  225. }
  226. if (!is_uploaded_file($upload['tmp_name'])) {
  227. echo("WARNING: One or more file have not been uploaded.");
  228. return;
  229. }
  230. // name
  231. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  232. if ($name == PHP_STR) {
  233. echo("WARNING: Invalid file name: " . $name);
  234. return;
  235. }
  236. $upload['name'] = $name;
  237. // fileType
  238. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  239. $upload['type'] = $fileType;
  240. // tmp_name
  241. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  242. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  243. echo("WARNING: Invalid file temp path: " . $tmp_name);
  244. return;
  245. }
  246. $upload['tmp_name'] = $tmp_name;
  247. //size
  248. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  249. if ($size == "") {
  250. echo("WARNING: Invalid file size.");
  251. return;
  252. }
  253. $upload["size"] = $size;
  254. $tmpFullPath = $upload["tmp_name"];
  255. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  256. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  257. $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  258. if ($fileExt != "mp3" && $fileExt != "wav") {
  259. echo("WARNING: Invalid file extension.");
  260. return;
  261. }
  262. $date = date("Y-m-d");
  263. $time = date("H:i:s");
  264. $destPath = APP_DATA_PATH . DIRECTORY_SEPARATOR . "sound";
  265. $destFilename = $date . "|" . $time . "|" . $name;
  266. copy($tmpFullPath, $destPath . DIRECTORY_SEPARATOR . $destFilename);
  267. // Updating history..
  268. $output = [];
  269. $output[] = $date . PHP_PIPE . PHP_PIPE . PHP_PIPE . $time . PHP_PIPE . PHP_PIPE . PHP_PIPE . $destFilename . PHP_PIPE . PHP_PIPE . PHP_PIPE ."u\n";
  270. updateHistory($output, HISTORY_MAX_ITEMS);
  271. // Cleaning up..
  272. // Delete the tmp file..
  273. unlink($tmpFullPath);
  274. $i++;
  275. }
  276. echo("<script>");
  277. echo("window.open('/?up=1','_self')");
  278. echo("</script>");
  279. exit;
  280. }
  281. }
  282. upload();
  283. function parseCommand() {
  284. global $command;
  285. global $cmd;
  286. global $opt;
  287. global $param1;
  288. global $param2;
  289. global $param3;
  290. //echo($command ."<br>");
  291. $str = trim($command);
  292. $ipos = stripos($str, PHP_SPACE);
  293. if ($ipos > 0) {
  294. $cmd = left($str, $ipos);
  295. $str = substr($str, $ipos+1);
  296. } else {
  297. $cmd = $str;
  298. return;
  299. }
  300. if (left($str, 1) === "-") {
  301. $ipos = stripos($str, PHP_SPACE);
  302. if ($ipos > 0) {
  303. $opt = left($str, $ipos);
  304. $str = substr($str, $ipos+1);
  305. } else {
  306. $opt = $str;
  307. return;
  308. }
  309. }
  310. if (left($str, 1) === "'") {
  311. $ipos = stripos($str, "'", 1);
  312. if ($ipos > 0) {
  313. $param1 = substr($str, 0, $ipos+1);
  314. $str = substr($str, $ipos+1);
  315. } else {
  316. $param1 = $str;
  317. return;
  318. }
  319. } else {
  320. $ipos = stripos($str, PHP_SPACE);
  321. if ($ipos > 0) {
  322. $param1 = left($str, $ipos);
  323. $str = substr($str, $ipos+1);
  324. } else {
  325. $param1 = $str;
  326. return;
  327. }
  328. }
  329. $ipos = stripos($str, PHP_SPACE);
  330. if ($ipos > 0) {
  331. $param2 = left($str, $ipos);
  332. $str = substr($str, $ipos+1);
  333. } else {
  334. $param2 = $str;
  335. return;
  336. }
  337. $ipos = stripos($str, PHP_SPACE);
  338. if ($ipos > 0) {
  339. $param3 = left($str, $ipos);
  340. $str = substr($str, $ipos+1);
  341. } else {
  342. $param3 = $str;
  343. return;
  344. }
  345. }
  346. function signParamValidation() {
  347. global $opt;
  348. global $param1;
  349. global $param2;
  350. global $param3;
  351. global $date;
  352. global $hour;
  353. global $min;
  354. global $desc;
  355. global $captchacount;
  356. global $captchasign;
  357. global $captchaHistory;
  358. //opt!=""
  359. if ($opt!==PHP_STR) {
  360. echo("WARNING: invalid options<br>");
  361. return false;
  362. }
  363. //param1==""
  364. if ($param1!==PHP_STR) {
  365. echo("WARNING: invalid parameters<br>");
  366. return false;
  367. }
  368. //param2==""
  369. if ($param2!==PHP_STR) {
  370. echo("WARNING: invalid parameters<br>");
  371. return false;
  372. }
  373. //param3==""
  374. if ($param3!==PHP_STR) {
  375. echo("WARNING: invalid parameters<br>");
  376. return false;
  377. }
  378. //date!=""
  379. if ($date===PHP_STR || strlen($date)<4) {
  380. //echo("WARNING: invalid date<br>");
  381. return false;
  382. }
  383. /*
  384. if (APP_MODE == CALENDAR_MODE_TYPE) {
  385. if ($hour===PHP_STR || strlen($hour)>2) {
  386. //echo("WARNING: invalid hour<br>");
  387. return false;
  388. }
  389. if ($min===PHP_STR || strlen($min)>2) {
  390. //echo("WARNING: invalid min<br>");
  391. return false;
  392. }
  393. }
  394. */
  395. //place!=""
  396. if ($desc===PHP_STR || strlen($desc)<4) {
  397. //echo("WARNING: invalid desc<br>");
  398. return false;
  399. }
  400. $rescaptcha1=$captchacount>=4;
  401. $rescaptcha2=count(array_filter($captchaHistory, "odd")) > (APP_MAX_FROM_IP - 1);
  402. //if ($rescaptcha1) {
  403. // echo("WARNING: captcha expired #1<br>");
  404. //}
  405. //if ($rescaptcha2) {
  406. // echo("WARNING: captcha expired #2<br>");
  407. //}
  408. ///if ($rescaptcha1 || $rescaptcha2) {
  409. //if ($rescaptcha1) {
  410. // return false;
  411. //}
  412. return true;
  413. }
  414. function odd($val) {
  415. global $captchasign;
  416. return rtrim($val,"\n") == $captchasign;
  417. }
  418. function myExecSignCommanddis() {
  419. global $date;
  420. global $hour;
  421. global $min;
  422. global $desc;
  423. global $curPath;
  424. global $lastMessage;
  425. global $captchacount;
  426. global $captchasign;
  427. global $captchaHistory;
  428. /*
  429. if (APP_MODE == EVENTS_MODE_TYPE) {
  430. $newSign = HTMLencodeF($date,false) . "|" . HTMLencodeF($desc,false) . "|u";
  431. } else {
  432. $newSign = HTMLencodeF($date,false) . "|" . HTMLencodeF($hour.":".((strlen($min)==1)?"0".$min:$min)) . "|" . HTMLencodeF($desc,false) . "|u";
  433. }
  434. */
  435. //echo("array_filter=".count(array_filter($captchaHistory, "odd"))."<br>");
  436. //echo("new_sign?=".((hash("sha256", $newSign . APP_SALT, false) !== $lastMessage)?"true":"false")."<br>");
  437. if (hash("sha256", $newSign . APP_SALT, false) !== $lastMessage) {
  438. // Updating message history..
  439. $output = [];
  440. $output[] = $newSign . "\n";
  441. updateHistory($output, HISTORY_MAX_ITEMS);
  442. // Updating captcha history..
  443. $output = [];
  444. $output[] = $captchasign . "\n";
  445. updatecaptchaHistory($output);
  446. $lastMessage = hash("sha256", $newSign . APP_SALT, false);
  447. }
  448. }
  449. function confParamValidation() {
  450. global $opt;
  451. global $param1;
  452. global $param2;
  453. global $param3;
  454. global $signHistory;
  455. global $signHistoryDateTime;
  456. //opt!=""
  457. if ($opt!==PHP_STR) {
  458. echo("WARNING: invalid options<br>");
  459. return false;
  460. }
  461. $myval = trim($param1,"'");
  462. //param1!=""
  463. if ($myval===PHP_STR) {
  464. echo("WARNING: invalid parameters<br>");
  465. return false;
  466. }
  467. //param1 in $signHistory
  468. //if (!in_array($myval."\n",$signHistory)) {
  469. if (!in_array($myval,$signHistoryDateTime)) {
  470. echo("WARNING: invalid parameters<br>");
  471. return false;
  472. }
  473. //param2==""
  474. if ($param2!==PHP_STR) {
  475. echo("WARNING: invalid parameters<br>");
  476. return false;
  477. }
  478. //param3==""
  479. if ($param3!==PHP_STR) {
  480. echo("WARNING: invalid parameters<br>");
  481. return false;
  482. }
  483. return true;
  484. }
  485. /*
  486. function myExecConfSignCommand() {
  487. global $param1;
  488. global $signHistory;
  489. global $curPath;
  490. $mysign = trim($param1,"'");
  491. if ($signHistory) {
  492. //echo("inside myExecConfSignCommand()");
  493. $newval = left($mysign, strlen($mysign)-3) . PHP_PIPE. PHP_PIPE ."v";
  494. $key = array_search($mysign."\n", $signHistory);
  495. if ($key !== false) {
  496. $signHistory[$key] = $newval . "\n";
  497. // Writing out $signHistory on disk..
  498. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_history";
  499. file_put_contents($filepath, implode('', $signHistory));
  500. }
  501. }
  502. }
  503. */
  504. function myExecConfSignCommand() {
  505. global $param1;
  506. global $signHistory;
  507. global $curPath;
  508. global $signHistoryDateTime;
  509. $mysign = trim($param1,"'");
  510. if ($signHistory) {
  511. //echo("inside myExecConfSignCommand()");
  512. //$newval = left($mysign, strlen($mysign)-3) . PHP_PIPE . PHP_PIPE . PHP_PIPE . "v";
  513. $key = array_search($mysign, $signHistoryDateTime);
  514. if ($key !== false) {
  515. $newval = left($signHistory[$key], strlen($signHistory[$key])-5) . PHP_PIPE . PHP_PIPE . PHP_PIPE ."v";
  516. $signHistory[$key] = $newval . "\n";
  517. // Writing out $signHistory on disk..
  518. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_history";
  519. file_put_contents($filepath, implode('', $signHistory));
  520. }
  521. }
  522. }
  523. function delParamValidation() {
  524. global $opt;
  525. global $param1;
  526. global $param2;
  527. global $param3;
  528. global $signHistory;
  529. global $signHistoryDateTime;
  530. //opt!=""
  531. if ($opt!==PHP_STR) {
  532. echo("WARNING: invalid options<br>");
  533. return false;
  534. }
  535. $myval = trim($param1,"'");
  536. //param1!=""
  537. if ($myval===PHP_STR) {
  538. echo("WARNING: invalid parameters<br>");
  539. return false;
  540. }
  541. //param1 in $signHistory
  542. //if (!in_array($myval."\n",$signHistory)) {
  543. if (!in_array($myval,$signHistoryDateTime)) {
  544. echo("WARNING: invalid parameters<br>");
  545. return false;
  546. }
  547. //param2==""
  548. if ($param2!==PHP_STR) {
  549. echo("WARNING: invalid parameters<br>");
  550. return false;
  551. }
  552. //param3==""
  553. if ($param3!==PHP_STR) {
  554. echo("WARNING: invalid parameters<br>");
  555. return false;
  556. }
  557. return true;
  558. }
  559. /*
  560. function myExecDelSignCommand() {
  561. global $param1;
  562. global $signHistory;
  563. global $curPath;
  564. $mysign = trim($param1,"'");
  565. if ($signHistory) {
  566. //echo("inside myExecDelSignCommand()");
  567. $newval = left($mysign, strlen($mysign)-2) . "|u";
  568. $key = array_search($mysign."\n", $signHistory);
  569. if ($key !== false) {
  570. $signHistory[$key] = $newval . "\n";
  571. // Writing out $signHistory on disk..
  572. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_history";
  573. file_put_contents($filepath, implode('', $signHistory));
  574. }
  575. }
  576. }
  577. */
  578. function myExecDelSignCommand() {
  579. global $param1;
  580. global $signHistory;
  581. global $curPath;
  582. global $signHistoryDateTime;
  583. $mysign = trim($param1,"'");
  584. if ($signHistory) {
  585. //echo("inside myExecDelSignCommand()");
  586. //$newval = left($mysign, strlen($mysign)-2) . "|u";
  587. $key = array_search($mysign, $signHistoryDateTime);
  588. if ($key !== false) {
  589. $newval = left($signHistory[$key], strlen($signHistory[$key])-5) . PHP_PIPE . PHP_PIPE . PHP_PIPE ."u";
  590. $signHistory[$key] = $newval . "\n";
  591. // Writing out $signHistory on disk..
  592. $filepath = $curPath . DIRECTORY_SEPARATOR . ".DI_history";
  593. file_put_contents($filepath, implode('', $signHistory));
  594. }
  595. }
  596. }
  597. $password = filter_input(INPUT_POST, "Password")??"";
  598. $password = strip_tags($password);
  599. if ($password==PHP_STR) {
  600. $password = filter_input(INPUT_POST, "Password2")??"";
  601. $password = strip_tags($password);
  602. }
  603. $command = filter_input(INPUT_POST, "CommandLine")??"";
  604. $command = strip_tags($command);
  605. //$pwd = filter_input(INPUT_POST, "pwd");
  606. $hideSplash = filter_input(INPUT_POST, "hideSplash")??"";
  607. $hideSplash = strip_tags($hideSplash);
  608. $hideHCSplash = filter_input(INPUT_POST, "hideHCSplash")??"";
  609. $hideHCSplash = strip_tags($hideHCSplash);
  610. $date = filter_input(INPUT_POST, "date")??"";
  611. $date = strip_tags($date);
  612. $hour = filter_input(INPUT_POST, "hour")??"";
  613. $hour = strip_tags($hour);
  614. $min = filter_input(INPUT_POST, "min")??"";
  615. $min = strip_tags($min);
  616. $desc = filter_input(INPUT_POST, "desc")??"";
  617. $desc = strip_tags($desc);
  618. $captchasign = hash("sha256", $_SERVER["REMOTE_ADDR"] . date("Y") . APP_SALT, false);
  619. $lastMessage = filter_input(INPUT_POST, "last_message")??"";
  620. $lastMessage = strip_tags($lastMessage);
  621. $totsigns = count($signHistory);
  622. //print_r($totsigns);
  623. //exit(0);
  624. if ($totsigns > 0) {
  625. $lastMessage = hash("sha256", rtrim($signHistory[$totsigns-1],"\n") . APP_SALT, false);
  626. }
  627. $captchacount = (int)filter_input(INPUT_POST, "captcha_count")??"";
  628. $captchacount = strip_tags($captchacount);
  629. //if ($captchacount === 0) {
  630. // $captchacount = 1;
  631. //}
  632. if ($password !== PHP_STR) {
  633. $hash = hash("sha256", $password . APP_SALT, false);
  634. if ($hash !== APP_HASH) {
  635. $password=PHP_STR;
  636. }
  637. }
  638. parseCommand($command);
  639. //echo("cmd=" . $cmd . "<br>");
  640. //echo("opt=" . $opt . "<br>");
  641. //echo("param1=" . $param1 . "<br>");
  642. //echo("param2=" . $param2 . "<br>");
  643. if ($password !== PHP_STR) {
  644. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  645. if ($cmd === "sign") {
  646. $captchacount = $captchacount + 1;
  647. if (signParamValidation()) {
  648. myExecSignCommand();
  649. }
  650. } else if ($command === "refresh") {
  651. // refreshing Msg Board..
  652. }
  653. } else if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  654. if ($cmd === "del") {
  655. if (delParamValidation()) {
  656. myExecDelSignCommand();
  657. }
  658. } else if ($cmd === "conf") {
  659. if (confParamValidation()) {
  660. myExecConfSignCommand();
  661. }
  662. }
  663. } else {
  664. }
  665. $contextType = PERSONAL_CONTEXT_TYPE;
  666. } else {
  667. /*
  668. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  669. if ($cmd === "sign") {
  670. $captchacount = $captchacount + 1;
  671. if (signParamValidation()) {
  672. myExecSignCommand();
  673. }
  674. }
  675. }*/
  676. }
  677. ?>
  678. <!DOCTYPE html>
  679. <head>
  680. <meta charset="UTF-8"/>
  681. <meta name="viewport" content="width=device-width, initial-scale=0.8"/>
  682. <!--
  683. Copyright 2021, 2026 5 Mode
  684. This file is part of DropInSound.
  685. DropInSound is free software: you can redistribute it and/or modify
  686. it under the terms of the GNU General Public License as published by
  687. the Free Software Foundation, either version 3 of the License, or
  688. (at your option) any later version.
  689. DropInSound is distributed in the hope that it will be useful,
  690. but WITHOUT ANY WARRANTY; without even the implied warranty of
  691. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  692. GNU General Public License for more details.
  693. You should have received a copy of the GNU General Public License
  694. along with DropInSound. If not, see <https://www.gnu.org/licenses/>.
  695. -->
  696. <title><?php echo(APP_TITLE); ?></title>
  697. <link rel="shortcut icon" href="/favicon.ico?v=<?php echo(time()); ?>>" />
  698. <meta name="description" content="<?php echo(APP_DESCRIPTION); ?>"/>
  699. <meta name="keywords" content="<?php echo(APP_KEYWORDS); ?>"/>
  700. <meta name="author" content="5 Mode"/>
  701. <meta name="robots" content="index,follow"/>
  702. <script src="/DIS_js/jquery-3.6.0.min.js" type="text/javascript"></script>
  703. <script src="/DIS_js/common.js" type="text/javascript"></script>
  704. <script src="/DIS_js/bootstrap.min.js" type="text/javascript"></script>
  705. <script src="/DIS_js/index-js.php" type="text/javascript" defer></script>
  706. <link href="/DIS_css/bootstrap.min.css" type="text/css" rel="stylesheet">
  707. <link href="/DIS_css/style.css?r=<?PHP echo(time());?>" type="text/css" rel="stylesheet">
  708. <style>
  709. @import url('https://fonts.googleapis.com/css2?family=<?php echo(str_ireplace(" ","+",DISPLAY_DATE_FONT));?>');
  710. </style>
  711. </head>
  712. <body>
  713. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "jscheck.html")): ?>
  714. <?php include("jscheck.html"); ?>
  715. <?php endif; ?>
  716. <form id="frmDI" method="POST" action="/" target="_self" enctype="multipart/form-data">
  717. <?php if(APP_USE === "PRIVATE"): ?>
  718. <div class="header">
  719. <a id="ahome" href="http://dropin.5mode-foss.eu" target="_blank" style="color:black; text-decoration: none;"><img id="logo-hmm" src="/DIS_res/DIlogo.png" style="width:32px;">&nbsp;DropIn</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="agithub" href="https://github.com/par7133/DropIn" style="color:#000000"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="afeedback" href="mailto:posta@elettronica.lol" style="color:#000000"><span style="color:#119fe2">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="asupport" href="tel:+39-378-0812391" 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><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="" autocomplete="off"></div>
  720. </div>
  721. <?php else: ?>
  722. <div class="header2">
  723. <?php echo(APP_CUSTOM_HEADER); ?>
  724. </div>
  725. <?php endif; ?>
  726. <div style="clear:both;margin:auto">&nbsp;</div>
  727. <?php
  728. $callSideBarTOP = 1;
  729. if(APP_USE === "PRIVATE") {
  730. $callSideBarTOP = 65;
  731. }
  732. ?>
  733. <div id="call-sidebar" style="top:<?php echo($callSideBarTOP);?>px;">
  734. &nbsp;
  735. </div>
  736. <div id="sidebar">
  737. <button id="sidebar-close" type="button" class="close" aria-label="Close" onclick="closeSideBar();">
  738. <span aria-hidden="true">&times;</span>
  739. </button>
  740. <br><br>
  741. <img id="genius" src="/DIS_res/HLgenius.png" alt="HL Genius" title="HL Genius">
  742. &nbsp;<br><br>
  743. <div style="text-align:left;white-space:nowrap;">
  744. &nbsp;<input id="Password" name="Password" class="sidebarcontrol" type="password" placeholder="password" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" class="sidebarcontrol" value="<?php echo(getResource("Go", $curLocale));?>" style="width:24%; height: 25px;background-color:lightgray;color:#000000;"><br>
  745. &nbsp;<input id="Salt" class="sidebarcontrol" type="text" placeholder="salt" autocomplete="off"><br>
  746. <div style="text-align:center;">
  747. <a id="butHashMe" href="#" onclick="showEncodedPassword();"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
  748. <br><br><br>
  749. </div>
  750. </div>
  751. </div>
  752. <div id="content-bar">
  753. <div style="width:100%; padding: 8px; text-align:center; font-size:26px; border:0px solid red;">
  754. <br>
  755. <?php if (APP_DEFAULT_CONTEXT === "PRIVATE"): ?>
  756. <div id="content-header">
  757. <?php if ($contextType === PUBLIC_CONTEXT_TYPE): ?>
  758. <div id="guest-msg"><h1><?php echo(APP_GUEST_MSG??"&nbsp;"); ?></h1></div>
  759. <?php else: ?>
  760. <div class="dragover" dropzone="copy" style="min-width:630px;">
  761. <div id="drop-img">
  762. <div id="fireupload" onclick="$('#files').click()">
  763. <img src="/DIS_res/dnd2.gif">
  764. </div>
  765. </div>
  766. <div id="template-img">
  767. <div id="templated">
  768. <a href="/template.mp3"><img src="/DIS_res/template.png"></a>
  769. </div>
  770. </div>
  771. <input id="files" name="files[]" type="file" accept=".txt" style="display:none;" multiple>
  772. <input type="hidden" id="t" name="t">
  773. <div id="welcome-msg"><h1><span id="page-title"><?php echo(APP_WELCOME_MSG??"&nbsp;"); ?></span></h1></div>
  774. <div style="clear:both;margin:auto;"><br></div>
  775. <input type="hidden" name="msg-sign" value="<?php echo($gdate . PHP_PIPE . PHP_PIPE . PHP_PIPE . $gtime); ?>">
  776. <hr>
  777. <br>
  778. </div>
  779. <?php showHistory(); ?>
  780. <?php endif; ?>
  781. <?php else: ?>
  782. <div id="content-header">
  783. <?php if ($contextType === PUBLIC_CONTEXT_TYPE): ?>
  784. <div class="dragover" dropzone="copy" style="min-width:630px;">
  785. <div id="drop-img">
  786. <div id="fireupload" onclick="$('#files').click()">
  787. <img src="/DIS_res/dnd2.gif">
  788. </div>
  789. </div>
  790. <div id="template-img">
  791. <div id="templated">
  792. <a href="/template.mp3"><img src="/DIS_res/template.png"></a>
  793. </div>
  794. </div>
  795. <input id="files" name="files[]" type="file" accept=".txt" style="display:none;" multiple>
  796. <input type="hidden" id="t" name="t">
  797. <div id="welcome-msg"><br><h1><span id="page-title"><?php echo(APP_WELCOME_MSG??"&nbsp;"); ?></span></h1></div>
  798. <div style="clear:both;margin:auto;"><br></div>
  799. <input type="hidden" name="msg-sign" value="<?php echo($gdate . PHP_PIPE . PHP_PIPE . PHP_PIPE . $gtime); ?>">
  800. <hr>
  801. <div style="clear:both;float:right;margin-right:5%;margin-bottom:30px;">
  802. <input id="txtSearch" name="q" type="text" class="search-control" value="<?PHP echo($q); ?>">
  803. </div>
  804. </div>
  805. <br><br><br><br>
  806. <?php showHistory(); ?>
  807. <?php else: ?>
  808. <div class="dragover" dropzone="copy" style="min-width:630px;">
  809. <div id="drop-img">
  810. <div id="fireupload" onclick="$('#files').click()">
  811. <img src="/DIS_res/dnd2.gif">
  812. </div>
  813. </div>
  814. <div id="template-img">
  815. <div id="templated">
  816. <a href="/template.mp3"><img src="/DIS_res/template.png"></a>
  817. </div>
  818. </div>
  819. <input id="files" name="files[]" type="file" accept=".txt" style="display:none;" multiple>
  820. <input type="hidden" id="t" name="t">
  821. <div id="welcome-msg"><h1><span id="page-title"><?php echo(APP_WELCOME_MSG??"&nbsp;"); ?></span></h1></div>
  822. <div style="clear:both;margin:auto;"><br></div>
  823. <input type="hidden" name="msg-sign" value="<?php echo($gdate . PHP_PIPE . PHP_PIPE . PHP_PIPE . $gtime); ?>">
  824. <hr>
  825. <br>
  826. </div>
  827. <?php showHistory(); ?>
  828. <?php endif; ?>
  829. <?php endif; ?>
  830. <div style="clear:both;margin:auto;"><br><br><br><br><br></div>
  831. <?php if(APP_USE === "BUSINESS"): ?>
  832. <div id="footer2">
  833. <a id="ahome" href="http://dropinsound.5mode-foss.eu" target="_blank" style="color:black;"><img id="logo-hl" src="/DIS_res/DIlogo.png">Powered by DropInSound</a>
  834. </div>
  835. <?php endif; ?>&nbsp;
  836. </div>
  837. </div>
  838. <input type="hidden" id="CommandLine" name="CommandLine">
  839. <input type="hidden" name="hideSplash" value="<?php echo($hideSplash); ?>">
  840. <input type="hidden" name="hideHCSplash" value="1">
  841. <input type="hidden" name="captcha_count" value="<?php echo($captchacount); ?>">
  842. <input type="hidden" name="last_message" value="<?php echo($lastMessage); ?>">
  843. </form>
  844. <div class="footer">
  845. <div id="footerCont">&nbsp;</div>
  846. <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 <span class="no-sm">and <a href="http://wysiwyg.systems">WYSIWYG</a> system</span>. CC&nbsp;&nbsp;</span></div>
  847. </div>
  848. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "skinner.html")): ?>
  849. <?php include("skinner.html"); ?>
  850. <?php endif; ?>
  851. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  852. <?php include("metrics.html"); ?>
  853. <?php endif; ?>
  854. </body>
  855. </html>