{
    $errorDocument = createDocument();
    $error = $errorDocument->CreateElement('error');
    $content = $errorDocument->CreateTextNode(utf8_encode('You need to search for something first.'));
    $error->appendChild($content);
    $errorDocument->appendChild($error);
    return $errorDocument->saveXML();
}
/* function treating the search results */
function request_treatment($html_content, $keywords)
{
    $matches = array();
    if (preg_match("#([0-9]+) résultat[s]{0,1} trouvé[s]{0,1} dans les titres de films.#", $html_content, $matches) == 0) {
        return generate_no_search_results($keywords);
    } else {
        return generate_search_results($html_content, $keywords, $matches[1]);
    }
}
$matches = array();
if (preg_match("^title=(.+)\$^", $_SERVER['QUERY_STRING'], $matches) == 0) {
    echo error_xml();
} else {
    $keywords = $matches[1];
    $url = $allocine_search_url . $keywords;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $html = curl_exec($ch);
    curl_close($ch);
    echo request_treatment($html, urldecode($keywords));
}
示例#2
0
        $form_error = false;
        if (empty($_POST["title"])) {
            $form_error = true;
            array_push($error, "aclTitle_" . xl('Need to enter title') . "!");
        }
        if ($_POST["title"] == "Administrators") {
            $form_error = true;
            array_push($error, "aclTitle_" . xl('Not allowed to delete the Administrators group') . "!");
        }
        //process if data is valid
        if (!$form_error) {
            acl_remove($_POST["title"], $_POST["return_value"]);
            echo "<?xml version=\"1.0\"?>\n" . "<response>\n" . "\t<success>SUCCESS</success>\n" . "</response>\n";
        } else {
            //$form_error = true, so return errors
            echo error_xml($error);
        }
    }
    if ($_POST["action"] == "returns") {
        //simply return all the possible acl return_values
        echo return_values_xml($error);
    }
}
//PROCESS ACO REQUESTS
if ($_POST["control"] == "aco") {
    if ($_POST["action"] == "list") {
        //send acl data
        echo aco_listings_xml($_POST["name"], $_POST["return_value"], $error);
    }
    if ($_POST["action"] == "add") {
        if ($_POST["selection"][0] == "null") {