task #11278: Option into point of sale module to add services in list
This commit is contained in:
parent
b95aa95d50
commit
409a0e622d
@ -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.50 2011/08/26 19:09:03 eldy Exp $
|
||||
* \version $Id: external_rss.php,v 1.49 2011/08/17 13:44:16 eldy Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@ -286,10 +286,7 @@ if ($resql)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<font class="error">'.$langs->trans("Offline");
|
||||
$langs->load("errors");
|
||||
if ($rssparser->error) print ' - '.$langs->trans($rssparser->error);
|
||||
print '</div>';
|
||||
print '<font class="error">'.$langs->trans("Offline").'</div>';
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
@ -323,5 +320,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/26 19:09:03 $ - $Revision: 1.50 $');
|
||||
llxFooter('$Date: 2011/08/17 13:44:16 $ - $Revision: 1.49 $');
|
||||
?>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
* \file htdocs/cashdesk/admin/cashdesk.php
|
||||
* \ingroup cashdesk
|
||||
* \brief Setup page for cashdesk module
|
||||
* \version $Id: cashdesk.php,v 1.9 2011/08/26 15:05:41 simnandez Exp $
|
||||
* \version $Id: cashdesk.php,v 1.8 2011/08/26 14:52:00 simnandez Exp $
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@ -151,7 +151,6 @@ print '<center><input type="submit" class="button" value="'.$langs->trans("Save"
|
||||
print "</form>\n";
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/26 15:05:41 $ - $Revision: 1.9 $');
|
||||
llxFooter('$Date: 2011/08/26 14:52:00 $ - $Revision: 1.8 $');
|
||||
?>
|
||||
|
||||
@ -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.5 2011/08/26 23:06:16 eldy Exp $
|
||||
* \version $Id: rssparser.class.php,v 1.1 2011/08/17 13:44:13 eldy Exp $
|
||||
*/
|
||||
class RssParser
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
protected $_format='';
|
||||
protected $_format='rss';
|
||||
protected $_urlRSS;
|
||||
protected $_language;
|
||||
protected $_generator;
|
||||
@ -53,12 +53,6 @@ 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
|
||||
*/
|
||||
@ -81,17 +75,8 @@ 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);
|
||||
@ -115,44 +100,22 @@ class RssParser
|
||||
}
|
||||
}
|
||||
|
||||
// Load file into $str
|
||||
// Load file into $rss
|
||||
if ($foundintocache) // Cache file found and is not too old
|
||||
{
|
||||
$str = file_get_contents($newpathofdestfile);
|
||||
$rss = simplexml_load_string(unserialize($str));
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
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);
|
||||
$rss = @simplexml_load_file($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)
|
||||
{
|
||||
@ -162,7 +125,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, $str);
|
||||
fwrite($fp, serialize($rss->asXML()));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
@ -170,132 +133,33 @@ class RssParser
|
||||
$this->_lastfetchdate=$nowgmt;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
// 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
|
||||
|
||||
$i = 0;
|
||||
// Loop on each record
|
||||
foreach($items as $item)
|
||||
{
|
||||
//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();
|
||||
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';
|
||||
// Loop on each record
|
||||
foreach($rss->channel->item as $item)
|
||||
{
|
||||
$itemLink = (string) $item->link;
|
||||
$itemTitle = (string) $item->title;
|
||||
$itemDescription = (string) $item->description;
|
||||
$itemPubDate = (string) $item->pubDate;
|
||||
|
||||
// Loop on each category
|
||||
$itemCategory=array();
|
||||
foreach ($item->category as $cat)
|
||||
{
|
||||
$itemCategory[] = (string) $cat;
|
||||
}
|
||||
|
||||
// Add record to result array
|
||||
$this->_rssarray[$i] = array(
|
||||
@ -303,9 +167,7 @@ class RssParser
|
||||
'title'=>$itemTitle,
|
||||
'description'=>$itemDescription,
|
||||
'pubDate'=>$itemPubDate,
|
||||
'category'=>$itemCategory,
|
||||
'id'=>$itemId,
|
||||
'author'=>$itemAuthor);
|
||||
'category'=>$itemCategory);
|
||||
|
||||
$i++;
|
||||
|
||||
@ -321,323 +183,5 @@ 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;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
7
htdocs/includes/smtps/README
Normal file
7
htdocs/includes/smtps/README
Normal file
@ -0,0 +1,7 @@
|
||||
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
|
||||
15
htdocs/core/class/smtps.php → htdocs/includes/smtps/SMTPs.php
Executable file → Normal file
15
htdocs/core/class/smtps.php → htdocs/includes/smtps/SMTPs.php
Executable file → Normal file
@ -18,7 +18,8 @@
|
||||
* - attachments
|
||||
* - GPG access
|
||||
*
|
||||
* This Class is based off of 'SMTP PHP MAIL' by Dirk Paehl, http://www.paehl.de
|
||||
* This Class is based off of 'SMTP PHP MAIL'
|
||||
* by Dirk Paehl, http://www.paehl.de
|
||||
*
|
||||
* @package SMTPs
|
||||
*
|
||||
@ -30,13 +31,12 @@
|
||||
* @reference http://www.gordano.com/kb.htm?q=803
|
||||
*
|
||||
* @author Walter Torres <walter@torres.ws> [with a *lot* of help!]
|
||||
* @author Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* @author Regis Houssin
|
||||
*
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.15 $
|
||||
* @copyright copyright information
|
||||
* @license GNU General Public Licence
|
||||
*
|
||||
* $Id: smtps.php,v 1.1 2011/08/26 23:19:54 eldy Exp $
|
||||
* $Id: SMTPs.php,v 1.15 2011/07/12 22:19:02 eldy Exp $
|
||||
*
|
||||
**/
|
||||
|
||||
@ -2520,10 +2520,7 @@ class SMTPs
|
||||
// ** CSV Version Control Info
|
||||
|
||||
/**
|
||||
* $Log: smtps.php,v $
|
||||
* Revision 1.1 2011/08/26 23:19:54 eldy
|
||||
* Qual: smtps is not really an external project but now a specific dolibarr class file, so i moved it into core/class
|
||||
*
|
||||
* $Log: SMTPs.php,v $
|
||||
* Revision 1.15 2011/07/12 22:19:02 eldy
|
||||
* Fix: Attachment fails if content was empty
|
||||
*
|
||||
@ -883,7 +883,6 @@ 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
|
||||
|
||||
@ -877,7 +877,6 @@ 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
|
||||
|
||||
@ -15,14 +15,14 @@ BoxLastCustomerOrders=Last customer orders
|
||||
BoxLastBooks=Last books
|
||||
BoxLastActions=Last actions
|
||||
BoxLastContracts=Last contracts
|
||||
BoxLastContacts=Last contacts/addresses
|
||||
BoxLastContacts=Derniers contacts/adresses
|
||||
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=Number of clients
|
||||
BoxTitleNbOfCustomers=Nombre de client
|
||||
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
|
||||
|
||||
@ -86,4 +86,3 @@ 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.
|
||||
@ -883,7 +883,6 @@ 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
|
||||
|
||||
@ -885,7 +885,6 @@ 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
|
||||
|
||||
@ -87,4 +87,3 @@ 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.
|
||||
@ -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,10 +48,20 @@ 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=Общая сумма неоплаченных счетов-фактур покупателям
|
||||
@ -62,21 +72,11 @@ 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 измененных потенциальных клиентов
|
||||
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).
|
||||
// STOP - Lines generated via autotranslator.php tool (2010-09-04 01:56:40).
|
||||
|
||||
@ -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.149 2011/08/26 23:19:53 eldy Exp $
|
||||
* \version $Id: CMailFile.class.php,v 1.148 2011/07/31 23:25:43 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."/core/class/smtps.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/smtps/SMTPs.php");
|
||||
$smtps = new SMTPs();
|
||||
$smtps->setCharSet($conf->file->character_set_client);
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/**
|
||||
* \file htdocs/lib/files.lib.php
|
||||
* \brief Library for file managing functions
|
||||
* \version $Id: files.lib.php,v 1.72 2011/08/26 17:59:14 eldy Exp $
|
||||
* \version $Id: files.lib.php,v 1.71 2011/07/31 23:25:43 eldy Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -186,7 +186,6 @@ 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
|
||||
@ -296,7 +295,6 @@ 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
|
||||
*/
|
||||
@ -309,7 +307,6 @@ function dol_is_dir($folder)
|
||||
|
||||
/**
|
||||
* Return if path is a file
|
||||
*
|
||||
* @param $pathoffile
|
||||
* @return boolean True or false
|
||||
*/
|
||||
@ -319,26 +316,8 @@ 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
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user