Prechádzať zdrojové kódy

Add files via upload

Daniele Bonini (皮夕): WebDev and DevOps by lots of Sim.pli.city bits 3 rokov pred
rodič
commit
7835f1078c

+ 35 - 0
Private/scripts/footer.php

@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of MacSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * footer.php
+ * 
+ * Footer page.
+ * 
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+?>
+    
+ </div>
+
+ <div class="footer" style="height: auto;"><!-- Here is the content of the footer --></div>
+ 
+ </body>
+</html>

+ 49 - 0
Private/scripts/footerContent.php

@@ -0,0 +1,49 @@
+<?php
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of MacSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * footerContent.php
+ * 
+ * Content of the footer.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+
+use fivemode\fivemode\Page;
+
+?>
+
+<?php
+  define("SCRIPT_NAME_FOOTER", pathinfo(__FILE__, PATHINFO_FILENAME));
+
+?>  
+
+<div id="footerCont">&nbsp;</div>
+<div id="footer"><span style="background:#FFFFFF;opacity:0.7;">&nbsp;&nbsp;A <a id="linkOpenGallery" href="http://5mode.com">5 Mode</a> project and <a href="http://demo.5mode.com">WYSIWYG</a> system. Some rights reserved.</span></div>
+
+</div>
+
+
+<?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
+<?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?> 
+<?php endif; ?>
+
+
+   <?php Page::displayJSBuffer(); ?>
+ 

+ 55 - 0
Private/scripts/getxml.php

@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of MacSwap.
+ *
+ * MacSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * MacSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with MacSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * getxml.php
+ * 
+ * Read an xml file from the data folder.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+
+header("Content-type: text/xml");
+
+//
+// PARAMETER VALIDATION
+//
+$filename = filter_input(INPUT_GET, "f");
+$filename2 = $filename . ".xml";
+
+//if (preg_match("/snip\d\d\d/", $filename)) {
+//  $filename = $filename . ".xml";
+//} else {
+//  exit(0);
+//}
+
+//if (is_readable(APP_DATA_PATH . PHP_SLASH . $filename)) {
+//  $filepath = APP_DATA_PATH . PHP_SLASH . $filename;
+//} else {
+//  exit(0);
+//}
+
+if (is_readable(APP_DATA_PATH . PHP_SLASH . $filename)) {
+  $filepath = APP_DATA_PATH . PHP_SLASH . $filename . PHP_SLASH . $filename2;
+} else {
+  exit(0);
+}
+
+echo(file_get_contents($filepath));

+ 130 - 0
Private/scripts/header.php

@@ -0,0 +1,130 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of SnipSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ * 
+ * header.php
+ * 
+ * Header page.
+ * 
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode     
+ */
+
+use fivemode\fivemode\Page;
+use fivemode\fivemode\Session;
+
+Page::clearJSBuffer();
+
+
+//if (User::issetInstance()) {
+//  $user = &User::getInstance();
+//  $attrLang = $user->getLanguage();
+//} else {
+  $attrLang = Session::get("lang", APP_DEF_LANG);
+//}
+
+?>
+ 
+<!DOCTYPE html>
+<html lang="<?php echo $attrLang;?>" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	
+  <meta charset="UTF-8"/>
+    
+  <meta name="viewport" content="width=device-width, initial-scale=1"/>
+  
+<!--
+<?php echo APP_LICENSE; ?>
+-->
+  
+  <?php 
+    if (defined("PAGE_TITLE")) {
+      $pageTitle = PAGE_TITLE;
+    } else {  
+      $pageTitle = APP_NAME;
+    }  
+  ?>
+  
+  <title><?php echo $pageTitle; ?></title>
+
+  <link rel="shortcut icon" href="/favicon.ico?v=<?php echo time();?>" />
+
+  <?php
+    if (defined("PAGE_DESCRIPTION")) {
+      $pageDescription = PAGE_DESCRIPTION;
+    } else {  
+      $pageDescription = "The 404 error's place.";
+    }
+  ?>  
+	<meta name="description" content="<?php echo $pageDescription; ?>"/>
+  <?php 
+    $customKeywords = "";
+    $pageKeywords = $pageTitle . PHP_SPACE . strtolower(str_replace(".", PHP_STR, $pageDescription)) . PHP_SPACE . $customKeywords . PHP_SPACE . APP_NAME;
+    $pageKeywords = str_replace(PHP_HYPHEN, PHP_SPACE, $pageKeywords);
+    $pageKeywords = str_replace(PHP_SPACE, ",", $pageKeywords);
+    $pageKeywords = str_replace(",,,", ",", $pageKeywords);
+    $pageKeywords = str_replace(",,", ",", $pageKeywords);
+    //$pageKeywords = str_replace(".", PHP_STR, $pageKeywords);
+  ?>
+  <meta name="keywords" content="<?php echo $pageKeywords;?>"/>
+  <meta name="author" content="5 Mode"/> 
+  
+  <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
+    <script src="/js/common.js?v=<?php echo time();?>" type="text/javascript"></script>
+   <script src="/js/bootstrap.min.js" type="text/javascript"></script>
+  <script src="/js/sha.js" type="text/javascript"></script>
+  <script src="/js/htmlencode.js" type="text/javascript"></script>
+  <script src="/js/serialize-javascript.js" type="text/javascript"></script>
+  
+  <script src="/js/<?php echo SCRIPT_NAME; ?>.js" type="text/javascript" defer></script>
+  
+  <?php if (SCRIPT_NAME === "home"): ?>
+  <script src="/js/cube-code.js" type="text/javascript"></script>
+  <script src="/js/dragndrop-code.js" type="text/javascript"></script>
+  <?php endif; ?>
+  
+  <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
+  <link href="/css/style.css?v=<?php echo time();?>" type="text/css" rel="stylesheet">
+    
+  <script>
+    <?php if (!stripos(APP_SCRIPTS_WITHOUT_HEADER, "|". SCRIPT_NAME . "|")): ?>
+      window.addEventListener("load", function() {
+        loadPageHeader("<?php echo SCRIPT_NAME; ?>", "<?php echo urlencode($q); ?>", "<?php echo urlencode($catMaskedPath); ?>", "<?php echo $platform; ?>");  
+        loadPageFooter("<?php echo SCRIPT_NAME; ?>");
+      }, true);
+    <?php endif; ?>
+  </script>    
+    
+</head>
+
+  <body>
+
+ <div id="HCsplash" style="padding-top: 40px; text-align:center;color:#d4b0dc;font-family:'Bungee Hairline';">
+    <div id="myh1" style="position:relative; top:80px;"><H1>SnipSwap</H1></div><br><br><br><br>
+    <img src="/res/code.png" style="width:310px;">
+</div>
+
+  <div class="header2" style="margin-top:18px; margin-bottom:18px; color:#000000; display:none;">
+    &nbsp;&nbsp;<a href="http://snipswap.org" target="_self" style=" text-decoration: none;"><img src="/res/code.png" style="width:25px;">&nbsp;SnipSwap</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/SnipSwap" style=""><span style="">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@snipswap.org" style=""><span style="">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:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>&nbsp;&nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="new password" style="font-size:11px;">&nbsp;&nbsp;<a href="#" onclick="showEncodedPassword();" style="position:relative; left:0px; top:0px; font-size:13px; font-weight:900; color:green;"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
+ </div>     
+     
+  <div class="body-area">
+
+  <div class="header" style="height: fit-content; min-height: 250px;"><!-- Here is the content of the header --></div>
+  

+ 243 - 0
Private/scripts/headerContent.php

@@ -0,0 +1,243 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of MacSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * headerContent.php
+ * 
+ * headerContent file.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+
+use fivemode\fivemode\CatUtil;
+
+
+// VARIABLES AND FUNCTION DECLARATIONS
+
+settype($q, "string");
+
+// PARAMETERS VALIDATION AND NORMALIZATION
+
+$q = (string)substr((string)filter_input1(INPUT_GET, "q", FILTER_SANITIZE_QM), 0, 100);
+$catMaskedPath = (string)substr((string)filter_input(INPUT_GET, "catMaskedPath", FILTER_SANITIZE_STRING), 0, 100);
+$platform = (string)substr((string)filter_input(INPUT_GET, "platform", FILTER_SANITIZE_STRING), 0, 1);
+
+$styleTag = PHP_STR;
+
+$cat1=PHP_STR;
+$cat2=PHP_STR;
+$cat3=PHP_STR;
+$aCats=explode(PHP_TILDE, $catMaskedPath);
+if(isset($aCats[0]) && ($aCats[0]!=="*")){
+  $cat1=$aCats[0];
+}
+if(isset($aCats[1])){
+  $cat2=$aCats[1];
+}
+if(isset($aCats[2])){
+  $cat3=$aCats[2];
+}
+
+//echo("catMaskedPath=" . $catMaskedPath . "<br>");
+//echo("cat1=" . $cat1 . "<br>");
+//echo("cat2=" . $cat2 . "<br>");
+//echo("cat3=" . $cat3 . "<br>");
+
+$aCats1 = CatUtil::getCatsList();
+
+$aCats2 = CatUtil::getSubCatsList($cat1);
+
+?>
+
+<script>
+
+  // show/hide the image preview of the search results  
+  //var bHideResultsPreview = false; 
+
+  $(document).ready(function() {
+
+    $("div#linkOpenGallery").on("click", function (e) {
+      e.preventDefault();
+      e.stopPropagation();
+      window.open("http://5mode.com","_blank");
+    });
+
+  }); 
+
+  //
+  // SEARCH FORM
+  //
+  $(document).ready(function() {
+
+    $("#cbCategory1").on("change", function() {
+      if ($(this).val() === "") {
+        $("#cbCategory2").val("");
+        window.open("/<?php echo($platform);?>/*", "_self");
+      } else {
+        window.open("/<?php echo($platform);?>/" + $(this).val(), "_self");
+      }
+    });
+
+    $("#cbCategory2").on("change", function() {
+      if ($(this).val() !== "") {
+        if ($("#cbCategory1").val()!=="") {
+          window.open("/<?php echo($platform);?>/" + $(this).val().replace("~","/"), "_self");
+        }  
+      } else {
+        window.open("/<?php echo($platform);?>/" + $("#cbCategory1").val(), "_self");
+      }
+    });
+
+    $("input#q").on("keydown",function(e) {
+      key = e.which;
+      if (key===13) {
+        e.preventDefault();
+        $("#butSearch-addon").click();
+      } 
+    });  
+    
+    $("#butSearch-addon").on("click",function(e) {
+      e.preventDefault();
+      //filterKeysQ(document.getElementById("q"));
+      if ($("input#q").val()!=="") {
+        //frmSearch.submit();  
+        if ($("#cbCategory2").val() !== "") {
+          if ($("#cbCategory1").val()!=="") {
+            if ($("input#q").val()!=="") {
+              window.open("/<?php echo($platform);?>/" + $("#cbCategory2").val().replace("~","/") + "?q=" + $("input#q").val(), "_self");
+            } else {
+              window.open("/<?php echo($platform);?>/" + $("#cbCategory2").val().replace("~","/"), "_self");
+            }  
+          }  
+        } else if ($("#cbCategory1").val() !== "") {
+          if ($("input#q").val()!=="") {
+            window.open("/<?php echo($platform);?>/" + $("#cbCategory1").val() + "?q=" + $("input#q").val(), "_self");
+          } else {
+            window.open("/<?php echo($platform);?>/" + $("#cbCategory1").val(), "_self");
+          }  
+        } else {  
+          window.open("/<?php echo($platform);?>/*" + "?q=" + $("input#q").val(), "_self");
+        }
+      }  
+    });
+    
+  });
+   
+</script>
+
+<div class="header" style="height: fit-content;" role="navigation" align="center">
+
+  <?php 
+
+      $GET_SCRIPT_NAME = basename(filter_input(INPUT_GET, "SCRIPT_NAME"));
+
+      if (stripos(APP_SCRIPTS_WITHOUT_SEARCH_MENU, "|". $GET_SCRIPT_NAME . "|") || (mb_strrchr($GET_SCRIPT_NAME, PHP_UNDERSCORE, false) === "_a")) { 
+  ?>
+                            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-strd">
+                              <table class="header-table" align="center">
+                                <tr>
+                                  <td class="col-burger-menu-icon">
+                                      <div id="burgerMenuIco" onclick="popupMenu()" style="position: relative; left:0px; border:0px solid blue; width: 48px; display:none;"><a id="aBurger-Menu" class="navbar-brand-nml" href="#" title="Tap here for options"><img src="/res/burger-menu2.png" width="42px"></a></div>
+                                      <div id="logo-div" style="width:180px; position:relative; top:-52; margin-left:46%; color:#ed6a43;"><a href="/" style="color:#ed6e48;font-size:30px;font-style:italic;font-weight:900;"><?php echo(strtoupper(APP_NAME));?></a></div> 
+                                  </td>    
+                                </tr>
+                              </table>
+                            </div>
+  
+  <?php } else { ?>
+
+                          <div class="col-strd">
+
+                            <table class="col-xs-12 col-sm-10 col-md-10 col-lg-10 header-table" align="center">
+                              <tr>
+                                <td class="col-burger-menu-icon">
+                                   <div id="burgerMenuIco" onclick="popupMenu()" style="position: absolute; left:+10px; top:+4px; border:0px solid blue; width: 46px; display:none;"><a id="aBurger-Menu" class="navbar-brand-nml" href="#" title="Tap here for options"><img src="/res/burger-menu2<?php echo($styleTag);?>.png" width="42px"></a></div>
+                                </td>    
+                                <td align="left" style="text-align:center;">
+
+                                    <div id="logo-div" style="width:180px; position:relative; top:-55; left:-44px; margin-left:46%; color:#ed6a43;"><a href="/" style="color:#ed6e48;font-size:30px;font-style:italic;font-weight:900;"><!--<?php echo(APP_NAME);?>--></a></div>
+                                  
+                                      <form id="frmSearch" style="width:200px; float:left; position:relative; top:+15px; left:+25px; " role="search" method="get" action="/search" target="_self">
+                                                                           
+                                                <select id="cbCategory1" class="form-control input-search" style="width:200px; position:relative; top:+1px;">
+                                                    <option value=""></option>
+                                                    <?php foreach($aCats1 as $cat) { ?>
+                                                    <option value="<?php echo($cat);?>" <?php echo($cat1 === $cat ? "selected": "");?>><?php echo($cat);?></option>
+                                                    <?php } ?>
+                                                </select> 
+
+                                                <br>
+
+                                                <select id="cbCategory2" class="form-control input-search" style="width:200px; position:relative; top:-10px;">
+                                                    <option value=""></option>
+                                                    <?php foreach($aCats2 as $cat) { 
+                       $ipos=strripos($cat, PHP_TILDE);            
+                       $displayText=substr($cat,$ipos+1); ?>
+                                                    <option value="<?php echo($cat);?>" <?php echo($cat2 === strtolower($displayText) ? "selected": "");?>><?php echo($displayText);?></option>
+                                                    <?php } ?>
+                                                </select> 
+                                        
+                                               <div class="input-group">
+
+                                                  <input id="q" name="q" type="search" class="form-control input-search" style="font-style: italic;" value="<?php echo $q;?>" maxlength="100" placeholder="SEARCH" title="Type here the search text" autocomplete="off" spellcheck="false" aria-describedby="butSearch-addon">
+                                                  <span id="butSearch-addon" class="input-group-addon btn-search-addon btn-blue" title="Search"><span class="glyphicon glyphicon-search"></span></span>
+
+                                                </div>
+                                        
+                                      </form> 
+                                    
+                                    <div id="form-ori-sep1" style="display:none;"><br><br></div>
+                                    
+                                     <img id="form-vert-bar" src="/res/pxl.gif" style="width:1px;height:160px;float:left;position:relative;left:+55px;background-color:gray;">
+                                    
+                                     <div id="catList" style="width:70%;float:left;position:relative;top:14px;left:75px;">
+                                      <?php
+                    $i=1;                   
+                    if ($cat1===PHP_STR) {
+                      foreach($aCats1 as $cat) { ?>
+                                                              <div id="linkCat<?php echo($i);?>" class="cat-div"><a href="/<?php echo($platform);?>/<?php echo($cat);?>"><?php echo($cat);?></a></div>
+                                                            <?php $i++; ?>  
+                                            <?php } ?>
+                                      <?php } else if ($cat2===PHP_STR) {
+                      if (Empty($aCats2)) {
+                        echo("<div  class=\"cat-div\" style=\"width:200px;background-color:transparent;\">no subcat found.</div>");
+                      } else {                 
+                        foreach($aCats2 as $cat) { 
+                          $ipos=strripos($cat, PHP_TILDE);            
+                          $displayText=substr($cat,$ipos+1); 
+                          $link=PHP_SLASH . $platform . PHP_SLASH . str_replace(PHP_TILDE, PHP_SLASH, $cat);?>
+                                                                <div id="linkCat<?php echo($i);?>" class="cat-div"><a href="<?php echo($link);?>"><?php echo($displayText);?></a></div>
+                                                                <?php $i++; ?>
+                                                <?php } ?>
+                                           <?php } ?>                    
+                                     <?php } else { 
+                      echo("<div  class=\"cat-div\" style=\"width:200px;background-color:transparent;\">no subcat found.</div>");
+                    } ?>
+                                     </div>
+                                     
+                                </td>
+                              </tr>
+                            </table>
+
+                          </div>
+
+  <?php } ?>
+
+</div>

+ 372 - 0
Private/scripts/home.php

@@ -0,0 +1,372 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of SnipSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * home.php
+ * 
+ * Page Home.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+
+use fivemode\fivemode\LinkUtil;
+
+
+define('PAGE_TITLE', "SnipSwap - Home");
+
+
+function echo_label(string $label) {
+  if (mb_strlen($label) > 25) {
+    echo(left($label, 25) . "...");
+  } else {
+    echo($label);
+  }
+}
+
+$q = (string)substr((string)filter_input1(INPUT_GET, "q", FILTER_SANITIZE_QM), 0, 100);
+$splash = filter_input(INPUT_GET, "splash");
+
+$curLocale = APP_LOCALE;
+
+?>
+
+<script>
+<?PHP if ($splash === "1"):?>
+  firstaccess = 1; 
+<?PHP else: ?> 
+  firstaccess = 0; 
+<?PHP endif ?> 
+
+</script>
+
+<?php require APP_SCRIPT_PATH . "/header.php";?>
+
+<div id="linkContainer" style="margin-top:3%;margin-left:5%;margin-bottom:3%;margin-right:5%;min-height:400px;border:0px solid red;" cat="<?PHP echo($catMaskedPath);?>" ondragover="onDragOver(event);" ondrop="onDrop(this, event);">
+<?php 
+  //echo($q."=q***"); 
+  //echo($catMaskedPath."=cat***"); 
+
+  $allLinks = LinkUtil::getLinkList(PHP_STR, "*");
+
+  $iLinkjs = 1;  
+  $myCubeInitjs= "";
+  foreach($allLinks as $ainallLink) {
+    $newFormalName = $ainallLink['name'];
+    $myCubeInitjs .= "cubes[" . $iLinkjs . "-1] = new myCube( 'Snip#". $iLinkjs . "', '" . $newFormalName . "', '" . APP_HOST . "');\n";
+    $myCubeInitjs .= "cubes[" . $iLinkjs . "-1].start();\n";
+    $iLinkjs++; 
+  }
+
+  $myCubeInitjs .= "totcubes=" . count($allLinks) . ";\n"; 
+  
+  $aLinks = LinkUtil::getLinkList($q, $catMaskedPath);
+  
+  $iLink = 0;  
+  foreach($aLinks as $aLink) { 
+    
+    $order = 1; 
+    foreach ($allLinks as $ainallLink) {
+      if ($ainallLink['name'] === $aLink['name']) {
+        break; 
+      }
+      $order++;
+    }
+    
+    ?>
+    
+                     <div class="link-div" style="width:250px; float:left; padding: 10px; margin:5px;" title="<?php echo($aLink['desc']); ?>" order="<?PHP echo($order);?>" onclick="selCube(this);openDetail()" draggable="true" ondragstart="onDragStart(this, event);" onmouseover="onMouseOver();">
+                           <div style="color:#ed6a43; padding-bottom:8px;"><?php echo($aLink['title']); ?></div>
+                           <a href="#"><img src="/res/code.png" style="width:232px; height:124px; border:1px solid darkgray;" alt="<?php echo($aLink['title']); ?>"></a><br>
+                           &nbsp;<a style="font-style:italic; color:green; font-size:10px; padding-top:5px;" href="http://<?php echo(str_replace(PHP_TILDE, PHP_SLASH, $aLink['link']));?>"><?php echo_label(str_replace(PHP_TILDE, PHP_SLASH, $aLink['label']));?></a><br>
+                     </div>
+ 
+      <?php 
+           
+      $iLink++;
+  
+   } ?>
+ 
+ <?php 
+  if (Empty($aLinks)) {
+    echo("<div class=\"no-link\" style=\"width:250px; float:left; padding: 10px;\">no link found</div>");    
+  }
+ ?>
+  
+</div>
+
+<?PHP echo("<script>$myCubeInitjs</script>"); ?>
+
+                    <button id="modalButton1" type="button" class="btn btn-primary" style="display:none;" data-toggle="modal" data-target="#modal1">Button #1</button>
+
+                    <div class="modal" tabindex="-1" role="dialog" id="modal1">
+                      <div class="modal-dialog modal-lg" role="document" style="width:80%;background-color:#FFFFFF;">
+                        <div class="modal-content" style="float:left;width:90%; height:90%;">
+                          <img src="/res/code.png" style="width:98%; vertical-align:top; opacity:0.2"></a>
+                          <div style="position:absolute; top:10px; padding:50px;">
+                             <table style="width:100%">
+                              <tr>  
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Title:&nbsp;</td><td width="700px"><input id="snip-detail-title" name="txtTitle" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                             </tr>
+                             <tr>  
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Description:&nbsp;</td><td width="700px"><input id="snip-detail-desc" name="txtDesc" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                             </tr>
+                             <tr>
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Code:&nbsp;</td><td width="700px"><textarea id="snip-detail-code" class="snip-code" name="txtCode" style="width:98%;max-width:750px;height:350px;max-height:350px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></textarea></td>
+                              </tr>
+                             <tr>
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Tags:&nbsp;</td><td width="700px"><input id="snip-detail-tags" name="txtTags" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                              </tr>
+                              <tr>  
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Label (link):&nbsp;</td><td width="700px"><input id="snip-detail-label" name="txtLabel" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                             </tr>
+                              <tr>  
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Link:&nbsp;</td><td width="700px"><input id="snip-detail-link" name="txtLink" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                             </tr>
+                              <tr>  
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Email:&nbsp;</td><td width="700px"><input id="snip-detail-email" name="txtEmail" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly></td>
+                             </tr>
+                             <tr>
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Cats:&nbsp;</td><td width="700px" style="padding-top:8px;font-weight:900;"><input id="snip-detail-cats" name="txtCats" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="storeData(this)" readonly><br><span style="font-size:10px;border-top:8px solid transparent;">space separated snip categories, "~" for subcategories.</span></td>
+                              </tr>
+                              <tr style="display: none;">
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Guid:&nbsp;</td><td width="700px"><input id="snip-detail-guid" name="txtGuid" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" readonly></td>
+                              </tr>
+                              <tr>
+                                <td style="width:100px;text-align:right;padding:10px;font-weight:900;">Password:&nbsp;</td><td width="700px"><input id="snip-detail-password" name="txtPassword" type="text" value="" style="width:98%;max-width:550px;font-weight:900;font-size:15px;border:2px solid #000000;" onkeyup="checkPwd(this)"></td>
+                              </tr>
+                             </table>
+                             <input type="hidden" id="comp-pwd" value="">
+                           </div> 
+                        </div>
+                        <div class="modal-toolbox" style="float:left;">
+                          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>   
+                        </div>   
+                      </div>  
+                    </div> 
+
+<script>
+  
+/*
+  * Interaction code
+  */
+ 
+  var oldtthis; // Old cube
+
+  var lineOldVal = ""; // Old value for a detail line
+  var lineNewVal = ""; // New value for a detail line
+
+  var dataChanged = false;
+
+  /*
+   * Select the given cube 
+   * 
+   * @param <interfaceEl> selected cube
+   * @returns void
+   */
+  function selCube(tthis) {    
+
+    _selCube(tthis);
+
+  } 
+
+  function checkPwd(tthis) {
+    if (encryptSha2($(tthis).val()) === $("#comp-pwd").val()) {
+      $("#snip-detail-title").prop("readonly", false);
+      $("#snip-detail-desc").prop("readonly", false);
+      $("#snip-detail-code").prop("readonly", false);
+      $("#snip-detail-tags").prop("readonly", false);
+      $("#snip-detail-label").prop("readonly", false);
+      $("#snip-detail-link").prop("readonly", false);
+      $("#snip-detail-email").prop("readonly", false);
+      $("#snip-detail-cats").prop("readonly", false);
+    }  
+  }  
+
+  /*
+   * Get the data for the given detail / face
+   * 
+   * @param string xmlStr, the current cube xml data
+   * @param string detail, the requested detail
+   * @returns string, the detail data 
+   */
+  function getDetailData(xmlStr, detail) {
+
+    var ret = "";
+    var re;
+
+    detail = detail.toLowerCase();
+
+    xmlStr = xmlStr.replace('<?xml version="1.0" encoding="UTF-8"?>',"");
+    xmlStr = xmlStr.replace('<details>',"");
+    xmlStr = xmlStr.replace('</details>',"");
+    xmlStr = xmlStr.replaceAll('\n',"|||999");
+    xmlStr = xmlStr.replaceAll(String.fromCharCode(9), "");
+    xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "|||999");
+    xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "|||999");
+    xmlStr = xmlStr.replaceAll("   ", "");
+    xmlStr = xmlStr.replaceAll("  ", "");
+    xmlStr = escape(xmlStr);
+    //xmlStr = xmlStr.replaceAll('\n',"|99");
+    //xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "|99");
+    //xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "|99");
+    xmlStr = xmlStr.replaceAll("%0A", "");
+    xmlStr = xmlStr.replaceAll("%20%20%20%20%20", "");
+    xmlStr = xmlStr.replaceAll("%20%20%20%20%", "");
+    xmlStr = xmlStr.replaceAll("%20%20%", "");
+    //xmlStr = unescape(xmlStr);
+    //alert("xmlStr="+xmlStr);
+
+    switch (detail) {
+      case "snippet":
+        re = new RegExp("detail%20face%3D%22snippet%22.+/cats", "igsu");
+        break;
+      case "contacts":
+        re = new RegExp("detail%20face%3D%22contacts%22.+/email", "igsu");
+        break;
+      case "other info":
+        re = new RegExp("detail%20face%3D%22other%20info%22.+/guid", "igsu");
+        break;
+      case "password":
+        re = new RegExp("detail%20face%3D%22password%22.+/password", "igsu");
+        break;
+    }        
+    s = re.exec(xmlStr);
+    if (!s || s.length===0) {
+      //ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error! #1";
+      alert("Error#1");
+      return ret;
+    }
+    xmlStr = s[0];
+    xmlStr = "<"+xmlStr+"></detail>";
+    xmlStr = unescape(xmlStr);
+    //alert(xmlStr);
+    const parser = new DOMParser();
+    const doc = parser.parseFromString(xmlStr, "text/xml");
+    x = doc.getElementsByTagName("detail");
+    if (x.length===0) {
+      //ret = "Error! #2";
+      alert("Error#2");
+      return ret;
+    }
+    //ret += "<div style='padding:10px;'>";
+    for (i = 0; i < x[0].childNodes.length; i++) {
+      if (x[0].childNodes[i].nodeType === 1) {
+        
+        if (x[0].childNodes[i].nodeName === "code") {
+          document.getElementById("snip-detail-" + x[0].childNodes[i].nodeName).innerHTML = htmlEncode(x[0].childNodes[i].textContent);
+        } else if (x[0].childNodes[i].nodeName === "password") {
+          document.getElementById("comp-pwd").value = htmlEncode(x[0].childNodes[i].textContent);
+        } else {
+          //alert(x[0].childNodes[i].nodeName);
+          document.getElementById("snip-detail-" + x[0].childNodes[i].nodeName).value = x[0].childNodes[i].textContent;
+        }
+        
+      }  
+    }
+    //if ((detail==="pictures") || (detail==="menu")) {
+    //  ret += "<div style='padding-left:80px;clear:both;'><br>you can use eg. Goolge Drive or Microsoft OneDrive to host your pictures.</div>"
+    //}
+    //ret += "</div>";
+    return ret;
+  }  
+  
+
+  /*
+   * Store in the cube object the new data of the text control
+   * 
+   * @param {InterfaceEl} tthis, the text control under editing
+   * @returns void     
+   */ 
+  function storeData(tthis) {
+
+    lineNewVal = $(tthis).val();
+    //alert(lineNewVal);
+
+    nodeName = tthis.id;
+    nodeName = nodeName.replace("snip-detail-","");
+    //alert(nodeName);
+
+    xmlStr = curcube.getxml();
+    //$("#log").html($("#log").html() + "old=" + "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs" + "\n");
+    //$("#log").html($("#log").html() + "new=" + lineNewVal + "\n");
+    //alert("<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
+    //re = "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs";
+
+    switch (nodeName) {
+      case "title":
+        re = /(\<title>).*(\<\/title>)/gs;
+        break;
+      case "desc":
+        re = /(\<desc>).*(\<\/desc>)/gs;
+        break;      
+      case "code":
+        re = /(\<code>\<\!\[CDATA\[).*(\]\]\>\<\/code>)/gs;
+        break;
+      case "tags":
+        re = /(\<tags>).*(\<\/tags>)/gs;
+        break;
+      case "cats":
+        re = /(\<cats>).*(\<\/cats>)/gs;
+        break;
+      case "label":
+        re = /(\<label>).*(\<\/label>)/gs;
+        break;
+      case "link":
+        re = /(\<link>).*(\<\/link>)/gs;
+        break;
+      case "email":
+        re = /(\<email>).*(\<\/email>)/gs;
+        break;
+    }  
+
+    xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2");
+    //xmlStr = xmlStr.replace("<" + nodeName + ">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
+    //alert(xmlStr);
+
+    curcube.xml = xmlStr;
+
+    dataChanged = true;
+  }
+
+  function _saveData() {
+    if (dataChanged) {
+      curcube.savedata();
+      dataChanged = false;
+    }  
+  }  
+
+  setInterval("_saveData()", 1500);
+
+  /*
+   * Display the given data detail
+   * 
+   * @param <interfaceEl> selected cube
+   * @returns void
+   */
+  function openDetail() {
+    //alert(curcube.getxml());
+    myhtml = getDetailData(curcube.getxml(), "snippet") + getDetailData(curcube.getxml(), "contacts") + getDetailData(curcube.getxml(), "other info") + getDetailData(curcube.getxml(), "password");
+    $('#modalButton1').click();      
+  }
+
+</script>  
+
+ <?php require APP_SCRIPT_PATH . "/footer.php";?>
+

+ 81 - 0
Private/scripts_ajax/putxml.php

@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of MacSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * putxml.php
+ * 
+ * Write an xml file in the data folder.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ */
+
+//
+// VARIABLES AND FUNCTIONS DECLARATIONS
+//
+
+
+//
+// PARAMETER VALIDATION
+//
+$filename = filter_input(INPUT_POST, "f");
+$filename2 = $filename . ".xml";
+
+$xmlStr = filter_input(INPUT_POST, "xml");
+
+
+// if the snip data folder doesn'exist I create it
+// with all the subfolders..
+if (!is_readable(APP_DATA_PATH . PHP_SLASH . $filename)) {
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename);
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "title");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "desc");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "code");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "cats");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "tags");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "label");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "link");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "email");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "guid");
+  mkdir(APP_DATA_PATH . PHP_SLASH . $filename. PHP_SLASH . "data". PHP_SLASH . "password");
+}
+
+
+// Saving the XML file..
+$filepath = APP_DATA_PATH . PHP_SLASH . $filename . PHP_SLASH . $filename2;
+file_put_contents($filepath, $xmlStr);
+
+
+
+// Saving filesystem version of the data..
+$details = new SimpleXMLElement($xmlStr);
+
+storeFSData($details, $filename, "title");
+storeFSData($details, $filename, "desc");
+storeFSData($details, $filename, "code");
+storeFSData($details, $filename, "cats");
+storeFSData($details, $filename, "tags");
+storeFSData($details, $filename, "label");
+storeFSData($details, $filename, "link");
+storeFSData($details, $filename, "email");
+storeFSData($details, $filename, "guid");
+storeFSData($details, $filename, "password");
+
+echo json_encode([200, 'OK']);

+ 26 - 0
Private/templates/Licenses/license-SnipSwap.txt

@@ -0,0 +1,26 @@
+/**
+ * Copyright 2021, 2024 5 Mode
+ *
+ * This file is part of SnipSwap.
+ *
+ * SnipSwap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SnipSwap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.  
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with SnipSwap. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * fileName.php
+ * 
+ * Description of the file.
+ *
+ * @author Daniele Bonini <my25mb@aol.com>
+ * @copyrights (c) 2016, 2024, 5 Mode
+ * @license https://opensource.org/licenses/BSD-3-Clause 
+ */

+ 21 - 0
Private/templates/snip.xml.amp.template

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<details>
+  <detail face="snippet">
+    <title></title>
+    <desc></desc>
+    <code><![CDATA[]]></code>
+    <tags></tags>
+    <cats></cats>
+  </detail>
+  <detail face="contacts">
+    <label></label> 
+    <link></link> 
+    <email></email>
+  </detail>  
+  <detail face="other info">
+    <guid></guid>
+  </detail>  
+  <detail face="password">
+    <password></password>
+  </detail>
+</details>