Example #1
0
function delete_scan($request)
{
    // Check to see if we were given a filename
    if (!isset($request['filename'])) {
        invalid_request();
    }
    // Build path to the files
    $path_tiff = $GLOBALS['scan_dir'] . '/' . $request['filename'] . '.tif';
    $path_pdf = $GLOBALS['scan_dir'] . '/' . $request['filename'] . '.pdf';
    // Check to see if the files exist, and, if so, delete them
    if (file_exists($path_tiff)) {
        unlink($path_tiff);
    }
    if (file_exists($path_pdf)) {
        unlink($path_pdf);
    }
    // Return success
    return true;
}
Example #2
0
<?php

if (invalid_request()) {
    die;
}
header('content-type: application/json');
//Sharrre by Julien Hany
$json = array('url' => '', 'count' => 0);
$json['url'] = $_GET['url'];
$url = urlencode($_GET['url']);
$type = urlencode($_GET['type']);
if (filter_var($_GET['url'], FILTER_VALIDATE_URL)) {
    if ($type == 'googlePlus') {
        //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/
        $content = parse("https://plusone.google.com/u/0/_/+1/fastbutton?url=" . $url . "&count=true");
        $dom = new DOMDocument();
        $dom->preserveWhiteSpace = false;
        @$dom->loadHTML($content);
        $domxpath = new DOMXPath($dom);
        $newDom = new DOMDocument();
        $newDom->formatOutput = true;
        $filtered = $domxpath->query("//div[@id='aggregateCount']");
        if (isset($filtered->item(0)->nodeValue)) {
            $json['count'] = str_replace('>', '', $filtered->item(0)->nodeValue);
        }
    } else {
        if ($type == 'stumbleupon') {
            $content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url={$url}");
            $result = json_decode($content);
            if (isset($result->result->views)) {
                $json['count'] = $result->result->views;