Example #1
0
 /** Allow url fopen to crawl the code */
 static function init()
 {
     SetUp::headers();
     error_reporting(false);
     if (!ini_get('allow_url_fopen')) {
         ini_set('allow_url_fopen', 1);
     }
 }
<?php

/**
 * Copyright (c) 2014 Leonardo Cardoso (http://leocardz.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.3.0
 */
include_once "classes/Database.php";
include_once "classes/SetUp.php";
SetUp::headers();
$delete = array("id" => $_POST["id"]);
Database::delete($delete);
echo mysql_error();
Example #3
0
<?php

/**
 * Copyright (c) 2015 Leonardo Cardoso (http://leocardz.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.0
 */
/**
 * This file is only to hightlight the urls that are found shown when post is already posted. :)
 * So, it has nothing bound directly to LinkPreview class
 */
include_once "classes/SetUp.php";
include_once "classes/Highlight.php";
SetUp::init();
$data = json_decode(urldecode(base64_decode($_POST["data"])));
$text = $data->text;
$description = $data->description;
$answer = array("text" => Highlight::url($text), "description" => Highlight::url($description));
echo json_encode($answer);
Example #4
0
<?php

/**
 * Copyright (c) 2015 Leonardo Cardoso (http://leocardz.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.0
 */
include_once "classes/LinkPreview.php";
SetUp::init();
$data = json_decode(urldecode(base64_decode($_POST["data"])));
$text = $data->text;
$imageAmount = $data->imageAmount;
$text = str_replace("\n", " ", $text);
$header = "";
$linkPreview = new LinkPreview();
$answer = $linkPreview->crawl($text, $imageAmount, $header);
echo $answer;
SetUp::finish();
Example #5
0
     $extension = $resumabledata['extension'];
     $basename = $resumabledata['basename'];
     $fullfilepath = $_GET['loc'] . $resumableFilename;
     if (Utils::notList($extension, SetUp::getConfig("upload_allow_type")) == true || Utils::inList($extension, SetUp::getConfig("upload_reject_extension")) == true || Utils::inList($resumableFilename, array('.htaccess', '.htpasswd', '.ftpquota')) == true || substr($resumableFilename, 0, 1) === ".") {
         if ($_GET['resumableChunkNumber'] == 1) {
             $chunk->setError("<span><i class=\"fa fa-exclamation-triangle\"></i> " . $basename . "<strong>." . $extension . "</strong> " . SetUp::getLangString("upload_type_not_allowed") . "</span> ");
         }
         header("HTTP/1.0 200 Ok");
     } elseif (file_exists($fullfilepath)) {
         if ($_GET['resumableChunkNumber'] == 1) {
             $chunk->setWarning(" <span><i class=\"fa fa-info-circle\"></i> <strong>" . $resumableFilename . "</strong> " . SetUp::getLangString("file_exists") . "</span> ");
         }
         header("HTTP/1.0 200 Ok");
     } elseif ($chunk->checkUserUp($_GET['resumableTotalSize']) == false) {
         if ($_GET['resumableChunkNumber'] == 1) {
             $chunk->setError("<span><i class=\"fa fa-exclamation-triangle\"></i>" . " <strong>" . SetUp::getLangString("upload_exceeded") . "</strong>: " . $_GET['resumableFilename'] . "</span> ");
         }
         header("HTTP/1.0 200 Ok");
     } else {
         $temp_dir = 'tmp/' . $_GET['resumableIdentifier'];
         $chunk_file = $temp_dir . '/' . $_GET['resumableFilename'] . '.part' . $_GET['resumableChunkNumber'];
         if (file_exists($chunk_file)) {
             header("HTTP/1.0 200 Ok");
         } else {
             header("HTTP/1.0 204 No Content");
         }
     }
 }
 if (!empty($_FILES)) {
     $resumabledata = $chunk->setupFilename($_POST['resumableFilename'], $_POST['resumableIdentifier']);
     $resumableFilename = $resumabledata['filename'];
Example #6
0
<?php

require 'mail/PHPMailerAutoload.php';
require 'config.php';
require 'users.php';
require 'token.php';
require 'class.php';
session_name($_CONFIG["session_name"]);
session_start();
$lang = filter_input(INPUT_POST, 'thislang', FILTER_SANITIZE_STRING);
require 'translations/' . $lang . '.php';
$setUp = new SetUp();
$utils = new Utils();
$updater = new Updater();
$resetter = new Resetter();
$encodeExplorer = new EncodeExplorer();
$dest = filter_input(INPUT_POST, "user_email", FILTER_VALIDATE_EMAIL);
$pulito = filter_input(INPUT_POST, 'cleanurl', FILTER_SANITIZE_STRING);
$postcaptcha = filter_input(INPUT_POST, "captcha", FILTER_SANITIZE_STRING);
global $_USERS;
global $_TOKENS;
if (!$dest || $setUp->getConfig("show_captcha_reset") == true && !$postcaptcha) {
    print "<div class=\"alert alert-warning\">" . $encodeExplorer->getString("fill_all_fields") . "</div>";
    exit;
}
if (Utils::checkCaptchaReset($postcaptcha) !== true) {
    print "<div class=\"alert alert-danger\">" . $encodeExplorer->getString("wrong_captcha") . "</div>";
    exit;
}
if (!$updater->findEmail($dest)) {
    print "<div class=\"alert alert-danger\">" . $encodeExplorer->getString("email_not_exist") . "</div>";
Example #7
0
<?php

require_once 'config.php';
require_once 'users.php';
require_once 'class.php';
require_once 'remember.php';
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$downloader = new Downloader();
$utils = new Utils();
$logger = new Logger();
$actions = new Actions();
$getcloud = $_POST["setdel"];
$hash = filter_input(INPUT_POST, "h", FILTER_SANITIZE_STRING);
$doit = filter_input(INPUT_POST, "doit", FILTER_SANITIZE_STRING);
$time = filter_input(INPUT_POST, "t", FILTER_SANITIZE_STRING);
if ($doit != $time * 12) {
    die('Direct access not permitted');
}
$alt = $setUp->getConfig('salt');
$altone = $setUp->getConfig('session_name');
if ($hash && $time && $gateKeeper->isUserLoggedIn() && $gateKeeper->isAllowed('delete_enable')) {
    if (md5($alt . $time) === $hash && $downloader->checkTime($time) == true) {
        foreach ($getcloud as $pezzo) {
Example #8
0
 /**
  * Generated from @assert ("2.1) === false.
  *
  * @covers pgn\tags\SetUp::validate
  */
 public function testValidate10()
 {
     $this->assertSame(false, $this->object->validate("2.1"));
 }
Example #9
0
<?php

$encodeExplorer = new EncodeExplorer();
$setUp = new SetUp();
$updater = new Updater();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
global $baselang;
$baselang = $_TRANSLATIONS;
$posteditlang = filter_input(INPUT_POST, "editlang", FILTER_SANITIZE_STRING);
$postnewlang = filter_input(INPUT_POST, "newlang", FILTER_SANITIZE_STRING);
$thelang = $posteditlang ? $posteditlang : "en";
$thenewlang = $postnewlang ? $postnewlang : null;
$editlang = $thenewlang ? $thenewlang : $thelang;
global $_TRANSLATIONSEDIT;
if ($posteditlang) {
    include 'translations/' . $editlang . '.php';
    $_TRANSLATIONSEDIT = $_TRANSLATIONS;
} else {
    $_TRANSLATIONSEDIT = $baselang;
}
/**
* Get lang
*/
if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
    $_SESSION['lang'] = $_GET['lang'];
}
if (isset($_SESSION['lang'])) {
    $lang = $_SESSION['lang'];
Example #10
0
global $_ERROR;
global $_WARNING;
global $_SUCCESS;
global $_IMAGES;
global $_USERS;
global $_DLIST;
require_once 'doc-admin/remember.php';
global $_REMEMBER;
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
require_once 'doc-admin/translations/' . $encodeExplorer->lang . '.php';
global $_TRANSLATIONS;
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$location = new Location();
$location->init();
$downloader = new Downloader();
$updater = new Updater();
$updater->init();
$template = new Template();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
require_once 'doc-admin/token.php';
global $_TOKENS;
$resetter = new Resetter();
$resetter->init();
if ($gateKeeper->isAccessAllowed()) {
    $fileManager = new FileManager();
Example #11
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
require 'config.php';
session_name($_CONFIG["session_name"]);
session_start();
if (isset($_GET['logout'])) {
    unset($_SESSION['doc_admin_name']);
    unset($_SESSION['doc_admin_pass']);
}
require 'users.php';
require 'class.php';
$encodeExplorer = new EncodeExplorer();
$setUp = new SetUp();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$template = new Template();
$gateKeeper = new GateKeeper();
$logged = false;
$error = null;
$captchaerror = null;
if (isset($_SESSION['doc_admin_name'])) {
    $logged = true;
}
$postusername = filter_input(INPUT_POST, "doc_admin_name", FILTER_SANITIZE_STRING);
$postuserpass = filter_input(INPUT_POST, "doc_admin_pass", FILTER_SANITIZE_STRING);
if ($postusername && $postuserpass) {
    if (logIn($postusername, $postuserpass)) {
Example #12
0
<?php

require_once 'config.php';
require_once 'users.php';
require_once 'class.php';
require_once 'remember.php';
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
require_once 'translations/' . $encodeExplorer->lang . '.php';
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$downloader = new Downloader();
$utils = new Utils();
$logger = new Logger();
$actions = new Actions();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$script_url = $setUp->getConfig('script_url');
$getfile = filter_input(INPUT_GET, "q", FILTER_SANITIZE_STRING);
$getfilelist = filter_input(INPUT_GET, "dl", FILTER_SANITIZE_STRING);
$getcloud = filter_input(INPUT_GET, "d", FILTER_SANITIZE_STRING);
$hash = filter_input(INPUT_GET, "h", FILTER_SANITIZE_STRING);
$supah = filter_input(INPUT_GET, "sh", FILTER_SANITIZE_STRING);
$playmp3 = filter_input(INPUT_GET, "audio", FILTER_SANITIZE_STRING);
$getpass = filter_input(INPUT_GET, "pw", FILTER_SANITIZE_STRING);
if ($getpass) {
    $getpass = urldecode($getpass);
}
Example #13
0
 /**
  * Check if all the parts exist, and 
  * gather all the parts of the file together
  *
  * @param string $location  - the final location
  * @param string $temp_dir  - the temporary directory holding all the parts of the file
  * @param string $fileName  - the original file name
  * @param string $chunkSize - each chunk size (in bytes)
  * @param string $totalSize - original file size (in bytes)
  * @param string $logloc    - relative location for log file
  *
  * @return uploaded file
  */
 public function createFileFromChunks($location, $temp_dir, $fileName, $chunkSize, $totalSize, $logloc)
 {
     global $chunk;
     $upload_dir = str_replace('\\', '', $location);
     $extension = File::getFileExtension($fileName);
     // count all the parts of this file
     $total_files = 0;
     foreach (scandir($temp_dir) as $file) {
         if (stripos($file, $fileName) !== false) {
             $total_files++;
         }
     }
     $finalfile = FileManager::safeExtension($fileName, $extension);
     // check that all the parts are present
     // the size of the last part is between chunkSize and 2*$chunkSize
     if ($total_files * $chunkSize >= $totalSize - $chunkSize + 1) {
         // create the final file
         if (($openfile = fopen($upload_dir . $finalfile, 'w')) !== false) {
             for ($i = 1; $i <= $total_files; $i++) {
                 fwrite($openfile, file_get_contents($temp_dir . '/' . $fileName . '.part' . $i));
             }
             fclose($openfile);
             // rename the temporary directory (to avoid access from other
             // concurrent chunks uploads) and than delete it
             if (rename($temp_dir, $temp_dir . '_UNUSED')) {
                 Actions::deleteDir($temp_dir . '_UNUSED');
             } else {
                 Actions::deleteDir($temp_dir);
             }
             $chunk->setSuccess(" <span><i class=\"fa fa-check-circle\"></i> " . $finalfile . " </span> ", "yep");
             $chunk->setUserUp($totalSize);
             $message = array('user' => GateKeeper::getUserInfo('name'), 'action' => 'ADD', 'type' => 'file', 'item' => $logloc . $finalfile);
             Logger::log($message, "");
             if (SetUp::getConfig("notify_upload")) {
                 Logger::emailNotification($logloc . $finalfile, 'upload');
             }
         } else {
             setError(" <span><i class=\"fa fa-exclamation-triangle\"></i> cannot create the destination file", "nope");
             return false;
         }
     }
 }
Example #14
0
<?php

require 'mail/PHPMailerAutoload.php';
require 'config.php';
require 'class.php';
$lang = filter_input(INPUT_POST, 'thislang', FILTER_SANITIZE_STRING);
require 'translations/' . $lang . '.php';
$setUp = new SetUp();
$utils = new Utils();
$encodeExplorer = new EncodeExplorer();
$from = filter_input(INPUT_POST, "mitt", FILTER_VALIDATE_EMAIL);
$dest = filter_input(INPUT_POST, "dest", FILTER_VALIDATE_EMAIL);
$link = filter_input(INPUT_POST, "sharelink", FILTER_SANITIZE_STRING);
$attachments = explode(",", filter_input(INPUT_POST, "attach", FILTER_SANITIZE_STRING));
$text_message = filter_input(INPUT_POST, "message", FILTER_SANITIZE_STRING);
$passlink = filter_input(INPUT_POST, "passlink", FILTER_SANITIZE_STRING);
$bcc = filter_input(INPUT_POST, 'send_cc', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
if ($from && $dest && $link) {
    $setfrom = $setUp->getConfig('email_from');
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    if ($setUp->getConfig('smtp_enable') == true) {
        $timeconfig = $setUp->getConfig('default_timezone');
        $timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
        date_default_timezone_set($timezone);
        $mail->isSMTP();
        $mail->SMTPDebug = 0;
        $smtp_auth = $setUp->getConfig('smtp_auth');
        $mail->Host = $setUp->getConfig('smtp_server');
        $mail->Port = (int) $setUp->getConfig('port');
        if ($setUp->getConfig('secure_conn') !== "none") {