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; }
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; }
function fnclist($id, $template) { global $_CONF; global $_TABLES; global $_USER_CONF; global $perpage; global $LANG_USERBOX; global $LANG_USERBOX_ADMIN; global $LANG_USERBOX_NOYES; //----- $page = COM_applyFilter($_REQUEST['page'], true); if (!isset($page) or $page == 0) { $page = 1; } $pi_name = "userbox"; $field_def = DATABOX_getadditiondef($pi_name); //----- $tbl1 = $_TABLES['USERBOX_addition']; $tbl2 = $_TABLES['USERBOX_base']; $tbl3 = $_TABLES['USERBOX_def_field']; $tbl5 = $_TABLES['users']; //----- $sql = "SELECT " . LB; $sql .= " t1.field_id " . LB; $sql .= " ,t1.value " . LB; $sql .= " ,t3.name " . LB; $sql .= " ,t3.templatesetvar" . LB; $sql .= " ,t3.description " . LB; $sql .= " ,Count(t1.id) AS count" . LB; $sql .= " FROM " . LB; $sql .= " {$tbl1} AS t1 " . LB; $sql .= " ,{$tbl2} AS t2 " . LB; $sql .= " ,{$tbl3} AS t3 " . LB; $sql .= " ,{$tbl5} AS t5 " . LB; $sql .= " WHERE " . LB; $sql .= " t1.value <>''" . LB; $sql .= " AND t1.id = t2.id " . LB; $sql .= " AND t1.id = t5.uid " . LB; $sql .= " AND t1.field_id = t3.field_id " . LB; //TYPE[0] = '一行テキストフィールド'; //TYPE[2] = 'いいえ/はい'; //TYPE[3] = '日付 (date picker対応)'; //TYPE[7] = 'オプションリスト'; //TYPE[8] = 'ラジオボタンリスト'; //TYPE[9] = 'オプションリスト(マスタ) (既定リスト)'; $sql .= " AND t3.type IN (0,2,3,4,7,8,9,16) " . LB; //ALLOW_DISPLAY[0] ='表示する(orderに指定可能)'; //ALLOW_DISPLAY[1] ='ログインユーザのみ表示する'; if (COM_isAnonUser()) { $sql .= " AND t3.allow_display=0 " . LB; } else { $sql .= " AND t3.allow_display IN (0,1) " . LB; } if ($id != 0) { $sql .= " AND t1.field_id = " . $id . LB; } //管理者の時,下書データも含む //if ( SEC_hasRights('userbox.admin')) { //}else{ $sql .= " AND t2.draft_flag=0" . LB; //} //アクセス権のないデータ はのぞく $sql .= COM_getPermSql('AND', 0, 2, "t2") . LB; //公開日以前のデータはのぞく $sql .= " AND (released <= NOW())" . LB; //公開終了日を過ぎたデータはのぞく $sql .= " AND (expired=0 OR expired > NOW())" . LB; $sql .= " GROUP BY " . LB; $sql .= " t1.field_id , t1.value" . LB; $sql .= " ORDER BY " . LB; $sql .= " t1.field_id,t1.value" . LB; $result = DB_query($sql); $cnt = DB_numRows($result); $pages = 0; if ($perpage > 0) { $pages = ceil($cnt / $perpage); } //ヘッダ、左ブロック //@@@@@@ 修正要 if ($id == 0) { $w = $LANG_USERBOX['attribute_top']; $attribute_top = $w; $field_top = ""; $col = "col.thtml"; } else { $url = $_CONF['site_url'] . "/userbox/attribute.php"; $attribute_top = ":<a href='" . $url . "'>" . $LANG_USERBOX['attribute_top'] . "</a>"; $w = $field_def[$id]['name'] . $LANG_USERBOX['countlist']; $field_top = $w; $col = "col2.thtml"; } if ($page > 1) { $page_title = sprintf('%s (%d)', $w, $page); } else { $page_title = sprintf('%s ', $w); } $headercode .= DATABOX_getheadercode("attribute", $template, $pi_name, 0, $_CONF['site_name'], $_CONF['meta_description'], $_CONF['meta_keywords'], $_CONF['meta_description']); $retval .= DATABOX_siteHeader($pi_name, '', $page_title, $headercode); // $tmplfld = DATABOX_templatePath('attribute', $template, $pi_name); $templates = new Template($tmplfld); $templates->set_file(array('list' => 'list.thtml', 'nav' => 'navigation.thtml', 'row' => 'row.thtml', 'col' => $col, 'pagenav' => 'pagenavigation.thtml')); $languageid = COM_getLanguageId(); $language = COM_getLanguage(); $templates->set_var('languageid', $languageid); $templates->set_var('language', $language); if ($languageid != "") { $templates->set_var('_languageid', "_" . $languageid); } else { $templates->set_var('_languageid', ""); } // $templates->set_var('site_url', $_CONF['site_url']); $templates->set_var('this_script', THIS_SCRIPT); $templates->set_var('home', $LANG_USERBOX['home']); $templates->set_var('attribute_top', $attribute_top); $templates->set_var('field_top', $field_top); //page $offset = ($page - 1) * $perpage; $lin1 = $offset + 1; $lin2 = $lin1 + $perpage - 1; if ($lin2 > $cnt) { $lin2 = $cnt; } $templates->set_var('lang_view', $LANG_USERBOX['view']); $templates->set_var('lin', $lin1 . "-" . $lin2); $templates->set_var('cnt', $cnt); // $templates->set_var('lang_name', $LANG_USERBOX_ADMIN['name']); $templates->set_var('lang_count', $LANG_USERBOX['count']); $sql .= " LIMIT {$offset}, {$perpage}"; $result = DB_query($sql); $numrows = DB_numRows($result); if ($numrows > 0) { for ($i = 0; $i < $numrows; $i++) { $A = DB_fetchArray($result); $name = COM_applyFilter($A['name']); $description = COM_applyFilter($A['description']); $fid = $A["field_id"]; $value = $A["value"]; $fieldvalue = DATABOX_getfieldvalue($value, $field_def[$fid]['type'], $field_def[$fid]['selectionary'], $LANG_USERBOX_NOYES, $field_def[$fid]['selectlist'], $pi_name); $url = $_CONF['site_url'] . "/" . THIS_SCRIPT; $url .= "?"; $url .= "id=" . $A['field_id']; $url .= "&m=id"; $url2 = $url . "&value=" . $A['value']; $url = COM_buildUrl($url); $link = COM_createLink($name, $url); $url2 = COM_buildUrl($url2); $link2 = COM_createLink($fieldvalue, $url2); $templates->set_var('field_link', $link); $templates->set_var('value_link', $link2); $templates->set_var('field_description', $description); $templates->set_var('field_name', $name); $templates->set_var('field_url', $url); $templates->set_var('value_url', $url2); $templates->set_var('value', $fieldvalue); $templates->set_var('count', $A['count']); //===== $templates->parse('col_var', 'col', true); $templates->parse('row_var', 'row', true); $templates->set_var('col_var', ''); } // Call to plugins to set template variables in the databox PLG_templateSetVars('userbox', $templates); //ページなび //$url = $_CONF['site_url'] . '/'.THIS_SCRIPT."?m=".$m;//."?order=$order"; $url = $_CONF['site_url'] . '/' . THIS_SCRIPT; $templates->set_var('page_navigation', COM_printPageNavigation($url, $page, $pages)); //------------ $templates->parse('nav_var', 'nav', true); $templates->set_var('blockfooter', COM_endBlock()); $templates->set_var('msg', ""); $templates->parse('output', 'list'); $school_content = $templates->finish($templates->get_var('output')); $retval .= $school_content; } else { $templates->set_var('msg', $LANG_USERBOX["nohit"]); $templates->parse('output', 'list'); $content = $templates->finish($templates->get_var('output')); $retval .= $content; } $retval = PLG_replacetags($retval); return $retval; }