$importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Demo mode: Uploading templates is disabled."), $basedestdir) . "<br/><br/>\n";
     $importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
     $importtemplateoutput .= "</div>\n";
     return;
 }
 require "classes/phpzip/phpzip.inc.php";
 //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name'];
 $zipfile = $_FILES['the_file']['tmp_name'];
 $z = new PHPZip();
 // Create temporary directory
 // If dangerous content is unzipped
 // then no one will know the path
 $extractdir = tempdir($tempdir);
 $basedestdir = $usertemplaterootdir;
 $newdir = str_replace('.', '', strip_ext(sanitize_paranoid_string($_FILES['the_file']['name'])));
 $destdir = $basedestdir . '/' . $newdir . '/';
 if (!is_writeable($basedestdir)) {
     $importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir) . "<br/><br/>\n";
     $importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
     $importtemplateoutput .= "</div>\n";
     return;
 }
 if (!is_dir($destdir)) {
     mkdir($destdir);
 } else {
     $importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Template '%s' does already exist."), $newdir) . "<br/><br/>\n";
     $importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
     $importtemplateoutput .= "</div>\n";
示例#2
0
       <select name="lang" style="font-size: 10; font-weight: bold; width: 150; border: 1px solid #000000;" onchange="document.select_lang.submit()">
       <?
         $language_dir = "language";
         $l_real_dir = realpath($language_dir);
         $l_dir = opendir($l_real_dir);
         // LOOP THROUGH THE PLUGINS DIRECTORY
         $lfile = array();
         while(false !== ($file = readdir($l_dir))){
           $lfile[] = $file;
         }
         //SORT THE CSS FILES IN THE ARRAY
         sort($lfile);
         //GO THROUGH THE ARRAY AND GET FILENAMES
         foreach($lfile as $key => $value){
         //IF FILENAME IS . OR .. DO NO SHOW IN THE LIST
         $fname = strip_ext($lfile[$key]);
         if($fname != ".." && $fname != "."){
           if($_SESSION['lang'] == $fname){
             echo "<option selected>" . $fname . "</option>";
           } elseif(trim($fname) != "") {
             echo "<option>" . $fname . "</option>";
           }
         }
       }
       ?>
       </select>
       </form>
     </div>
   <div class="bottom-bg"></div>
 </div>-->
 <!--left menu tugsgul-->
示例#3
0
文件: uploads.php 项目: robocon/iopr
 function getFiles($path)
 {
     $path = "" . WEB_PATH . "/images/random/";
     $files = array();
     $fileNames = array();
     $i = 0;
     // build
     if (is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file == "." || $file == "..") {
                     continue;
                 }
                 $fullpath = $path . "/" . $file;
                 //$fkey = strtolower($file);
                 $fkey = $file;
                 while (array_key_exists($fkey, $fileNames)) {
                     $fkey .= " ";
                 }
                 $a = stat($fullpath);
                 $files[$fkey]['size'] = $a['size'];
                 if ($a['size'] == 0) {
                     $files[$fkey]['sizetext'] = "-";
                 } else {
                     if ($a['size'] > 1024 && $a['size'] <= 1024 * 1024) {
                         $files[$fkey]['sizetext'] = ceil($a['size'] / 1024 * 100) / 100 . " K";
                     } else {
                         if ($a['size'] > 1024 * 1024) {
                             $files[$fkey]['sizetext'] = ceil($a['size'] / (1024 * 1024) * 100) / 100 . " Mb";
                         } else {
                             $files[$fkey]['sizetext'] = $a['size'] . " bytes";
                         }
                     }
                 }
                 $files[$fkey]['name'] = $file;
                 $e = strip_ext($file);
                 // $e is the extension - for example, .gif
                 $files[$fkey]['type'] = filetype($fullpath);
                 // file, dir, etc
                 $k = $e . $file;
                 // we use this string for sorting the array elements by extension and filename;
                 $fileNames[$i++] = $k;
             }
             closedir($dh);
         } else {
             die("Cannot open directory: {$path}");
         }
     } else {
         die("Path is not a directory: {$path}");
     }
     sort($fileNames, SORT_STRING);
     // sorting
     $sortedFiles = array();
     $i = 0;
     foreach ($fileNames as $f) {
         $f = substr($f, 4, strlen($f) - 4);
         // we remove the extension we added in front of the filename for sorting
         if ($files[$f]['name'] != '') {
             $sortedFiles[$i++] = $files[$f];
         }
     }
     // ends the foreach where we build the final sorted array
     return $sortedFiles;
 }
示例#4
0
				<?
					if($photocount == 1){
				?>
					</tr><tr>
				<?
					} else {
				?>
				
				<?
					}
				?>
					<td align="center" valign="middle" bgcolor="#F9F9F9" style="border: 1px solid #eeeeee; padding: 5px 0px 5px 0px;">
						<?php
								$sample_video_path = "./" . $setting->sample_dir . "/";
                if($photo_rows > 0){
								$filename = strip_ext($photo->filename);
								if(file_exists($sample_video_path . $filename . ".flv")){
									$flvsample=$filename . ".flv";									
								} else {
									$flvsample="";
								}
								
								// FIX FOR MOVING TO SWF FOLDER
								$sample_video_path = ".$sample_video_path";
							
								if($setting->show_watermark_thumb == 1){
									$imagepage = "thumb_mark.php?i=";
								} else {
									$imagepage = "image.php?src=";
								}
					
示例#5
0
											$file_size1 = $file_size1/1048576;
											$file_size1 = round($file_size1,2);
										echo "<br><b>Movie File:</b> Yes&nbsp;<input type=\"checkbox\" name=\"delete_movie_" . $image->id . "\" value=\"1\"> Delete <br>";
										echo $mov_name . "<br>";
										echo "File Size: " . $file_size1 . "(MB)<br>";
										} else {
										echo "<br><b>Movie File:</b> No&nbsp;";
										?>
										<br><b>Upload/Update:</b><br><input type="file" name="movie_file_<? echo $image->id; ?>" size="20" maxlength="40">
										<?
										} //End of movie upload
										?>
										
										<?php
										//Added for movie sample file uploading ability in version 320
										$name2 = strip_ext($image->filename);
										$name2 = array($name2 . ".mov", $name2 . ".avi", $name2 . ".mpg", $name2 . ".flv", $name2 . ".wmv");
										foreach($name2 as $key => $value){
										if(is_file($sample_video_path_manager . $name2[$key])){
											$file_exist2 = 1;
											$sample_name = $name2[$key];
											$check_sam = $sample_video_path_manager . $name2[$key];
											}
										}
										if($file_exist2 == 1){
											$file_size2 = filesize($check_sam);
											$file_size2 = $file_size2/1048576;
											$file_size2 = round($file_size2,2);
										echo "<br><b>Sample Movie File:</b> Yes&nbsp;<input type=\"checkbox\" name=\"delete_sample_" . $image->id . "\" value=\"1\"> Delete <br>";
										echo $sample_name . "<br>";
										echo "File Size: " . $file_size2 . "(MB)<br>";
示例#6
0
     $fs_mov2 = "file_name_" . $movie2->id;
     if ($_FILES[$rs_mov2]['name'] != "") {
         $movie2_extension = $_FILES[$rs_mov2]['name'];
         $movie2_ext = substr($_FILES[$rs_mov2]['name'], -3);
         $movie2_name = strip_ext($_POST[$fs_mov2]);
         $movie2_name = $movie2_name . "." . $movie2_ext;
         upload_file_new($_FILES[$rs_mov2], $movie2_name, $sample_video_path_manager);
     }
 }
 //Delete uploaded sample movie files attached
 $movie3_result = mysql_query("SELECT id FROM uploaded_images", $db);
 while ($movie3 = mysql_fetch_object($movie3_result)) {
     $rs_mov3 = "delete_sample_" . $movie3->id;
     $fs_mov3 = "file_name_" . $movie3->id;
     if ($_POST[$rs_mov3] == 1) {
         $movie_name3 = strip_ext($_POST[$fs_mov3]);
         $movie_name3 = array($movie_name3 . ".mov", $movie_name3 . ".avi", $movie_name3 . ".mpg", $movie_name3 . ".flv", $movie_name3 . ".wmv");
         foreach ($movie_name3 as $key => $value) {
             if (is_file($sample_video_path_manager . $movie_name3[$key])) {
                 $mov_name3 = $movie_name3[$key];
             }
         }
         unlink($sample_video_path_manager . $mov_name3);
     }
 }
 if ($prod) {
     foreach ($prod as $value) {
         $prod2 = $prod2 . "," . $value;
     }
 }
 $prod = $prod2;
示例#7
0
/**
FUNCTION: glob_rsort_modtime()
* Glob reverse sorted by file modification time.
*
* Returns an array of files matching the given glob pattern, sorted 
* by their modification times in descending order.  The array keys
* hold the filepath and the values hold the mtime.  On error, array
* will be indexed and contain 'false' and an error message.
*
* {@source}
*
* @param string $patt Pattern to search, including glob braces.
* @return array filename => mtime OR false, 'errormsg'.
*/
function glob_rsort_modtime($patt)
{
    if (($files = @glob($patt, GLOB_BRACE)) === false) {
        return array(false, 'Glob error.');
    }
    if (!count($files)) {
        return array(false, 'No files found.');
    }
    $rtn = array();
    foreach ($files as $filename) {
        $rtn[$filename] = filemtime($filename);
    }
    arsort($rtn);
    reset($rtn);
    return $rtn;
}
$files = glob_rsort_modtime('*.jpg');
示例#8
0
                $name = substr($name, 0, -strlen($ext));
            }
            return $name;
        }
        ?>
<script type="text/javascript">

function highlight(field) {
        field.focus();
        field.select();
}

</script>
	<?php 
        $imagefilename = $_FILES['imagefile']['name'];
        $imagefilename_rl = strip_ext($imagefilename);
        $imagefilename_ext = strtolower(end(explode('.', $imagefilename)));
        // get the file extension
        // Transliterate all characters with accents,umlauts,ligatures and runes known to ISO-8859-1
        $imagefilename_rl = strtr($imagefilename_rl, "¡ªº¿ÀÁÂÃÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕØÙÚÛÝàáâãåçèéêëìíîïðñòóôõøùúûýÿ", "!ao?AAAAACEEEEIIIIDNOOOOOUUUYaaaaaceeeeiiiidnooooouuuyy");
        $imagefilename_rl = strtr($imagefilename_rl, array("Ä" => "Ae", "Æ" => "AE", "Ö" => "Oe", "Ü" => "Ue", "Þ" => "TH", "ß" => "ss", "ä" => "ae", "æ" => "ae", "ö" => "oe", "ü" => "ue", "þ" => "th"));
        // Strip all non-alphanumeric characters (except _ -) from string and replace all spaces with _ (underscore)
        $find = array("/[^a-zA-Z0-9\\-\\_\\s]/", "/\\s+/");
        $replace = array("", "_");
        $imagefilename_rl = strtolower(preg_replace($find, $replace, $imagefilename_rl));
        // Truncate filename if longer than 100 characters
        $imagefilename_rl = strlen($imagefilename_rl) > 100 ? substr($imagefilename_rl, 0, 100) : $imagefilename_rl;
        $imagefilename = $imagefilename_rl . "." . $imagefilename_ext;
        $url = $file_prefix . $imagefilename;
        // Set $url To Equal The Filename For Later Use
        $getcode = "[url=" . $forumurl . $idir . $file_prefix . $imagefilename . "][img]" . $forumurl . $tdir . $file_prefix . $imagefilename . "[/img][/url]";
示例#9
0
						function db_tree($x,$level,$order_by,$order_type,$access_type,$nav){
							global $db;
							
							$current_row = 1;
							
							$pg_result = mysql_query("SELECT id,galorder,pub_pri,active,title,nest_under FROM photo_galleries where nest_under = '$x' order by $order_by " . $order_type, $db);
							$pg_rows = mysql_num_rows($pg_result);
							while($pg = mysql_fetch_object($pg_result)){
								if(strlen($pg->title) > 100){
									$trim_title = substr($pg->title, 0, 100) . "...";
								}
								else {
									$trim_title = $pg->title;
								}
								
								$row_color++;	
								if ($row_color%2 == 0) {
									echo "<tr bgcolor=\"#577EC4\" onmouseover=\"this.style.backgroundColor='#094493';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#577EC4'\">";
								}
								else {
									echo "<tr bgcolor=\"#5E85CA\" onmouseover=\"this.style.backgroundColor='#094493';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#5E85CA'\">";
								}
						?>
								<?
									// SHOW ID IF ADMIN IS LOGGED IN
									if($_SESSION['access_type'] == "admin"){
								?>
								<td align="center" class="listing_id" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'">
									<? echo $pg->id; ?>
								</td>
								<?
									}
								?>
								
								<td align="center" class="listing_id" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'">
									<?php if($pg->pub_pri == 1){ echo "--"; } else { echo $pg->galorder; } ?>
								</td>
								
								<td width="100%">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tr>
											<td align="left" class="listing" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $staff->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'"><?	for($z = 1; $z < $level; $z++){	echo "<img src=\"images/mgr_listing_spacer.gif\" border=\"0\">"; } ?><a href="mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $staff->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>" class="list_links"><?php if($pg->pub_pri == 1){ echo "<img src=\"images/mgr_cat_lock.gif\" border=\"0\">"; } else { ?><img src="images/mgr_icon_gallery2.gif" border="0"><?php } ?></a></td>
											<td width="100%" align="left" class="listing" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'">
												&nbsp;&nbsp;<a href="mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>" class="list_links"><? echo $trim_title; ?></a>
											</td>										
										</tr>
									</table>
								</td>					
								
								
								<td align="center" class="listing" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'">
									<a href="mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>" class="edit_links"><b><? if($pg->active == 1){ echo "Yes"; } else { echo "No"; } ?></a>
								</td>
								<td align="center" class="listing" onClick="window.location.href='mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>'">
									
                  <!--
                  <a href="mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>" class="edit_links">
                  -->    
                      <?php
                        $language_dir = "../language";
                        $l_real_dir = realpath($language_dir);
                        $l_dir = opendir($l_real_dir);
                        $i = 0;
                        // LOOP THROUGH THE PLUGINS DIRECTORY
                        $lfile = array();
                        while(false !== ($file = readdir($l_dir))){
                        $lfile[] = $file;
                        }
                        //SORT THE CSS FILES IN THE ARRAY
                        sort($lfile);
                      ?>

                      
                      <?php
                        //GO THROUGH THE ARRAY AND GET FILENAMES
                        foreach($lfile as $key => $value){
                          //IF FILENAME IS . OR .. OR SLIDESHOW.CSS DO NO SHOW IN THE LIST
                          $fname = strip_ext($lfile[$key]);
                          if($fname != ".." && $fname != "." && trim($fname) != ""){
                              
                       ?>
                       <a href="mgr.php?nav=<? echo $nav; ?>&item_id=<? echo $pg->id; ?>&order_by=<? echo $order_by; ?>&order_type=<? echo $order_type; ?>&lang=<?php echo $fname; ?>" class="edit_links">
                        [edit]<?php echo $fname ;?>
                       </a>
                       <?php       
                          }
                        }
                          
                      ?>
                  <!--
                  </a>
                  -->
								</td>
								<td align="center" class="listing">
									<input name="<? echo $pg->id; ?>" type="checkbox" value="1">
								</td>
							</tr>					
						<?
							
								db_tree($pg->id,$level + 1,$order_by,$order_type,$access_type,$nav);	
							$current_row ++;						
							}
						}						
示例#10
0
文件: opraf.php 项目: nimral/opraf
function render_images()
{
    #TODO
    global $pdf_file;
    global $img_dir;
    global $img_uri;
    global $lock;
    $pdf_base = strip_ext($pdf_file);
    $imgs = get_images($pdf_base);
    if (count($imgs) == 0) {
        render_regen_form($pdf_file, 'Obrázky je nutné nejdříve vygenerovat.');
        return;
    }
    render_check_update($pdf_base, $imgs[0]);
    foreach ($imgs as $idx => $img) {
        $img_uri_path = "{$img_uri}/{$img}";
        $img_path = "{$img_dir}/{$img}";
        list($w, $h) = getimagesize($img_path);
        $id = "img-{$idx}";
        if ($lock) {
            echo "<b>Od " . $lock["cas"] . " zanáší " . $lock["au"] . " korektury.</b>";
        }
        render_image($img_path, $id, $w, $h);
    }
    if ($lock) {
        render_unlock($pdf_file);
    } else {
        render_lock($pdf_file);
    }
    render_delall($pdf_file);
}
示例#11
0
<?php

// Grab all content files, add a wrapper, a beat, and a melody
$filelist = getContentList(PATH_TXT, '.php');
$findme = array(" ", "'");
$replaceme = array("_", "");
$home_page = 'Start';
foreach ($filelist as $file) {
    $filename = str_replace($findme, $replaceme, htmlentities(strip_ext(basename($file))));
    if ($filename == '0') {
        $filename = $home_page;
    }
    echo '<div id="' . $filename . '" class="thisisapage">' . '<div class="heading"><h1></h1></div>' . get_include_contents(PATH_TXT . $file) . '</div>';
}
示例#12
0
						foreach($ids as $key => $value){
							if($mycount == 1){
								echo "<tr>";
							}
							$title2 = str_replace($replace_char, " ", $ids5[$key]);
				?>
								<td valign="top" width="<?php echo round(100/$setting->dis_columns); ?>%">
									<table width="100px">
										<tr>
											<td align="center" valign="middle" height="<? echo $setting->thumb_width + 15; ?>" bgcolor="#F9F9F9" style="border: 1px solid #eeeeee; padding: 5px 0px 5px 0px;">
												
                    <?php
                    			$sample_video_path = "./" . $setting->sample_dir . "/";
                    			
													if($ids2[$key] != "ns"){
														$filename = strip_ext($ids4[$key]);
														if(file_exists($sample_video_path . $filename . ".flv")){
															$flvsample=$filename . ".flv";									
														} else {
															$flvsample="";
														}
														
														// FIX FOR MOVING TO SWF FOLDER
														$sample_video_path = ".$sample_video_path";
													
														if($setting->show_watermark_thumb == 1){
															$imagepage = "thumb_mark.php?i=";
														} else {
															$imagepage = "image.php?src=";
														}
												?>
| downloaded:       Fri, 17 Sep 2010 13:18:17 GMT as PHP file
|
| code URL:
| http://phparadise.de/php-code/file-handling/strip-file-extension/
|
| description:
| this php code will strip the extension from a filename. to remove the extension
| just call the function with the name of the file
|
------------------------------------------------------------------------------*/
function strip_ext($name)
{
    $ext = strrchr($name, '.');
    if ($ext !== false) {
        $name = substr($name, 0, -strlen($ext));
    }
    return $name;
}
// demonstration
$filename = 'file_name.txt';
echo '
<p>
	the filename without extension:<br />
	' . strip_ext($filename) . '
</p>';
// to get the file extension, do
echo '
<p>
	the file extension:<br />
	' . end(explode('.', $filename)) . '
</p>';