remove deprecated docs folder

Dieser Commit ist enthalten in:
Oldperl 2017-01-13 12:56:33 +00:00
Ursprung 4eb6b37363
Commit 00369bd704
9 geänderte Dateien mit 599 neuen und 675 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,10 @@
<div class="flexslider">
<ul class="slides">
<!-- BEGIN:BLOCK -->
<li>
<img src="{IMG}" alt="" />
<p class="flex-caption">{IMG_CAPTION}</p>
</li>
<!-- END:BLOCK -->
</ul>
</div>

Datei anzeigen

Vorher

Breite:  |  Höhe:  |  Größe: 146 KiB

Nachher

Breite:  |  Höhe:  |  Größe: 146 KiB

Datei anzeigen

Vorher

Breite:  |  Höhe:  |  Größe: 126 KiB

Nachher

Breite:  |  Höhe:  |  Größe: 126 KiB

Datei anzeigen

Vorher

Breite:  |  Höhe:  |  Größe: 126 KiB

Nachher

Breite:  |  Höhe:  |  Größe: 126 KiB

Datei anzeigen

Vorher

Breite:  |  Höhe:  |  Größe: 53 KiB

Nachher

Breite:  |  Höhe:  |  Größe: 53 KiB

Datei anzeigen

@ -213,7 +213,7 @@ class clDbBackup {
if (!isset($rows[$column])) { if (!isset($rows[$column])) {
$values[] = 'NULL'; $values[] = 'NULL';
} else if ($rows[$column] != '') { } else if ($rows[$column] != '') {
$values[] = '\'' . mysql_escape_string($rows[$column]) . '\''; $values[] = '\'' . $this->_oDb->escape($rows[$column]) . '\'';
} else { } else {
$values[] = '\'\''; $values[] = '\'\'';
} }

Datei anzeigen

@ -6,10 +6,6 @@
* Description: * Description:
* Validates the HTML * Validates the HTML
* *
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes * @package Contenido Backend classes
* @version 1.6.1 * @version 1.6.1
* @author unknown * @author unknown
@ -19,13 +15,8 @@
* @link http://www.contenido.org * @link http://www.contenido.org
* @since file available since contenido release <= 4.6 * @since file available since contenido release <= 4.6
* *
* {@internal
* created unknown
* modified 2008-07-02, Frederic Schneider, add security fix
* *
* $Id: class.htmlvalidator.php 312 2014-06-18 11:01:08Z oldperl $: * $Id: class.htmlvalidator.php 312 2014-06-18 11:01:08Z oldperl $:
* }}
*
*/ */
if(!defined('CON_FRAMEWORK')) { if(!defined('CON_FRAMEWORK')) {
@ -60,6 +51,9 @@ class cHTMLValidator
// remove all php code from layout // remove all php code from layout
$resultingHTML = preg_replace('/<\?(php)?((.)|(\s))*?\?>/i', '', $html); $resultingHTML = preg_replace('/<\?(php)?((.)|(\s))*?\?>/i', '', $html);
// remove comments
$resultingHTML = preg_replace('/<\!--((.)|(\s))*?-->/i', '', $resultingHTML);
/* We respect only \n, but we need to take care of windows (\n\r) and other systems (\r) */ /* We respect only \n, but we need to take care of windows (\n\r) and other systems (\r) */
$resultingHTML = str_replace("\r\n", "\n", $resultingHTML); $resultingHTML = str_replace("\r\n", "\n", $resultingHTML);
$resultingHTML = str_replace("\r", "\n", $resultingHTML); $resultingHTML = str_replace("\r", "\n", $resultingHTML);

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -31,12 +32,10 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
/** /**
* Function reduces long path names and creates a dynamic tooltipp which shows * Function reduces long path names and creates a dynamic tooltipp which shows
* the full path name on mouseover * the full path name on mouseover
@ -47,7 +46,7 @@ if (!defined('CON_FRAMEWORK')) {
* string is shorter there will be no tooltipp * string is shorter there will be no tooltipp
* @return string - string, which contains short path name and tooltipp if neccessary * @return string - string, which contains short path name and tooltipp if neccessary
*/ */
function generateDisplayFilePath ($sDisplayPath, $iLimit) { function generateDisplayFilePath($sDisplayPath, $iLimit) {
$sDisplayPath = (string) trim($sDisplayPath); $sDisplayPath = (string) trim($sDisplayPath);
$iLimit = (int) $iLimit; $iLimit = (int) $iLimit;
if (strlen($sDisplayPath) > $iLimit) { if (strlen($sDisplayPath) > $iLimit) {
@ -60,32 +59,31 @@ function generateDisplayFilePath ($sDisplayPath, $iLimit) {
foreach ($aPathFragments as $sFragment) { foreach ($aPathFragments as $sFragment) {
if ($sFragment != '') { if ($sFragment != '') {
if (strlen($sFragment) > ($iLimit-5)) { if (strlen($sFragment) > ($iLimit - 5)) {
$sFragment = capiStrTrimHard($sFragment, $iLimit); $sFragment = capiStrTrimHard($sFragment, $iLimit);
} }
if($iCharcount+strlen($sFragment)+1 > $iLimit) { if ($iCharcount + strlen($sFragment) + 1 > $iLimit) {
$sTooltippString .= '<br>'.$sFragment.'/'; $sTooltippString .= '<br>' . $sFragment . '/';
$iCharcount = strlen($sFragment); $iCharcount = strlen($sFragment);
} else { } else {
$iCharcount = $iCharcount+1+strlen($sFragment); $iCharcount = $iCharcount + 1 + strlen($sFragment);
$sTooltippString .= $sFragment.'/'; $sTooltippString .= $sFragment . '/';
} }
} }
} }
$sDisplayPath = '<span onmouseover="Tip(\''.$sTooltippString.'\', BALLOON, true, ABOVE, true);">'.$sDisplayPathShort.'</span>'; $sDisplayPath = '<span onmouseover="Tip(\'' . $sTooltippString . '\', BALLOON, true, ABOVE, true);">' . $sDisplayPathShort . '</span>';
} }
return $sDisplayPath; return $sDisplayPath;
} }
function uplDirectoryListRecursive ($currentdir, $startdir=NULL, $files=array(), $depth=-1, $pathstring="") { function uplDirectoryListRecursive($currentdir, $startdir = NULL, $files = array(), $depth = -1, $pathstring = "") {
$depth++; $depth++;
$unsorted_files = array(); $unsorted_files = array();
if (chdir ($currentdir) == false) if (chdir($currentdir) == false) {
{
return; return;
} }
@ -93,33 +91,36 @@ function uplDirectoryListRecursive ($currentdir, $startdir=NULL, $files=array(),
if (!$startdir) { if (!$startdir) {
$startdir = $currentdir; $startdir = $currentdir;
} }
$d = opendir ("."); $d = opendir(".");
//list the files in the dir //list the files in the dir
while ($file = readdir ($d)) { while ($file = readdir($d)) {
if ($file != ".." && $file != ".") { if ($file != ".." && $file != ".") {
if (is_dir ($file)) { if (is_dir($file)) {
$unsorted_files[] = $file; $unsorted_files[] = $file;
} else { } else {
} }
} }
} }
if (is_array($unsorted_files)) sort($unsorted_files); if (is_array($unsorted_files))
sort($unsorted_files);
$sorted_files = $unsorted_files; $sorted_files = $unsorted_files;
if(is_array($sorted_files)) { if (is_array($sorted_files)) {
foreach ($sorted_files as $file) { foreach ($sorted_files as $file) {
if ($file != ".." && $file != ".") { if ($file != ".." && $file != ".") {
if ((filetype(getcwd()."/".$file) == "dir") && if ((filetype(getcwd() . "/" . $file) == "dir") &&
(opendir(getcwd()."/".$file) !== false)) { (opendir(getcwd() . "/" . $file) !== false)) {
$a_file['name'] = $file; $a_file['name'] = $file;
$a_file['depth'] = $depth; $a_file['depth'] = $depth;
$a_file['pathstring'] = $pathstring.$file.'/';; $a_file['pathstring'] = $pathstring . $file . '/';
;
$files[] = $a_file; $files[] = $a_file;
// If $file is a directory take a look inside // If $file is a directory take a look inside
$files = uplDirectoryListRecursive (getcwd().'/'.$file, getcwd(), $files, $depth, $a_file['pathstring']); $files = uplDirectoryListRecursive(getcwd() . '/' . $file, getcwd(), $files, $depth, $a_file['pathstring']);
} else { } else {
// If $ file is not a directory then do nothing // If $ file is not a directory then do nothing
} }
@ -127,15 +128,15 @@ function uplDirectoryListRecursive ($currentdir, $startdir=NULL, $files=array(),
} }
} }
closedir ($d); closedir($d);
chdir ($startdir); chdir($startdir);
return $files; return $files;
} }
function upldelete($path, $files) { function upldelete($path, $files) {
global $cfgClient, $client, $con_cfg, $db, $cfg; global $cfgClient, $client, $con_cfg, $db, $cfg;
$path = $cfgClient[$client]['upl']['path'].$path; $path = $cfgClient[$client]['upl']['path'] . $path;
if (!is_array($files)) { if (!is_array($files)) {
$tmp[] = $files; $tmp[] = $files;
@ -144,36 +145,35 @@ function upldelete($path, $files) {
} }
$ArrayCount = count($files); $ArrayCount = count($files);
for ($i=0; $i<$ArrayCount; $i++) { for ($i = 0; $i < $ArrayCount; $i++) {
if (is_dir($path.urldecode($files[$i]))) { if (is_dir($path . urldecode($files[$i]))) {
uplRecursiveRmDirIfEmpty($path.urldecode($files[$i])); uplRecursiveRmDirIfEmpty($path . urldecode($files[$i]));
$sql = "DELETE FROM ".$cfg["tab"]["upl"]." WHERE dirname='".Contenido_Security::escapeDB($files[$i], $db)."/'"; $sql = "DELETE FROM " . $cfg["tab"]["upl"] . " WHERE dirname='" . Contenido_Security::escapeDB($files[$i], $db) . "/'";
$db->query($sql); $db->query($sql);
} else { } else {
if (file_exists ($cfgClient[$client]["path"]["frontend"].$con_cfg['PathFrontendTmp'].urldecode($files[$i]))) { if (file_exists($cfgClient[$client]["path"]["frontend"] . $con_cfg['PathFrontendTmp'] . urldecode($files[$i]))) {
unlink($cfgClient[$client]["path"]["frontend"].$con_cfg['PathFrontendTmp'].urldecode($files[$i])); unlink($cfgClient[$client]["path"]["frontend"] . $con_cfg['PathFrontendTmp'] . urldecode($files[$i]));
} }
$file_name = urldecode($files[$i]); $file_name = urldecode($files[$i]);
$sql_dirname = str_replace($cfgClient[$client]['upl']['path'], '', $path); $sql_dirname = str_replace($cfgClient[$client]['upl']['path'], '', $path);
unlink($path.$file_name); unlink($path . $file_name);
$sql = "SELECT idupl $sql = "SELECT idupl
FROM ".$cfg["tab"]["upl"]." FROM " . $cfg["tab"]["upl"] . "
WHERE WHERE
idclient='".Contenido_Security::toInteger($client)."' idclient='" . Contenido_Security::toInteger($client) . "'
AND AND
filename='".Contenido_Security::toInteger($file_name)."' filename='" . Contenido_Security::toInteger($file_name) . "'
AND AND
dirname='".Contenido_Security::escapeDB($sql_dirname)."'"; dirname='" . Contenido_Security::escapeDB($sql_dirname) . "'";
$db->query($sql); $db->query($sql);
if ($db->next_record()) { if ($db->next_record()) {
$sql = "DELETE FROM ".$cfg["tab"]["upl"]." WHERE idupl='".Contenido_Security::toInteger($db->f("idupl"))."'"; $sql = "DELETE FROM " . $cfg["tab"]["upl"] . " WHERE idupl='" . Contenido_Security::toInteger($db->f("idupl")) . "'";
$db->query($sql); $db->query($sql);
} }
} }
} }
} }
@ -182,21 +182,20 @@ function uplRecursiveRmDirIfEmpty($dir) {
global $notification; global $notification;
if(!is_dir($dir)) { if (!is_dir($dir)) {
return 0; return 0;
} }
$directory = @opendir($dir); $directory = @opendir($dir);
if (!$directory) if (!$directory) {
{
return false; return false;
} }
readdir($directory); readdir($directory);
while(false !== ($dir_entry = readdir($directory))) { while (false !== ($dir_entry = readdir($directory))) {
if($dir_entry != "." && $dir_entry != "..") { if ($dir_entry != "." && $dir_entry != "..") {
if (is_dir($dir."/".$dir_entry)) { if (is_dir($dir . "/" . $dir_entry)) {
uplrecursivermdir($dir."/".$dir_entry); uplrecursivermdir($dir . "/" . $dir_entry);
} else { } else {
$notification->displayNotification("warning", "Im Verzeichnis $dir sind noch Dateien vorhanden. L&ouml;schen nicht m&ouml;glich."); $notification->displayNotification("warning", "Im Verzeichnis $dir sind noch Dateien vorhanden. L&ouml;schen nicht m&ouml;glich.");
} }
@ -211,18 +210,17 @@ function uplRecursiveRmDirIfEmpty($dir) {
} }
} }
function uplHasFiles($dir) function uplHasFiles($dir) {
{
global $client, $cfgClient; global $client, $cfgClient;
$directory = @opendir($cfgClient[$client]["upl"]["path"].$dir); $directory = @opendir($cfgClient[$client]["upl"]["path"] . $dir);
if (!$directory) { if (!$directory) {
return true; return true;
} }
while(false !== ($dir_entry = readdir($directory))) { while (false !== ($dir_entry = readdir($directory))) {
if($dir_entry != "." && $dir_entry != "..") { if ($dir_entry != "." && $dir_entry != "..") {
closedir($directory); closedir($directory);
return (true); return (true);
} }
@ -233,14 +231,12 @@ function uplHasFiles($dir)
return false; return false;
} }
function uplHasSubdirs($dir) function uplHasSubdirs($dir) {
{
global $client, $cfgClient; global $client, $cfgClient;
$directory = @opendir($cfgClient[$client]["upl"]["path"].$dir); $directory = @opendir($cfgClient[$client]["upl"]["path"] . $dir);
if (!$directory) if (!$directory) {
{
return true; return true;
} }
@ -248,11 +244,9 @@ function uplHasSubdirs($dir)
$ret = false; $ret = false;
while(false !== ($dir_entry = readdir($directory))) { while (false !== ($dir_entry = readdir($directory))) {
if ($dir_entry != "." && $dir_entry != "..") if ($dir_entry != "." && $dir_entry != "..") {
{ if (is_dir($cfgClient[$client]["upl"]["path"] . $dir . $dir_entry)) {
if (is_dir($cfgClient[$client]["upl"]["path"].$dir.$dir_entry))
{
closedir($directory); closedir($directory);
return true; return true;
} }
@ -262,19 +256,16 @@ function uplHasSubdirs($dir)
return ($ret); return ($ret);
} }
/** /**
* uplSyncDirectory ($path) * uplSyncDirectory ($path)
* Sync database contents with directory * Sync database contents with directory
* *
* @param string $path Specifies the path to scan * @param string $path Specifies the path to scan
*/ */
function uplSyncDirectory ($path) function uplSyncDirectory($path) {
{
global $cfgClient, $client, $cfg, $db; global $cfgClient, $client, $cfg, $db;
if (is_dbfs($path)) if (is_dbfs($path)) {
{
return uplSyncDirectoryDBFS($path); return uplSyncDirectoryDBFS($path);
} }
@ -282,7 +273,7 @@ function uplSyncDirectory ($path)
$properties = new PropertyCollection; $properties = new PropertyCollection;
/* Read all files in a specific directory */ /* Read all files in a specific directory */
$dir = $cfgClient[$client]['upl']['path'].$path; $dir = $cfgClient[$client]['upl']['path'] . $path;
$olddir = getcwd(); $olddir = getcwd();
@ -290,26 +281,21 @@ function uplSyncDirectory ($path)
$dirhandle = @opendir($dir); $dirhandle = @opendir($dir);
/* Whoops, probably failed to open. Return to the caller, but clean up stuff first. */ /* Whoops, probably failed to open. Return to the caller, but clean up stuff first. */
if (!$dirhandle) if (!$dirhandle) {
{
$uploads->select("dirname = '$path' AND idclient = '$client'"); $uploads->select("dirname = '$path' AND idclient = '$client'");
while ($upload = $uploads->next()) while ($upload = $uploads->next()) {
{ if (!file_exists($cfgClient[$client]["upl"]["path"] . $upload->get("dirname") . $upload->get("filename"))) {
if (!file_exists($cfgClient[$client]["upl"]["path"].$upload->get("dirname").$upload->get("filename")))
{
$uploads->delete($upload->get("idupl")); $uploads->delete($upload->get("idupl"));
} }
} }
// A click on "Upload" (root) would result in path = "" and this will result in LIKE '%' = everything // A click on "Upload" (root) would result in path = "" and this will result in LIKE '%' = everything
// So, we have to exclude dbfs-files, as they "don't exist" (-> file_exists) // So, we have to exclude dbfs-files, as they "don't exist" (-> file_exists)
$properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '".$path."%' AND itemid NOT LIKE 'dbfs%'"); $properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '" . $path . "%' AND itemid NOT LIKE 'dbfs%'");
while ($property = $properties->next()) while ($property = $properties->next()) {
{ if (!file_exists($cfgClient[$client]["upl"]["path"] . $property->get("itemid"))) {
if (!file_exists($cfgClient[$client]["upl"]["path"].$property->get("itemid")))
{
$properties->delete($property->get("idproperty")); $properties->delete($property->get("idproperty"));
} }
} }
@ -319,12 +305,9 @@ function uplSyncDirectory ($path)
} }
/* Put all the files into the $files array */ /* Put all the files into the $files array */
while ($file = readdir ($dirhandle)) while ($file = readdir($dirhandle)) {
{ if ($file != "." && $file != "..") {
if ($file != "." && $file != "..") if (is_file($file)) {
{
if (is_file($file))
{
$uploads->sync($path, $file); $uploads->sync($path, $file);
} }
} }
@ -332,22 +315,18 @@ function uplSyncDirectory ($path)
$uploads->select("dirname = '$path' AND idclient = '$client'"); $uploads->select("dirname = '$path' AND idclient = '$client'");
while ($upload = $uploads->next()) while ($upload = $uploads->next()) {
{ if (!file_exists($cfgClient[$client]["upl"]["path"] . $upload->get("dirname") . $upload->get("filename"))) {
if (!file_exists($cfgClient[$client]["upl"]["path"].$upload->get("dirname").$upload->get("filename")))
{
$uploads->delete($upload->get("idupl")); $uploads->delete($upload->get("idupl"));
} }
} }
// A click on "Upload" (root) would result in path = "" and this will result in LIKE '%' = everything // A click on "Upload" (root) would result in path = "" and this will result in LIKE '%' = everything
// So, we have to exclude dbfs-files, as they "don't exist" (-> file_exists) // So, we have to exclude dbfs-files, as they "don't exist" (-> file_exists)
$properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '".$path."%' AND itemid NOT LIKE 'dbfs%'"); $properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '" . $path . "%' AND itemid NOT LIKE 'dbfs%'");
while ($property = $properties->next()) while ($property = $properties->next()) {
{ if (!file_exists($cfgClient[$client]["upl"]["path"] . $property->get("itemid"))) {
if (!file_exists($cfgClient[$client]["upl"]["path"].$property->get("itemid")))
{
$properties->delete($property->get("idproperty")); $properties->delete($property->get("idproperty"));
} }
} }
@ -361,45 +340,37 @@ function uplSyncDirectory ($path)
* *
* @param string $path Specifies the path to scan * @param string $path Specifies the path to scan
*/ */
function uplSyncDirectoryDBFS ($path) function uplSyncDirectoryDBFS($path) {
{
global $cfgClient, $client, $cfg, $db; global $cfgClient, $client, $cfg, $db;
$uploads = new UploadCollection; $uploads = new UploadCollection;
$properties = new PropertyCollection; $properties = new PropertyCollection;
$dbfs = new DBFSCollection; $dbfs = new DBFSCollection;
if ($dbfs->dir_exists($path)) if ($dbfs->dir_exists($path)) {
{
$strippath = $dbfs->strip_path($path); $strippath = $dbfs->strip_path($path);
$dbfs->select("dirname = '$strippath'"); $dbfs->select("dirname = '$strippath'");
while ($file = $dbfs->next()) while ($file = $dbfs->next()) {
{ if ($file->get("filename") != ".") {
if ($file->get("filename") != ".") $uploads->sync($path . "/", $file->get("filename"));
{
$uploads->sync($path."/", $file->get("filename"));
} }
} }
} }
$uploads->select("dirname = '$path/' AND idclient = '$client'"); $uploads->select("dirname = '$path/' AND idclient = '$client'");
while ($upload = $uploads->next()) while ($upload = $uploads->next()) {
{ if (!$dbfs->file_exists($upload->get("dirname") . $upload->get("filename"))) {
if (!$dbfs->file_exists($upload->get("dirname").$upload->get("filename")))
{
$uploads->delete($upload->get("idupl")); $uploads->delete($upload->get("idupl"));
} }
} }
$properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '".$path."%'"); $properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '" . $path . "%'");
while ($property = $properties->next()) while ($property = $properties->next()) {
{ if (!$dbfs->file_exists($property->get("itemid"))) {
if (!$dbfs->file_exists($property->get("itemid")))
{
$properties->delete($property->get("idproperty")); $properties->delete($property->get("idproperty"));
} }
} }
@ -407,16 +378,14 @@ function uplSyncDirectoryDBFS ($path)
return; return;
} }
function uplmkdir($path, $name) {
function uplmkdir($path,$name) {
global $cfgClient, $client, $action; global $cfgClient, $client, $action;
if (is_dbfs($path)) if (is_dbfs($path)) {
{ $path = str_replace("dbfs:", "", $path);
$path = str_replace("dbfs:","", $path);
$fullpath = $path."/".$name."/."; $fullpath = $path . "/" . $name . "/.";
$dbfs = new DBFSCollection; $dbfs = new DBFSCollection;
$dbfs->create($fullpath); $dbfs->create($fullpath);
@ -425,79 +394,67 @@ function uplmkdir($path,$name) {
$name = uplCreateFriendlyName($name); $name = uplCreateFriendlyName($name);
$name = strtr($name, "'", "."); $name = strtr($name, "'", ".");
if(file_exists($cfgClient[$client]['upl']['path'].$path.$name)) { if (file_exists($cfgClient[$client]['upl']['path'] . $path . $name)) {
$action = "upl_mkdir"; $action = "upl_mkdir";
return "0702"; return "0702";
} else { } else {
$oldumask = umask(0); $oldumask = umask(0);
@mkdir($cfgClient[$client]['upl']['path'].$path.$name,0775); @mkdir($cfgClient[$client]['upl']['path'] . $path . $name, 0775);
umask($oldumask); umask($oldumask);
} }
} }
function uplRenameDirectory ($oldpath, $newpath, $parent) function uplRenameDirectory($oldpath, $newpath, $parent) {
{
global $cfgClient, $client, $cfg, $db; global $cfgClient, $client, $cfg, $db;
$db2 = new DB_ConLite; $db2 = new DB_ConLite;
rename($cfgClient[$client]['upl']['path'].$parent.$oldpath, $cfgClient[$client]['upl']['path'].$parent.$newpath."/"); rename($cfgClient[$client]['upl']['path'] . $parent . $oldpath, $cfgClient[$client]['upl']['path'] . $parent . $newpath . "/");
/* Fetch all directory strings starting with the old path, and replace them /* Fetch all directory strings starting with the old path, and replace them
with the new path */ with the new path */
$sql = "SELECT dirname, idupl FROM ".$cfg["tab"]["upl"]." WHERE idclient='".Contenido_Security::toInteger($client)."' AND dirname LIKE '".Contenido_Security::escapeDB($parent, $db).Contenido_Security::escapeDB($oldpath, $db)."%'"; $sql = "SELECT dirname, idupl FROM " . $cfg["tab"]["upl"] . " WHERE idclient='" . Contenido_Security::toInteger($client) . "' AND dirname LIKE '" . Contenido_Security::escapeDB($parent, $db) . Contenido_Security::escapeDB($oldpath, $db) . "%'";
$db->query($sql); $db->query($sql);
while ($db->next_record()) while ($db->next_record()) {
{
$moldpath = $db->f("dirname"); $moldpath = $db->f("dirname");
$junk = substr($moldpath, strlen($parent) + strlen($oldpath)); $junk = substr($moldpath, strlen($parent) + strlen($oldpath));
$newpath2 = $parent . $newpath . $junk; $newpath2 = $parent . $newpath . $junk;
$idupl = $db->f("idupl"); $idupl = $db->f("idupl");
$sql = "UPDATE ".$cfg["tab"]["upl"]." SET dirname='".Contenido_Security::escapeDB($newpath2, $db)."' WHERE idupl = '".Contenido_Security::toInteger($idupl)."'"; $sql = "UPDATE " . $cfg["tab"]["upl"] . " SET dirname='" . Contenido_Security::escapeDB($newpath2, $db) . "' WHERE idupl = '" . Contenido_Security::toInteger($idupl) . "'";
$db2->query($sql); $db2->query($sql);
} }
$sql = "SELECT itemid, idproperty FROM ".$cfg["tab"]["properties"]." WHERE itemid LIKE '".Contenido_Security::escapeDB($parent, $db).Contenido_Security::escapeDB($oldpath, $db)."%'"; $sql = "SELECT itemid, idproperty FROM " . $cfg["tab"]["properties"] . " WHERE itemid LIKE '" . Contenido_Security::escapeDB($parent, $db) . Contenido_Security::escapeDB($oldpath, $db) . "%'";
$db->query($sql); $db->query($sql);
while ($db->next_record()) while ($db->next_record()) {
{
$moldpath = $db->f("itemid"); $moldpath = $db->f("itemid");
$junk = substr($moldpath, strlen($parent) + strlen($oldpath)); $junk = substr($moldpath, strlen($parent) + strlen($oldpath));
$newpath2 = $parent . $newpath . $junk; $newpath2 = $parent . $newpath . $junk;
$idproperty = $db->f("idproperty"); $idproperty = $db->f("idproperty");
$sql = "UPDATE ".$cfg["tab"]["properties"]." SET itemid = '$newpath2' WHERE idproperty='$idproperty'"; $sql = "UPDATE " . $cfg["tab"]["properties"] . " SET itemid = '$newpath2' WHERE idproperty='$idproperty'";
$db2->query($sql); $db2->query($sql);
} }
} }
function uplRecursiveDirectoryList($directory, &$rootitem, $level, $sParent = '', $iRenameLevel = null) {
function uplRecursiveDirectoryList ($directory, &$rootitem, $level, $sParent = '', $iRenameLevel = null)
{
$dirhandle = @opendir($directory); $dirhandle = @opendir($directory);
if (!$dirhandle) if (!$dirhandle) {
{
} } else {
else
{
$aInvalidDirectories = array(); $aInvalidDirectories = array();
unset($files); unset($files);
//list the files in the dir //list the files in the dir
while ($file = readdir ($dirhandle)) while ($file = readdir($dirhandle)) {
{ if ($file != "." && $file != "..") {
if ($file != "." && $file != "..") if (@chdir($directory . $file . "/")) {
{
if (@chdir($directory.$file."/"))
{
if (uplCreateFriendlyName($file) == $file) { if (uplCreateFriendlyName($file) == $file) {
$files[] = $file; $files[] = $file;
} else { } else {
@ -517,23 +474,18 @@ function uplRecursiveDirectoryList ($directory, &$rootitem, $level, $sParent = '
} }
} }
if (is_array($files)) if (is_array($files)) {
{
sort($files); sort($files);
foreach ($files as $key => $file) foreach ($files as $key => $file) {
{
/* We aren't using is_dir anymore as that function is buggy */ /* We aren't using is_dir anymore as that function is buggy */
$olddir = getcwd(); $olddir = getcwd();
if ($file != "." && $file != "..") if ($file != "." && $file != "..") {
{ if (@chdir($directory . $file . "/")) {
if (@chdir($directory.$file."/"))
{
unset($item); unset($item);
$item = new TreeItem($file, $directory.$file."/",true); $item = new TreeItem($file, $directory . $file . "/", true);
$item->custom["level"] = $level; $item->custom["level"] = $level;
if ($key == count($files)-1) if ($key == count($files) - 1) {
{
$item->custom["lastitem"] = true; $item->custom["lastitem"] = true;
} else { } else {
$item->custom["lastitem"] = false; $item->custom["lastitem"] = false;
@ -543,7 +495,7 @@ function uplRecursiveDirectoryList ($directory, &$rootitem, $level, $sParent = '
$rootitem->addItem($item); $rootitem->addItem($item);
$old = $rootitem; $old = $rootitem;
$aArrayTemp = uplRecursiveDirectoryList($directory.$file."/", $item, $level + 1, $sParent.$file.'/', $iRenameLevel); $aArrayTemp = uplRecursiveDirectoryList($directory . $file . "/", $item, $level + 1, $sParent . $file . '/', $iRenameLevel);
$aInvalidDirectories = array_merge($aInvalidDirectories, $aArrayTemp); $aInvalidDirectories = array_merge($aInvalidDirectories, $aArrayTemp);
$rootitem = $old; $rootitem = $old;
chdir($olddir); chdir($olddir);
@ -553,43 +505,36 @@ function uplRecursiveDirectoryList ($directory, &$rootitem, $level, $sParent = '
} }
} }
@closedir ($dirhandle); @closedir($dirhandle);
return $aInvalidDirectories; return $aInvalidDirectories;
} }
function uplRecursiveDBDirectoryList($directory, &$rootitem, $level) {
function uplRecursiveDBDirectoryList ($directory, &$rootitem, $level)
{
$dbfs = new DBFSCollection; $dbfs = new DBFSCollection;
$dbfs->select("filename = '.'","dirname", "dirname ASC"); $dbfs->select("filename = '.'", "dirname", "dirname ASC");
$count = 0; $count = 0;
$lastlevel = 0; $lastlevel = 0;
$item["."] = &$rootitem; $item["."] = &$rootitem;
while ($dbitem = $dbfs->next()) while ($dbitem = $dbfs->next()) {
{
$dirname = $dbitem->get("dirname"); $dirname = $dbitem->get("dirname");
$level = substr_count($dirname, "/")+2; $level = substr_count($dirname, "/") + 2;
$file = basename($dbitem->get("dirname")); $file = basename($dbitem->get("dirname"));
$parent = dirname($dbitem->get("dirname")); $parent = dirname($dbitem->get("dirname"));
if ($dirname != "." && $file != ".") if ($dirname != "." && $file != ".") {
{ $item[$dirname] = new TreeItem($file, "dbfs:/" . $dirname, true);
$item[$dirname] = new TreeItem($file, "dbfs:/".$dirname,true);
$item[$dirname]->custom["level"] = $level; $item[$dirname]->custom["level"] = $level;
$item[$dirname]->custom["parent"] = $parent; $item[$dirname]->custom["parent"] = $parent;
$item[$dirname]->custom["lastitem"] = true; $item[$dirname]->custom["lastitem"] = true;
if ($prevobj[$level]->custom["level"] == $level) if ($prevobj[$level]->custom["level"] == $level) {
{ if (is_object($prevobj[$level])) {
if (is_object($prevobj[$level]))
{
$prevobj[$level]->custom["lastitem"] = false; $prevobj[$level]->custom["lastitem"] = false;
} }
} }
if ($lastlevel > $level) if ($lastlevel > $level) {
{
unset($prevobj[$lastlevel]); unset($prevobj[$lastlevel]);
$lprevobj->custom["lastitem"] = true; $lprevobj->custom["lastitem"] = true;
} }
@ -599,8 +544,7 @@ function uplRecursiveDBDirectoryList ($directory, &$rootitem, $level)
$lastlevel = $level; $lastlevel = $level;
if (is_object($item[$parent])) if (is_object($item[$parent])) {
{
$item[$parent]->addItem($item[$dirname]); $item[$parent]->addItem($item[$dirname]);
} }
@ -609,18 +553,14 @@ function uplRecursiveDBDirectoryList ($directory, &$rootitem, $level)
} }
} }
function uplGetThumbnail($file, $maxsize) {
function uplGetThumbnail ($file, $maxsize)
{
global $client, $cfgClient, $cfg; global $client, $cfgClient, $cfg;
if ($maxsize == -1) if ($maxsize == -1) {
{ return uplGetFileIcon($file);
return uplGetFileIcon ($file);
} }
switch (getFileExtension($file)) switch (getFileExtension($file)) {
{
case "png": case "png":
case "gif": case "gif":
case "tiff": case "tiff":
@ -632,15 +572,13 @@ function uplGetThumbnail ($file, $maxsize)
case "iff": case "iff":
case "xbm": case "xbm":
case "wbmp": case "wbmp":
$img = capiImgScale($cfgClient[$client]["upl"]["path"].$file, $maxsize, $maxsize, false, false, 50); $img = capiImgScale($cfgClient[$client]["upl"]["path"] . $file, $maxsize, $maxsize, false, false, 50);
if ($img !== false) if ($img !== false) {
{
return $img; return $img;
} else { } else {
$value = capiImgScale($cfg["path"]["contenido"]."images/unknown.jpg", $maxsize, $maxsize, false, false, 50); $value = capiImgScale($cfg["path"]["contenido"] . "images/unknown.jpg", $maxsize, $maxsize, false, false, 50);
if ($value !== false) if ($value !== false) {
{
return $value; return $value;
} else { } else {
return uplGetFileIcon($file); return uplGetFileIcon($file);
@ -648,9 +586,7 @@ function uplGetThumbnail ($file, $maxsize)
} }
break; break;
default: default:
return uplGetFileIcon ($file); return uplGetFileIcon($file);
break;
} }
} }
@ -662,8 +598,7 @@ function uplGetThumbnail ($file, $maxsize)
* @return Icon for the file type * @return Icon for the file type
* *
*/ */
function uplGetFileIcon ($file) function uplGetFileIcon($file) {
{
global $cfg; global $cfg;
switch (getFileExtension($file)) { switch (getFileExtension($file)) {
@ -761,18 +696,17 @@ function uplGetFileIcon ($file)
case "css": $icon = "css.gif"; case "css": $icon = "css.gif";
default: default:
if (file_exists($cfg['path']['contenido_fullhtml'] . $cfg["path"]["images"]. "filetypes/".getFileExtension($file).".gif")) { if (file_exists($cfg['path']['contenido_fullhtml'] . $cfg["path"]["images"] . "filetypes/" . getFileExtension($file) . ".gif")) {
$icon = getFileExtension($file).".gif"; $icon = getFileExtension($file) . ".gif";
} else { } else {
$icon = "unknown.gif"; $icon = "unknown.gif";
} }
break; break;
} }
return $cfg['path']['contenido_fullhtml'] . $cfg["path"]["images"]. "filetypes/".$icon; return $cfg['path']['contenido_fullhtml'] . $cfg["path"]["images"] . "filetypes/" . $icon;
} }
/** /**
* Returns the description for a file type * Returns the description for a file type
* *
@ -781,12 +715,10 @@ function uplGetFileIcon ($file)
* @return Text for the file type * @return Text for the file type
* *
*/ */
function uplGetFileTypeDescription ($extension) function uplGetFileTypeDescription($extension) {
{
global $cfg; global $cfg;
switch ($extension) switch ($extension) {
{
/* Presentation files */ /* Presentation files */
case "sxi": return (i18n("OpenOffice.org Presentation")); case "sxi": return (i18n("OpenOffice.org Presentation"));
case "sti": return (i18n("OpenOffice.org Presentation Template")); case "sti": return (i18n("OpenOffice.org Presentation Template"));
@ -861,12 +793,11 @@ function uplGetFileTypeDescription ($extension)
case "mpeg": return (i18n("MPEG Movie")); case "mpeg": return (i18n("MPEG Movie"));
case "wmv": return (i18n("Windows Media Video")); case "wmv": return (i18n("Windows Media Video"));
default: return (i18n($extension."-File")); default: return (i18n($extension . "-File"));
} }
} }
function uplCreateFriendlyName ($filename, $spacer="_") function uplCreateFriendlyName($filename, $spacer = "_") {
{
global $cfg; global $cfg;
$newfilename = ""; $newfilename = "";
@ -877,19 +808,16 @@ function uplCreateFriendlyName ($filename, $spacer="_")
$filename = str_replace(" ", $spacer, $filename); $filename = str_replace(" ", $spacer, $filename);
} }
for ($i=0;$i<strlen($filename);$i++) for ($i = 0; $i < strlen($filename); $i++) {
{ $atom = substr($filename, $i, 1);
$atom = substr($filename, $i,1);
$bFound = false; $bFound = false;
if (preg_match("/[0-9a-zA-Z]/i", $atom )) if (preg_match("/[0-9a-zA-Z]/i", $atom)) {
{
$newfilename .= $atom; $newfilename .= $atom;
$bFound = true; $bFound = true;
} }
if (($atom == "-" || $atom == "_" || $atom == ".") && !$bFound) if (($atom == "-" || $atom == "_" || $atom == ".") && !$bFound) {
{
$newfilename .= $atom; $newfilename .= $atom;
$bFound = true; $bFound = true;
} }
@ -905,8 +833,7 @@ function uplCreateFriendlyName ($filename, $spacer="_")
return $newfilename; return $newfilename;
} }
function uplSearch ($searchfor) function uplSearch($searchfor) {
{
global $client; global $client;
$properties = new PropertyCollection; $properties = new PropertyCollection;
@ -915,59 +842,53 @@ function uplSearch ($searchfor)
$mysearch = urlencode($searchfor); $mysearch = urlencode($searchfor);
/* Search for keywords first, ranking +5 */ /* Search for keywords first, ranking +5 */
$properties->select("idclient='".Contenido_Security::toInteger($client)."' AND itemtype = 'upload' AND type='file' AND name='keywords' AND value LIKE '%".Contenido_Security::escapeDB($mysearch, $db)."%'","itemid"); $properties->select("idclient='" . Contenido_Security::toInteger($client) . "' AND itemtype = 'upload' AND type='file' AND name='keywords' AND value LIKE '%" . Contenido_Security::escapeDB($mysearch, $db) . "%'", "itemid");
while ($item = $properties->next()) while ($item = $properties->next()) {
{
$items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 5); $items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 5);
} }
/* Search for medianame , ranking +4 */ /* Search for medianame , ranking +4 */
$properties->select("idclient='".Contenido_Security::toInteger($client)."' AND itemtype = 'upload' AND type='file' AND name='medianame' AND value LIKE '%".Contenido_Security::escapeDB($mysearch, $db)."%'","itemid"); $properties->select("idclient='" . Contenido_Security::toInteger($client) . "' AND itemtype = 'upload' AND type='file' AND name='medianame' AND value LIKE '%" . Contenido_Security::escapeDB($mysearch, $db) . "%'", "itemid");
while ($item = $properties->next()) while ($item = $properties->next()) {
{
$items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 4); $items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 4);
} }
/* Search for media notes, ranking +3 */ /* Search for media notes, ranking +3 */
$properties->select("idclient='".Contenido_Security::toInteger($client)."' AND itemtype = 'upload' AND type='file' AND name='medianotes' AND value LIKE '%".Contenido_Security::escapeDB($mysearch, $db)."%'","itemid"); $properties->select("idclient='" . Contenido_Security::toInteger($client) . "' AND itemtype = 'upload' AND type='file' AND name='medianotes' AND value LIKE '%" . Contenido_Security::escapeDB($mysearch, $db) . "%'", "itemid");
while ($item = $properties->next()) while ($item = $properties->next()) {
{
$items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 3); $items[$item->get("itemid")] += (substr_count(strtolower($item->get("value")), strtolower($searchfor)) * 3);
} }
/* Search for description, ranking +2 */ /* Search for description, ranking +2 */
$uploads->select("idclient='".Contenido_Security::toInteger($client)."' AND description LIKE '%".Contenido_Security::escapeDB($mysearch, $db)."%'", "idupl"); $uploads->select("idclient='" . Contenido_Security::toInteger($client) . "' AND description LIKE '%" . Contenido_Security::escapeDB($mysearch, $db) . "%'", "idupl");
while ($item = $uploads->next()) while ($item = $uploads->next()) {
{ $items[$item->get("dirname") . $item->get("filename")] += (substr_count(strtolower($item->get("description")), strtolower($searchfor)) * 2);
$items[$item->get("dirname").$item->get("filename")] += (substr_count(strtolower($item->get("description")), strtolower($searchfor)) * 2);
} }
/* Search for file name, ranking +1 */ /* Search for file name, ranking +1 */
$uploads->select("idclient='".Contenido_Security::toInteger($client)."' AND filename LIKE '%".Contenido_Security::escapeDB($mysearch, $db)."%'", "idupl"); $uploads->select("idclient='" . Contenido_Security::toInteger($client) . "' AND filename LIKE '%" . Contenido_Security::escapeDB($mysearch, $db) . "%'", "idupl");
while ($item = $uploads->next()) while ($item = $uploads->next()) {
{ $items[$item->get("dirname") . $item->get("filename")] += 1;
$items[$item->get("dirname").$item->get("filename")] += 1;
} }
return ($items); return ($items);
} }
function uplGetFileExtension ($sFile) function uplGetFileExtension($sFile) {
{
/* Fetch the dot position */ /* Fetch the dot position */
$iDotPosition = strrpos($sFile, "."); $iDotPosition = strrpos($sFile, ".");
$sExtension = substr($sFile, $iDotPosition + 1); $sExtension = substr($sFile, $iDotPosition + 1);
if (strpos($sExtension, "/") !== false) if (strpos($sExtension, "/") !== false) {
{
return false; return false;
} else { } else {
return $sExtension; return $sExtension;
} }
} }
?> ?>

Datei anzeigen

@ -29,7 +29,6 @@ define('CL_BACKUP_START_IMG_OFF', $cfg['path']['contenido_html'] . $cfg['path'][
$aMessage = array(); $aMessage = array();
$bNoBackup = false; $bNoBackup = false;
$bFinalStep = false; $bFinalStep = false;
echo CL_BACKUP_PATH;
// check backup path // check backup path
if (!is_dir(CL_BACKUP_PATH) || !is_writable(CL_BACKUP_PATH)) { if (!is_dir(CL_BACKUP_PATH) || !is_writable(CL_BACKUP_PATH)) {
$notification->displayNotification("error", i18n("Backupfolder missing or not writable!")); $notification->displayNotification("error", i18n("Backupfolder missing or not writable!"));