Exemplo n.º 1
0
Arquivo: abs.php Projeto: kidaa/uw-web
$output = $_GET['output'];
$callback = $_GET['callback'];
$key = $_GET['key'];
// TODO:STORE Access by key for analytics?
$results = null;
$dbs_book_codes = array("GN", "EX", "LV", "NU", "DT", "JS", "JG", "RT", "S1", "S2", "K1", "K2", "R1", "R2", "ER", "NH", "ET", "JB", "PS", "PR", "EC", "SS", "IS", "JR", "LM", "EK", "DN", "HS", "JL", "AM", "OB", "JH", "MC", "NM", "HK", "ZP", "HG", "ZC", "ML", "MT", "MK", "LK", "JN", "AC", "RM", "C1", "C2", "GL", "EP", "PP", "CL", "H1", "H2", "T1", "T2", "TT", "PM", "HB", "JM", "P1", "P2", "J1", "J2", "J3", "JD", "RV");
$osis_book_codes = array("Gen", "Exod", "Lev", "Num", "Deut", "Josh", "Judg", "Ruth", "1Sam", "2Sam", "1Kgs", "2Kgs", "1Chr", "2Chr", "Ezra", "Neh", "Esth", "Job", "Ps", "Prov", "Eccl", "Song", "Isa", "Jer", "Lam", "Ezek", "Dan", "Hos", "Joel", "Amos", "Obad", "Jonah", "Mic", "Nah", "Hab", "Zeph", "Hag", "Zech", "Mal", "Matt", "Mark", "Luke", "John", "Acts", "Rom", "1Cor", "2Cor", "Gal", "Eph", "Phil", "Col", "1Thess", "2Thess", "1Tim", "2Tim", "Titus", "Phlm", "Heb", "Jas", "1Pet", "2Pet", "1John", "2John", "3John", "Jude", "Rev");
switch ($action) {
    case 'list':
        $results = get_list($_GET['force']);
        break;
    case 'books':
        $results = get_books($_GET['version']);
        break;
    case 'chapter':
        $results = get_chapter($_GET['version'], $_GET['sectionid'], $_GET['osis'], $_GET['chapter'], $_GET['dir'], $_GET['lang'], $_GET['lang3'], $_GET['previd'], $_GET['nextid'], $_GET['bookname']);
        break;
    case 'search':
        $results = get_search($_GET['version'], $_GET['text'], $_GET['divisions']);
        break;
}
function dbs_code_to_osis($dbs_book_code)
{
    global $dbs_book_codes;
    global $osis_book_codes;
    $dbs_index = array_search($dbs_book_code, $dbs_book_codes);
    $osis_book_code = $osis_book_codes[$dbs_index];
    return $osis_book_code;
}
function osis_code_to_dbs($osis_book_code)
{
// Fetch page
if ($novel_id) {
    $novel = get_novel($list, $novel_id);
    //$DEBUG = '<pre>' . var_export($novel, true) . '</pre>';
    if ($volume_id) {
        $volume = get_volume($novel, $volume_id);
        //$DEBUG = '<pre>' . var_export($volume, true) . '</pre>';//exit($DEBUG);
        if (!$text_vert_mode) {
            $chapter_id = $chapter_id ? $chapter_id : 0;
            if (!$volume || $chapter_id >= count($volume['chapters'])) {
                //header("Location: {$url_base}{$novel_id}/{$volume_id}/");
                header('HTTP/1.0 404 Not Found');
                display_errordoc(404);
                exit;
            }
            $chapter = get_chapter($volume, $chapter_id);
            process_chapter_text($novel, $volume, $chapter);
            //$DEBUG = '<pre>' . var_export($chapter, true) . '</pre>';//exit($DEBUG);
        } else {
            // Check whether pages is cached
            $refresh_pages = false;
            $_pages_mtime_file = "{$CNF_PATH_CACHE_MTIME}{$_cache_id}_pages.json";
            if ($force_refresh || !file_exists($_pages_mtime_file)) {
                $refresh_pages = true;
            } else {
                $_pages_mtime = json_decode(file_get_contents($_pages_mtime_file), true);
                $refresh_pages = check_data_mtime($_pages_mtime);
            }
            // Regenerate pages
            if ($refresh_pages) {
                $_pages = get_pages_v($volume, $chapter);