diff --git a/languages/default/de/page.xml b/languages/default/de/page.xml
index 5e9e94fc..30eecfa3 100644
--- a/languages/default/de/page.xml
+++ b/languages/default/de/page.xml
@@ -10,6 +10,8 @@
Kontakt
Datum
Standard Seite
+ External
+ External URL
Gallery
Intern
Keyword
diff --git a/languages/default/uk/page.xml b/languages/default/uk/page.xml
index 7a56916e..f159f827 100644
--- a/languages/default/uk/page.xml
+++ b/languages/default/uk/page.xml
@@ -10,6 +10,8 @@
Contact
Date
Default page
+ External
+ External URL
Gallery
Intern
Keyword
diff --git a/stuff/admin/page_downloads.php b/stuff/admin/page_downloads.php
index 7f56b391..be04fe77 100644
--- a/stuff/admin/page_downloads.php
+++ b/stuff/admin/page_downloads.php
@@ -43,32 +43,45 @@ if ((!isset($admin_id) or $main != 1) or (isset($admin_id) and !$pa['cms_pages']
die;
}
-$sprache = getlanguagefile('page',$user_language,$reseller_id);
+$sprache = getlanguagefile('page', $user_language, $reseller_id);
$loguserid = $admin_id;
$logusername = getusername($admin_id);
$logusertype = 'admin';
$logreseller = 0;
$logsubuser = 0;
$logsubuser = 0;
+
+$id = $ui->id('id', 10, 'get');
+$external = ($ui->active('external', 'post')) ? $ui->active('external', 'post') : 'N';
+$externalURL = ($ui->url('externalURL', 'post')) ? $ui->url('externalURL', 'post') : '';
+
if ($ui->w('action', 4, 'post') and !token(true)) {
+
$template_file = $spracheResponse->token;
-} else if ($ui->id('id', 10, 'get') or $ui->st('d', 'get') == 'ad') {
- $id = $ui->id('id', 10, 'get');
+
+} else if ($id or $ui->st('d', 'get') == 'ad') {
+
$template_file = 'uadmin_404.tpl';
$foundLanguages = array();
+
$query = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='pd' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
foreach ($languages as $row) {
- if (small_letters_check($row,2)) {
+
+ if (small_letters_check($row, 2)) {
+
$description = '';
+
unset($lang);
- if ($ui->id('id', 10, 'get')) {
- $query->execute(array($id, $row,$reseller_id));
+
+ if ($id) {
+ $query->execute(array($id, $row, $reseller_id));
while ($row2 = $query->fetch(PDO::FETCH_ASSOC)) {
$lang = $row2['lang'];
$description = $row2['text'];
}
}
- if ((!$ui->id('id', 10, 'get') and $row==$rSA['language']) or isset($lang)) {
+
+ if ((!$id and $row==$rSA['language']) or isset($lang)) {
$style = '';
$displayNone = '';
$checkbox=' ';
@@ -77,15 +90,23 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$displayNone='display_none';
$checkbox=' ';
}
+
$foundLanguages[] = array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'description' => $description,'display' => $displayNone);
}
}
+
if (!$ui->st('action', 'post') and $ui->st('d', 'get') == 'ad') {
+
$template_file = 'admin_page_downloads_add.tpl';
- } else if (!$ui->st('action', 'post') and $ui->id('id', 10, 'get') and ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'dl')) {
+
+ } else if (!$ui->st('action', 'post') and $id and ($ui->st('d', 'get') == 'md' or $ui->st('d', 'get') == 'dl')) {
+
$query = $sql->prepare("SELECT * FROM `page_downloads` WHERE `fileID`=? AND `resellerID`=? LIMIT 1");
- $query->execute(array($id,$reseller_id));
+ $query->execute(array($id, $reseller_id));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
+
+ $external = $row['external'];
+ $externalURL = $row['externalURL'];
$show = $row['show'];
$order = $row['order'];
$count = $row['count'];
@@ -93,30 +114,45 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$fileExtension = $row['fileExtension'];
$fileName = $row['fileName'];
$date = $row['date'];
+
$template_file = ($ui->st('d', 'get') == 'md') ? 'admin_page_downloads_mod.tpl' : 'admin_page_downloads_del.tpl';
}
- } else if ($ui->st('action', 'post') == 'ad' or ($ui->st('action', 'post') == 'md' and $ui->id('id', 10, 'get'))) {
- $id = $ui->id('id', 10, 'get');
+
+ } else if ($ui->st('action', 'post') == 'ad' or ($ui->st('action', 'post') == 'md' and $id)) {
+
if ($ui->st('action', 'post') == 'ad') {
+
$query = $sql->prepare("SELECT 1 FROM `page_downloads` WHERE `fileName`=? LIMIT 1");
- $query->execute(array($ui->names('fileName',255, 'post')));
+ $query->execute(array($ui->names('fileName', 255, 'post')));
+
if ($query->rowCount() > 0) {
$template_file = $spracheResponse->error_name;
} else {
- $query = $sql->prepare("INSERT INTO `page_downloads` (`show`,`description`,`fileName`,`date`,`resellerID`) VALUES (?,?,?,NOW(),?)");
- $query->execute(array($ui->w('show',1, 'post'),$ui->names('description',255, 'post'),$ui->names('fileName',255, 'post'),$reseller_id));
- if ($query->rowCount() > 0) $changed = true;
+
+ $query = $sql->prepare("INSERT INTO `page_downloads` (`show`,`description`,`fileName`,`date`,`external`,`externalURL`,`resellerID`) VALUES (?,?,?,NOW(),?,?,?)");
+ $query->execute(array($ui->w('show', 1, 'post'), $ui->names('description', 255, 'post'), $ui->names('fileName', 255, 'post'), $external, $externalURL, $reseller_id));
+
+ if ($query->rowCount() > 0) {
+ $changed = true;
+ }
+
$template_file = $spracheResponse->table_add;
$id = $sql->lastInsertId();
}
- } else if ($ui->st('action', 'post') == 'md' and $ui->id('id', 10, 'get')) {
- $query = $sql->prepare("UPDATE `page_downloads` SET `show`=?,`description`=?,`fileName`=? WHERE `fileID`=? AND `resellerID`=? LIMIT 1");
- $query->execute(array($ui->w('show',1, 'post'),$ui->names('description',255, 'post'),$ui->names('fileName',255, 'post'),$id,$reseller_id));
- if ($query->rowCount() > 0) $changed = true;
+
+ } else if ($ui->st('action', 'post') == 'md' and $id) {
+
+ $query = $sql->prepare("UPDATE `page_downloads` SET `show`=?,`description`=?,`fileName`=?,`external`=?,`externalURL`=? WHERE `fileID`=? AND `resellerID`=? LIMIT 1");
+ $query->execute(array($ui->w('show', 1, 'post'), $ui->names('description', 255, 'post'), $ui->names('fileName', 255, 'post'), $external, $externalURL, $id, $reseller_id));
+
+ if ($query->rowCount() > 0) {
+ $changed = true;
+ }
}
+
if ($id) {
- if (isset($_FILES['upload']) and $_FILES['upload']['error'] == 0) {
+ if ($external == 'N' and isset($_FILES['upload']) and $_FILES['upload']['error'] == 0) {
$allowedTypes = array(
'avi' => 'video/x-msvideo',
@@ -143,54 +179,88 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
'zip' => array('application/x-zip','application/zip','application/x-zip-compressed','application/octet-stream')
);
- $exploded=explode('.',$_FILES['upload']['name']);
+ $exploded=explode('.', $_FILES['upload']['name']);
$extension = $exploded[count($exploded)-1];
- if (isset($allowedTypes[$extension]) and ((is_array($allowedTypes[$extension]) and in_array($_FILES["upload"]["type"],$allowedTypes[$extension])) or (!is_array($allowedTypes[$extension]) and $_FILES["upload"]["type"] == $allowedTypes[$extension])) ) {
+ if (isset($allowedTypes[$extension]) and ((is_array($allowedTypes[$extension]) and in_array($_FILES["upload"]["type"], $allowedTypes[$extension])) or (!is_array($allowedTypes[$extension]) and $_FILES["upload"]["type"] == $allowedTypes[$extension])) ) {
if (move_uploaded_file($_FILES["upload"]["tmp_name"],EASYWIDIR . '/downloads/'.$id . '.' . $extension)) {
+
$changed = true;
+
$query = $sql->prepare("UPDATE `page_downloads` SET `fileExtension`=? WHERE `fileID`=? AND `resellerID`=?");
- $query->execute(array($extension,$id,$reseller_id));
+ $query->execute(array($extension, $id, $reseller_id));
}
}
}
- if ($ui->smallletters('language',2, 'post')) {
- $array=(array)$ui->smallletters('language',2, 'post');
+ if ($ui->smallletters('language', 2, 'post')) {
+
+ $array=(array)$ui->smallletters('language', 2, 'post');
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('pd',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach($array as $language) {
- if (small_letters_check($language,2)) {
- $query->execute(array($id,$language,$ui->description('text', 'post',$language),$reseller_id));
- if ($query->rowCount() > 0) $changed = true;
+
+ if (small_letters_check($language, 2)) {
+
+ $query->execute(array($id, $language, $ui->description('text', 'post', $language), $reseller_id));
+
+ if ($query->rowCount() > 0) {
+ $changed = true;
+ }
}
}
+
$query = $sql->prepare("SELECT `lang` FROM `translations` WHERE `type`='pd' AND `transID`=? AND `resellerID`=?");
- $query->execute(array($id,$reseller_id));
+ $query->execute(array($id, $reseller_id));
+
$query2 = $sql->prepare("DELETE FROM `translations` WHERE `type`='pd' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
+
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
- if (!in_array($row['lang'],$array)) {
- $query2->execute(array($addonid, $row['lang'],$reseller_id));
- if ($query2->rowCount() > 0) $changed = true;
+ if (!in_array($row['lang'], $array)) {
+
+ $query2->execute(array($addonid, $row['lang'], $reseller_id));
+
+ if ($query2->rowCount() > 0) {
+ $changed = true;
+ }
}
}
+
} else {
+
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='pd' AND `transID`=? AND `resellerID`=?");
- $query->execute(array($id,$reseller_id));
- if ($query->rowCount() > 0) $changed = true;
+ $query->execute(array($id, $reseller_id));
+
+ if ($query->rowCount() > 0) {
+ $changed = true;
+ }
}
+
$template_file = (isset($changed)) ? $spracheResponse->table_add : $spracheResponse->error_table;
+
} else {
$template_file = $spracheResponse->error_table;
}
- } else if ($ui->st('action', 'post') == 'dl' and $ui->id('id', 10, 'get')) {
+
+ } else if ($ui->st('action', 'post') == 'dl' and $id) {
+
$query = $sql->prepare("DELETE FROM `page_downloads` WHERE `fileID`=? AND `resellerID`=? LIMIT 1");
- $query->execute(array($id,$reseller_id));
+ $query->execute(array($id, $reseller_id));
+
$template_file = ($query->rowCount() > 0) ? $spracheResponse->table_del : 'admin_404.tpl';
- $query = $sql->prepare("DELETE FROM `translations` WHERE `type`='pd' AND `transID`=? AND `resellerID`=?");
- $query->execute(array($id,$reseller_id));
- @unlink(EASYWIDIR . "/downloads/${id}/${fileExtension}");
- $template_file = $spracheResponse->table_del;
+
+ if ($query->rowCount() > 0) {
+
+ $query = $sql->prepare("DELETE FROM `translations` WHERE `type`='pd' AND `transID`=? AND `resellerID`=?");
+ $query->execute(array($id, $reseller_id));
+
+ @unlink(EASYWIDIR . "/downloads/${id}/${fileExtension}");
+
+ $template_file = $spracheResponse->table_del;
+ } else {
+ $template_file =$spracheResponse->error_table;
+ }
}
+
} else {
if ($ui->w('downloadOrder',4, 'post') == 'true') {
@@ -198,9 +268,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query = $sql->prepare("UPDATE `page_downloads` SET `order`=? WHERE `fileID`=? LIMIT 1");
foreach ($ui->id('downloadID',10, 'post') as $id => $order) {
- $query->execute(array($order,$id));
+ $query->execute(array($order, $id));
}
}
+
$table = array();
$query = $sql->prepare("SELECT `fileID`,`description`,`order`,`count` FROM `page_downloads` WHERE `resellerID`=?");
diff --git a/stuff/admin/page_settings.php b/stuff/admin/page_settings.php
index d396ccbd..28fe24a6 100644
--- a/stuff/admin/page_settings.php
+++ b/stuff/admin/page_settings.php
@@ -40,6 +40,7 @@ if ((!isset($admin_id) or $main != 1) or (isset($admin_id) and !$pa['cms_setting
header('Location: admin.php');
die('No Access');
}
+
$sprache = getlanguagefile('page',$user_language,$reseller_id);
$loguserid = $admin_id;
$logusername = getusername($admin_id);
@@ -47,6 +48,7 @@ $logusertype = 'admin';
$logreseller = 0;
$logsubuser = 0;
$logsubuser = 0;
+
if ($ui->w('action', 4, 'post') and !token(true)) {
$template_file = $spracheResponse->token;
} else if ($ui->smallletters('action',2, 'post') == 'md' and $ui->id('maxnews',19, 'post')) {
diff --git a/stuff/cms/init_page.php b/stuff/cms/init_page.php
index 127b1358..53d20490 100644
--- a/stuff/cms/init_page.php
+++ b/stuff/cms/init_page.php
@@ -112,6 +112,7 @@ if (isset($page_active) and $page_active == 'Y') {
$query->execute(array($user_language));
if ($seo == 'Y') {
+
$page_data->SetMenu($gsprache->news, $gsprache->news,'news');
if ($protectioncheck == 'Y') {
diff --git a/stuff/cms/page_download.php b/stuff/cms/page_download.php
index a5c3159a..d1cc3ef9 100644
--- a/stuff/cms/page_download.php
+++ b/stuff/cms/page_download.php
@@ -63,42 +63,47 @@ if (isset($downloadID)) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
- if (($row['show'] == 'E' or ($row['show'] == 'A' and isset($admin_id)) or ($row['show'] == 'R' and (isset($user_id) or isset($admin_id)))) and file_exists(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}")) {
+ if (($row['show'] == 'E' or ($row['show'] == 'A' and isset($admin_id)) or ($row['show'] == 'R' and (isset($user_id) or isset($admin_id)))) and ($row['external'] == 'Y' or ($row['external'] == 'N' and file_exists(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}")))) {
if (isset($startDownload)) {
- $fileWithPath = EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}";
- $finfo = finfo_open(FILEINFO_MIME_TYPE);
- $contentType = finfo_file($finfo, $fileWithPath);
-
- finfo_close($finfo);
- header("Content-Type: ${contentType}");
-
- if (strpos(strtolower($ui->server['SERVER_SOFTWARE']),'nginx') !== false) {
-
- header('Content-Length: ' . (string) (filesize($fileWithPath)));
- header('Cache-Control: public, must-revalidate');
- header('Pragma: no-cache');
- header("Content-Disposition: attachment; filename=\"${row['fileName']}.${row['fileExtension']}\"");
- header('Content-Transfer-Encoding: binary');
- header("X-Accel-Redirect: /downloads/${row['fileID']}.${row['fileExtension']}");
-
- } else {
- header("Content-Disposition: attachment; filename=\"${row['fileName']}.${row['fileExtension']}\"");
- set_time_limit(0);
- $fp = @fopen(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}","rb");
- while(!feof($fp)) {
- print(@fread($fp, 1024));
- ob_flush();
- flush();
- }
- }
-
$query2 = $sql->prepare("UPDATE `page_downloads` SET `count`=(`count`+1) WHERE `fileID`=? LIMIT 1");
$query2->execute(array($downloadID));
$query2 = $sql->prepare("INSERT INTO `page_downloads_log` (`fileID`,`date`,`ip`,`hostname`) VALUES (?,NOW(),?,?) ON DUPLICATE KEY UPDATE `fileID`=`fileID`+1");
$query2->execute(array($downloadID, $loguserip, $userHostname));
+ if ($row['external'] == 'N') {
+
+ $fileWithPath = EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}";
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ $contentType = finfo_file($finfo, $fileWithPath);
+
+ finfo_close($finfo);
+ header("Content-Type: ${contentType}");
+
+ if (strpos(strtolower($ui->server['SERVER_SOFTWARE']),'nginx') !== false) {
+
+ header('Content-Length: ' . (string) (filesize($fileWithPath)));
+ header('Cache-Control: public, must-revalidate');
+ header('Pragma: no-cache');
+ header("Content-Disposition: attachment; filename=\"${row['fileName']}.${row['fileExtension']}\"");
+ header('Content-Transfer-Encoding: binary');
+ header("X-Accel-Redirect: /downloads/${row['fileID']}.${row['fileExtension']}");
+
+ } else {
+ header("Content-Disposition: attachment; filename=\"${row['fileName']}.${row['fileExtension']}\"");
+ set_time_limit(0);
+ $fp = @fopen(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}","rb");
+ while(!feof($fp)) {
+ print(@fread($fp, 1024));
+ ob_flush();
+ flush();
+ }
+ }
+ } else {
+ header("location: ${row['externalURL']}");
+ }
+
die;
} else {
@@ -118,7 +123,7 @@ if (isset($downloadID)) {
$query = $sql->prepare("SELECT d.*,t.`text` FROM `page_downloads` d LEFT JOIN `translations` t ON t.`type`='pd' AND t.`transID`=d.`fileID` AND t.`lang`=? ORDER BY d.`order`,d.`fileID`");
$query->execute(array($user_language));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
- if (($row['show'] == 'E' or ($row['show'] == 'A' and isset($admin_id)) or ($row['show'] == 'R' and (isset($user_id) or isset($admin_id)))) and file_exists(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}")) {
+ if (($row['show'] == 'E' or ($row['show'] == 'A' and isset($admin_id)) or ($row['show'] == 'R' and (isset($user_id) or isset($admin_id)))) and ($row['external'] == 'Y' or ($row['external'] == 'N' and file_exists(EASYWIDIR . "/downloads/${row['fileID']}.${row['fileExtension']}")))) {
$table[] = array('id' => $row['fileID'], 'description' => $row['description'], 'link' => (isset($seo) and $seo == 'Y') ? $page_data->pages['downloads']['link'].'get/'.$row['fileID'].'/' : $page_data->pages['downloads']['link'].'&action=get&id='.$row['fileID'], 'text' => $row['text']);
}
}
diff --git a/stuff/data/table_page_downloads.php b/stuff/data/table_page_downloads.php
index 9dc5809a..79c76aff 100644
--- a/stuff/data/table_page_downloads.php
+++ b/stuff/data/table_page_downloads.php
@@ -39,6 +39,8 @@
$defined['page_downloads'] = array(
'fileID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
+ 'external' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
+ 'externalURL' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'show' => array("Type"=>"enum('A','R','N','E')","Null"=>"YES","Key"=>"","Default"=>"E","Extra"=>""),
'order' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"0","Extra"=>""),
'count' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"","Default"=>"0","Extra"=>""),
diff --git a/template/default/admin/admin_page_downloads_add.tpl b/template/default/admin/admin_page_downloads_add.tpl
index 1ead0728..3aa4971c 100644
--- a/template/default/admin/admin_page_downloads_add.tpl
+++ b/template/default/admin/admin_page_downloads_add.tpl
@@ -22,9 +22,24 @@
+
+
+
+
diff --git a/template/default/admin/admin_page_downloads_mod.tpl b/template/default/admin/admin_page_downloads_mod.tpl
index d09e663e..78fbb919 100644
--- a/template/default/admin/admin_page_downloads_mod.tpl
+++ b/template/default/admin/admin_page_downloads_mod.tpl
@@ -26,10 +26,12 @@
+
+