Example #1
0
         dol_syslog("Yes with id " . $parentdirisindatabase);
         //print "Yes with id ".$parentdirisindatabase."<br>\n";
         $fk_parent = $parentdirisindatabase;
         //break;  // We found parent, we can stop the while loop
     } else {
         dol_syslog("No");
         //print "No<br>\n";
     }
 } else {
     dol_syslog("Parent is root");
     $fk_parent = 0;
     // Parent is root
 }
 if ($fk_parent >= 0) {
     $ecmdirtmp->ref = 'NOTUSEDYET';
     $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
     $ecmdirtmp->description = '';
     $ecmdirtmp->fk_parent = $fk_parent;
     $txt = "We create directory " . $ecmdirtmp->label . " with parent " . $fk_parent;
     dol_syslog($txt);
     //print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
     $id = $ecmdirtmp->create($user);
     if ($id > 0) {
         $newdirsql = array('id' => $id, 'id_mere' => $ecmdirtmp->fk_parent, 'label' => $ecmdirtmp->label, 'description' => $ecmdirtmp->description, 'fullrelativename' => $relativepathmissing);
         $sqltree[] = $newdirsql;
         // We complete fulltree for following loops
         //var_dump($sqltree);
         $adirwascreated = 1;
     } else {
         dol_syslog("Failed to create directory " . $ecmdirtmp->label, LOG_ERR);
     }
Example #2
0
	/**
     * testDolBasename
     *
     * @return	int
     */
    public function testDolBasename()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

        $result=dol_basename('adir/afile');
    	print __METHOD__." result=".$result."\n";
		$this->assertEquals('afile',$result);

		$result=dol_basename('adir/afile/');
    	print __METHOD__." result=".$result."\n";
		$this->assertEquals('afile',$result);

		$result=dol_basename('adir/νεο');    // With cyrillic data. Here basename fails to return correct value
    	print __METHOD__." result=".$result."\n";
		$this->assertEquals('νεο',$result);

		$result=dol_basename('adir/νεο/');    // With cyrillic data. Here basename fails to return correct value
    	print __METHOD__." result=".$result."\n";
		$this->assertEquals('νεο',$result);
    }