当前位置: 首页>>代码示例>>PHP>>正文


PHP getext函数代码示例

本文整理汇总了PHP中getext函数的典型用法代码示例。如果您正苦于以下问题:PHP getext函数的具体用法?PHP getext怎么用?PHP getext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_video_files

 /**
  * function used to get video files only3
  */
 function get_video_files($with_path = false)
 {
     $exts = get_vid_extensions($with_path);
     $vid_files = array();
     $files = $this->get_files();
     if (is_array($files)) {
         foreach ($files as $file) {
             $ext = getext($file['file']);
             if (in_array($ext, $exts)) {
                 $vid_files[] = $file;
             }
         }
     }
     return $vid_files;
 }
开发者ID:yukisky,项目名称:clipbucket,代码行数:18,代码来源:mass_upload.class.php

示例2: template_rm_dir

function template_rm_dir($dir)
{
    if (getext(substr($dir, 0, -1)) == 'js') {
        return;
    }
    if (is_file(substr($dir, 0, -1))) {
        @unlink(substr($dir, 0, -1));
        return;
    }
    if ($d = opendir($dir)) {
        while (($f = readdir($d)) !== false) {
            if ($f != '.' && $f != '..') {
                template_rm_dir($dir . $f . DIRECTORY_SEPARATOR, $object);
            }
        }
        @rmdir($dir . $f);
    }
}
开发者ID:jonycookie,项目名称:projectm2,代码行数:18,代码来源:template.destroy_dir.php

示例3: del_dir

 function del_dir($path, &$info, &$err)
 {
     global $user;
     $info = array();
     $info["file"] = 0;
     $info["dir"] = 0;
     if (!is_dir($path)) {
         return false;
     }
     if ($this->get_perm($path) != "0777") {
         $this->ftp_cmode($path, "0777");
     }
     $this->my_list($path, $dirs, $files);
     foreach ($files as $f) {
         $ftype = getext($f);
         if ($user["limit"]["{$ftype}"] && !$user["only"]) {
             $err .= "文件{$f}删除失败:不能删除{$user["limittype"]}类型的文件!";
         } else {
             if (!$user["limit"]["{$ftype}"] && $user["only"]) {
                 $err .= "文件{$f}删除失败:不能删除除{$user["limittype"]}类型以外的文件!";
             } else {
                 if (@unlink($f)) {
                     $info["file"]++;
                 } else {
                     $err .= "文件{$f}删除失败!\n";
                 }
             }
         }
     }
     for ($i = count($dirs) - 1; $i >= 0; $i--) {
         $f = $dirs[$i];
         if (!@rmdir($f)) {
             $err .= "目录{$f}删除失败!\n";
         } else {
             $info["dir"]++;
         }
     }
     if (@rmdir($path)) {
         $info["dir"]++;
     }
     return $info["dir"];
 }
开发者ID:TopGrd,项目名称:newxb,代码行数:42,代码来源:longbill.class.php

示例4: encrypt_project

function encrypt_project($project, $new_project)
{
    $project = rtrim($project, '/');
    $new_project = rtrim($new_project, '/');
    if (!file_exists($new_project)) {
        if (!mkdir($new_project)) {
            printf("[failed] failed to call `mkdir()' function\n");
            return false;
        }
    }
    $hdl_o = opendir($project);
    $hdl_n = opendir($new_project);
    if (!$hdl_o || !$hdl_n) {
        if ($hdl_o) {
            closedir($hdl_o);
        }
        if ($hdl_n) {
            closedir($hdl_n);
        }
        printf("[failed] failed to call `opendir()' function\n");
        return false;
    }
    while (($file = readdir($hdl_o)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        $path = $project . '/' . $file;
        if (is_dir($path)) {
            encrypt_project($path, $new_project . '/' . $file);
        } elseif (is_file($path) && getext($file) == 'php') {
            beast_encode_file($path, $new_project . '/' . $file);
        } else {
            copy($path, $new_project . '/' . $file);
        }
    }
    closedir($hdl_o);
    closedir($hdl_n);
    return true;
}
开发者ID:sophia2152,项目名称:php-beast,代码行数:39,代码来源:encrypt_project.php

示例5: elseif

}
$dir = $config_vars['default_upload_dir'];
if ($HTTP_POST_VARS['moveup'] == "up") {
    $temp = $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id'] - 1];
    $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id'] - 1] = $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id']];
    $HTTP_SESSION_VARS['files'][$HTTP_POST_VARS['id']] = $temp;
} else {
    if ($HTTP_POST_VARS['movedown'] == "down") {
        $temp = $HTTP_SESSION_VARS['files'][$id + 1];
        $HTTP_SESSION_VARS['files'][$id + 1] = $HTTP_SESSION_VARS['files'][$id];
        $HTTP_SESSION_VARS['files'][$id] = $temp;
    } elseif (isset($dir)) {
        unset($HTTP_SESSION_VARS['files']);
        $dir_handle = opendir($dir);
        while ($file = readdir($dir_handle)) {
            if ($file != "." && $file != ".." and isset($filetypes[getext($file)])) {
                $f['filesize'] = round(filesize($dir . '/' . $file) / 1024, 1);
                $f['size'] = getimagesize($dir . '/' . $file);
                $f['url'] = $dir . '/' . $file;
                $f['name'] = basename($file);
                $HTTP_SESSION_VARS['files'][] = $f;
            }
        }
    }
}
$smarty->assign('files', $HTTP_SESSION_VARS['files']);
$smarty->assign('files_size', sizeof($HTTP_SESSION_VARS['files']));
$smarty->assign('dir', $dir);
if (!isset($HTTP_POST_VARS['thumbsize'])) {
    $HTTP_POST_VARS['thumbsize'] = 50;
}
开发者ID:BackupTheBerlios,项目名称:phreakpic,代码行数:31,代码来源:add_content.php

示例6: create_group_image

 /**
  * Function used to create group thumbnail
  * @param = $gpid {ID of group for which thumbnail is being created }
  * @param = $file { Source of image file $_FILES }
  */
 function create_group_image($gpid, $file)
 {
     global $imgObj;
     $file_ext = strtolower(getext($file['name']));
     $exts = array('jpg', 'png', 'gif', 'jpeg');
     foreach ($exts as $ext) {
         if ($ext == $file_ext) {
             $thumb_name = $gpid . '.' . $ext;
             $small_thumb_name = $gpid . '-small.' . $ext;
             $path = GP_THUMB_DIR . '/' . $thumb_name;
             $small_path = GP_THUMB_DIR . '/' . $small_thumb_name;
             foreach ($exts as $unlink_ext) {
                 if (file_exists(GP_THUMB_DIR . '/' . $gpid . '.' . $unlink_ext)) {
                     unlink(GP_THUMB_DIR . '/' . $gpid . '.' . $unlink_ext);
                 }
             }
             move_uploaded_file($file['tmp_name'], $path);
             if (!$imgObj->ValidateImage($path, $ext)) {
                 e(lang('pic_upload_vali_err'));
             } else {
                 $imgObj->CreateThumb($path, $path, $this->gp_thumb_width, $ext, $this->gp_thumb_height, true);
                 $imgObj->CreateThumb($path, $small_path, $this->gp_small_thumb_width, $ext, $this->gp_small_thumb_height, true);
             }
         }
     }
 }
开发者ID:Coding110,项目名称:cbvideo,代码行数:31,代码来源:groups.class.php

示例7: add_category_thumb

 /**
  * Function used to add category thumbnail
  * @param $Cid and Array
  */
 function add_category_thumb($cid, $file)
 {
     global $imgObj;
     if ($this->category_exists($cid)) {
         //Checking for category thumbs direcotry
         if (isset($this->thumb_dir)) {
             $dir = $this->thumb_dir;
         } else {
             $dir = $this->section_tbl;
         }
         //Checking File Extension
         $ext = strtolower(getext($file['name']));
         if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif') {
             $dir_path = CAT_THUMB_DIR . '/' . $dir;
             if (!is_dir($dir_path)) {
                 @mkdir($dir_path, 0777);
             }
             if (is_dir($dir_path)) {
                 $path = $dir_path . '/' . $cid . '.' . $ext;
                 //Removing File if already exists
                 if (file_exists($path)) {
                     unlink($path);
                 }
                 move_uploaded_file($file['tmp_name'], $path);
                 //Now checking if file is really an image
                 if (!@$imgObj->ValidateImage($path, $ext)) {
                     e(lang("pic_upload_vali_err"));
                     unlink($path);
                 } else {
                     $imgObj->CreateThumb($path, $path, $this->cat_thumb_width, $ext, $this->cat_thumb_height, true);
                 }
             } else {
                 e(lang("cat_dir_make_err"));
             }
         } else {
             e(lang("cat_img_error"));
         }
     }
 }
开发者ID:yukisky,项目名称:clipbucket,代码行数:43,代码来源:category.class.php

示例8: savefile

   if ($_FILES["ext2"]["tmp_name"] != "" && $_POST["ext2_chk"] != 1) {
       $myext2 = savefile("ext2", __racinebd__ . "list_images2_");
   } else {
       if ($_POST["ext2"] != "" && $_POST["ext2_chk"] != 1) {
           $filename2 = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext2"]["name"]);
           $myext2 = ",ext2='" . getext($_FILES["ext2"]["name"]) . "',nom_fichier2='" . $filename2 . "'";
       } else {
           if ($_POST["ext2_chk"] == 1) {
               $myext2 = ",ext1=null";
           }
       }
   }
   //if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){
   //sauvegarde en base
   $ext1 = getext($_FILES["ext1"]["name"]);
   $ext2 = getext($_FILES["ext2"]["name"]);
   $sql = "update " . __racinebd__ . "list_images \r\n  set titre1='" . addquote($_POST["titre_fichier1"]) . "',\r\n  titre2='" . addquote($_POST["titre_fichier2"]) . "',\r\n  lightbox='" . addquote($_POST["lightbox"]) . "',\r\n  contenulightbox='" . addquote($_POST["contenu"]) . "'\r\n  {$myext1}\r\n  {$myext2}\r\n  where images_id=" . $_POST["images_id"];
   /*
   ext1,nom_fichier1,titre2,ext2,nom_fichier2,lightbox,contenulightbox) 
   value(,'".$ext1."','".$filename1."','".addquote($_POST["titre_fichier2"])."','".$ext2."','".$filename2."','".$_POST["lightbox"]."','".$_POST["contenu"]."')";
   */
   $link = query($sql);
   //$images_id=insert_id();
   $sql = "select * from " . __racinebd__ . "list_images where images_id=" . $_POST["images_id"];
   $link = query($sql);
   $tbl_info = fetch($link);
   ?>
 <script>
 //parent.
 
 //content='<table width="100%" style="border-bottom:1px solid black" id="table_image_<?php 
开发者ID:jcmwc,项目名称:fleet,代码行数:31,代码来源:modiffile.php

示例9: set_time_limit

<?php

require "../../require/function.php";
require "../../require/back_include.php";
set_time_limit(3600);
if ($_POST["prix"] != "") {
    //creation du repertoire tmp
    //@mkdir ($_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id'], 0775);
    //deplacement du fichier
    //move_uploaded_file($_FILES[ext]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$_FILES["ext"]["name"]);
    $filename = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext"]["name"]);
    //if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){
    //sauvegarde en base
    $ext = getext($_FILES["ext"]["name"]);
    $sql = "insert into " . __racinebd__ . "prix (montant,quantite,ref) value('" . addquote($_POST["prix"]) . "','" . addquote($_POST["quantite"]) . "','" . addquote($_POST["ref"]) . "')";
    $link = query($sql);
    $prix_id = insert_id();
    $querystring = "select * from " . __racinebd__ . "attribut where supprimer=0 order by libelle";
    $link = query($querystring);
    while ($tbl = fetch($link)) {
        //print "attr_".$tbl["attribut_id"]."<br>";
        //print $_POST["attr_".$tbl["attribut_id"]];
        if ($_POST["attr_" . $tbl["attribut_id"]] != "" && $_POST["attr_" . $tbl["attribut_id"]] != -1) {
            $sql = "insert into " . __racinebd__ . "valeur_prix (valeur_id,prix_id,attribut_id) value('" . addquote($_POST["attr_" . $tbl["attribut_id"]]) . "','" . $prix_id . "','" . $tbl["attribut_id"] . "')";
            query($sql);
        }
    }
    ?>
  <script>
  content='<table width="100%" style="border-bottom:1px solid black" id="table_prix_<?php 
    echo $prix_id;
开发者ID:jcmwc,项目名称:fleet,代码行数:31,代码来源:insertprice.php

示例10: testext

function testext($name, $listext)
{
    return array_search(getext($_FILES[$name]["name"]), $listext) === false ? false : true;
}
开发者ID:jcmwc,项目名称:fleet,代码行数:4,代码来源:function.php

示例11: end_upload_file

function end_upload_file($name, $file, $attr)
{
    global $errors, $config;
    $ftype = getext($file['name']);
    //echo $ftype;
    //var_dump($config);  var_dump($attr); die();
    //如果是图片,那么只能上传这几种文件类型
    if ($attr['type'] == 'image' || $attr['type'] == 'imagelist') {
        $attr['filetype'] = array('jpg', 'jpeg', 'png', 'gif');
    }
    //验证文件类型
    if (!$config['upload_file_types']) {
        $errors[$name] = lang('need_config_upload_file_types');
    } else {
        if (!$attr['filetype']) {
            $errors[$name] = lang('file_type_not_configed');
        } else {
            if (!preg_match("/\\*\\.{$ftype};/i", $config['upload_file_types']) && !in_array($ftype, $attr['filetype'])) {
                $errors[$name] = lang('not_allowed_file_type');
            } else {
                $file_url = $file['name'];
                //如果文件名是一般的字母数字和-_,则不改变文件名
                if (preg_match('/^[a-z0-9\\_\\-\\s\\.]+$/i', $file_url)) {
                    $file_url = preg_replace('/\\s+/', '_', $file_url);
                } else {
                    //否则改成时间和随机数
                    $file_url = date('Y_m_d_H_i_s_') . rand(1111, 9999) . '.' . $ftype;
                }
                if (!$file_url) {
                    $errors[$name] = 'error';
                }
                //保存到什么地方
                if (!$attr['saveto']) {
                    end_mkdir(END_ROOT . END_UPLOAD_DIR);
                    $file_url = END_UPLOAD_DIR . $file_url;
                } else {
                    end_mkdir(END_ROOT . $attr['saveto']);
                    $file_url = $attr['saveto'] . $file_url;
                }
                //避免重名
                while (file_exists(END_ROOT . $file_url)) {
                    $file_url = dirname($file_url) . '/' . preg_replace('/\\.[a-z0-9]+$/i', '', basename($file_url)) . rand(1111, 9999) . '.' . $ftype;
                }
                //保存文件
                if (@move_uploaded_file($file["tmp_name"], END_ROOT . $file_url)) {
                    if ($attr['filter']) {
                        $file_url = $attr['filter']($file_url);
                    }
                    //$data[$name] = $file_url;
                    //更改图片尺寸
                    if ($attr['type'] == 'image' && is_array($attr['resize'])) {
                        foreach ($attr['resize'] as $_r) {
                            if (is_array($_r) && $_r['width'] && $_r['height']) {
                                //调整图片尺寸,保存为
                                $__re = thumb($file_url, $_r['width'], $_r['height']);
                                if ($_r['saveas']) {
                                    $data[$_r['saveas']] = $__re;
                                }
                            }
                        }
                    }
                    if (($attr['type'] == 'image' || $attr['type'] == 'imagelist') && $attr['max_width']) {
                        include_once END_ROOT . 'end_system/library/image.php';
                        $img = new Image();
                        $img->filepath = END_ROOT . $file_url;
                        $img->resize_width($attr['max_width']);
                    }
                }
                if (!file_exists(END_ROOT . $file_url)) {
                    $errors[$name] = lang('upload_error');
                }
                if (!is_writable(END_ROOT . dirname($file_url))) {
                    $errors[$name] = dirname($file_url) . ' ' . lang('is not writable');
                }
                return $file_url;
            }
        }
    }
}
开发者ID:WSKINGS,项目名称:chat_tickets,代码行数:79,代码来源:edit_field.php

示例12: upload_user_file

 /**
  * function used to upload user avatar and or background
  */
 function upload_user_file($type = 'a', $file, $uid)
 {
     global $db, $userquery, $cbphoto, $imgObj;
     $avatar_dir = BASEDIR . '/images/avatars/';
     $bg_dir = BASEDIR . '/images/backgrounds/';
     if ($userquery->user_exists($uid)) {
         switch ($type) {
             case 'a':
             case 'avatar':
                 if ($file['size'] / 1024 > config('max_profile_pic_size')) {
                     e(sprintf(lang('file_size_exceeds'), config('max_profile_pic_size')));
                 } elseif (file_exists($file['tmp_name'])) {
                     $ext = getext($file['name']);
                     $file_name = $uid . '.' . $ext;
                     $file_path = $avatar_dir . $file_name;
                     if (move_uploaded_file($file['tmp_name'], $file_path)) {
                         if (!$imgObj->ValidateImage($file_path, $ext)) {
                             e(lang("Invalid file type"));
                             @unlink($file_path);
                         } else {
                             $small_size = $avatar_dir . $uid . '-small.' . $ext;
                             $cbphoto->CreateThumb($file_path, $file_path, $ext, AVATAR_SIZE, AVATAR_SIZE);
                             $cbphoto->CreateThumb($file_path, $small_size, $ext, AVATAR_SMALL_SIZE, AVATAR_SMALL_SIZE);
                         }
                     } else {
                         e(lang("class_error_occured"));
                     }
                 }
                 break;
             case 'b':
             case 'bg':
             case 'background':
                 if ($file['size'] / 1024 > config('max_bg_size')) {
                     e(sprintf(lang('file_size_exceeds'), config('max_bg_size')));
                 } elseif (file_exists($file['tmp_name'])) {
                     $ext = getext($file['name']);
                     $file_name = $uid . '.' . $ext;
                     $file_path = $bg_dir . $file_name;
                     if (move_uploaded_file($file['tmp_name'], $file_path)) {
                         if (!$imgObj->ValidateImage($file_path, $ext)) {
                             e(lang("Invalid file type"));
                             @unlink($file_path);
                         } else {
                             $imgObj->CreateThumb($file_path, $file_path, BG_SIZE, $ext);
                         }
                     } else {
                         e(lang("An error occured While Uploading File!"));
                     }
                 }
                 break;
         }
         return $file_name;
     } else {
         e(lang('user_doesnt_exist'));
     }
 }
开发者ID:karamasmouh,项目名称:clipbucket,代码行数:59,代码来源:upload.class.php

示例13: has_hq

/**
 * Function used to check weather video has Mp4 file or not
 */
function has_hq($vdetails, $is_file = false)
{
    if (!$is_file) {
        $file = get_hq_video_file($vdetails);
    } else {
        $file = $vdetails;
    }
    if (getext($file) == 'mp4') {
        return $file;
    } else {
        return false;
    }
}
开发者ID:reactvideos,项目名称:Website,代码行数:16,代码来源:functions_video.php

示例14: generate_filename

 function generate_filename()
 {
     global $config_vars;
     //check if content is already in a cat
     if (!isset($this->cat_ids)) {
         $this->generate_content_in_cat_data();
     }
     if (sizeof($this->cat_ids) > 0) {
         $cat_obj = new categorie();
         $cat_obj->generate_from_id($this->cat_ids[0]);
         $path = $cat_obj->get_name();
         while ($cat_obj->get_parent_id() != $config_vars['root_categorie']) {
             $old_cat_id = $cat_obj->get_parent_id();
             $cat_obj = new categorie();
             $cat_obj->generate_from_id($old_cat_id);
             $path = $cat_obj->get_name() . '/' . $path;
         }
         // make $path is it doesnt exists
         if (!is_dir($config_vars['content_path_prefix'] . '/' . $path)) {
             makedir($config_vars['content_path_prefix'] . '/' . $path);
         }
         $path = $path . '/' . basename($this->name) . '.' . getext($this->file);
         $filename = $config_vars['content_path_prefix'] . '/' . $path;
         // if filename has changed check if such a file does not already exists is so add a number behind till its a new file
         if ($this->file != $filename) {
             $newfilename = $filename;
             $i = 0;
             while (is_file($newfilename)) {
                 $newfilename = getfile($filename) . "-{$i}." . getext($filename);
                 $i++;
             }
             $filename = $newfilename;
         }
         return $filename;
     } else {
         return OP_CONTENT_NOT_IN_CAT;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phreakpic,代码行数:38,代码来源:album_content.inc.php

示例15: checktype

function checktype($filename)
{
    global $user;
    $ftype = getext($filename);
    if ($user["limit"]["{$ftype}"] && !$user["only"]) {
        exitme("notice(lang.cannot_types)", "eval");
    } else {
        if (!$user["limit"]["{$ftype}"] && $user["only"]) {
            exitme("notice(lang.only_types);", "eval");
        }
    }
}
开发者ID:TopGrd,项目名称:newxb,代码行数:12,代码来源:do.php


注:本文中的getext函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。