<?php

mongo_connect(config('mongodb.host'), config('mongodb.db'));
log_open();
function echo_msg_flush($msg)
{
    echo '<script language="JavaScript" type="text/javascript">' . 'log_write( \'' . str_replace(array('\'', "\n", "\r"), array('"', "", ""), $msg) . '\');' . '</script>';
    for ($k = 0; $k < 50000; $k++) {
        echo ' ';
    }
    echo PHP_EOL;
}
// Turn off output buffering
ini_set('default_socket_timeout', 36000);
ini_set('max_execution_time', 36000);
$words = explode(PHP_EOL, "guerra\ncombattere\nsanguinoso");
$request = new JentiRequestWiktionary($config);
$jenti_word = new JentiWord($config);
ob_implicit_flush(TRUE);
$log = log_open();
foreach ($words as $word) {
    $word_array = $request->get_word($word);
    if ($request->error) {
        echo_msg_flush($request->error);
        log_writeln($log, $request->error);
        continue;
    }
    foreach ($word_array as $word_info) {
        $jenti_word->add_word_and_definitions($word_info);
        if (!$jenti_word->error) {
            echo_msg_flush(print_r($word_info, true));
            log_writeln($log, print_r($word_info, true));
        }
        if ($jenti_word->error) {
            echo_msg_flush($jenti_word->error);
    Quickbooks Import QBI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Quickbooks Import QBI; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
if (isset($stage) and $stage == 'process' and isset($engine) and $engine == 'orders') {
    if (!isset($qbimported)) {
        $qbimported = 0;
    }
    // Open log file
    if (QBI_LOG == 1) {
        $loghandle = log_open("orders");
    }
    if (QBI_LOG == 1) {
        $log = log_head();
    }
    // Determine default language id
    $language_id_default = get_language_id(DEFAULT_LANGUAGE);
    if (QBI_LOG == 1) {
        $log .= log_lang($language_id_default);
    }
    // Add config info to log
    if (QBI_LOG == 1) {
        $log .= log_config();
    }
    // Update prior orders
    if ($qbimported == 0) {
function log_write($text)
{
    $reglog = $GLOBALS['reglog'];
    @fwrite($reglog, $text);
}
function log_open()
{
    $reglog = fopen('/domains/jongereninspiratiedag.nl/DEFAULT/specials/registerlog.txt', 'a+');
    return $reglog;
}
function log_close()
{
    $reglog = $GLOBALS['reglog'];
    @fclose($reglog);
}
$reglog = log_open();
#error_reporting(E_ALL); // E_ALL ^ E_NOTICE
#ini_set('display_errors', 1);
function payment_costs($ticket)
{
    $costs = 0;
    if ($ticket == 'dag') {
        $costs = '10,-';
    } elseif ($ticket == 'overnacht') {
        $costs = '7,50';
    } elseif ($ticket == 'dag_overnacht') {
        $costs = '12,50';
    }
    return $costs;
}
function set_register_state(&$user, &$register_state, $state)