Example #1
0
     $department = null;
 }
 if (count($description) > 0) {
     $keyword_SQL = 'AND (';
     foreach ($description as $keyword) {
         $keyword = trim($keyword);
         $keyword_SQL .= "c.description LIKE '%{$keyword}%' OR ";
     }
     $keyword_SQL = substr($keyword_SQL, 0, -4) . ")";
 } else {
     $keyword_SQL = null;
 }
 // Validate the numerical arguments we got
 assertNumeric($term, "term");
 assertNumeric($school, "school");
 assertNumeric($credits, "number of credits");
 // Times (Search for any if any is selected, search for the specified times, OR don't specify any time data)
 if (!empty($_POST['timesAny']) && $_POST['timesAny'] == 'any') {
     $times = null;
     $timesAny = true;
 } elseif (empty($_POST['timesAny']) && !empty($_POST['times'])) {
     $times = is_array($_POST['times']) ? $_POST['times'] : array($_POST['times']);
     $timesAny = false;
 } else {
     $times = null;
     $timesAny = true;
 }
 // Days (same process as the time)
 if (!empty($_POST['daysAny']) && $_POST['daysAny'] == 'any') {
     $days = null;
     $daysAny = true;
Example #2
0
<?php

use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode;
$steps->Then('/^the return code should be (\\d+)$/', function ($world, $return_code) {
    if ($return_code != $world->result->return_code) {
        throw new RuntimeException($world->result);
    }
});
$steps->Then('/^(STDOUT|STDERR) should (be|contain|not contain):$/', function ($world, $stream, $action, PyStringNode $expected) {
    $stream = strtolower($stream);
    $expected = $world->replace_variables((string) $expected);
    checkString($world->result->{$stream}, $expected, $action, $world->result);
});
$steps->Then('/^(STDOUT|STDERR) should be a number$/', function ($world, $stream) {
    $stream = strtolower($stream);
    assertNumeric(trim($world->result->{$stream}, "\n"));
});
$steps->Then('/^(STDOUT|STDERR) should not be a number$/', function ($world, $stream) {
    $stream = strtolower($stream);
    assertNotNumeric(trim($world->result->{$stream}, "\n"));
});
$steps->Then('/^STDOUT should be a table containing rows:$/', function ($world, TableNode $expected) {
    $output = $world->result->stdout;
    $actual_rows = explode("\n", rtrim($output, "\n"));
    $expected_rows = array();
    foreach ($expected->getRows() as $row) {
        $expected_rows[] = $world->replace_variables(implode("\t", $row));
    }
    compareTables($expected_rows, $actual_rows, $output);
});
$steps->Then('/^STDOUT should end with a table containing rows:$/', function ($world, TableNode $expected) {
Example #3
0
                    <img src="https://graph.facebook.com/' . $id . '/picture?type=square" alt="' . $item . '">
                    ' . $item . '
                  </a>
                </li>';
}
?>
        </ul>
      </div>

      <div class="list">
        <h3>Friends using this app</h3>
        <ul class="friends">
          <?php 
foreach ($app_using_friends as $auf) {
    // Extract the pieces of info we need from the requests above
    $uid = assertNumeric(idx($auf, 'uid'));
    $pic = idx($auf, 'pic_square');
    $name = idx($auf, 'name');
    echo '
                <li>
                  <a href="#" onclick="window.open(\'http://www.facebook.com/' . $uid . '\')">
                    <img src="https://graph.facebook.com/' . $uid . '/picture?type=square" alt="' . $name . '">
                    ' . $name . '
                  </a>
                </li>';
}
?>
        </ul>
      </div>
    </section>
Example #4
0
 $school = !empty($_POST['college']) && $_POST['college'] != 'any' ? $_POST['college'] * 100 : null;
 $credits = !empty($_POST['credits']) ? $_POST['credits'] : null;
 $professor = !empty($_POST['professor']) ? $_POST['professor'] : null;
 $level = !empty($_POST['level']) && $_POST['level'] != 'any' ? $_POST['level'] : null;
 if (!empty($_POST['department']) && $_POST['department'] != 'any') {
     $department = $_POST['department'];
     $school = null;
     // We won't search for a school if department is assigned.
 } else {
     $department = null;
 }
 // Validate the numerical arguments we got
 assertNumeric($quarter, "quarter");
 assertNumeric($school, "school");
 assertNumeric($credits, "number of credits");
 assertNumeric($department, "department");
 // Times (Search for any if any is selected, search for the specified times, OR don't specify any time data)
 if (!empty($_POST['timesAny']) && $_POST['timesAny'] == 'any') {
     $times = null;
     $timesAny = true;
 } elseif (empty($_POST['timesAny']) && !empty($_POST['times'])) {
     $times = is_array($_POST['times']) ? $_POST['times'] : array($_POST['times']);
     $timesAny = false;
 } else {
     $times = null;
     $timesAny = true;
 }
 // Days (same process as the time)
 if (!empty($_POST['daysAny']) && $_POST['daysAny'] == 'any') {
     $days = null;
     $daysAny = true;