예제 #1
0
/**
 * @param int $color1
 * @param int $color2
 * @param float $factor
 * @return int
 */
function interpolate($color1, $color2, $factor)
{
    $r = (red($color2) - red($color1)) * $factor + red($color1);
    $g = (green($color2) - green($color1)) * $factor + green($color1);
    $b = (blue($color2) - blue($color1)) * $factor + blue($color1);
    return color($r, $g, $b);
}
예제 #2
0
파일: Dashboard.php 프로젝트: teddcm/saask
 function __construct()
 {
     parent::__construct();
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
     if (!$this->ion_auth->logged_in()) {
         red('user/login');
     }
 }
예제 #3
0
function cek_login()
{
    $CI =& get_instance();
    if (is_login() && $CI->agent->is_referral()) {
    } else {
        red(base_url());
        die;
    }
}
예제 #4
0
파일: Outbox.php 프로젝트: teddcm/saask
 function __construct()
 {
     parent::__construct();
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
     $this->load->model('model_outbox');
     if (!$this->ion_auth->logged_in()) {
         red('user/login');
     }
     $this->per_preview = 5;
     $this->per_page = 10;
     $this->start_rows = $this->uri->segment('4') == '' ? 0 : $this->uri->segment('4');
     $config['per_page'] = $this->per_page;
     $this->pagination_config = $config;
 }
예제 #5
0
파일: info.php 프로젝트: calcinai/phpi
/**
 * @param \Calcinai\PHPi\Board $board
 * @param string $header_name
 * @param Calcinai\PHPi\Board\Feature\Header\PhysicalPin[] $physical_pins
 */
function renderHeader($board, $header_name, $physical_pins)
{
    $table_format = "| %10s | %5s | %3s | %3s | %s %s | %-3s | %-3s | %-5s | %-10s |\n";
    $high_char = red('●');
    $low_char = grey('●');
    //Ha ha...
    $header = sprintf($table_format, 'func', 'type', 'BCM', 'PHY', $header_name, '', 'PHY', 'BCM', 'type', 'func');
    $hr = preg_replace('/[\\w ]/i', '-', str_replace('|', '+', $header));
    echo $hr;
    echo $header;
    echo $hr;
    reset($physical_pins);
    do {
        $odd_pin = current($physical_pins);
        $even_pin = next($physical_pins);
        $odd_pin_attr = getPinAttributes($board, $odd_pin->gpio_number);
        $even_pin_attr = getPinAttributes($board, $even_pin->gpio_number);
        printf($table_format, $odd_pin_attr->function, $odd_pin->type, $odd_pin->gpio_number, $odd_pin->physical_number, $odd_pin_attr->level ? $high_char : $low_char, $even_pin_attr->level ? $high_char : $low_char, $even_pin->physical_number, $even_pin->gpio_number, $even_pin->type, $even_pin_attr->function);
    } while (next($physical_pins));
    echo $hr;
    printf("%s pin high, %s pin low\n", $high_char, $low_char);
}
예제 #6
0
StaffWidgets('fsa_barcode');
StaffWidgets('fsa_exists_Y');
$extra['SELECT'] .= ",(SELECT coalesce(STATUS,'Active') FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS STATUS";
$extra['SELECT'] .= ",(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE";
$extra['functions'] += array('BALANCE' => 'red');
$extra['columns_after'] = array('BALANCE' => _('Balance'), 'STATUS' => _('Status'));
Search('staff_id', $extra);
if (UserStaffID()) {
    $staff = DBGet(DBQuery("SELECT s.STAFF_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME,(SELECT STAFF_ID FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS ACCOUNT_ID,(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE FROM STAFF s WHERE s.STAFF_ID='" . UserStaffID() . "'"));
    $staff = $staff[1];
    echo '<FORM action="' . PreparePHP_SELF() . '" method="POST">';
    DrawHeader(_('Timeframe') . ':' . PrepareDate($start_date, '_start') . ' ' . _('to') . ' ' . PrepareDate($end_date, '_end') . ' : ' . $type_select . ' : <INPUT type="submit" value="' . _('Go') . '">');
    echo '</FORM>';
    //modif Francois: fix bug no balance
    //	DrawHeader(NoInput($staff['FULL_NAME'],'&nbsp;'.$staff['STAFF_ID']),'', NoInput(red($student['BALANCE']),_('Balance')));
    DrawHeader(NoInput($staff['FULL_NAME'], '&nbsp;' . $staff['STAFF_ID']), '', NoInput(red($staff['BALANCE']), _('Balance')));
    if ($_REQUEST['detailed_view'] != 'true') {
        DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'true')) . ">" . _('Detailed View') . "</A>");
    } else {
        DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'false')) . ">" . _('Original View') . "</A>");
    }
    if ($staff['ACCOUNT_ID'] && $staff['BALANCE'] != '') {
        if ($_REQUEST['type_select']) {
            $where = " AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "'";
        }
        if ($_REQUEST['detailed_view'] == 'true') {
            $RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_STAFF_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.STAFF_ID,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION," . db_case(array('fst.SELLER_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)")) . " AS SELLER FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst WHERE fst.STAFF_ID='" . UserStaffID() . "' AND fst.SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $start_date . "' AND date '" . $end_date . "' +1" . $where . " ORDER BY fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'BALANCE' => 'red'));
            //modif Francois: add translation
            foreach ($RET as $RET_key => $RET_val) {
                $RET[$RET_key] = array_map('types_locale', $RET_val);
            }
예제 #7
0
파일: User.php 프로젝트: teddcm/saask
 function deactivate($id = NULL)
 {
     if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin() || !$this->input->is_ajax_request()) {
         if ($this->input->post()) {
             return show_error('You must be an administrator to view this page.');
         } else {
             red('');
         }
     } else {
         $deactivation = $this->ion_auth->deactivate($id);
         if ($deactivation) {
             echo 'success';
         } else {
             echo 'failed';
         }
     }
 }
예제 #8
0
파일: solEval.php 프로젝트: axomar/ITS
function Evaluation($id, $value, $input, $exercise_id, $operatorData, $answer)
{
    $m = new EvalMath();
    $xml = simplexml_load_file($exercise_id) or die("Error: Cannot create object");
    // $ops = array("==", "!=", "GE", "LE", "GT", "LT");
    $count_options = $xml->input[$id]->count();
    for ($i = 0; $i < $count_options; $i++) {
        $operator = $xml->input[$id]->option[$i]->operator;
        $equation = trim($xml->input[$id]->option[$i]->equation);
        $data = explode(" ", $equation);
        $operatorDT = "";
        if ($operator == 'IF') {
            if (strstr($equation, "and")) {
                $content = explode("and", $equation);
                $data1 = explode(" ", $content[0]);
                $data2 = explode(" ", $content[1]);
                if (evalStatement($data1, $input, $answer) and evalStatement($data2, $input, $answer)) {
                    return $xml->input[$id]->option[$i]->result;
                }
            } elseif (strstr($equation, "or")) {
                $content = explode("or", $equation);
                $data1 = explode(" ", $content[0]);
                $data2 = explode(" ", $content[1]);
                if (evalStatement($data1, $input, $answer) or evalStatement($data2, $input, $answer)) {
                    return $xml->input[$id]->option[$i]->result;
                }
            } else {
                if (evalStatement($data, $input, $answer)) {
                    return $xml->input[$id]->option[$i]->result;
                }
            }
        } else {
            $equation = "";
            foreach ($data as $element) {
                if (is_numeric($element)) {
                    $equation .= $element;
                } else {
                    if ($element[0] == 'o') {
                        $operatorDT = ltrim($element, "o");
                    } elseif ($element[0] == 'v') {
                        $trimmed = intval(ltrim($element, "v"));
                        $equation .= $input[$trimmed];
                    } elseif ($element[0] == 'a') {
                        $trimmed = intval(ltrim($element, "a"));
                        $equation .= $answer[$trimmed - 1];
                    } else {
                        $equation .= $element;
                    }
                }
            }
            if (strstr($equation, "mcm")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = mcm(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "smn")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = smn(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "smd")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = smd(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "cod")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = cod(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "red")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = red(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "txt")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = txt($valor[0], $valor[1]);
            } else {
                $equation_result = $m->evaluate($equation);
            }
            if ($operatorDT == "") {
                $operatorData = "";
            }
            // return strval($equation_result);
            switch ($operator) {
                case "==":
                    if ($equation_result == $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "!=":
                    if ($equation_result != $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "GT":
                    if ($equation_result > $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "GE":
                    if ($equation_result >= $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "LT":
                    if ($equation_result < $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "LE":
                    if ($equation_result <= $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
            }
            // SWITCH
        }
        // else IF
    }
    // option's LOOP
}
예제 #9
0
파일: files.php 프로젝트: xurenlu/tik
<?php

global $data;
echo '    
    <form method="post" action="?act=upload" enctype="multipart/form-data">
    上传:
            <input type="file" name="up" id="up" />
            <input type="submit" name="submit" value="submit" />
        </form>
        ';
echo "<h1>文件列表</h1>";
red("点击文件名复制路径");
echo '<ul>';
foreach ($data["files"] as $file) {
    echo '<li><a href="' . $file . '">' . $file . '</a>';
}
echo '</ul>';
예제 #10
0
function pleac_Redefining_a_Function()
{
    // In PHP once a function has been defined it remains defined. In other words,
    // it cannot be undefined / deleted, nor can that particular function name be
    // reused to reference another function body. Even the lambda-like functions
    // created via the 'create_function' built-in, cannot be undefined [they exist
    // until script termination, thus creating too many of these can actually
    // exhaust memory !]. However, since the latter can be assigned to variables,
    // the same variable name can be used to reference difference functions [and
    // when this is done the reference to the previous function is lost (unless
    // deliberately saved), though the function itself continues to exist].
    //
    // If, however, all that is needed is a simple function aliasing facility,
    // then just assign the function name to a variable, and execute using the
    // variable name
    // Original function
    function expand()
    {
        echo "expand\n";
    }
    // Prove that function exists
    echo (function_exists('expand') ? 'yes' : 'no') . "\n";
    // Use a variable to alias it
    $grow = 'expand';
    // Call function via original name, and variable, respectively
    expand();
    $grow();
    // Remove alias variable
    unset($grow);
    // ----------------------------
    function fred()
    {
        echo "fred\n";
    }
    $barney = 'fred';
    $barney();
    unset($barney);
    fred();
    // ------------
    $fred = create_function('', 'echo "fred\\n";');
    $barney = $fred;
    $barney();
    unset($barney);
    $fred();
    // ----------------------------
    function red($text)
    {
        return "<FONT COLOR='red'>{$text}</FONT>";
    }
    echo red('careful here') . "\n";
    // ------------
    $colour = 'red';
    ${$colour} = create_function('$text', 'global $colour;
return "<FONT COLOR=\'$colour\'>$text</FONT>";');
    echo ${$colour}('careful here') . "\n";
    unset(${$colour});
    // ----
    $colours = split(' ', 'red blue green yellow orange purple violet');
    foreach ($colours as $colour) {
        ${$colour} = create_function('$text', 'global $colour;
  return "<FONT COLOR=\'$colour\'>$text</FONT>";');
    }
    foreach ($colours as $colour) {
        echo ${$colour}("Careful with this {$colour}, James") . "\n";
    }
    foreach ($colours as $colour) {
        unset(${$colour});
    }
}
예제 #11
0
파일: system.php 프로젝트: houweifeng/sbase
$string .= "</script>\n";
echo "<div id='content' valign='top' ></div>\n";
echo "<div id='pagesplit' valign='top' ></div><br>\n";
echo $string;
unset($string);
/****************************************user management ******************************************/
/****************************************user UPDATE form******************************************/
if (isset($_GET['op']) && $_GET['op'] == 'user_edit') {
    if (isset($_GET['user_id'])) {
        $user_id = mysql_escape_string($_GET['user_id']);
    } else {
        die(red(INVALID_USER_ID));
    }
    $_user_ = $sess_user->user_exists('', $user_id);
    if (!$_user_) {
        die(red(INVALID_USER_ID));
    } else {
        @extract($_user_);
        print_r($_user_);
    }
    ?>
<script language='javascript'>
function check_update_input(form){
        if((form.password.value || form.password1.value) && form.password.value != form.password1.value){
                alert('您输入的两次密码不一致');
                return false;
        }
        return true;
}
</script>
<TABLE cellspacing=1 bgcolor='#000000' width=100% align=center class='form'>
예제 #12
0
파일: edit.php 프로젝트: xurenlu/tik
编辑页面<?php 
echo red($data["id"]);
?>
<form method="POST" action="?act=save">
<input name="id" type="hidden" value="<?php 
echo h($data["id"]);
?>
"/>
<h3>内容:</h3>
<table >
<tr >
<td>
<textarea name="content" rows="20" cols="65" style="height:400px;"><?php 
if (!empty($data["content"])) {
    echo h($data["content"]);
}
?>
</textarea>
</td>
<td>
<iframe src="?act=files" height="400" width="300" frameborder="0"></iframe>
</td>
</tr>
</table>
<p>
<button type="submit">提交</button>

</form>
<?php 
js("jquery");
?>
예제 #13
0
파일: solEval v1.1.php 프로젝트: axomar/ITS
function Evaluation($id, $value, $input, $exercise_id, $operatorData, $answer)
{
    $m = new EvalMath();
    $xml = simplexml_load_file($exercise_id) or die("Error: Cannot create object");
    $count_options = $xml->input[$id]->count();
    for ($i = 0; $i < $count_options; $i++) {
        $operator = $xml->input[$id]->option[$i]->operator;
        $equation = trim($xml->input[$id]->option[$i]->equation);
        $data = explode(" ", $equation);
        $equation = "";
        $operatorDT = "";
        if ($operator == 'IF') {
            // retrieve elements from de conditional
            $cont = 0;
            foreach ($data as $element) {
                if ($element[0] == 'v') {
                    $trimmed = intval(ltrim($element, "v"));
                    $value[$cont] = strval($input[$trimmed]);
                } elseif ($element[0] == 'a') {
                    $trimmed = intval(ltrim($element, "a"));
                    $value[$cont] = strval($answer[$trimmed - 1]);
                } else {
                    $value[$cont] = strval($element);
                }
                //if($value[$cont] == "==")
                //  return "ccc";
                $cont++;
            }
            // evaluate one or two conditional statements
            if ($cont <= 3) {
                if (condicional($value[0], $data[1], $value[2])) {
                    return $xml->input[$id]->option[$i]->result;
                    $i = $count_options;
                }
            } else {
                if ($data[3] == "and") {
                    if (condicional($value[0], $data[1], $value[2]) and condicional($value[4], $data[5], $value[6])) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                } else {
                    if ($data[3] == "or") {
                        if (condicional($value[0], $data[1], $value[2]) or condicional($value[4], $data[5], $value[6])) {
                            return $xml->input[$id]->option[$i]->result;
                            $i = $count_options;
                        }
                    }
                }
            }
            /*
            switch($data[1]) 
            {
             case "==": 
            			if($equation == $data[2]) 
            			  {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;
            			  }
            			  break;
             case "!=": if($equation != $data[2]) 
            			   {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;			
            			   }
            			  break;
             case "GT": if($equation > $data[2]) 
            			   {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;			
            			   }
            			  break;
             case "GE": if($equation >= $data[2]) 
            			   {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;			
            			   }
            			  break;
             case "LT": if($equation < $data[2]) 
            			   {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;			
            			   }
            			  break;			  
             case "LE": if($equation <= $data[2]) 
            			   {return $xml->input[$id]->option[$i]->result;
            			    $i=$count_options;			
            			   }
            			  break;
            }	// SWITCH
            */
        } else {
            foreach ($data as $element) {
                if (is_numeric($element)) {
                    $equation .= $element;
                } else {
                    if ($element[0] == 'o') {
                        $operatorDT = ltrim($element, "o");
                    } elseif ($element[0] == 'v') {
                        $trimmed = intval(ltrim($element, "v"));
                        $equation .= $input[$trimmed];
                    } elseif ($element[0] == 'a') {
                        $trimmed = intval(ltrim($element, "a"));
                        $equation .= $answer[$trimmed - 1];
                    } else {
                        $equation .= $element;
                    }
                    /*		
                    		elseif (strpos($element,'v') === False)
                    		{ 
                    		 $equation .= $element;
                    		}
                    		else
                    		{ 
                    		 $trimmed = intval(ltrim($element, "v"));
                             $equation .= $input[$trimmed];
                    		}		 
                    */
                }
            }
            //	return $equation[3];
            //	  $equation = "mcm(2,4)";
            if (strstr($equation, "mcm")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = mcm(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "smn")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = smn(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "smd")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = smd(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "cod")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = cod(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "red")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = red(intval($valor[0]), intval($valor[1]));
            } elseif (strstr($equation, "txt")) {
                $valor = explode(",", substr($equation, 3));
                $equation_result = txt($valor[0], $valor[1]);
            } else {
                $equation_result = $m->evaluate($equation);
            }
            if ($operatorDT == "") {
                $operatorData = "";
            }
            // return strval($equation_result);
            switch ($operator) {
                case "==":
                    if ($equation_result == $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "!=":
                    if ($equation_result != $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "GT":
                    if ($equation_result > $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "GE":
                    if ($equation_result >= $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "LT":
                    if ($equation_result < $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
                case "LE":
                    if ($equation_result <= $value && $operatorDT == $operatorData) {
                        return $xml->input[$id]->option[$i]->result;
                        $i = $count_options;
                    }
                    break;
            }
            // SWITCH
        }
        // else IF
    }
    // option's LOOP
}
예제 #14
0
function learn(&$user, $filter)
{
    $card = next_card($user, $filter);
    if ($card == NULL) {
        return false;
    }
    $user_card = sql_single_query("select * from user_cards where user_id = {$user['id']} and card_id = {$card['id']}");
    $mylang = $user['language'];
    // pick out the second language from a (for example: /en-ro/) tag (which should be the first tag)
    // note this only works for language cards, this needs work WORK !!!
    $learning = substr($card['tags'], 4, 2);
    $language = get_translated_language($mylang, $learning);
    $prompt = array("en" => "What is the {$language} for ", "nl" => "Wat is het {$language} voor", "de" => "Wie sagt man auf {$language}", "ro" => "Cum se zice in {$language}")[$mylang];
    $goodanswer = array("en" => "the right answer was", "nl" => "het goede antwoord was", "de" => "die richtige antword war", "ro" => "bun resuns e");
    $front = json_decode($card['front'], 1);
    $back = json_decode($card['back'], 1);
    $exposure_start = microtime(true);
    // prompt the user and wait for the answer
    if (abs($user_card['first'] - time(0)) < 5) {
        $fresh = red("*");
    } else {
        $fresh = " ";
    }
    $answer = termline("{$fresh} {$prompt}: " . color_string($front['sp'], "yellow") . " ");
    $exposure_took = intval(1000 * (microtime(true) - $exposure_start));
    if ($answer === NULL) {
        return false;
    }
    if (process_answer($user, $card, $answer, $exposure_took)) {
        echo correct($mylang);
        $user['ngood']++;
    } else {
        $user['nfalse']++;
        echo $goodanswer[$mylang] . ": " . color_string($back['sp'], "yellow") . "\n";
        echo wrong($mylang);
    }
    $ratio = intval(100 * ($user['ngood'] / ($user['ngood'] + $user['nfalse'])));
    $interval = sql_simple_query("select `interval` from user_cards where id={$user_card['id']}");
    echo "! took {$exposure_took} ms, right this session: {$ratio}% total score {$user['score']} next in {$interval} seconds\n";
    echo "\n";
    echo "\n";
    return true;
}
예제 #15
0
파일: query.php 프로젝트: houweifeng/sbase
            } else {
                $result_string .= "<TR align='center'>\n";
                $result_string .= "<TD bgcolor='#ffffff' align=left width=200 ><b>" . $k . "</b></TD>\n";
                $result_string .= "<TD bgcolor='#ffffff' align=left>" . $url_data_array[$v] . "</TD>\n";
                $result_string .= "</TR>\n";
            }
        }
        $result_string .= "<TR align='center'>\n";
        $result_string .= "<TD bgcolor='#ffffff' align=left width=200 ></TD>\n";
        $result_string .= "<TD bgcolor='#ffffff' align=left>\n";
        $result_string .= "<input type=button name='opsubmit' value='重新抓取' ";
        $result_string .= " onclick='javascript:ActionUrlinfoForm(this.form, \"redownload\");'>\n";
        $result_string .= "</TD></TR>\n";
        $result_string .= "</FORM></TABLE>\n";
    } else {
        $result_string = red("没有找到[{$url}]相关记录");
    }
    echo $result_string;
}
if (isset($_GET['op']) && $_GET['op'] == 'view_info') {
    $objdata = new cDatadb($dbdata);
    $objstore = new cStoredb($dbstore);
    $url = mysql_escape_string($_GET['url']);
    $pri = $objdata->find_url($url);
    $result_string = "<TABLE cellspacing=1 bgcolor='#000000' width='100%' align=center>\n";
    $result_string .= "<FORM action='query.php' method='post' name='info_list' >\n";
    $result_string .= "<input type=hidden name='op' value='pchange' >\n";
    $result_string .= "<input type=hidden name='url' value='{$url}'>\n";
    $result_string .= "<TR align='center'>\n";
    $result_string .= "<TH bgcolor='#C0C0C0' align=left >名称</TH>\n";
    $result_string .= "<TH bgcolor='#C0C0C0' align=left >结果</TH>\n";
예제 #16
0
function check($value)
{
    return $value ? green('OK') : red('FAIL');
}
예제 #17
0
 // find other students associated with the same account
 $xstudents = DBGet(DBQuery("SELECT s.STUDENT_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fssa WHERE fssa.ACCOUNT_ID='" . $student['ACCOUNT_ID'] . "' AND s.STUDENT_ID=fssa.STUDENT_ID AND s.STUDENT_ID!='" . UserStudentID() . "'" . ($_REQUEST['include_inactive'] ? '' : " AND exists(SELECT '' FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=s.STUDENT_ID AND SYEAR='" . UserSyear() . "' AND (START_DATE<=CURRENT_DATE AND (END_DATE IS NULL OR CURRENT_DATE<=END_DATE)))")));
 echo '<FORM action="Modules.php?modname=' . $_REQUEST[modname] . '&modfunc=update" method="POST">';
 DrawHeader('<label>' . CheckBoxOnclick('include_inactive') . ' ' . _('Include Inactive Students in Shared Account') . '</label>', SubmitButton(_('Save')));
 echo '<BR />';
 //modif Francois: fix SQL bug invalid numeric data
 if (isset($error)) {
     echo $error;
 }
 PopTable('header', _('Account Information'), 'width="100%"');
 echo '<TABLE class="width-100p">';
 echo '<TR>';
 echo '<TD class="valign-top">';
 echo '<TABLE class="width-100p"><TR>';
 echo '<TD class="valign-top">' . NoInput($student['FULL_NAME'], '<b>' . $student['STUDENT_ID'] . '</b>') . '</TD>';
 echo '<TD class="valign-top">' . NoInput(red($student['BALANCE']), _('Balance')) . '</TD>';
 echo '</TR></TABLE>';
 echo '</TD></TR></TABLE>';
 echo '<HR>';
 echo '<TABLE class="width-100p cellspacing-0 cellpadding-0">';
 echo '<TR><TD class="valign-top">';
 echo '<TABLE class="width-100p cellpadding-6">';
 echo '<TR>';
 echo '<TD>';
 // warn if account non-existent (balance query failed)
 if ($student['BALANCE'] == '') {
     //var_dump($student['ACCOUNT_ID']);
     echo TextInput(array($student['ACCOUNT_ID'], '<span style="color:red">' . $student['ACCOUNT_ID'] . '</span>'), 'food_service[ACCOUNT_ID]', _('Account ID'), 'size=12 maxlength=10');
     $warning = _('Non-existent account!');
     echo button('warning', '', '"#" onMouseOver=\'stm(["' . _('Warning') . '","' . str_replace('"', '\\"', str_replace("'", '&#39;', $warning)) . '"],tipmessageStyle);\' onMouseOut=\'htm()\'');
 } else {
예제 #18
0
 public function search()
 {
     $type = !empty($_POST['type']) ? $_POST['type'] : 'cort';
     if (isset($_POST['searchSubmit'])) {
         $keywords = !empty($_POST['keywords']) ? t($_POST['keywords']) : '';
         if (!$keywords) {
             $this->error('关键字太少');
         }
         if ($type == 'name') {
             $where = 'gid=' . $this->gid . " AND is_del=0 AND name like '%{$keywords}%'";
             $topiclist = $this->topic->order('top DESC,replytime DESC')->where($where)->findPage(3);
             foreach ($topiclist['data'] as $k => $v) {
                 $topiclist['data'][$k]['tid'] = $topiclist['data'][$k]['id'];
                 $topiclist['data'][$k]['name'] = red($topiclist['data'][$k]['name'], $keywords);
                 $topiclist['data'][$k]['content'] = D('Post')->getField('content', 'tid=' . $v['id'] . " AND istopic=1");
             }
         } elseif ($type == 'cort') {
             $topiclist = $this->topic->getSearch($keywords, $this->gid, 'cort');
             foreach ($topiclist['data'] as $k => $v) {
                 $topiclist['data'][$k]['title'] = red($topiclist['data'][$k]['title'], $keywords);
                 $topiclist['data'][$k]['content'] = redContent($topiclist['data'][$k]['content'], $keywords);
             }
         }
         $this->assign('keywords', $keywords);
         $this->assign('topiclist', $topiclist);
     }
     $this->setTitle($this->siteTitle['search_topic']);
     $this->assign('type', $type);
     $this->setTitle("帖子 - " . $this->groupinfo['name']);
     $this->display();
 }
예제 #19
0
<?php 
print_list("hwloc-users");
?>

<?php 
print_link("hwloc developers list", "hwloc-devel");
?>

<P>This list is used for general questions and discussion of hwloc.
Please see the "<a href="<?php 
printf("{$topdir}/community/help/");
?>
">Getting Help</a>" page for details on submitting requests for
help.  <?php 
red("Subscribers");
?>
 can post questions, comments,
suspected bug reports, etc. to the list at the following address:</p>

<?php 
print_list("hwloc-devel");
?>

<?php 
print_link("Git commit list (<font color=red>USERS\nCANNOT POST TO THIS LIST</font>)", "hwloc-commits");
?>

<p>A mail is sent to this list for every git push to Github in the
hwloc code base.  The mail includes a list of files that were changed,
the developer's commit message, and a diff of the changes.  <strong>Only the
예제 #20
0
파일: login.php 프로젝트: houweifeng/sbase
    session_unregister('sess_user');
    go2url('index.php');
}
//change password
if (isset($_POST['op']) && $_POST['op'] == 'change') {
    $old_password = isset($_POST['old_password']) ? mysql_escape_string($_POST['old_password']) : '';
    $password1 = isset($_POST['password1']) ? mysql_escape_string($_POST['password1']) : '';
    $password2 = isset($_POST['password2']) ? mysql_escape_string($_POST['password2']) : '';
    if ($old_password && $password1 && $password2) {
        if ($password1 != $password2) {
            die(MSG_USER_PASSWORD_CONFIRM_FAILED);
        } else {
            if (!$sess_user->verify($sess_user->user_name, $old_password)) {
                echo red(MSG_OLDPASSWORD_ERROR);
            } elseif (!$sess_user->password_update($sess_user->user_id, $sess_user->user_name, $password1)) {
                echo red(MSG_UPDATE_PASSWORD_FAILED);
            } else {
                //echo red(MSG_UPDATE_PASSWORD_SUCCESSED.":[$password1]");
                go2url('index.php');
            }
        }
    } else {
        die(MSG_ENTER_FULL_DETAIL);
    }
}
//change password form
if (isset($_GET['op']) && $_GET['op'] == 'change') {
    require_once './include/header.inc.php';
    ?>
		<div class="form">
		<form action="login.php" method="post">
예제 #21
0
            DBQuery('BEGIN; ' . $sql1 . '; ' . $sql2 . '; COMMIT');
            unset($_SESSION['FSA_sale']);
        }
        unset($_REQUEST['modfunc']);
    } else {
        unset($_REQUEST['modfunc']);
    }
    unset($_REQUEST['submit']);
}
if (UserStudentID() && !$_REQUEST['modfunc']) {
    $student = DBGet(DBQuery("SELECT s.STUDENT_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME,fsa.ACCOUNT_ID,fsa.STATUS,fsa.DISCOUNT,fsa.BARCODE,(SELECT BALANCE FROM FOOD_SERVICE_ACCOUNTS WHERE ACCOUNT_ID=fsa.ACCOUNT_ID) AS BALANCE FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fsa WHERE s.STUDENT_ID='" . UserStudentID() . "' AND fsa.STUDENT_ID=s.STUDENT_ID"));
    $student = $student[1];
    echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=submit&menu_id=' . $_REQUEST['menu_id'] . '" method="POST">';
    DrawHeader('', SubmitButton(_('Cancel Sale'), 'submit[cancel]') . SubmitButton(_('Complete Sale'), 'submit[save]'));
    echo '</FORM>';
    DrawHeader(NoInput($student['FULL_NAME'], '&nbsp;' . $student['STUDENT_ID']), '', NoInput(red($student['BALANCE']), _('Balance')));
    if ($student['BALANCE'] != '') {
        echo '<TABLE class="width-100p">';
        echo '<TR><TD class="width-100p valign-top">';
        $RET = DBGet(DBQuery('SELECT fsti.DESCRIPTION,fsti.AMOUNT FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti WHERE fst.ACCOUNT_ID=\'' . $student['ACCOUNT_ID'] . '\' AND fst.STUDENT_ID=\'' . UserStudentID() . '\' AND fst.SYEAR=\'' . UserSyear() . '\' AND fst.SHORT_NAME=\'' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . '\' AND fst.TIMESTAMP BETWEEN CURRENT_DATE AND \'tomorrow\' AND fsti.TRANSACTION_ID=fst.TRANSACTION_ID'));
        $columns = array('DESCRIPTION' => _('Item'), 'AMOUNT' => _('Amount'));
        $singular = sprintf(_('Earlier %s Sale'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']);
        $plural = sprintf(_('Earlier %s Sales'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']);
        ListOutput($RET, $columns, $singular, $plural, $link, false, array('save' => false, 'search' => false));
        // IMAGE
        //modif Francois: fix error Warning: fclose() expects parameter 1 to be resource, boolean given
        //		if($file = @fopen($picture=$StudentPicturesPath.'/'.UserSyear().'/'.UserStudentID().'.jpg','r') || $file = @fopen($picture=$StudentPicturesPath.'/'.(UserSyear()-1).'/'.UserStudentID().'.jpg','r'))
        if (file_exists($picture = $StudentPicturesPath . UserSyear() . '/' . UserStudentID() . '.jpg') || file_exists($picture = $StudentPicturesPath . (UserSyear() - 1) . '/' . UserStudentID() . '.jpg')) {
            //			fclose($file);
            echo '</TD><TD rowspan="2" style="text-align:left; width:150px;"><IMG SRC="' . $picture . '" width="150">';
        }
예제 #22
0
파일: huck.php 프로젝트: krasimir/fabrico
function error($text, $line_break = true)
{
    red($text, $line_break);
    die;
}
예제 #23
0
 }
 echo '<BR>';
 PopTable('header', 'Account Information', 'width=100%');
 echo '<TABLE width=100%>';
 echo '<TR>';
 echo '<TD valign=top>';
 echo '<TABLE width=100%><TR>';
 echo '<TD valign=top>';
 echo $staff['FIRST_NAME'] . ' ' . $staff['MIDDLE_NAME'] . ' ' . $staff['LAST_NAME'] . '<BR>';
 echo '<b><small>' . $staff['STAFF_ID'] . '</small></b>';
 if (!$staff['BALANCE']) {
     $warning = 'This user does not have a Meal Account.';
     echo '<BR>' . button('warning', '', '# onMouseOver=\'stm(["Warning","' . $warning . '"],["white","#006699","","","",,"black","#e8e8ff","","","",,,,2,"#006699",2,,,,,"",,,,]);\' onMouseOut=\'htm()\'');
 }
 echo '</TD>';
 echo '<TD valign=top>' . red($staff['BALANCE']) . '<BR><small>Balance</small></TD>';
 echo '</TR></TABLE>';
 echo '</TD></TR></TABLE>';
 echo '<HR>';
 echo '<TABLE width=100% border=0 cellpadding=0 cellspacing=0>';
 echo '<TR><TD valign=top>';
 echo '<TABLE border=0 cellpadding=6 width=100%>';
 echo '<TR>';
 echo '<TD>';
 $options = array('Inactive' => 'Inactive', 'Disabled' => 'Disabled', 'Closed' => 'Closed');
 echo SelectInput($staff['STATUS'], 'food_service[STATUS]', 'Status', $options, 'Active');
 echo '</TD>';
 echo '<TD>';
 echo TextInput($staff['BARCODE'], 'food_service[BARCODE]', 'Barcode', 'size=12 maxlength=25');
 echo '</TD>';
 echo '</TR>';
예제 #24
0
        }
        unset($_REQUEST['modfunc']);
    } else {
        unset($_REQUEST['modfunc']);
    }
    unset($_REQUEST['submit']);
}
if (UserStudentID() && !$_REQUEST['modfunc']) {
    $student = DBGet(DBQuery("SELECT s.STUDENT_ID,CONCAT(" . (Preferences('NAME') == 'Common' ? 'coalesce(s.CUSTOM_200000002,s.FIRST_NAME)' : 's.FIRST_NAME') . ",' ',s.LAST_NAME) AS FULL_NAME,fsa.ACCOUNT_ID,fsa.STATUS,fsa.DISCOUNT,fsa.BARCODE,(SELECT BALANCE FROM FOOD_SERVICE_ACCOUNTS WHERE ACCOUNT_ID=fsa.ACCOUNT_ID) AS BALANCE FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fsa WHERE s.STUDENT_ID='" . UserStudentID() . "' AND fsa.STUDENT_ID=s.STUDENT_ID"));
    $student = $student[1];
    echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=submit&menu_id={$_REQUEST['menu_id']} method=POST>";
    DrawHeader('', SubmitButton('Cancel Sale', 'submit[cancel]') . SubmitButton('Complete Sale', 'submit[save]'));
    echo '</FORM>';
    echo '<TABLE width=100%><TR>';
    echo '<TD valign=top>' . NoInput($student['FULL_NAME'], $student['STUDENT_ID']) . '</TD>';
    echo '<TD valign=top>' . NoInput(red($student['BALANCE']), 'Balance') . '</TD>';
    echo '</TR></TABLE>';
    echo '<HR>';
    if ($student['BALANCE']) {
        echo '<TABLE border=0 width=100%>';
        echo '<TR><TD width=100% valign=top>';
        $RET = DBGet(DBQuery('SELECT fsti.DESCRIPTION,fsti.AMOUNT FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti WHERE fst.ACCOUNT_ID=' . $student['ACCOUNT_ID'] . ' AND fst.STUDENT_ID=' . UserStudentID() . ' AND fst.SYEAR=' . UserSyear() . ' AND fst.SHORT_NAME=\'' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . '\' AND fst.TIMESTAMP BETWEEN CURRENT_DATE AND \'tomorrow\' AND fsti.TRANSACTION_ID=fst.TRANSACTION_ID'));
        $columns = array('DESCRIPTION' => 'Item', 'AMOUNT' => 'Amount');
        ListOutput($RET, $columns, 'Earlier ' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . ' Sale', 'Earlier ' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . ' Sales', $link, false, array('save' => false, 'search' => false));
        // IMAGE
        if ($file = @fopen($picture = $StudentPicturesPath . '/' . UserSyear() . '/' . UserStudentID() . '.jpg', 'r') || ($file = @fopen($picture = $StudentPicturesPath . '/' . (UserSyear() - 1) . '/' . UserStudentID() . '.jpg', 'r'))) {
            fclose($file);
            echo '<TD rowspan=2 width=150 align=left><IMG SRC="' . $picture . '" width=150></TD>';
        }
        echo '</TD></TR>';
        echo '<TR><TD width=100% valign=top>';
예제 #25
0
        }
        unset($_REQUEST['modfunc']);
    } else {
        unset($_REQUEST['modfunc']);
    }
    unset($_REQUEST['submit']);
}
if (UserStaffID() && !$_REQUEST['modfunc']) {
    $staff = DBGet(DBQuery("SELECT s.STAFF_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME,(SELECT STAFF_ID FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS ACCOUNT_ID,(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE FROM STAFF s WHERE s.STAFF_ID='" . UserStaffID() . "'"));
    $staff = $staff[1];
    echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=submit&menu_id={$_REQUEST['menu_id']} method=POST>";
    DrawHeader('', SubmitButton(_('Cancel Sale'), 'submit[cancel]') . SubmitButton(_('Complete Sale'), 'submit[save]'));
    echo '</FORM>';
    echo '<TABLE width=100%><TR>';
    echo '<TD valign=top>' . NoInput($staff['FULL_NAME'], $staff['STAFF_ID']) . '</TD>';
    echo '<TD valign=top>' . NoInput(red($staff['BALANCE']), _('Balance')) . '</TD>';
    echo '</TR></TABLE>';
    echo '<HR>';
    if ($staff['ACCOUNT_ID'] && $staff['BALANCE'] != '') {
        echo '<TABLE border=0 width=100%>';
        echo '<TR><TD width=100% valign=top>';
        $RET = DBGet(DBQuery("SELECT fsti.DESCRIPTION,fsti.AMOUNT FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti WHERE fst.STAFF_ID='" . UserStaffID() . "' AND fst.SYEAR='" . UserSyear() . "' AND fst.SHORT_NAME='" . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . "' AND fst.TIMESTAMP BETWEEN CURRENT_DATE AND CURRENT_DATE+1 AND fsti.TRANSACTION_ID=fst.TRANSACTION_ID"));
        $columns = array('DESCRIPTION' => _('Item'), 'AMOUNT' => _('Amount'));
        $singular = sprintf(_('Earlier %s Sale'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']);
        $plural = sprintf(_('Earlier %s Sales'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']);
        ListOutput($RET, $columns, $singular, $plural, $link, false, array('save' => false, 'search' => false));
        // IMAGE
        if ($file = @fopen($picture = $UserPicturesPath . '/' . UserSyear() . '/' . UserStaffID() . '.JPG', 'r') || ($file = @fopen($picture = $UserPicturesPath . '/' . (UserSyear() - 1) . '/' . UserStaffID() . '.JPG', 'r'))) {
            fclose($file);
            echo '<TD rowspan=2 width=150 align=left><IMG SRC="' . $picture . '" width=150></TD>';
        }
 function searchTopic()
 {
     $keywords = t($_POST['keywords']);
     if (!$keywords) {
         $this->error('关键字太少');
     }
     $where = "is_del=0 AND title like '%{$keywords}%'";
     $topiclist = D('Topic')->order('top DESC,replytime DESC')->where($where)->findPage(3);
     foreach ($topiclist['data'] as $k => $v) {
         $topiclist['data'][$k]['tid'] = $topiclist['data'][$k]['id'];
         $topiclist['data'][$k]['title'] = red($topiclist['data'][$k]['title'], $keywords);
         $content = D('Post')->getField('content', 'tid=' . $v['id'] . " AND istopic=1");
         $topiclist['data'][$k]['content'] = msubstr(t($content), 0, 100);
         $topiclist['data'][$k]['group_name'] = getgroupinfo($topiclist['data'][$k]['gid'], 'name');
         $topiclist['data'][$k]['group_id'] = $topiclist['data'][$k]['gid'];
     }
     $this->assign('keywords', $keywords);
     $this->assign('topiclist', $topiclist);
     $this->display();
 }