pub / stagit-scripts

Building src.jayvii.de with stagit
git clone https://src.jayvii.de/pub/stagit-scripts.git
Home | Log | Files | Exports | Refs | README | RSS

index.php (3491B)


      1 <!-- SPDX-License-Identifier: AGPL-3.0-or-later
      2      SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> -->
      3 
      4 <?php
      5 
      6 // Fetch Repository Type (may only be "pub" or "prv")
      7 $repo_type = preg_replace(
      8      '/[^a-z]/',
      9      '',
     10      rawurldecode(basename($_GET["type"]))
     11 );
     12 if ($repo_type != "pub") {
     13      $repo_type = "prv";
     14 }
     15 
     16 // Fetch Repository Name
     17 $repo_name = preg_replace(
     18      '/[^a-zA-Z0-9\s\.\,\!\?\:\_\-]/',
     19      '',
     20      rawurldecode(basename($_GET["name"]))
     21 );
     22 
     23 // Fetch Repository Description
     24 $repo_desc = preg_replace(
     25      '/[^a-zA-Z0-9\s\.\,\!\?\:\_\-]/',
     26      '',
     27      rawurldecode($_GET["description"])
     28 );
     29 
     30 // Fetch Repository Full Description
     31 $repo_desc_full = preg_replace(
     32      '/[^a-zA-Z0-9\s\.\,\!\?\:\_\-]/',
     33      '',
     34      rawurldecode($_GET["description_full"])
     35 );
     36 
     37 
     38 // Fetch Repository Owner
     39 $repo_owner = preg_replace(
     40      '/[^a-zA-Z0-9\s\.\,\!\?\:\_\-]/',
     41      '',
     42      rawurldecode(basename($_GET["owner"]))
     43 );
     44 
     45 ?>
     46 
     47 <!DOCTYPE html>
     48 <html>
     49 <head>
     50 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     51 <meta name="viewport" content="width=device-width, initial-scale=1" />
     52 <title>Create Repositories</title>
     53 <link rel="icon" type="image/png" href="../favicon.png" />
     54 <link rel="stylesheet" type="text/css" href="../style.css" />
     55 </head>
     56 <body>
     57 <table>
     58 <tr><td><a href="../"><img src="../assets/backicon.png" alt="Go Back" width="32" height="32" /></a></td>
     59 <td><span class="desc">Creating a new Repository</span></td></tr><tr><td></td><td>
     60 </td></tr>
     61 </table>
     62 <hr/>
     63 <div id="content">
     64 
     65 <?php
     66 
     67      # check whether all variables are set
     68      if ($repo_type == "" || $repo_name == "" || $repo_desc == "" || $repo_desc_full = "" || $repo_owner == "") {
     69           $content = "<p id=\"status\"></p>";
     70      } else {
     71           passthru(
     72                $_SERVER['DOCUMENT_ROOT'] . "/bin/git_create_repo.sh " .
     73                "\"" . $_SERVER['DOCUMENT_ROOT'] . "\" " .
     74                "\"" . $repo_type . "\" " .
     75                "\"" . $repo_name . "\" " .
     76                "\"" . $repo_desc . "\" " .
     77                "\"" . $repo_desc_full . "\" " .
     78                "\"" . $repo_owner . "\"",
     79                $response
     80            );
     81            $content = "<p id=\"status\">" . $response . "</p>";
     82      }
     83 
     84      echo $content;
     85 ?>
     86 
     87      <form method="GET">
     88           <label for="name">Repository Name</label><br>
     89           <input type="text" id="name" name="name" maxlength="30" placeholder="my_new_project" default=<?php echo "\"" . $repo_name . "\""; ?> required><br>
     90           <label for="description">Repository Description</label><br>
     91           <input type="text" id="description" name="description" maxlength="100" placeholder="This project is about..." default=<?php echo "\"" . $repo_desc . "\""; ?> required><br>
     92           <label for="description_full">Long Description of the Repository</label><br>
     93           <textarea id="description_full" name="description_full" style="min-height:150px;" required></textarea><br>
     94           <label for="owner" >Repository Owner</label><br>
     95           <input type="text" id="owner" name="owner" maxlength="30" placeholder="Me" default=<?php echo "\"" . $repo_owner . "\""; ?> required><br>
     96           <label for="type">Repository Type</label><br>
     97           <select name="type" required>
     98                <option value="prv" selected>Private</option>
     99                <option value="pub">Public</option>
    100           </select><br><br>
    101           <input type="submit" value="Submit">
    102      </form>
    103 </div>
    104 </body>
    105 </html>