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])) {
$values[] = 'NULL';
} else if ($rows[$column] != '') {
$values[] = '\'' . mysql_escape_string($rows[$column]) . '\'';
$values[] = '\'' . $this->_oDb->escape($rows[$column]) . '\'';
} else {
$values[] = '\'\'';
}

Datei anzeigen

@ -6,10 +6,6 @@
* Description:
* Validates the HTML
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes
* @version 1.6.1
* @author unknown
@ -19,13 +15,8 @@
* @link http://www.contenido.org
* @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 $:
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
@ -60,6 +51,9 @@ class cHTMLValidator
// remove all php code from layout
$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) */
$resultingHTML = str_replace("\r\n", "\n", $resultingHTML);
$resultingHTML = str_replace("\r", "\n", $resultingHTML);

Datei anzeigen

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

Datei anzeigen

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