예제 #1
0
    public function lostUsername()
    {
        global $mysql, $langArray, $config, $meta;
        $mysql->query("\n\t\t\tSELECT *\n\t\t\tFROM `users`\n\t\t\tWHERE `email` = '" . sql_quote($_POST['email']) . "'\n\t\t", __FUNCTION__);
        if ($mysql->num_rows() == 0) {
            return 'error_invalid_user_email';
        }
        $d = $mysql->fetch_array();
        //判断有无客服管理模块
        require_once ROOT_PATH . '/apps/app_extends/models/app_extends.class.php';
        $app_extends = new app_extends();
        if ($app_extends->is_service()) {
            //通过用户id获取关联客服
            require_once ROOT_PATH . '/apps/service/models/service.class.php';
            $service = new service();
            $theservice = $service->getserviceByuserid($d['user_id']);
            require_once ENGINE_PATH . 'classes/email.class.php';
            $emailClass = new email();
            $emailClass->fromEmail = 'no-reply@' . $config['domain'];
            $emailClass->contentType = 'text/html';
            $emailClass->subject = '[' . $meta['meta_title'] . ']发给[' . $d['username'] . ']的找回用户名邮件';
            $emailClass->message = '[' . $d['username'] . ']!<br />
							    &nbsp;&nbsp;&nbsp;&nbsp;什么?你连用户名都能忘?你是不是打算把小编也忘了,太残忍了! <br />
								&nbsp;&nbsp;&nbsp;&nbsp;算了,不跟你计较,这是你的用户名:<br />
								&nbsp;&nbsp;&nbsp;&nbsp;帐号:[' . $d['username'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;不许再忘哦!<br />
                                <br />
								&nbsp;&nbsp;&nbsp;&nbsp;专属小编:[' . $theservice['user_name'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . $meta['meta_title'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . date('Y-m-d H:i:s', time()) . ']<br />';
            require_once ROOT_PATH . '/apps/system/models/system.class.php';
            $system = new system();
            $smtp = $system->is_smtp();
            $smtpconf = $system->getAllKeyValue();
            if ($smtp) {
                $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
                $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $d['email'], $smtpconf["smtp_from_name"]);
                unset($emailClass);
                return true;
            }
            $emailClass->to($d['email']);
            $emailClass->send();
            unset($emailClass);
            return true;
        }
        require_once ENGINE_PATH . 'classes/email.class.php';
        $emailClass = new email();
        $emailClass->fromEmail = 'no-reply@' . $config['domain'];
        $emailClass->subject = '[' . $config['domain'] . '] ' . $langArray['email_lost_username'];
        $emailClass->message = langMessageReplace($langArray['email_lost_username_text'], array('DOMAIN' => $config['domain'], 'USERNAME' => $d['username']));
        require_once ROOT_PATH . '/apps/system/models/system.class.php';
        $system = new system();
        $smtp = $system->is_smtp();
        $smtpconf = $system->getAllKeyValue();
        if ($smtp) {
            $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
            $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $d['email'], $smtpconf["smtp_from_name"]);
            unset($emailClass);
            return true;
        }
        $emailClass->to($d['email']);
        $emailClass->send();
        unset($emailClass);
        return true;
    }
예제 #2
0
    public function unapproveDelete($id)
    {
        global $mysql, $data, $langArray, $config, $meta;
        if ($data['status'] == 'active') {
            return true;
        }
        if (!isset($_POST['comment_to_user']) || trim($_POST['comment_to_user']) == '') {
            return $langArray['error_set_comment_to_user'];
        }
        $this->delete($id, true);
        //判断有无客服管理模块
        require_once ROOT_PATH . '/apps/app_extends/models/app_extends.class.php';
        $app_extends = new app_extends();
        if ($app_extends->is_service()) {
            //通过用户id获取关联客服
            require_once ROOT_PATH . '/apps/service/models/service.class.php';
            $service = new service();
            $theservice = $service->getserviceByuserid($data['user']['user_id']);
            #给用户发邮件
            require_once ENGINE_PATH . '/classes/email.class.php';
            $emailClass = new email();
            $emailClass->fromEmail = 'no-reply@' . $config['domain'];
            $emailClass->contentType = 'text/html';
            $emailClass->subject = '你的作品[' . $data['name'] . ']被删除';
            $emailClass->message = 'Hi![' . $data['user']['username'] . ']:<br />
								&nbsp;&nbsp;&nbsp;&nbsp;很抱歉你的作品[' . $data['name'] . ']因以下原因被删除:<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . $_POST['comment_to_user'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;不要失望好么?小编其实也很难过!<br />
								&nbsp;&nbsp;&nbsp;&nbsp;一定要再接再厉,小编为你加油!<br />
								&nbsp;&nbsp;&nbsp;&nbsp;Fighting!<br />
								<br />
								&nbsp;&nbsp;&nbsp;&nbsp;专属小编:[' . $theservice['user_name'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . $meta['meta_title'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . date('Y-m-d H:i:s', time()) . ']<br />';
            require_once ROOT_PATH . '/apps/system/models/system.class.php';
            $system = new system();
            $smtp = $system->is_smtp();
            $smtpconf = $system->getAllKeyValue();
            if ($smtp) {
                $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
                $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $data['user']['email'], $smtpconf["smtp_from_name"]);
                unset($emailClass);
            } else {
                $emailClass->to($data['user']['email']);
                $emailClass->send();
                unset($emailClass);
            }
        } else {
            #给用户发邮件
            require_once ENGINE_PATH . '/classes/email.class.php';
            $emailClass = new email();
            $emailClass->fromEmail = 'no-reply@' . $config['domain'];
            $emailClass->subject = '[' . $config['domain'] . '] ' . $langArray['email_unapprove_delete_item_subject'];
            $emailClass->message = langMessageReplace($langArray['email_unapprove_delete_item_text'], array('THEMENAME' => $data['name'], 'COMMENT' => $_POST['comment_to_user']));
            require_once ROOT_PATH . '/apps/system/models/system.class.php';
            $system = new system();
            $smtp = $system->is_smtp();
            $smtpconf = $system->getAllKeyValue();
            if ($smtp) {
                $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
                $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $data['user']['email'], $smtpconf["smtp_from_name"]);
                unset($emailClass);
            } else {
                $emailClass->to($data['user']['email']);
                $emailClass->send();
                unset($emailClass);
            }
        }
        return true;
    }