Ejemplo n.º 1
0
/**
 * cron_auto_sendmail_error_log()
 *
 * @return
 */
function cron_auto_sendmail_error_log()
{
    global $global_config, $lang_global;
    $result = true;
    $error_log_fileext = preg_match("/[a-z]+/i", NV_LOGS_EXT) ? NV_LOGS_EXT : 'log';
    $file = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/sendmail.' . $error_log_fileext;
    if (file_exists($file) and filesize($file) > 0) {
        $result = nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $global_config['error_send_email'], sprintf($lang_global['error_sendmail_subject'], $global_config['site_name']), $lang_global['error_sendmail_content'], $file);
        if ($result) {
            if (!@unlink($file)) {
                $result = false;
            }
        }
    }
    return $result;
}
Ejemplo n.º 2
0
/**
 * lost_pass_sendMail()
 *
 * @param mixed $row
 * @return void
 */
function lost_pass_sendMail($row)
{
    global $db, $global_config, $lang_module;
    $passlostkey = (!empty($row['passlostkey']) and preg_match("/^([0-9]{10,15})\\|([a-z0-9]{32})\$/i", $row['passlostkey'], $matches)) ? array($matches[1], $matches[2]) : array();
    if (!isset($passlostkey[0]) or !isset($passlostkey[1]) or (int) $passlostkey[0] < NV_CURRENTTIME) {
        $key = strtoupper(nv_genpass(10));
        $passlostkey = md5($row['userid'] . $key . $global_config['sitekey']);
        $pa = NV_CURRENTTIME + 3600;
        $passlostkey = $pa . '|' . $passlostkey;
        $sql = "UPDATE " . NV_MOD_TABLE . " SET passlostkey='" . $passlostkey . "' WHERE userid=" . $row['userid'];
        $db->query($sql);
        $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
        $name = array_filter($name);
        $name = implode(' ', $name);
        $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
        $message = sprintf($lang_module['lostpass_email_content'], $name, $sitename, $key, nv_date('H:i d/m/Y', $pa));
        @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['lostpass_email_subject'], $message);
    }
}
Ejemplo n.º 3
0
/**
 * nv_SendMail2User()
 *
 * @param mixed $cid
 * @param mixed $fcontent
 * @param mixed $ftitle
 * @param mixed $femail
 * @param mixed $full_name
 * @return void
 */
function nv_SendMail2User($cid, $fcontent, $ftitle, $femail, $full_name)
{
    global $db, $module_data;
    $email_list = array();
    $sql = "SELECT `email`, `admins` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id` =" . $cid;
    $result = $db->sql_query($sql);
    list($email, $admins) = $db->sql_fetchrow($result);
    if (!empty($email)) {
        $email_list[] = $email;
    }
    if (!empty($admins)) {
        $admins = array_map("trim", explode(";", $admins));
        $a_l = array();
        foreach ($admins as $adm) {
            if (preg_match("/^([0-9]+)\\/([0-1]{1})\\/([0-1]{1})\\/([0-1]{1})\$/i", $adm)) {
                $adm2 = array_map("trim", explode("/", $adm));
                if ($adm2[3] == 1) {
                    $a_l[] = intval($adm2[0]);
                }
            }
        }
        if (!empty($a_l)) {
            $a_l = implode(",", $a_l);
            $sql = "SELECT t2.email as admin_email FROM `" . NV_AUTHORS_GLOBALTABLE . "` AS t1 INNER JOIN  `" . NV_USERS_GLOBALTABLE . "` AS t2 ON t1.admin_id = t2.userid WHERE t1.lev!=0 AND t1.is_suspend=0 AND t1.admin_id IN (" . $a_l . ")";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                if (nv_check_valid_email($row['admin_email']) == "") {
                    $email_list[] = $row['admin_email'];
                }
            }
        }
    }
    $email_list = array_unique($email_list);
    if (!empty($email_list)) {
        $from = array($full_name, $femail);
        foreach ($email_list as $to) {
            @nv_sendmail($from, $to, $ftitle, $fcontent);
        }
    }
}
Ejemplo n.º 4
0
/**
 * nv_del_user()
 *
 * @param mixed $userid
 * @return
 */
function nv_del_user($userid)
{
    global $db, $global_config, $nv_Request, $module_name, $user_info, $lang_module;
    $sql = 'SELECT group_id, username, first_name, last_name, email, photo, in_groups, idsite FROM ' . NV_MOD_TABLE . ' WHERE userid=' . $userid;
    $row = $db->query($sql)->fetch(3);
    if (empty($row)) {
        $return = 0;
    }
    list($group_id, $username, $first_name, $last_name, $email, $photo, $in_groups, $idsite) = $row;
    if ($global_config['idsite'] > 0 and $idsite != $global_config['idsite']) {
        return 0;
    }
    $query = $db->query('SELECT COUNT(*) FROM ' . NV_MOD_TABLE . '_groups_users WHERE group_id IN (1,2,3) AND userid=' . $userid);
    if ($query->fetchColumn()) {
        return 0;
    } else {
        $userdelete = !empty($first_name) ? $first_name . ' (' . $username . ')' : $username;
        $result = $db->exec('DELETE FROM ' . NV_MOD_TABLE . ' WHERE userid=' . $userid);
        if (!$result) {
            return 0;
        }
        $in_groups = explode(',', $in_groups);
        $db->query('UPDATE ' . NV_MOD_TABLE . '_groups SET numbers = numbers-1 WHERE group_id IN (SELECT group_id FROM ' . NV_MOD_TABLE . '_groups_users WHERE userid=' . $userid . ' AND approved = 1)');
        $db->query('UPDATE ' . NV_MOD_TABLE . '_groups SET numbers = numbers-1 WHERE group_id=' . (($group_id == 7 or in_array(7, $in_groups)) ? 7 : 4));
        $db->query('DELETE FROM ' . NV_MOD_TABLE . '_groups_users WHERE userid=' . $userid);
        $db->query('DELETE FROM ' . NV_MOD_TABLE . '_openid WHERE userid=' . $userid);
        $db->query('DELETE FROM ' . NV_MOD_TABLE . '_info WHERE userid=' . $userid);
        nv_insert_logs(NV_LANG_DATA, $module_name, 'log_del_user', 'userid ' . $userid, $user_info['userid']);
        if (!empty($photo) and is_file(NV_ROOTDIR . '/' . $photo)) {
            @nv_deletefile(NV_ROOTDIR . '/' . $photo);
        }
        $subject = $lang_module['delconfirm_email_title'];
        $message = sprintf($lang_module['delconfirm_email_content'], $userdelete, $global_config['site_name']);
        $message = nl2br($message);
        nv_sendmail($global_config['site_email'], $email, $subject, $message);
        return $userid;
    }
}
Ejemplo n.º 5
0
/**
 * nv_SendMail2User()
 *
 * @param mixed $cid
 * @param mixed $fcontent
 * @param mixed $ftitle
 * @param mixed $femail
 * @param mixed $full_name
 * @return void
 */
function nv_SendMail2User($cid, $fcontent, $ftitle, $femail, $full_name)
{
    global $db, $module_data, $db_config;
    $email_list = array();
    $sql = 'SELECT email, admins FROM ' . NV_PREFIXLANG . '_' . $module_data . '_department WHERE id =' . $cid;
    $result = $db->query($sql);
    list($email, $admins) = $result->fetch(3);
    if (!empty($email)) {
        $email_list[] = $email;
    }
    if (!empty($admins)) {
        $admins = array_map('trim', explode(';', $admins));
        $a_l = array();
        foreach ($admins as $adm) {
            if (preg_match('/^([0-9]+)\\/([0-1]{1})\\/([0-1]{1})\\/([0-1]{1})$/i', $adm)) {
                $adm2 = array_map('trim', explode('/', $adm));
                if ($adm2[3] == 1) {
                    $a_l[] = intval($adm2[0]);
                }
            }
        }
        if (!empty($a_l)) {
            $a_l = implode(',', $a_l);
            $sql = 'SELECT t2.email as admin_email FROM ' . NV_AUTHORS_GLOBALTABLE . ' t1 INNER JOIN ' . NV_USERS_GLOBALTABLE . ' t2 ON t1.admin_id = t2.userid WHERE t1.lev!=0 AND t1.is_suspend=0 AND t1.admin_id IN (' . $a_l . ')';
            $result = $db->query($sql);
            while ($row = $result->fetch()) {
                if (nv_check_valid_email($row['admin_email']) == '') {
                    $email_list[] = $row['admin_email'];
                }
            }
        }
    }
    if (!empty($email_list)) {
        $from = array($full_name, $femail);
        $email_list = array_unique($email_list);
        @nv_sendmail($from, $email_list, $ftitle, $fcontent);
    }
}
Ejemplo n.º 6
0
 $data_insert['password'] = $password;
 $data_insert['email'] = $array_register['email'];
 $data_insert['first_name'] = $array_register['first_name'];
 $data_insert['last_name'] = $array_register['last_name'];
 $data_insert['your_question'] = $your_question;
 $data_insert['answer'] = $array_register['answer'];
 $userid = $db->insert_id($sql, userid, $data_insert);
 if (!$userid) {
     die(reg_result(array('status' => 'error', 'input' => '', 'mess' => $lang_module['err_no_save_account'])));
 } else {
     $query_field['userid'] = $userid;
     $db->query('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_info (' . implode(', ', array_keys($query_field)) . ') VALUES (' . implode(', ', array_values($query_field)) . ')');
     $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
     $subject = $lang_module['account_register'];
     $message = sprintf($lang_module['account_register_info'], $array_register['first_name'], $global_config['site_name'], NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true), $array_register['username']);
     nv_sendmail($global_config['site_email'], $array_register['email'], $subject, $message);
     if (!empty($global_config['auto_login_after_reg'])) {
         // Auto login
         $array_user = array('userid' => $userid, 'last_agent' => '', 'last_ip' => '', 'last_login' => 0, 'last_openid' => '');
         validUserLog($array_user, 1, '');
         $nv_redirect = nv_redirect_decrypt($nv_redirect);
         $url = !empty($nv_redirect) ? $nv_redirect : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
     } else {
         $url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=login';
         if (!empty($nv_redirect)) {
             $url .= '&nv_redirect=' . $nv_redirect;
         }
     }
     $nv_redirect = '';
     die(reg_result(array('status' => 'ok', 'input' => nv_url_rewrite($url, true), 'mess' => $lang_module['register_ok'])));
 }
Ejemplo n.º 7
0
if (empty($row)) {
    die('NO');
}
list($username, $first_name, $last_name, $email, $photo, $idsite) = $row;
if ($global_config['idsite'] > 0 and $idsite != $global_config['idsite']) {
    die('NO');
}
$query = $db->query('SELECT COUNT(*) FROM ' . NV_GROUPS_GLOBALTABLE . '_users WHERE group_id IN (1,2,3) AND userid=' . $userid);
if ($query->fetchColumn()) {
    die('ERROR_' . $lang_module['delete_group_system']);
} else {
    $userdelete = !empty($first_name) ? $first_name . ' (' . $username . ')' : $username;
    $result = $db->exec('DELETE FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $userid);
    if (!$result) {
        die('NO');
    }
    $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers-1 WHERE group_id IN (SELECT group_id FROM ' . NV_GROUPS_GLOBALTABLE . '_users WHERE userid=' . $userid . ')');
    $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers-1 WHERE group_id=4');
    $db->query('DELETE FROM ' . NV_GROUPS_GLOBALTABLE . '_users WHERE userid=' . $userid);
    $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_openid WHERE userid=' . $userid);
    $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_info WHERE userid=' . $userid);
    nv_insert_logs(NV_LANG_DATA, $module_name, 'log_del_user', 'userid ' . $userid, $admin_info['userid']);
    if (!empty($photo) and is_file(NV_ROOTDIR . '/' . $photo)) {
        @nv_deletefile(NV_ROOTDIR . '/' . $photo);
    }
    $subject = $lang_module['delconfirm_email_title'];
    $message = sprintf($lang_module['delconfirm_email_content'], $userdelete, $global_config['site_name']);
    $message = nl2br($message);
    nv_sendmail($global_config['site_email'], $email, $subject, $message);
    die('OK');
}
Ejemplo n.º 8
0
            $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $transaction_status . ", transaction_id=" . $transaction_id . ", transaction_count=transaction_count+1 WHERE order_id=" . $order_id);
            //Cap nhat diem tich luy
            UpdatePoint($data_content);
            nv_insert_logs(NV_LANG_DATA, $module_name, 'Log payment product', "Order code: " . $data_content['order_code'], $admin_info['userid']);
        }
        // Gửi mail xác nhận thanh toán
        $content = '';
        $email_contents_table = call_user_func('email_new_order_payment', $content, $data_content, $data_pro, true);
        $checkss = md5($order_id . $global_config['sitekey'] . session_id());
        $review_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=payment&order_id=' . $order_id . '&checkss=' . $checkss;
        $replace_data = array('order_code' => $data_content['order_code'], 'order_name' => $data_content['order_name'], 'order_email' => $data_content['order_email'], 'order_phone' => $data_content['order_phone'], 'order_address' => $data_content['order_address'], 'order_note' => $data_content['order_note'], 'order_total' => nv_number_format($data_content['order_total']), 'unit_total' => $data_content['unit_total'], 'dateup' => nv_date("d-m-Y", $data_content['order_time']), 'moment' => nv_date("H:i", $data_content['order_time']), 'review_url' => '<a href="' . $global_config['site_url'] . $review_url . '">' . $lang_module['here'] . '</a>', 'table_product' => $email_contents_table, 'site_url' => $global_config['site_url'], 'site_name' => $global_config['site_name']);
        $content_file = NV_ROOTDIR . '/' . NV_DATADIR . '/' . NV_LANG_DATA . '_' . $module_data . '_order_payment_content.txt';
        if (file_exists($content_file)) {
            $content = file_get_contents($content_file);
            if (empty($content)) {
                $content = $lang_module['order_email_payment'];
            }
            $content = nv_editor_br2nl($content);
        } else {
            $content = $lang_module['order_email_payment'];
        }
        foreach ($replace_data as $key => $value) {
            $content = str_replace('{' . $key . '}', $value, $content);
        }
        $email_contents = call_user_func('email_new_order_payment', $content, $data_content, $data_pro);
        nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $data_content['order_email'], sprintf($lang_module['document_payment_email_order_payment'], $module_info['custom_title'], $data_content['order_code']), $email_contents);
        $contents = $lang_module['order_submit_pay_ok'];
        nv_del_moduleCache($module_name);
    }
}
die($contents);
Ejemplo n.º 9
0
                 $xtpl->assign('SITE_NAME', $global_config['site_name']);
                 $xtpl->assign('SITE_SLOGAN', $global_config['site_description']);
                 $xtpl->assign('SITE_EMAIL', $global_config['site_email']);
                 $xtpl->assign('SITE_FONE', $global_config['site_phone']);
                 $xtpl->assign('SITE_URL', $global_config['site_url']);
                 $xtpl->assign('TITLE', $title);
                 $xtpl->assign('CONTENT', $mess);
                 $xtpl->assign('AUTHOR_SIG', $my_sig);
                 $xtpl->assign('AUTHOR_NAME', $admin_info['username']);
                 $xtpl->assign('AUTHOR_POS', $admin_info['position']);
                 $xtpl->assign('AUTHOR_EMAIL', $my_mail);
                 $xtpl->parse('main');
                 $content = $xtpl->text('main');
                 $from = array($admin_info['username'], $my_mail);
                 $to = $row_user['email'];
                 $send = nv_sendmail($from, $to, nv_EncString($title), $content);
                 if (!$send) {
                     nv_info_die($lang_global['error_info_caption'], $lang_global['site_info'], $lang_global['error_sendmail_admin'], 1);
                 }
             }
         }
         Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=suspend&id=" . $id);
     }
 } else {
     $adminpass = $new_reason = "";
     $clean_history = $sendmail = 0;
 }
 $contents['change_suspend']['new_suspend_caption'] = !empty($error) ? $error : $lang_module['chg_is_suspend' . $new_suspend];
 $contents['change_suspend']['new_suspend_is_error'] = !empty($error) ? 1 : 0;
 $contents['change_suspend']['new_suspend_action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=suspend&amp;admin_id=" . $admin_id;
 $contents['change_suspend']['sendmail'] = array($lang_module['suspend_sendmail'], $sendmail);
Ejemplo n.º 10
0
                $rand = 6;
            }
            $row['safekey'] = md5(nv_genpass($rand));
            $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET safekey= :safekey WHERE userid=' . $user_info['userid']);
            $stmt->bindParam(':safekey', $row['safekey'], PDO::PARAM_STR);
            $stmt->execute();
            $nv_Request->set_Session('safesend', 0);
        }
        $ss_safesend = $nv_Request->get_int('safesend', 'session', 0);
        if ($ss_safesend < NV_CURRENTTIME) {
            $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
            $name = array_filter($name);
            $name = implode(' ', $name);
            $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
            $message = sprintf($lang_module['safe_send_content'], $name, $sitename, $row['safekey']);
            @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['safe_send_subject'], $message);
            $ss_safesend = NV_CURRENTTIME + 600;
            $nv_Request->set_Session('safesend', $ss_safesend);
        }
        $ss_safesend = ceil(($ss_safesend - NV_CURRENTTIME) / 60);
        die(json_encode(array('status' => 'ok', 'input' => '', 'mess' => sprintf($lang_module['safe_send_ok'], $ss_safesend))));
    }
    $safe_key = nv_substr($nv_Request->get_title('safe_key', 'post', '', 1), 0, 32);
    if (empty($row['safekey']) or $safe_key != $row['safekey']) {
        die(json_encode(array('status' => 'error', 'input' => 'safe_key', 'mess' => $lang_module['verifykey_error'])));
    }
    $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET safemode=1, safekey= :safekey WHERE userid=' . $user_info['userid']);
    $stmt->bindParam(':safekey', $row['safekey'], PDO::PARAM_STR);
    $stmt->execute();
    die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=editinfo', true), 'mess' => $lang_module['safe_activate_ok'])));
}
Ejemplo n.º 11
0
 }
 if ($data['send']) {
     if ($data['answer'] == $row['answer']) {
         $nv_Request->unset_request('lostpass_seccode', 'session');
         $rand = rand(NV_UPASSMIN, NV_UPASSMAX);
         if ($rand < 6) {
             $rand = 6;
         }
         $password_new = nv_genpass($rand);
         $passlostkey = md5($row['userid'] . $password_new . $global_config['sitekey']);
         $k = md5($row['userid'] . $passlostkey . $global_config['sitekey']);
         $subject = sprintf($lang_module['lostpass_email_subject'], $global_config['site_name']);
         $link_lostpass_content_email = NV_MY_DOMAIN . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&u=' . $row['userid'] . '&k=' . $k;
         $row['full_name'] = nv_show_name_user($row['first_name'], $row['last_name'], $row['username']);
         $message = sprintf($lang_module['lostpass_email_content'], $row['full_name'], $global_config['site_name'], $link_lostpass_content_email, $row['username']);
         $ok = nv_sendmail($global_config['site_email'], $row['email'], $subject, $message);
         if ($ok) {
             $sql = "UPDATE " . NV_USERS_GLOBALTABLE . " SET passlostkey='" . $passlostkey . "' WHERE userid=" . $row['userid'];
             $db->query($sql);
             if (!empty($check_email)) {
                 $row['email'] = substr($row['email'], 0, 3) . '***' . substr($row['email'], -6);
             }
             $info = sprintf($lang_module['lostpass_content_mess'], $row['email']);
         } else {
             $info = $lang_global['error_sendmail'];
         }
         $nv_redirect = !empty($data['nv_redirect']) ? nv_base64_decode($data['nv_redirect']) : nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true);
         $contents = user_info_exit($info);
         $contents .= '<meta http-equiv="refresh" content="10;url=' . $nv_redirect . '" />';
         include NV_ROOTDIR . '/includes/header.php';
         echo nv_site_theme($contents);
Ejemplo n.º 12
0
function cron_blog_newsletters($table_data, $num_onesend)
{
    global $db, $global_config, $db_config;
    $num_onesend = empty($num_onesend) ? 5 : intval($num_onesend);
    if (!empty($table_data)) {
        $table_data = explode("_", $table_data);
        $table_data = array_map("trim", $table_data);
        $lang = $table_data[0];
        unset($table_data[0]);
        $module_data = implode("_", $table_data);
        // Lay module file, module name
        $sql = "SELECT title, module_file FROM " . NV_MODULES_TABLE . " WHERE module_data=" . $db->quote($module_data);
        $result = $db->query($sql);
        list($module_name, $module_file) = $result->fetch(3);
        $table_data = $db_config['prefix'] . "_" . $lang . "_" . $module_data;
        // Lay cau hinh gui mail
        $sql = "SELECT config_value FROM " . $table_data . "_config WHERE config_name=" . $db->quote('numberResendNewsletter');
        $result = $db->query($sql);
        $numberResendNewsletter = $result->fetchColumn();
        // Lay tin can gui (uu tien cac tin round 1 hon)
        $sql = "SELECT a.*, b.title, b.alias, b.hometext FROM " . $table_data . "_send a INNER JOIN " . $table_data . "_rows b ON a.pid=b.id WHERE a.status!=2 AND b.status=1 ORDER BY a.status DESC, a.id ASC LIMIT 0,1";
        $result = $db->query($sql);
        if ($result->rowCount()) {
            // Du lieu gui
            $data_send = $result->fetch();
            $data_send['lastid'] = intval($data_send['lastid']);
            $data_send['link'] = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $data_send['alias'];
            $data_send['resenddata'] = explode(",", $data_send['resenddata']);
            $data_send['errordata'] = explode(",", $data_send['errordata']);
            // Danh dau la dang gui
            if (empty($data_send['status'])) {
                $db->query("UPDATE " . $table_data . "_send SET status=1, starttime=" . NV_CURRENTTIME . ", round=1 WHERE id=" . $data_send['id']);
            }
            // Goi ngon ngu
            include NV_ROOTDIR . "/modules/" . $module_file . "/language/" . $lang . ".php";
            // Lay nguoi gui lan gui 1
            if ($data_send['round'] <= 1) {
                $sql = "SELECT id, email FROM " . $table_data . "_newsletters WHERE status=1 AND id>" . $data_send['lastid'] . " ORDER BY id ASC LIMIT 0," . $num_onesend;
            } else {
                $sql = "SELECT id, email FROM " . $table_data . "_newsletters WHERE status=1 AND id>" . $data_send['lastid'] . " AND id IN(" . implode(",", $data_send['resenddata']) . ") ORDER BY id ASC LIMIT 0," . $num_onesend;
            }
            $result = $db->query($sql);
            $num = $result->rowCount();
            while ($row = $result->fetch()) {
                if (nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $row['email'], nv_unhtmlspecialchars($data_send['title']), $data_send['hometext'] . "<br /><br />" . $lang_module['newsletterMessage'] . ": <a href=\"" . $data_send['link'] . "\">" . $data_send['link'] . "</a>")) {
                    // Cap nhat lan gui cuoi va so email da gui
                    $db->query("UPDATE " . $table_data . "_newsletters SET numemail=numemail+1, lastsendtime=" . NV_CURRENTTIME . " WHERE id=" . $row['id']);
                } else {
                    // Danh dau cac email bi loi trong lan gui nay
                    $data_send['errordata'][$row['id']] = $row['id'];
                }
                $data_send['lastid'] = $row['id'];
            }
            // Cap nhat lai thong tin
            $sql = array();
            $sql[] = "lastid=" . $data_send['lastid'];
            if ($num < $num_onesend) {
                // Tang so lan gui len 1
                $data_send['round'] = $data_send['round'] + 1;
                // Danh dau da gui xong neu qua so lan gui hoac khong co email loi
                if ($data_send['round'] > $numberResendNewsletter or empty($data_send['errordata'])) {
                    $sql[] = "status=2";
                    $sql[] = "endtime=" . NV_CURRENTTIME;
                } else {
                    $sql[] = "round=" . $data_send['round'];
                    // Du lieu gui lan tiep theo la du lieu loi cua lan nay
                    $sql[] = "resenddata=" . $db->quote(implode(",", $data_send['errordata']));
                    $sql[] = "errordata=''";
                }
            } else {
                // Ghi lai du lieu loi
                $sql[] = "errordata=" . $db->quote($data_send['errordata'] ? implode(",", $data_send['errordata']) : '');
            }
            $db->query("UPDATE " . $table_data . "_send SET " . implode(", ", $sql) . " WHERE id=" . $data_send['id']);
        }
    }
    return true;
}
Ejemplo n.º 13
0
                 $xtpl->assign('SITE_NAME', $global_config['site_name']);
                 $xtpl->assign('SITE_SLOGAN', $global_config['site_description']);
                 $xtpl->assign('SITE_EMAIL', $global_config['site_email']);
                 $xtpl->assign('SITE_FONE', $global_config['site_phone']);
                 $xtpl->assign('SITE_URL', $global_config['site_url']);
                 $xtpl->assign('TITLE', $title);
                 $xtpl->assign('CONTENT', $mess);
                 $xtpl->assign('AUTHOR_SIG', $my_sig);
                 $xtpl->assign('AUTHOR_NAME', $admin_info['username']);
                 $xtpl->assign('AUTHOR_POS', $admin_info['position']);
                 $xtpl->assign('AUTHOR_EMAIL', $my_mail);
                 $xtpl->parse('main');
                 $content = $xtpl->text('main');
                 $from = array($admin_info['username'], $my_mail);
                 $to = $row_user['email'];
                 $send = nv_sendmail($from, $to, $title, $content);
                 if (!$send) {
                     $page_title = $lang_global['error_info_caption'];
                     $contents = $lang_global['error_sendmail_admin'] . '<meta http-equiv="refresh" content="10;URL=' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '" />';
                     include NV_ROOTDIR . '/includes/header.php';
                     echo nv_admin_theme($contents);
                     include NV_ROOTDIR . '/includes/footer.php';
                 }
             }
         }
         Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=suspend&id=' . $id);
     }
 } else {
     $adminpass = $new_reason = '';
     $clean_history = $sendmail = 0;
 }
Ejemplo n.º 14
0
            }
            $email_contents = call_user_func('email_new_order', $content, $data_order, $data_pro);
            $email_title = empty($order_info) ? $lang_module['order_email_title'] : $lang_module['order_email_edit_title'];
            nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $data_order['order_email'], sprintf($email_title, $module_info['custom_title'], $data_order['order_code']), $email_contents);
            // Them vao notification
            $content = array('order_id' => $data_order['id'], 'order_code' => $data_order['order_code'], 'order_name' => $data_order['order_name']);
            $userid = isset($user_info['userid']) and !empty($user_info['userid']) ? $user_info['userid'] : 0;
            nv_insert_notification($module_name, empty($order_info) ? 'order_new' : 'order_edit', $content, 0, $userid, 1);
            // Gui mail thong bao den nguoi quan ly shops
            $order_url = $global_config['site_url'] . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=or_view&amp;order_id=' . $data_order['id'];
            $lang_module['order_email_thanks'] = sprintf($lang_module['order_email_thanks_to_admin'], $data_order['order_name']);
            $lang_module['order_email_review'] = sprintf($lang_module['order_email_review_to_admin'], $order_url);
            $listmail_notify = nv_listmail_notify();
            if (!empty($listmail_notify)) {
                $email_contents_to_admin = call_user_func('email_new_order', $data_order, $data_pro);
                nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $listmail_notify, sprintf($email_title, $module_info['custom_title'], $data_order['order_code']), $email_contents_to_admin);
            }
            // Chuyen trang xem thong tin don hang vua dat
            unset($_SESSION[$module_data . '_cart']);
            unset($_SESSION[$module_data . '_order_info']);
            unset($_SESSION[$module_data . '_coupons']);
            Header('Location: ' . $review_url);
            $action = 1;
        }
    }
}
// Lay dia diem
$sql = "SELECT id, parentid, title, lev FROM " . $db_config['prefix'] . '_' . $module_data . "_location ORDER BY sort ASC";
$result = $db->query($sql);
while (list($id_i, $parentid_i, $title_i, $lev_i) = $result->fetch(3)) {
    $xtitle_i = '';
Ejemplo n.º 15
0
    $timeout = $nv_Request->get_int($module_name . '_gift', 'cookie', 0);
    if ($timeout == 0 or NV_CURRENTTIME - $timeout > 360) {
        $song = getsongbyID($id);
        if (empty($song)) {
            die($lang_module['err_exist_song']);
        }
        $nv_Request->set_Cookie($module_name . '_gift', NV_CURRENTTIME);
        $sql = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_gift` VALUES ( \n\t\t\tNULL, \n\t\t\t" . $db->dbescape($who_send) . ", \n\t\t\t" . $db->dbescape($who_receive) . ", \n\t\t\t" . $db->dbescape($id) . ", \n\t\t\tUNIX_TIMESTAMP(), \n\t\t\t" . $db->dbescape($body) . ", \n\t\t\t" . $setting['auto_gift'] . " \n\t\t)";
        if ($db->sql_query_insert_id($sql)) {
            if ($setting['auto_gift']) {
                nv_del_moduleCache($module_name);
            }
            $link = "<a href=\"" . NV_MY_DOMAIN . nv_url_rewrite($main_header_URL . "=listenone/" . $song['id'] . "/" . $song['ten']) . "\">" . NV_MY_DOMAIN . nv_url_rewrite($main_header_URL . "=listenone/" . $song['id'] . "/" . $song['ten']) . "</a>";
            $subject = $lang_module['sendmail_welcome'] . " \"" . $who_send . "\"";
            $message = sprintf($lang_module['gift_message'], $who_receive, $who_send, NV_MY_DOMAIN, $body, $link);
            nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $email_receive, $subject, $message);
            if ($setting['auto_gift']) {
                die("OK");
            } else {
                die("WAIT");
            }
        } else {
            die($lang_module['send_gift_error']);
        }
    } else {
        die($lang_module['ready_send_gift']);
    }
}
// Them bai hat vao playlist
if ($nv_Request->isset_request('addplaylist', 'post')) {
    if (!defined('NV_IS_AJAX')) {
Ejemplo n.º 16
0
                    if (nv_check_valid_email($row['admin_email']) == '') {
                        $email_list[] = $row['admin_email'];
                    }
                }
            }
        }
        if (!empty($email_list)) {
            $from = array($fname, $femail);
            $email_list = array_unique($email_list);
            @nv_sendmail($from, $email_list, $ftitle, $fcon_mail);
        }
        // Gửi bản sao đến hộp thư người gửi
        if ($fsendcopy) {
            $from = array($global_config['site_name'], $global_config['site_email']);
            $fcon_mail = contact_sendcontact($row_id, $fcat, $ftitle, $fname, $femail, $fphone, $fcon, $fpart, false);
            @nv_sendmail($from, $femail, $ftitle, $fcon_mail);
        }
        nv_insert_notification($module_name, 'contact_new', array('title' => $ftitle), $row_id, 0, $sender_id, 1);
        die(json_encode(array('status' => 'ok', 'input' => '', 'mess' => $lang_module['sendcontactok'])));
    }
    die(json_encode(array('status' => 'error', 'input' => '', 'mess' => $lang_module['sendcontactfailed'])));
}
$page_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$mod_title = isset($lang_module['main_title']) ? $lang_module['main_title'] : $module_info['custom_title'];
$full_theme = true;
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
if (!empty($alias_department)) {
    $base_url .= '&amp;' . NV_OP_VARIABLE . '=' . $alias_department;
    if (isset($array_op[1]) and $array_op[1] == 0) {
        $base_url .= '/0';
Ejemplo n.º 17
0
             $to_mail = filter_text_input('email', 'post', '');
             $content = filter_text_input('content', 'post', '', 1);
             $err_email = nv_check_valid_email($to_mail);
             $err_youremail = nv_check_valid_email($youremail);
             $err_name = "";
             $message = "";
             $success = "";
             if ($global_config['gfx_chk'] > 0 and !nv_capcha_txt($nv_seccode)) {
                 $err_name = $lang_global['securitycodeincorrect'];
             } elseif (empty($name)) {
                 $err_name = $lang_module['sendmail_err_name'];
             } elseif (empty($err_email) and empty($err_youremail)) {
                 $subject = $lang_module['sendmail_subject'] . "{$name}";
                 $message .= "" . $lang_module['sendmail_welcome'] . " <strong>" . $global_config['site_name'] . "</strong> " . $lang_module['sendmail_welcome1'] . "<br /><br />" . $content . "<br /><br />" . $hometext . " <br/><br /><strong>" . $lang_module['sendmail_welcome2'] . "</strong><br />" . $link;
                 $from = array($name, $youremail);
                 $check = nv_sendmail($from, $to_mail, $subject, $message);
                 if ($check) {
                     $success = "" . $lang_module['sendmail_success'] . "<strong> " . $to_mail . "</strong>";
                 } else {
                     $success = $lang_module['sendmail_success_err'];
                 }
             }
             $result = array("err_name" => $err_name, "err_email" => $err_email, "err_yourmail" => $err_youremail, "send_success" => $success, "check" => $check);
         }
         $sendmail = array("id" => $id, "catid" => $catid, "checkss" => md5($id . session_id() . $global_config['sitekey']), "v_name" => $name, "v_mail" => $youremail, "to_mail" => $to_mail, "content" => $content, "result" => $result, "action" => "" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=sendmail/" . $global_array_cat[$catid]['alias'] . "/" . $alias . "-" . $id);
         $contents = sendmail_themme($sendmail);
         include NV_ROOTDIR . "/includes/header.php";
         echo $contents;
         include NV_ROOTDIR . "/includes/footer.php";
     }
 }
Ejemplo n.º 18
0
}
$admin_name = $admin_info['full_name'];
if (empty($admin_name)) {
    $admin_name = $admin_info['username'];
}
$mess_content = $error = "";
if ($nv_Request->get_int('save', 'post') == '1') {
    $mess_content = nv_editor_filter_textarea('mess_content', '', NV_ALLOWED_HTML_TAGS, true);
    if (strip_tags($mess_content) != "") {
        list($from) = $db->sql_fetchrow($db->sql_query("SELECT `email` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $row['cid']));
        if (nv_check_valid_email($from) != "") {
            $from = $admin_info['email'];
        }
        $from = array($admin_name, $from);
        $subject = "Re: " . $row['title'];
        if (nv_sendmail($from, $row['sender_email'], $subject, $mess_content)) {
            $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_send` SET `is_reply`=1, `reply_content`=" . $db->dbescape($mess_content) . ", `reply_time`=" . NV_CURRENTTIME . ", `reply_aid`=" . $admin_info['admin_id'] . " WHERE `id`=" . $id;
            $db->sql_query($sql);
            Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=view&id=" . $id);
            die;
        } else {
            $error = $lang_global['error_sendmail_admin'];
        }
    }
} else {
    $mess_content .= "<br /><br />----------<br />Best regards,<br /><br />" . $admin_name . "<br />";
    if (!empty($admin_info['position'])) {
        $mess_content .= $admin_info['position'] . "<br />";
    }
    $mess_content .= "<br />";
    $mess_content .= "E-mail: " . $admin_info['email'] . "<br />";
Ejemplo n.º 19
0
            }
            if (!empty($a_l)) {
                $a_l = implode(',', $a_l);
                $sql = 'SELECT t2.email as admin_email FROM ' . NV_AUTHORS_GLOBALTABLE . ' t1 INNER JOIN ' . NV_USERS_GLOBALTABLE . ' t2 ON t1.admin_id = t2.userid WHERE t1.lev!=0 AND t1.is_suspend=0 AND t2.active=1 AND t1.admin_id IN (' . $a_l . ')';
                $result = $db_slave->query($sql);
                while ($row = $result->fetch()) {
                    if (nv_check_valid_email($row['admin_email']) == '') {
                        $email_list[] = $row['admin_email'];
                    }
                }
            }
        }
        if (!empty($email_list)) {
            $from = array($fname, $femail);
            $email_list = array_unique($email_list);
            @nv_sendmail($from, $email_list, $ftitle, $fcon);
        }
        nv_insert_notification($module_name, 'contact_new', array('title' => $ftitle), $row_id, 0, $sender_id, 1);
        die(json_encode(array('status' => 'ok', 'input' => '', 'mess' => $lang_module['sendcontactok'])));
    }
    die(json_encode(array('status' => 'error', 'input' => '', 'mess' => $lang_module['sendcontactfailed'])));
}
$page_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$mod_title = isset($lang_module['main_title']) ? $lang_module['main_title'] : $module_info['custom_title'];
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
if (!empty($alias_department)) {
    $base_url .= '&amp;' . NV_OP_VARIABLE . '=' . $alias_department;
}
$base_url_rewrite = nv_url_rewrite($base_url, true);
if ($_SERVER['REQUEST_URI'] == $base_url_rewrite) {
Ejemplo n.º 20
0
        if ($row['status'] == 0) {
            die(sprintf($BL->lang('newsletterIsBan'), $array['email']));
        } elseif ($row['status'] == 1) {
            die(sprintf($BL->lang('newsletterIsActive'), $array['email']));
        } else {
            if (!$db->query("DELETE FROM " . $BL->table_prefix . "_newsletters WHERE email=" . $db->quote($array['email']))) {
                die('Unknow Error!!!');
            }
        }
    }
    // Khoa unique
    $tokenkey = md5($array['checksess'] . $array['email']);
    $linkConfirm = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op . "&amp;confirm=" . $tokenkey;
    $linkCancel = NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $op . "&amp;cancel=" . $tokenkey;
    $mailContent = sprintf($BL->lang('newsletterMailConfirm'), $linkConfirm, $linkConfirm, $linkCancel, $linkCancel, $global_config['site_name']);
    if (nv_sendmail(array($global_config['site_name'], $global_config['site_email']), $array['email'], $BL->lang('newsletterMailSubject'), $mailContent)) {
        if ($db->query("INSERT INTO " . $BL->table_prefix . "_newsletters (id, email, regip, regtime, tokenkey, status) VALUES(NULL, " . $db->quote($array['email']) . ", " . $db->quote($client_info['ip']) . ", " . NV_CURRENTTIME . ", " . $db->quote($tokenkey) . ", -1)")) {
            die(sprintf($BL->lang('newsletterMailOk'), $array['email']));
        }
        die("Unknow Error!!!");
    } else {
        die($BL->lang('newsletterMailError'));
    }
}
$page_title = $mod_title = $BL->lang('newsletter');
// Khoi tao
$array = array('status' => 0, 'message' => "");
// Xac thuc hoac huy dang ky nhan tin
if ($nv_Request->isset_request("confirm", "get") or $nv_Request->isset_request("cancel", "get")) {
    $confirm = nv_substr($nv_Request->get_title('confirm', 'get', '', 1), 0, 255);
    $cancel = nv_substr($nv_Request->get_title('cancel', 'get', '', 1), 0, 255);