Пример #1
0
function get_from_server($url, $req)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    $output = curl_exec($ch);
    curl_close($ch);
    save_item($output, $req);
    return $output;
}
Пример #2
0
    // $tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
    //$sql_last_connection="SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id='".api_get_user_id()."' ORDER BY login_date DESC LIMIT 0,1";
    //$q_last_connection=Database::query($sql_last_connection);
    // if(Database::num_rows($q_last_connection) > 0) {
    //	$current_time=date('Y-m-d H:i:s');
    //  $row = Database::fetch_array($q_last_connection);
    //$i_id_last_connection=$row['login_id'];
    //    $s_sql_update_logout_date="UPDATE $tbl_track_login SET logout_date='".$current_time."' WHERE login_id='$i_id_last_connection'";
    //  Database::query($s_sql_update_logout_date);
    //   }
    // }
    if ($mylp->get_type() == 2) {
        $return .= "update_stats();";
    }
    return $return;
    //return $objResponse;
}
$interactions = array();
if (isset($_REQUEST['interact'])) {
    if (is_array($_REQUEST['interact'])) {
        foreach ($_REQUEST['interact'] as $idx => $interac) {
            $interactions[$idx] = split(',', substr($interac, 1, -1));
            if (!isset($interactions[$idx][7])) {
                //make sure there are 7 elements
                $interactions[$idx][7] = '';
            }
        }
    }
}
echo save_item($_REQUEST['lid'], $_REQUEST['uid'], $_REQUEST['vid'], $_REQUEST['iid'], $_REQUEST['s'], $_REQUEST['max'], $_REQUEST['min'], $_REQUEST['status'], $_REQUEST['t'], $_REQUEST['suspend'], $_REQUEST['loc'], $interactions, $_REQUEST['core_exit']);
Пример #3
0
function process_wdb($file)
{
    global $schema_defs;
    global $log;
    $num_recs = 0;
    //open the file for binary reading
    $fh = fopen($file, "rb");
    //select schema
    $sig = strrev(fread($fh, 4));
    $schema = split("[|]", $schema_defs[$sig]);
    $log->writeLine("File sig: {$sig}");
    //read other useless info
    fread($fh, 16);
    $bp = new BinaryParser();
    //grab each record in the file based on the schema
    //and store it inside an arrary
    while (!feof($fh)) {
        $eof = fread($fh, 8);
        if ($eof == WDB_EOF) {
            //end of file
            $log->writeLine("Found *.wdb EOF pattern. Exiting.");
            break;
        } else {
            //reset the cursor position
            fseek($fh, -8, SEEK_CUR);
        }
        $num_recs++;
        $record = array();
        $r = 0;
        foreach ($schema as $type) {
            $r++;
            $val = "";
            switch ($type) {
                case "int":
                    $val = bread_int($bp, $fh);
                    break;
                case "float":
                    $val = bread_float($bp, $fh);
                    break;
                case "short":
                    $val = bread_short($bp, $fh);
                    break;
                case "string":
                    $val = bread_string($fh);
                    break;
            }
            $record[$r] = $val;
        }
        switch ($sig) {
            case "WIDB":
                if (VERBOSE_LOGGING == 1) {
                    $log->writeLine("Saving item: " . $record[5]);
                }
                save_item($record);
                break;
            case "WQST":
                save_quest($record);
                break;
            case "WMOB":
                save_mob($record);
                break;
        }
    }
    //close the file
    fclose($fh);
    $log->writeLine("{$num_recs} records processed.");
    //TODO: delete the file if successful
    if (unlink($file)) {
        $log->writeLine("File unlinked!");
    } else {
        $log->writeLine("Could not unlink file!!!");
    }
}
Пример #4
0
            $row = Database::fetch_array($q_last_connection);
            $i_id_last_connection = $row['login_id'];
            $sql = "UPDATE {$tbl_track_login}\n                    SET logout_date='" . $current_time . "'\n                    WHERE login_id = {$i_id_last_connection}";
            Database::query($sql);
        }
    }
    if ($myLP->get_type() == 2) {
        $return .= "update_stats();";
    }
    // To be sure progress is updated.
    $myLP->save_last();
    Session::write('lpobject', serialize($myLP));
    if ($debug > 0) {
        error_log('---------------- lp_ajax_save_item.php : save_item end ----- ');
    }
    return $return;
}
$interactions = array();
if (isset($_REQUEST['interact'])) {
    if (is_array($_REQUEST['interact'])) {
        foreach ($_REQUEST['interact'] as $idx => $interac) {
            $interactions[$idx] = preg_split('/,/', substr($interac, 1, -1));
            if (!isset($interactions[$idx][7])) {
                // Make sure there are 7 elements.
                $interactions[$idx][7] = '';
            }
        }
    }
}
echo save_item(!empty($_REQUEST['lid']) ? $_REQUEST['lid'] : null, !empty($_REQUEST['uid']) ? $_REQUEST['uid'] : null, !empty($_REQUEST['vid']) ? $_REQUEST['vid'] : null, !empty($_REQUEST['iid']) ? $_REQUEST['iid'] : null, !empty($_REQUEST['s']) ? $_REQUEST['s'] : null, !empty($_REQUEST['max']) ? $_REQUEST['max'] : null, !empty($_REQUEST['min']) ? $_REQUEST['min'] : null, !empty($_REQUEST['status']) ? $_REQUEST['status'] : null, !empty($_REQUEST['t']) ? $_REQUEST['t'] : null, !empty($_REQUEST['suspend']) ? $_REQUEST['suspend'] : null, !empty($_REQUEST['loc']) ? $_REQUEST['loc'] : null, $interactions, !empty($_REQUEST['core_exit']) ? $_REQUEST['core_exit'] : '', !empty($_REQUEST['session_id']) ? $_REQUEST['session_id'] : '', !empty($_REQUEST['course_id']) ? $_REQUEST['course_id'] : '', empty($_REQUEST['finish']) ? 0 : 1, empty($_REQUEST['userNavigatesAway']) ? 0 : 1, empty($_REQUEST['statusSignalReceived']) ? 0 : 1);
Container::$legacyTemplate = 'layout_empty.html.twig';
Пример #5
0
function sphsc3()
{
    $results = array();
    $i = 0;
    do {
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidsaud.asp'; //7-8
        // 'https://content.sphsc.washington.edu/sphintra/web2/res_blurb.asp';  // 11
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidscore.asp'; // 14
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidsphd.asp'; //15
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidspb.asp';  // 16, 19
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidsmed.asp';  // 17, 20
        // 'https://content.sphsc.washington.edu/sphintra/web2/factoidsug.asp'; // 18
        // 'https://content.sphsc.washington.edu/sphintra/web2/res_stone_blurb.asp';
        //$uri = 'https://content.sphsc.washington.edu/sphintra/web2/factoidscore.asp'; // 19
        // No's:
        // http://content.sphsc.washington.edu/sphintra/web2/clinic_msg.asp
        // http://content.sphsc.washington.edu/sphintra/web2/home_right.asp
        // https://content.sphsc.washington.edu/sphintra/web2/res_stone_blurb.asp
        // http://content.sphsc.washington.edu/sphintra/web2/outreach_msg.asp
        $tids = array();
        $c = array('indent' => true, 'output-xhtml' => true, 'wrap' => 200, 'hide-comments' => true);
        $response = get_page($uri);
        $tidy = new tidy();
        $tidy->parseString($response, $c, 'utf8');
        $tidy->cleanRepair();
        preg_match("/<body[^>]*>(.*?)<\\/body>/is", $tidy, $a);
        $body = str_replace(array("\n", "\r"), '', $a[1]);
        $title = some_words(strip_tags($body));
        $results[$title] = $body;
    } while ($i++ < 20);
    foreach ($results as $k => $v) {
        save_item($k, $v, $tids);
    }
}
            $row = Database::fetch_array($q_last_connection);
            $i_id_last_connection = $row['login_id'];
            $s_sql_update_logout_date = "UPDATE {$tbl_track_login} SET logout_date='" . $current_time . "' WHERE login_id='{$i_id_last_connection}'";
            Database::query($s_sql_update_logout_date);
        }
    }
    if ($mylp->get_type() == 2) {
        $return .= "update_stats();";
    }
    //To be sure progress is updated
    $mylp->save_last();
    Session::write('lpobject', serialize($mylp));
    if ($debug > 0) {
        error_log('---------------- lp_ajax_save_item.php : save_item end ----- ');
    }
    return $return;
}
$interactions = array();
if (isset($_REQUEST['interact'])) {
    if (is_array($_REQUEST['interact'])) {
        foreach ($_REQUEST['interact'] as $idx => $interac) {
            $interactions[$idx] = split(',', substr($interac, 1, -1));
            if (!isset($interactions[$idx][7])) {
                // Make sure there are 7 elements.
                $interactions[$idx][7] = '';
            }
        }
    }
}
echo save_item(!empty($_REQUEST['lid']) ? $_REQUEST['lid'] : null, !empty($_REQUEST['uid']) ? $_REQUEST['uid'] : null, !empty($_REQUEST['vid']) ? $_REQUEST['vid'] : null, !empty($_REQUEST['iid']) ? $_REQUEST['iid'] : null, !empty($_REQUEST['s']) ? $_REQUEST['s'] : null, !empty($_REQUEST['max']) ? $_REQUEST['max'] : null, !empty($_REQUEST['min']) ? $_REQUEST['min'] : null, !empty($_REQUEST['status']) ? $_REQUEST['status'] : null, !empty($_REQUEST['t']) ? $_REQUEST['t'] : null, !empty($_REQUEST['suspend']) ? $_REQUEST['suspend'] : null, !empty($_REQUEST['loc']) ? $_REQUEST['loc'] : null, $interactions, !empty($_REQUEST['core_exit']) ? $_REQUEST['core_exit'] : '');