Qual: vcard is not really an external project but now a specific dolibarr class file, so i moved it into core/class

This commit is contained in:
Laurent Destailleur 2011-08-26 23:40:47 +00:00
parent addf46c9cc
commit 4ff832ec25
20 changed files with 3573 additions and 3086 deletions

View File

@ -29,9 +29,7 @@ NuSoap 0.9.5 LGPL 2.1 Yes Interfac
OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files
Php-barcode 0.3pl1 GPL 2.0 Yes Bar code generation
PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files
SMTPs 1.15 GPL Yes SMTPS library
TCPDF 5.9.098 LGPL 3.0 Yes PDF generation
VCard 2.0 GPL 2.0 Yes VCard library
For licenses compatibility informations:
http://www.fsf.org/licensing/licenses/index_html
@ -45,6 +43,8 @@ Copyright (C) 2011
- Regis Houssin <regis@dolibarr.fr>
- Juanjo Menent
- Philippe Grand
- Jean Heimburger <jean@tiaris.info>
- Philippe Grand
Copyright (C) 2010
- Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -24,7 +24,7 @@
* \file htdocs/admin/external_rss.php
* \ingroup external_rss
* \brief Page to setupe module ExternalRss
* \version $Id: external_rss.php,v 1.49 2011/08/17 13:44:16 eldy Exp $
* \version $Id: external_rss.php,v 1.50 2011/08/26 19:09:03 eldy Exp $
*/
require("../main.inc.php");
@ -286,7 +286,10 @@ if ($resql)
}
else
{
print '<font class="error">'.$langs->trans("Offline").'</div>';
print '<font class="error">'.$langs->trans("Offline");
$langs->load("errors");
if ($rssparser->error) print ' - '.$langs->trans($rssparser->error);
print '</div>';
}
print "</td>";
print "</tr>";
@ -320,5 +323,5 @@ else
$db->close();
llxFooter('$Date: 2011/08/17 13:44:16 $ - $Revision: 1.49 $');
llxFooter('$Date: 2011/08/26 19:09:03 $ - $Revision: 1.50 $');
?>

View File

@ -20,13 +20,13 @@
* \file htdocs/contact/vcard.php
* \ingroup societe
* \brief Onglet vcard d'un contact
* \version $Id: vcard.php,v 1.27 2011/07/31 23:54:12 eldy Exp $
* \version $Id: vcard.php,v 1.28 2011/08/26 23:40:49 eldy Exp $
*/
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/vcard/vcard.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/vcard.class.php");
$contact = new Contact($db);

View File

@ -19,14 +19,14 @@
* \file htdocs/core/class/rssparser.class.php
* \ingroup core
* \brief File of class to parse rss feeds
* \version $Id: rssparser.class.php,v 1.1 2011/08/17 13:44:13 eldy Exp $
* \version $Id: rssparser.class.php,v 1.5 2011/08/26 23:06:16 eldy Exp $
*/
class RssParser
{
var $db;
var $error;
protected $_format='rss';
protected $_format='';
protected $_urlRSS;
protected $_language;
protected $_generator;
@ -53,6 +53,12 @@ class RssParser
public function getLastFetchDate() { return $this->_lastfetchdate; }
public function getItems() { return $this->_rssarray; }
// For parsing with xmlparser
var $stack = array(); // parser stack
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
/**
* Constructor
*/
@ -75,8 +81,17 @@ class RssParser
{
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$str=''; // This will contain content of feed
// Check parameters
if (! dol_is_url($urlRSS))
{
$this->error="ErrorBadUrl";
return -1;
}
$this->_urlRSS = $urlRSS;
$newpathofdestfile=$cachedir.'/'.md5($this->_urlRSS);
$newpathofdestfile=$cachedir.'/'.md5($this->_urlRSS);
$newmask=octdec('0644');
//dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile);
@ -100,22 +115,44 @@ class RssParser
}
}
// Load file into $rss
// Load file into $str
if ($foundintocache) // Cache file found and is not too old
{
$str = file_get_contents($newpathofdestfile);
$rss = simplexml_load_string(unserialize($str));
}
else
{
try {
$rss = @simplexml_load_file($this->_urlRSS);
ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
ini_set("max_execution_time", 10);
$str = file_get_contents($this->_urlRSS);
}
catch (Exception $e) {
print 'Error retrieving URL '.$this->urlRSS.' - '.$e->getMessage();
}
}
// 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($this);exit;
}
// If $rss loaded
if ($rss)
{
@ -125,7 +162,7 @@ class RssParser
dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is saved onto disk.");
if (! dol_is_dir($cachedir)) dol_mkdir($cachedir);
$fp = fopen($newpathofdestfile, 'w');
fwrite($fp, serialize($rss->asXML()));
fwrite($fp, $str);
fclose($fp);
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
@ -133,33 +170,132 @@ class RssParser
$this->_lastfetchdate=$nowgmt;
}
// Save description entries
if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language;
if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator;
if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright;
if (!empty($rss->channel->lastbuilddate)) $this->_lastbuilddate = (string) $rss->channel->lastbuilddate;
if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0];
if (!empty($rss->channel->link)) $this->_link = (string) $rss->channel->link;
if (!empty($rss->channel->title)) $this->_title = (string) $rss->channel->title;
if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description;
// TODO imageurl
unset($str); // Free memory
if (empty($rss->_format)) // If format not detected automatically
{
$rss->_format='rss';
if (empty($rss->channel)) $rss->_format='atom';
}
$items=array();
// Save description entries
if ($rss->_format == 'rss')
{
//var_dump($rss);
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language;
if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator;
if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright;
if (!empty($rss->channel->lastbuilddate)) $this->_lastbuilddate = (string) $rss->channel->lastbuilddate;
if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0];
if (!empty($rss->channel->link)) $this->_link = (string) $rss->channel->link;
if (!empty($rss->channel->title)) $this->_title = (string) $rss->channel->title;
if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description;
}
else
{
if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language'];
if (!empty($rss->channel['rss_generator'])) $this->_generator = (string) $rss->channel['rss_generator'];
if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright'];
if (!empty($rss->channel['rss_lastbuilddate'])) $this->_lastbuilddate = (string) $rss->channel['rss_lastbuilddate'];
if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url'];
if (!empty($rss->channel['rss_link'])) $this->_link = (string) $rss->channel['rss_link'];
if (!empty($rss->channel['rss_title'])) $this->_title = (string) $rss->channel['rss_title'];
if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description'];
}
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items=$rss->channel->item; // With simplexml
else $items=$rss->items; // With xmlparse
//var_dump($items);exit;
}
else if ($rss->_format == 'atom')
{
//var_dump($rss);
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
if (!empty($rss->generator)) $this->_generator = (string) $rss->generator;
if (!empty($rss->lastbuilddate)) $this->_lastbuilddate = (string) $rss->modified;
if (!empty($rss->link->href)) $this->_link = (string) $rss->link->href;
if (!empty($rss->title)) $this->_title = (string) $rss->title;
if (!empty($rss->description)) $this->_description = (string) $rss->description;
}
else
{
//if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language'];
if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator'];
//if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright'];
if (!empty($rss->channel['modified'])) $this->_lastbuilddate = (string) $rss->channel['modified'];
//if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url'];
if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link'];
if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title'];
//if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description'];
}
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { $tmprss=xml2php($rss); $items=$tmprss['entry'];} // With simplexml
else $items=$rss->items; // With xmlparse
//var_dump($items);exit;
}
$i = 0;
// Loop on each record
foreach($rss->channel->item as $item)
foreach($items as $item)
{
$itemLink = (string) $item->link;
$itemTitle = (string) $item->title;
$itemDescription = (string) $item->description;
$itemPubDate = (string) $item->pubDate;
//var_dump($item);exit;
if ($rss->_format == 'rss')
{
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
$itemLink = (string) $item->link;
$itemTitle = (string) $item->title;
$itemDescription = (string) $item->description;
$itemPubDate = (string) $item->pubDate;
$itemId = '';
$itemAuthor = '';
}
else
{
$itemLink = (string) $item['rss_link'];
$itemTitle = (string) $item['rss_title'];
$itemDescription = (string) $item['rss_description'];
$itemPubDate = (string) $item['rss_pubdate'];
$itemId = (string) $item['rss_guid'];
$itemAuthor = (string) $item['rss_author'];
}
// Loop on each category
$itemCategory=array();
foreach ($item->category as $cat)
{
$itemCategory[] = (string) $cat;
}
// Loop on each category
$itemCategory=array();
if (is_array($item->category))
{
foreach ($item->category as $cat)
{
$itemCategory[] = (string) $cat;
}
}
}
else if ($rss->_format == 'atom')
{
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
$itemLink = (string) $item['link']['href'];
$itemTitle = (string) $item['title'];
$itemDescription = (string) $item['summary'];
$itemPubDate = (string) $item['created'];
$itemId = (string) $item['id'];
$itemAuthor = (string) ($item['author']?$item['author']:$item['author_name']);
}
else
{
$itemLink = (string) $item['link']['href'];
$itemTitle = (string) $item['title'];
$itemDescription = (string) $item['summary'];
$itemPubDate = (string) $item['created'];
$itemId = (string) $item['id'];
$itemAuthor = (string) ($item['author']?$item['author']:$item['author_name']);
}
}
else print 'ErrorBadFeedFormat';
// Add record to result array
$this->_rssarray[$i] = array(
@ -167,7 +303,9 @@ class RssParser
'title'=>$itemTitle,
'description'=>$itemDescription,
'pubDate'=>$itemPubDate,
'category'=>$itemCategory);
'category'=>$itemCategory,
'id'=>$itemId,
'author'=>$itemAuthor);
$i++;
@ -183,5 +321,323 @@ class RssParser
}
}
/**
* Triggered when opened tag is found
*
* @param $p
* @param $element Tag
* @param $attrs Attributes of tags
*/
function feed_start_element($p, $element, &$attrs)
{
$el = $element = strtolower($element);
$attrs = array_change_key_case($attrs, CASE_LOWER);
// check for a namespace, and split if found
$ns = false;
if ( strpos( $element, ':' ) ) {
list($ns, $el) = explode( ':', $element, 2);
}
if ( $ns and $ns != 'rdf' ) {
$this->current_namespace = $ns;
}
// if feed type isn't set, then this is first element of feed identify feed from root element
if (empty($this->_format))
{
if ( $el == 'rdf' ) {
$this->_format = 'rss';
$this->feed_version = '1.0';
}
elseif ( $el == 'rss' ) {
$this->_format = 'rss';
$this->feed_version = $attrs['version'];
}
elseif ( $el == 'feed' ) {
$this->_format = 'atom';
$this->feed_version = $attrs['version'];
$this->inchannel = true;
}
return;
}
if ( $el == 'channel' )
{
$this->inchannel = true;
}
elseif ($el == 'item' or $el == 'entry' )
{
$this->initem = true;
if ( isset($attrs['rdf:about']) ) {
$this->current_item['about'] = $attrs['rdf:about'];
}
}
// if we're in the default namespace of an RSS feed,
// record textinput or image fields
elseif (
$this->_format == 'rss' and
$this->current_namespace == '' and
$el == 'textinput' )
{
$this->intextinput = true;
}
elseif (
$this->_format == 'rss' and
$this->current_namespace == '' and
$el == 'image' )
{
$this->inimage = true;
}
# handle atom content constructs
elseif ( $this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS) )
{
// avoid clashing w/ RSS mod_content
if ($el == 'content' ) {
$el = 'atom_content';
}
$this->incontent = $el;
}
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
elseif ($this->_format == 'atom' and $this->incontent )
{
// if tags are inlined, then flatten
$attrs_str = join(' ',
array_map('map_attrs',
array_keys($attrs),
array_values($attrs) ) );
$this->append_content( "<$element $attrs_str>" );
array_unshift( $this->stack, $el );
}
// Atom support many links per containging element.
// Magpie treats link elements of type rel='alternate'
// as being equivalent to RSS's simple link element.
//
elseif ($this->_format == 'atom' and $el == 'link' )
{
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
{
$link_el = 'link';
}
else {
$link_el = 'link_' . $attrs['rel'];
}
$this->append($link_el, $attrs['href']);
}
// set stack[0] to current element
else {
array_unshift($this->stack, $el);
}
}
/**
* Triggered when CDATA is found
*
* @param $p
* @param $element Tag
* @param $attrs Attributes of tags
*/
function feed_cdata ($p, $text) {
if ($this->_format == 'atom' and $this->incontent)
{
$this->append_content( $text );
}
else {
$current_el = join('_', array_reverse($this->stack));
$this->append($current_el, $text);
}
}
/**
* Triggered when closed tag is found
*
* @param $p
* @param $element Tag
*/
function feed_end_element ($p, $el) {
$el = strtolower($el);
if ( $el == 'item' or $el == 'entry' )
{
$this->items[] = $this->current_item;
$this->current_item = array();
$this->initem = false;
}
elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput' )
{
$this->intextinput = false;
}
elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image' )
{
$this->inimage = false;
}
elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS) )
{
$this->incontent = false;
}
elseif ($el == 'channel' or $el == 'feed' )
{
$this->inchannel = false;
}
elseif ($this->_format == 'atom' and $this->incontent ) {
// balance tags properly
// note: i don't think this is actually neccessary
if ( $this->stack[0] == $el )
{
$this->append_content("</$el>");
}
else {
$this->append_content("<$el />");
}
array_shift( $this->stack );
}
else {
array_shift( $this->stack );
}
$this->current_namespace = false;
}
/**
* To concat 2 string with no warning if an operand is not defined
*
* @param $str1
* @param $str2
*/
function concat (&$str1, $str2="") {
if (!isset($str1) ) {
$str1="";
}
$str1 .= $str2;
}
/**
*/
function append_content($text) {
if ( $this->initem ) {
$this->concat( $this->current_item[ $this->incontent ], $text );
}
elseif ( $this->inchannel ) {
$this->concat( $this->channel[ $this->incontent ], $text );
}
}
/**
* smart append - field and namespace aware
*/
function append($el, $text) {
if (!$el) {
return;
}
if ( $this->current_namespace )
{
if ( $this->initem ) {
$this->concat(
$this->current_item[ $this->current_namespace ][ $el ], $text);
}
elseif ($this->inchannel) {
$this->concat(
$this->channel[ $this->current_namespace][ $el ], $text );
}
elseif ($this->intextinput) {
$this->concat(
$this->textinput[ $this->current_namespace][ $el ], $text );
}
elseif ($this->inimage) {
$this->concat(
$this->image[ $this->current_namespace ][ $el ], $text );
}
}
else {
if ( $this->initem ) {
$this->concat(
$this->current_item[ $el ], $text);
}
elseif ($this->intextinput) {
$this->concat(
$this->textinput[ $el ], $text );
}
elseif ($this->inimage) {
$this->concat(
$this->image[ $el ], $text );
}
elseif ($this->inchannel) {
$this->concat(
$this->channel[ $el ], $text );
}
}
}
}
/**
* Function to convert an XML object into an array
*/
function xml2php($xml)
{
$fils = 0;
$tab = false;
$array = array();
foreach($xml->children() as $key => $value)
{
$child = xml2php($value);
//To deal with the attributes
foreach($value->attributes() as $ak=>$av)
{
$child[$ak] = (string)$av;
}
//Let see if the new child is not in the array
if($tab==false && in_array($key,array_keys($array)))
{
//If this element is already in the array we will create an indexed array
$tmp = $array[$key];
$array[$key] = NULL;
$array[$key][] = $tmp;
$array[$key][] = $child;
$tab = true;
}
elseif($tab == true)
{
//Add an element in an existing array
$array[$key][] = $child;
}
else
{
//Add a simple element
$array[$key] = $child;
}
$fils++;
}
if($fils==0)
{
return (string)$xml;
}
return $array;
}
?>

2724
htdocs/core/class/smtps.php Executable file

File diff suppressed because it is too large Load Diff

298
htdocs/core/class/vcard.class.php Executable file
View File

@ -0,0 +1,298 @@
<?php
/* Copyright (C) Kai Blankenhorn <kaib@bitfolge.de>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* v2.0 Initial creation Kai Blankenhorn
* 2007 v3.0 Laurent Destailleur eldy@users.sourceforge.net
* Added functions (as in http://www.ietf.org/rfc/rfc2426.txt):
* setTitle setOrg setProdId setUID
*/
/**
* \file htdocs/core/class/vcard.class.php
* \brief Class to manage vCard files
*/
/**
* Encode a string for vCard
*
* @param string String to encode
*/
function encode($string)
{
return str_replace(";","\;",(dol_quoted_printable_encode(utf8_decode($string))));
}
/**
* Taken from php documentation comments
* No more used
*
* @param input String
* @param line_max Max length of lines
*/
function dol_quoted_printable_encode($input, $line_max = 76)
{
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
$lines = preg_split("/(\?:\r\n|\r|\n)/", $input);
$eol = "\r\n";
$linebreak = "=0D=0A";
$escape = "=";
$output = "";
for ($j=0;$j<count($lines);$j++) {
$line = $lines[$j];
$linlen = strlen($line);
$newline = "";
for($i = 0; $i < $linlen; $i++) {
$c = substr($line, $i, 1);
$dec = ord($c);
if ( ($dec == 32) && ($i == ($linlen - 1)) ) { // convert space at eol only
$c = "=20";
} elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
$h2 = floor($dec/16); $h1 = floor($dec%16);
$c = $escape.$hex["$h2"].$hex["$h1"];
}
if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
$newline = " ";
}
$newline .= $c;
} // end of for
$output .= $newline;
if ($j<count($lines)-1) $output .= $linebreak;
}
return trim($output);
}
/**
* \class vCard
* \brief Class to buld vCard files
*/
class vCard
{
var $properties;
var $filename;
//var $encoding="UTF-8";
var $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
/**
* mise en forme du numero de telephone
*
* @param number numero de telephone
* @param type
*/
function setPhoneNumber($number, $type="") {
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
$key = "TEL";
if ($type!="") $key .= ";".$type;
$key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($number);
}
/**
* mise en forme de la photo
* warning NON TESTE !
*
* @param type
* @param photo
*/
function setPhoto($type, $photo) { // $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
}
/**
* mise en forme du nom formate
*
* @param name
*/
function setFormattedName($name) {
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
}
/**
* mise en forme du nom complet
*
* @param family
* @param first
* @param additional
* @param prefix
* @param suffix
*/
function setName($family="", $first="", $additional="", $prefix="", $suffix="") {
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf";
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
}
/**
* mise en forme de l'anniversaire
*
* @param date
*/
function setBirthday($date) { // $date format is YYYY-MM-DD
$this->properties["BDAY"] = $date;
}
/**
* mise en forme de l'adresse
*
* @param postoffice
* @param extended
* @param street
* @param city
* @param region
* @param zip
* @param country
* @param type
*/
function setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR";
if ($type!="") $key.= ";$type";
$key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") {
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
}
}
/**
* mise en forme du label
*
* @param postoffice
* @param extended
* @param street
* @param city
* @param region
* @param zip
* @param country
* @param type
*/
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
$label = "";
if ($postoffice!="") $label.= "$postoffice\r\n";
if ($extended!="") $label.= "$extended\r\n";
if ($street!="") $label.= "$street\r\n";
if ($zip!="") $label.= "$zip ";
if ($city!="") $label.= "$city\r\n";
if ($region!="") $label.= "$region\r\n";
if ($country!="") $country.= "$country\r\n";
$this->properties["LABEL;$type;CHARSET=".$this->encoding] = encode($label);
}
/**
* mise en forme de l'email
*
* @param address EMail
* @param type Vcard type
*/
function setEmail($address,$type="internet,pref") {
$this->properties["EMAIL;TYPE=".$type] = $address;
}
/**
* mise en forme de la note
*
* @param note
*/
function setNote($note) {
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
}
/**
* mise en forme de la fonction
*
* @param title
*/
function setTitle($title) {
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
}
/**
* mise en forme de la societe
*
* @param org
*/
function setOrg($org) {
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
}
/**
* mise en forme du logiciel generateur
*
* @param prodid
*/
function setProdId($prodid) {
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
}
/**
* mise en forme du logiciel generateur
*
* @param uid
*/
function setUID($uid) {
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
}
/**
* mise en forme de l'url
*
* @param url
* @param type
*/
function setURL($url, $type="") {
// $type may be WORK | HOME
$key = "URL";
if ($type!="") $key.= ";$type";
$this->properties[$key] = $url;
}
/**
* permet d'obtenir une vcard
*/
function getVCard() {
$text = "BEGIN:VCARD\r\n";
//$text.= "VERSION:3.0\r\n";
$text.= "VERSION:2.1\r\n";
foreach($this->properties as $key => $value) {
$text.= "$key:$value\r\n";
}
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
$text.= "MAILER: Dolibarr\r\n";
$text.= "END:VCARD\r\n";
return $text;
}
/**
* permet d'obtenir le nom de fichier
*/
function getFileName() {
return $this->filename;
}
}
?>

View File

@ -1,7 +0,0 @@
README (english)
----------------
This directory contains a PHP library for manipulating SMTPS.
Web: http://www.paehl.de/cms/php_scripts (Class from SMTP PHP Mail project)
Author: Dirk Paehl
Licence: GPL

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
README (english)
----------------
This directory contains a PHP library for manipulating VCal format.
Author: Kai Blankenhorn
Licence: GPL 2.0

View File

@ -1,295 +0,0 @@
<?php
/***************************************************************************
php vCard class
(c) Kai Blankenhorn
www.bitfolge.de/en
kaib@bitfolge.de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***************************************************************************
2007 v3.0 Laurent Destailleur eldy@users.sourceforge.net
Added functions (as in http://www.ietf.org/rfc/rfc2426.txt):
setTitle setOrg setProdId setUID
***************************************************************************/
/**
* \file htdocs/includes/vcard/vcard.class.php
* \brief Classe permettant de creer un fichier vcard.
* \author Kai Blankenhorn.
* \version 2.0
*
* Ensemble des fonctions permettant de creer un fichier vcard.
*/
function encode($string) {
//return escape($string);
return escape(dol_quoted_printable_encode(utf8_decode($string)));
}
function escape($string) {
return str_replace(";","\;",$string);
}
/** \brief Taken from php documentation comments
* No more used
*/
function dol_quoted_printable_encode($input, $line_max = 76) {
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
$lines = preg_split("/(\?:\r\n|\r|\n)/", $input);
$eol = "\r\n";
$linebreak = "=0D=0A";
$escape = "=";
$output = "";
for ($j=0;$j<count($lines);$j++) {
$line = $lines[$j];
$linlen = strlen($line);
$newline = "";
for($i = 0; $i < $linlen; $i++) {
$c = substr($line, $i, 1);
$dec = ord($c);
if ( ($dec == 32) && ($i == ($linlen - 1)) ) { // convert space at eol only
$c = "=20";
} elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
$h2 = floor($dec/16); $h1 = floor($dec%16);
$c = $escape.$hex["$h2"].$hex["$h1"];
}
if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
$newline = " ";
}
$newline .= $c;
} // end of for
$output .= $newline;
if ($j<count($lines)-1) $output .= $linebreak;
}
return trim($output);
}
/** \class vCard
\brief Classe permettant de creer un fichier vcard
Ensemble des fonctions permettant de creer un fichier vcard
*/
class vCard {
var $properties;
var $filename;
//var $encoding="UTF-8";
var $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
/**
\brief mise en forme du numero de telephone
\param number numero de telephone
\param type
*/
function setPhoneNumber($number, $type="") {
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
$key = "TEL";
if ($type!="") $key .= ";".$type;
$key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($number);
}
/**
\brief mise en forme de la photo
\param type
\param photo
\warning NON TESTE !
*/
// UNTESTED !!!
function setPhoto($type, $photo) { // $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
}
/**
\brief mise en forme du nom formate
\param name
*/
function setFormattedName($name) {
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
}
/**
\brief mise en forme du nom complet
\param family
\param first
\param additional
\param prefix
\param suffix
*/
function setName($family="", $first="", $additional="", $prefix="", $suffix="") {
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf";
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
}
/**
\brief mise en forme de l'anniversaire
\param date
*/
function setBirthday($date) { // $date format is YYYY-MM-DD
$this->properties["BDAY"] = $date;
}
/**
\brief mise en forme de l'adresse
\param postoffice
\param extended
\param street
\param city
\param region
\param zip
\param country
\param type
*/
function setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR";
if ($type!="") $key.= ";$type";
$key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") {
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
}
}
/**
\brief mise en forme du label
\param postoffice
\param extended
\param street
\param city
\param region
\param zip
\param country
\param type
*/
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
$label = "";
if ($postoffice!="") $label.= "$postoffice\r\n";
if ($extended!="") $label.= "$extended\r\n";
if ($street!="") $label.= "$street\r\n";
if ($zip!="") $label.= "$zip ";
if ($city!="") $label.= "$city\r\n";
if ($region!="") $label.= "$region\r\n";
if ($country!="") $country.= "$country\r\n";
$this->properties["LABEL;$type;CHARSET=".$this->encoding] = encode($label);
}
/**
\brief Mise en forme de l'email
\param address EMail
\param type Vcard type
*/
function setEmail($address,$type="internet,pref") {
$this->properties["EMAIL;TYPE=".$type] = $address;
}
/**
\brief mise en forme de la note
\param note
*/
function setNote($note) {
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
}
/**
\brief mise en forme de la fonction
\param title
*/
function setTitle($title) {
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
}
/**
\brief mise en forme de la societe
\param org
*/
function setOrg($org) {
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
}
/**
\brief mise en forme du logiciel generateur
\param prodid
*/
function setProdId($prodid) {
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
}
/**
\brief mise en forme du logiciel generateur
\param uid
*/
function setUID($uid) {
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
}
/**
\brief mise en forme de l'url
\param url
\param type
*/
function setURL($url, $type="") {
// $type may be WORK | HOME
$key = "URL";
if ($type!="") $key.= ";$type";
$this->properties[$key] = $url;
}
/**
\brief permet d'obtenir une vcard
*/
function getVCard() {
$text = "BEGIN:VCARD\r\n";
//$text.= "VERSION:3.0\r\n";
$text.= "VERSION:2.1\r\n";
foreach($this->properties as $key => $value) {
$text.= "$key:$value\r\n";
}
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
$text.= "MAILER:php vCard class by Kai Blankenhorn\r\n";
$text.= "END:VCARD\r\n";
return $text;
}
/**
\brief permet d'obtenir le nom de fichier
*/
function getFileName() {
return $this->filename;
}
}
?>

View File

@ -883,6 +883,7 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O
WatermarkOnDraft=Marca d'aigua en els documents esborrany
CompanyIdProfChecker=Id Professional únic
MustBeUnique=Ha de ser únic?
Miscellanous=Miscel·lània
##### Webcal setup #####
WebCalSetup=Configuració d'enllaç amb el calendari webcalendar
WebCalSyncro=Integrar els esdeveniments Dolibarr a webcalendar

View File

@ -877,6 +877,7 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for
WatermarkOnDraft=Watermark on draft document
CompanyIdProfChecker=Professional Id unique
MustBeUnique=Must be unique ?
Miscellanous=Miscellanous
##### Webcal setup #####
WebCalSetup=Webcalendar link setup
WebCalSyncro=Add Dolibarr events to WebCalendar

View File

@ -15,14 +15,14 @@ BoxLastCustomerOrders=Last customer orders
BoxLastBooks=Last books
BoxLastActions=Last actions
BoxLastContracts=Last contracts
BoxLastContacts=Derniers contacts/adresses
BoxLastContacts=Last contacts/addresses
BoxLastMembers=Last members
BoxCurrentAccounts=Current accounts balance
BoxSalesTurnover=Sales turnover
BoxTotalUnpaidCustomerBills=Total unpaid customer's invoices
BoxTotalUnpaidSuppliersBills=Total unpaid supplier's invoices
BoxTitleLastBooks=Last %s recorded books
BoxTitleNbOfCustomers=Nombre de client
BoxTitleNbOfCustomers=Number of clients
BoxTitleLastRssInfos=Last %s news from %s
BoxTitleLastProducts=Last %s modified products/services
BoxTitleLastCustomerOrders=Last %s modified customer orders
@ -44,11 +44,11 @@ BoxTitleCurrentAccounts=Current account's balances
BoxTitleSalesTurnover=Sales turnover
BoxTitleTotalUnpaidCustomerBills=Unpaid customer's invoices
BoxTitleTotalUnpaidSuppliersBills=Unpaid supplier's invoices
BoxTitleLastModifiedContacts=Last %s modified contacts/addresses
BoxTitleLastModifiedContacts=Last %s modified contacts/addresses
BoxMyLastBookmarks=My last %s bookmarks
FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Last successfull refresh date: %s
LastRefreshDate=Last refresh date
NoRecordedBookmarks=No bookmarks defined.
NoRecordedBookmarks=No bookmarks defined.
ClickToAdd=Click here to add.
NoRecordedCustomers=No recorded customers
NoRecordedContacts=No recorded contacts

View File

@ -86,3 +86,4 @@ ErrorProductWithRefNotExist=Product with reference '<i>%s</i>' don't exist
ErrorDeleteNotPossibleLineIsConsolidated=Delete not possible because record is linked to a bank transation that is conciliated
ErrorProdIdAlreadyExist=%s is assigned to another third
ErrorFailedToSendPassword=Failed to send password
ErrorFailedToLoadRSSFile=Fails to get RSS feed. Try to add constant MAIN_SIMPLEXMLLOAD_DEBUG if error messages does not provide enough information.

View File

@ -883,6 +883,7 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope
WatermarkOnDraft=Marca de agua en los documentos borrador
CompanyIdProfChecker=Id Profesional único
MustBeUnique=¿Debe ser único?
Miscellanous=Miscelánea
##### Webcal setup #####
WebCalSetup=Configuración de enlace con el calendario Webcalendar
WebCalSyncro=Integrar los eventos Dolibarr en WebCalendar

View File

@ -885,6 +885,7 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open
WatermarkOnDraft=Filigrane sur les documents brouillons
CompanyIdProfChecker=Id professionel unique
MustBeUnique=Doit être unique ?
Miscellanous=Miscellanous
##### Webcal setup #####
WebCalSetup= Configuration du lien vers le calendrier Webcalendar
WebCalSyncro= Intégrer les événements Dolibarr dans WebCalendar

View File

@ -87,3 +87,4 @@ ErrorProductWithRefNotExist=La référence produit '<i>%s</i>' n'existe pas
ErrorDeleteNotPossibleLineIsConsolidated=Suppression impossible car l'enregistrement porte sur au moins une transaction bancaire rapprochée
ErrorProdIdAlreadyExist=%s est attribué à un autre tiers
ErrorFailedToSendPassword=Échec de l'envoi du mot de passe
ErrorFailedToLoadRSSFile=Echec de la récupération du flux RSS. Ajouter la constante MAIN_SIMPLEXMLLOAD_DEBUG si le message d'erreur n'est pas assez explicite.

View File

@ -10,12 +10,12 @@
// Reference language: en_US
CHARSET=UTF-8
BoxLastRssInfos=Информация RSS
BoxLastProducts=Последние %s товаров / услуг
BoxLastProductsInContract=Последние %s проданных товаров / услуг
BoxLastProducts=Последние %s товары / услуги
BoxLastProductsInContract=Последние %s проданные товары / услуги
BoxLastSupplierBills=Последние счета-фактуры поставщиков
BoxLastCustomerBills=Последние счета-фактуры покупателям
BoxLastProposals=Последние коммерческие предложения
BoxLastProspects=Последние измененные потенциальные покупатели
BoxLastProspects=Последние измененные потенциальные клиенты
BoxLastCustomers=Последние измененные покупатели
BoxLastCustomerOrders=Последние заказы покупателей
BoxLastSuppliers=Последние измененные поставщики
@ -26,8 +26,8 @@ BoxSalesTurnover=Оборот по продажам
BoxTitleLastBooks=Последние %s зарегистрированных сделок
BoxTitleNbOfCustomers=Кол-во покупателей
BoxTitleLastRssInfos=Последние новости %s из %s
BoxTitleLastProducts=Последние %s измененных товаров / услуг
BoxTitleLastCustomerOrders=Последние %s измененных заказов покупателей
BoxTitleLastProducts=Последние %s измененные товары / услуги
BoxTitleLastCustomerOrders=Последние %s измененные заказы покупателей
BoxTitleLastSuppliers=Последние %s зарегистрированных поставщиков
BoxTitleLastCustomers=Последние %s зарегистрированных покупателей
BoxTitleLastCustomersOrProspects=Последние %s зарегистрированных покупателей и потенциальных клиентов
@ -48,20 +48,10 @@ NoRecordedOrders=Нет зарегистрированных заказы пок
NoRecordedProposals=Нет зарегистрированных предложений
NoRecordedInvoices=Нет зарегистрированных счетов-фактур покупателям
NoRecordedSupplierInvoices=Нет зарегистрированных счетов-фактур поставщиков
// Date 2009-01-19 21:30:52
// STOP - Lines generated via parser
// START - Lines generated via autotranslator.php tool (2009-08-13 21:14:36).
// Reference language: en_US
LastRefreshDate=Дата последнего обновления
NoRecordedProducts=Нет зарегистрированных товаров / услуг
NoRecordedProspects=Нет зарегистрированных потенциальных клиентов
NoContractedProducts=Нет законтрактованных товаров / услуг
// STOP - Lines generated via autotranslator.php tool (2009-08-13 21:14:36).
// START - Lines generated via autotranslator.php tool (2009-08-19 20:18:27).
// Reference language: en_US
BoxOldestUnpaidCustomerBills=Самые старые неоплаченные счета-фактуры покупателям
BoxOldestUnpaidSupplierBills=Самые старые неоплаченные счета-фактуры поставщиков
BoxTotalUnpaidCustomerBills=Общая сумма неоплаченных счетов-фактур покупателям
@ -72,11 +62,21 @@ BoxTitleTotalUnpaidCustomerBills=Неоплаченные счета-факту
BoxTitleTotalUnpaidSuppliersBills=Неоплаченные счета-фактуры поставщиков
NoUnpaidCustomerBills=Нет неоплаченных счетов-фактур покупателям
NoUnpaidSupplierBills=Нет неоплаченных счетов-фактур поставщиков
// STOP - Lines generated via autotranslator.php tool (2009-08-19 20:18:27).
// START - Lines generated via autotranslator.php tool (2010-09-04 01:33:40).
// Reference language: en_US -> ru_RU
BoxTitleLastModifiedSuppliers=Последнее %s измененных поставщиков
BoxTitleLastModifiedCustomers=Последнее %s измененных клиентов
BoxTitleLastModifiedCustomers=Последнее %s измененных покупателей
BoxTitleLastModifiedProspects=Последнее %s измененных потенциальных клиентов
// STOP - Lines generated via autotranslator.php tool (2010-09-04 01:56:40).
BoxLastContracts=Последние договоры
BoxLastContacts=Последние контакты / адреса
BoxLastMembers=Последнее участники
BoxTitleLastModifiedCustomers=Последние %s измененных покупателей
BoxTitleLastModifiedProspects=Последние %s измененных потенциальных клиентов
BoxTitleLastProductsInContract=Последние %s товаров / услуг в договорах
BoxTitleLastModifiedMembers=Последние %s измененных участников
BoxTitleLastModifiedContacts=Последние %s измененных контактов / адресов
NoRecordedContacts=Нет введенных контактов
BoxTitleLastContracts=Последние %s договоров
BoxTitleLastModifiedDonations=Последние %s измененных пожертвований
BoxTitleLastModifiedExpenses=Последние %s измененных расходов
NoModifiedSupplierBills=Нет введенных счетов-фактур поставщиков
NoRecordedContracts=Нет введенных договоров
// STOP - Lines generated via autotranslator.php tool (2011-08-25 22:47:13).

View File

@ -24,7 +24,7 @@
/**
* \file htdocs/lib/CMailFile.class.php
* \brief File of class to send emails (with attachments or not)
* \version $Id: CMailFile.class.php,v 1.148 2011/07/31 23:25:43 eldy Exp $
* \version $Id: CMailFile.class.php,v 1.149 2011/08/26 23:19:53 eldy Exp $
* \author Dan Potter.
* \author Eric Seigne
* \author Laurent Destailleur.
@ -235,7 +235,7 @@ class CMailFile
// Use SMTPS library
// ------------------------------------------
require_once(DOL_DOCUMENT_ROOT."/includes/smtps/SMTPs.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/smtps.php");
$smtps = new SMTPs();
$smtps->setCharSet($conf->file->character_set_client);

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/lib/files.lib.php
* \brief Library for file managing functions
* \version $Id: files.lib.php,v 1.71 2011/07/31 23:25:43 eldy Exp $
* \version $Id: files.lib.php,v 1.72 2011/08/26 17:59:14 eldy Exp $
*/
/**
@ -186,6 +186,7 @@ function dol_compare_file($a, $b)
/**
* Return mime type of a file
*
* @param file Filename we looking for MIME type
* @param default Default mime type if extension not found in known list
* @param mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language
@ -295,6 +296,7 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
/**
* Test if filename is a directory
*
* @param folder Name of folder
* @return boolean True if it's a directory, False if not found
*/
@ -307,6 +309,7 @@ function dol_is_dir($folder)
/**
* Return if path is a file
*
* @param $pathoffile
* @return boolean True or false
*/
@ -316,8 +319,26 @@ function dol_is_file($pathoffile)
return is_file($newpathoffile);
}
/**
* Return if path is an URL
*
* @param $url
* @return boolean True or false
*/
function dol_is_url($url)
{
$tmpprot=array('file','http','ftp','zlib','data','ssh2','ogg','expect');
foreach($tmpprot as $prot)
{
if (preg_match('/^'.$prot.':/i',$url)) return true;
}
return false;
}
/**
* Test if a folder is empty
*
* @param folder Name of folder
* @return boolean True if dir is empty or non-existing, False if it contains files
*/