mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 00:54:49 +02:00
Some basic preparation for new e_url scheme and other changes.
For anyone reading - please remember that 0.8 should not be utilized on a public site prior to official release.
This commit is contained in:
@@ -16,17 +16,39 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class secure_image {
|
||||
class secure_image
|
||||
{
|
||||
var $random_number;
|
||||
var $HANDLERS_DIRECTORY;
|
||||
var $IMAGES_DIRECTORY;
|
||||
var $THIS_DIR;
|
||||
|
||||
function secure_image() {
|
||||
function secure_image()
|
||||
{
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
$this->random_number = str_replace(".", "", $sec.$usec);
|
||||
|
||||
$imgp = dirname(__FILE__);
|
||||
if (substr($imgp,-1,1) != '/') $imgp .= '/';
|
||||
if(!require($imgp.'../e107_config.php'))
|
||||
{
|
||||
if(defined('e_DEBUG'))
|
||||
{
|
||||
echo "FAILED TO LOAD e107_config.php in secure_img_handler.php";
|
||||
}
|
||||
}
|
||||
|
||||
$this->THIS_DIR = $imgp;
|
||||
$this->HANDLERS_DIRECTORY = $HANDLERS_DIRECTORY;
|
||||
$this->IMAGES_DIRECTORY = $IMAGES_DIRECTORY;
|
||||
}
|
||||
|
||||
function create_code() {
|
||||
global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
|
||||
function create_code()
|
||||
{
|
||||
|
||||
$pref = e107::getPref();
|
||||
$sql = e107::getDb();
|
||||
|
||||
/*
|
||||
require_once('e107_class.php');
|
||||
$e107 = new e107(false, false);
|
||||
@@ -34,10 +56,7 @@ class secure_image {
|
||||
|
||||
$imgpy = str_replace($HANDLERS_DIRECTORY, "", $e107->file_path);
|
||||
*/
|
||||
$imgp = dirname(__FILE__);
|
||||
if (substr($imgp,-1,1) != '/') $imgp .= '/';
|
||||
if (!isset($HANDLERS_DIRECTORY)) require_once($imgp.'../e107_config.php');
|
||||
$imgp = str_replace($HANDLERS_DIRECTORY,$IMAGES_DIRECTORY,$imgp);
|
||||
$imgp = str_replace($this->HANDLERS_DIRECTORY, $this->IMAGES_DIRECTORY, $this->THIS_DIR);
|
||||
|
||||
mt_srand ((double)microtime() * 1000000);
|
||||
$maxran = 1000000;
|
||||
@@ -51,8 +70,12 @@ class secure_image {
|
||||
return $recnum;
|
||||
}
|
||||
|
||||
function verify_code($rec_num, $checkstr) {
|
||||
global $sql, $tp;
|
||||
|
||||
function verify_code($rec_num, $checkstr)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if ($sql->db_Select("tmp", "tmp_info", "tmp_ip = '".$tp -> toDB($rec_num)."'")) {
|
||||
$row = $sql->db_Fetch();
|
||||
$sql->db_Delete("tmp", "tmp_ip = '".$tp -> toDB($rec_num)."'");
|
||||
@@ -62,10 +85,10 @@ class secure_image {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function r_image() {
|
||||
global $HANDLERS_DIRECTORY;
|
||||
function r_image()
|
||||
{
|
||||
$code = $this->create_code();
|
||||
return "<img src='".e_HTTP.$HANDLERS_DIRECTORY."secure_img_render.php?{$code}' class='icon secure-image' alt='' />";
|
||||
return "<img src='".e_HTTP.$this->HANDLERS_DIRECTORY."secure_img_render.php?{$code}' class='icon secure-image' alt='' />";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user