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


PHP dol_is_dir函数代码示例

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


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

示例1: dol_syslog

                    //var_dump($sqltree);
                    $adirwascreated = 1;
                } else {
                    dol_syslog("Failed to create directory " . $ecmdirtmp->label, LOG_ERR);
                }
            } else {
                $txt = "Parent of " . $dirdesc['fullname'] . " not found";
                dol_syslog($txt);
                //print $txt."<br>\n";
            }
        }
    }
    // Loop now on each sql tree to check if dir exists
    foreach ($sqltree as $dirdesc) {
        $dirtotest = $conf->ecm->dir_output . '/' . $dirdesc['fullrelativename'];
        if (!dol_is_dir($dirtotest)) {
            $ecmdirtmp->id = $dirdesc['id'];
            $ecmdirtmp->delete($user, 'databaseonly');
            //exit;
        }
    }
    $sql = "UPDATE " . MAIN_DB_PREFIX . "ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0";
    // If pb into cahce counting, we set to value -1 = "unknown"
    dol_syslog("sql = " . $sql);
    $db->query($sql);
    // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
    // it to be sure that fulltree array is not used without reloading it.
    if ($adirwascreated) {
        $sqltree = null;
    }
}
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:index_auto.php

示例2: header

/*
 * Action
 */
// None
/*
 * View
 */
if (!isset($mode) || $mode != 'noajax') {
    // Ajout directives pour resoudre bug IE
    header('Cache-Control: Public, must-revalidate');
    header('Pragma: public');
    top_httphead();
}
$type = 'directory';
// This test if file exists should be useless. We keep it to find bug more easily
if (!dol_is_dir($upload_dir)) {
    //	dol_mkdir($upload_dir);
    /*    $langs->load("install");
        dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir));
        exit;*/
}
print '<!-- TYPE=' . $type . ' -->' . "\n";
print '<!-- Page called with mode=' . $mode . ' url=' . $_SERVER["PHP_SELF"] . '?' . $_SERVER["QUERY_STRING"] . ' -->' . "\n";
$param = '';
$param .= ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '');
$url = DOL_URL_ROOT . '/ecm/index.php';
// Dir scan
if ($type == 'directory') {
    $formfile = new FormFile($db);
    $maxlengthname = 40;
    // Right area. If module is defined, we are in automatic ecm.
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:ajaxdirpreview.php

示例3: migrate_product_photospath

/**
 * Migrate file from old path to new one for product $product
 *
 * @param 	Product	$product 	Object product
 * @return	void
 */
function migrate_product_photospath($product)
{
    global $conf;
    $dir = $conf->product->multidir_output[$product->entity];
    $origin = $dir . '/' . get_exdir($product->id, 2) . $product->id . "/photos";
    $destin = $dir . '/' . dol_sanitizeFileName($product->ref);
    $error = 0;
    $origin_osencoded = dol_osencode($origin);
    $destin_osencoded = dol_osencode($destin);
    dol_mkdir($destin);
    if (dol_is_dir($origin)) {
        $handle = opendir($origin_osencoded);
        if (is_resource($handle)) {
            while (($file = readdir($handle)) != false) {
                if ($file != '.' && $file != '..' && is_dir($origin_osencoded . '/' . $file)) {
                    $thumbs = opendir($origin_osencoded . '/' . $file);
                    if (is_resource($thumbs)) {
                        dol_mkdir($destin . '/' . $file);
                        while (($thumb = readdir($thumbs)) != false) {
                            dol_move($origin . '/' . $file . '/' . $thumb, $destin . '/' . $file . '/' . $thumb);
                        }
                        //		    			dol_delete_dir($origin.'/'.$file);
                    }
                } else {
                    if (dol_is_file($origin . '/' . $file)) {
                        dol_move($origin . '/' . $file, $destin . '/' . $file);
                    }
                }
            }
        }
    }
}
开发者ID:Albertopf,项目名称:prueba,代码行数:38,代码来源:migrate_picture_path.php

示例4: setEventMessage

        } else {
            $error++;
        }
    }
    if (!$error) {
        setEventMessage($langs->trans("SetupIsReadyForUse"));
    }
}
/*
 * View
 */
// Set dir where external modules are installed
if (!dol_is_dir($dirins)) {
    dol_mkdir($dirins);
}
$dirins_ok = dol_is_dir($dirins);
$wikihelp = 'EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
llxHeader('', $langs->trans("Upgrade"), $wikihelp);
print_fiche_titre($langs->trans("Upgrade"), '', 'title_setup');
print $langs->trans("CurrentVersion") . ' : <b>' . DOL_VERSION . '</b><br>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl) {
    $title = $sfurl->channel[0]->item[0]->title;
    function word_limiter($text, $limit = 30, $chars = '0123456789.')
    {
        if (strlen($text) > $limit) {
            $words = str_word_count($text, 2, $chars);
            $words = array_reverse($words, TRUE);
            foreach ($words as $length => $word) {
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:update.php

示例5: parser

 /**
  * 	Parse rss URL
  *
  * 	@param	string	$urlRSS		Url to parse
  * 	@param	int		$maxNb		Max nb of records to get (0 for no limit)
  * 	@param	int		$cachedelay	0=No cache, nb of seconds we accept cache files (cachedir must also be defined)
  * 	@param	string	$cachedir	Directory where to save cache file
  *	@return	int					<0 if KO, >0 if OK
  */
 public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
 {
     global $conf;
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $rss = '';
     $str = '';
     // This will contain content of feed
     // Check parameters
     if (!dol_is_url($urlRSS)) {
         $this->error = "ErrorBadUrl";
         return -1;
     }
     $this->_urlRSS = $urlRSS;
     $newpathofdestfile = $cachedir . '/' . dol_hash($this->_urlRSS, 3);
     // Force md5 hash (does not contains special chars)
     $newmask = '0644';
     //dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile);
     $nowgmt = dol_now();
     // Search into cache
     $foundintocache = 0;
     if ($cachedelay > 0 && $cachedir) {
         $filedate = dol_filemtime($newpathofdestfile);
         if ($filedate >= $nowgmt - $cachedelay) {
             //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it.");
             $foundintocache = 1;
             $this->_lastfetchdate = $filedate;
         } else {
             dol_syslog(get_class($this) . "::parser cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it.");
         }
     }
     // Load file into $str
     if ($foundintocache) {
         $str = file_get_contents($newpathofdestfile);
     } else {
         try {
             ini_set("user_agent", "Dolibarr ERP-CRM RSS reader");
             ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
             ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
             $opts = array('http' => array('method' => "GET"));
             if (!empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)) {
                 $opts['http']['timeout'] = $conf->global->MAIN_USE_CONNECT_TIMEOUT;
             }
             if (!empty($conf->global->MAIN_PROXY_USE)) {
                 $opts['http']['proxy'] = 'tcp://' . $conf->global->MAIN_PROXY_HOST . ':' . $conf->global->MAIN_PROXY_PORT;
             }
             //var_dump($opts);exit;
             $context = stream_context_create($opts);
             $str = file_get_contents($this->_urlRSS, false, $context);
         } catch (Exception $e) {
             print 'Error retrieving URL ' . $this->urlRSS . ' - ' . $e->getMessage();
         }
     }
     if ($str !== false) {
         // Convert $str into xml
         if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
             //print 'xx'.LIBXML_NOCDATA;
             libxml_use_internal_errors(false);
             $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
         } else {
             $xmlparser = xml_parser_create('');
             if (!is_resource($xmlparser)) {
                 $this->error = "ErrorFailedToCreateParser";
                 return -1;
             }
             xml_set_object($xmlparser, $this);
             xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
             xml_set_character_data_handler($xmlparser, 'feed_cdata');
             $status = xml_parse($xmlparser, $str);
             xml_parser_free($xmlparser);
             $rss = $this;
             //var_dump($rss->_format);exit;
         }
     }
     // If $rss loaded
     if ($rss) {
         // Save file into cache
         if (empty($foundintocache) && $cachedir) {
             dol_syslog(get_class($this) . "::parser cache file " . $newpathofdestfile . " is saved onto disk.");
             if (!dol_is_dir($cachedir)) {
                 dol_mkdir($cachedir);
             }
             $fp = fopen($newpathofdestfile, 'w');
             fwrite($fp, $str);
             fclose($fp);
             if (!empty($conf->global->MAIN_UMASK)) {
                 $newmask = $conf->global->MAIN_UMASK;
             }
             @chmod($newpathofdestfile, octdec($newmask));
             $this->_lastfetchdate = $nowgmt;
         }
         unset($str);
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:rssparser.class.php

示例6: tree_showpad

         $resarray = tree_showpad($sqltree, $key, 1);
         // Refresh cache for this subdir
         if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) {
             $result = $ecmdirstatic->fetch($val['id']);
             $ecmdirstatic->ref = $ecmdirstatic->label;
             $result = $ecmdirstatic->refreshcachenboffile(0);
             $val['cachenbofdoc'] = $result;
         }
         $a = $resarray[0];
         $nbofsubdir = $resarray[1];
         $nboffilesinsubdir = $resarray[2];
         break;
     }
 }
 //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
 if ($file != '.' && $file != '..' && (!empty($val['fullrelativename']) && $val['id'] >= 0 || dol_is_dir($fullpathselecteddir . (preg_match('/\\/$/', $fullpathselecteddir) ? '' : '/') . $file))) {
     if (empty($val['fullrelativename'])) {
         $val['fullrelativename'] = $file;
         $val['id'] = 0;
         $val['label'] = $file;
         $val['description'] = '';
         $nboffilesinsubdir = $langs->trans("Unknown");
     }
     print '<li class="directory collapsed">';
     print "<a class=\"fmdirlia jqft ecmjqft\" href=\"#\" rel=\"" . dol_escape_htmltag($val['fullrelativename'] . '/') . "\" id=\"fmdirlia_id_" . $val['id'] . "\"";
     print " onClick=\"loadandshowpreview('" . dol_escape_js($val['fullrelativename']) . "'," . $val['id'] . ")\">";
     print dol_escape_htmltag($file);
     print "</a>";
     print '<div class="ecmjqft">';
     print '<table class="nobordernopadding"><tr>';
     /*print '<td align="left">';
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:ajaxdirtree.php

示例7: getTransformRateByMonthWithPrevYear

	/**
	 * Return amount of elements by month for several years
	 *
	 * @param int $endyear		End year
	 * @param int $startyear	Start year
	 * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save)
	 * @return array of values
	 */
	function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0)
	{
		global $conf, $user, $langs;

		if ($startyear > $endyear) return - 1;

		$datay = array();

		// Search into cache
		if (! empty($cachedelay))
		{
			include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
			include_once DOL_DOCUMENT_ROOT . '/core/lib/json.lib.php';
		}

		$newpathofdestfile = $conf->user->dir_temp . '/' . get_class($this) . '_' . __FUNCTION__ . '_' . (empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix . '_') . $langs->defaultlang . '_user' . $user->id . '.cache';
		$newmask = '0644';

		$nowgmt = dol_now();

		$foundintocache = 0;
		if ($cachedelay > 0) {
			$filedate = dol_filemtime($newpathofdestfile);
			if ($filedate >= ($nowgmt - $cachedelay)) {
				$foundintocache = 1;

				$this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate;
			} else {
				dol_syslog(get_class($this) . '::' . __FUNCTION__ . " cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it.");
			}
		}

		// Load file into $data
		if ($foundintocache) // Cache file found and is not too old
		{
			dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . ".");
			$data = json_decode(file_get_contents($newpathofdestfile), true);
		} else {
			$year = $startyear;
			while ( $year <= $endyear ) {
				$datay[$year] = $this->getTransformRateByMonth($year);
				$year ++;
			}

			$data = array ();
			// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
			for($i = 0; $i < 12; $i ++) {
				$data[$i][] = $datay[$endyear][$i][0]; // set label
				$year = $startyear;
				while ( $year <= $endyear ) {
					$data[$i][] = $datay[$year][$i][1]; // set yval for x=i
					$year ++;
				}
			}
		}

		// Save cache file
		if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == - 1)) {
			dol_syslog(get_class($this) . '::' . __FUNCTION__ . " save cache file " . $newpathofdestfile . " onto disk.");
			if (! dol_is_dir($conf->user->dir_temp))
				dol_mkdir($conf->user->dir_temp);
			$fp = fopen($newpathofdestfile, 'w');
			fwrite($fp, json_encode($data));
			fclose($fp);
			if (! empty($conf->global->MAIN_UMASK))
				$newmask = $conf->global->MAIN_UMASK;
			@chmod($newpathofdestfile, octdec($newmask));

			$this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt;
		}

		return $data;
	}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:81,代码来源:projectstats.class.php

示例8: dol_filecache

/**
 * Store object in file
 *
 * @param string $directory Directory of cache
 * @param string $filename Name of filecache
 * @param mixed $object Object to store in cachefile
 * @return void
 */
function dol_filecache($directory, $filename, $object)
{
    if (!dol_is_dir($directory)) {
        dol_mkdir($directory);
    }
    $cachefile = $directory . $filename;
    file_put_contents($cachefile, serialize($object), LOCK_EX);
    @chmod($cachefile, 0644);
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:17,代码来源:files.lib.php

示例9: delete


//.........这里部分代码省略.........

            // Update link in member table
            if (! $error)
            {
                $sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
                $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
                if (! $this->db->query($sql))
                {
                    $error++;
                    $this->error .= $this->db->lasterror();
                    dol_syslog(get_class($this)."::delete erreur -1 ".$this->error, LOG_ERR);
                }
            }

            // Remove ban
            if (! $error)
            {
                $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib";
                $sql.= " WHERE fk_soc = " . $id;
                if (! $this->db->query($sql))
                {
                    $error++;
                    $this->error = $this->db->lasterror();
                }
            }

		    // Remove societe_remise_except
            if (! $error)
            {
                $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except";
                $sql.= " WHERE fk_soc = " . $id;
                if (! $this->db->query($sql))
                {
                    $error++;
                    $this->error = $this->db->lasterror();
                }
            }

            // Remove associated users
            if (! $error)
            {
                $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux";
                $sql.= " WHERE fk_soc = " . $id;
                if (! $this->db->query($sql))
                {
                    $error++;
                    $this->error = $this->db->lasterror();
                }
            }

            // Removed extrafields
            if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
            {
            	$result=$this->deleteExtraFields();
            	if ($result < 0)
            	{
            		$error++;
            		dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
            	}
            }

            // Remove third party
            if (! $error)
            {
                $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe";
                $sql.= " WHERE rowid = " . $id;
                dol_syslog(get_class($this)."::delete", LOG_DEBUG);
                if (! $this->db->query($sql))
                {
                    $error++;
                    $this->error = $this->db->lasterror();
                }
            }

            if (! $error)
            {
                $this->db->commit();

                // Delete directory
                if (! empty($conf->societe->multidir_output[$entity]))
                {
                	$docdir = $conf->societe->multidir_output[$entity] . "/" . $id;
                	if (dol_is_dir($docdir))
                	{
                    	dol_delete_dir_recursive($docdir);
                	}
                }

                return 1;
            }
            else
			{
				dol_syslog($this->error, LOG_ERR);
                $this->db->rollback();
                return -1;
            }
        }
		else dol_syslog("Can't remove thirdparty with id ".$id.". There is ".$objectisused." childs", LOG_WARNING);
        return 0;
    }
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:101,代码来源:societe.class.php

示例10: complete_substitutions_array

/**
 *  Complete the $substitutionarray with more entries
 *
 *  @param  array		$substitutionarray		Array substitution old value => new value value
 *  @param  Translate	$outputlangs            If we want substitution from special constants, we provide a language
 *  @param  object		$object                 If we want substitution from special constants, we provide data in a source object
 *  @param  Mixed		$parameters       		Add more parameters (useful to pass product lines)
 *  @param  string      $callfunc               What is the name of the custom function that will be called? (default: completesubstitutionarray)
 *  @return	void
 *  @see 	make_substitutions
 */
function complete_substitutions_array(&$substitutionarray, $outputlangs, $object = '', $parameters = null, $callfunc = "completesubstitutionarray")
{
    global $conf, $user;
    require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
    // Check if there is external substitution to do asked by plugins
    $dirsubstitutions = array_merge(array(), (array) $conf->modules_parts['substitutions']);
    foreach ($dirsubstitutions as $reldir) {
        $dir = dol_buildpath($reldir, 0);
        // Check if directory exists
        if (!dol_is_dir($dir)) {
            continue;
        }
        $substitfiles = dol_dir_list($dir, 'files', 0, 'functions_');
        foreach ($substitfiles as $substitfile) {
            if (preg_match('/functions_(.*)\\.lib\\.php/i', $substitfile['name'], $reg)) {
                $module = $reg[1];
                dol_syslog("Library functions_" . $substitfile['name'] . " found into " . $dir);
                // Include the user's functions file
                require_once $dir . $substitfile['name'];
                // Call the user's function, and only if it is defined
                $function_name = $module . "_" . $callfunc;
                if (function_exists($function_name)) {
                    $function_name($substitutionarray, $outputlangs, $object, $parameters);
                }
            }
        }
    }
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:39,代码来源:functions.lib.php

示例11: dol_delete_dir_recursive

/**
 *  Remove a directory $dir and its subdirectories
 *  @param      dir             Dir to delete
 *  @param      count           Counter to count nb of deleted elements
 *  @param      nophperrors     Disable all PHP output errors
 *  @return     int             Number of files and directory removed
 */
function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0)
{
    dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG);
    if (dol_is_dir($dir))
    {
        $dir_osencoded=dol_osencode($dir);
        if ($handle = opendir("$dir_osencoded"))
        {
            while (false !== ($item = readdir($handle)))
            {
                if (! utf8_check($item)) $item=utf8_encode($item);  // should be useless

                if ($item != "." && $item != "..")
                {
                    if (is_dir(dol_osencode("$dir/$item")))
                    {
                        $count=dol_delete_dir_recursive("$dir/$item",$count,$nophperrors);
                    }
                    else
                    {
                        dol_delete_file("$dir/$item",1,$nophperrors);
                        $count++;
                        //echo " removing $dir/$item<br>\n";
                    }
                }
            }
            closedir($handle);
            dol_delete_dir($dir,$nophperrors);
            $count++;
            //echo "removing $dir<br>\n";
        }
    }

    //echo "return=".$count;
    return $count;
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:43,代码来源:files.lib.php

示例12: array

 $nboffilesinsubdir = 0;
 // Try to find key into $sqltree
 $val = array();
 foreach ($sqltree as $key => $tmpval) {
     //print "-- ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'<br>';
     if ($tmpval['fullrelativename'] == ($selecteddir != '/' ? $selecteddir . '/' : '') . $file) {
         $val = $tmpval;
         $resarray = tree_showpad($sqltree, $key, 1);
         $a = $resarray[0];
         $nbofsubdir = $resarray[1];
         $nboffilesinsubdir = $resarray[2];
         break;
     }
 }
 //if (file_exists($fullpathselecteddir . $file) && $file != '.' && $file != '..' && is_dir($fullpathselecteddir . $file))
 if ($file != '.' && $file != '..' && (!empty($val['fullrelativename']) && $val['id'] >= 0 || dol_is_dir($fullpathselecteddir . $file))) {
     print '<li class="directory collapsed">';
     print "<a class=\"fmdirlia jqft ecmjqft\" href=\"#\" rel=\"" . dol_escape_htmltag($val['fullrelativename'] . '/') . "\" id=\"fmdirlia_id_" . $val['id'] . "\"";
     print " onClick=\"loadandshowpreview('" . dol_escape_js($val['fullrelativename']) . "'," . $val['id'] . ")\">";
     print dol_escape_htmltag($file);
     print "</a>";
     print '<div class="ecmjqft">';
     print '<table class="nobordernopadding"><tr>';
     /*print '<td align="left">';
     		print dol_escape_htmltag($file);
     		print '</td>';*/
     // Nb of docs
     print '<td align="right">';
     print isset($val['cachenbofdoc']) ? $val['cachenbofdoc'] : '&nbsp;';
     print '</td>';
     print '<td align="left">';
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:ajaxdirtree.php

示例13: getAllByProductEntry

 /**
  * Return count, and sum of products
  *
  * @param	int		$year			Year
  * @param	int		$cachedelay		Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
  * @return 	array					Array of values
  */
 function getAllByProductEntry($year, $cachedelay = 0)
 {
     global $conf, $user, $langs;
     $datay = array();
     // Search into cache
     if (!empty($cachedelay)) {
         include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
         include_once DOL_DOCUMENT_ROOT . '/core/lib/json.lib.php';
     }
     $newpathofdestfile = $conf->user->dir_temp . '/' . get_class($this) . '_' . __FUNCTION__ . '_' . (empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix . '_') . $langs->defaultlang . '_user' . $user->id . '.cache';
     $newmask = '0644';
     $nowgmt = dol_now();
     $foundintocache = 0;
     if ($cachedelay > 0) {
         $filedate = dol_filemtime($newpathofdestfile);
         if ($filedate >= $nowgmt - $cachedelay) {
             $foundintocache = 1;
             $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate;
         } else {
             dol_syslog(get_class($this) . '::' . __FUNCTION__ . " cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it.");
         }
     }
     // Load file into $data
     if ($foundintocache) {
         dol_syslog(get_class($this) . '::' . __FUNCTION__ . " read data from cache file " . $newpathofdestfile . " " . $filedate . ".");
         $data = json_decode(file_get_contents($newpathofdestfile), true);
     } else {
         $data = $this->getAllByProduct($year);
         //					$data[$i][]=$datay[$year][$i][1];	// set yval for x=i
     }
     // Save cache file
     if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1)) {
         dol_syslog(get_class($this) . '::' . __FUNCTION__ . " save cache file " . $newpathofdestfile . " onto disk.");
         if (!dol_is_dir($conf->user->dir_temp)) {
             dol_mkdir($conf->user->dir_temp);
         }
         $fp = fopen($newpathofdestfile, 'w');
         if ($fp) {
             fwrite($fp, json_encode($data));
             fclose($fp);
             if (!empty($conf->global->MAIN_UMASK)) {
                 $newmask = $conf->global->MAIN_UMASK;
             }
             @chmod($newpathofdestfile, octdec($newmask));
         }
         $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt;
     }
     return $data;
 }
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:56,代码来源:stats.class.php

示例14: getLabelFromNumber

 /**
  *      Return full text translated to language label for a key. Store key-label in a cache.
  *      This function need module "numberwords" to be installed. If not it will return
  *      same number (this module is not provided by default as it use non GPL source code).
  *
  *		@param	int		$number		Number to encode in full text
  * 		@param	int		$isamount	1=It's an amount, 0=it's just a number
  *      @return string				Label translated in UTF8 (but without entities)
  * 									10 if setDefaultLang was en_US => ten
  * 									123 if setDefaultLang was fr_FR => cent vingt trois
  */
 function getLabelFromNumber($number, $isamount = 0)
 {
     global $conf;
     $newnumber = $number;
     $dirsubstitutions = array_merge(array(), $conf->modules_parts['substitutions']);
     foreach ($dirsubstitutions as $reldir) {
         $dir = dol_buildpath($reldir, 0);
         $newdir = dol_osencode($dir);
         // Check if directory exists
         if (!dol_is_dir($dir)) {
             continue;
         }
         $fonc = 'numberwords';
         if (file_exists($newdir . '/functions_' . $fonc . '.lib.php')) {
             include_once $newdir . '/functions_' . $fonc . '.lib.php';
             $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
             break;
         }
     }
     return $newnumber;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:32,代码来源:translate.class.php

示例15: delete


//.........这里部分代码省略.........
         if (!$error) {
             // Appel des triggers
             include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('COMPANY_DELETE', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
             }
             // Fin appel triggers
         }
         if (!$error) {
             require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
             $static_cat = new Categorie($this->db);
             $toute_categs = array();
             // Fill $toute_categs array with an array of (type => array of ("Categorie" instance))
             if ($this->client || $this->prospect) {
                 $toute_categs['societe'] = $static_cat->containing($this->id, 2);
             }
             if ($this->fournisseur) {
                 $toute_categs['fournisseur'] = $static_cat->containing($this->id, 1);
             }
             // Remove each "Categorie"
             foreach ($toute_categs as $type => $categs_type) {
                 foreach ($categs_type as $cat) {
                     $cat->del_type($this, $type);
                 }
             }
         }
         // Remove contacts
         if (!$error) {
             $sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople";
             $sql .= " WHERE fk_soc = " . $id;
             dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
             if (!$this->db->query($sql)) {
                 $error++;
                 $this->error .= $this->db->lasterror();
                 dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
             }
         }
         // Update link in member table
         if (!$error) {
             $sql = "UPDATE " . MAIN_DB_PREFIX . "adherent";
             $sql .= " SET fk_soc = NULL WHERE fk_soc = " . $id;
             dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
             if (!$this->db->query($sql)) {
                 $error++;
                 $this->error .= $this->db->lasterror();
                 dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
             }
         }
         // Remove ban
         if (!$error) {
             $sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe_rib";
             $sql .= " WHERE fk_soc = " . $id;
             dol_syslog(get_class($this) . "::Delete sql=" . $sql, LOG_DEBUG);
             if (!$this->db->query($sql)) {
                 $error++;
                 $this->error = $this->db->lasterror();
                 dol_syslog(get_class($this) . "::delete erreur -2 " . $this->error, LOG_ERR);
             }
         }
         // Removed extrafields
         if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
             $result = $this->deleteExtraFields();
             if ($result < 0) {
                 $error++;
                 dol_syslog(get_class($this) . "::delete error -3 " . $this->error, LOG_ERR);
             }
         }
         // Remove third party
         if (!$error) {
             $sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe";
             $sql .= " WHERE rowid = " . $id;
             dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
             if (!$this->db->query($sql)) {
                 $error++;
                 $this->error = $this->db->lasterror();
                 dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
             }
         }
         if (!$error) {
             $this->db->commit();
             // Delete directory
             if (!empty($conf->societe->multidir_output[$entity])) {
                 $docdir = $conf->societe->multidir_output[$entity] . "/" . $id;
                 if (dol_is_dir($docdir)) {
                     dol_delete_dir_recursive($docdir);
                 }
             }
             return 1;
         } else {
             $this->db->rollback();
             return -1;
         }
     } else {
         dol_syslog("Can't remove thirdparty with id " . $id . ". There is " . $objectisused . " childs", LOG_WARNING);
     }
     return 0;
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:societe.class.php


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