Popravek ecditor uploaderja, ce je instalacija 1ke v poddirektoriju (npr. xxx.si/ankete)

This commit is contained in:
pero1203 2021-03-09 14:13:34 +01:00
parent 9f99e43fb9
commit 6569d4be6f
2 changed files with 12 additions and 9 deletions

View File

@ -6,6 +6,9 @@
//spremenljivka za ID elementa od txtUrl //spremenljivka za ID elementa od txtUrl
var urlsrc = ''; var urlsrc = '';
// Url strani za embedd uploaderja
var site_url = $('#srv_site_url').val();
// Jezik za image uploader // Jezik za image uploader
var lang = 'sl'; var lang = 'sl';
@ -160,7 +163,7 @@ CKEDITOR.on('dialogDefinition', function (ev) {
type: 'html', type: 'html',
id: 'uploadSlikeEnka', id: 'uploadSlikeEnka',
label: 'Naloži sliko', label: 'Naloži sliko',
html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="/editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1&url='+urlsrc+'&lang='+lang+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>' html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="'+site_url+'editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1&url='+urlsrc+'&lang='+lang+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>'
}, },
'txtAlt' 'txtAlt'
); );
@ -179,7 +182,7 @@ CKEDITOR.on('dialogDefinition', function (ev) {
type: 'html', type: 'html',
id: 'uploadDatotekeEnka', id: 'uploadDatotekeEnka',
label: 'Naloži datoteko', label: 'Naloži datoteko',
html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="/editors/ckeditor_4_4/uploader/EnkaUploader.php?url='+urlsrc+'&lang='+lang+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>' html: '<div style="display: block; float: left; width: 100%; height: 40px; clear: both;"><iframe src="'+site_url+'editors/ckeditor_4_4/uploader/EnkaUploader.php?url='+urlsrc+'&lang='+lang+'" style="width: 350px; height: 50px; border: none; overflow: hidden;" border="0" frameborder="0"></iframe></div>'
} }
); );
} }

View File

@ -7,7 +7,7 @@
<?php <?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/function.php'); include_once('../../../function.php');
// Ce imamo v GET-u lang naložimo jezikovno datoteko // Ce imamo v GET-u lang naložimo jezikovno datoteko
if(isset($_GET['lang'])){ if(isset($_GET['lang'])){
@ -25,7 +25,7 @@ if (!isset ($_POST['posted']) && (isset ($_GET['image']) && $_GET['image'] == 1)
?> ?>
<body style="margin-top: 0px; top: 0px; margin-left: 0px; left: 0px; padding-top: 0px;"> <body style="margin-top: 0px; top: 0px; margin-left: 0px; left: 0px; padding-top: 0px;">
<form name="uploader" method="post" enctype="multipart/form-data" <form name="uploader" method="post" enctype="multipart/form-data"
action="/editors/ckeditor_4_4/uploader/EnkaUploader.php" style="height: 15px;"> action="<?= $site_url ?>editors/ckeditor_4_4/uploader/EnkaUploader.php" style="height: 15px;">
<input type="hidden" name="posted" value="1"/> <input type="hidden" name="posted" value="1"/>
<input type="hidden" name="urlsrc" value="<?= $_GET['url'] ?>"/> <input type="hidden" name="urlsrc" value="<?= $_GET['url'] ?>"/>
<input type="hidden" name="type" value="image"/> <input type="hidden" name="type" value="image"/>
@ -41,7 +41,7 @@ if (!isset ($_POST['posted']) && (isset ($_GET['image']) && $_GET['image'] == 1)
?> ?>
<body style="margin-top: 0px; top: 0px; margin-left: 0px; left: 0px; padding-top: 0px;"> <body style="margin-top: 0px; top: 0px; margin-left: 0px; left: 0px; padding-top: 0px;">
<form name="uploader" method="post" enctype="multipart/form-data" <form name="uploader" method="post" enctype="multipart/form-data"
action="/editors/ckeditor_4_4/uploader/EnkaUploader.php" style="height: 15px;"> action="<?= $site_url ?>editors/ckeditor_4_4/uploader/EnkaUploader.php" style="height: 15px;">
<input type="hidden" name="posted" value="1"/> <input type="hidden" name="posted" value="1"/>
<input type="hidden" name="urlsrc" value="<?= $_GET['url'] ?>"/> <input type="hidden" name="urlsrc" value="<?= $_GET['url'] ?>"/>
<input type="hidden" name="type" value="file"/> <input type="hidden" name="type" value="file"/>
@ -64,7 +64,7 @@ if (!isset ($_POST['posted']) && (isset ($_GET['image']) && $_GET['image'] == 1)
$final = $nakljucno .$ime; $final = $nakljucno .$ime;
if (move_uploaded_file($_FILES['editorDatoteka']['tmp_name'], $site_path .'uploadi/editor/doc/' .$final)) { if (move_uploaded_file($_FILES['editorDatoteka']['tmp_name'], $site_path .'uploadi/editor/doc/' .$final)) {
?> ?>
<body bgcolor="#ebebeb" onload="parent.document.getElementById(parent.urlsrc).value='<?=str_replace("http://", "", $site_url)?>uploadi/editor/doc/<?=$final?>'; window.location.href='<?= $site_url ?>/editors/ckeditor_4_4/uploader/EnkaUploader.php'; "> <body bgcolor="#ebebeb" onload="parent.document.getElementById(parent.urlsrc).value='<?=str_replace("http://", "", $site_url)?>uploadi/editor/doc/<?=$final?>'; window.location.href='<?= $site_url ?>editors/ckeditor_4_4/uploader/EnkaUploader.php'; ">
<strong style="font-family: Arial; font-size: 12px; font-weight: bold;"><?=$lang['upload_done']?></strong> <strong style="font-family: Arial; font-size: 12px; font-weight: bold;"><?=$lang['upload_done']?></strong>
<?php <?php
}else { }else {
@ -94,14 +94,14 @@ if (!isset ($_POST['posted']) && (isset ($_GET['image']) && $_GET['image'] == 1)
if (strpos($ime, ".jpg") === false && strpos($ime, ".jpeg") === false && strpos($ime, ".gif") === false && if (strpos($ime, ".jpg") === false && strpos($ime, ".jpeg") === false && strpos($ime, ".gif") === false &&
strpos($ime, ".png") === false && strpos($ime, ".bmp") === false && strpos($ime, ".svg") === false) { strpos($ime, ".png") === false && strpos($ime, ".bmp") === false && strpos($ime, ".svg") === false) {
?> ?>
<body onload="window.location.href='<?= $site_url ?>/editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1&error=1';"> <body onload="window.location.href='<?= $site_url ?>editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1&error=1';">
<?php <?php
}else { }else {
$nakljucno = time(); $nakljucno = time();
$final = $nakljucno . $ime; $final = $nakljucno . $ime;
$UF_obj = new Upload(); $UF_obj = new Upload();
$UF_obj->File = $_FILES['eitorSlika']; $UF_obj->File = $_FILES['eitorSlika'];
$UF_obj->SavePath = $_SERVER['DOCUMENT_ROOT'] . '/uploadi/editor'; $UF_obj->SavePath = $site_path . '/uploadi/editor';
$UF_obj->NewName = $_FILES['eitorSlika']['name']; $UF_obj->NewName = $_FILES['eitorSlika']['name'];
//Širina in višina slike nastavimo //Širina in višina slike nastavimo
@ -113,7 +113,7 @@ if (!isset ($_POST['posted']) && (isset ($_GET['image']) && $_GET['image'] == 1)
$Error = $UF_obj->UploadFile(); $Error = $UF_obj->UploadFile();
if (empty($Error)) { if (empty($Error)) {
?> ?>
<body onload="parent.document.getElementById(parent.urlsrc).value='<?= $site_url ?>uploadi/editor/<?= $final ?>'; parent.document.querySelector('img[id$=_previewImage]').src='<?= $site_url ?>uploadi/editor/<?= $final ?>'; parent.document.querySelector('img[id$=_previewImage]').style.display='block'; window.location.href='<?= $site_url ?>/editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1';"> <body onload="parent.document.getElementById(parent.urlsrc).value='<?= $site_url ?>uploadi/editor/<?= $final ?>'; parent.document.querySelector('img[id$=_previewImage]').src='<?= $site_url ?>uploadi/editor/<?= $final ?>'; parent.document.querySelector('img[id$=_previewImage]').style.display='block'; window.location.href='<?= $site_url ?>editors/ckeditor_4_4/uploader/EnkaUploader.php?image=1';">
<strong style="font-family: Arial; font-size: 12px; font-weight: bold;"><?= $lang['upload_img_done'] ?></strong> <strong style="font-family: Arial; font-size: 12px; font-weight: bold;"><?= $lang['upload_img_done'] ?></strong>
<?php <?php
}else { }else {