Esempio n. 1
0
function ranks()
{
    $name = get_parameter("name");
    $ranks = "";
    // read 'ranks.txt' file line by line, extract a line that contains a matching 'name' parameter value
    // 'ranks.txt' file을 한줄 한줄 읽고, 'name' 매개변수의 값을 가진 줄(line)을 추출하시오
    $names_array = file("ranks.txt");
    foreach ($names_array as $line) {
        $tmp_name = explode(" ", $line)[0];
        if ($tmp_name === $name) {
            $ranks .= $line;
            break;
        }
    }
    if ($ranks) {
        // emit a retured ranking data from the 'generate_xml' function as an output in XML data format
        // 'generate_xml' 함수에서 반화하는 랭킹 데이터를 XML 데이터 형식으로 만들어 내보내시오
        return generate_xml($ranks);
    } else {
        header("HTTP/1.1 410 Gone");
        die("HTTP/1.1 410 Gone - There is no data for this name/gender.");
    }
}
Esempio n. 2
0
function generate_pdf($url)
{
    $xml = pdf_FlateEncode(generate_xml($url));
    $xmllen = strlen($xml);
    $eol = '
';
    $endobj = 'endobj' . $eol;
    $xref = array();
    $pdf = '%PDF-1.5' . $eol;
    $pdf = $pdf . '%' . RandomNonASCIIString(4) . $eol;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(1) . '<</Length ' . strlen($xml) . '/Filter [/FlateDecode]/Type /EmbeddedFile>>' . $eol;
    $pdf = $pdf . 'stream' . $eol;
    $pdf = $pdf . $xml . $eol;
    $pdf = $pdf . $eol . 'endstream' . $eol;
    $pdf = $pdf . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(2) . '<</V () /Kids [' . ioRef(3) . '] /T (' . 'Top[0]' . ') >>' . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(3) . '<</Parent ' . ioRef(2) . ' /Kids [' . ioRef(4) . '] /T (Page1[0])>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(4) . '<</MK <</IF <</A [0.0 1.0]>>/TP 1>>/P ' . ioRef(5);
    $pdf = $pdf . '/FT /Btn/TU (' . 'Image' . ')/Ff 65536/Parent ' . ioRef(3);
    $pdf = $pdf . '/F 4/DA (/CourierStd 10 Tf 0 g)/Subtype /Widget/Type /Annot/T (' . 'Image[0]' . ')/Rect [107.385 705.147 188.385 709.087]>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(5) . '<</Rotate 0 /CropBox [0.0 0.0 612.0 792.0]/MediaBox [0.0 0.0 612.0 792.0]/Resources <</XObject >>/Parent ';
    $pdf = $pdf . ioRef(6) . '/Type /Page/PieceInfo null>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(6) . '<</Kids [' . ioRef(5) . ']/Type /Pages/Count 1>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(7) . '<</PageMode /UseAttachments/Pages ' . ioRef(6);
    $pdf = $pdf . '/MarkInfo <</Marked true>>/Lang (en-us)/AcroForm ' . ioRef(8);
    $pdf = $pdf . '/Type /Catalog>>';
    $pdf = $pdf . $eol . $endobj;
    $xref[] = strlen($pdf);
    $pdf = $pdf . ioDef(8) . '<</DA (/Helv 0 Tf 0 g )/XFA [(template) ' . ioRef(1) . ']/Fields [';
    $pdf = $pdf . ioRef(2) . ']>>';
    $pdf = $pdf . $endobj . $eol;
    $xrefPosition = strlen($pdf);
    $pdf = $pdf . 'xref' . $eol;
    $pdf = $pdf . '0 ' . (count($xref) + 1) . $eol;
    $pdf = $pdf . '0000000000 65535 f' . $eol;
    $i = 0;
    while ($i < count($xref)) {
        $temp = sprintf('%010d 00000 n', $xref[$i]);
        $pdf = $pdf . $temp . $eol;
        ++$i;
    }
    $pdf = $pdf . 'trailer' . '<</Size ' . (count($xref) + 1) . '/Root ' . ioRef(7) . '>>' . $eol;
    $pdf = $pdf . 'startxref' . $eol;
    $pdf = $pdf . $xrefPosition . $eol;
    $pdf = $pdf . '%%EOF';
    return $pdf;
}
Esempio n. 3
0
    }
    $from_pos += 4;
    $query_parts['search_from'] = substr($search_query, $from_pos, $where_pos - $from_pos);
    $query_parts['search_where'] = substr($search_query, $where_pos, $order_pos - $where_pos);
    return $query_parts;
}
$ids = explode(",", $_POST['records']);
add2log($_REQUEST['module'], $_REQUEST['name'], "start update xml [" . count($ids) . " objects processed]");
if (isset($_POST['custom_generate']) && $_POST['custom_generate'] == '1') {
    $path = "custom/kXML/custom_generate/{$_REQUEST['module']}/{$_REQUEST['name']}";
    if (file_exists($path)) {
        $name_this = str_replace('.php', '', $_REQUEST['name']);
        $name_this = 'generate_xml_' . $name_this;
        include_once $path;
        foreach ($ids as $id) {
            generate_xml($id);
        }
    }
    //echo "Объявления добавлены в файл выбранной Вами доски. \n Обработано объектов: ".count($ids);
    echo "Объявления добавлены в файл выбранной Вами доски.";
    return false;
}
$first_line = true;
//$bean=loadBean($_POST['module']);
$n_ = '
';
$encoding = 'UTF-8';
$search = array();
$elements = array();
$elements_h = array();
$path = $_POST['module'];
Esempio n. 4
0
    /* count of cols in 1st array */
    $b = $arr2[1];
    /* count of cols in 2nd array */
    if ($a == $b) {
        return 0;
    }
    return $a < $b ? -1 : 1;
}
prepare_conversion();
$table_names = array();
$tables = array();
$r = odbc_tables($conn);
while ($t = odbc_fetch_array($r)) {
    //    print_r($t);
    $type = $t['TABLE_TYPE'] == 'TABLE';
    $owner = true;
    if (isset($t['TABLE_OWNER'])) {
        $owner = strtolower($t['TABLE_OWNER']) != 'information_schema';
    }
    if ($type && $owner) {
        $table_names[] = $t['TABLE_NAME'];
    }
}
for ($i = 0; $i < count($table_names); $i++) {
    $cols = get_cols($conn, $table_names[$i]);
    $cnt = count($cols);
    $tables[] = array($cols, $cnt, $table_names[$i]);
}
usort($tables, "cmp");
generate_xml($tables);
Esempio n. 5
0
     db_table_struct_select();
     break;
 case 'add_query':
     add_query();
     break;
 case 'edit_query':
     edit_query();
     break;
 case 'db_tables':
     db_tables();
     break;
 case 'show_stats':
     show_stats();
     break;
 case 'generate_xml':
     generate_xml();
     break;
 case 'generate_csv':
     generate_csv();
     break;
 case 'paypal_info':
     paypal_info();
     break;
 case 'default':
     setdefault();
     break;
 case 'product_option':
     product_option();
     break;
 case 'preview':
     preview_formmaker();
Esempio n. 6
0
function creat_group($name, $descr, $list_id, $req, $group_type)
{
    global $l;
    if (trim($name) == "") {
        return array('RESULT' => 'ERROR', 'LBL' => $l->g(638));
    }
    if (trim($descr) == "") {
        return array('RESULT' => 'ERROR', 'LBL' => $l->g(1234));
    }
    //static group?
    if ($group_type == 'STATIC') {
        $static = 1;
        $req = "";
    } else {
        $static = 0;
    }
    //does $name group already exists
    $reqGetId = "SELECT id FROM hardware WHERE name='%s' and deviceid = '_SYSTEMGROUP_'";
    $argGetId = $name;
    $resGetId = mysql2_query_secure($reqGetId, $_SESSION['OCS']["readServer"], $argGetId);
    if ($valGetId = mysql_fetch_array($resGetId)) {
        return array('RESULT' => 'ERROR', 'LBL' => $l->g(621));
    }
    //insert new group
    $sql_insert = "INSERT INTO hardware(deviceid,name,description,lastdate) VALUES( '_SYSTEMGROUP_' , '%s', '%s', NOW())";
    $arg_insert = array($name, $descr);
    mysql2_query_secure($sql_insert, $_SESSION['OCS']["writeServer"], $arg_insert);
    //Getting hardware id
    $insertId = mysql_insert_id($_SESSION['OCS']["writeServer"]);
    $xml = generate_xml($req);
    //Creating group
    $sql_group = "INSERT INTO groups(hardware_id, xmldef, create_time) VALUES ( %s, '%s', UNIX_TIMESTAMP() )";
    $arg_group = array($insertId, $xml);
    mysql2_query_secure($sql_group, $_SESSION['OCS']["writeServer"], $arg_group);
    addLog("CREATE GROUPE", $name);
    //Generating cache
    if ($list_id != '') {
        $nb_computer = add_computers_cache($list_id, $insertId, $static);
        return array('RESULT' => 'OK', 'LBL' => $nb_computer);
    }
    return array('RESULT' => 'OK', 'LBL' => $l->g(607) . " " . $l->g(608));
}
Esempio n. 7
0
 $square_footage = $_POST['square_footage'];
 $bedrooms = $_POST['bedrooms'];
 $bathrooms = $_POST['bathrooms'];
 $stories = $_POST['stories'];
 $lot_size = $_POST['lot_size'];
 $year_built = $_POST['year_built'];
 $propertyType = $_POST['propertyType'];
 $pType = $_POST['pType'];
 $address = $_POST['address'];
 $street = $_POST['street'];
 $city = $_POST['city'];
 $state = $_POST['state'];
 $zip = $_POST['zip'];
 $date = date('Y-m-d');
 //echo "($street,$city,$state,$zip,'',$date";
 $xml_result = generate_xml($street, $city, $state, $zip, '', $date);
 $results = array();
 /*criteria- 1   ******** sqft->10+- age 5+-  saledate<180 prox0.5mile lot size 50+-   ***********/
 $C1Rangesqrft = MinMax(10, $square_footage);
 $C1RangeAge = MinMaxAge(5, $year_built);
 $C1Rangelot = MinMax(50, $lot_size);
 $C1Proximity = "0.5";
 /*criteria- 2   ******** sqft->10+- age 5+-  saledate<180 prox0.5mile lot size 50+-   ***********/
 $C2Rangesqrft = MinMax(15, $square_footage);
 $C2RangeAge = MinMaxAge(10, $year_built);
 $C2Rangelot = MinMax(50, $lot_size);
 $C2Proximity = "1";
 /*criteria- 3   ******** sqft->10+- age 5+-  saledate<180 prox0.5mile lot size 50+-   ***********/
 $C3Rangesqrft = MinMax(20, $square_footage);
 $C3RangeAge = MinMaxAgePer(50, $year_built);
 $C3Rangelot = MinMax(50, $lot_size);
function model_location_and_time_xml($latitude, $longitude, $radius, $datetime, $numresults, $pollutant, $maxfit)
{
    $query = query_location_time_circle_unique_entries($latitude, $longitude, $radius, $datetime, $pollutant);
    generate_xml($query, $numresults, $maxfit);
}
Esempio n. 9
0
<?php

require_once "inc/model/functions.php";
require_once "config/file_locations.php";
require_once "config/graph_variables.php";
if (isset($_POST["command"]) and strpos($_POST["command"], "create_xml") !== False) {
    error_reporting(0);
    $xml_string = generate_xml($_POST, $xml_structure_file);
    $f = fopen($new_xml_file, 'w');
    if ($f == False) {
        echo "{$new_xml_file} is not writable";
        exit;
    }
    fwrite($f, $xml_string);
    chmod("{$new_xml_file}", 0666);
    fclose($f);
    echo "successful";
    exit;
} else {
    if (isset($_POST["command"]) and $_POST["command"] == "run") {
        $result = shell_exec("sh " . $sh_file);
        if (strpos($result, "done") !== False) {
            echo "successful";
        } else {
            echo "{$sh_file} could not be executed. Try changing the persmission of the file to 755.";
        }
        exit;
    } else {
        if (isset($_GET["command"]) and $_GET["command"] == "default") {
            echo get_default($default_xml);
            exit;