Esempio n. 1
0
<?php

require_once 'utils.php';
require_once 'process.php';
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
if (isset($_REQUEST["key"]) and isset($_REQUEST["format"])) {
    $key = $_REQUEST["key"];
    $format = $_REQUEST["format"];
    $conv = new ConvertBook();
    try {
        $conv->convertFromS3($key, $format);
        httpRedirect("status.php?key={$key}&format={$format}");
    } catch (Exception $e) {
        error_log("FB2PDF ERROR. Convert: " . $e->getMessage());
        httpResponseCode("400 Bad Request", "Ошибка конвертации. Пожалуйста, попробуйте ешё раз.");
    }
} else {
    if (isset($_REQUEST["url"])) {
        // redirect to the index page
        $url = $_REQUEST["url"];
        if (isset($_REQUEST["auto"])) {
            httpRedirect("uploader.php?url={$url}");
        } else {
            httpRedirect("index.php?url={$url}");
        }
    } else {
        httpResponseCode("400 Bad Request", "Missing parameter \"url\"");
    }
}
Esempio n. 2
0
 }
 if (empty($_GET['redir'])) {
     $strRedirectURL = "";
     //str_replace("index".F_EXT_PHP, "", FN_INDEX);
 } else {
     $strRedirectURL = "http://" . SVR_HOST . URL_ROOT . $_GET['redir'];
 }
 if ($blnAlreadyLoggedIn) {
     if ($intCurrentUserID != $intUserID) {
         $CMS->US->Login($intUserID);
     }
 } else {
     $CMS->US->Login($intUserID);
 }
 if ($strRedirectURL) {
     httpRedirect($strRedirectURL);
     exit;
 }
 // ** Go back link ** //
 if ($strReferrer) {
     // Check logged in flag doesn't already exist
     if (strpos($strReferrer, "loggedin=1") === false) {
         // Add the flag to force a recache
         if (strpos($strReferrer, "?") !== false) {
             $strReferrer .= "&amp;loggedin=1";
         } else {
             $strReferrer .= "?loggedin=1";
         }
     }
     $strGoBack = "<li><a href=\"{$strReferrer}\">Go back to the page you were just viewing</a></li>";
 } else {
Esempio n. 3
0
                // check uploaded file
                $path = $_FILES['fileupload']['tmp_name'];
                $file = $_FILES['fileupload']['name'];
                $conv->convertFromFile($path, $file, $format, $email);
            } else {
                // deal with errors
                if ($err_upload == UPLOAD_ERR_INI_SIZE || $err_upload == UPLOAD_ERR_FORM_SIZE) {
                    throw new Exception("The uploaded file exceeds the maximum allowed size.", ConvertBook::ERR_SIZE);
                } else {
                    throw new Exception("Unable to upload file. PHP error - " . $err_upload, ConvertBook::ERR_LOAD);
                }
            }
        }
    }
    $key = $conv->bookKey;
    httpRedirect("status.php?key={$key}&format={$format}");
} catch (Exception $e) {
    error_log("FB2PDF ERROR. Uploader: " . $e->getMessage());
    $errCode = null;
    $errMessage = null;
    if ($e->getCode() == ConvertBook::ERR_ILLEGAL_ARG) {
        $errCode = "400 Bad Request";
        $errMessage = "Пожалуйста, укажите FB2 файл, который Вы бы хотели сконвертировать.";
    } else {
        if ($e->getCode() == ConvertBook::ERR_LOAD) {
            $errCode = "400 Bad Request";
            $errMessage = "Невозможно загрузить файл <b>{$file}</b>. Пожалуйста, убедитесь, что Вы правильно указали имя файла и попробуйте ешё раз.";
        } else {
            if ($e->getCode() == ConvertBook::ERR_FORMAT) {
                $errCode = "404 Not Found";
                $errMessage = "<b>{$file}</b> не существует или не является файлом в формате ZIP или FB2. Пожалуйста, выберите ZIP или FB2 файл и попробуйте ещё раз.";
Esempio n. 4
0
<?php

ob_start();
$start_time = microtime(true);
require_once 'common.php';
if (!is_readable('config.php')) {
    httpRedirect('install.php');
}
require_once 'config.php';
error_reporting(0);
httpAuth();
httpNoCache();
Db_Mysql::init(MYSQL_HOST, MYSQL_LOGIN, MYSQL_PASSWORD, MYSQL_DB);
$db = Db_Mysql::getInstance();
$db->query('SET NAMES "utf8" COLLATE "utf8_unicode_ci";');
$db->debug = 0;
if (isset($_GET['b'])) {
    header('Content-Type: text/xml');
    echo '<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
    $page = $_GET['b'];
    if (preg_match('/^[a-zA-Z]{1,20}$/', $page)) {
        if (file_exists("act/{$page}.php")) {
            include "act/{$page}.php";
        } else {
            echo "Illegal page";
        }
    } else {
        echo "Illegal page";
    }
    @ob_end_flush();
    exit;
Esempio n. 5
0
    if (file_exists($strLocation) == false) {
        $CMS->Err_MFail(M_ERR_FILE_NOT_FOUND, $strLocation);
    }
}
// Log activity
if ($strIsAvatar != "Y" && $strIsSiteImage != "Y" && !$blnThumb) {
    $intCurrentUserID = $CMS->RES->GetCurrentUserID();
    $CMS->PL->SetTitle($strSEOTitle);
    $CMS->SYS->CreateAccessLog("Downloaded file: {$strTitle}", AL_TAG_FILE_DOWNLOAD, $intCurrentUserID, "");
    // Push up those hits
    $CMS->FL->IncrementHits($intFileID);
}
// Stream file (music only)
if (!empty($_GET['stream'])) {
    if ($_GET['stream'] == "yes") {
        httpRedirect($strLocation);
        exit;
    }
}
// Required for IE, otherwise Content-disposition is ignored
if (ini_get('zlib.output_compression')) {
    ini_set('zlib.output_compression', 'Off');
}
// Download the file
switch ($strFileType) {
    case "MPG":
    case "MPEG":
    case "MP2":
    case "MP3":
        $strContentType = "audio/mpeg";
        break;
Esempio n. 6
0
<?php

require_once 'awscfg.php';
require_once 'db.php';
require_once 'utils.php';
global $awsS3Bucket;
if (!isset($_GET["key"])) {
    httpResponseCode("400 Bad Request", "Missing parameter \"key\"");
} else {
    $key = $_GET["key"];
    $url = "http://s3.amazonaws.com/{$awsS3Bucket}/{$key}";
    // update counter in the DB
    if (strstr($key, ".zip") or strstr($key, ".pdf")) {
        // TODO: pass format and actual key as separate parameters.
        // Hacking it out from a filename is bad ju-ju.
        $key = substr($key, 0, strlen($key) - 4);
        $format = 1;
        if (strstr($key, "-")) {
            $list = array();
            $list = explode("-", $key);
            $key = $list[0];
            $format = $list[1];
        }
        $db = getDBObject();
        if (!$db->updateBookCounter($key, $format)) {
            error_log("FB2PDF ERROR. Unable to update book's counter. Key={$key}");
        }
    }
    httpRedirect($url);
}
Esempio n. 7
0
            $strHTML = "<div id=\"mPage\">\n<h1>{$strPageTitle}</h1>\n<p>Article unlocked. <a href=\"{$strReturnURL}\">Return</a></p>\n</div>\n";
        } else {
            $strArticleTitle = $CMS->ART->GetTitle($intItemID);
            $strFormMsg = <<<UnlockArticle
<p>You are about to unlock the following article:</p>
<ul>
<li>Title: {$strArticleTitle}</li>
<li>ID: {$intItemID}</li>
</ul>

UnlockArticle;
        }
        break;
}
if ($blnUCPRedirect) {
    httpRedirect("http://" . SVR_HOST . FN_ADM_MANAGE_AVATARS);
}
$CMS->AP->SetTitle($strPageTitle);
if (!$_POST) {
    $strHTML = <<<END
<div id="UserCP-UserTools">
<h1>{$strPageTitle}</h1>
{$strFormMsg}
<form action="{FN_USER_TOOLS}{$strFormAction}" method="post">
<p><input type="hidden" name="dummy" value="{$intItemID}" /></p>
<p>{$strSubmitButton} {$strCancelButton}</p>
</form>
</div>

END;
}
Esempio n. 8
0
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require 'sys/header.php';
$strFeed = empty($_GET['name']) ? "" : $CMS->FilterAlphanumeric($_GET['name'], "");
$RSS = new RSSBuilder();
switch ($strFeed) {
    case "articles":
        $intAreaID = empty($_GET['id']) ? "" : $CMS->FilterNumeric($_GET['id']);
        if (!$intAreaID) {
            $strFeedburnerURL = $CMS->SYS->GetSysPref(C_PREF_RSS_ARTICLES_URL);
            if ($strFeedburnerURL) {
                $strUserAgent = empty($_SERVER['HTTP_USER_AGENT']) ? "" : $_SERVER['HTTP_USER_AGENT'];
                if (strpos(strtoupper($strUserAgent), "FEEDBURNER") !== false) {
                    // Feedburner is OK to access this URL
                } else {
                    httpRedirect($strFeedburnerURL);
                    exit;
                }
            }
        }
        exit($RSS->GetArticleRSS($intAreaID));
        break;
    case "comments":
        $intArticleID = empty($_GET['id']) ? "" : $CMS->FilterNumeric($_GET['id']);
        exit($RSS->GetCommentRSS($intArticleID));
        break;
    default:
        $CMS->Err_MFail(M_ERR_MISSINGPARAMS_SYSTEM, "name");
}