mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
chaning phpgw -> egw
This commit is contained in:
parent
7c4a55d133
commit
062f20ec42
@ -47,9 +47,9 @@
|
||||
{
|
||||
$this->schema_proc = CreateObject('phpgwapi.schema_proc');
|
||||
}
|
||||
$this->db = $this->schema_proc->m_odb;
|
||||
$this->adodb = &$GLOBALS['phpgw']->ADOdb;
|
||||
|
||||
$this->db = $this->schema_proc->m_odb;
|
||||
$this->adodb = &$GLOBALS['egw']->ADOdb;
|
||||
if (is_object($GLOBALS['phpgw_setup'])) // called from setup
|
||||
{
|
||||
$tables = $this->adodb->MetaTables('TABLES');
|
||||
@ -82,7 +82,7 @@
|
||||
{
|
||||
$this->backup_dir = $GLOBALS['phpgw_info']['server']['files_dir'].'/db_backup';
|
||||
}
|
||||
$this->charset = $GLOBALS['phpgw']->translation->charset();
|
||||
$this->charset = $GLOBALS['egw']->translation->charset();
|
||||
}
|
||||
if (!is_dir($this->backup_dir) && is_writable(dirname($this->backup_dir)))
|
||||
{
|
||||
|
@ -44,7 +44,7 @@
|
||||
*/
|
||||
function schema_proc($dbms=False)
|
||||
{
|
||||
$this->m_odb = is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db;
|
||||
$this->m_odb = is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['phpgw_setup']->db;
|
||||
$this->m_odb->connect();
|
||||
|
||||
$this->sType = $dbms ? $dmbs : $this->m_odb->Type;
|
||||
@ -644,7 +644,7 @@
|
||||
* @param mixed $line the line method was called from - use __LINE__
|
||||
* @param string $file the file method was called from - use __FILE__
|
||||
* @param int $offset row to start from
|
||||
* @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']
|
||||
* @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
|
||||
* @return ADORecordSet or false, if the query fails
|
||||
*/
|
||||
function query($sQuery, $line='', $file='')
|
||||
|
@ -437,7 +437,7 @@ class Horde_iCalendar {
|
||||
}
|
||||
|
||||
// Unfold any folded lines.
|
||||
$vCal = preg_replace ('/(\r|\n)+ /', ' ', $vCal);
|
||||
#$vCal = preg_replace ('/(\r|\n)+ /', ' ', $vCal);
|
||||
|
||||
// Unfold "quoted printable" folded lines like:
|
||||
// BODY;ENCODING=QUOTED-PRINTABLE:=
|
||||
@ -459,8 +459,12 @@ class Horde_iCalendar {
|
||||
// BODY;ENCODING=QUOTED-PRINTABLE:=
|
||||
// another=20line=
|
||||
// last=20line
|
||||
#if (preg_match_all('/^([^:]+;\s*ENCODING=QUOTED-PRINTABLE(.*=*\s))/mU', $vCal, $matches)) {
|
||||
# $matches = preg_split('/=+\s/',$vCal);
|
||||
# $vCal = implode('',$matches);
|
||||
#}
|
||||
if (preg_match_all('/^([^:]+;\s*ENCODING=QUOTED-PRINTABLE(.*=*\s))/mU', $vCal, $matches)) {
|
||||
$matches = preg_split('/=+\s/',$vCal);
|
||||
$matches = preg_split('/=(\r\n|\r|\n)/',$vCal);
|
||||
$vCal = implode('',$matches);
|
||||
}
|
||||
|
||||
@ -1139,9 +1143,15 @@ class Horde_iCalendar {
|
||||
*/
|
||||
function _quotedPrintableEncode($input = '')
|
||||
{
|
||||
return $this->EncodeQP($input);
|
||||
|
||||
#$input = preg_replace('!(\r\n|\r|\n)!',"\n",$input);
|
||||
|
||||
// If imap_8bit() is available, use it.
|
||||
if (function_exists('imap_8bit')) {
|
||||
return imap_8bit($input);
|
||||
$retValue = imap_8bit($input);
|
||||
#$retValue = preg_replace('/=0A/',"=0D=0A=\r\n",$retValue);
|
||||
return $retValue;
|
||||
}
|
||||
|
||||
// Rather dumb replacment: just encode everything.
|
||||
@ -1160,5 +1170,126 @@ class Horde_iCalendar {
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
var $LE = "\r\n";
|
||||
|
||||
/**
|
||||
* Encode string to quoted-printable.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function EncodeQP ($str) {
|
||||
$encoded = $this->FixEOL($str);
|
||||
#$encoded = $str;
|
||||
#if (substr($encoded, -(strlen($this->LE))) != $this->LE)
|
||||
# $encoded .= $this->LE;
|
||||
|
||||
// Replace every high ascii, control and = characters
|
||||
#$encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
|
||||
# "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
$encoded = preg_replace('/([\000-\012\015\016\020-\037\075\177-\377])/e',
|
||||
"'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
// Replace every spaces and tabs when it's the last character on a line
|
||||
$encoded = preg_replace("/([\011\040])".$this->LE."/e",
|
||||
"'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
|
||||
|
||||
// Maximum line length of 76 characters before CRLF (74 + space + '=')
|
||||
$encoded = $this->WrapText($encoded, 74, true);
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps message for use with mailers that do not
|
||||
* automatically perform wrapping and for quoted-printable.
|
||||
* Original written by philippe.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function WrapText($message, $length, $qp_mode = false) {
|
||||
$soft_break = ($qp_mode) ? "=\r\n" : $this->LE;
|
||||
|
||||
#$message = $this->FixEOL($message);
|
||||
if (substr($message, -1) == $this->LE)
|
||||
$message = substr($message, 0, -1);
|
||||
|
||||
$line = explode("=0D=0A", $message);
|
||||
$message = "";
|
||||
for ($i=0 ;$i < count($line); $i++)
|
||||
{
|
||||
$line_part = explode(" ", $line[$i]);
|
||||
$buf = "";
|
||||
for ($e = 0; $e<count($line_part); $e++)
|
||||
{
|
||||
$word = $line_part[$e];
|
||||
if ($qp_mode and (strlen($word) > $length))
|
||||
{
|
||||
$space_left = $length - strlen($buf) - 1;
|
||||
if ($e != 0)
|
||||
{
|
||||
if ($space_left > 20)
|
||||
{
|
||||
$len = $space_left;
|
||||
if (substr($word, $len - 1, 1) == "=")
|
||||
$len--;
|
||||
elseif (substr($word, $len - 2, 1) == "=")
|
||||
$len -= 2;
|
||||
$part = substr($word, 0, $len);
|
||||
$word = substr($word, $len);
|
||||
$buf .= " " . $part;
|
||||
$message .= $buf . sprintf("=%s", $this->LE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message .= $buf . $soft_break;
|
||||
}
|
||||
$buf = "";
|
||||
}
|
||||
while (strlen($word) > 0)
|
||||
{
|
||||
$len = $length;
|
||||
if (substr($word, $len - 1, 1) == "=")
|
||||
$len--;
|
||||
elseif (substr($word, $len - 2, 1) == "=")
|
||||
$len -= 2;
|
||||
$part = substr($word, 0, $len);
|
||||
$word = substr($word, $len);
|
||||
|
||||
if (strlen($word) > 0)
|
||||
$message .= $part . sprintf("=%s", $this->LE);
|
||||
else
|
||||
$buf = $part;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$buf_o = $buf;
|
||||
$buf .= ($e == 0) ? $word : (" " . $word);
|
||||
|
||||
if (strlen($buf) > $length and $buf_o != "")
|
||||
{
|
||||
$message .= $buf_o . $soft_break;
|
||||
$buf = $word;
|
||||
}
|
||||
}
|
||||
}
|
||||
$message .= $buf;
|
||||
if((count($line)-1) > $i)
|
||||
$message .= "=0D=0A=\r\n";
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
/**
|
||||
* Changes every end of line from CR or LF to CRLF.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function FixEOL($str) {
|
||||
$str = str_replace("\r\n", "\n", $str);
|
||||
$str = str_replace("\r", "\n", $str);
|
||||
$str = str_replace("\n", $this->LE, $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user