示例#1
0
 function enumerate()
 {
     extract(tep_load('defs', 'database'));
     $plugins_query_raw = "select plugins_key, plugins_data from " . TABLE_PLUGINS . " where front_end='1'";
     $plugins_array = $db->query_to_array($plugins_query_raw);
     for ($i = 0, $j = count($plugins_array); $i < $j; $i++) {
         $plugins_data = array();
         if (!empty($plugins_array[$i]['plugins_data'])) {
             $tmp_data = unserialize($plugins_array[$i]['plugins_data']);
             if (!isset($tmp_data[$this->site_index])) {
                 continue;
             }
             $plugins_data = $tmp_data[$this->site_index];
         }
         if (!isset($plugins_data['status_id']) || !$plugins_data['status_id']) {
             continue;
         }
         if (isset($plugins_data['fscripts']) && is_array($plugins_data['fscripts'])) {
             for ($load = false, $i2 = 0, $j2 = count($plugins_data['fscripts']); $i2 < $j2; $i2++) {
                 if ($plugins_data['fscripts'][$i2] == $cDefs->script) {
                     $load = true;
                     break;
                 }
             }
             if (!$load) {
                 tep_log($plugin_key . ' request for ' . $cDefs->script . ' is undefined');
                 continue;
             }
         }
         $plugin_key = $plugins_array[$i]['plugins_key'];
         $executive = DIR_FS_PLUGINS . $plugin_key . '/' . $plugin_key . '.php';
         if (!is_file($executive)) {
             tep_log('Cannot find file ' . $executive);
             unset($plugins_array[$i]);
             continue;
         }
         include_once $executive;
         if (!class_exists($plugin_key)) {
             tep_log('Cannot find class ' . $plugin_key);
             unset($plugins_array[$i]);
             continue;
         }
         $plugins_array[$i]['sort_id'] = $plugins_data['sort_id'] . $plugin_key;
         $this->keys_array[$plugins_data['sort_id'] . $plugin_key] = $plugin_key;
     }
     $plugins_array = tep_array_invert_from_element($plugins_array, 'sort_id');
     ksort($plugins_array, SORT_NUMERIC);
     ksort($this->keys_array, SORT_NUMERIC);
     $this->plugins_array = array_values($plugins_array);
     $this->keys_array = array_flip(array_values($this->keys_array));
 }
示例#2
0
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)
{
    $from_email_address = trim(implode('', array_map('trim', explode("\n", $from_email_address))));
    $from_email_name = trim(implode('', array_map('trim', explode("\n", $from_email_name))));
    $email_text = tep_html_entity_decode($email_text);
    $recipients = explode(',', $to_email_address);
    reset($recipients);
    while (list(, $to_email_address) = each($recipients)) {
        $to_email_address = trim($to_email_address);
        if (tep_not_null($to_email_address)) {
            // Instantiate a new PHPMailer object
            $mail = new PHPMailer();
            $mail->CharSet = 'windows-1251';
            // Build the text version
            $text = strip_tags($email_text);
            $mail->SetFrom($from_email_address, $from_email_name);
            $mail->AddAddress($to_email_address, $to_name);
            $mail->Subject = $email_subject;
            $mail->AddReplyTo($from_email_address, $from_email_name);
            if (EMAIL_USE_HTML == 'true' && $from_email_address == STORE_OWNER_EMAIL_ADDRESS) {
                ob_start();
                include DIR_FS_CATALOG . 'images/mail/email_header.php';
                echo preg_replace('~[\\n\\r][\\n\\r]+~', '<br/><br/>', $email_text);
                include DIR_FS_CATALOG . 'images/mail/email_footer.php';
                $email_text_html = ob_get_clean();
                $email_text_html = str_replace('<title></title>', '<title>' . $email_subject . '</title>', $email_text_html);
                $mail->MsgHTML($email_text_html);
            } else {
                $mail->Body = $text;
            }
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
            // enable SMTP authentication
            //$mail->SMTPSecure = "ssl";               // sets the prefix to the servier
            //$mail->Host       = "ex.setbook.ru";       // sets the SMTP server
            $mail->Host = "mail.setbook.ru";
            // sets the SMTP server
            $mail->Port = 587;
            // set the SMTP port
            //$mail->Port       = 25;                   // set the SMTP port
            //$mail->Username   = "******";  // username
            $mail->Username = "******";
            // username
            $mail->Password = "******";
            // password
            if (!$mail->Send()) {
                tep_log("Mailer Error: " . $mail->ErrorInfo, $mail, 'mail.errors');
            }
        }
    }
}
示例#3
0
 function invoke()
 {
     extract(tep_load('defs'));
     $result = false;
     $args = func_get_args();
     if (!count($args)) {
         return $result;
     }
     $method = array_shift($args);
     if ($cDefs->ajax && substr($method, 0, strlen($this->ajax_prefix)) != $this->ajax_prefix) {
         //return $result;
     }
     for ($i = 0, $j = count($this->plugins_array); $i < $j; $i++) {
         $executive = $this->prefix . $this->plugins_array[$i]['plugins_key'];
         if (!isset($this->objects_array[$i])) {
             if ($this->plugins_array[$i]['display_box'] && $method != 'init_sessions') {
                 continue;
             }
             if ($this->plugins_array[$i]['display_box'] && $method == 'init_sessions') {
                 extract(tep_load('sessions'));
                 $box_method =& $cSessions->register('selected_box', 'config_box');
                 if (isset($_GET['selected_box']) && !empty($_GET['selected_box'])) {
                     $box_method = tep_sanitize_string($_GET['selected_box']);
                 }
                 if (!method_exists($executive, $box_method)) {
                     $this->plugins_array[$i]['status'] = false;
                 }
             }
             if ($this->plugins_array[$i]['status']) {
                 $this->objects_array[$i] = new $executive();
             } else {
                 tep_log('Invalid Plugin ' . $executive);
                 continue;
             }
         }
         $plugin = $this->objects_array[$i];
         if (method_exists($plugin, $method)) {
             $pass_args = array();
             foreach ($args as $value) {
                 $pass_args[] = $value;
             }
             $tmp_result = call_user_func_array(array(&$plugin, $method), $pass_args);
             if ($tmp_result) {
                 $result = true;
             }
         }
     }
     return $result;
 }
示例#4
0
 function dbg_log()
 {
     $log = tep_log();
 }