コード例 #1
0
ファイル: addressbook.php プロジェクト: poorrepo/smsproject
function update_contact()
{
    //sprawdzanie czy pola wypelnione
    if (isset($_POST['id_contact']) && !empty($_POST['id_contact']) && isset($_POST['contact_number']) && !empty($_POST['contact_number']) && isset($_POST['contact_nickname']) && !empty($_POST['contact_nickname']) && isset($_POST['contact_name']) && !empty($_POST['contact_name']) && isset($_POST['contact_lastname']) && !empty($_POST['contact_lastname']) && isset($_POST['contact_address']) && !empty($_POST['contact_address']) && isset($_POST['contact_email']) && !empty($_POST['contact_email'])) {
        //update contact
        $baza = new baza();
        if (PEAR::isError($baza)) {
            echo 'Nie mozna sie polaczyc z baza danych: ' . $db->getMessage();
            die;
        }
        $query = "UPDATE `sms`.`contacts` \r\n            SET \r\n            `contact_number`='" . $_POST['contact_number'] . "', \r\n            `contact_nickname`='" . $_POST['contact_nickname'] . "', \r\n            `contact_name`='" . $_POST['contact_name'] . "', \r\n            `contact_lastname`='" . $_POST['contact_lastname'] . "', \r\n            `contact_address`='" . $_POST['contact_address'] . "', \r\n            `contact_email`='" . $_POST['contact_email'] . "' \r\n            WHERE `id_contact`='" . $_POST['id_contact'] . "';";
        $wyniki = $baza->mdb2->query($query);
        if (!isset($wyniki->result)) {
            echo "Blad bazy danych";
            die;
        }
    } else {
        //wszytko musi byc wypelnione
        print_error_message("Wszsytkie pola musza być wypełnione");
    }
}
コード例 #2
0
ファイル: forgotPassword.php プロジェクト: renoted/Gameloc
<?php 
require __DIR__ . "/include/header.php";
?>

<div class="container">

        <form method="POST" action="<?php 
echo $_SERVER["PHP_SELF"];
?>
">

            <div class="form-group">
              <label for="email">Adresse électronique</label>
              <input type="text" class="form-control" id="email" name="email" placeholder="Email">
            </div>
            <?php 
print_error_message($errors, "email");
?>
            <?php 
if (isset($info["email"])) {
    echo '<div class="alert alert-info">' . $info["email"] . "</div>";
}
?>
            <button type="submit" name="submitBtn" class="btn btn-primary btn-index">Valider</button>
        </form>

      </div><!-- /.container

<?php 
require __DIR__ . "/include/footer.php";
コード例 #3
0
ファイル: saprfc_test.php プロジェクト: prajay04/php-saprfc
            saprfc_table_init ($fce,$interface["name"]);
            $var="RFC_TABLE_".$interface["name"];
            $vararray = unserialize (urldecode($$var));
            if (is_array($vararray))
            {
               for ($j=0;$j<count($vararray);$j++)
                    saprfc_table_append ($fce,$interface["name"],$vararray[$j]);
            }
         }
      }
      // rfc call function in connected R/3
      $retval = @saprfc_call_and_receive ($fce);
      if ( $retval != SAPRFC_OK  )
      {
        print_error_message ( "Call error",
                              "Calling of function module $function failed. See the error message below.<a href=\"saprfc_test.php?p=select\">Other function module</a>",
                              saprfc_error()
                            );
        exit;
      }

      print_header ("Results of function module $function");

      $form = "<table colspacing=0 colpadding=0>\n";
      $form .= "<tr bgcolor=#D0D0D0><td colspan=2><b>EXPORT PARAMETERS</b></td></tr>\n";
      for ($i=0;$i<count($def);$i++)
      {
         $interface = $def[$i];
         if ($interface["type"] == "EXPORT")  // show export parameters
         {
            $var = saprfc_export ($fce,$interface["name"]);
            $form .= show_parameter_out ($interface["name"],$interface["def"],$var);
コード例 #4
0
ファイル: add_game.php プロジェクト: renoted/Gameloc
if (isset($title)) {
    echo $title;
}
?>
">
		</div>
		<?php 
print_error_message($errors, "title");
?>
		
		<div class="form-group">
			<label for="user-picture">Image du jeux (jpg/jpeg ou png) *</label>
			<input type="file" id="user-picture" name="user-picture">
		</div>
		<?php 
print_error_message($errors, "picture");
?>

		<div class="form-group">
			<label for="published">Date de sortie</label>
			<input type="text" class="form-control" id="published" placeholder="Date de sortie" name="published" value="<?php 
if (isset($published)) {
    echo $published;
}
?>
">
		</div>
		<div class="form-group">
			<label for="published">Description</label>
			<textarea id="description" class="form-control" placeholder="Description" name="description" rows="3"><?php 
if (isset($description)) {
コード例 #5
0
ファイル: view.class.php プロジェクト: ramainen/doit-cms
 function from_file($file)
 {
     $name = str_replace(array('/', '.', '-', '\\'), array('_', '_', '_', '_'), substr($file, 1)) . '_tpl';
     if (!function_exists($name)) {
         ob_start();
         //Подавление стандартного вывода ошибок Parse Error
         $code = d()->shablonize(file_get_contents(ROOT . '/app' . $file));
         $result = eval('function ' . $name . '(){ $doit=d(); ?' . '>' . $code . '<' . '?php ;} ');
         ob_end_clean();
         if ($result === false && ($error = error_get_last())) {
             $lines = explode("\n", 'function ' . $name . '(){ $doit=d(); ?' . '>' . $code . '<' . '?php ;} ');
             $file = $this->fragmentslist[$name];
             return print_error_message($lines[$error['line'] - 1], $error['line'], $file, $error['message'], 'Ошибка при обработке шаблона', true);
         } else {
             ob_start();
             $result = call_user_func($name);
             $_end = ob_get_contents();
             ob_end_clean();
             if (!is_null($result)) {
                 $_end = $result;
             }
             return $_end;
         }
     } else {
         ob_start();
         $result = call_user_func($name);
         $_end = ob_get_contents();
         ob_end_clean();
         if (!is_null($result)) {
             $_end = $result;
         }
         return $_end;
     }
 }
コード例 #6
0
        </h3>

        <?php 
if (form_submitted()) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    try {
        if (id_matches_db($username, $password)) {
            store_id_in_session($username);
            print_success_message('Login successful! You will be redirected to your home page shortly.');
            redirect('index.php');
        } else {
            print_error_message('Invalid username or password. Please try again.');
        }
    } catch (Exception $ex) {
        print_error_message('Invalid username or password. Please try again.');
    }
}
?>


        <form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post" role="form">
            <div class="form-group">
                <label class="sr-only" for="username">Username</label>
                <input type="text" class="form-control" name="username" placeholder="Username" autofocus required>
            </div>
            <div class="form-group">
                <label class="sr-only" for="password">Password</label>
コード例 #7
0
 function parseResultSetFromFileForAppend($fd)
 {
     $start = getmicrotime();
     $rs = new ResultSet();
     // COLUMN NAMES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             print_error_msg("Invalid Table File!<br>");
             return null;
         }
     }
     // remove newline
     remove_last_char($buf);
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnNames($rec);
     // COLUMN TYPES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             print_error_msg("Invalid Table File!<br>");
             return null;
         }
     }
     // remove newline
     remove_last_char($buf);
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnTypes($rec);
     // COLUMN DEFAULT VALUES
     // read with a maximum of 1000 bytes, until there is a newline included (or eof)
     $buf = "";
     while (is_false(strstr($buf, "\n"))) {
         $buf .= fgets($fd, 1000);
         if (feof($fd)) {
             break;
             // there's no newline after the colum types => empty table
         }
     }
     // remove newline
     if (last_char($buf) == "\n") {
         remove_last_char($buf);
     }
     $rec = $this->parseRowFromLine($buf);
     $rs->setColumnDefaultValues($rec);
     // get file size
     fseek($fd, 0, SEEK_END);
     $size = ftell($fd);
     $lastRecSize = min($size, ASSUMED_RECORD_SIZE);
     $lastRecPos = false;
     while (is_false($lastRecPos)) {
         fseek($fd, -$lastRecSize, SEEK_END);
         $buf = fread($fd, $lastRecSize);
         $lastRecSize = $lastRecSize * 2;
         $lastRecSize = min($size, $lastRecSize);
         if ($lastRecSize < 1) {
             print_error_message("lastRecSize should not be 0! Contact developer please!");
         }
         $lastRecPos = $this->getLastRecordPosInString($buf);
         if (TXTDBAPI_VERBOSE_DEBUG) {
             echo "<hr>pass! <br>";
             echo "lastRecPos: " . $lastRecPos . "<br>";
             echo "buf: " . $buf . "<br>";
         }
     }
     $buf = trim(substr($buf, $lastRecPos));
     verbose_debug_print("buf after substr() and trim(): " . $buf . "<br>");
     $rs->reset();
     $row = $this->parseRowFromLine($buf);
     if (TXTDBAPI_VERBOSE_DEBUG) {
         echo "parseResultSetFromFileForAppend(): last Row:<br>";
         print_r($row);
         echo "<br>";
     }
     $rs->appendRow($row);
     $rs->setColumnAliases(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnTables(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnTableAliases(create_array_fill(count($rs->colNames), ""));
     $rs->setColumnFunctions(create_array_fill(count($rs->colNames), ""));
     $rs->colFuncsExecuted = create_array_fill(count($rs->colNames), false);
     debug_print("<i>III: parseResultSetFromFileForAppend: " . (getmicrotime() - $start) . " seconds elapsed</i><br>");
     return $rs;
 }
コード例 #8
0
ファイル: tasks.php プロジェクト: poorrepo/smsproject
function add_tasks()
{
    if (isset($_POST["message_content"]) && !empty($_POST["message_content"]) && isset($_POST["send_time"]) && !empty($_POST["send_time"]) && isset($_POST["number_contact"]) && !empty($_POST["number_contact"])) {
        $wiadomosc = $_POST["message_content"];
        $termin_wyslania = $_POST["send_time"];
        $user_id = $_SESSION["id_user"];
        //jak ok to dodawanie zadan do bazy danych aplikacji
        foreach ($_POST["number_contact"] as $contact_number) {
            $result = insert_task_to_db($contact_number, $wiadomosc, $user_id, $termin_wyslania);
            //sprwadzenei statusu bazy danych, jak sie udalo dodac rekord to zwraca 1(true), jak nie to blad
            if (!isset($result->result)) {
                echo "Blad bazy danych";
            }
        }
    } else {
        print_error_message("Niekomplene dane");
        die;
    }
}
コード例 #9
0
/**
 * Get experiments in project
 * @param $projectId
 * @return array|null
 */
function get_experiments_in_project($projectId)
{
    global $airavataclient;
    $experiments = array();
    try {
        $experiments = $airavataclient->getAllExperimentsInProject($projectId);
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
    } catch (TTransportException $tte) {
        print_error_message('TTransportException!<br><br>' . $tte->getMessage());
    }
    return $experiments;
}
コード例 #10
0
ファイル: login.php プロジェクト: poorrepo/smsproject
function print_login_fail()
{
    print_error_message('Logowanie nie powiodło sie!');
}
コード例 #11
0
/**
 * Get a string containing the given experiment's status
 * @param $expId
 * @return mixed
 */
function get_experiment_status($expId)
{
    global $airavataclient;
    try {
        $experimentStatus = $airavataclient->getExperimentStatus($expId);
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (ExperimentNotFoundException $enf) {
        print_error_message('ExperimentNotFoundException!<br><br>' . $enf->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
    } catch (Exception $e) {
        print_error_message('Exception!<br><br>' . $e->getMessage());
    }
    return ExperimentState::$__names[$experimentStatus->experimentState];
}
コード例 #12
0
ファイル: index.php プロジェクト: helio-vo/helio
                $rows = $xml->getElementsByTagName('TR');
                $tab_dates = array();
                $nb_rows = $rows->length;
                for ($i = 0; $i < $nb_rows; $i++) {
                    $dt = $rows->item($i)->getElementsByTagName('TD')->item($index)->nodeValue;
                    $dt = str_replace('T', ' ', $dt);
                    $tmp = explode(' ', $dt);
                    //$tab_dates[] = "'".$tmp[0]."'";
                    $tab_dates[] = $tmp[0];
                }
                $tab_dates = array_values(array_unique($tab_dates));
                $_SESSION['par_post']['date_sample'] = $tab_dates;
                $_SESSION['par_post']['from'] = min($tab_dates);
                $_SESSION['par_post']['to'] = max($tab_dates);
            } else {
                print_error_message('No date in the VOTable file ');
            }
        }
    }
}
?>
		<style type="text/css">
			td.default { width:20%; padding: 3px; text-align: center;}
			td.contrib { border:1px solid #dbd7d4; width:20%; padding: 3px; text-align: center;}
			td.feat_sel { border:1px solid #eaf4fd;}
			ul#icons {margin: 0; padding: 0;}
			ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
			ul#icons span.ui-icon {float: left; margin: 0 4px;}
			.crit_name {background-color: #eaf4fd; font-weight:bold; }
		</style>	
<!--	</head> -->
コード例 #13
0
/**
 * Create form inputs to accept the inputs to the given application
 * @param $id
 * @param $isRequired
 * @internal param $required
 */
function create_inputs($id, $isRequired)
{
    $inputs = get_application_inputs($id);
    $required = $isRequired ? ' required' : '';
    foreach ($inputs as $input) {
        /*
        echo '<p>DataType::STRING = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::STRING . '</p>';
        echo '<p>DataType::INTEGER = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::INTEGER . '</p>';
        echo '<p>DataType::FLOAT = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::FLOAT . '</p>';
        echo '<p>DataType::URI = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::URI . '</p>';
        
        echo '<p>$input->type = ' . $input->type . '</p>';
        */
        switch ($input->type) {
            case DataType::STRING:
                echo '<div class="form-group">
                    <label for="experiment-input">' . $input->name . '</label>
                    <input type="text" class="form-control" name="' . $input->name . '" id="' . $input->name . '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '>
                    </div>';
                break;
            case DataType::INTEGER:
            case DataType::FLOAT:
                echo '<div class="form-group">
                    <label for="experiment-input">' . $input->name . '</label>
                    <input type="number" class="form-control" name="' . $input->name . '" id="' . $input->name . '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '>
                    </div>';
                break;
            case DataType::URI:
                echo '<div class="form-group">
                    <label for="experiment-input">' . $input->name . '</label>
                    <input type="file" class="" name="' . $input->name . '" id="' . $input->name . '" ' . $required . '>
                    <p class="help-block">' . $input->userFriendlyDescription . '</p>
                    </div>';
                break;
            default:
                print_error_message('Input data type not supported!
                    Please file a bug report using the link in the Help menu.');
                break;
        }
    }
}
コード例 #14
0
ファイル: register.php プロジェクト: renoted/Gameloc
				<div class="form-group">
					<label for="town">Ville *</label>
					<input type="text" class="form-control" id="town" placeholder="town" name="town" value="<?php 
if (isset($town)) {
    echo $town;
}
?>
">
				</div>
				<?php 
print_error_message($errors, "town");
?>

				<div class="form-group">
					<label for="phone">Téléphone *</label>
					<input type="phone" class="form-control" id="phone" placeholder="phone" name="phone" value="<?php 
if (isset($phone)) {
    echo $phone;
}
?>
">
				</div>
				<?php 
print_error_message($errors, "phone");
?>

				<button type="submit" class="btn btn-primary" name="submitBtn">Valider</button>
			</form>
		</div>
<?php 
require __DIR__ . "/include/footer.php";
コード例 #15
0
function create_project()
{
    global $airavataclient;
    $project = new Project();
    $project->owner = $_SESSION['username'];
    $project->name = $_POST['project-name'];
    $project->description = $_POST['project-description'];
    $projectId = null;
    try {
        $projectId = $airavataclient->createProject($project);
        if ($projectId) {
            print_success_message("<p>Project {$_POST['project-name']} created!</p>" . '<p>You will be redirected to the summary page shortly, or you can
                <a href="project_summary.php?projId=' . $projectId . '">go directly</a> to the project summary page.</p>');
            redirect('project_summary.php?projId=' . $projectId);
        } else {
            print_error_message("Error creating project {$_POST['project-name']}!");
        }
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
    }
    return $projectId;
}
コード例 #16
0
ファイル: hfc_to_csvxml.php プロジェクト: helio-vo/helio
            $cmd = $cmd . "sql=\"" . $sql_query . "\" ofmt=votable-tabledata > /tmp/" . $filename . ".xml";
            exec($cmd);
            // Adds DESCRIPTION element to FIELD elements
            Add_Field_Description("/tmp/" . $filename . ".xml", $tab_comment, $what, $sql_query);
            // sends the file to browser
            $fp = fopen("/tmp/" . $filename . ".xml", 'r');
            break;
        case 'csv':
            $cmd = $cmd . "sql=\"" . $sql_query . "\" ofmt=csv > /tmp/" . $filename . ".csv";
            exec($cmd);
            $fp = fopen("/tmp/" . $filename . ".csv", 'r');
            break;
    }
    fpassthru($fp);
} else {
    print_error_message('Bad query!');
}
function Add_Field_Description($file, $tab_comment, $feat, $query)
{
    global $global;
    $xml = new DOMDocument();
    $xml->load($file);
    $xml->formatOutput = true;
    //$newline = $xml->createTextNode("\n");
    $fields = $xml->getElementsByTagName('RESOURCE');
    $node_resource = $fields->item(0);
    $node_desc = $xml->createElement("DESCRIPTION", 'HFC GUI');
    $node_info = $xml->createElement("INFO", $query);
    $node_info->setAttribute('name', 'QUERY_STRING');
    $tables = $xml->getElementsByTagName('TABLE');
    $sql_query = "SHOW TABLES FROM " . $global['TBSP'];
コード例 #17
0
        <?php 
if (id_in_session()) {
    $columnClass = 'col-md-4';
    echo '<h1>Welcome, ' . $_SESSION['username'] . '!</h1>';
    if ($_SESSION['username'] == 'admin1') {
        try {
            open_tokens_file($tokenFilePath);
        } catch (Exception $e) {
            print_error_message($e->getMessage());
        }
        if (isset($_GET['tokenId'])) {
            try {
                write_new_token($_GET['tokenId']);
                print_success_message('Received new XSEDE token ' . $tokenFile->tokenId . '! Click <a href="' . $req_url . '?gatewayName=' . $gatewayName . '&email=' . $email . '&portalUserName='******'username'] . '">here</a> to fetch a new token.');
            } catch (Exception $e) {
                print_error_message($e->getMessage());
            }
        } else {
            echo '<p><small>Community token currently set to ' . $tokenFile->tokenId . '. Click <a href="' . $req_url . '?gatewayName=' . $gatewayName . '&email=' . $email . '&portalUserName='******'username'] . '">here</a> to fetch a new token.</small></p>';
        }
    } else {
        /* temporarily remove to avoid confusion during XSEDE tutorial
                        if (isset($_SESSION['tokenId']))
                        {
                            echo '<p><small>XSEDE token currently active.
                            All experiments launched during this session will use your personal allocation.</small></p>';
                        }
                        elseif(!isset($_GET['tokenId']) && !isset($_SESSION['tokenId']))
                        {
                            echo '<p><small>Currently using community allocation. Click <a href="' .
                                $req_url .
コード例 #18
0
ファイル: login.php プロジェクト: renoted/Gameloc
print_error_message($errors, "connexion");
?>

      <div class="form-group">
        <label for="email">Adresse électronique</label>
        <input type="text" class="form-control" id="email" name="email" placeholder="Email">
        <?php 
print_error_message($errors, "email");
?>
      </div>

      <div class="form-group">
        <label for="password">Mot de passe</label>
        <input type="password" class="form-control" id="password" name="password" placeholder="Password">
        <?php 
print_error_message($errors, "password");
?>
      </div>
      
      <button type="submit" name="submitBtn" class="btn btn-primary btn-index">Valider</button>
  </form>
  <a href="forgotPassword.php">Mot de passe oublié ?</a>
</div><!-- /.container
 


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
コード例 #19
0
ファイル: results.php プロジェクト: helio-vo/helio
function check_param_criteria()
{
    $flag = true;
    // checks that there is at least a criteria when start_date is empty
    if (isset($_SESSION['par_post']['ignore_date'])) {
        $tst_criteria = (strcmp($_SESSION['par_post']['fil_criter_select'], "None") != 0) + (strcmp($_SESSION['par_post']['pro_criter_select'], "None") != 0) + (strcmp($_SESSION['par_post']['ar_criter_select'], "None") != 0) + (strcmp($_SESSION['par_post']['sp_criter_select'], "None") != 0) + (strcmp($_SESSION['par_post']['ch_criter_select'], "None") != 0) + (strcmp($_SESSION['par_post']['t3_criter_select'], "None") != 0) + is_numeric($_SESSION['par_post']['region']['minlat']);
        if (!$tst_criteria) {
            print_error_message("Date selection or criteria are required. Return to query form.");
            $flag = false;
        }
    }
    // checks solar region values if they exist
    if (is_numeric($_SESSION['par_post']['region']['minlat']) && is_numeric($_SESSION['par_post']['region']['maxlat'])) {
        if ($_SESSION['par_post']['region']['minlat'] < -90 || $_SESSION['par_post']['region']['minlat'] > 90) {
            print_error_message("Min value is out of [-90, 90] degrees. Return to query form.");
            $flag = false;
            break;
        }
        if ($_SESSION['par_post']['region']['maxlat'] < -90 || $_SESSION['par_post']['region']['maxlat'] > 90) {
            print_error_message("Max value is out of [-90, 90] degrees. Return to query form.");
            $flag = false;
            break;
        }
        if (is_numeric($_SESSION['par_post']['region']['minlon'])) {
            if ($_SESSION['par_post']['region']['minlon'] < 0 || $_SESSION['par_post']['region']['minlon'] > 360) {
                print_error_message("Min value is out of [0, 360] degrees. Return to query form.");
                $flag = false;
                break;
            }
        }
        //else $_SESSION['par_post']['region']['minlon'] = 0;
        if (is_numeric($_SESSION['par_post']['region']['maxlon'])) {
            if ($_SESSION['par_post']['region']['maxlon'] < 0 || $_SESSION['par_post']['region']['maxlon'] > 360) {
                print_error_message("Max value is out of [0, 360] degrees. Return to query form.");
                $flag = false;
                break;
            }
        }
        //else $_SESSION['par_post']['region']['maxlon'] = 360;
        if ($_SESSION['par_post']['region']['minlat'] > $_SESSION['par_post']['region']['maxlat']) {
            print_error_message("Min > Max !. Return to query form.");
            $flag = false;
        }
    }
    if (is_numeric($_SESSION['par_post']['region']['minlon']) && is_numeric($_SESSION['par_post']['region']['maxlon'])) {
        if (!is_numeric($_SESSION['par_post']['region']['minlat'])) {
            $_SESSION['par_post']['region']['minlat'] = -90;
        }
        if (!is_numeric($_SESSION['par_post']['region']['maxlat'])) {
            $_SESSION['par_post']['region']['maxlat'] = 90;
        }
    }
    // checks filaments criteria values
    if (in_array("fil", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['fil_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['fil_criter_select']) {
                case "Length":
                    if (!array_sum($_SESSION['par_post']['fil_length_par'])) {
                        print_error_message("Min and Max length values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['fil_length_par']['min'] > $_SESSION['par_post']['fil_length_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Orientation":
                    if (!array_sum($_SESSION['par_post']['fil_orientation_par'])) {
                        print_error_message("Min and Max orientation values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['fil_orientation_par']['min'] > $_SESSION['par_post']['fil_orientation_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Area":
                    if (!array_sum($_SESSION['par_post']['fil_area_par'])) {
                        print_error_message("Min and Max area values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['fil_area_par']['min'] > $_SESSION['par_post']['fil_area_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
            }
        }
    }
    // checks prominences criteria values
    if (in_array("pro", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['pro_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['pro_criter_select']) {
                case "Height":
                    if (!array_sum($_SESSION['par_post']['pro_height_par'])) {
                        print_error_message("Min and Max height values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['pro_height_par']['min'] > $_SESSION['par_post']['pro_height_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Delta latitude":
                    if (!array_sum($_SESSION['par_post']['pro_delta_lat_par'])) {
                        print_error_message("Min and Max latitude values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['pro_delta_lat_par']['min'] > $_SESSION['par_post']['pro_delta_lat_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Max. intensity":
                    if (!array_sum($_SESSION['par_post']['pro_maxint_par'])) {
                        print_error_message("Min and Max intensity values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['pro_maxint_par']['min'] > $_SESSION['par_post']['pro_maxint_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
            }
        }
    }
    if (in_array("ar", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['ar_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['ar_criter_select']) {
                case "Area":
                    if (!array_sum($_SESSION['par_post']['ar_area_par'])) {
                        print_error_message("Min and Max area values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['ar_area_par']['min'] > $_SESSION['par_post']['ar_area_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Max. intensity":
                    if (!array_sum($_SESSION['par_post']['ar_maxint_par'])) {
                        print_error_message("Min and Max intensity values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['ar_maxint_par']['min'] > $_SESSION['par_post']['ar_maxint_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
            }
        }
    }
    if (in_array("ch", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['ch_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['ch_criter_select']) {
                case "Area":
                    if (!array_sum($_SESSION['par_post']['ch_area_par'])) {
                        print_error_message("Min and Max area values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['ch_area_par']['min'] > $_SESSION['par_post']['ch_area_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
                case "Width":
                    if (!array_sum($_SESSION['par_post']['ch_width_par'])) {
                        print_error_message("Min and Max area values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['ch_width_par']['min'] > $_SESSION['par_post']['ch_width_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
            }
        }
    }
    if (in_array("sp", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['sp_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['sp_criter_select']) {
                case "Area":
                    if (!array_sum($_SESSION['par_post']['sp_area_par'])) {
                        print_error_message("Min and Max area values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['sp_area_par']['min'] > $_SESSION['par_post']['sp_area_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
            }
        }
    }
    // checks type III criteria values
    if (in_array("t3", $_SESSION['par_post']['features'])) {
        if (strcmp($_SESSION['par_post']['t3_criter_select'], "None") != 0) {
            // test if there are criteria values
            switch ($_SESSION['par_post']['t3_criter_select']) {
                case "Max. intensity":
                    if (!array_sum($_SESSION['par_post']['t3_maxint_par'])) {
                        print_error_message("Min and Max intensity values are not specified. Return to query form.");
                        $flag = false;
                    }
                    if ($_SESSION['par_post']['t3_maxint_par']['min'] > $_SESSION['par_post']['t3_maxint_par']['max']) {
                        print_error_message("Min > Max !. Return to query form.");
                        $flag = false;
                    }
                    break;
            }
        }
    }
    return $flag;
}
コード例 #20
0
ファイル: cms.php プロジェクト: ramainen/doit-cms
 /**
  * Функция для eval
  *
  * Подготавливает новую функцию для предотвращения повторных eval-ов и запускает её.
  * По сути, имея название шаблона, eval-ит его с экономией процессорного времени.
  *
  * @param $name имя шаблона вида file_tpl
  * @return void значение, полученное из шаблона при помощи return.
  */
 function compile_and_run_template($name)
 {
     if (!function_exists($name)) {
         ob_start();
         //Подавление стандартного вывода ошибок Parse Error
         $result = eval('function ' . $name . '(){ $doit=d(); ?' . '>' . $this->get_compiled_code($name) . '<' . '?php ;} ');
         ob_end_clean();
         if ($result === false && ($error = error_get_last())) {
             $lines = explode("\n", 'function ' . $name . '(){ $doit=d(); ?' . '>' . $this->get_compiled_code($name) . '<' . '?php ;} ');
             $file = $this->fragmentslist[$name];
             return print_error_message($lines[$error['line'] - 1], $error['line'], $file, $error['message'], 'Ошибка при обработке шаблона', true);
         } else {
             return call_user_func($name);
         }
     } else {
         return call_user_func($name);
     }
 }
コード例 #21
0
/**
 * Create a new experiment from the values submitted in the form
 * @return null
 */
function create_experiment()
{
    global $airavataclient;
    $experiment = assemble_experiment();
    //var_dump($experiment);
    $expId = null;
    try {
        if ($experiment) {
            $expId = $airavataclient->createExperiment($experiment);
        }
        if ($expId) {
            /*
            print_success_message("Experiment {$_POST['experiment-name']} created!" .
                ' <a href="experiment_summary.php?expId=' . $expId . '">Go to experiment summary page</a>');
            */
        } else {
            print_error_message("Error creating experiment {$_POST['experiment-name']}!");
        }
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
    }
    return $expId;
}
コード例 #22
0
    $im = $_POST['im'];
    $url = $_POST['url'];
    if ($idStore->username_exists($username)) {
        print_error_message('The username you entered is already in use. Please select another.');
    } else {
        if (strlen($username) < 3) {
            print_error_message('Username should be more than three characters long!');
        } else {
            if ($password != $confirm_password) {
                print_error_message('The passwords that you entered do not match!');
            } elseif (!isset($first_name)) {
                print_error_message('First name is required.');
            } elseif (!isset($last_name)) {
                print_error_message('Last name is required.');
            } elseif (!isset($email)) {
                print_error_message('Email address is required.');
            } else {
                $idStore->add_user($username, $password, $first_name, $last_name, $email, $organization, $address, $country, $telephone, $mobile, $im, $url);
                print_success_message('New user created!');
                redirect('login.php');
            }
        }
    }
}
?>

    <form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post" role="form">
        <div class="form-group required"><label class="control-label">Username</label>
コード例 #23
0
ファイル: message.php プロジェクト: gschoppe/Repertoire
</p>
    </div>
<?php 
    if ($message['destructs']) {
        ?>
    <script type="text/javascript">
        $(document).ready(function() {
            setTimeout(function() {$('#<?php 
        echo print_DB($messageID);
        ?>
').fadeOut();},5000);
            $('#<?php 
        echo print_DB($messageID);
        ?>
 .close').click(function(){
                $(this).parent().fadeOut();
            });
        });
    </script>
<?php 
    }
}
if (isset($message) && $message) {
    if (isset($message['type'])) {
        print_error_message($message);
    } else {
        foreach ($message as $m) {
            print_error_message($m);
        }
    }
}
コード例 #24
0
function update_project($projectId, $updatedProject)
{
    global $airavataclient;
    try {
        $airavataclient->updateProject($projectId, $updatedProject);
        print_success_message('Project updated! Click <a href="project_summary.php?projId=' . $projectId . '">here</a> to view the project summary.');
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (ProjectNotFoundException $pnfe) {
        print_error_message('ProjectNotFoundException!<br><br>' . $pnfe->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
    }
}
コード例 #25
0
ファイル: print_res_hour.php プロジェクト: helio-vo/helio
function query_feat($date, $feat_type)
{
    $tab_results = array();
    // date selection part of the query
    $query_date = "DATE_OBS='" . $date . "' ";
    // region/position part of the query
    if (is_numeric($_SESSION['par_post']['region']['minlat'])) {
        $minlat = $_SESSION['par_post']['region']['minlat'];
        $maxlat = $_SESSION['par_post']['region']['maxlat'];
        $minlon = $_SESSION['par_post']['region']['minlon'];
        $maxlon = $_SESSION['par_post']['region']['maxlon'];
        $query_region = "(FEAT_CARR_LAT_DEG BETWEEN " . $minlat . " AND " . $maxlat;
        if (strcmp($_SESSION['par_post']['region']['symmetric'], "on") == 0) {
            if ($minlat * $maxlat >= 0) {
                $query_region = $query_region . " OR FEAT_CARR_LAT_DEG BETWEEN ";
                $query_region = $query_region . -1 * $maxlat . " AND " . -1 * $minlat;
            }
        }
        $query_region = $query_region . ")";
        if (is_numeric($_SESSION['par_post']['region']['minlon'])) {
            $query_region = $query_region . " AND (FEAT_CARR_LONG_DEG BETWEEN " . $minlon . " AND " . $maxlon . ')';
        }
        //echo "region=$query_region<br>\n";
        // temporary for AR
        $query_region_ar = "(FEAT_HG_LAT_DEG BETWEEN " . $minlat . " AND " . $maxlat;
        if (strcmp($_SESSION['par_post']['region']['symmetric'], "on") == 0) {
            if ($minlat * $maxlat >= 0) {
                $query_region_ar = $query_region_ar . " OR FEAT_HG_LAT_DEG BETWEEN ";
                $query_region_ar = $query_region_ar . -1 * $maxlat . " AND " . -1 * $minlat;
            }
        }
        $query_region_ar = $query_region_ar . ")";
        if (is_numeric($_SESSION['par_post']['region']['minlon'])) {
            $query_region_ar = $query_region_ar . " AND (FEAT_HG_LONG_DEG BETWEEN " . $minlon . " AND " . $maxlon . ')';
        }
        //$tab_where_ar[] = $query_region;
    }
    if ($feat_type == "fil") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        if (isset($query_region)) {
            $tab_where_feat[] = $query_region;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_fil'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_fil']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['fil_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['fil_criter_select']) {
                case "Length":
                    $query_crit = "(SKE_LENGTH_DEG BETWEEN " . $_SESSION['par_post']['fil_length_par']['min'] . " AND " . $_SESSION['par_post']['fil_length_par']['max'] . ')';
                    break;
                case "Orientation":
                    $query_crit = "(SKE_ORIENTATION BETWEEN " . $_SESSION['par_post']['fil_orientation_par']['min'] . " AND " . $_SESSION['par_post']['fil_orientation_par']['max'] . ')';
                    break;
                case "Area":
                    $query_crit = "(FEAT_AREA_DEG2 BETWEEN " . $_SESSION['par_post']['fil_area_par']['min'] . " AND " . $_SESSION['par_post']['fil_area_par']['max'] . ')';
                    break;
                case "Disappearance":
                    $query_crit = "(PHENOM=5)";
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_FIL_GUI ";
        //$sql_query = "SELECT v_fil.*, t_trckfil.* FROM VIEW_FIL_GUI v_fil, FILAMENTS_TRACKING t_trckfil ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . "ORDER BY TRACK_ID ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY TRACK_ID ASC";
        }
        //$sql_query = $sql_query." WHERE (v_fil.ID_FIL =  t_trckfil.FIL_ID) ORDER BY TRACK_ID ASC";
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        //		$_SESSION['query']['fil'] = $sql_query;
        $nb_feat = count($tab_results['ID_FIL']);
        if ($nb_feat == 0 && strcmp($_SESSION['par_post']['fil_criter_select'], "Disappearance")) {
            $sql_query = "SELECT v_fil.* FROM VIEW_FIL_GUI v_fil ";
            $query_where = "WHERE " . $query_cond;
            if (strlen($query_cond)) {
                $sql_query = $sql_query . $query_where . "ORDER BY DATE_OBS ASC";
            } else {
                $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
            }
            //print_r($sql_query); echo "<BR>\n";
            $tab_results = execute_query($sql_query . " LIMIT 8000");
            $nb_feat = count($tab_results['ID_FIL']);
        }
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "pro") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_pro'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_pro']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['pro_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['pro_criter_select']) {
                case "Height":
                    $query_crit = "(FEAT_HEIGHT_KM BETWEEN " . $_SESSION['par_post']['pro_height_par']['min'] . " AND " . $_SESSION['par_post']['pro_height_par']['max'] . ')';
                    break;
                case "Delta latitude":
                    $query_crit = "(DELTA_LAT_DEG BETWEEN " . $_SESSION['par_post']['pro_delta_lat_par']['min'] . " AND " . $_SESSION['par_post']['pro_delta_lat_par']['max'] . ')';
                    break;
                case "Max. intensity":
                    $query_crit = "(FEAT_MAX_INT BETWEEN " . $_SESSION['par_post']['pro_maxint_par']['min'] . " AND " . $_SESSION['par_post']['pro_maxint_par']['max'] . ')';
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_PRO_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_PROMINENCE']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "ar") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        if (isset($query_region_ar)) {
            $tab_where_feat[] = $query_region_ar;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_ar'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_ar']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['ar_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['ar_criter_select']) {
                case "Area":
                    $query_crit = "(FEAT_AREA_DEG2 BETWEEN " . $_SESSION['par_post']['ar_area_par']['min'] . " AND " . $_SESSION['par_post']['ar_area_par']['max'] . ')';
                    break;
                case "Max. intensity":
                    $query_crit = "(FEAT_MAX_INT BETWEEN " . $_SESSION['par_post']['ar_maxint_par']['min'] . " AND " . $_SESSION['par_post']['ar_maxint_par']['max'] . ')';
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_AR_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_AR']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "ch") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        if (isset($query_region)) {
            $tab_where_feat[] = $query_region;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_ch'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_ch']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['ch_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['ch_criter_select']) {
                case "Area":
                    $query_crit = "(FEAT_AREA_DEG2 BETWEEN " . $_SESSION['par_post']['ch_area_par']['min'] . " AND " . $_SESSION['par_post']['ch_area_par']['max'] . ')';
                    break;
                case "Width":
                    $query_crit = "(FEAT_WIDTH_HG_LONG_DEG BETWEEN " . $_SESSION['par_post']['ch_width_par']['min'] . " AND " . $_SESSION['par_post']['ch_width_par']['max'] . ')';
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_CH_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_CORONALHOLES']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "sp") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        if (isset($query_region)) {
            $tab_where_feat[] = $query_region;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_sp'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_sp']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['sp_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['sp_criter_select']) {
                case "Area":
                    $query_crit = "(FEAT_AREA_DEG2 BETWEEN " . $_SESSION['par_post']['sp_area_par']['min'] . " AND " . $_SESSION['par_post']['sp_area_par']['max'] . ')';
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $tab_where_feat[] = "(FEAT_DIAM_DEG>0)";
        $sql_query = "SELECT * FROM VIEW_SP_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_SUNSPOT']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "t3") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_t3'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_t3']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        // check if query has criteria
        if (strcmp($_SESSION['par_post']['t3_criter_select'], "None") != 0) {
            switch ($_SESSION['par_post']['t3_criter_select']) {
                case "Max. intensity":
                    $query_crit = "(FEAT_MAX_INT BETWEEN " . $_SESSION['par_post']['t3_maxint_par']['min'] . " AND " . $_SESSION['par_post']['t3_maxint_par']['max'] . ')';
                    break;
            }
            $tab_where_feat[] = $query_crit;
            //echo "criteria=$query_crit<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_T3_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_TYPE_III']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "t2") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_t2'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_t2']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_T2_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY DATE_OBS ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY DATE_OBS ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_TYPE_II']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    if ($feat_type == "rs") {
        $tab_where_feat = array();
        if (isset($query_date)) {
            $tab_where_feat[] = $query_date;
        }
        if (isset($query_region)) {
            $tab_where_feat[] = $query_region;
        }
        // check if query is on specific observatory
        if (isset($_SESSION['par_post']['obs_rs'])) {
            $query_obs = '(ID_OBSERVATORY IN (' . implode(',', $_SESSION['par_post']['obs_rs']) . '))';
            $tab_where_feat[] = $query_obs;
            //echo "observatory=$query_obs<br>\n";
        }
        $sql_query = "SELECT * FROM VIEW_RS_GUI ";
        $query_cond = implode(' AND ', $tab_where_feat);
        $query_where = "WHERE " . $query_cond;
        if (strlen($query_cond)) {
            $sql_query = $sql_query . $query_where . " ORDER BY TRACK_ID ASC";
        } else {
            $sql_query = $sql_query . " ORDER BY TRACK_ID ASC";
        }
        //print_r($sql_query); echo "<BR>\n";
        $tab_results = execute_query($sql_query);
        $nb_feat = count($tab_results['ID_RS']);
        if ($nb_feat == 8000) {
            print_error_message("Query limited to 8000 results!");
        }
    }
    return $tab_results;
}
コード例 #26
0
/**
 * Get results of the user's search
 * @return array|null
 */
function get_search_results()
{
    global $airavataclient;
    $experiments = array();
    try {
        switch ($_POST['search-key']) {
            case 'experiment-name':
                $experiments = $airavataclient->searchExperimentsByName($_SESSION['username'], $_POST['search-value']);
                break;
            case 'experiment-description':
                $experiments = $airavataclient->searchExperimentsByDesc($_SESSION['username'], $_POST['search-value']);
                break;
            case 'application':
                $experiments = $airavataclient->searchExperimentsByApplication($_SESSION['username'], $_POST['search-value']);
                break;
        }
    } catch (InvalidRequestException $ire) {
        print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    } catch (AiravataClientException $ace) {
        print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    } catch (AiravataSystemException $ase) {
        if ($ase->airavataErrorType == 2) {
            print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
                                <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
                                <a href="create_project.php">here</a> to create a new project.</p>');
        } else {
            print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
            //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
        }
    } catch (TTransportException $tte) {
        print_error_message('TTransportException!<br><br>' . $tte->getMessage());
    }
    return $experiments;
}
コード例 #27
0
ファイル: users.php プロジェクト: poorrepo/smsproject
function add_user()
{
    if (isset($_POST['user_pass']) && !empty($_POST['user_pass']) && isset($_POST['user_imie']) && !empty($_POST['user_imie']) && isset($_POST['user_nazwisko']) && !empty($_POST['user_nazwisko']) && isset($_POST['user_dzial']) && !empty($_POST['user_dzial']) && isset($_POST['disabled']) && isset($_POST['access_level']) && !empty($_POST['access_level'])) {
        $pass = md5($_POST['user_pass']);
        //add user
        $baza = new baza();
        if (PEAR::isError($baza)) {
            echo 'Nie mozna sie polaczyc z baza danych: ' . $db->getMessage();
            die;
        }
        $query = "INSERT INTO `sms`.`users` \r\n                (\r\n                    `user_name`, \r\n                    `user_pass`, \r\n                    `user_imie`, \r\n                    `user_nazwisko`, \r\n                    `user_dzial`, \r\n                    `disabled`,\r\n                    `access_level`\r\n                ) \r\n                VALUES \r\n                (\r\n                    '" . $_POST['user_name'] . "', \r\n                    '" . $pass . "', \r\n                    '" . $_POST['user_imie'] . "', \r\n                    '" . $_POST['user_nazwisko'] . "', \r\n                    '" . $_POST['user_dzial'] . "', \r\n                    " . $_POST['disabled'] . ",\r\n                    '" . $_POST['access_level'] . "'\r\n                );";
        $wyniki = $baza->mdb2->query($query);
        if (!isset($wyniki->result)) {
            echo "Blad bazy danych";
            die;
        }
    } else {
        //wszytko musi byc wypelnione
        print_error_message("Wszsytkie pola musza być wypełnione");
        die;
    }
}