[ Index ]

PHP Cross Reference of Yamoon 0.9.0

title

Body

[close]

/ -> language.php (source)

   1  <?php
   2  require_once ('Yamoon/Global.php');
   3  include ('header.php');
   4  
   5  $language_id = $_GET['language_id'];
   6  
   7  // ===================== DELETE
   8  if (isset($_GET['action']) && $_GET['action'] == "delete") {
   9      $language = new Language($config, $language_id);
  10      $timeout = $config->redir_timeout;
  11      $message = "";
  12      if ($language->delete()) {
  13          $message = "Language '".$language->name."' deleted!";
  14      } else {
  15          $timeout = $config->redir_timeout_error;
  16          $message = "Language '".$language->name."' could not be deleted. Assure there's no services with that!";
  17      }
  18      $link = "admin.php";
  19      include ('message.php');
  20  
  21  // ===================== EDIT
  22  } else if (isset($_GET['action']) && $_GET['action'] == "edit") {
  23      $timeout = $config->redir_timeout;
  24      if (isset($_GET['languagename']) && $_GET['languagename'] != "") {
  25          if ($language_id) {
  26              // UPDATE
  27              $language = new Language($config, $language_id);
  28              $language->name = $_GET['languagename'];
  29              $language->cmd = $_GET['languagecmd'];
  30              $language->update();
  31              $link = "language.php?action=edit&language_id=$language_id";
  32              $message = "Language '".$language->name."' updated!";
  33          } else {
  34              // INSERT
  35              $name = $_GET['languagename'];
  36              $cmd = $_GET['languagecmd'];
  37              if (!$cmd || $cmd == "") {
  38                  $cmd = shell_exec("which $name");
  39              }
  40              $language = new Language($config);
  41              if ($language->create($name, $cmd))
  42                  $message = "Language '".$name."' created!";
  43              else {
  44                  $timeout = $config->redir_timeout_error;
  45                  $message = "Cannot create duplicated languages!";
  46              }
  47              $link = "admin.php";
  48          }
  49          include ('message.php');
  50      } else {
  51          // EDIT
  52          $language = new Language($config, $language_id);
  53  ?>
  54  
  55  <p>
  56  <form action="language.php">
  57  <input type=hidden name=action value=edit>
  58  <input type=hidden name=language_id value="<?php print $language->id ?>">
  59  <table>
  60      <tr>
  61          <td class='title'>Language</td><td class='field'><input name=languagename value="<?php print $language->name ?>"></td>
  62      </tr>
  63      <tr>
  64          <td class='title'>Command</td><td class='field'><input name=languagecmd value="<?php print $language->cmd ?>"></td>
  65      </tr>
  66      <tr>
  67          <td class='link' colspan=2><input type=submit value="Update"></td>
  68      </tr>
  69  </table>
  70  </form>
  71  <p>
  72  
  73  <?php
  74      }
  75  
  76  // ===================== VIEW
  77  } else {
  78  ?>
  79  
  80  <p>
  81  <table>
  82      <tr>
  83          <td class='title'>Language</td><td class='field'><?php print $language->name ?></td>
  84      </tr>
  85      <tr>
  86          <td class='title'>Command</td><td class='field'><?php print $language->cmd ?></td>
  87      </tr>
  88  </table>
  89  <p>
  90  
  91  <?php
  92  }
  93  include ('footer.php');
  94  ?>


Generated: Sat Feb 19 17:29:53 2005 Cross-referenced by PHPXref 0.6