コード例 #1
0
 function clonePage($params = array())
 {
     if (!is_writable($this->_PATH_CUR_THEME_PAGE_LAYOUTS)) {
         CTrace::err("ClonePage: " . $this->_PATH_CUR_THEME_PAGE_LAYOUTS . " is not writable.");
         return;
     }
     $cur_pages = $this->getPagesList();
     if (empty($params['page_name'])) {
         $params['page_name'] = 'test.php';
     }
     if (empty($params['cloned_page'])) {
         $params['cloned_page'] = 'index.php';
     }
     if (empty($params['settings'])) {
         $params['settings'] = null;
     }
     if (empty($params['placeholders'])) {
         $params['placeholders'] = null;
     }
     if (in_array($params['page_name'], $cur_pages)) {
         CTrace::err("ClonePage: page {$params['page_name']} already exists");
         return;
     }
     if (in_array($params['cloned_page'], $cur_pages)) {
         $clone = $this->getData($this->_PATH_CUR_THEME_PAGE_LAYOUTS . $params['cloned_page'] . '.yml');
         if (!empty($params['settings']) && is_array($params['settings'])) {
             foreach ($params['settings'] as $sname => $sval) {
                 if (!empty($sname) && in_array($sname, array_keys($clone['settings']))) {
                     $clone['settings'][$sname] = $sval;
                 }
             }
         }
         if (!empty($params['placeholders']) && is_array($params['placeholders'])) {
             foreach ($params['placeholders'] as $phName => $phVal) {
                 if (!empty($phName) && in_array($phName, array_keys($clone['placeholders']))) {
                     if (!empty($params['placeholders'][$phName]['visibility'])) {
                         $clone['placeholders'][$phName]['visibility'] = $params['placeholders'][$phName]['visibility'];
                     }
                     if (isset($params['placeholders'][$phName]['blocks']) && is_array($params['placeholders'][$phName]['blocks'])) {
                         if ($params['placeholders'][$phName]['blocks'] == array()) {
                             $clone['placeholders'][$phName]['blocks'] = array();
                         } else {
                             if (!empty($params['placeholders'][$phName]['overwrite'])) {
                                 $clone['placeholders'][$phName]['blocks'] = array();
                             }
                             foreach ($params['placeholders'][$phName]['blocks'] as $block) {
                                 if (!empty($block['name'])) {
                                     if (empty($block['visibility'])) {
                                         $block['visibility'] = 'visible';
                                     }
                                     array_push($clone['placeholders'][$phName]['blocks'], $block);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $this->_writeYAML($params['page_name'], $clone);
         // save 'new_page.php.yml'
         $this->_writeYAML($params['page_name'], $clone, true);
         // save 'new_page.php.restore.yml'
     } else {
         CTrace::err("ClonePage: cloning page {$params['cloned_page']} doesn't exist");
     }
 }
コード例 #2
0
 /**
  *
  *
  * @return null
  */
 function initModules()
 {
     global $application, $zone;
     $lang = _ml_strtolower($application->getAppIni('LANGUAGE'));
     $moduleListCache = $application->getMMCache();
     if (isset($_SERVER['QUERY_STRING']) and $_SERVER['QUERY_STRING'] == 'update_all_modules') {
         CCacheFactory::clearAll();
         $this->resetAllModulesStatus();
         $_die_after_init = true;
     } else {
         $_die_after_init = false;
     }
     if (!$this->isModuleInstalled('Modules_Manager')) {
         $this->installModule($this->getModuleInfoFromFile($this->modules_directory . 'Modules_Manager'));
         CCacheFactory::clearAll();
     } else {
         /* Upgrade Main Store SQL- start*/
         $mmInfo = $this->getModuleInfoFromFile($this->modules_directory . 'Modules_Manager');
         if (version_compare($this->getModuleVersion($mmInfo->name), $mmInfo->version) < 0) {
             $oldVersionexplode = explode(".", $this->getModuleVersion($mmInfo->name));
             $oldModuleVersion = $oldVersionexplode[2];
             $upgradeFolder = $application->appIni['PATH_SYSTEM_DIR'] . "dbupdates/";
             $this->executeUpgradeSQL($oldModuleVersion, $upgradeFolder);
         }
         /* Upgrade Main Store SQL-end */
     }
     if (!$this->isModuleInstalled('Resources')) {
         $this->installModule($this->getModuleInfoFromFile($this->modules_directory . 'Resources'));
         // aquire system and CZ messages
         modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'system-messages-' . $lang . '.ini', 'SYS', 'system_messages', 'AZ');
         $_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/avactis-themes/system/resources/messages.ini';
         modApiFunc("Resources", "addResourceIniToDB", $_path, 'CZ', 'customer_messages', 'CZ');
         CCacheFactory::clearAll();
     }
     if (!$this->isModuleInstalled('MultiLang')) {
         modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'multilang-messages-' . $lang . '.ini', 'ML', 'MultiLang', 'AZ');
         $this->installModule($this->getModuleInfoFromFile($this->modules_directory . 'multilang'));
         $this->isModuleInstalled('MultiLang', true);
         //                  ,
         CCacheFactory::clearAll();
     }
     if (!$this->isModuleInstalled('Configuration')) {
         modApiFunc("Resources", "addResourceIniToDB", $application->getAppIni('PATH_ADMIN_RESOURCES') . 'configuration-messages-' . $lang . '.ini', 'CFG', 'Configuration', 'AZ');
         $this->installModule($this->getModuleInfoFromFile($this->modules_directory . 'configuration'));
         $this->isModuleInstalled('Configuration', true);
         //                  ,
         CCacheFactory::clearAll();
     }
     if (!$this->isModuleInstalled('EventsManager')) {
         $this->installModule($this->getModuleInfoFromFile($this->modules_directory . 'eventsmanager'));
         $this->isModuleInstalled('EventsManager', true);
         //                  ,
         CCacheFactory::clearAll();
     }
     if ($application->db->DB_isTableExists($application->getAppIni('DB_TABLE_PREFIX') . "sessions") == false) {
         $tables['sessions'] = array();
         $tables['sessions']['columns'] = array('ses_id' => 'sessions.ses_id', 'ses_time' => 'sessions.ses_time', 'ses_value' => 'sessions.ses_value', 'ses_locked' => 'sessions.ses_locked');
         $tables['sessions']['types'] = array('ses_id' => DBQUERY_FIELD_TYPE_CHAR32 . ' NOT NULL DEFAULT \'\'', 'ses_time' => DBQUERY_FIELD_TYPE_INT . ' NOT NULL DEFAULT 0', 'ses_value' => DBQUERY_FIELD_TYPE_LONGTEXT . ' NOT NULL ', 'ses_locked' => DBQUERY_FIELD_TYPE_INT . ' NOT NULL DEFAULT 0');
         $tables['sessions']['primary'] = array('ses_id');
         $tables['sessions']['indexes'] = array('IDX_time' => 'ses_time', 'IDX_locked' => 'ses_locked');
         $query = new DB_Table_Create($application->addTablePrefix($tables));
     }
     $this->moduleList = $moduleListCache->read('ModulesList');
     $this->apiFiles = $moduleListCache->read('apiFiles');
     $this->modulesResFiles = $moduleListCache->read('modulesResFiles');
     $this->shortNamesToResFiles = $moduleListCache->read('shortNamesToResFiles');
     $this->actionList = $moduleListCache->read('actionList');
     $this->czViewList = $moduleListCache->read('czViewList');
     $this->azViewList = $moduleListCache->read('azViewList');
     $this->czAliasesList = $moduleListCache->read('czAliasesList');
     $this->hookList = $moduleListCache->read('hookList');
     $this->blocksList = $moduleListCache->read('blocksList');
     $this->SectionByView = $moduleListCache->read('SectionByView');
     $this->ViewBySection = $moduleListCache->read('ViewBySection');
     $this->storefrontLayout = $moduleListCache->read('storefrontLayout');
     if (!$this->hookList) {
         $this->hookList = array();
     }
     if (!isset($this->moduleList)) {
         $this->moduleList = array();
         /** installed Extensions Array **/
         $installedExtensionArray = $this->getInstalledExtensionModuleInfo();
         /* Processing for avactis-extensions directory-Begin*/
         $dir = @dir($application->getAppIni("PATH_ADD_MODULES_DIR"));
         if (is_dir($application->getAppIni("PATH_ADD_MODULES_DIR")) && is_readable($application->getAppIni("PATH_ADD_MODULES_DIR"))) {
             while ($file = $dir->read()) {
                 if ($file != '..' && $file != '.' && is_dir($application->getAppIni("PATH_ADD_MODULES_DIR") . $file)) {
                     $moduleInfo = $this->getModuleInfoFromFile($this->add_modules_directory . $file);
                     $isExtensionNotInstalled = true;
                     if (isset($installedExtensionArray[$moduleInfo->name])) {
                         $isExtensionNotInstalled = $installedExtensionArray[$moduleInfo->name]['module_active'];
                     }
                     if ($isExtensionNotInstalled && $moduleInfo != null) {
                         $this->moduleList[$moduleInfo->name] = $moduleInfo;
                     }
                 }
             }
         }
         /* Processing for avactis-extensions directory-End*/
         $dir = @dir($application->getAppIni("PATH_MODULES_DIR"));
         while ($file = $dir->read()) {
             if ($file != '..' && $file != '.' && !is_dir($application->getAppIni("PATH_ADD_MODULES_DIR") . $file) && is_dir($application->getAppIni("PATH_MODULES_DIR") . $file)) {
                 $moduleInfo = $this->getModuleInfoFromFile($this->modules_directory . $file);
                 if ($moduleInfo != null) {
                     //
                     $this->moduleList[$moduleInfo->name] = $moduleInfo;
                 }
             }
         }
         asort($this->moduleList);
         foreach ($this->moduleList as $module_name => $moduleInfo) {
             // check if the files of the module exist.
             $this->checkModuleFiles($moduleInfo);
             // save the class name of the module and the whole path to its main file in the list
             $this->apiFiles[_ml_strtolower($moduleInfo->name)] = $moduleInfo->mainFile;
             // save all extra API classes and their files
             if (is_array($moduleInfo->extraAPIFiles)) {
                 foreach ($moduleInfo->extraAPIFiles as $class => $file) {
                     $this->apiFiles[_ml_strtolower($class)] = $file;
                 }
             }
             if ($moduleInfo->shortName != null and isset($this->modulesResFiles[$moduleInfo->shortName])) {
                 unset($this->moduleList[$moduleInfo->name]);
                 CTrace::err('Duplicate Short Name ' . $moduleInfo->shortName);
                 continue;
             }
             $res_file_suffix = '-' . _ml_strtolower($application->getAppIni('LANGUAGE')) . '.ini';
             $res_files_common_location = $application->getAppIni('PATH_ADMIN_RESOURCES');
             if ($moduleInfo->resFile != null and $moduleInfo->shortName != null) {
                 /*
                  *        $this->modulesResFiles
                  *                        .                                                   .
                  */
                 $res_file_in_module = $this->store_dir . $moduleInfo->directory . 'resources/' . $moduleInfo->resFile . $res_file_suffix;
                 $res_file_in_common_location = $res_files_common_location . $moduleInfo->resFile . $res_file_suffix;
                 if ($moduleInfo->shortName == null) {
                     _fatal("Module {$moduleInfo->name} has no short name.");
                 }
                 if (isset($this->shortNamesToResFiles[$moduleInfo->resFile])) {
                     _fatal("Duplicate Res File for {$moduleInfo->name}.");
                 } else {
                     $this->shortNamesToResFiles[$moduleInfo->resFile] = $moduleInfo->shortName;
                 }
                 if (file_exists($res_file_in_module)) {
                     $this->modulesResFiles[$moduleInfo->shortName] = $res_file_in_module;
                 } else {
                     if (file_exists($res_file_in_common_location)) {
                         $this->modulesResFiles[$moduleInfo->shortName] = $res_file_in_common_location;
                     }
                 }
             }
             //                                   API              .
             //                                  .
             if (PRODUCT_VERSION_TYPE == 'TRUNK') {
                 $this->checkModuleAPIClass($moduleInfo);
             }
             //                   ,
             //                                ,                       .
             // get text resources from the res file and put it into the database
             if (!$this->isModuleInstalled($moduleInfo->name)) {
                 if (!isset($moduleInfo->shortName)) {
                     _fatal("No short name for {$moduleInfo->name}!");
                 }
                 if (isset($this->modulesResFiles[$moduleInfo->shortName]) && file_exists($this->modulesResFiles[$moduleInfo->shortName])) {
                     modApiFunc("Resources", "dropMessageMetaByMetaId", $moduleInfo->shortName);
                     modApiFunc("Resources", "dropMessageGroupByMetaId", $moduleInfo->shortName);
                     modApiFunc("Resources", "addResourceIniToDB", $this->modulesResFiles[$moduleInfo->shortName], $moduleInfo->shortName, $moduleInfo->name, 'AZ');
                 } else {
                     // no res file for module
                 }
             }
             $this->installModule($moduleInfo);
             // update       ,
             //       ,                modules               updated                   .
             $this->updateModule($moduleInfo);
             //                       actions
             foreach ($moduleInfo->actionFiles as $actionName => $actionFile) {
                 $this->actionList[$actionName] = $actionFile;
             }
             // save the list of all views for CustomerZone
             foreach ($moduleInfo->czViewFiles as $viewName => $viewFile) {
                 $this->czViewList[$viewName] = $viewFile;
             }
             // save the list of all views for AdminZone
             foreach ($moduleInfo->czAliases as $alias => $viewName) {
                 $this->czAliasesList[$alias] = $viewName;
             }
             // save the list of all views for AdminZone
             foreach ($moduleInfo->azViewFiles as $viewName => $viewFile) {
                 $this->azViewList[$viewName] = $viewFile;
             }
             // save a list of all hooks
             foreach ($moduleInfo->hookMap as $hookName => $actionList) {
                 foreach ($actionList as $actionName) {
                     if (!key_exists($actionName, $this->hookList)) {
                         $this->hookList[$actionName] = array();
                     }
                     $this->hookList[$actionName][$hookName] = $moduleInfo->hookFiles[$hookName];
                 }
             }
             // save a list of blocks
             if (file_exists($this->store_dir . $moduleInfo->directory . 'blocks.yml')) {
                 $this->blocksList[] = $this->store_dir . $moduleInfo->directory . 'blocks.yml';
             }
             // sections by view
             if (!empty($moduleInfo->SectionByView)) {
                 $this->SectionByView = $moduleInfo->SectionByView;
             }
             // views by section
             if (!empty($moduleInfo->ViewBySection)) {
                 $this->ViewBySection = $moduleInfo->ViewBySection;
             }
             // storefront Layout addition
             if ($moduleInfo->storefrontLayout && file_exists($this->store_dir . $moduleInfo->directory . $moduleInfo->storefrontLayout)) {
                 if (!$this->storefrontLayout) {
                     $this->storefrontLayout = array();
                 }
                 $this->storefrontLayout = array_merge($this->storefrontLayout, _parse_ini_file($this->store_dir . $moduleInfo->directory . $moduleInfo->storefrontLayout, true));
             }
         }
         if (PRODUCT_VERSION_TYPE != 'TRUNK') {
             $moduleListCache->write('ModulesList', $this->moduleList);
             $moduleListCache->write('apiFiles', $this->apiFiles);
             $moduleListCache->write('modulesResFiles', $this->modulesResFiles);
             $moduleListCache->write('shortNamesToResFiles', $this->shortNamesToResFiles);
             $moduleListCache->write('actionList', $this->actionList);
             $moduleListCache->write('czViewList', $this->czViewList);
             $moduleListCache->write('azViewList', $this->azViewList);
             $moduleListCache->write('czAliasesList', $this->czAliasesList);
             $moduleListCache->write('hookList', $this->hookList);
             $moduleListCache->write('blocksList', $this->blocksList);
             $moduleListCache->write('SectionByView', $this->SectionByView);
             $moduleListCache->write('ViewBySection', $this->ViewBySection);
             $moduleListCache->write('storefrontLayout', $this->storefrontLayout);
         }
     } else {
         CTrace::inf('Bypass loading of module list (use cached).');
     }
     if (!defined('COMPILED_MODULES_LOADED')) {
         foreach ($this->moduleList as $module_name => $moduleInfo) {
             // if the file of module constants is specfifed, then load it.
             if ($moduleInfo->constantsFile !== null) {
                 $this->includeFile($moduleInfo->constantsFile);
             }
             // load common db queries
             $common_db_queries_file = $moduleInfo->directory . 'dbqueries/common.php';
             if (file_exists($this->store_dir . $common_db_queries_file)) {
                 $this->includeFile($common_db_queries_file);
             }
             //load extension default hooks
             if ($moduleInfo->ext_def_hooks !== null) {
                 $this->includeFile($moduleInfo->ext_def_hooks);
             }
             $this->includeFile($moduleInfo->directory . '/asc-hooks.php');
         }
     } else {
         CTrace::inf('Bypass constants and queries including (use precompiled).');
     }
     if (!defined('MODULES_VIEWS_REGISTERED')) {
         if ($zone == 'CustomerZone') {
             foreach ($this->moduleList as $module_name => $moduleInfo) {
                 $this->registerViewList($moduleInfo->czViewFiles);
                 $this->registerAliasesList($moduleInfo->czAliases);
             }
         } else {
             foreach ($this->moduleList as $module_name => $moduleInfo) {
                 $this->registerViewList($moduleInfo->azViewFiles);
             }
         }
     } else {
         CTrace::inf('Bypass modules views registering (use precompiled).');
     }
     if ($_die_after_init === true) {
         die('Message');
     }
 }
コード例 #3
0
/**
 * The global function to generate the fatal error.
 *
 * <code>
 * _fatal(string $code [, mixed $var1 [, mixed $var2 [, ...]]])
 * </code>
 * Error code $code and a certain number of variables are passed in
 * the function. They are inserted to the text of the error message,
 * which matches the error code. Error codes and their texts are stored
 * in the resource files templates/resources/<module_name>.ini
 *
 * @see Resource
 * @see _warning()
 * @ function is not completed
 * @access public
 * @return
 */
function _fatal($msg)
{
    global $application, $zone;
    $numargs = func_num_args();
    $listargs = func_get_args();
    $args = array();
    if ($numargs > 1) {
        for ($i = 1; $i < $numargs; $i++) {
            $args['{' . ($i - 1) . '}'] = $listargs[$i];
        }
    }
    if (isset($application)) {
        $lang = _ml_strtolower($application->getAppIni('LANGUAGE'));
        if (!isset($lang) || $lang == '') {
            $lang = 'eng';
        }
        $path = $application->getAppIni('PATH_ADMIN_RESOURCES');
        $filename = 'system-messages-' . $lang . '.ini';
        $messages_resources = @_parse_ini_file($path . $filename);
    }
    if (isset($listargs[0]["CODE"])) {
        // Code
        $err_code = $listargs[0]["CODE"];
    }
    if (isset($listargs[0]["MODULE"])) {
        // Module
        $err_module = $listargs[0]["MODULE"];
    }
    if (isset($listargs[0]["DIRECTIVE"])) {
        // Directive
        $err_directive = $listargs[0]["DIRECTIVE"];
    }
    if (isset($listargs[0]["SECTION"])) {
        // Section
        $err_section = $listargs[0]["SECTION"];
    }
    if (isset($listargs[0]["FILE"])) {
        // File
        $err_file = $listargs[0]["FILE"];
    } elseif (isset($listargs[0]["file"])) {
        $err_file = $listargs[0]["file"];
    }
    if (isset($listargs[0]["LINE"])) {
        // Line
        $err_line = $listargs[0]["LINE"];
    } elseif (isset($listargs[0]["line"])) {
        $err_line = $listargs[0]["line"];
    }
    if (isset($listargs[0]["MESSAGE"])) {
        // Message
        $err_message = $listargs[0]["MESSAGE"];
    } elseif (isset($messages_resources[$listargs[0]["CODE"]])) {
        $err_message = strtr($messages_resources[$listargs[0]["CODE"]], $args);
    } elseif (isset($listargs[0]["message"])) {
        $err_message = $listargs[0]["message"];
    }
    CTrace::err('Fatal Error: ' . (isset($zone) ? $zone : 'Unspecified Zone') . "\n" . (isset($err_code) ? "Code = {$err_code}\n" : '') . (isset($err_module) ? "Module = {$err_module}\n" : '') . "Referer = " . $_SERVER['PHP_SELF'] . "\n" . (isset($err_file) ? "File = {$err_file}\n" : '') . (isset($err_line) ? "Line = {$err_line}\n" : '') . (isset($err_message) ? "Message = {$err_message}" : ''));
    CTrace::backtrace();
    if (isset($zone) && $zone == 'CustomerZone' && isset($application)) {
        header("location:" . $application->appIni['SITE_URL'] . "internal-server-error.html", TRUE, 307);
        die;
    } elseif (isset($zone) && $zone == 'CustomerZone') {
        header("location:internal-server-error.html", TRUE, 307);
        die;
    }
    if (is_array($listargs[0])) {
        if (isset($listargs[0])) {
            $header = "<!DOCTYPE HTML>\n";
            $header .= "<HTML><HEAD><TITLE>Tags Errors and Warnings</TITLE>";
            $header .= "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n";
            $header .= "<LINK HREF=\"../../includes/bootstrap/css/bootstrap.min.css\" TYPE=\"text/css\" REL=\"stylesheet\">\n";
            $header .= "</HEAD><BODY><DIV class='container'><br /><br /><br /><br />\n";
            $subtitle = "<div class='alert alert-danger'><h1>%s</h1>\n";
            $subtitle .= "<strong>Error Code:</strong> %s</div>\n";
            $tablecontent = "%s<br /><br />\n";
            $tablecontent .= "%s\n";
            $source_line = "<strong>%s</strong>\n";
            $source_line .= "%s<br />\n";
            $output = $header;
            $source = "";
            if (isset($err_file)) {
                $source .= sprintf($source_line, "File:", $err_file);
            }
            if (isset($err_line)) {
                $source .= sprintf($source_line, "Line:", $err_line);
            }
            if (isset($err_section)) {
                $source .= sprintf($source_line, "Section:", "[" . $err_section . "]");
            }
            if (isset($err_directive)) {
                $source .= sprintf($source_line, "Directive:", $err_directive);
            }
            if (isset($err_module)) {
                $source .= sprintf($source_line, "Module:", $err_module);
            }
            if (isset($err_message)) {
                $source .= sprintf($source_line, "Message:", $err_message);
            }
            $content = sprintf($tablecontent, $listargs[0]["CODE"], $source);
            $output .= sprintf($subtitle, "FATAL Core Error", $content);
            $footer = "</DIV></BODY></HTML>";
            $output .= $footer;
            die($output);
        } else {
            die(print_r($listargs[0], true));
        }
    } else {
        $msg = '';
        foreach ($listargs as $a) {
            $msg .= $a . "<br>\n";
        }
        die('<B><FONT COLOR="red">FATAL ERROR</FONT></B><br> ' . $msg);
    }
}
コード例 #4
0
 /**
 * Sends the mail.
 *
 * @param  array  $recipients
 * @param  string $type OPTIONAL
 * @return mixed
 */
 function send($recipients, $type = 'mail')
 {
     if (!defined('CRLF')) {
         //$this->setCrlf( "\r\n" ); // used to separate header lines
     }
     if (!$this->is_built) {
         $this->buildMessage();
     }
     switch ($type) {
         case 'mail':
             $subject = '';
             if (!empty($this->headers['Subject'])) {
                 $subject = $this->_encodeHeader($this->headers['Subject'], $this->build_params['head_charset']);
                 unset($this->headers['Subject']);
             }
             // Get flat representation of headers
             foreach ($this->headers as $name => $value) {
                 $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']);
             }
             $to = $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']);
             if (!empty($this->return_path)) {
                 $result = @mail($to, $subject, $this->output, implode(CRLF, $headers), '-f' . $this->return_path);
             } else {
                 $result = @mail($to, $subject, $this->output, implode(CRLF, $headers));
             }
             // Reset the subject in case mail is resent
             if ($subject !== '') {
                 $this->headers['Subject'] = $subject;
             }
             // Return
             return $result;
             break;
         case 'smtp':
             require_once dirname(__FILE__) . '/phpmailer/PHPMailerAutoload.php';
             require_once dirname(__FILE__) . '/RFC822.php';
             //remove//		$smtp = &smtp::connect($this->smtp_params);
             $mail = new PHPMailer();
             $mail->isSMTP();
             // Set mailer to use SMTP
             $mail->XMailer = 'PHPMailer';
             $mail->Host = $this->smtp_params['host'];
             // Specify main and backup server
             $mail->Port = $this->smtp_params['port'];
             // SMTP port
             //                $mail->SMTPSecure = 'ssl';								// Enable encryption, 'ssl' also accepted
             $mail->SMTPAuth = $this->smtp_params['auth'];
             // Enable SMTP authentication
             $mail->Username = $this->smtp_params['user'];
             // SMTP username
             $mail->Password = $this->smtp_params['pass'];
             // SMTP password
             $mail->Subject = $this->headers['Subject'];
             $isHTML = !empty($this->html) ? true : false;
             $mail->IsHTML($isHTML);
             // sets ContentType to text or html
             $mail->Body = $this->output;
             if (isset($this->html_text) && !empty($this->html_text)) {
                 $mail->AltBody = $this->html_text;
             }
             // Parse recipients argument for internet addresses
             foreach ($recipients as $recipient) {
                 $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false);
                 foreach ($addresses as $address) {
                     $mail->addAddress(sprintf('%s@%s', $address->mailbox, $address->host), $address->personal);
                     //remove//				$smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host);
                 }
             }
             unset($addresses);
             // These are reused
             unset($address);
             // These are reused
             // Get flat representation of headers, parsing
             // Cc and Bcc as we go
             foreach ($this->headers as $name => $value) {
                 if ($name == 'Cc' or $name == 'Bcc') {
                     $addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false);
                     foreach ($addresses as $address) {
                         $mail->addCC(sprintf('%s@%s', $address->mailbox, $address->host), $address->personal);
                         //remove//					$smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host);
                     }
                 }
                 if ($name == 'Bcc') {
                     /*						$addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false);
                     						foreach ($addresses as $address) {
                     							$mail->addBCC(sprintf('%s@%s', $address->mailbox, $address->host),$address->personal);
                     						}
                     */
                     continue;
                 }
                 //remove//			$headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']);
             }
             //remove//		// Add To header based on $recipients argument
             //remove//		$headers[] = 'To: ' . $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']);
             //remove//		// Add headers to send_params
             //remove//		$send_params['headers']    = $headers;
             //remove//		$send_params['recipients'] = array_values(array_unique($smtp_recipients));
             //remove//		$send_params['body']       = $this->output;
             // Setup return path
             if (isset($this->return_path)) {
                 $mail->ReturnPath = $this->return_path;
             }
             if (!empty($this->headers['From'])) {
                 $from = Mail_RFC822::parseAddressList($this->headers['From']);
                 //remove//			$send_params['from'] = sprintf('%s@%s', $from[0]->mailbox, $from[0]->host);
                 $mail->setFrom(sprintf('%s@%s', $from[0]->mailbox, $from[0]->host), $from[0]->personal);
                 $mail->addReplyTo(sprintf('%s@%s', $from[0]->mailbox, $from[0]->host), $from[0]->personal);
             } else {
                 $mail->From = 'postmaster@' . $this->smtp_params['helo'];
             }
             // Send it
             //remove//		if (!$smtp->send($send_params)) {
             //remove//			$this->errors = $smtp->errors;
             if (!$mail->send()) {
                 $this->errors = $mail->ErrorInfo;
                 CTrace::err('Mail sending error: ' . $this->errors);
                 return false;
             }
             return true;
             break;
     }
 }