Вход Регистрация
Файл: moduls/lib/index.php
Строк: 308
<?php

/**
* @package     Prime Social
* @link        http://primesocial.ru
* @copyright   Copyright (C) 2016 Prime Social
* @author      BoB | http://primesocial.ru/about
*/


require_once('../../core/start.php');

check_auth();

switch (
$select) {
    
    default:
    
head('Kutubxona');   

    if (
$_POST['add'] && privilegy('lib')) {
        
$name html($_POST['name']);
            
        if (empty(
$name)) {
            echo 
DIV_ERROR 'Bo`lim nomini kiriting' CLOSE_DIV;
        } else {
            
DB::$dbs->query("INSERT INTO ".LIB." (`name`) VALUES (?)", array($name));
            
header("Location: ".HOME."/lib/"); 
        }
    }

    
$all DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB."");
        
    if (
$all == 0) {
        echo 
DIV_AUT 'Bo`limlar xali ochilmagan' CLOSE_DIV;
    } else {
        
$sql DB::$dbs->query("SELECT * FROM ".LIB." ORDER BY `id` DESC ");
        while(
$folder $sql -> fetch()) {
            
$articls DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_ARTICL." WHERE `folder_id` = ? ", array($folder['id']));
            echo 
'<div class="lines">'.icon('kitob.png').' <a href="'.HOME.'/lib/'.$folder['id'].'/">'.$folder['name'].'</a> <span class="count">'.$articls.'</span> </div>';
        }
    }
    
    if (
privilegy('lib')) {
        echo 
DIV_AUT;
        echo 
'<form action="#" method="POST">';
        echo 
'<input type="text" name="name" /> ';
        echo 
'<input type="submit" name="add" value="Yangi bo`lim" /></form>';
        echo 
CLOSE_DIV
    } 
    echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <b>Kutubxona</b>' CLOSE_DIV;
    break;
    
    case 
'folder':
    
$folder DB::$dbs->queryFetch("SELECT * FROM ".LIB." WHERE `id` = ? ", array(abs(num($_GET['folder']))));
    
    if (empty(
$folder)) {
        
head('Bo`lim topilmadi');
        
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV;  
              
    } else {
        
        
head(' ' $folder['name']);
           
        
        if (isset(
$_GET['del'])) {
            if (!isset(
$_GET['go'])) {
                echo 
DIV_LI '<b>O`chirishni tastiqlang:</b> <a href="?del&go">[O`chirish]</a> <a href="'.HOME.'/lib/'.$folder['id'].'/">[Yo`q]</a>' CLOSE_DIV;
            } else {
                
DB::$dbs->query("DELETE FROM ".LIB_CAT." WHERE `folder_id` = ? ", array($folder['id']));
                
DB::$dbs->query("DELETE FROM ".LIB." WHERE `id` = ? ", array($folder['id']));
                
header("Location: ".HOME."/lib/"); 
            }    
        }

        if (isset(
$_GET['edit']) && privilegy('lib')) {
            if (
$_POST['edit']) {
                
$name html($_POST['name']);
                
                if (empty(
$name)) {
                    echo 
DIV_ERROR 'Bo`lim nomini kiriting' CLOSE_DIV;
                } else {
                    
DB::$dbs->query("UPDATE ".LIB." SET `name` = ? WHERE `id` = ? ", array($name$folder['id']));
                    
header("Location: ".HOME."/lib/".$folder['id']."/"); 
                }
            }
            
            echo 
DIV_AUT;
            echo 
'<form action="#" method="POST">';
            echo 
'Bo`limni tahrirlash:<br /><input type="text" value="'.$folder['name'].'" name="name" />';
            echo 
'<input type="submit" name="edit" value="O`zgartirish" /></form>';
            echo 
CLOSE_DIV;             
        }
                
        if (
$_POST['add'] && privilegy('lib')) {
            
$name html($_POST['name']);
                
            if (empty(
$name)) {
                echo 
DIV_ERROR 'Bo`lim nomini kiriting' CLOSE_DIV;
            } else {
                
DB::$dbs->query("INSERT INTO ".LIB_CAT." (`folder_id`, `name`) VALUES (?, ?)", array($folder['id'], $name));
                
header("Location: ".HOME."/lib/".$folder['id']."/"); 
            }
        }
                
        
$all DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_CAT." WHERE `folder_id` = ?", array($folder['id']));
            
        if (
$all == 0) {
            echo 
DIV_AUT 'Ichki bo`limlar yo`q' CLOSE_DIV;
        } else {
            
$n = new Navigator($all,$config['write']['lib_cat'],'folder='.$folder['id'].'&select=folder'); 
            
$sql DB::$dbs->query("SELECT * FROM ".LIB_CAT." WHERE `folder_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['lib_cat']." ", array($folder['id']));
            while(
$folderc $sql -> fetch()) {
                
$articls DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_ARTICL." WHERE `folderc_id` = ? ", array($folderc['id']));
                echo 
'<div class="lines">'.icon('box.png').'  <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/">'.$folderc['name'].'</a> <span class="count"> '.$articls.'</span> </div>';
            }
            echo 
$n->navi(); 
        }        
    }

    if (
privilegy('lib')) {    
        echo 
DIV_AUT;
        echo 
'<form action="#" method="POST">';
        echo 
'<input type="text" name="name" /> ';
        echo 
'<input type="submit" name="add" value="Yangi bo`lim" /></form>';
        echo 
CLOSE_DIV
        
        if (!empty(
$folder)) {
            echo 
DIV_BLOCK;
            echo 
'<a href="?edit">Bo`limni tahrirlash</a><br />';
            echo 
'<a href="?del">Bo`limni o`chirish</a><br />';
            echo 
CLOSE_DIV;  
        }
    }
    
    echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>'.(empty($folder) ? 'Bo`lim topilmadi' $folder['name']).'</b>' CLOSE_DIV;      
    break;
    
    case 
'articls':
    
$folder DB::$dbs->queryFetch("SELECT * FROM ".LIB." WHERE `id` = ? ", array(abs(num($_GET['folder']))));
    
    if (empty(
$folder)) {
        
head('Bo`lim topilmadi');
         
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Bo`lim topilmadi</b>' CLOSE_DIV;      
        require_once(
'../../core/stop.php');
        exit(); 
              
    }
        
    
$folderc DB::$dbs->queryFetch("SELECT * FROM ".LIB_CAT." WHERE `id` = ? ", array(abs(num($_GET['folderc']))));
    
    if (empty(
$folderc)) {
        
head('Ichki bo`lim topilmadi');
        
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Ichki bo`lim topilmadi</b>' CLOSE_DIV;       
        require_once(
'../../core/stop.php');
        exit(); 
              
    }
    
    
head('' $folderc['name'] . ' maqolalari');
        

    if (isset(
$_GET['del']) && privilegy('lib')) {
        if (!isset(
$_GET['go'])) {
            echo 
DIV_LI '<b>O`chirishni tastiqlang:</b> <a href="?del&go">[O`chirish]</a> <a href="'.HOME.'/lib/'.$folderc['id'].'/">[Yo`q]</a>' CLOSE_DIV;
        } else {
            
DB::$dbs->query("DELETE FROM ".LIB_CAT." WHERE `id` = ? ", array($folderc['id']));
            
header("Location: ".HOME."/lib/".$folder['id']."/"); 
        }    
    }

    if (isset(
$_GET['edit']) && privilegy('lib')) {
        if (
$_POST['edit']) {
            
$name html($_POST['name']);
            if (empty(
$name)) {
                echo 
DIV_ERROR 'Ichki bo`lim nomini kiriting' CLOSE_DIV;
            } else {
                
DB::$dbs->query("UPDATE ".LIB_CAT." SET `name` = ? WHERE `id` = ? ", array($name$folderc['id']));
                
header("Location: ".HOME."/lib/".$folder['id']."/".$folderc['id']."/"); 
            }
        }
            
        echo 
DIV_AUT;
        echo 
'<form action="#" method="POST">';
        echo 
'Ichki bo`limni tahrirlash:<br /><input type="text" value="'.$folderc['name'].'" name="name" />';
        echo 
'<input type="submit" name="edit" value="O`zgartirish" /></form>';
        echo 
CLOSE_DIV;             
    }
            
    
$all DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_ARTICL." WHERE `folderc_id` = ?", array($folderc['id']));
            
    if (
$all == 0) {
        echo 
DIV_AUT 'Maqolalar hali kiritilmagan' CLOSE_DIV;
    } else {
        
$n = new Navigator($all,$config['write']['lib_articl'],'select=articls&folder='.$folder['id'].'&folderc='.$folderc['id']); 
        
$sql DB::$dbs->query("SELECT * FROM ".LIB_ARTICL." WHERE `folderc_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['lib_articl']." ", array($folderc['id']));
        while(
$articl $sql -> fetch()) {
           echo 
'<div class="lines">'.icon('pages.png').'  <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/">'.$articl['title'].'</a>' CLOSE_DIV;
        }
        echo 
$n->navi();
    }    
    
    echo 
DIV_AUT '<b>Yangi maqola:</b><br /><form action="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/add/" enctype="multipart/form-data" method="POST">
     * Nom:<br /><input type="text" name="name" /><br /><br />
    
     * Matn:<br /><textarea name="text"></textarea><br />
    Kitobni kiritish:<br />
    <input type="file" name="file" /><br /><br />
    
    Ta`rif:<br /><textarea name="info"></textarea><br /><br />

    Screenshot:<br />
    <input type="file" name="screen" /><br />
    
    <input type="submit" name="add" value="Maqola yaratish" /></form>' 
CLOSE_DIV;
                        
    if (
privilegy('lib')) {    
        echo 
DIV_BLOCK;
        echo 
'<a href="?edit">Bo`limni tahrirlash</a><br />';
        echo 
'<a href="?del">Bo`limni o`chirish</a><br />';
        echo 
CLOSE_DIV;  
    }
    
    echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/">'.$folder['name'].'</a>/ <b>'.$folderc['name'].'</b>' CLOSE_DIV;      
    break;
    
    case 
'articl':
    
$folder DB::$dbs->queryFetch("SELECT * FROM ".LIB." WHERE `id` = ? ", array(abs(num($_GET['folder']))));
    
    if (empty(
$folder)) {
        
head('Bo`lim topilmadi');
        
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Bo`lim topilmadi</b>' CLOSE_DIV;      
        require_once(
'../../core/stop.php');
        exit(); 
              
    }
        
    
$folderc DB::$dbs->queryFetch("SELECT * FROM ".LIB_CAT." WHERE `id` = ? ", array(abs(num($_GET['folderc']))));
    
    if (empty(
$folderc)) {
        
head('Ichki bo`lim topilmadi');
        
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Ichki bo`lim topilmadi</b>' CLOSE_DIV;       
        require_once(
'../../core/stop.php');
        exit(); 
              
    }

    
$articl DB::$dbs->queryFetch("SELECT * FROM ".LIB_ARTICL." WHERE `id` = ? ", array(abs(num($_GET['articl']))));
    if (empty(
$articl)) {
        
head('Maqola topilmadi');
         
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Maqola topilmadi</b>' CLOSE_DIV;  
        require_once(
'../../core/stop.php');
        exit(); 
              
    }    
    
head('Maqola: ' $articl['title']);

    if (isset(
$_GET['del'])) {
        if (!isset(
$_GET['go'])) {
            echo 
DIV_LI '<b>O`chirishni tastiqlang:</b> <a href="?del&go">[O`chirish]</a> <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/">[Yo`q]</a>' CLOSE_DIV;
        } else {
            
DB::$dbs->query("DELETE FROM ".LIB_COMM." WHERE `articl_id` = ? ", array($articl['id']));
            @
unlink('../../files/lib/screen/'.$articl['screen']);
            @
unlink('../../files/lib/jar/'.$articl['id'].'.jar');
            @
unlink('../../files/lib/jad/'.$articl['id'].'.jad');
            @
unlink('../../files/lib/text/'.$articl['text']);
            
DB::$dbs->query("DELETE FROM ".LIB_ARTICL." WHERE `id` = ? ", array($articl['id']));
            
header("Location: ".HOME."/lib/".$folder['id']."/".$folderc['id']."/"); 
        }    
    }
                
    
    echo 
DIV_BLOCK '';
    if (!empty(
$articl['screen'])) {
        echo 
'<center><a href="'.HOME.'/files/lib/screen/'.$articl['screen'].'"><img src="'.HOME.'/files/lib/screen/'.$articl['screen'].'" width="300px;"/></a></center><br />';
    } 
    echo 
'<b>Ta`rif:</b> ' text($articl['info']);
    echo 
CLOSE_DIV;


    
nav;

 
$simvol $config['write']['lib_articl_str'];                // Sahifadagi belgilar soni

// Sahifalar bo`yicha navigatsiya

$tx file_get_contents('../../files/lib/text/'.$articl['text']);
$strrpos mb_strrpos($tx" ");
$pages 1;
// Sahifa raqamini topamiz
if (isset($_GET['page'])) {
    
$page abs(intval($_GET['page']));
    if (
$page == 0)
        
$page 1;
        
$start $page 1;
    }
    else {
        
$page $start 1;
    }
    
$t_si 0;
    if (
$strrpos) {
        while (
$t_si $strrpos) {
            
$string mb_substr($tx$t_si$simvol);
            
$t_ki mb_strrpos($string" ");
            
$m_sim $t_ki;
            
$strings[$pages] = $string;
            
$t_si $t_ki $t_si;
            if (
$page == $pages) {
                
$page_text $strings[$pages];
            }
                if (
$strings[$pages] == "") {
                   
$t_si $strrpos++;
                }
                else {
                  
$pages++;
                }
        }
                if (
$page >= $pages) {
                    
$page $pages 1;
                    
$page_text $strings[$page];
                }
                
$pages $pages 1;
                if (
$page != $pages) {
                    
$prb mb_strrpos($page_text" ");
                    
$page_text mb_substr($page_text0$prb);
                }
            }
            else {
                
$page_text $tx;
            }

            
// Maqolani filtrdan chiqarish va ko`rgazish
            
$page_text htmlentities($page_textENT_QUOTES'UTF-8');
            
$page_text nl2br($page_text);

            echo 
DIV_BLOCK $page_text CLOSE_DIV;
            
            if (
$pages 1) {
               echo 
DIV_LI
               
nav($pages,$page,$num,'');
               echo 
CLOSE_DIV;
            }
    
    echo 
DIV_BLOCK;
    echo 
''.icon('yuklama.png').'  Yuklash: <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/load/?jar">[JAR]</a> <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/load/?jad">[JAD]</a> <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/load/?txt">[TXT]</a><br />';

    
$comm DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_COMM." WHERE `articl_id` = ?", array($articl['id']));
    echo 
''.icon('chat.png').' <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/comm/">Sharhlar</a> ['.$comm.']<br />';
    echo 
CLOSE_DIV;
    
    if (
privilegy('lib')) {
        echo 
DIV_BLOCK;
        echo 
'<a href="?del">Maqolani o`chirish</a><br />';
        echo 
CLOSE_DIV;        
    }

    echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/">'.$folder['name'].'</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/">'.$folderc['name'].'</a> / <b>'.$articl['title'].'</b>' CLOSE_DIV;      
    break;
    
    case 
'comm':
    
$folder DB::$dbs->queryFetch("SELECT * FROM ".LIB." WHERE `id` = ? ", array(abs(num($_GET['folder']))));
    
    if (empty(
$folder)) {
        
head('Bo`lim topilmadi');
         
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Bo`lim topilmadi</b>' CLOSE_DIV;      
        require_once(
'../../core/stop.php');
        exit(); 
              
    }
        
    
$folderc DB::$dbs->queryFetch("SELECT * FROM ".LIB_CAT." WHERE `id` = ? ", array(abs(num($_GET['folderc']))));
    
    if (empty(
$folderc)) {
        
head('Ichki bo`lim topilmadi');
         
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Ichki bo`lim topilmadi</b>' CLOSE_DIV;       
        require_once(
'../../core/stop.php');
        exit(); 
              
    }

    
$articl DB::$dbs->queryFetch("SELECT * FROM ".LIB_ARTICL." WHERE `id` = ? ", array(abs(num($_GET['articl']))));
    if (empty(
$articl)) {
        
head('Maqola topilmadi');
         
        echo 
DIV_ERROR 'Xatolik!' CLOSE_DIV
        
        echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <b>Maqola topilmadi</b>' CLOSE_DIV;  
        require_once(
'../../core/stop.php');
        exit(); 
              
    }    
    
head('Maqolaga sharhlar'); 
    
    if (
$_POST) {
        
$comm html($_POST['comm']);
        
        if (empty(
$comm)) {
            
$err 'Sharh bo`sh';
        }
                
        if (!empty(
$err)) {
            echo 
DIV_ERROR $err CLOSE_DIV;
        } else {
            
DB::$dbs->query("INSERT INTO ".LIB_COMM." (`articl_id`, `user_id`, `comm`, `time`) VALUES (?, ?, ?, ?)", array($articl['id'], $user['user_id'], $commtime()));
            
balls_operation(2);
            echo 
DIV_MSG 'Sharh kiritildi' CLOSE_DIV;                    
        }
    }
            
    
$comm DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LIB_COMM." WHERE `articl_id` = ?", array($articl['id']));
 

    if (!empty(
$_GET['del_comm'])) {
        
DB::$dbs->query("DELETE FROM ".LIB_COMM." WHERE `id` = ? ", array(num($_GET['del_comm'])));
    }
                       
    if (empty(
$comm)) {
        echo 
DIV_BLOCK 'Sharhlar yo`q' CLOSE_DIV;
    } else {
        
$n = new Navigator($comm,$config['write']['lib_comm'],'select=comm&id='.$articl['id']); 
        
$sql DB::$dbs->query("SELECT * FROM ".LIB_COMM." WHERE `articl_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['lib_comm']."", array($articl['id']));
        while(
$comm $sql -> fetch()) {
            echo 
DIV_LI userLink($comm['user_id']) . ' [' vrem($comm['time']) . ']' . (privilegy('lib_moder') ? ' <a href="?del_comm='.$comm['id'].'">[Удал.]</a>' NULL) . CLOSE_DIV;
            echo 
DIV_BLOCK text($comm['comm']) . CLOSE_DIV;
        }
        echo 
$n->navi();                   
    }
            
    echo 
DIV_AUT;
    echo 
'<form action="#" method="POST">';
    echo 
'Sharh:<br /><textarea name="comm"></textarea><br />';
    echo 
'<input type="submit" value="Kiritish" /></form>';
    echo 
CLOSE_DIV;
            
    
bbsmile();  
            
echo 
DIV_GO '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/lib/">Kutubxona</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/">'.$folder['name'].'</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/">'.$folderc['name'].'</a> / <a href="'.HOME.'/lib/'.$folder['id'].'/'.$folderc['id'].'/'.$articl['id'].'/">'.$articl['title'].'</a> / <b>Sharhlar</b>' CLOSE_DIV;        
    break;
    
    case 
'load':
    
head('Faylni yuklash');
    
$articl DB::$dbs->queryFetch("SELECT * FROM ".LIB_ARTICL." WHERE `id` = ? ", array(abs(num($_GET['articl']))));
          
    
    echo 
DIV_BLOCK;
    if (isset(
$_GET['jar'])) {
    
        if (!
file_exists('../../files/lib/jar/' $articl['id'] . '.jar')) {
            
$text file_get_contents('../../files/lib/text/'.$articl['text']);
            
$midlet_name mb_substr($articl['title'], 010);
            
$midlet_name iconv('UTF-8''windows-1251'$midlet_name);

            
// Maqolaning matnini yozamiz
            
$files fopen("java/book.txt"'w+');
            
flock($filesLOCK_EX);
            
$book_name iconv('UTF-8''windows-1251'$articl['title']);
            
$book_text iconv('UTF-8''windows-1251'$text);
            
$result $book_text;
            
fputs($files$result);
            
flock($filesLOCK_UN);
            
fclose($files);
        
// Arxiv yaratamiz
        
require_once ('../../core/class/pclzip.lib.php');
        
$archive = new PclZip('../../files/lib/jar/' $articl['id'] . '.jar');
        
$list $archive->create('java'PCLZIP_OPT_REMOVE_PATH'java');
    }
    
    
header("Location: ".HOME."/files/lib/jar/".$articl['id'].".jar");
    
    } elseif (isset(
$_GET['jad'])) {
        
$text file_get_contents('../../files/lib/text/'.$articl['text']);
        if (!
file_exists('../../files/lib/jar/' $articl['id'] . '.jar')) {
            
$midlet_name mb_substr($articl['title'], 010);
            
$midlet_name iconv('UTF-8''windows-1251'$midlet_name);

            
// Maqolaning matnini yozamiz
            
$files fopen("java/book.txt"'w+');
            
flock($filesLOCK_EX);
            
$book_name iconv('UTF-8''windows-1251'$articl['title']);
            
$book_text iconv('UTF-8''windows-1251'$text);
            
$result $book_text;
            
fputs($files$result);
            
flock($filesLOCK_UN);
            
fclose($files);
        
// Arxiv yaratamiz
        
require_once ('../../core/class/pclzip.lib.php');
        
$archive = new PclZip('../../files/lib/jar/' $articl['id'] . '.jar');
        
$list $archive->create('java'PCLZIP_OPT_REMOVE_PATH'java');
    }
    
        if (!
file_exists('../../files/lib/jad/' $articl['id'] . '.jad')) {
            
$filesize filesize('../../files/lib/jad/' $articl['id'] . '.jar');
            
$jad_text 'Manifest-Version: 1.0
            MIDlet-1: ' 
$articl['id'] . ', , br.BookReader
            MIDlet-Name: ' 
$articl['id'] .'
            MIDlet-Vendor: Miledi
            MIDlet-Version: 1.5.3
            MIDletX-No-Command: true
            MIDletX-LG-Contents: true
            MicroEdition-Configuration: CLDC-1.0
            MicroEdition-Profile: MIDP-1.0
            TCBR-Platform: Generic version (all phones)
            MIDlet-Jar-Size: ' 
$filesize'
            MIDlet-Jar-URL: ' 
HOME '/files/lib/jar/' $articl['id'] . '.jar';
            
$files fopen('../../files/lib/jad/' $articl['id'] . '.jad''w+');
            
flock($filesLOCK_EX);
            
fputs($files$jad_text);
            
flock($filesLOCK_UN);
            
fclose($files);
        }
        
header("Location: ".HOME."/files/lib/jad/".$articl['id'].".jad");
    } elseif (isset(
$_GET['txt'])) {
        
ob_clean();
        
ob_implicit_flush();
        
header('Content-Type: text/plain; charset=utf-8'true);
        
        
header('Content-Disposition: attachment; filename='.$articl['id'].'.txt');
        
$text file_get_contents('../../files/lib/text/'.$articl['text']);
        echo 
$text;
        exit;
    } else {
        echo 
'Xatolik';
    }
    echo 
CLOSE_DIV;
    require_once(
'../../core/stop.php');
    break;
    
}


require_once(
'../../core/stop.php');
?>
Онлайн: 0
Реклама