Exemple #1
0
    }
    output_result(1, $result);
} else {
    if ($req == 'setup' and !empty($game)) {
        // REQUEST: Return the basic game setup information for a game.
        $g = $live->get_game_info($game, $advance);
        if (!$g) {
            output_result(0, array('err' => $cms->trans('Game not found!')));
        }
        //$g['overlay'] = false;	// testing...
        if ($cms->input['debug']) {
            print "<span style='display:block;font-size:70%'>" . join('<br/>', $live->ps->db->queries) . "</span>\n";
            var_dump($g);
            exit;
        }
        output_result(1, $g);
        // all is well, output game info
    } else {
        if (empty($game)) {
            $game = 0;
        }
        // build a list of games that are available.
        $gamelist = $live->get_game_list(array('sort' => $sort, 'order' => $order, 'start' => $start, 'limit' => $limit, 'filter' => $q));
        // assign variables to the theme
        $cms->theme->assign(array('game' => $game, 'games' => $gamelist));
    }
}
// display the output
$basename = basename(__FILE__, '.php');
//$cms->theme->add_css('css/2column.css');	// this page has a left column
$cms->theme->add_css('css/psycholive.css');
 function initialiaze_finding_table($all_customers_data, $reservation_length, $choosen_time, $options, $repeat = '', $find_new_time = '')
 {
     global $other_times;
     global $customer_data_same_time;
     global $c;
     global $all_suggested_time;
     global $auto_find;
     global $open_time;
     global $close_time;
     $output_allowed = false;
     $find_table_response = check_if_table_is_found($all_customers_data, $reservation_length, $choosen_time, $options, $repeat, $find_new_time);
     if ($find_table_response['have_table'] == 'false') {
         if ($options['provide_other_time']) {
             $all_customers_data = $find_table_response['all_customer_data'];
             $customers_data_same_times = $find_table_response['customer_data_same_time'];
             for ($x = 0; $x < count($customers_data_same_times); $x++) {
                 if ($customers_data_same_times[$x]['process'] != 'true') {
                     $choosen_time = $customers_data_same_times[$x]['Booking_Time'];
                     foreach ($customer_data_same_time as $key => $val) {
                         if ($val['Booking_Time'] == $choosen_time) {
                             $customer_data_same_time[$key]['process'] = 'true';
                         }
                     }
                     initialiaze_finding_table($all_customers_data, $reservation_length, $choosen_time, $options, 'yes');
                 }
             }
             $total_customer = count($customer_data_same_time) - 1;
             $choosen_time = $customer_data_same_time[$total_customer]['Booking_Time'];
             $c++;
             for ($k = $c; $k < 100; $k++) {
                 if ($auto_find <= $other_times) {
                     initialiaze_finding_table($all_customers_data, $reservation_length, $choosen_time, $options, 'yes', $k);
                 }
             }
             exit;
         } else {
             echo output_result('1');
             // TABLE IS NOT FOUND
             exit;
         }
         // if( $options['provide_other_time'] ){
     } else {
         $all_suggested_time[] = $find_table_response['choosen_time'];
         if ($repeat == 'yes') {
             if ($auto_find >= $other_times) {
                 $time_arrange = '';
                 foreach ($all_suggested_time as $time) {
                     if ($time_arrange == '') {
                         $time_arrange[] = $time;
                     }
                     foreach ($time_arrange as $new) {
                         if ($new != $time) {
                             $same = false;
                         } else {
                             $same = true;
                             break;
                         }
                     }
                     if (!$same) {
                         $time_arrange[] = $time;
                     }
                 }
                 sort($time_arrange);
                 foreach ($time_arrange as $time) {
                     if ($time >= $open_time && $time <= $close_time) {
                         $filter_time_arrange[] = $time;
                     }
                 }
                 if ($filter_time_arrange != '') {
                     foreach ($filter_time_arrange as $key => $val) {
                         $minutes = $val % 60 - 0;
                         $hour = ($val - $minutes) / 60 - 0;
                         if ($minutes < 10) {
                             $minutes = '0' . $minutes;
                         }
                         if ($hour < 10) {
                             $hour = '0' . $hour;
                         }
                         $filter_time_arrange[$key] = $hour . ':' . $minutes;
                     }
                     $all_other_time = implode(' , ', $filter_time_arrange);
                     $output['type'] = '2';
                     // TABLE IS NOT FOUND
                     $output['other_time'] = $all_other_time;
                     $output['type_table'] = '';
                     $output_allowed = true;
                 } else {
                     $output['type'] = '3';
                     // FULLY BOOKED
                     $output['other_time'] = '';
                     $output['type_table'] = '';
                     $output_allowed = true;
                 }
             }
             $auto_find++;
         }
         // if( $repeat == 'yes' ){
         if ($repeat == '') {
             $output['type'] = '0';
             // TABLE FOUND
             $output['other_time'] = '';
             $output['type_table'] = $find_table_response['type_table'];
             $output_allowed = true;
         }
         if ($output_allowed) {
             echo output_result($output['type'], $output['other_time'], $output['type_table']);
             exit;
         }
     }
     // if( $find_table_response['have_table'] == 'false' ){
 }
Exemple #3
0
    $scws->set_rule(ini_get('scws.default.fpath') . '/rules_cht.utf8.ini');
    $scws->set_dict(ini_get('scws.default.fpath') . '/dict_cht.utf8.xdb');
}
// apply other settings & send the text content
$scws->set_duality($duality);
$scws->set_ignore($ignore);
$scws->set_multi($multi);
$scws->send_text($data);
// fetch the result
$words = array();
while ($res = $scws->get_result()) {
    $words = array_merge($words, $res);
}
// output the result
$result = array('status' => 'ok', 'words' => $words);
output_result($result);
// -----------------------------------------------------------------
// internal functions
// -----------------------------------------------------------------
// output real result
function output_result($result)
{
    global $respond, $scws, $charset;
    if ($scws) {
        $scws->close();
    }
    // get oe (output encoding)
    if ($charset === 'utf8') {
        $charset = 'utf-8';
    }
    // header