function plugin_close_convert() { global $vars, $script; $qm = get_qm(); $qt = get_qt(); $page = isset($vars['page']) ? $vars['page'] : ''; //キャッシュ無効 $qt->enable_cache = false; $title = $qm->m['plg_close']['title']; $msg = $qm->m['plg_close']['ntc']; //parse arguments $args = func_get_args(); $num = count($args); if ($num == 0) { //do nothing } else { if ($num == 1) { $title = array_pop($args); } else { list($title, $msg) = $args; } } $editable = edit_auth($page, FALSE, FALSE); if ($editable) { return $qm->m['plg_close']['ntc_admin']; } else { force_output_message($title, '', $msg); } }
function plugin_fb_likegate_convert() { global $vars, $script, $nowindow; $qm = get_qm(); $qt = get_qt(); $editable = edit_auth($page, FALSE, FALSE); //本文部分以外のページに設置した場合、無効にする if (isset($vars['page_alt']) && is_page($vars['page_alt'])) { if ($editable) { return 'error: #fb_likegate: 本文に設置してください。'; } else { return ''; } } $page = isset($vars['page']) ? $vars['page'] : ''; //キャッシュ無効 $qt->enable_cache = false; $args = func_get_args(); if (count($args) === 0) { return $qm->replace('fmt_err_cvt', 'fb_likegate', $qm->m['plg_fb_likegate']['err_usage']); } list($unlike_page) = $args; $fb_apps_url = plugin_fb_root_get_apps_url(); //Facebook からのアクセス if ($signed_request = plugin_fb_root_parse_request()) { $nowindow = 1; $edit_url = $script . '?cmd=edit&page=' . rawurlencode($page); plugin_fb_root_set_page(); $liked = (isset($signed_request->page->liked) and !is_null($signed_request->page->liked)) ? $signed_request->page->liked : $signed_request->page['liked']; if ($liked) { $src = get_source($page); foreach ($src as $i => $line) { if (strpos($line, '#fb_likegate') === 0) { unset($src[$i]); break; } } $body = convert_html($src); } else { $src = get_source($unlike_page); foreach ($src as $i => $line) { if (strpos($line, '#fb_page') === 0) { unset($src[$i]); } } $body = convert_html($src); } if ($editable) { $add_body = convert_html($qm->replace('plg_fb_likegate.ntc_admin_fb', $edit_url, $unlike_page, $fb_apps_url)); } force_output_message('', '', $add_body . $body); } else { if ($editable) { return convert_html($qm->replace('plg_fb_likegate.ntc_admin', $unlike_page, $fb_apps_url)); } force_output_message($qm->m['plg_fb_likegate']['ntc_title'], '', $qm->m['plg_fb_likegate']['ntc_msg']); } }
function plugin_fb_page_convert() { global $vars, $script, $nowindow; $qm = get_qm(); $qt = get_qt(); $qt->setv('jquery_include', true); $editable = edit_auth($page, FALSE, FALSE); //本文部分以外のページに設置した場合、無効にする if (isset($vars['page_alt']) && is_page($vars['page_alt'])) { if ($editable) { return 'error: #fb_page: 本文に設置してください。'; } else { return ''; } } $page = isset($vars['page']) ? $vars['page'] : ''; //キャッシュ無効 $qt->enable_cache = false; $args = func_get_args(); $fb_apps_url = plugin_fb_root_get_apps_url(); //Facebook からのアクセス if ($signed_request = plugin_fb_root_parse_request()) { $nowindow = 1; $edit_url = $script . '?cmd=edit&page=' . rawurlencode($page); plugin_fb_root_set_page(); $lines = get_source($page); foreach ($lines as $k => $v) { if (strpos($v, '#fb_page') === 0) { unset($lines[$k]); } } $body = convert_html($lines); if ($editable) { $add_body = convert_html($qm->replace('plg_fb_page.ntc_admin_fb', $edit_url, $fb_apps_url)); } force_output_message('', '', $add_body . $body); } else { if ($editable) { return convert_html($qm->m['plg_fb_page']['ntc_admin']); } force_output_message($qm->m['plg_fb_likegate']['ntc_title'], '', $qm->m['plg_fb_likegate']['ntc_msg']); } }
function plugin_qform_do_finish($params, $url_sanitize = '0') { global $vars, $script, $google_apps, $google_apps_domain, $pass; $qm = get_qm(); $page = $vars['page']; $conf = $params['conf']; $els = $params['element']; $search = array(); $udata = array(); //mk data $all = ''; $excludes = array_flip(array('email')); foreach ($els as $id => $v) { $tmp = isset($_SESSION['qform'][$id]) ? $_SESSION['qform'][$id] : ''; //住所だけ、特別扱い if ($id === 'address_zip') { $tmp = ''; foreach (array('address_zip', 'address_state', 'address_city', 'address_street') as $addname) { $udata[$addname] = isset($_SESSION['qform'][$addname]) ? $_SESSION['qform'][$addname] : ''; $search[$addname] = '<%' . $addname . '%>'; $tmp .= $_SESSION['qform'][$addname] . "\n"; } $tmp = substr($tmp, 0, -1); $id = 'address'; } else { if (preg_match('/^address_/', $id)) { continue; } } $data = is_array($tmp) ? implode(", ", $tmp) : $tmp; $udata[$id] = array_key_exists($id, $excludes) ? $data : plugin_qform_sanitize_url($data, $url_sanitize); $search[$id] = '<%' . $id . '%>'; //lname, fnameのとき用 if ($id == 'lname') { $all .= $v['label'] . ' : '; $all .= $udata['lname'] . ' ' . $_SESSION['qform']['fname'] . "\n"; } //lname_kana, fname_kanaのとき用 if ($id == 'lname_kana') { $all .= $v['label'] . ' : '; $all .= $udata['lname_kana'] . ' ' . $_SESSION['qform']['fname_kana'] . "\n"; } if ($id != 'fname' && $id != 'lname' && $id != 'fname_kana' && $id != 'lname_kana') { $all .= $v['label'] . ' : '; //addressの時だけ、ラベルの後に改行を入れる if ($id == 'address') { $all .= "\n"; } $all .= $udata[$id] . "\n"; } } $search['all_post_data'] = '<%all_post_data%>'; $udata['all_post_data'] = $all; $search['form_url'] = '<%form_url%>'; $udata['form_url'] = $script . '?' . rawurlencode($page); //mail送信 $smail = new SimpleMail(); // -------------------------------- // Auto Reply Mail (finish mail) // -------------------------------- if (isset($conf['finish_mail'])) { $subject = str_replace($search, $udata, $conf['finish_mail']['subject']); $mailbody = str_replace($search, $udata, $conf['finish_mail']['body']); //Google Appsを使って、更に自分宛の場合 if ($google_apps && preg_match('/.*@' . $google_apps_domain . '$/', $udata['email'])) { $mail =& new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $conf['finish_mail']['from']['email'], 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($udata['email']); $mail->subject($subject); $mail->from($conf['finish_mail']['from']['email']); $mail->text($mailbody); $retval = $mail->send(); } else { // 通常の送信 $smail->set_params($conf['finish_mail']['from']['name'], $conf['finish_mail']['from']['email']); $smail->subject = $subject; $smail->to = array('name' => '', 'email' => $udata['email']); $smail->send($mailbody); } } // ------------------------------- // notice mail // ------------------------------- if (isset($conf['notice_mail'])) { $subject = str_replace($search, $udata, $conf['notice_mail']['subject']); $mailbody = str_replace($search, $udata, $conf['notice_mail']['body']); // commu if (isset($_SESSION['commu_user'])) { // commu $domain = ini_get('session.cookie_domain'); // commu $path = ini_get('session.cookie_path'); // commu $url = (SERVER_PORT == 443) ? 'https://' : 'http://'; // commu $url .= $domain; // commu $url .= (SERVER_PORT == 80) ? '' : ':'.SERVER_PORT; // commu $url .= $path.'commu/admin_user_view.php?cid='.$_SESSION['commu_user']['id']; // commu $mailbody .= "\n\n----------------------------\n"; // commu $mailbody .= "ユーザーの詳細\n".$url."\n"; // commu } $to_name = $conf['notice_mail']['to']['name']; $to_email = $conf['notice_mail']['to']['email']; //Google Appsを使って、更に自分宛の場合 if ($google_apps && preg_match('/.*@' . $google_apps_domain . '$/', $to_email)) { $mail =& new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $udata['email'], 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($to_email); $mail->subject($subject); $mail->from($udata['email']); $mail->text($mailbody); //添付ファイル foreach ($_SESSION['qform']['_FILES'] as $f) { if (file_exists($f['path'])) { $mail->attach(array($f['path'], $f['name']), true); } } $retval = $mail->send(); } else { $name = isset($udata['lname']) ? $udata['lname'] : ''; $name .= isset($udata['fname']) ? $udata['fname'] : ''; $smail->set_params($name, $udata['email']); $smail->subject = $subject; $smail->to = array('name' => $to_name, 'email' => $to_email); //添付ファイル foreach ($_SESSION['qform']['_FILES'] as $f) { if (file_exists($f['path'])) { $smail->add_attaches($f['name'], $f['path']); } } $smail->send($mailbody); } } // ------------------------------- // session destroy & tmpfile unlink // ------------------------------- plugin_qform_unlink_attaches(); $_SESSION['qform'] = null; unset($_SESSION['qform']); // ------------------------------- // post // ------------------------------- if (isset($conf['finish_post'])) { $dat = $conf['finish_post']['data']; $to_enc = $conf['finish_post']['encode']; $url = $conf['finish_post']['url']; foreach ($dat as $key => $val) { $val = str_replace($search, $udata, $val); $dat[$key] = mb_convert_encoding($val, $to_enc, 'UTF-8'); } $pdata = http_build_query($dat, "", "&"); $res = do_post_request($url, $pdata); //echo $res; } // -------------------------------- // redirect // -------------------------------- if (isset($conf['finish_url']) && is_url($conf['finish_url'])) { header('Location: ' . $conf['finish_url']); exit; } // --------------------------------- // 完了ページの表示 // --------------------------------- if (isset($conf['finish_msg'])) { $body = str_replace($search, $udata, $conf['finish_msg']); force_output_message($qm->m['plg_qform']['title_finished'], $page, convert_html($body)); } else { force_output_message($qm->m['plg_qform']['title_finished'], $page, $qm->m['plg_qform']['finished']); } }
function plugin_pkwkmail_en_convert() { //--- キャッシュを無効に --- $qt = get_qt(); $qt->enable_cache = false; global $vars, $_pkwkmail_msg, $script; $page = isset($vars['page']) ? $vars['page'] : ''; //freeze check - 凍結していない場合はエラー if (PKWKMAIL_FREEZE_CHECK == '1') { if (!is_freeze($vars['page'])) { return '<p>' . $_pkwkmail_msg['not_use'] . '</p>'; } } //preparing values - return code > return after quotation - 変数の準備と改行コード一時退避 $lines = array(); if (isset($vars['refer'])) { $r_page = htmlspecialchars($vars['refer']); $page = $r_page; $lines = PKWKMAIL_read_postdata_old($r_page); } else { $args = func_get_args(); $args = str_replace(array("\r", "\r\n"), "\n", $args); $lines = preg_replace("/\\s*=\\s*'\n*/", "='", $args[0]); $lines = str_replace("'\n", "'PKWKMAIL_EXPLODE", $lines); $lines = str_replace("\n", "PKWKMAIL_LATER_RETRUN", $lines); $lines = explode("PKWKMAIL_EXPLODE", $lines); } //decide form action destination $a_page = $script . '?' . rawurlencode($page); //phase check - 段階のチェック $cnfm = 0; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($vars['cnfm_chk']) && $vars['cnfm_chk'] == 1) { $cnfm = 1; } if (isset($vars['cnfm_snd']) && $vars['cnfm_snd'] == 1) { $cnfm = 2; } } //switch - 段階に応じた対応分岐 switch ($cnfm) { case 1: $attr = PKWKMAIL_prepare($lines); $body = PKWKMAIL_confirm($attr, $a_page); // $body.= PKWKMAIL_formmaker( $attr,$cnfm ); // return $body; $title = $attr['confirm_message_title']; force_output_message($title, $page, "<h2>{$title}</h2>" . $body); break; case 2: $attr = PKWKMAIL_prepare($lines); $body = PKWKMAIL_sent($attr); // return $body; $title = $attr['finish_message_title']; force_output_message($title, $page, "<h2>{$title}</h2>" . $body); break; default: $attr = PKWKMAIL_prepare($lines); $body = PKWKMAIL_entry($attr); $body .= PKWKMAIL_formmaker($attr, $cnfm, $a_page); return $body; } }
/** * Redirect to URL or Page */ function redirect($url = '', $msg = '', $refresh_sec = 2) { global $script, $style_name, $vars; $qt = get_qt(); if (is_url($url)) { // } else { if (is_page($url)) { $url = $script . '?' . $url; } else { $url = $script; } } if ($msg !== '') { $style_name = '../'; $title = array_shift(explode("\n", $msg)); $head = '<meta http-equiv="refresh" content="' . h($refresh_sec) . ';URL=' . h($url) . '" />'; $qt->appendv('beforescript', $head); $vars['disable_toolmenu'] = TRUE; $body = convert_html(' * ' . $msg . ' ' . $refresh_sec . '秒後に移動します。 移動しない場合は[[ここをクリック>' . $url . ']] '); force_output_message($title, '', $body); } else { header('Location: ' . $url); } exit; }
function plugin_qlg_convert() { global $vars, $script, $nowindow; $qm = get_qm(); $qt = get_qt(); $qt->setv('jquery_include', true); $editable = edit_auth($page, FALSE, FALSE); //本文部分以外のページに設置した場合、無効にする if (isset($vars['page_alt']) && is_page($vars['page_alt'])) { if ($editable) { return 'error: #qlg: 本文に設置してください。'; } else { return ''; } } $page = isset($vars['page']) ? $vars['page'] : ''; //キャッシュ無効 $qt->enable_cache = false; $args = func_get_args(); $code = array_pop($args); $meta = FALSE; if ($code) { $meta = sprintf(PLUGIN_QLG_VERIFY_META_FMT, $code); //set verify code $qt->appendv_once('plugin_qlg', 'beforescript', "\n" . $meta); } // 現在、QLG からだと管理者かどうかは判別できない $fb_apps_url = plugin_fb_root_get_apps_url(); //Facebook からのアクセス if ($signed_request = plugin_fb_root_parse_request()) { $nowindow = 1; $edit_url = $script . '?cmd=edit&page=' . rawurlencode($page); plugin_fb_root_set_page_css(); $lines = get_source($page); foreach ($lines as $k => $v) { if (strpos($v, '#qlg') === 0) { unset($lines[$k]); } } $body = convert_html($lines); if ($editable) { $add_body = convert_html($qm->replace('plg_fb_page.ntc_admin_fb', $edit_url, $fb_apps_url)); if ($meta === FALSE) { $add_body .= convert_html(' &deco(b,red,,18){エラー:確認コードが設定されていません。}; Quick LikeGate のページへ移動して、確認コードをコピペしてください。 '); // add_body end } $add_body .= ' Quick LikeGate は<a href="' . PLUGIN_QLG_APP_URL . '" target="_parent">こちら</a>。 '; // add_body end } force_output_message('', '', $add_body . $body); } else { if ($editable) { $ntc = ' \'\'【お知らせ】管理者モード以外のアクセスでは表示されません。\'\' Quick LikeGate から読み込まれている場合のみ表示されます。 '; // convert_html end if ($meta === FALSE) { $ntc .= ' &deco(b,red,,18){エラー:確認コードが設定されていません。}; Quick LikeGate のページへ移動して、確認コードをコピペしてください。 '; // ntc end } $add_body = ' Quick LikeGate は<a href="' . PLUGIN_QLG_APP_URL . '" target="_blank">こちら</a>。 '; return convert_html($ntc) . $add_body; } force_output_message($qm->m['plg_fb_likegate']['ntc_title'], '', $qm->m['plg_fb_likegate']['ntc_msg']); } }