From: vincent@cubedesigners.com Date: Thu, 5 Jul 2012 17:32:28 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=29f6aa0b0982afcf6184a77124b9509ab6fa145f;p=cubeextranet.git --- diff --git a/fluidbook/tools/convertrn.pe b/fluidbook/tools/convertrn.pe new file mode 100644 index 000000000..9a192d89e --- /dev/null +++ b/fluidbook/tools/convertrn.pe @@ -0,0 +1,26 @@ +#!/usr/local/bin/fontforge +Open($1) +Print("Open font ",$1) +if($argc>3) + Print("Change name to ",$3) + SetFontNames($3,$3,$3,'Regular','','1.0') + SetTTFName(0x409,0,"-") + SetTTFName(0x409,1,$3) + SetTTFName(0x409,3,$3) + SetTTFName(0x409,4,$3) + SetTTFName(0x409,5,"1.0") + SetTTFName(0x409,6,$3) + SetTTFName(0x409,7,"-") + SetTTFName(0x409,8,"-") + SetTTFName(0x409,9,"-") + SetTTFName(0x409,10,"-") + SetTTFName(0x409,11,"-") + SetTTFName(0x409,12,"-") + SetTTFName(0x409,13,"-") + SetTTFName(0x409,14,"-") + SetTTFName(0x409,16,$3) + SetTTFName(0x409,17,$3) + SetTTFName(0x409,18,$3) + SetTTFName(0x409,19,"-") +endif +Generate($2) \ No newline at end of file diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 39c54d5a1..b04ed0286 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -195,12 +195,87 @@ class commonTools { return $res; } - public static function makeFavicon() { + public static function webfonts($args) { + global $core; + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res.='
'; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.='
' . __('Générer un kit webfont') . '
' . __('Veuillez charger une police de caractères') . '
' . $core->typo->BoutonOK(__('Générer le kit webfont')) . '
'; + $res.='
'; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + public static function makeWebfont() { $tmp = cubeFiles::tempdir(); - mkdir($tmp, 0777, true); + if (!file_exists($tmp)) { + mkdir($tmp, 0777, true); + } + + $ex = explode('.', strtolower($_FILES['file']['name'])); + $upext = array_pop($ex); + $fontName = implode('.', $ex); + + $fontFile = $tmp . '/' . strtolower($_FILES['file']['name']); + move_uploaded_file($_FILES['file']['tmp_name'], $fontFile); + + $ext = array('ttf', 'woff', 'eot'); + + foreach ($ext as $e) { + $out = $tmp . '/' . $fontName . '.' . $e; + if ($e != 'eot') { + $fontforge = new cubeCommandLine('convertrn.pe'); + $fontforge->setPath(CONVERTER_PATH); + $fontforge->setArg(null, $fontFile); + $fontforge->setArg(null, $out); + $fontforge->setArg(null, $fontName); + $fontforge->execute(); + fb($fontforge->commande); + fb($fontforge->output); + } else { + $ttf = $tmp . '/' . $fontName . '.ttf'; + `/usr/local/bin/ttf2eot < $ttf > $out`; + } + } + + $css = "@font-face { + font-family: '$fontName'; + src: url('$fontName.eot'); + src: url('$fontName.eot?#iefix') format('embedded-opentype'), + url('$fontName.woff') format('woff'), + url('$fontName.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +}"; + file_put_contents($tmp . '/' . $fontName . '.css', $css); + $tmpfile = cubeFiles::tempnam() . '.zip'; + + $zip = new cubeCommandLine('zip'); + $zip->cd($tmp); + $zip->setArg(null, $tmpfile); + $zip->setArg('0'); + $zip->setArg('u'); + $zip->setArg('r'); + $zip->setArg('X'); + $zip->setArg(null, '.'); + $zip->execute(); + + cubeHTTP::downloadFile($tmpfile, $fontName . '.zip'); + } + + public static function makeFavicon() { + $tmp = cubeFiles::tempdir(); + mkdir($tmp, 0777, true); $upload = $_FILES['file']['tmp_name']; diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index f8b40952c..6101a0049 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -656,7 +656,7 @@ class wsMaintenance { global $core; $book_id = $args[0]; $document_id = $args[1]; - $dao=new wsDAOBook($core->con); + $dao = new wsDAOBook($core->con); $dao->appendDocument($book_id, $document_id); } @@ -684,6 +684,57 @@ class wsMaintenance { } } + public static function syncLDAP() { + global $core; + cubePHP::neverStop(); + + $res = '
';
+
+		$ds = ldap_connect('localhost', 10389);
+		ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+		ldap_bind($ds, 'uid=admin,ou=system', '*arica*6');
+
+		$r = $core->con->select('SELECT * FROM utilisateurs_entreprise ORDER BY utilisateur_id');
+		while ($r->fetch()) {
+			if (is_null($r->utilisateur_id)) {
+				continue;
+			}
+			$entree = array();
+			$entree['objectClass'][] = 'top';
+			$entree['objectClass'][] = 'person';
+			$entree['objectClass'][] = 'organizationalPerson';
+			$entree['objectClass'][] = 'extensibleObject';
+			$entree['cn'] = trim($r->prenom . ' ' . $r->nom . ' - ' . $r->rs . ' (' . $r->utilisateur_id . ')', ' -');
+			$entree['sn'] = $r->nom == '' ? $entree['cn'] : $r->nom;
+			$entree['mail'] = $r->email;
+			$entree['uid'] = 'extranet_' . $r->utilisateur_id;
+			$entree['OrganizationalUnitName'] = $r->rs;
+			if ($r->telephone && $r->telephone != '+33') {
+				$entree['telephoneNumber'][] = $r->telephone;
+			}
+			if ($r->mobile && $r->mobile != '+33') {
+				$entree['telephoneNumber'][] = $r->mobile;
+			}
+			if ($r->fax && $r->fax != '+33') {
+				$entree['telexNumber'] = $r->fax;
+			}
+			$dn = 'uid=' . $entree['uid'] . ',o=cubedesigners';
+			if (!ldap_add($ds, $dn, $entree)) {
+				$e = ldap_error($ds);
+				if ($e == 'Already exists') {
+					ldap_modify($ds, $dn, $entree);
+				} else {
+					fb($entree, $e);
+				}
+			}
+		}
+		$res = 'test';
+		$res.='
'; + + ldap_close($ds); + return $res; + } + } ?> \ No newline at end of file