function dl_read_stat_per_path($path = "%", $sortBy, $sort, $listType, $limit)
{
    $config = dl_get_config();
    if (!isset($sortBy)) {
        $sortBy = $config["sortBy"];
    }
    if (!isset($sort)) {
        $sort = $config["sortOrder"];
    }
    if (!isset($limit)) {
        $limit = $config["top_max"];
    }
    $db = __do_db_connect();
    $sth = $db->prepare("SELECT url, counter FROM dl_statistics WHERE url LIKE :path ORDER by  {$sortBy} {$sort}");
    if ($sth) {
        $generic_path = "";
        if ($path == "%") {
            $generic_path = "%";
        } else {
            $generic_path = $path . '%';
        }
        $sth->bindParam(':path', $generic_path);
        if (!$sth->execute()) {
            print_r($sth->errorInfo());
            die("Error executing statement ");
        }
        $result = $sth->fetchAll();
        # Tidy array up, I only want named keys
        $full_result = array();
        foreach ($result as $elem => &$line) {
            if (file_exists('/mnt/usb/LibraryBox' . $line['url'])) {
                unset($line[0]);
                unset($line[1]);
                $url_expl = explode('/', $line['url']);
                $line['filename'] = end($url_expl);
                $line['url_encoded'] = rawurlencode($line['url']);
                $line['filename_encoded'] = rawurlencode(get_utf8_encoded($line['filename']));
                $full_result[] = $line;
            }
        }
        if ($listType == "top") {
            return array_slice($full_result, 0, $limit);
        }
        return $full_result;
    } else {
        print_r($db->errorInfo());
        die("\n no valid statement could be found");
    }
}
	That file lays on librarybox in the content folder 
		http://librarybox.us/content/.... 
	which is in reality on the USB stick. That file can simply exchanged without the need
	of touching the logic behind.

	Currently I don't have the path filter programmed in that script.



CHANGELOG:
	0.1 RELEASE 

********************************************/
require_once "dl_statistics.conf.php";
include "dl_statistics.func.php";
$config = dl_get_config();
$sort = $config["sortOrder"];
$sortBy = $config["sortBy"];
$top_max = $config["top_max"];
$output_type = $config["output_type"];
$list_type = $config["list_type"];
if (isset($_GET['sortOrder'])) {
    if ($_GET['sortOrder'] == 'ASC') {
        $sort = 'ASC';
    } else {
        $sort = 'DESC';
    }
}
if (isset($_GET['sortBy'])) {
    if ($_GET["sortBy"] == "url") {
        $sortBy = "url";
Пример #3
0
function vc_read_stat_sum_per_day_only($day = "%")
{
    $config = dl_get_config();
    return dl_read_stat_sum_per_day($day, $config["sortBy"], $config["sortOrder"], "all", $config["top_max"]);
}