[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> validate.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2007 MySQL AB                              |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: Bryan Alsdorf <bryan@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id$
  29  //
  30  
  31  require_once(dirname(__FILE__) . '/init.php');
  32  include_once (APP_INC_PATH . "class.auth.php");
  33  include_once (APP_INC_PATH . "class.issue.php");
  34  include_once (APP_INC_PATH . "db_access.php");
  35  
  36  Auth::checkAuthentication(APP_COOKIE);
  37  
  38  $valid_functions = array('validateIssueNumbers');
  39  $action = Misc::escapeString($_REQUEST['action']);
  40  if (in_array($action, $valid_functions)) {
  41      echo $action();
  42  } else {
  43      echo "ERROR: Unable to call function $action";
  44  }
  45  exit;
  46  
  47  function validateIssueNumbers()
  48  {
  49      $issues = @explode(',', $_REQUEST['values']);
  50      if ($_REQUEST['check_project'] == 0) {
  51          $check_project = false;
  52      } else {
  53          $check_project = true;
  54      }
  55      $bad_issues = array();
  56      if (count($issues) > 0) {
  57          for ($i = 0; $i < count($issues); $i++) {
  58              if (!Issue::exists(trim($issues[$i]), $check_project)) {
  59                  $bad_issues[] = $issues[$i];
  60              }
  61          }
  62      }
  63      if (count($bad_issues) > 0) {
  64          return $_REQUEST['form_name'] . ':' . $_REQUEST['field_name'] . ':' . join(', ', $bad_issues);
  65      } else {
  66          return $_REQUEST['form_name'] . ':' . $_REQUEST['field_name'] . ':' . 'ok';
  67      }
  68  }


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7