function execute($requests)
 {
     $csv = '"カテゴリ","画像容量","平均容量(1人当り)"' . "\n";
     $csv = mb_convert_encoding($csv, 'SJIS', 'UTF-8');
     $analysis_image_category = get_analysis_image_category();
     foreach ($analysis_image_category as $key => $value) {
         $category = $analysis_image_category[$key]['category'];
         $category = mb_convert_encoding($category, 'SJIS', 'UTF-8');
         $sum = $analysis_image_category[$key]['sum'];
         $avg = $analysis_image_category[$key]['avg'];
         $csv .= sprintf("\"%s\",%01.2f,%01.2f\n", $category, $sum, $avg);
     }
     $analysis_image_category_sum = get_analysis_image_category_sum();
     $category_sum = $analysis_image_category_sum['category'];
     $category_sum = mb_convert_encoding($category_sum, 'SJIS', 'UTF-8');
     $sum_all = $analysis_image_category_sum['sum'];
     $avg_all = $analysis_image_category_sum['avg'];
     $csv .= sprintf("\"%s\",%01.2f,%01.2f\n", $category_sum, $sum_all, $avg_all);
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=analysis_image_category.csv");
     echo $csv;
     exit;
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $target_c_message_id = $requests['target_c_message_id'];
     $c_message = db_message_c_message4c_message_id2($target_c_message_id, $u);
     // 権限チェック
     if (!util_is_readable_message($u, $target_c_message_id)) {
         handle_kengen_error();
     }
     // ファイルアップロード機能がオフ
     if (!OPENPNE_USE_FILEUPLOAD) {
         handle_kengen_error();
     }
     // ファイルが存在しない
     $file = db_file_c_file4filename($c_message['filename']);
     if (empty($file)) {
         handle_kengen_error();
     }
     // オリジナルファイル名
     $original_filename = $file['original_filename'];
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
         // IE の場合のみ、ファイル名を SJIS に変換し、キャッシュをさせないヘッダを出力しない
         $original_filename = mb_convert_encoding($original_filename, 'SJIS', 'UTF-8');
     } else {
         send_nocache_headers(true);
     }
     $original_filename = str_replace(array("\r", "\n"), '', $original_filename);
     header('Content-Disposition: attachment; filename="' . $original_filename . '"');
     header('Content-Length: ' . strlen($file['bin']));
     header('Content-Type: application/octet-stream');
     echo $file['bin'];
     exit;
 }
Пример #3
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $c_commu_topic_comment_id = $requests['target_c_commu_topic_comment_id'];
     // ----------
     if (!$c_commu_topic_id && !$c_commu_topic_comment_id) {
         handle_kengen_error();
     }
     if ($c_commu_topic_comment_id) {
         $c_topic_comment = db_commu_c_commu_topic_comment4c_commu_topic_comment_id($c_commu_topic_comment_id);
         $c_commu_id = $c_topic_comment['c_commu_id'];
         $filename = $c_topic_comment['filename'];
     } else {
         $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id);
         $c_commu_id = $c_topic['c_commu_id'];
         $filename = $c_topic['filename'];
     }
     //--- 権限チェック
     //コミュニティ参加者
     $status = db_common_commu_status($u, $c_commu_id);
     if (!$status['is_bbs_view']) {
         handle_kengen_error();
     }
     // ファイルアップロード機能がオフ
     if (!OPENPNE_USE_FILEUPLOAD) {
         handle_kengen_error();
     }
     // ファイルが存在しない
     $file = db_file_c_file4filename($filename);
     if (empty($file)) {
         handle_kengen_error();
     }
     // オリジナルファイル名
     $original_filename = $file['original_filename'];
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
         // IE の場合のみ、ファイル名を SJIS に変換し、キャッシュをさせないヘッダを出力しない
         $original_filename = mb_convert_encoding($original_filename, 'SJIS', 'UTF-8');
     } else {
         send_nocache_headers(true);
     }
     $original_filename = str_replace(array("\r", "\n"), '', $original_filename);
     header('Content-Disposition: attachment; filename="' . $original_filename . '"');
     header('Content-Length: ' . strlen($file['bin']));
     header('Content-Type: application/octet-stream');
     echo $file['bin'];
     exit;
 }
 function execute($requests)
 {
     if (!LOG_C_ACCESS_LOG) {
         admin_client_redirect('top', '指定されたページにはアクセスできません');
     }
     $ktai_flag = $requests['ktai_flag'];
     $ymd = $requests['ymd'];
     $month_flag = $requests['month_flag'];
     $page_name = $requests['page_name'];
     $orderby = $requests['orderby'];
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=access_analysis_target_topic.csv");
     $out = fopen('php://output', 'w');
     $csv_header = array('トピックID', 'トピック名', WORD_COMMUNITY . '名', 'アクセス数');
     for ($i = 0; $i < sizeof($csv_header); $i++) {
         $csv_header[$i] = mb_convert_encoding($csv_header[$i], 'SJIS', 'UTF-8');
     }
     fputcsv($out, $csv_header);
     $sum = 0;
     $page = 1;
     $page_size = -1;
     list($target_topic) = p_access_analysis_target_topic_target_topic4ym_page_name($ymd, $month_flag, $page_name, $ktai_flag, $page, $page_size, $orderby);
     foreach ($target_topic as $item) {
         if ($item['is_c_commu_topic_exists']) {
             $topic_name = mb_convert_encoding($item['topic_name'], 'SJIS', 'UTF-8');
             $commu_name = mb_convert_encoding($item['commu_name'], 'SJIS', 'UTF-8');
         } else {
             $msg = '(既に削除されたトピックです)';
             $msg = mb_convert_encoding($msg, 'SJIS', 'UTF-8');
             $topic_name = $msg;
             $commu_name = $msg;
         }
         $csv_line = array($item['target_c_commu_topic_id'], $topic_name, $commu_name, $item['count']);
         fputcsv($out, $csv_line);
         $sum += $item['count'];
     }
     fputcsv($out, array(mb_convert_encoding('合計', 'SJIS', 'UTF-8'), '', '', $sum));
     exit;
 }
 function execute($requests)
 {
     $csv = '"月","人数"' . "\n";
     $csv = mb_convert_encoding($csv, 'SJIS', 'UTF-8');
     $analysis_date_month = get_analysis_date_month();
     foreach ($analysis_date_month as $key => $value) {
         $csv .= sprintf("\"%s\",%d\n", $key, $value);
     }
     $csv_analysis_sum = '合計';
     $csv_analysis_sum = mb_convert_encoding($csv_analysis_sum, 'SJIS', 'UTF-8');
     $analysis_date_month_sum = array_sum($analysis_date_month);
     $csv .= sprintf("\"%s\",%d\n", $csv_analysis_sum, $analysis_date_month_sum);
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=user_analysis_date_month.csv");
     echo $csv;
     exit;
 }
 function execute($requests)
 {
     if (!LOG_C_ACCESS_LOG) {
         admin_client_redirect('top', '指定されたページにはアクセスできません');
     }
     $ktai_flag = $requests['ktai_flag'];
     $ymd = $requests['ymd'];
     $csv = '"年月日","アクセス数"' . "\n";
     $csv = mb_convert_encoding($csv, 'SJIS', 'UTF-8');
     $access_analysis_day = p_access_analysis_day_access_analysis_day($ymd, $ktai_flag);
     foreach ($access_analysis_day as $item) {
         $csv .= sprintf("\"%s\",%d\n", $item['ymd'], $item['count']);
     }
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=access_analysis_day.csv");
     echo $csv;
     exit;
 }
 function execute($requests)
 {
     $date = $requests['date'];
     list($year, $month, $day) = explode('-', $date);
     $date = mb_substr($date, 0, 7);
     $csv = '"年月日","人数"' . "\n";
     $csv = mb_convert_encoding($csv, 'SJIS', 'UTF-8');
     $analysis_date_day = get_analysis_date_day($date);
     foreach ($analysis_date_day as $key => $value) {
         $csv .= sprintf("\"%d/%d/%d\",%d\n", $year, $month, $key, $value);
     }
     $csv_analysis_sum = '合計';
     $csv_analysis_sum = mb_convert_encoding($csv_analysis_sum, 'SJIS', 'UTF-8');
     $analysis_date_day_sum = array_sum($analysis_date_day);
     $csv .= sprintf("\"%s\",%d\n", $csv_analysis_sum, $analysis_date_day_sum);
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=user_analysis_date_day.csv");
     echo $csv;
     exit;
 }
 function execute($requests)
 {
     if (!LOG_C_ACCESS_LOG) {
         admin_client_redirect('top', '指定されたページにはアクセスできません');
     }
     $ktai_flag = $requests['ktai_flag'];
     $ymd = $requests['ymd'];
     $month_flag = $requests['month_flag'];
     $page_name = $requests['page_name'];
     $orderby = $requests['orderby'];
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=access_analysis_member.csv");
     $out = fopen('php://output', 'w');
     $csv_header = array('メンバーID', WORD_NICKNAME, 'アクセス数');
     for ($i = 0; $i < sizeof($csv_header); $i++) {
         $csv_header[$i] = mb_convert_encoding($csv_header[$i], 'SJIS', 'UTF-8');
     }
     fputcsv($out, $csv_header);
     $sum = 0;
     $page = 1;
     $page_size = -1;
     list($access_member) = p_access_analysis_member_access_member4ym_page_name($ymd, $month_flag, $page_name, $ktai_flag, $page, $page_size, $orderby);
     foreach ($access_member as $item) {
         $nickname = $item['is_c_member_exists'] ? $item['nickname'] : '(既に退会したメンバーです)';
         $nickname = mb_convert_encoding($nickname, 'SJIS', 'UTF-8');
         $csv_line = array($item['c_member_id'], $nickname, $item['count']);
         fputcsv($out, $csv_line);
         $sum += $item['count'];
     }
     fputcsv($out, array(mb_convert_encoding('合計', 'SJIS', 'UTF-8'), '', $sum));
     exit;
 }
Пример #9
0
 function execute($requests)
 {
     $arr_start_date['year'] = $requests['PERIOD_FROM_YEAR'];
     $arr_start_date['month'] = $requests['PERIOD_FROM_MONTH'];
     $arr_start_date['day'] = $requests['PERIOD_FROM_DAY'];
     $arr_end_date['year'] = $requests['PERIOD_TO_YEAR'];
     $arr_end_date['month'] = $requests['PERIOD_TO_MONTH'];
     $arr_end_date['day'] = $requests['PERIOD_TO_DAY'];
     //入力値の精査
     //(1)日付入力チェック(期間指定だった場合)
     if ($requests['IS_PERIOD'] > 0) {
         $this->check_date_error($arr_start_date, $errors, "対象期間(開始)");
         $this->check_date_error($arr_end_date, $errors, "対象期間(終了)");
         if (empty($errors)) {
             $this->check_date_error_for_period($arr_start_date, $arr_end_date, $errors);
         }
         // エラーがあればリダイレクト
         if (!empty($errors)) {
             $this->handleError($errors);
         }
         $start_datetime = $this->conv_timestamp_to_datetime($this->conv_arr_date_to_timestamp($arr_start_date));
         $end_datetime = $this->conv_timestamp_to_datetime($this->conv_arr_date_to_timestamp($arr_end_date), array('strtotime' => '+1 day'));
         $dsp_datetime = $this->conv_timestamp_to_datetime($this->conv_arr_date_to_timestamp($arr_end_date));
     }
     //画面データを配列に格納
     $input['data_type'] = $requests['GET_DATA_TYPE'];
     $input['member']['select'] = $requests['SELECT_MEMBER'];
     $input['member']['c_member_id'] = $requests['SELECT_MEMBER_ID'];
     $input['period']['is_period'] = $requests['IS_PERIOD'];
     $input['period']['start_datetime'] = $start_datetime;
     $input['period']['end_datetime'] = $end_datetime;
     $input['period']['dsp_datetime'] = $dsp_datetime;
     $input['commu']['is_commu'] = $requests['IS_COMMU'];
     $input['commu']['category_id'] = $requests['CATEGORY_ID'];
     $input['commu']['commu_id'] = $requests['COMMU_ID'];
     //データ存在チェック
     $id_list = $this->get_id_list($input);
     if (!$id_list) {
         $errors = array('ダウンロードデータ対象データが存在しません');
         $this->handleError($errors);
     }
     //download日時を取得
     $download_date = date('Y/m/d H:i:s');
     //シリアライザ作成
     $options = $this->create_serial_option();
     $serializer = new XML_Serializer($options);
     //RDF配列作成
     $rdf = $this->create_rdf_array($input, $download_date, $id_list);
     $result = $serializer->serialize($rdf);
     if ($result === true) {
         $xml = $serializer->getSerializedData();
         //IE以外の場合、キャッシュをさせないヘッダを出力
         if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
             send_nocache_headers(true);
         }
         header("Content-Type: application/octet-stream");
         header("Content-Disposition: attachment; filename=download.rdf");
         echo $xml;
         //echo "<pre>".htmlspecialchars($xml)."</pre>";
     }
     exit;
 }
Пример #10
0
/**
 * openpne_forward
 *
 * @param string $module a requested module name.
 * @param string $type request type. 'page' or 'do'
 * @param string $action requested page/command name.
 * @param array  $errors error message strings.
 */
function openpne_forward($module, $type = '', $action = '', $errors = array())
{
    /// module ///
    if (!($module = _check_module($module))) {
        openpne_display_error('モジュールが見つかりません', true);
    }
    $GLOBALS['__Framework']['current_module'] = $module;
    // disable modules
    if (in_array($module, (array) $GLOBALS['_OPENPNE_DISABLE_MODULES'])) {
        openpne_display_error('モジュールが無効になっています', true);
    }
    // init
    if ($init = openpne_ext_search("{$module}/init.inc")) {
        require_once $init;
    }
    /// type ///
    if (!$type) {
        $type = $GLOBALS['__Framework']['default_type'];
    }
    if (!_check_type($type)) {
        openpne_display_error('リクエストの種類が正しくありません', true);
    }
    $GLOBALS['__Framework']['current_type'] = $type;
    /// action ///
    if (!($action = _check_action($action))) {
        openpne_display_error('アクションの指定が正しくありません', true);
    }
    if (!($file = openpne_ext_search("{$module}/{$type}/{$action}.php"))) {
        openpne_display_error('アクションファイルが見つかりません', true);
    }
    require_once $file;
    $class_name = "{$module}_{$type}_{$action}";
    if (!class_exists($class_name)) {
        openpne_display_error('アクションが見つかりません', true);
    }
    $action_obj = new $class_name();
    $GLOBALS['__Framework']['current_action'] = $action;
    // maintenace mode
    if (OPENPNE_UNDER_MAINTENANCE) {
        if (!in_array($module, (array) $GLOBALS['_OPENPNE_MAINTENANCE_MODULES']) || in_array($type . '_' . $action, (array) $GLOBALS['_OPENPNE_MAINTENANCE_EXCLUDED_ACTION'][$module])) {
            openpne_display_error();
        }
    }
    // auth
    if ($GLOBALS['__Framework']['is_secure'] = $action_obj->isSecure()) {
        if ($auth = openpne_ext_search("{$module}/auth.inc")) {
            require_once $auth;
        } else {
            require_once 'auth.inc';
        }
    }
    // ---------- リクエストバリデーション ----------
    require_once 'OpenPNE/Validator.php';
    require_once 'OpenPNE/Validator/Common.php';
    $validator = new OpenPNE_Validator_Common();
    $files = array();
    if ($ini = openpne_ext_search("{$module}/validate/{$type}/{$action}.ini")) {
        $files[] = $ini;
    }
    list($result, $requests) = $validator->common_validate($files);
    $action_obj->requests = $requests;
    if ($result === false) {
        $errors = $validator->getErrors();
        $action_obj->handleError($errors);
    }
    // ----------------------------------------------
    switch ($type) {
        case 'page':
            $smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']);
            $smarty->templates_dir = $module . '/templates';
            $smarty->assign('requests', $requests);
            $smarty->assign('msg', $requests['msg']);
            $smarty->assign('msg1', $requests['msg1']);
            $smarty->assign('msg2', $requests['msg2']);
            $smarty->assign('msg3', $requests['msg3']);
            if ($errors) {
                $smarty->assign('errors', $errors);
            }
            if (OPENPNE_USE_PARTIAL_SSL) {
                $a = "{$type}_{$action}";
                if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                    $p = $_POST;
                } else {
                    $p = $_GET;
                }
                switch (openpne_ssl_type($module, $a)) {
                    case 'SSL_REQUIRED':
                        if (!is_ssl()) {
                            openpne_redirect($module, $a, $p);
                        }
                        break;
                    case 'SSL_DISABLED':
                        if (is_ssl()) {
                            openpne_redirect($module, $a, $p);
                        }
                        break;
                    case 'SSL_SELECTABLE':
                        if ($https = is_ssl()) {
                            $url = openpne_gen_url($module, $a, $p, true, 'nonssl');
                        } else {
                            $url = openpne_gen_url($module, $a, $p, true, 'ssl');
                        }
                        $smarty->assign('HTTPS', $https);
                        $smarty->assign('SSL_SELECT_URL', $url);
                        break;
                }
            }
            $action_obj->view =& $smarty;
            break;
    }
    // init function
    $init_func = "init_{$module}_{$type}";
    if (function_exists($init_func)) {
        if (isset($smarty)) {
            $init_func($smarty);
        } else {
            $init_func();
        }
    }
    $result = $action_obj->execute($requests);
    if ($result == 'success') {
        send_nocache_headers();
        if ($smarty->ext_search($smarty->templates_dir . '/common/layout.tpl', $place)) {
            $smarty->assign('op_content', $smarty->ext_fetch("{$action}.tpl"));
            $smarty->ext_display('common/layout.tpl');
        } else {
            $smarty->ext_display("{$action}.tpl");
        }
    }
    // ----------------------------------------------
    // c_access_log
    if (LOG_C_ACCESS_LOG) {
        if ($GLOBALS['__Framework']['is_secure'] && $type == 'page') {
            if ($module == 'pc') {
                p_access_log($GLOBALS['AUTH']->uid(), $action);
            } elseif ($module == 'ktai') {
                p_access_log($GLOBALS['KTAI_C_MEMBER_ID'], $action, 1);
            }
        }
    }
    // カスタムログ用関数の呼び出し
    if (OPENPNE_LOG_FUNCTION && is_callable(OPENPNE_LOG_FUNCTION)) {
        // c_member_id を取得
        $c_member_id = 0;
        if ($GLOBALS['__Framework']['is_secure']) {
            if ($module == 'pc') {
                $c_member_id = $GLOBALS['AUTH']->uid();
            } else {
                if ($module == 'ktai') {
                    $c_member_id = $GLOBALS['KTAI_C_MEMBER_ID'];
                }
            }
        }
        $params = array('module' => $module, 'type' => $type, 'action' => $action, 'c_member_id' => $c_member_id, 'is_secure' => $GLOBALS['__Framework']['is_secure']);
        call_user_func(OPENPNE_LOG_FUNCTION, $params);
    }
    return true;
}