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


PHP dol_is_file函数代码示例

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


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

示例1: liste_photos

 /**
  *    Return tableau de toutes les photos de la categorie
  *
  *    @param      string	$dir        Repertoire a scanner
  *    @param      int		$nbmax      Nombre maximum de photos (0=pas de max)
  *    @return     array       			Tableau de photos
  */
 function liste_photos($dir, $nbmax = 0)
 {
     include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
     $nbphoto = 0;
     $tabobj = array();
     $dirthumb = $dir . 'thumbs/';
     if (file_exists($dir)) {
         $handle = opendir($dir);
         if (is_resource($handle)) {
             while (($file = readdir($handle)) != false) {
                 if (dol_is_file($dir . $file) && preg_match('/(\\.jpg|\\.bmp|\\.gif|\\.png|\\.tiff)$/i', $dir . $file)) {
                     $nbphoto++;
                     $photo = $file;
                     // On determine nom du fichier vignette
                     $photo_vignette = '';
                     if (preg_match('/(\\.jpg|\\.bmp|\\.gif|\\.png|\\.tiff)$/i', $photo, $regs)) {
                         $photo_vignette = preg_replace('/' . $regs[0] . '/i', '', $photo) . '_small' . $regs[0];
                     }
                     // Objet
                     $obj = array();
                     $obj['photo'] = $photo;
                     if ($photo_vignette && is_file($dirthumb . $photo_vignette)) {
                         $obj['photo_vignette'] = $photo_vignette;
                     } else {
                         $obj['photo_vignette'] = "";
                     }
                     $tabobj[$nbphoto - 1] = $obj;
                     // On continue ou on arrete de boucler
                     if ($nbmax && $nbphoto >= $nbmax) {
                         break;
                     }
                 }
             }
             closedir($handle);
         }
     }
     return $tabobj;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:45,代码来源:categorie.class.php

示例2:

print $langs->trans("DownloadPackageFromWebSite", $fullurl) . '<br>';
print '<b>' . $langs->trans("StepNb", 2) . '</b>: ';
print $langs->trans("UnpackPackageInDolibarrRoot", $dolibarrroot) . '<br>';
print '<b>' . $langs->trans("StepNb", 3) . '</b>: ';
print $langs->trans("RemoveLock", $dolibarrdataroot . '/install.lock') . '<br>';
print '<b>' . $langs->trans("StepNb", 4) . '</b>: ';
$fullurl = '<a href="' . DOL_URL_ROOT . '/install/" target="_blank">' . DOL_URL_ROOT . '/install/</a>';
print $langs->trans("CallUpdatePage", $fullurl) . '<br>';
print '<b>' . $langs->trans("StepNb", 5) . '</b>: ';
print $langs->trans("RestoreLock", $dolibarrdataroot . '/install.lock') . '<br>';
print '<br>';
print '<br>';
// Install external module
$allowonlineinstall = true;
$allowfromweb = 1;
if (dol_is_file($dolibarrdataroot . '/installmodules.lock')) {
    $allowonlineinstall = false;
}
$fullurl = '<a href="' . $urldolibarrmodules . '" target="_blank">' . $urldolibarrmodules . '</a>';
$message = '';
if (!empty($allowonlineinstall)) {
    if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
        $message = info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT . '/custom', DOL_DOCUMENT_ROOT));
        $allowfromweb = -1;
    } else {
        if ($dirins_ok) {
            if (!is_writable(dol_osencode($dirins))) {
                $langs->load("errors");
                $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins));
                $allowfromweb = 0;
            }
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:update.php

示例3: array

             $mesg = $langs->trans("ErrorCanNotCreateDir", $dir);
             $error++;
         }
     }
 }
 $graphfiles = array('propal' => array('modulepart' => 'productstats_proposals', 'file' => $object->id . '/propal12m' . ((string) $type != '' ? '_type' . $type : '') . '_' . $mode . '.png', 'label' => $mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsProposals") : $langs->transnoentitiesnoconv("NumberOfProposals")), 'orders' => array('modulepart' => 'productstats_orders', 'file' => $object->id . '/orders12m' . ((string) $type != '' ? '_type' . $type : '') . '_' . $mode . '.png', 'label' => $mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders") : $langs->transnoentitiesnoconv("NumberOfCustomerOrders")), 'invoices' => array('modulepart' => 'productstats_invoices', 'file' => $object->id . '/invoices12m' . ((string) $type != '' ? '_type' . $type : '') . '_' . $mode . '.png', 'label' => $mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices") : $langs->transnoentitiesnoconv("NumberOfCustomerInvoices")), 'orderssuppliers' => array('modulepart' => 'productstats_orderssuppliers', 'file' => $object->id . '/orderssuppliers12m' . ((string) $type != '' ? '_type' . $type : '') . '_' . $mode . '.png', 'label' => $mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders") : $langs->transnoentitiesnoconv("NumberOfSupplierOrders")), 'invoicessuppliers' => array('modulepart' => 'productstats_invoicessuppliers', 'file' => $object->id . '/invoicessuppliers12m' . ((string) $type != '' ? '_type' . $type : '') . '_' . $mode . '.png', 'label' => $mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices") : $langs->transnoentitiesnoconv("NumberOfSupplierInvoices")));
 $px = new DolGraph();
 if (!$error) {
     $mesg = $px->isGraphKo();
     if (!$mesg) {
         foreach ($graphfiles as $key => $val) {
             if (!$graphfiles[$key]['file']) {
                 continue;
             }
             $graph_data = array();
             if (dol_is_file($dir . '/' . $graphfiles[$key]['file'])) {
                 // TODO Load cachefile $graphfiles[$key]['file']
             } else {
                 if ($key == 'propal') {
                     $graph_data = $object->get_nb_propal($socid, $mode, (string) $type != '' ? $type : -1);
                 }
                 if ($key == 'orders') {
                     $graph_data = $object->get_nb_order($socid, $mode, (string) $type != '' ? $type : -1);
                 }
                 if ($key == 'invoices') {
                     $graph_data = $object->get_nb_vente($socid, $mode, (string) $type != '' ? $type : -1);
                 }
                 if ($key == 'invoicessuppliers') {
                     $graph_data = $object->get_nb_achat($socid, $mode, (string) $type != '' ? $type : -1);
                 }
                 if ($key == 'orderssuppliers') {
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:card.php

示例4: is_photo_available

 function is_photo_available($sdir)
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $pdir = get_exdir($this->id, 2) . $this->id . "/photos/";
     $dir = $sdir . '/' . $pdir;
     $nbphoto = 0;
     $dir_osencoded = dol_osencode($dir);
     if (file_exists($dir_osencoded)) {
         $handle = opendir($dir_osencoded);
         if (is_resource($handle)) {
             while (($file = readdir($handle)) != false) {
                 if (!utf8_check($file)) {
                     $file = utf8_encode($file);
                 }
                 // To be sure data is stored in UTF8 in memory
                 if (dol_is_file($dir . $file)) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:abbenbouchta,项目名称:immobilier,代码行数:23,代码来源:local.class.php

示例5: clearstatcache

    $classname = "mod".ucfirst($generator);
    $module = new $classname($db);
    if ($module->encodingIsSupported($encoding))
    {
        $result=$module->buildBarCode($code,$encoding,$readable);
    }
}
else					// Open and return file
{
    clearstatcache();

    // Output files on browser
    dol_syslog("viewimage.php return file $original_file content-type=$type");

    // This test is to avoid error images when image is not available (for example thumbs).
    if (! dol_is_file($original_file))
    {
        $original_file=DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg';
        /*$error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed';
        dol_print_error(0,$error);
        print $error;
        exit;*/
    }

    // Les drois sont ok et fichier trouve
    if ($type)
    {
        header('Content-Disposition: inline; filename="'.basename($original_file).'"');
        header('Content-type: '.$type);
    }
    else
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:viewimage.php

示例6: testDolIsFileDir

   /**
    * testDolIsFileDir
    *
    * @return	int
    */
    public function testDolIsFileDir()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$file=dirname(__FILE__).'/Example_import_company_1.csv';

		$result=dol_is_file($file);
    	print __METHOD__." result=".$result."\n";
		$this->assertTrue($result);

		$result=dol_is_dir($file);
    	print __METHOD__." result=".$result."\n";
		$this->assertFalse($result);

		return $result;
    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:25,代码来源:FilesLibTest.php

示例7: rebuild_merge_pdf


//.........这里部分代码省略.........
    dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
    if ($usestdout) {
        print '--- start' . "\n";
    }
    // Start of transaction
    //$db->begin();
    $error = 0;
    $result = 0;
    $files = array();
    // liste les fichiers
    dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
    if ($resql = $db->query($sql)) {
        $num = $db->num_rows($resql);
        $cpt = 0;
        $oldemail = '';
        $message = '';
        $total = '';
        if ($num) {
            // First loop on each resultset to build PDF
            // -----------------------------------------
            while ($cpt < $num) {
                $obj = $db->fetch_object($resql);
                $fac = new Facture($db);
                $result = $fac->fetch($obj->rowid);
                if ($result > 0) {
                    $outputlangs = $langs;
                    if (!empty($newlangid)) {
                        if ($outputlangs->defaultlang != $newlangid) {
                            $outputlangs = new Translate("", $conf);
                            $outputlangs->setDefaultLang($newlangid);
                        }
                    }
                    $filename = $conf->facture->dir_output . '/' . $fac->ref . '/' . $fac->ref . '.pdf';
                    if ($regenerate || !dol_is_file($filename)) {
                        if ($usestdout) {
                            print "Build PDF for invoice " . $obj->facnumber . " - Lang = " . $outputlangs->defaultlang . "\n";
                        }
                        $result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs);
                    } else {
                        if ($usestdout) {
                            print "PDF for invoice " . $obj->facnumber . " already exists\n";
                        }
                    }
                    // Add file into files array
                    $files[] = $filename;
                }
                if ($result <= 0) {
                    $error++;
                    if ($usestdout) {
                        print "Error: Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid) . "\n";
                    } else {
                        dol_syslog("Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid), LOG_ERR);
                    }
                }
                $cpt++;
            }
            // Define format of output PDF
            $formatarray = pdf_getFormat($langs);
            $page_largeur = $formatarray['width'];
            $page_hauteur = $formatarray['height'];
            $format = array($page_largeur, $page_hauteur);
            if ($usestdout) {
                print "Using output PDF format " . join('x', $format) . "\n";
            } else {
                dol_syslog("Using output PDF format " . join('x', $format), LOG_ERR);
            }
开发者ID:Samara94,项目名称:dolibarr,代码行数:67,代码来源:invoice2.lib.php

示例8: ucfirst

             break;
         }
     }
     // Load barcode class for generating barcode image
     $classname = "mod" . ucfirst($generator);
     $module = new $classname($db);
     if ($generator != 'tcpdfbarcode') {
         // May be phpbarcode
         $template = 'standardlabel';
         $is2d = false;
         if ($module->encodingIsSupported($encoding)) {
             $barcodeimage = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
             dol_delete_file($barcodeimage);
             // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
             $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
             if ($result <= 0 || !dol_is_file($barcodeimage)) {
                 $error++;
                 setEventMessages('Failed to generate image file of barcode for code=' . $code . ' encoding=' . $encoding . ' file=' . basename($barcodeimage), null, 'errors');
                 setEventMessages($module->error, null, 'errors');
             }
         } else {
             $error++;
             setEventMessages("Error, encoding " . $encoding . " is not supported by encoder " . $generator . '. You must choose another barcode type or install a barcode generation engine that support ' . $encoding, null, 'errors');
         }
     } else {
         $template = 'tcpdflabel';
         $encoding = $module->getTcpdfEncodingType($encoding);
         //convert to TCPDF compatible encoding types
         $is2d = $module->is2d;
     }
 }
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:printsheet.php

示例9: dol_move

/**
 * Move a file into another name.
 * This function differs from dol_move_uploaded_file, because it can be called in any context.
 *
 * @param	string  $srcfile            Source file (can't be a directory. use native php @rename() to move a directory)
 * @param   string	$destfile           Destination file (can't be a directory. use native php @rename() to move a directory)
 * @param   integer	$newmask            Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK)
 * @param   int		$overwriteifexists  Overwrite file if exists (1 by default)
 * @return  boolean 		            True if OK, false if KO
 */
function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1)
{
    global $conf;
    $result = false;
    dol_syslog("files.lib.php::dol_move srcfile=" . $srcfile . " destfile=" . $destfile . " newmask=" . $newmask . " overwritifexists=" . $overwriteifexists);
    $destexists = dol_is_file($destfile);
    if ($overwriteifexists || !$destexists) {
        $newpathofsrcfile = dol_osencode($srcfile);
        $newpathofdestfile = dol_osencode($destfile);
        $result = @rename($newpathofsrcfile, $newpathofdestfile);
        // To see errors, remove @
        if (!$result) {
            if ($destexists) {
                dol_syslog("files.lib.php::dol_move failed. We try to delete first and move after.", LOG_WARNING);
                // We force delete and try again. Rename function sometimes fails to replace dest file with some windows NTFS partitions.
                dol_delete_file($destfile);
                $result = @rename($newpathofsrcfile, $newpathofdestfile);
                // To see errors, remove @
            } else {
                dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
            }
        }
        if (empty($newmask)) {
            $newmask = empty($conf->global->MAIN_UMASK) ? '0755' : $conf->global->MAIN_UMASK;
        }
        $newmaskdec = octdec($newmask);
        // Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too)
        // to allow mask usage for dir, we shoul introduce a new param "isdir" to 1 to complete newmask like this
        // if ($isdir) $newmaskdec |= octdec('0111');  // Set x bit required for directories
        @chmod($newpathofdestfile, $newmaskdec);
    }
    return $result;
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:43,代码来源:files.lib.php

示例10: commonGenerateDocument

 /**
  * Common function for all objects extending CommonObject for generating documents
  *
  * @param 	string 		$modelspath 	Relative folder where generators are placed
  * @param 	string 		$modele 		Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example.
  * @param 	Translate 	$outputlangs 	Language to use
  * @param 	int 		$hidedetails 	1 to hide details. 0 by default
  * @param 	int 		$hidedesc 		1 to hide product description. 0 by default
  * @param 	int 		$hideref 		1 to hide product reference. 0 by default
  * @return 	int 						>0 if OK, <0 if KO
  */
 protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref)
 {
     global $conf, $langs;
     $srctemplatepath = '';
     // Increase limit for PDF build
     $err = error_reporting();
     error_reporting(0);
     @set_time_limit(120);
     error_reporting($err);
     // If selected model is a filename template (then $modele="modelname" or "modelname:filename")
     $tmp = explode(':', $modele, 2);
     if (!empty($tmp[1])) {
         $modele = $tmp[0];
         $srctemplatepath = $tmp[1];
     }
     // Search template files
     $file = '';
     $classname = '';
     $filefound = 0;
     $dirmodels = array('/');
     if (is_array($conf->modules_parts['models'])) {
         $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
     }
     foreach ($dirmodels as $reldir) {
         foreach (array('doc', 'pdf') as $prefix) {
             $file = $prefix . "_" . $modele . ".modules.php";
             // On verifie l'emplacement du modele
             $file = dol_buildpath($reldir . $modelspath . $file, 0);
             if (file_exists($file)) {
                 $filefound = 1;
                 $classname = $prefix . '_' . $modele;
                 break;
             }
         }
         if ($filefound) {
             break;
         }
     }
     // If generator was found
     if ($filefound) {
         require_once $file;
         $obj = new $classname($this->db);
         // If generator is ODT, we must have srctemplatepath defined, if not we set it.
         if ($obj->type == 'odt' && empty($srctemplatepath)) {
             $varfortemplatedir = $obj->scandir;
             if ($varfortemplatedir && !empty($conf->global->{$varfortemplatedir})) {
                 $dirtoscan = $conf->global->{$varfortemplatedir};
                 $listoffiles = array();
                 // Now we add first model found in directories scanned
                 $listofdir = explode(',', $dirtoscan);
                 foreach ($listofdir as $key => $tmpdir) {
                     $tmpdir = trim($tmpdir);
                     $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
                     if (!$tmpdir) {
                         unset($listofdir[$key]);
                         continue;
                     }
                     if (is_dir($tmpdir)) {
                         $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\\.od(s|t)$', '', 'name', SORT_ASC, 0);
                         if (count($tmpfiles)) {
                             $listoffiles = array_merge($listoffiles, $tmpfiles);
                         }
                     }
                 }
                 if (count($listoffiles)) {
                     foreach ($listoffiles as $record) {
                         $srctemplatepath = $record['fullname'];
                         break;
                     }
                 }
             }
             if (empty($srctemplatepath)) {
                 $this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
                 return -1;
             }
         }
         if ($obj->type == 'odt' && !empty($srctemplatepath)) {
             if (!dol_is_file($srctemplatepath)) {
                 $this->error = 'ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
                 return -1;
             }
         }
         // We save charset_output to restore it because write_file can change it if needed for
         // output format that does not support UTF8.
         $sav_charset_output = $outputlangs->charset_output;
         if ($obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) {
             $outputlangs->charset_output = $sav_charset_output;
             // We delete old preview
             require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:commonobject.class.php

示例11: dol_move

/**
 * Move a file into another name
 * @param   $srcfile            Source file (can't be a directory)
 * @param   $destfile           Destination file (can't be a directory)
 * @param   $newmask            Mask for new file (0 by default means $conf->global->MAIN_UMASK)
 * @param   $overwriteifexists  Overwrite file if exists (1 by default)
 * @return  boolean             True if OK, false if KO
 */
function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
{
    global $conf;
    $result=false;

    dol_syslog("files.lib.php::dol_move srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwritifexists=".$overwriteifexists);
    if ($overwriteifexists || ! dol_is_file($destfile))
    {
        $newpathofsrcfile=dol_osencode($srcfile);
        $newpathofdestfile=dol_osencode($destfile);

        $result=@rename($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
        if (! $result) dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
        if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
        @chmod($newpathofsrcfile, octdec($newmask));
    }

    return $result;
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:27,代码来源:files.lib.php

示例12: dol_move

/**
 * Move a file into another name.
 * This function differs from dol_move_uploaded_file, because it can be called in any context.
 *
 * @param	string  $srcfile            Source file (can't be a directory)
 * @param   string	$destfile           Destination file (can't be a directory)
 * @param   string	$newmask            Mask for new file (0 by default means $conf->global->MAIN_UMASK)
 * @param   int		$overwriteifexists  Overwrite file if exists (1 by default)
 * @return  boolean 		            True if OK, false if KO
 */
function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1)
{
    global $conf;
    $result = false;
    dol_syslog("files.lib.php::dol_move srcfile=" . $srcfile . " destfile=" . $destfile . " newmask=" . $newmask . " overwritifexists=" . $overwriteifexists);
    $destexists = dol_is_file($destfile);
    if ($overwriteifexists || !$destexists) {
        $newpathofsrcfile = dol_osencode($srcfile);
        $newpathofdestfile = dol_osencode($destfile);
        $result = @rename($newpathofsrcfile, $newpathofdestfile);
        // To see errors, remove @
        if (!$result) {
            if ($destexists) {
                dol_syslog("files.lib.php::dol_move failed. We try to delete first and move after.", LOG_WARNING);
                // We force delete and try again. Rename function sometimes fails to replace dest file with some windows NTFS partitions.
                dol_delete_file($destfile);
                $result = @rename($newpathofsrcfile, $newpathofdestfile);
                // To see errors, remove @
            } else {
                dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
            }
        }
        if (empty($newmask) && !empty($conf->global->MAIN_UMASK)) {
            $newmask = $conf->global->MAIN_UMASK;
        }
        @chmod($newpathofsrcfile, octdec($newmask));
    }
    return $result;
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:39,代码来源:files.lib.php

示例13: clearstatcache

    $module = new $classname($db);
    if ($module->encodingIsSupported($encoding))
    {
        $result=$module->buildBarCode($code,$encoding,$readable);
    }
}
else					// Open and return file
{
    clearstatcache();

    // Output files on browser
    dol_syslog("viewimage.php return file $original_file content-type=$type");
    $original_file_osencoded=dol_osencode($original_file);

    // This test if file exists should be useless. We keep it to find bug more easily
	if (! dol_is_file($original_file_osencoded))
    {
        $error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed';
        dol_print_error(0,$error);
        print $error;
        exit;
    }

    // Les drois sont ok et fichier trouve
    if ($type)
    {
        header('Content-Disposition: inline; filename="'.basename($original_file).'"');
        header('Content-type: '.$type);
    }
    else
    {
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:viewimage.php

示例14: liste_photos

 /**
  *  Retourne tableau de toutes les photos du produit
  *
  *  @param      string		$dir        Repertoire a scanner
  *  @param      int			$nbmax      Nombre maximum de photos (0=pas de max)
  *  @return     array       			Tableau de photos
  */
 function liste_photos($dir, $nbmax = 0)
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $nbphoto = 0;
     $tabobj = array();
     $dir_osencoded = dol_osencode($dir);
     $handle = @opendir($dir_osencoded);
     if (is_resource($handle)) {
         while (($file = readdir($handle)) != false) {
             if (!utf8_check($file)) {
                 $file = utf8_encode($file);
             }
             // readdir returns ISO
             if (dol_is_file($dir . $file) && preg_match('/(' . $this->regeximgext . ')$/i', $dir . $file)) {
                 $nbphoto++;
                 // On determine nom du fichier vignette
                 $photo = $file;
                 $photo_vignette = '';
                 if (preg_match('/(' . $this->regeximgext . ')$/i', $photo, $regs)) {
                     $photo_vignette = preg_replace('/' . $regs[0] . '/i', '', $photo) . '_small' . $regs[0];
                 }
                 $dirthumb = $dir . 'thumbs/';
                 // Objet
                 $obj = array();
                 $obj['photo'] = $photo;
                 if ($photo_vignette && dol_is_file($dirthumb . $photo_vignette)) {
                     $obj['photo_vignette'] = 'thumbs/' . $photo_vignette;
                 } else {
                     $obj['photo_vignette'] = "";
                 }
                 $tabobj[$nbphoto - 1] = $obj;
                 // On continue ou on arrete de boucler ?
                 if ($nbmax && $nbphoto >= $nbmax) {
                     break;
                 }
             }
         }
         closedir($handle);
     }
     return $tabobj;
 }
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:48,代码来源:product.class.php

示例15: foreach

 foreach ($listofobjectref[$thirdpartyid] as $objectid => $object) {
     //var_dump($object);
     //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
     if ($object->statut != Facture::STATUS_VALIDATED) {
         $nbignored++;
         continue;
         // Payment done or started or canceled
     }
     // Read document
     // TODO Use future field $object->fullpathdoc to know where is stored default file
     // TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
     $filename = dol_sanitizeFileName($object->ref) . '.pdf';
     $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
     $file = $filedir . '/' . $filename;
     $mime = dol_mimetype($file);
     if (dol_is_file($file)) {
         if (empty($sendto)) {
             $object->fetch_thirdparty();
             $sendto = $object->thirdparty->email;
         }
         if (empty($sendto)) {
             //print "No recipient for thirdparty ".$object->thirdparty->name;
             $nbignored++;
             continue;
         }
         if (dol_strlen($sendto)) {
             // Create form object
             $attachedfiles = array('paths' => array_merge($attachedfiles['paths'], array($file)), 'names' => array_merge($attachedfiles['names'], array($filename)), 'mimes' => array_merge($attachedfiles['mimes'], array($mime)));
         }
         $listofqualifiedinvoice[$objectid] = $object;
         $listofqualifiedref[$objectid] = $object->ref;
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:list.php


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