Example #1
0
 function compare($dir, $racine)
 {
     $retour = 'terminée avec succès.<br>';
     $files = array_diff(scandir($dir), array('.', '..'));
     foreach ($files as $file) {
         if (is_dir($dir . $file)) {
             if (file_exists($racine . $file)) {
                 compare($dir . $file . '/', $racine . $file . '/');
             } else {
                 mkdir($racine . $file);
             }
         } else {
             if (file_exists($racine . $file)) {
                 $shaNow = sha1_file($racine . $file);
                 $shaNext = sha1_file($dir . $file);
                 if ($shaNow != $shaNext) {
                     if (filemtime($dir . $file) >= filemtime($racine . $file)) {
                         $retour .= $racine . $file . ' Le fichier actuel a une date de modification plus récente<br>';
                     } else {
                         transfertFile($dir . '/' . $file, $racine . $file);
                     }
                 }
             } else {
                 transfertFile($dir . '/' . $file, $racine . $file);
             }
         }
     }
     return $retour;
 }
Example #2
0
function validate($email, $pw)
{
	require 'connect.php';
	$q="select userid, password from user where emailid='$email'";
	$r=mysql_query($q);
	if(!$r)
		header("Location:error.html");
	else
		{
			$row=mysql_fetch_row($r);
			$resusid=$row[0];
			$respw=$row[1];
			$flag=compare($respw, $pw);
		}
	if($flag)
		{
			//user is authenticated
			authenticate($resusid);
		}
	else
		{
			header("Location:error.html");
		}
	 
}
/**
 * Adds if statement logic to change output based on if statement.
 * 
 * 
 * @param mixed &$parsed
 * @return void
 */
function cond(&$parsed)
{
    global $cssp, $browser;
    foreach ($parsed as $block => $css) {
        foreach ($parsed[$block] as $selector => $styles) {
            foreach ($styles as $property => $values) {
                if (strpos($values[0], 'cond(') !== false) {
                    /**
                     * Clean up variable names and Formatting.
                     */
                    $condition = get_string_between($values[0], "cond(", ")");
                    $ifParams = explode("?", $condition);
                    $ifResults = explode(":", $ifParams[1]);
                    $ifCond = explode(" ", $ifParams[0]);
                    $ifCond[0] = interp($ifCond[0]);
                    //Convert PHP string to Values
                    $ifCond[2] = interp($ifCond[2]);
                    //Convert PHP string to Values
                    $test = compare($ifCond[0], $ifCond[1], $ifCond[2]);
                    $parsed[$block][$selector][$property] = '';
                    //Remove existing Cond Statement
                    if ($test) {
                        $parsed[$block][$selector][$property][] = $ifResults[0];
                        //Place True Value
                    } else {
                        $parsed[$block][$selector][$property][] = $ifResults[1];
                        //Place False Value
                    }
                }
            }
        }
    }
}
Example #4
0
function create_graph($a, $b)
{
    // 2. matching
    $count = 0;
    $gml = "graph [\ncomment \"Matching\"\ndirected 1\n# First set of labels\n";
    foreach ($a as $str) {
        $gml .= "node [ id {$count} label \"" . addcslashes($str, '"') . "\" ]\n";
        $count++;
    }
    $gml .= "# Second set of labels\n";
    foreach ($b as $str) {
        $gml .= "node [ id {$count} label \"" . addcslashes($str, '"') . "\" ]\n";
        $count++;
    }
    $m = count($a);
    $n = count($b);
    for ($i = 0; $i < $m; $i++) {
        for ($j = 0; $j < $n; $j++) {
            $gml .= "edge [ source {$i} target " . ($m + $j) . " label \"" . floor(100 * compare($a[$i], $b[$j])) . "\" ]\n";
        }
    }
    $gml .= "]\n";
    /*
    echo '<pre>';
    echo $gml;
    echo '</pre>';
    */
    return $gml;
}
Example #5
0
 protected function u_spearmanRanks(\SplFixedArray $_data, $_size, $_stride, $_offset, \SplFixedArray $_ranks, &$_combinations)
 {
     $_combinations = 0;
     /* Using native arrays because native functions are faster than written */
     $temp1 = $temp2 = array_fill(0, $_size, 0.0);
     for ($i = 0; $i < $_size; $i++) {
         $temp1[$i] = $_data[$i * $_stride + $_offset];
         $temp2[$i] = $i;
     }
     array_multisort($temp1, $temp2);
     for ($i = 0; $i < $_size; $i++) {
         $count = 0;
         while ($i < $_size - 1) {
             if (compare($temp1[$i], $temp1[$i + 1])) {
                 break;
             }
             $count++;
             $i++;
         }
         $value = $i;
         if ($count > 0) {
             $value -= $count / 2.0;
             $_combinations += $count * ($count + 1) * ($count + 2);
         }
         while ($count >= 0) {
             $temp1[$i - $count] = $temp2[$i - $count];
             $temp2[$i - $count] = $value;
             $count--;
         }
     }
     array_multisort($temp1, $temp2);
     for ($i = 0; $i < $_size; $i++) {
         $_ranks[$i] = $temp2[$i];
     }
 }
 /**
  * usort() compatible comparision function (i.e., returns -1 | 0 | +1).
  */
 public static function ucompare($a, $b)
 {
     $result = compare($a, $b);
     if ($result == 0) {
         return 0;
     }
     if ($result > 0) {
         return 1;
     }
     return -1;
 }
function compare($arg1, $arg2)
{
    //echo "compare is called <br>";
    global $_;
    //if obj1 and obj2 are objects then continue below after conditional block
    if (!(is_object($arg1) and is_object($arg2))) {
        //if obj1 and obj2 are arrays then check that array counts match
        if (is_array($arg1) and is_array($arg2)) {
            //check if the two arrays have a matching count
            if (count($arg1) != count($arg2)) {
                return false;
            } else {
                //continue with this else when $arg1 and $arg2 are arrays
                foreach ($arg1 as $key => $value) {
                    //for each $key in $arg1
                    //check if the $key value is an object or an array
                    if (is_object($arg1[$key]) or is_array($arg1[$key])) {
                        //if the $key value is an object or an array run
                        //compare on the object key values
                        //if the compare returns false return false
                        if (!compare($arg1[$key], $arg2[$key])) {
                            return false;
                        }
                    } elseif ($arg1[$key] != $arg2[$key]) {
                        return false;
                    }
                }
            }
        } else {
            return $arg1 == $arg2;
        }
    } else {
        //continue with this else when both $arg1 and $arg2 are objects
        foreach ($arg1 as $key => $value) {
            //for each $key in $arg1
            //check if the $key value is an object or an array
            if (is_object($arg1->{$key}) or is_array($arg1->{$key})) {
                //if the $key value is an object or an array run
                //compare on the object key values
                //if the compare returns false return false
                if (!compare($arg1->{$key}, $arg2->{$key})) {
                    return false;
                }
            } elseif ($arg1->{$key} != $arg2->{$key}) {
                return false;
            }
        }
    }
    return true;
}
function combine_arrays($array1, $array2)
{
    $sameArray = compare($array1, $array2);
    $newArray = array();
    foreach ($array2 as $key => $items) {
        if (!is_null($array1[$key])) {
            array_push($newArray, $array1[$key]);
        }
        foreach ($sameArray as $index) {
            if ($index == $key) {
                continue 2;
            }
        }
        array_push($newArray, $items);
    }
    return $newArray;
}
/** 
Finds a random index in the array such that neither (index-1) nor (index)
contains an element equal to $element
*/
function findSuitableIndex($array, $element, $arraySize)
{
    $index = rand(0, $arraySize - 1);
    for ($i = 0; $i < $arraySize - 1; $i++) {
        if (!compare($array[$index], $element)) {
            if ($index == 0 || !compare($array[$index - 1], $element)) {
                return $index;
            } else {
                if ($index == $arraySize - 1) {
                    return $arraySize;
                }
            }
        }
        $index = ($index + 1) % $arraySize;
    }
    die('An error occurred (5), please try again.<br>If this problem persists, contact a webmaster at: <a href="mailto:shs@altervista.org">shs@altervista.org</a>');
}
function array_sort(&$array, $sort_key)
{
    $size = count($array);
    sort($array);
    foreach ($array as $key => $val) {
        if ($key + 1 == $size) {
            return;
        }
        while (compare($array[$key], $array[$key + 1], $sort_key) == -1) {
            $tmp = $array[$key + 1];
            $array[$key + 1] = $array[$key];
            $array[$key] = $tmp;
            if ($key != 0) {
                $key--;
            }
        }
    }
}
Example #11
0
function compare($a_aRow1, $a_aRow2, $a_lField = 0)
{
    global $g_aaSortArray;
    $lCompareVal = 0;
    if ($a_lField < count($g_aaSortArray)) {
        $sSortFieldName = $g_aaSortArray[$a_lField]['name'];
        $sSortFieldDir = $g_aaSortArray[$a_lField]['dir'];
        $vValue1 = eval('return $a_aRow1[' . $sSortFieldName . '];');
        $vValue2 = eval('return $a_aRow2[' . $sSortFieldName . '];');
        if ($vValue1 == $vValue2) {
            $lCompareVal = compare($a_aRow1, $a_aRow2, $a_lField + 1);
        } else {
            $lCompareVal = strtolower($vValue1) > strtolower($vValue2) ? 1 : -1;
            if (strtolower(substr($sSortFieldDir, 0, 4)) == 'desc') {
                $lCompareVal = -$lCompareVal;
            }
        }
    }
    return $lCompareVal;
}
Example #12
0
function Nav_data($dbc, $path_info)
{
    $q = "SELECT * FROM pages";
    $r = mysqli_query($dbc, $q);
    while ($nav = mysqli_fetch_assoc($r)) {
        ?>
		
			
<li <?php 
        compare($path_info['call_parts'][0], $nav['nav'], 'class = "active"');
        ?>
> <a href="<?php 
        echo $nav['nav'];
        ?>
"><?php 
        echo $nav['nav'];
        ?>
</a></li>	

<?php 
    }
}
Example #13
0
        $node->addChild($key, (string) $value)->addAttribute("tool", "kdu");
    }
    if ($format[0] == "DJVU" || $format[0] == "DJVU (multi-page)" || $format[0] == "jhove DJVU") {
        $djvu_dump = exec_help("djvudump '{$file}'", "djvudump '{$file}'");
        $node = $xml->addChild("djvu_dump", htmlentities($djvu_dump));
    }
    return $xml;
}
$files = $_GET['file'];
$op = $_GET['op'];
$action = $_GET['action'];
if ((count($files) == 2 || count($files) == 1) && ($action == "compare" || $action == "execute" || $action == "EXECUTE")) {
    if (count($files) == 2) {
        $xml = compare($files[0], $files[1]);
    } else {
        $xml = compare($files[0], "null");
    }
    $smarty = smarty_init();
    if ($xml == false || $xml->{"error"}) {
        $smarty->assign("error", $xml == false ? "Error processing image" : $xml->{"error"});
        $smarty->assign('template', 'error.tpl');
        $smarty->assign('selected', 'compare');
        $smarty->display('layout.tpl');
        exit(1);
    }
    $images = array();
    $count = 0;
    foreach (count($files) == 2 ? array("image1", "image2") : array("image1") as $image) {
        $data = array();
        $data["thumbnail"] = "images/" . $xml->{$image}->{"checksum"} . ".png";
        $data["big"] = "images/" . $xml->{$image}->{"checksum"} . "_big.png";
Example #14
0
foreach ($dictionary as $rel => $rel_def) {
    if (!empty($rel_def['indices'])) {
        $indices = $rel_def['indices'];
    } else {
        $indices = array();
    }
    //clean vardef defintions.. removed indexes not value for this dbtype.
    //set index name as the key.
    $var_indices = array();
    foreach ($indices as $definition) {
        if (empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
            $var_indices[$definition['name']] = $definition;
        }
    }
    $db_indices = $focus->db->helper->get_indices($rel_def['table']);
    compare($rel_def['table'], $db_indices, $var_indices);
}
////	END PROCESS RELATIONSHIP METADATA
///////////////////////////////////////////////////////////////////////////////
function_exists('logThis') ? logThis("RepairIndex: we have " . count($drop_index) . " indices to DROP.") : "";
function_exists('logThis') ? logThis("RepairIndex: we have " . count($add_index) . " indices to ADD.") : "";
function_exists('logThis') ? logThis("RepairIndex: we have " . count($change_index) . " indices to CHANGE.") : "";
if (count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0) {
    if (!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
        echo $_REQUEST['silent'] ? "" : "<BR><BR><BR>";
        echo $_REQUEST['silent'] ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
    }
    $focus = new Account();
    if (count($drop_index) > 0) {
        if (isset($_REQUEST['mode']) and $_REQUEST['mode'] == 'execute') {
            echo $_REQUEST['silent'] ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
Example #15
0
echo <<<_END
<span class='formheading'><p>Enter the details of your workout below:
</p></span>
<form method='POST' action='add.php'>
<span class='nonulfield'>The torture lasted</span>
<input type='text' name='min' size='4' maxlength='5'/>
<span class='nonulfield'>minutes.<br>
<br><span class='nonulfield'>I wasted my time with </span>
<select name='activity'>
_END;
$result = query("SELECT * FROM exercises");
for ($i = 0; $i < $result->num_rows; $i++) {
    $row = $result->fetch_array(MYSQLI_ASSOC);
    $exercise_name = $row['name'];
    echo "<option value='{$exercise_name}'>{$exercise_name}</option>";
}
echo "</select><span class='nonulfield'>. (" . "<a href='newtype.php'>Add Exercise Type</a>)<br><br>";
if (!isset($_SESSION['weight'])) {
    echo "<span class='nonulfield'>On a good day, I weigh </span>\n    <input type='text' name='weight' size='4' maxlength='5' value='{$weight}'/>\n    <span class='nonulfield'> pounds.</span>";
}
?>
<br><br>
<input type='submit' value='Submit'/>
<br>
</form>
</body>
</html>
<?php 
if ($calories) {
    compare($calories);
}
Example #16
0
unset($files[$baseLanguage]);
// compare each language with the baselanguage
foreach ($files as $key => $file) {
    $comp = import($file);
    print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
    $result = compare($base, $comp);
    if (is_array($result) && sizeof($result) > 0) {
        print "  found missing strings: \n";
        foreach ($result as $value) {
            print "    " . $value . "\n";
        }
    } else {
        print "   no missing strings found! \n ";
    }
    print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
    $result = compare($comp, $base);
    if (is_array($result) && sizeof($result) > 0) {
        print "  found strings not in basefile: \n";
        foreach ($result as $key => $value) {
            print "    " . $value . "\n";
        }
    } else {
        print "   There are no strings which are not in the basefile! \n ";
    }
}
//-----------------------------------------------------------------------------------------
// FUNCTIONS
//-----------------------------------------------------------------------------------------
/**
 * prints the help screen
 *
/**
 * Sorts files (callback)
 *
 * @param  string  $file1
 * @param  string  $file2
 * @return integer
 */
function sortContent($file1, $file2)
{
    $asc = '-' != substr(SORT_METHOD, -1);
    switch (strtolower(substr(SORT_METHOD, 0, 4))) {
        case 'name':
            return compare($asc ? $file1 : $file2, $asc ? $file2 : $file1);
            break;
        case 'date':
            return compare(filectime(DIRNAME . ($asc ? $file1 : $file2)), filectime(DIRNAME . ($asc ? $file2 : $file1)));
            break;
    }
    return 0;
}
Example #18
0
<?php

require __DIR__ . '/lib.php';
$c = 0;
do {
    $data = read_queue();
    if ($data) {
        define('SAVE_DIRNAME', $data);
        $lpath = build_data_path($data, 'input_left');
        $rpath = build_data_path($data, 'input_right');
        $left = read_as_array($lpath, true);
        $right = read_as_array($rpath, true);
        $left = process_array($left);
        $right = process_array($right);
        $type_list = array(TYPE_SAME, TYPE_DIFFERENT, TYPE_LEFT_ONLY, TYPE_RIGHT_ONLY);
        foreach ($type_list as $type) {
            $result = compare($type, $left, $right);
            save_result($type, $result);
        }
    } else {
        usleep(100);
    }
} while (++$c < 10000);
Example #19
0
<?php

function compare($num)
{
    $baseMemory = memory_get_usage();
    $now = time();
    for ($i = 0; $i < 5 * 10000 * 10000; $i++) {
        $num($i);
    }
    var_dump($num === 'compare2' ? '==' : '===');
    var_dump(memory_get_usage() - $baseMemory);
    var_dump(time() - $now);
}
function compare2($i)
{
    $count = 0;
    if ($i == true) {
        $count++;
    }
}
function compare3($i)
{
    $count = 0;
    if ($i === true) {
        $count++;
    }
}
compare('compare2');
compare('compare3');
Example #20
0
File: cache.php Project: ekudel/vkt
function filterWaitingOrders($orders, $lowerBound, $upperBound, $count)
{
    $started = false;
    $result = [];
    foreach ($orders as $order) {
        $key = buildKey($order);
        if (!$started && (!$upperBound || compare($key, $upperBound) < 0)) {
            $started = true;
        }
        if ($started) {
            if ($lowerBound && compare($key, $lowerBound) <= 0) {
                return $result;
            }
            array_push($result, $order);
            if (sizeof($result) == $count) {
                return $result;
            }
        }
    }
    return FEED_CACHE_SIZE == sizeof($orders) ? false : $result;
}
    }
    if (!empty($dictionary[$focus->object_name]['indices'])) {
        $indices = $dictionary[$focus->object_name]['indices'];
    } else {
        $indices = array();
    }
    //clean vardef defintions.. removed indexes not value for this dbtype.
    //set index name as the key.
    $var_indices = array();
    foreach ($indices as $definition) {
        if (empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
            $var_indices[$definition['name']] = $definition;
        }
    }
    $db_indices = $focus->db->helper->get_indices($focus->table_name);
    compare($focus, $db_indices, $var_indices);
}
if (count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0) {
    global $sugar_config;
    if (!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
        echo "<BR><BR><BR>";
        echo "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
    }
    $focus = new Account();
    if (count($drop_index) > 0) {
        if (isset($_REQUEST['mode']) and $_REQUEST['mode'] == 'execute') {
            echo "<BR>Dropping constraints/indexes.";
            foreach ($drop_index as $statement) {
                echo "<BR> Executing " . $statement;
                $focus->db->query($statement);
            }
 public function storeAnswer($id, CreateAnswerRequest $request)
 {
     $input = $request->all();
     // Get time between exercise load and store answer.
     $endTime = microtime(true);
     $diffTime = $endTime - $input['start_time'];
     $exercise = loadExercise($id)[0];
     //must check for empty answers & stuff like that...
     //must also find a way to avoid duplicate answers since 'text' types can't be used as key
     $ans = new Answer();
     $ans->given_code = $input['given_code'];
     $ans->time = $diffTime;
     $result = preg_replace('/[^A-Za-z0-9\\-\\ ,\\.;:\\[\\]\\?\\!@#$%&\\*\\(\\)\\-=\\+\\.^\\P{C}\\n]/', '', $input['result']);
     // dd($result);
     // dd(preg_match("/^[hH]ello, [wW]orld$/", substr_replace($result, "", -1)));
     // dd(preg_match("/^Hello, world$/", $result));
     if ($exercise->expected_result == '*') {
         $ans->success = true;
     } else {
         $rule = "/" . $exercise->expected_result . "/";
         // dd($rule);
         if (preg_match($rule, $result)) {
             $ans->success = true;
         } elseif (compare(bin2hex($result), bin2hex($exercise->expected_result . chr(0xd) . chr(0xa)))) {
             $ans->success = true;
         } else {
             $ans->success = false;
         }
     }
     $ans->uId = Auth::id();
     $ans->eId = $id;
     storeAnswer($ans);
     if ($exercise->expected_result != '*') {
         if ($ans->success) {
             flash()->success("You solved the exercise in " . $diffTime . " seconds.");
             \Session::flash('correctAnswer', 'blabla');
         } else {
             flash()->error("Too bad, the answer was wrong.");
         }
     }
     // $result = $input['result'];
     $answer = $input['given_code'];
     $sId = \Session::get('currentSerie');
     $challenges = loadChallengesByUserExercise(\Auth::id(), $id);
     // Only update challenge if the given answer is correct.
     if ($ans->success) {
         foreach ($challenges as $c) {
             if ($c->winner != \Auth::id()) {
                 if ($c->userA == \Auth::id()) {
                     if (!empty(loadCorrectAnswers($c->userB, $id)) && $diffTime < loadCorrectAnswers($c->userB, $id)[0]->time) {
                         $newScore = loadUser(\Auth::id())[0]->score;
                         $newScore += 1;
                         setUserScore(\Auth::id(), $newScore);
                         setWinner($c->id, \Auth::id());
                         storeNotification($c->userB, "challenge beaten", \Auth::id(), $c->id);
                     }
                 } else {
                     if (!empty(loadCorrectAnswers($c->userA, $id)) && $diffTime < loadCorrectAnswers($c->userA, $id)[0]->time) {
                         $newScore = loadUser(\Auth::id())[0]->score;
                         $newScore += 1;
                         setUserScore(\Auth::id(), $newScore);
                         setWinner($c->id, \Auth::id());
                         storeNotification($c->userA, "challenge beaten", \Auth::id(), $c->id);
                     }
                 }
             }
         }
     }
     return redirect('exercises/' . $id)->with(['result' => $result, 'answer' => $answer]);
 }
<?php

require "settings.php";
require "sales_forecast.lib.php";
if (isset($_REQUEST["key"])) {
    switch ($_REQUEST["key"]) {
        case "enter":
            $OUTPUT = enter();
            break;
        case "compare":
            $OUTPUT = compare();
            break;
    }
} else {
    $OUTPUT = enter();
}
require "template.php";
function enter()
{
    extract($_REQUEST);
    $fields = array();
    $fields["prd"] = "month";
    extract($fields, EXTR_SKIP);
    if ($prd == "month") {
        $prd_month = "checked";
        $prd_week = "";
    } else {
        $prd_month = "";
        $prd_week = "checked";
    }
    // Retrieve list of sales forecasts
    {
        return $this->_doors;
    }
}
class BMW extends Coupe
{
    public function __construct($engineSize, $hp)
    {
        $this->_engineSize = $engineSize;
        $this->_hp = $hp;
        $this->_seats = 5;
        $this->_doors = 2;
    }
    public function effectiveness()
    {
        return $this->_hp * 1.1 / $this->_engineSize;
    }
    public function getSeats()
    {
        return $this->_seats;
    }
}
function compare(Car $A, Car $B)
{
    // Random calculation just for the sake of the example
    return $A->effectiveness() > $B->effectiveness() ? get_class($A) : get_class($B);
}
$CarA = new BMW(121, 3.0);
$CarB = new MercedesBenz(101, 2.5);
echo "More effective car is: " . compare($CarA, $CarB) . " <br />";
Example #25
0
     echo '结束';
 }
 unlink('sanjiedoudb.txt');
 function compare(&$x, &$y)
 {
     if ($x > $y) {
         $temp = $y;
         $y = $x;
         $x = $temp;
     }
 }
 compare($a, $b);
 //  a,b 中小的值存a 大的值存在b
 compare($a, $c);
 //   a,c 中小的值存a 大的值存在//到这一步 a中值最小
 compare($b, $c);
 //   b,c 中小的值存b 大的值存在  //到这一步步 c中值最大
 $jg_array = array("shenjie" => $shenjiemoney1, "fojie" => $fojiemoney1, "mojie" => $mojiemoney1);
 $jg1 = array_search($c, $jg_array);
 $a1 = $DB->select('*', 'sanjiedou', "WHERE youjie LIKE '%{$jg1}%'")->fetchALL();
 foreach ($a1 as $row1) {
     $kjuser = $row1['user'];
     //输出押注成功用户
     $mamoney = $row1[$jg1];
     //取赌注金币
     $row2 = $DB->select('*', 'user', "WHERE user='******'")->fetchALL();
     $row2 = $row2['0'];
     $money1 = $row2['rmb'];
     //取用户原来金币
     $q = $money1;
     $dz = $mamoney * 2.9;
Example #26
0
compare('01', $date->formatLikeSQL('W7'), 'W7 (368)');
compare('01', $date->formatLikeSQL('IW'), 'IW (368)');
$date->addDays(1);
// Wednesday, 5th January 2000
compare('01', $date->formatLikeSQL('WW'), 'WW (369)');
compare('02', $date->formatLikeSQL('W1'), 'W1 (369)');
compare('01', $date->formatLikeSQL('W4'), 'W4 (369)');
compare('01', $date->formatLikeSQL('W7'), 'W7 (369)');
compare('01', $date->formatLikeSQL('IW'), 'IW (369)');
$date->addDays(1);
// Thursday, 6th January 2000
compare('01', $date->formatLikeSQL('WW'), 'WW (370)');
compare('02', $date->formatLikeSQL('W1'), 'W1 (370)');
compare('01', $date->formatLikeSQL('W4'), 'W4 (370)');
compare('01', $date->formatLikeSQL('W7'), 'W7 (370)');
compare('01', $date->formatLikeSQL('IW'), 'IW (370)');
$date->addDays(1);
// Friday, 7th January 2000
compare('01', $date->formatLikeSQL('WW'), 'WW (371)');
compare('02', $date->formatLikeSQL('W1'), 'W1 (371)');
compare('01', $date->formatLikeSQL('W4'), 'W4 (371)');
compare('01', $date->formatLikeSQL('W7'), 'W7 (371)');
compare('01', $date->formatLikeSQL('IW'), 'IW (371)');
$date->addDays(1);
// Saturday, 8th January 2000
compare('02', $date->formatLikeSQL('WW'), 'WW (372)');
compare('02', $date->formatLikeSQL('W1'), 'W1 (372)');
compare('01', $date->formatLikeSQL('W4'), 'W4 (372)');
compare('01', $date->formatLikeSQL('W7'), 'W7 (372)');
compare('01', $date->formatLikeSQL('IW'), 'IW (372)');
Example #27
0
function right_Judge_ID($testJID)
{
    global $fullname;
    // Данные о текущем пользователе
    global $nickname;
    global $email;
    global $cur_no;
    // Номер текущего пользователя в списке
    global $users;
    global $password;
    $users = file($password . "users.txt");
    for ($i = 0; $i < count($users); $i++) {
        $users[$i] = trim($users[$i]);
    }
    for ($i = 0; $i < count($users) / 4; $i++) {
        if (compare($testJID, $users[$i * 4])) {
            $fullname = $users[$i * 4 + 1];
            $nickname = $users[$i * 4 + 2];
            $email = $users[$i * 4 + 3];
            $cur_no = $i;
            return true;
        }
    }
    return false;
}
Example #28
0
 /**
  * Delete the feed
  */
 public function delete()
 {
     if (!$this->getId()) {
         return;
     }
     db()->deleteMultiple(RDR_Entry::getByCondition("feed = {0}", array($this)));
     $cats = RDR_Category::getByQuery("\n            SELECT o FROM RDR_Category_feeds\n            WHERE k = " . $this->getId() . "\n        ");
     foreach ($cats as $category) {
         $feeds = $category->feeds;
         if ($feeds) {
             foreach ($feeds as $key => $feed) {
                 if (compare($this, $feed)) {
                     unset($feeds[$key]);
                 }
                 if (count($feeds) != count($category->feeds)) {
                     $category->store();
                 }
             }
         }
     }
     parent::delete();
     RDR_Cleanup::cleanupFlags();
 }
Example #29
0
$datetest->addSeconds(-885427200, true);
compare("11/12/1977 01.00.22.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-885427200");
$datetest = new Date($date);
$datetest->addSeconds(-917049600, true);
compare("10/12/1976 01.00.23.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-917049600");
$datetest = new Date($date);
$datetest->addSeconds(-948672000, true);
compare("10/12/1975 01.00.24.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-948672000");
$datetest = new Date($date);
$datetest->addSeconds(-980294400, true);
compare("09/12/1974 01.00.25.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-980294400");
$datetest = new Date($date);
$datetest->addSeconds(-1011916800, true);
compare("08/12/1973 01.00.26.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1011916800");
$datetest = new Date($date);
$datetest->addSeconds(-1043539200, true);
compare("07/12/1972 01.00.27.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1043539200");
$datetest = new Date($date);
$datetest->addSeconds(-1075161600, true);
compare("07/12/1971 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1075161600");
// 23 leap seconds
$datetest = new Date($date);
$datetest->addSeconds(-1106784000, true);
compare("06/12/1970 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1106784000");
$datetest = new Date($date);
$datetest->addSeconds(-1138406400, true);
compare("05/12/1969 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1138406400");
$datetest = new Date($date);
$datetest->addSeconds(-1170028800, true);
compare("04/12/1968 01.00.28.98765", $datetest->formatLikeSQL("DD/MM/YYYY HH.MI.SS.FFFFF"), "-1170028800");
		<select name="avoidance" id="avoidance" form="add-profile-indiv" class="form-control">
			<option value="" <?php 
echo compare($student['avoidance'], -1) ? "selected='selected'" : '';
?>
></option>
			<option value="1" <?php 
echo compare($student['avoidance'], 1) ? "selected='selected'" : '';
?>
>Very low</option>
			<option value="2" <?php 
echo compare($student['avoidance'], 2) ? "selected='selected'" : '';
?>
>Low</option>
			<option value="3" <?php 
echo compare($student['avoidance'], 3) ? "selected='selected'" : '';
?>
>Average</option>
			<option value="4" <?php 
echo compare($student['avoidance'], 4) ? "selected='selected'" : '';
?>
>High</option>
			<option value="5" <?php 
echo compare($student['avoidance'], 5) ? "selected='selected'" : '';
?>
>Very high</option>
		</select>
	</div>
	<div class="two-col">
		<!-- filler -->
	</div>
</div>