Exemple #1
0
 function admin_send($id)
 {
     $newsletter = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "newsletters WHERE id=" . $id . "");
     $users = $this->exec_all("SELECT username, email FROM " . DB_PREFIX . "users WHERE newsletter=1");
     foreach ($users as $user) {
         $message = str_replace("%username%", $user['username'], $newsletter['content']);
         tools::sendMail($user['email'], $newsletter['object'], $message);
     }
     $this->exec("UPDATE " . DB_PREFIX . "newsletters SET sent=1, sent_date='" . date("Y-m-d H:i:s") . "' WHERE id=" . $id . "");
     tools::setFlash($this->l('Request processed'), 'success');
     tools::redirect('/admin/newsletter');
 }
Exemple #2
0
 public function afterInsert($vars)
 {
     $name = $login = $vars[':pseudo'];
     $password = $this->_newPassword;
     $companyMail = \app::$config['mail']['adminMail'];
     ob_start();
     include 'admin/views/mail/registration.php';
     $body = ob_get_clean();
     if (\tools::sendMail($vars[':mail'], \app::$config['mail']['adminMail'], \app::$config['mail']['adminMail'], \t('Your profile has been created with success'), $body)) {
         return '1';
     } else {
         return '0';
     }
 }
Exemple #3
0
 public function contact()
 {
     if (!empty($_POST)) {
         $data = tools::filter($_POST);
         if (isset($_SESSION['user_id'])) {
             $user = $this->user->get($_SESSION['user_id']);
             $email = $user['email'];
         } else {
             $email = $data['email'];
         }
         tools::sendMail($this->settings['app']['contact_email'], $user['email'], $data['object'], $data['message']);
         tools::setFlash(SUCCESS_SENT, 'success');
         tools::redirect('/contact');
     }
     $this->smarty->display('contact.tpl');
 }
Exemple #4
0
 function reset()
 {
     if (isset($_POST['email'])) {
         $email = tools::filter($_POST['email']);
         $errors = tools::validate(array('email' => $email), false);
         if (!empty($errors)) {
             tools::setFlash($this->l('Invalid email'), 'error');
             tools::redirect('/user/reset');
         }
         if ($user = $this->user->getByEmail($email)) {
             $newPassword = substr(session_id(), 0, 8);
             if ($this->user->update($user['id'], array('ppasswd' => tools::generateHash($newPassword)))) {
                 // send new password to user
                 tools::sendMail($user['email'], 'password_reset', array('username' => $user['username'], 'password' => $newPassword));
                 tools::setFlash($this->l('A new password sent to you by email'), 'success');
             } else {
                 tools::setFlash($this->l('An error has occurred'), 'error');
             }
         } else {
             tools::setFlash($this->l('Email does not exist'), 'error');
         }
         tools::redirect('/user/reset');
     }
     $this->smarty->display('user/reset.tpl');
 }
Exemple #5
0
 public function afterInsert($vars)
 {
     $configs = \app::getModule('blog')->getConfigs();
     $reqhold = 'SELECT count(' . PREFIX . 'blog_comment.id_comment) from ' . PREFIX . 'blog_comment where ' . PREFIX . '.blog_comment.status = 0';
     $hold = \PDOconnection::getDB()->query($reqhold)->fetch();
     $holdcomments = $hold[0];
     if ($holdcomments == '') {
         $holdcomments = 0;
     }
     if (isset($vars[':author'])) {
         $author = $vars[':author'];
     }
     if (isset($vars[':author_email'])) {
         $author_email = $vars[':author_email'];
     }
     $id_comment = $vars[':id_comment'];
     $id_post = $vars[':id_post'];
     $author_ip = $vars[':author_ip'];
     $author_url = $vars[':author_url'];
     $content = $vars[':content'];
     $remote = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $author_ip;
     $postquery = "SELECT blog_post.title, blog_post.url from blog_post where id_post =" . $id_post;
     $posttitle = '';
     $posturl = '';
     $params = \PDOconnection::getDB()->query($postquery);
     foreach ($params as $param) {
         $posttitle = $param['title'];
         $posturl = $param['url'];
     }
     // Email me when anyone posts a comment mailForAnyPost or a comment is held for moderation
     if ($configs['mailForAnyPost'] == '1' || $configs['heldModeration'] == '1' && $vars[':status'] == '0') {
         // if block config provides mailing before moderation
         $titre = utf8_decode('Comment Moderation for ' . $posttitle . ' (' . $vars[':date'] . ')');
         $message = t('A new comment on', FALSE) . ' ' . $posttitle . ' ' . t('is held for moderation', FALSE);
         $message .= '<br><A href="' . $posturl . '">' . $posturl . '</A><br>';
         $message .= '<br>' . isset($vars[':author']) ? t('Author :') . $author : '' . t('(IP :') . $author_ip . ',' . $remote . ' )';
         if (isset($vars[':author_email'])) {
             $message .= '<br>' . t('E-mail :') . '<A href="mailto:' . $author_email . '">' . $author_email . '</A>';
         }
         $message .= '<br>' . t('Website :') . $author_url;
         $message .= '<br>' . t('Whois :') . '<A href="' . 'http://whois.arin.net/rest/ip/' . $author_ip . '">' . 'http://whois.arin.net/rest/ip/' . $author_ip . '</a>';
         $message .= '<br>' . t('Comment :') . $content . '<br>' . t('ID Comment') . $id_comment;
         $message .= '<br>' . '<A href="' . BASE_PATH . 'index#modules/model/blog/comment">' . BASE_PATH . 'index#modules/model/blog/comment</a>';
         $message .= '<br>' . t('Right now, ' . $holdcomments . ' comments await your approval', false) . '.';
         $message = utf8_decode($message);
         $adminmail = \app::$config['mail']['adminMail'];
         ob_start();
         include 'blog/views/mail/moderationmail.php';
         $body = ob_get_clean();
         if (\tools::sendMail($adminmail, '' . $adminmail . '', '' . $adminmail . '', $titre, $body)) {
             return true;
         } else {
             return false;
         }
     }
     // else config provides mailing after previous approved comment
     if ($configs['previousComment'] == '1' && $vars[':status'] == '1') {
         $titre = utf8_decode('Approved comment for ' . $posttitle . ' (' . $vars[':date'] . ')');
         $message = t('New approved comment on', FALSE) . ' ' . $posttitle;
         $message .= '<br><A href="' . $posturl . '">' . $posturl . '</A><br>';
         $message .= '<br>' . isset($vars[':author']) ? t('Author :') . $author : '' . t('(IP :') . $author_ip . ',' . $remote . ' )';
         if (isset($vars[':author_email'])) {
             $message .= '<br>' . t('E-mail :') . '<A href="mailto:' . $author_email . '">' . $author_email . '</A>';
         }
         $message .= '<br>' . t('Website :') . $author_url;
         $message .= '<br>' . t('Whois :') . '<A href="' . 'http://whois.arin.net/rest/ip/' . $author_ip . '">' . 'http://whois.arin.net/rest/ip/' . $author_ip . '</a>';
         $message .= '<br>' . t('Comment :') . $content . '<br>' . t('ID Comment') . $id_comment;
         $message .= '<br>' . '<A href="' . BASE_PATH . 'index#modules/model/blog/comment">' . BASE_PATH . 'index#modules/model/blog/comment</a>';
         $message .= '<br>' . t('Right now, ' . $holdcomments . ' comments await your approval', false) . '.';
         $message = utf8_decode($message);
         $adminmail = \app::$config['mail']['adminMail'];
         ob_start();
         include 'blog/views/mail/moderationmail.php';
         $body = ob_get_clean();
         if (\tools::sendMail($adminmail, '' . $adminmail . '', '' . $adminmail . '', $titre, $body)) {
             return true;
         } else {
             return false;
         }
     }
 }
Exemple #6
0
 function admin_send_message($id)
 {
     if (isset($_POST['message'])) {
         $message = $this->exec_one("SELECT id, object, sender_id FROM " . DB_PREFIX . "messages WHERE id=" . $id . "");
         if (!empty($message)) {
             $post_data = tools::filter($_POST);
             $sql_request = $this->exec("INSERT INTO " . DB_PREFIX . "messages (object, message, sender_id, receiver_id, discuss_id, created) \r\n\t\t\t\t\t\t\t\tVALUES('" . $message['object'] . "', '" . $_POST['message'] . "', '1', '" . $message['sender_id'] . "', '" . $message['id'] . "', '" . date("Y-m-d H:i:s") . "')");
             $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'contact_response' AND language = '" . $this->settings['app']['language'] . "'");
             $user = $this->exec_one("SELECT username, email FROM " . DB_PREFIX . "users WHERE id=" . $message['sender_id'] . "");
             $message = str_replace("%username%", $user['username'], $email_template['content']);
             tools::sendMail($user['email'], $email_template['object'], $message);
             tools::setFlash(SUCCESS_SENT, 'success');
             tools::redirect('/admin/dashboard/messages');
         }
     }
 }
Exemple #7
0
 function paypal_ipn()
 {
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = trim(urlencode(stripslashes($value)));
         $req .= "&{$key}={$value}";
     }
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     //$header = "POST https://www.sandbox.paypal.com/cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
     $fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
     // variables
     $control = explode('#', $_POST['custom']);
     $model = $control[0];
     $id = $control[1];
     $user_id = $control[2];
     $coupon_id = $control[3];
     $price = $_POST['mc_gross'];
     if (!$fp) {
         tools::sendMail($this->settings['app']['contact_email'], "Paypal IPN error", ERROR_PAYPAL_IPN);
     } else {
         fputs($fp, $header . $req);
         while (!feof($fp)) {
             $res = fgets($fp, 1024);
             if (strcmp($res, "VERIFIED") == 0) {
                 switch ($model) {
                     case 'auction':
                         $auction = $this->exec_one("SELECT a.id, a.product_id, p.name, p.price as product_price FROM " . DB_PREFIX . "auctions a, " . DB_PREFIX . "products p WHERE a.id=" . $id . " AND p.id=a.product_id");
                         $user = $this->exec_one("SELECT email, username FROM " . DB_PREFIX . "users WHERE id = " . $this->safe($user_id) . "");
                         // update auction status
                         $this->exec("UPDATE " . DB_PREFIX . "auctions SET status_id=5, payment='1#" . date("Y-m-d H:i:s") . "', modified='" . date("Y-m-d H:i:s") . "' WHERE id=" . $id . "");
                         // add product buy
                         $this->exec("INSERT INTO " . DB_PREFIX . "products_buys (auction_id, price, payment_id, created) VALUES('" . $id . "', '" . $this->safe($price) . "', '1', '" . date("Y-m-d H:i:s") . "')");
                         // update product stock
                         $this->exec("UPDATE " . DB_PREFIX . "products SET stock_number=stock_numer-1 WHERE id=" . $auction['product_id'] . "");
                         // send confirmation email
                         $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'email_confirm_payment_auction' AND language = '" . $this->settings['app']['language'] . "'");
                         $message = str_replace("%username%", $user['username'], $email_template['content']);
                         $message = str_replace("%auction_id%", $id, $message);
                         tools::sendMail($user['email'], $email_template['object'], $message);
                         // add credits if pack auction
                         if (strpos($auction['name'], 'Pack')) {
                             $credits = $auction['product_price'] * $this->settings['app']['bid_value'];
                             $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created)\r\n\t\t\t\t\t\t\t\t\t\t\t VALUES('" . $this->safe($user_id) . "', 'package_win#" . $auction['name'] . "', '" . $credits . "', '" . date("Y-m-d H:i:s") . "')");
                             unlink(_DIR_ . '/data/bids_balance_' . $user_id);
                         }
                         break;
                     case 'credits':
                         $auction = $this->exec_one("SELECT p.name, p.price as product_price, a.product_id, a.price FROM " . DB_PREFIX . "auctions a, " . DB_PREFIX . "products p WHERE a.id=" . $id . " AND p.id=a.product_id");
                         $user = $this->exec_one("SELECT email, username FROM " . DB_PREFIX . "users WHERE id = " . $this->safe($user_id) . "");
                         $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'email_confirm_payment_credits' AND language = '" . $this->settings['app']['language'] . "'");
                         $message = str_replace("%username%", $user['username'], $email_template['content']);
                         $message = str_replace("%auction_id%", $id, $message);
                         $message = str_replace("%product_name%", $auction['name'], $message);
                         $nb_credits = $auction['product_price'] / $this->settings['app']['bid_value'];
                         $message = str_replace("%credits%", $nb_credits, $message);
                         $message = str_replace("%price%", $auction['price'], $message);
                         $this->send_mail($user['email'], $email_template['object'], $message);
                         $this->exec("UPDATE " . DB_PREFIX . "auctions SET status_id=5, payment='1#" . date("Y-m-d H:i:s") . "', modified='" . date("Y-m-d H:i:s") . "' WHERE id=" . $id . "");
                         // restart the auction
                         if ($this->settings['app']['auction_autostart']) {
                             $this->exec("INSERT INTO " . DB_PREFIX . "auctions (product_id, status_id, active, created) VALUES('" . $auction['product_id'] . "', '1', '1', '" . date("Y-m-d h:i:s") . "')");
                         }
                         // add credits
                         $credits = round($auction['product_price'] / $this->settings['app']['bid_value']);
                         $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, auction_id, description, credit, created)\r\n\t\t\t\t\t\t\t\t\t\t VALUES('" . $user_id . "', '" . $id . "', 'credits_deal#" . $auction['name'] . "#" . $auction['product_id'] . "#" . $auction['product_price'] . "', '" . $credits . "', '" . date("Y-m-d H:i:s") . "')");
                         unlink(_DIR_ . '/data/bids_balance_' . $user_id);
                         break;
                     case 'package':
                         $package = $this->exec_one("SELECT id, name, bids FROM " . DB_PREFIX . "packages WHERE id=" . $id . "");
                         $user = $this->exec_one("SELECT username, email FROM " . DB_PREFIX . "users WHERE id=" . $this->safe($user_id) . "");
                         //check first time buying
                         $first_time = $this->exec_one("SELECT id FROM " . DB_PREFIX . "bids WHERE user_id=" . $this->safe($user_id) . " AND description LIKE 'package#%'");
                         if (empty($first_time)) {
                             $free_first_buy_credits = $this->exec_one("SELECT value FROM " . DB_PREFIX . "settings WHERE name='free_first_buy_credits'");
                             $bids = ceil($package['bids'] * $free_first_buy_credits['value'] / 100);
                             $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $user_id . "', 'package#" . $package['name'] . "#1', '" . $package['bids'] . "', '" . date("Y-m-d H:i:s") . "')");
                             //add free credits
                             $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $user_id . "', 'free#package', '" . $bids . "', '" . date("Y-m-d H:i:s") . "')");
                         } else {
                             $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $user_id . "', 'package#" . $package['name'] . "#1', '" . $package['bids'] . "', '" . date("Y-m-d H:i:s") . "')");
                         }
                         // check for submitted coupon
                         if (!empty($coupon_id)) {
                             $coupon = $this->exec_one("SELECT id, type, saving FROM " . DB_PREFIX . "coupons WHERE id=" . $this->safe($coupon_id) . "");
                             if ($coupon['type'] == 2) {
                                 $this->exec_one("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $user_id . "', 'free#coupon#" . $coupon['id'] . "', '" . $coupon['saving'] . "', '" . date("Y-m-d H:i:s") . "')");
                             } elseif ($coupon['type'] == 3) {
                                 $credits = $package['bids'] * $coupon['saving'] / 100;
                                 $this->exec_one("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $user_id . "', 'free#coupon#" . $coupon['id'] . "', '" . $credits . "', '" . date("Y-m-d H:i:s") . "')");
                             }
                             $this->exec("INSERT INTO " . DB_PREFIX . "coupons_submitted (user_id, coupon_id, created) VALUES('" . $user_id . "', '" . $coupon['id'] . "', '" . date("Y-m-d H:i:s") . "')");
                             unset($_SESSION['coupon_id']);
                         }
                         unlink(_DIR_ . '/data/bids_balance_' . $user_id);
                         // check referrer and add credits if referred
                         $referral = $this->exec_one("SELECT referrer_id FROM " . DB_PREFIX . "referrals WHERE user_id=" . $this->safe($user_id) . " AND confirmed=0");
                         if ($referral) {
                             $referrer = $this->exec_one("SELECT username, email FROM " . DB_PREFIX . "users WHERE id=" . $referral['referrer_id'] . "");
                             $this->exec("INSERT INTO " . DB_PREFIX . "bids (user_id, description, credit, created) VALUES('" . $referral['referrer_id'] . "', 'free#referral#" . $user['id'] . "', '" . $this->settings['app']['free_referral_buy_credits'] . "', '" . date("Y-m-d H:i:s") . "')");
                             $this->exec("UPDATE " . DB_PREFIX . "referrals SET confirmed=1 WHERE user_id=" . $this->safe($user_id) . "");
                             unlink(_DIR_ . '/cache/bids_balance_' . $referral['referrer_id']);
                             $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'email_referrer' AND language = '" . $this->settings['app']['language'] . "'");
                             $message = str_replace("%username%", $referrer['username'], $email_template['content']);
                             tools::sendMail($referrer['email'], $email_template['object'], $message);
                         }
                         // send notification
                         $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'email_confirm_payment_package' AND language = '" . $this->settings['app']['language'] . "'");
                         $message = str_replace("%username%", $user['username'], $email_template['content']);
                         $message = str_replace("%package%", $package['name'], $message);
                         tools::sendMail($user['email'], $email_template['object'], $message);
                         break;
                 }
             } else {
                 if (strcmp($res, "INVALID") == 0) {
                     tools::sendMail($this->settings['app']['contact_email'], "INVALID PAYPAL IPN", "");
                 }
             }
         }
         fclose($fp);
     }
 }
Exemple #8
0
 /**
  * Reset a user's password and send the new one by email
  * @param $userMail mail
  */
 public function resetPassword($userMail)
 {
     $newPass = substr(hash('sha1', uniqid(mt_rand())), 0, 8);
     \app::getModule('core')->getEntity('user')->where('mail = :mail')->update(array('pass' => $newPass, 'mail' => $userMail));
     $password = $newPass;
     ob_start();
     include 'admin/views/mail/remdp.php';
     $body = ob_get_clean();
     if (\tools::sendMail($userMail, \app::$config['mail']['adminMail'], \app::$config['mail']['adminMail'], 'Password reset', $body)) {
         return '1';
     } else {
         return '0';
     }
 }
Exemple #9
0
function closeAuction($auction = array())
{
    $db = Database::getInstance();
    $db->update("auctions", array('closed' => 1, 'end_time' => date('Y-m-d H:i:s')), "id = {$auction['id']}");
    usleep(250000);
    $bid = lastBid($auction['id']);
    if (!empty($bid)) {
        $db->update("auctions", array('winner_id' => $bid['user_id'], 'status_id' => 4), "id={$auction['id']}");
        // send email to winner
        $user = $db->getRow("SELECT username, email FROM " . DB_PREFIX . "users WHERE id=" . $bid['user_id']);
        tools::sendMail($user['email'], 'won_auction', array('username' => $user['username'], 'auction_id' => $auction['id']));
    }
    clearCache($auction['id']);
    $db->delete("extends", "auction_id = {$auction['id']}");
    if (!empty($auction['podium'])) {
        $podium_data = $db->getRows("SELECT DISTINCT user_id FROM " . DB_PREFIX . "bids WHERE auction_id=" . $auction['id'] . " AND (description = 'manual' OR description = 'auto') AND user_id != " . $bid['user_id'] . " ORDER BY id DESC LIMIT 2");
        $users = array();
        $i = 0;
        foreach ($podium_data as $podium) {
            $user_data = $db->getRow("SELECT username, email, autobidder FROM " . DB_PREFIX . "users WHERE id={$podium['user_id']}");
            $users[$i]['user_id'] = $podium['user_id'];
            $users[$i]['username'] = $user_data['username'];
            $users[$i]['email'] = $user_data['email'];
            $users[$i]['autobidder'] = $user_data['autobidder'];
            $i++;
        }
        if (empty($users[0]['autobidder'])) {
            $db->insert("bids", array('user_id' => $users[0]['user_id'], 'auction_id' => $auction['id'], 'description' => 'free_credits#podium#second', 'credit' => $auction['second_credits'], 'created' => date('Y-m-d H:i:s')));
        }
        if (empty($users[1]['autobidder'])) {
            $db->insert("bids", array('user_id' => $users[1]['user_id'], 'auction_id' => $auction['id'], 'description' => 'free_credits#podium#third', 'credit' => $auction['third_credits'], 'created' => date('Y-m-d H:i:s')));
        }
        $db->update("auctions", array('second' => $users[0]['username'], 'third' => $users[1]['username']), "id={$auction['id']}");
    }
}
Exemple #10
0
 function admin_start($id)
 {
     if (!empty($_POST)) {
         // Send email alerts to users who asked
         $email_alerts = $this->exec_all("SELECT user_id FROM " . DB_PREFIX . "email_alerts WHERE auction_id=" . $id);
         $email_template = $this->exec_one("SELECT object, content FROM " . DB_PREFIX . "email_templates WHERE name = 'email_alert' AND language = '" . $this->settings['app']['language'] . "'");
         $auction = $this->exec_one("SELECT a.id, a.type, a.fixed_time_limit, p.name FROM " . DB_PREFIX . "auctions a, " . DB_PREFIX . "products p WHERE a.id=" . $id . " AND p.id=a.product_id");
         foreach ($email_alerts as $alert) {
             $user = $this->user->getById($alert['user_id']);
             tools::sendMail($user['email'], 'email_alert_auction_start', array('username' => $user['username'], 'auction_id' => $auction['id']));
         }
         //$endTime = time() + $this->settings['app']['waiting_time'];
         $endTime = $_POST['date'] . " " . $_POST['auction_hour'] . ":" . $_POST['auction_min'] . ":" . $_POST['auction_sec'];
         $this->exec("UPDATE " . DB_PREFIX . "auctions SET start_time='" . $endTime . "', end_time='" . $endTime . "', status_id=3 WHERE id=" . $id);
         $name = _DIR_ . "/data/auction_" . $id;
         $name_2 = _DIR_ . "/data/auction_view_" . $id;
         if (file_exists($name)) {
             unlink($name);
         }
         if (file_exists($name_2)) {
             unlink($name_2);
         }
         tools::setFlash($this->l('Request processed'), 'success');
         tools::redirect('/admin/auction/ongoing');
     }
     $seconds = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59");
     $minutes = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59");
     $hours = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23");
     $now = array();
     $now['seconds'] = date("s");
     $now['minutes'] = date("i");
     $now['hours'] = date("H");
     $auction = $this->exec_one("SELECT a.id, p.name FROM " . DB_PREFIX . "auctions a, " . DB_PREFIX . "products p WHERE a.id=" . $id . " AND p.id=a.product_id");
     $this->smarty->assign(array('auction' => $auction, 'seconds' => $seconds, 'minutes' => $minutes, 'hours' => $hours, 'now' => $now));
     $this->smarty->display('admin/auction/start.tpl');
 }
    public function sendMail()
    {
        $tools = new tools();
        $eMail = $tools->getEmail();
        $baseUrl = HTTP_SERVER . DIR_WS_CATALOG;
        $dateihandle = fopen(HTTP_SERVER . DIR_WS_CATALOG . 'export/idealo_realtime_test.html', "r");
        $zeile = fgets($dateihandle, 4096);
        $error = 'keine';
        if ($zeile != 'no errors') {
            $error = $baseUrl . 'export/idealo_realtime_test.html';
        }
        $activeProducts = xtc_db_query("SELECT count(products_id)\n\t\t\t\t\t\t\t\t\t\tFROM `products` \n\t\t\t\t\t\t\t\t\t\tWHERE `products_status` = 1");
        $activeProducts = xtc_db_fetch_array($activeProducts);
        $activeProducts = $activeProducts['count(products_id)'];
        $products = xtc_db_query("SELECT count(products_id) FROM `products`");
        $products = xtc_db_fetch_array($products);
        $products = $products['count(products_id)'];
        $tools->sendMail($eMail, $baseUrl . 'export/idealo_realtime_test.csv', $error, $baseUrl, MODULE_VERSION_TEXT, $baseUrl . 'export/log_' . date("n_Y") . '.html', $baseUrl . 'export/last_answer.xml', $baseUrl . 'export/last_request.xml', $baseUrl . 'export/idealo_realtime/idealo_realtime.php', $activeProducts, $products);
        $html = '	<body bgcolor="#99CCFF">
					<b>
					<center>
					<font face="Arial,MS Sans Serif">
		 			
		 			<form name="close" onSubmit= "window.close();>
		 				<br><br>
		 				<div id="logo">
							<a href="http://www.idealo.de" target="_blank">' . xtc_image(DIR_WS_CATALOG . 'export/idealo_realtime/logo_blue_big.png', 'Price Comparison', '', '', 'class="logo noborder"') . '</a>
						</div><br><br>';
        $html .= IDEALO_QUESTION_AFTER_EMAIL_SEND_01 . $baseUrl . IDEALO_QUESTION_AFTER_EMAIL_SEND_02 . '<br><br>';
        $html .= '<input id="close" type="submit" name="close" value="close" />
	 		
	    			</form><br><br>
	    			
	    			</font>
					</center>
					</b>
				</body>';
        echo $html;
        die;
    }