Bilder nach upload "CHMOD 600"?

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Bilder nach upload "CHMOD 600"?

Beitrag von halousi » Mi 2. Nov 2005, 09:21

hallo, habe nach dem update auf 4.6.1 das problem, daß bilder beim upload in der dateiverwaltung mit CHMOD 600 abgelegt werden. das führt natürlich dazu, daß man die bilder nicht anzeigen und verwenden kann.
hoster ist die domainfactory. kann man beim uplaod irgendwo den chmod ändern?

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 2. Nov 2005, 10:43

Contenido setzt keine Rechte beim Upload - eventuell mal den Provider darauf hinweisen, daß er die umask ändern soll ;)

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 11:22

kann die rechte nicht in der functions.upl.php irgendwie einfügen? (chmod($file, 0644); ) oder so?

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 13:31

weiss denn niemand wo ich den chmod-befehl einfügen muss?

Arno Simon
Beiträge: 158
Registriert: Di 2. Sep 2003, 18:10
Kontaktdaten:

Beitrag von Arno Simon » Mi 2. Nov 2005, 13:35

halousi hat geschrieben:weiss denn niemand wo ich den chmod-befehl einfügen muss?
mea culpa,

aber manchmal nützt auch selbst probieren etwas!

versuch's doch'mal an o.g. stelle!

garantieren wird's dir zunächst mal keiner und andere haben auch andere probleme ;)

vG

Arno

PS Feedback in Deinem eigenen Beitrag nicht vergessen! Damit auch andere was davon haben....
Kaum macht man's richtig, schon funktioniert's...
Feedback ist wichtig! Undank ist der Welten lohn!!
Rechtschreibfehler sind ein Geschenk an die Allgemeinheit!

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 13:49

aber manchmal nützt auch selbst probieren etwas!
nun genau dafür sollte ich wissen in welcher datei der upload ausgeführt wird....

emergence
Beiträge: 10641
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mi 2. Nov 2005, 13:51

-> include.upl_files_overview.php
*** make your own tools (wishlist :: thx)

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 16:10

ok, ich geb auf. ich bekomm es nicht zum laufen.
kann mir da vieleicht jemand helfen? warum hat das in der 4.5 version funktioniert und jetzt nicht mehr und warum funktionieren dann die preview-bilder? der provider hat nichts verändert. habe vor einem jahr extra von strato zu df gewechselt und jetzt gehts wieder nicht :cry: da muss es doch eine lösung geben, bitte schaut doch mal nach ob sich da nicht doch ein befehl zum setzten der zugriffsrechte einfügen lässt.

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 2. Nov 2005, 16:29

Die Diskussion hatten wir schonmal...

was sind dann deiner Meinung nach die richtigen Zugriffsrechte?

777? bitte nicht
666? auch nicht prickelnd
644? dann funktionieren ftp-uploads nicht mit der Vorschau, da meistens apache+ftp user nicht derselbe sind..
664? dann mußt du garantieren daß ftp-user und apache-user in derselben gruppe sind, was aber bei fast keinem provider der fall ist...

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 16:48

welchen grund gibt es bilder nicht auf 777 zu setzen?
fakt ist doch, daß ich nicht der einzige mit diesem problem bin und es werden mit der neuen version sicher immer mehr. die funktionalität von contenido ist dadurch enorm eingeschränkt, oder welchem kunden kann ich zumuten seine bilder immer per ftp aufzuspielen? ergo wird contenido dadurch unbrauchber.
die lösung kann sicher nicht sein immer den provider wechseln zu müssen, oder? zudem bin ich z.b. mit der domainfactory sehr zufrieden und habe keinerlei probleme mit anderer software wie z.b. xtcommerce, bbboard oder sonstigen tools (auch contenido 4.5 lief einwandfrei). ich kann auch die df verstehen dass sie nicht wegen contenido die einstellungen ihres servers ändern.

also bitte, habt mitleid und helft uns doch... :wink:

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 2. Nov 2005, 17:09

weil mit dem Recht 777 JEDER auf, der sich auf dem Server befindet, Daten lesen UND ändern kann

setz dich doch ein bisschen mit Unix-Dateisystemberechtigungen auseinander

fakt ist, daß es keine Lösung von Contenido gibt...dein Provider sollte die umask entsprechend richtig konfigurieren oder du mußt dir einen Hack einbauen der die Rechte entsprechend setzt

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Mi 2. Nov 2005, 17:26

das ist mir schon klar, aber das wäre MIR im fall von bilder ziemlich wurst.
fakt ist, daß es keine Lösung gibt...
wo kam dann die vom "alten" her und wie machen es die "anderen"?
und was soll ich deiner meinung nach jetzt mit 10 contenido installationen auf meinem server anstellen, alle umziehen?
setz dich doch ein bisschen mit Unix-Dateisystemberechtigungen auseinander
finde ich dann die lösung zum problem von contenido 4.6?

verstehe ich das aber richtig, daß es prinzipiell schon möglich ist die daten beim upload mit einem chmod zu versehen?
na vieleicht findet sich ja dann doch noch jemand der uns da eine lösung anbieten könnte.

halousi
Beiträge: 111
Registriert: Mi 30. Mär 2005, 15:31
Kontaktdaten:

Beitrag von halousi » Fr 4. Nov 2005, 12:25

und hier ist die lösung!!!

datei "includes/functions.upl.php" durch diesen code ersetzten!
ACHTUNG: bitte backup der "alten" erstellen!!!



Code: Alles auswählen

<?php
/*****************************************
* File      :   $RCSfile: functions.upl.php,v $
* Project   :   Contenido
* Descr     :   Upload functions mit chmod 0777
*
* Author    :   $Author: timo.hummel $
*
* Created   :   28.12.2003
* Modified  :   $Date: 2005/10/21 12:13:20 $
                     $Date: 2005/11/04 12:23:20 by halousi $
*
* © four for business AG, www.4fb.de
*
* $Id: functions.upl.php,v 1.25 2005/10/21 12:13:20 timo.hummel Exp $
******************************************/

cInclude("classes", "class.upload.php");
cInclude("classes", "class.properties.php");
cInclude("classes", "class.dbfs.php");

function uplDirectoryListRecursive ($currentdir, $startdir=NULL, $files=array(), $depth=-1, $pathstring="") {
    $depth++;

    $unsorted_files = array();

    if (chdir ($currentdir) == false)
    {
    	return;
    }

    // remember where we started from
    if (!$startdir) {
        $startdir = $currentdir;
    }
    $d = opendir (".");

    //list the files in the dir
    while ($file = readdir ($d)) {
        if ($file != ".." && $file != ".") {
            if (is_dir ($file)) {
                $unsorted_files[] = $file;
            } else {
            }
        }
    }
    if (is_array($unsorted_files)) sort($unsorted_files);
    $sorted_files = $unsorted_files;

    if(is_array($sorted_files)) {
        foreach ($sorted_files as $file) {
            if ($file != ".." && $file != ".") {

                if ((filetype(getcwd()."/".$file) == "dir") &&
                    (opendir(getcwd()."/".$file) !== false)) {
                    $a_file['name']  = $file;
                    $a_file['depth'] = $depth;
                    $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']);
                } else {
                    // If $ file is not a directory then do nothing
                }
            }
        }
    }

    closedir ($d);
    chdir ($startdir);
    return $files;
}

function upldelete($path, $files) {
        global $cfgClient, $client, $con_cfg, $db, $cfg;

        $path = $cfgClient[$client]['upl']['path'].$path;

        if (!is_array($files)) {
            $tmp[] = $files;
            unset($files);
            $files = $tmp;
        }

        $ArrayCount = count($files);
        for ($i=0; $i<$ArrayCount; $i++) {
                if (is_dir($path.urldecode($files[$i]))) {
//                        uplrecursivermdir($path.urldecode($files[$i]));
                        uplRecursiveRmDirIfEmpty($path.urldecode($files[$i]));

                        $sql = "DELETE FROM ".$cfg["tab"]["upl"]." WHERE dirname='".$files[$i]."/'";
                        $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]));
                        }

                        $file_name = urldecode($files[$i]);
                        $sql_dirname = str_replace($cfgClient[$client]['upl']['path'], '', $path);

                        unlink($path.$file_name);

                        $sql = "SELECT idupl
                                          FROM ".$cfg["tab"]["upl"]."
                                          WHERE
                                          idclient='$client'
                                          AND
                                          filename='$file_name'
                                          AND
                                          dirname='$sql_dirname'";
                        $db->query($sql);
                        if ($db->next_record()) {
                                $sql = "DELETE FROM ".$cfg["tab"]["upl"]." WHERE idupl='".$db->f("idupl")."'";

                                $db->query($sql);
                        }

                }
        }
}

function uplRecursiveRmDirIfEmpty($dir) {

    global $notification;

    if(!is_dir($dir)) {
            return 0;
    }
    $directory = @opendir($dir);

    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);
                    } else {
                            $notification->displayNotification("warning", "Im Verzeichnis $dir sind noch Dateien vorhanden. L&ouml;schen nicht m&ouml;glich.");
                            //unlink($dir."/".$dir_entry);
                    }
            }
    }
    closedir($directory);
    unset($directory);
    if (@rmdir($dir)) {
            return 1;
    } else {
            return 0;
    }
}

function uplHasFiles($dir)
{
	global $client, $cfgClient;

    $directory = @opendir($cfgClient[$client]["upl"]["path"].$dir);

    if (!$directory)
    {
    	return true;
    }

    readdir($directory);

    $ret = false;

    while(false !== ($dir_entry = readdir($directory))) {
            if($dir_entry != "." && $dir_entry != "..") {
            				closedir($directory);
                            return (true);
            }
    }
    closedir($directory);
    unset($directory);

    return ($ret);
}

function uplHasSubdirs($dir)
{
	global $client, $cfgClient;

    $directory = @opendir($cfgClient[$client]["upl"]["path"].$dir);

    if (!$directory)
    {
    	return true;
    }

    readdir($directory);

    $ret = false;

    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;
        		}
    		}
    }

    return ($ret);
}


/**
 * uplSyncDirectory ($path)
 * Sync database contents with directory
 *
 * @param string $path Specifies the path to scan
 */
function uplSyncDirectory ($path)
{
	global $cfgClient, $client, $cfg, $db;

	if (substr($path,0,5) == "dbfs:")
	{
		return uplSyncDirectoryDBFS($path);
	}

	$uploads = new UploadCollection;
    $properties = new PropertyCollection;

	/* Read all files in a specific directory */
	$dir = $cfgClient[$client]['upl']['path'].$path;

	$olddir = getcwd();

	@chdir($dir);
	$dirhandle = @opendir($dir);

	/* Whoops, probably failed to open. Return to the caller, but clean up stuff first. */
	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")))
        	{
        		$uploads->delete($upload->get("idupl"));
        	}
        }

        $properties->select("idclient = '$client' AND itemtype='upload' AND type='file' AND itemid LIKE '".$path."%'");


       	while ($property = $properties->next())
       	{
       		if (!file_exists($cfgClient[$client]["upl"]["path"].$property->get("itemid")))
    		{
    			$properties->delete($property->get("idproperty"));
    		}
       	}

		chdir($olddir);
		return;
	}




	/* Put all the files into the $files array */
	while ($file = readdir ($dirhandle))
    {
    	if ($file != "." && $file != "..")
    	{
    		if (is_file($file))
    		{
    			$uploads->sync($path, $file);
    			chmod ($file, 0777); 
    		}
    	}
    }

    $uploads->select("dirname = '$path' AND idclient = '$client'");


    while ($upload = $uploads->next())
    {
    	if (!file_exists($cfgClient[$client]["upl"]["path"].$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."%'");


   	while ($property = $properties->next())
   	{
   		if (!file_exists($cfgClient[$client]["upl"]["path"].$property->get("itemid")))
		{
			$properties->delete($property->get("idproperty"));
		}
   	}


    chdir($olddir);
}


/**
 * uplSyncDirectoryDBFS ($path)
 * Sync database contents with DBFS
 *
 * @param string $path Specifies the path to scan
 */
function uplSyncDirectoryDBFS ($path)
{
	global $cfgClient, $client, $cfg, $db;

	$uploads = new UploadCollection;
    $properties = new PropertyCollection;
    $dbfs = new DBFSCollection;

    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"));
        		chmod ($file, 0777); 
        	}
        }
	}

	$uploads->select("dirname = '$path/' AND idclient = '$client'");

    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."%'");


   	while ($property = $properties->next())
   	{
   		if (!$dbfs->file_exists($property->get("itemid")))
		{
			$properties->delete($property->get("idproperty"));
		}
   	}

	return;
}


function uplmkdir($path,$name) {
        global $cfgClient, $client, $action;

        if (substr($path,0,5) == "dbfs:")
        {
        	$path = str_replace("dbfs:","", $path);

        	$fullpath = $path."/".$name."/.";

        	$dbfs = new DBFSCollection;
        	$dbfs->create($fullpath);
        	return;
        }

        $name = uplCreateFriendlyName($name);
        $name = strtr($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);
                umask($oldumask);
        }
}

function uplRenameDirectory ($oldpath, $newpath, $parent)
{
	global $cfgClient, $client, $cfg, $db;

	$db2 = new DB_Contenido;

	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='$client' AND dirname LIKE '{$parent}{$oldpath}%'";
	$db->query($sql);

	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='$newpath2' WHERE idupl = '$idupl'";
		$db2->query($sql);

	}

	$sql = "SELECT itemid, idproperty FROM ".$cfg["tab"]["properties"]." WHERE itemid LIKE '{$parent}{$oldpath}%'";
	$db->query($sql);

	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'";
		$db2->query($sql);
	}

}









function uplRecursiveDirectoryList ($directory, &$rootitem, $level)
{
	$dirhandle = @opendir($directory);

	if (!$dirhandle)
	{
	} else {

		unset($files);

        //list the files in the dir
        while ($file = readdir ($dirhandle))
        {
        	if ($file != "." && $file != "..")
        	{
        		if (@chdir($directory.$file."/"))
            	{
            		$files[] = $file;
            	}
        	}
        }


        if (is_array($files))
        {
        	sort($files);
        	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."/"))
            		{
                		unset($item);
                		$item = new TreeItem($file, $directory.$file."/",true);
                		$item->custom["level"] = $level;

                		if ($key == count($files)-1)
                		{
                			$item->custom["lastitem"] = true;
                		} else {
                			$item->custom["lastitem"] = false;
                		}

                		$item->custom["parent"] = $directory;

                		$rootitem->addItem($item);
                		$old = $rootitem;
                		uplRecursiveDirectoryList($directory.$file."/", $item, $level + 1);
                		$rootitem = $old;
                		chdir($olddir);
                	}
            	}
        	}
        }
	}

    @closedir ($dirhandle);
}

function uplRecursiveDBDirectoryList ($directory, &$rootitem, $level)
{
	$dbfs = new DBFSCollection;

	$dbfs->select("filename = '.'","dirname", "dirname ASC");

	$count = 0;
	$lastlevel = 0;

	$item["."] = &$rootitem;

	while ($dbitem = $dbfs->next())
	{
		$dirname = $dbitem->get("dirname");
		$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);

    		$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]))
    			{
    				$prevobj[$level]->custom["lastitem"] = false;
    			}
    		}

			if ($lastlevel < $level)
			{

			}
    		if ($lastlevel > $level)
    		{
    			unset($prevobj[$lastlevel]);
    			$lprevobj->custom["lastitem"] = true;
    		}

    		$prevobj[$level] = &$item[$dirname];
    		$lprevobj = &$item[$dirname];

    		$lastlevel = $level;

    		if (is_object($item[$parent]))
    		{
    			$item[$parent]->addItem($item[$dirname]);
    		}

    		$count++;
		}
	}

}

function uplGetThumbnail ($file, $maxsize)
{
	global $client, $cfgClient, $cfg;

	if ($maxsize == -1)
	{
		return uplGetFileIcon ($file);
	}

	switch (getFileExtension($file))
	{
		case "png":
		case "psd":
		case "gif":
		case "tiff":
		case "bmp":
		case "jpeg":
		case "jpg":
		case "bmp":
		case "iff":
		case "xbm":
		case "wbmp":
				$img = capiImgScale($cfgClient[$client]["upl"]["path"].$file, $maxsize, $maxsize, false, false, 50);

				if ($img !== false)
				{
					return $img;
				} else {
					$value = capiImgScale($cfg["path"]["contenido"]."images/unknown.jpg", $maxsize, $maxsize, false, false, 50);
					if ($value !== false)
					{
						return $value;
					} else {
						return uplGetFileIcon($file);
					}
				}
				break;
		default:
				return uplGetFileIcon ($file);
				break;

	}
}

/**
 * Returns the icon for a file type
 *
 * @param $file		Filename to retrieve the extension for
 *
 * @return Icon for the file type
 *
 */
function uplGetFileIcon ($file)
{
	global $cfg;

	switch (getFileExtension($file))
	{
		case "sxi":
		case "sti":
		case "pps":
		case "pot":
		case "kpr":
		case "ppt":	$icon = "ppt.gif";
					break;
		case "doc":
		case "dot":
		case "sxw":
		case "stw":
		case "sdw":
		case "kwd":	$icon = "word.gif";
					break;
		case "xls":
		case "sxc":
		case "stc":
		case "xlw":
		case "xlt":
		case "csv":
		case "ksp":
		case "sdc":	$icon = "excel.gif";
					break;
		case "txt":
		case "rtf": $icon = "txt.gif";
					break;
		case "gif": $icon = "gif.gif";
					break;
		case "png": $icon = "png.gif";
					break;
		case "jpeg":
		case "jpg": $icon = "jpg.gif";
					break;
		case "html":
		case "htm": $icon = "html.gif";
					break;
		case "lha":
		case "rar":
		case "arj":
		case "bz2":
		case "bz":
		case "gz":
		case "tar":
		case "tbz2":
		case "tbz":
		case "tgz":
		case "zip": $icon = "zip.gif";
					break;
		case "pdf": $icon = "pdf.gif";
					break;

		default: $icon = "unknown.gif";
	}

	return $cfg['path']['contenido_fullhtml'] . $cfg["path"]["images"]. "filetypes/".$icon;
}


/**
 * Returns the description for a file type
 *
 * @param $extension	Extension to use
 *
 * @return Text for the file type
 *
 */
function uplGetFileTypeDescription ($extension)
{
	global $cfg;

	switch ($extension)
	{
		/* Presentation files */
		case "sxi": return (i18n("OpenOffice.org Presentation"));
		case "sti": return (i18n("OpenOffice.org Presentation Template"));
		case "pps": return (i18n("Microsoft PowerPoint Screen Presentation"));
		case "pot": return (i18n("Microsoft PowerPoint Presentation Template"));
		case "kpr": return (i18n("KDE KPresenter Document"));
		case "ppt":	return (i18n("Microsoft PowerPoint Presentation Template"));

		/* Document files */
		case "doc": return (i18n("Microsoft Word Document or regular text file"));
		case "dot": return (i18n("Microsoft Word Template"));
		case "sxw": return (i18n("OpenOffice.org Text Document"));
		case "stw": return (i18n("OpenOffice.org Text Document Template"));
		case "sdw": return (i18n("StarOffice 5.0 Text Document"));
		case "kwd":	return (i18n("KDE KWord Document"));

		/* Spreadsheet files */
		case "xls": return (i18n("Microsoft Excel Worksheet"));
		case "sxc": return (i18n("OpenOffice.org Table"));
		case "stc": return (i18n("OpenOffice.org Table Template"));
		case "xlw": return (i18n("Microsoft Excel File"));
		case "xlt": return (i18n("Microsoft Excel Template"));
		case "csv": return (i18n("Comma Seperated Value File"));
		case "ksp": return (i18n("KDE KSpread Document"));
		case "sdc": return (i18n("StarOffice 5.0 Table"));

		/* Text types */
		case "txt": return (i18n("Plain Text"));
		case "rtf": return (i18n("Rich Text Format"));

		/* Images */
		case "gif": return (i18n("GIF Image"));
		case "png": return (i18n("PNG Image"));
		case "jpeg": return (i18n("JPEG Image"));
		case "jpg": return (i18n("JPEG Image"));
		case "tif": return (i18n("TIFF Image"));
		case "psd": return (i18n("Adobe Photoshop Image"));

		/* HTML */
		case "html": return (i18n("Hypertext Markup Language Document"));
		case "htm": return (i18n("Hypertext Markup Language Document"));

		/* Archives */
		case "lha": return (i18n("LHA Archive"));
		case "rar": return (i18n("RAR Archive"));
		case "arj": return (i18n("ARJ Archive"));
		case "bz2": return (i18n("bz2-compressed File"));
		case "bz": return (i18n("bzip-compressed File"));
		case "zip": return (i18n("ZIP Archive"));
		case "tar": return (i18n("TAR Archive"));
		case "gz": return (i18n("GZ Compressed File"));

		/* Source files */
		case "c": return (i18n("C Program Code"));
		case "c++":
		case "cc":
		case "cpp": return (i18n("C++ Program Code"));
		case "hpp":
		case "h": return (i18n("C or C++ Program Header"));
		case "php":
		case "php3":
		case "php4": return (i18n("PHP Program Code"));
		case "phps": return (i18n("PHP Source File"));

		case "pdf": return (i18n("Adobe Acrobat Portable Document"));
		default: return (i18n("Unknown Type"));
	}

}

function uplCreateFriendlyName ($filename)
{
	$newfilename = "";

	$filename = str_replace(" ", "_", $filename);

	for ($i=0;$i<strlen($filename);$i++)
	{
		$atom = substr($filename, $i,1);
		if (eregi("[[:alnum:]]", $atom ))
		{
			$newfilename .= $atom;
		}

		if ($atom == "-" || $atom == "_" || $atom == ".")
		{
			$newfilename .= $atom;
		}
	}

	return $newfilename;
}

function uplSearch ($searchfor)
{
	global $client;

    $properties = new PropertyCollection;
    $uploads = new UploadCollection;

    $mysearch = urlencode($searchfor);

    /* Search for keywords first, ranking +5 */
    $properties->select("idclient='$client' AND itemtype = 'upload' AND type='file' AND name='keywords' AND value LIKE '%$mysearch%'","itemid");

    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='$client' AND itemtype = 'upload' AND type='file' AND name='medianame' AND value LIKE '%$mysearch%'","itemid");

    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='$client' AND itemtype = 'upload' AND type='file' AND name='medianotes' AND value LIKE '%$mysearch%'","itemid");

    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='$client' AND description LIKE '%$mysearch%'", "idupl");

    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='$client' AND filename LIKE '%$mysearch%'", "idupl");

    while ($item = $uploads->next())
    {
    	$items[$item->get("dirname").$item->get("filename")] += 1;
    }

    return ($items);
}

function uplGetFileExtension ($sFile)
{
	/* Fetch the dot position */
	$iDotPosition = strrpos($sFile, ".");

	$sExtension = substr($sFile, $iDotPosition + 1);
	if (strpos($sExtension, "/") !== false)
	{
		return false;
	} else {
		return $sExtension;
	}
}

?>

Dinkel
Beiträge: 565
Registriert: Di 22. Mär 2005, 14:52
Kontaktdaten:

Beitrag von Dinkel » Fr 4. Nov 2005, 16:01

wäre schön, wenn Du sagst, was Du geändert hast, dann muss man es nicht mühsam suchen ;)
selbstentwickelte Module:
Downloads und Infos zu den Modulen: gibt es hier.
Modul: Forum | Version 0.9 | getestet: 4.6.24 MR, 4.8.11, 4.8.11 AMR
Modul: Galleriffic | Version: 0.3.4 BETA | getestet: 4.8.11, 4.8.11 AMR, 4.8.12, 4.8.12 AMR
Modul: Metadata | Version: 2.0 | getestet: 4.9.7, 4.9.7 AMR
Modul: Slider Gallery | Version: 1.0 | getestet: 4.9.12 AMR
Modul: Up- & Download | Version: 4.1 | getestet: 4.9.12 AMR

HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

Beitrag von HerrB » Fr 4. Nov 2005, 19:59

Ohne es jetzt zu wissen, ob das alles ist, suche mal im Code nach chmod.

Gruß
HerrB
Bitte keine unaufgeforderten PMs oder E-Mails -> use da Forum!

Newsletter: V4.4.x | V4.6.0-15 (Module, Backend) | V4.6.22+
Standardartikelliste: V4.4.x | V4.6.x
http://www.contenido.org/forum/search.php | http://faq.contenido.org | http://www.communido.net

Gesperrt