Ejemplo n.º 1
0
function fncsendmail($m = "", $id = 0, $username = "", $email = "")
{
    $pi_name = "userbox";
    global $_CONF;
    global $_TABLES;
    global $LANG_USERBOX_MAIL;
    global $LANG_USERBOX_ADMIN;
    global $_USER;
    global $_USERBOX_CONF;
    global $LANG28;
    $retval = '';
    $site_name = $_CONF['site_name'];
    $subject = $LANG_USERBOX_MAIL['subject_' . $m];
    $message = $LANG_USERBOX_MAIL['message_' . $m];
    if ($m === "data_delete") {
        $msg .= $LANG28['2'] . ":" . $id . LB;
        $msg .= $LANG28['3'] . ":" . $title . LB;
        //URL
        $url = $_CONF['site_url'] . "/userbox/profile.php";
        $url = COM_buildUrl($url);
    } else {
        $sql = "SELECT ";
        $sql .= " t1.*";
        $sql .= " ,t2.uid";
        $sql .= " ,t2.username";
        $sql .= " ,t2.fullname";
        $sql .= " ,t2.email";
        $sql .= " FROM ";
        $sql .= $_TABLES['USERBOX_base'] . " AS t1";
        $sql .= "," . $_TABLES['users'] . " AS t2";
        $sql .= " WHERE ";
        $sql .= " t1.id = {$id}";
        $sql .= " AND t1.id = t2.uid";
        $result = DB_query($sql);
        $numrows = DB_numRows($result);
        if ($numrows > 0) {
            $A = DB_fetchArray($result);
            $A = array_map('stripslashes', $A);
            $email = $A['email'];
            //下書
            if ($A['draft_flag'] == 1) {
                $msg .= $LANG_USERBOX_ADMIN['draft'] . LB;
            }
            //コア
            $msg .= $LANG28['2'] . ":" . $A['uid'] . LB;
            $msg .= $LANG28['3'] . ":" . $A['username'] . LB;
            $msg .= $LANG28['4'] . ":" . $A['fullname'] . LB;
            //基本項目
            $msg .= $LANG_USERBOX_ADMIN['page_title'] . ":" . $A['page_title'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['description'] . ":" . $A['description'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['hits'] . ":" . $A['hits'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['comments'] . ":" . $A['comments'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['meta_description'] . ":" . $A['meta_description'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['meta_keywords'] . ":" . $A['meta_keywords'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['commentcode'] . ":" . $A['commentcode'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['comment_expire'] . ":" . $A['comment_expire'] . LB;
            // 準備中 $msg.=  $LANG_USERBOX_ADMIN['language_id'].":".$A['language_id'].LB;
            $msg .= $LANG_USERBOX_ADMIN['owner_id'] . ":" . $A['owner_id'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['group_id'] . ":" . $A['group_id'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_owner'] . ":" . $A['perm_owner'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_group'] . ":" . $A['perm_group'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_members'] . ":" . $A['perm_members'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_anon'] . ":" . $A['perm_anon'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['modified'] . ":" . $A['modified'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['created'] . ":" . $A['created'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['expired'] . ":" . $A['expired'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['released'] . ":" . $A['released'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['orderno'] . ":" . $A['orderno'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['trackbackcode'] . ":" . $A['trackbackcode'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['draft'] . ":" . $A['draft'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['udatetime'] . ":" . $A['udatetime'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['uuid'] . ":" . $A['uuid'] . LB;
            //koko
            //カテゴリ
            $msg .= DATABOX_getcategoriesText($id, 0, $pi_name);
            //追加項目
            $group_id = stripslashes($A['group_id']);
            $owner_id = stripslashes($A['owner_id']);
            $chk_user = DATABOX_chkuser($group_id, $owner_id, "userbox.admin");
            $addition_def = DATABOX_getadditiondef($pi_name);
            $additionfields = DATABOX_getadditiondatas($id, $pi_name);
            $msg .= DATABOX_getaddtionfieldsText($additionfields, $addition_def, $chk_user, $pi_name, $A['fieldset_id']);
            //タイムスタンプ 更新ユーザ
            $msg .= $LANG_USERBOX_ADMIN['udatetime'] . ":" . $A['udatetime'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['uuid'] . ":" . $A['uuid'] . LB;
            //URL
            $url = $_CONF['site_url'] . "/userbox/profile.php";
            $url .= "?";
            if ($_USERBOX_CONF['datacode']) {
                $url .= "m=code";
                $url .= "&code=" . $A['username'];
            } else {
                $url .= "m=id";
                $url .= "&id=" . $A['id'];
            }
            $url = COM_buildUrl($url);
        }
    }
    if ($_USERBOX_CONF['mail_to_draft'] == 0 and $A['draft_flag'] == 1) {
    } else {
        $message .= $msg . LB;
        $message .= $url . LB;
        $message .= $LANG_USERBOX_MAIL['sig'] . LB;
        $mail_to = $_USERBOX_CONF['mail_to'];
        //--- to user
        if ($_USERBOX_CONF['mail_to_owner'] == 1) {
            if (array_search($email, $mail_to) === false) {
                $to = $email;
                COM_mail($to, $subject, $message);
            }
        }
        //--- to admin
        if (!empty($mail_to)) {
            $to = implode($mail_to, ",");
            COM_mail($to, $subject, $message);
        }
    }
    return $retval;
}
Ejemplo n.º 2
0
function fncsendmail($m = "", $id = 0, $title = "")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_DATABOX_MAIL;
    global $LANG_DATABOX_ADMIN;
    global $_USER;
    global $_DATABOX_CONF;
    $pi_name = "databox";
    $retval = '';
    $site_name = $_CONF['site_name'];
    $subject = sprintf($LANG_DATABOX_MAIL['subject_' . $m], $_USER['username']);
    $message = sprintf($LANG_DATABOX_MAIL['message_' . $m], $_USER['username'], $_USER['uid']);
    if ($m === "data_delete") {
        $msg = $LANG_DATABOX_ADMIN['id'] . ":" . $id . LB;
        $msg .= $LANG_DATABOX_ADMIN['title'] . ":" . $title . LB;
        //URL
        $url = $_CONF['site_url'] . "/databox/data.php";
        $url = COM_buildUrl($url);
        $A['draft_flag'] = 0;
    } else {
        $sql = "SELECT ";
        $sql .= " *";
        $sql .= " FROM ";
        $sql .= $_TABLES['DATABOX_base'];
        $sql .= " WHERE ";
        $sql .= " id = {$id}";
        $result = DB_query($sql);
        $numrows = DB_numRows($result);
        if ($numrows > 0) {
            $A = DB_fetchArray($result);
            $A = array_map('stripslashes', $A);
            //下書
            if ($A['draft_flag'] == 1) {
                $msg .= $LANG_DATABOX_ADMIN['draft'] . LB;
            }
            //基本項目
            $msg .= $LANG_DATABOX_ADMIN['code'] . ":" . $A['code'] . LB;
            $msg .= $LANG_DATABOX_ADMIN['title'] . ":" . $A['title'] . LB;
            $msg .= $LANG_DATABOX_ADMIN['page_title'] . ":" . $A['page_title'] . LB;
            $msg .= $LANG_DATABOX_ADMIN['description'] . ":" . $A['description'] . LB;
            //カテゴリ
            $msg .= DATABOX_getcategoriesText($id, 0, "DATABOX");
            //追加項目
            $group_id = stripslashes($A['group_id']);
            $owner_id = stripslashes($A['owner_id']);
            $chk_user = DATABOX_chkuser($group_id, $owner_id, "databox.admin");
            $addition_def = DATABOX_getadditiondef();
            $additionfields = DATABOX_getadditiondatas($id);
            $msg .= DATABOX_getaddtionfieldsText($additionfields, $addition_def, $chk_user, $pi_name, $A['fieldset_id']);
            //タイムスタンプ 更新ユーザ
            $msg .= $LANG_DATABOX_ADMIN['udatetime'] . ":" . $A['udatetime'] . LB;
            $msg .= $LANG_DATABOX_ADMIN['uuid'] . ":" . $A['uuid'] . LB;
            //URL
            $url = $_CONF['site_url'] . "/databox/data.php";
            $url .= "?";
            if ($_DATABOX_CONF['datacode']) {
                $url .= "m=code";
                $url .= "&code=" . $A['code'];
            } else {
                $url .= "m=id";
                $url .= "&id=" . $A['id'];
            }
            $url = COM_buildUrl($url);
        }
    }
    if ($_DATABOX_CONF['mail_to_draft'] == 0 and $A['draft_flag'] == 1) {
    } else {
        $message .= $msg . LB;
        $message .= $url . LB;
        $message .= $LANG_DATABOX_MAIL['sig'] . LB;
        $mail_to = $_DATABOX_CONF['mail_to'];
        //--- to owner
        if ($_DATABOX_CONF['mail_to_owner'] == 1) {
            $owner_email = DB_getItem($_TABLES['users'], "email", "uid=" . $A['owner_id']);
            if (array_search($owner_email, $mail_to) === false) {
                $to = $owner_email;
                COM_mail($to, $subject, $message);
            }
        }
        //--- mail_to
        if (!empty($mail_to)) {
            $to = implode($mail_to, ",");
            COM_mail($to, $subject, $message);
        }
    }
    return $retval;
}