/**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DbConn();
     // ログインチェック
     SC_Utils::sfIsSuccess(new SC_Session());
     // ランキングの変更
     if ($_GET['move'] == 'up') {
         // 正当な数値であった場合
         if (SC_Utils::sfIsInt($_GET['id'])) {
             $this->lfRunkUp($conn, $_GET['id']);
             // エラー処理
         } else {
             GC_Utils::gfPrintLog("error id=" . $_GET['id']);
         }
     } else {
         if ($_GET['move'] == 'down') {
             if (SC_Utils::sfIsInt($_GET['id'])) {
                 $this->lfRunkDown($conn, $_GET['id']);
                 // エラー処理
             } else {
                 GC_Utils::gfPrintLog("error id=" . $_GET['id']);
             }
         }
     }
     // ページの表示
     $this->sendRedirect($this->getLocation(URL_SYSTEM_TOP));
 }
 /**
  * ブロックファイルに応じて tpl_mainpage を設定する
  *
  * @param string $bloc_file ブロックファイル名
  * @return void
  */
 function setTplMainpage($bloc_file)
 {
     $debug_message = "";
     $user_bloc_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . BLOC_DIR . $bloc_file;
     if (is_file($user_bloc_path)) {
         $this->tpl_mainpage = $user_bloc_path;
     } else {
         $this->tpl_mainpage = BLOC_PATH . $bloc_file;
     }
     $debug_message = "block:" . $this->tpl_mainpage . "\n";
     GC_Utils::gfDebugLog($debug_message);
 }
 /**
  * ログローテーション機能
  *
  * XXX この類のローテーションは通常 0 開始だが、本実装は 1 開始である。
  * この中でログ出力は行なわないこと。(無限ループの懸念あり)
  *
  * @param integer $max_log
  *            最大ファイル数
  * @param integer $max_size
  *            最大サイズ
  * @param string $path
  *            ファイルパス
  * @return void
  */
 function gfLogRotation($max_log, $max_size, $path)
 {
     // 終了条件
     if (!@is_file($path)) {
         return;
     }
     if (@filesize($path) <= $max_size) {
         return;
     }
     if (preg_match("{" . date("Y/m/d/a") . "}", $path)) {
         $arrFiles = glob("{$path}.*");
         $arrFilesCount = count($arrFiles);
         $max_log = $arrFilesCount + 2;
         // Archiveログの場合は無尽蔵
         GC_Utils::gfLogRotation($max_log, $max_size, $path);
     } else {
         // 通常ログの場合は設定値
         GC_Utils::gfLogRotation($max_log, $max_size, $path);
     }
 }
示例#4
0
 /**
  * フロント用ログ出力
  *
  * フロント用ログ出力を行ないます
  * @param string $mess ログメッセージ
  * @param string $log_level ログレベル("Info" or "Debug")
  * @return void
  */
 function gfFrontLog($mess, $log_level = 'Info')
 {
     // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する
     if ($log_level === 'Debug' && DEBUG_MODE === false) {
         return;
     }
     // ログメッセージに、呼び出し元関数名等の情報を付加する
     $mess = GC_Utils::gfGetLogStr($mess, $log_level);
     // ログ出力
     // ※現在は管理画面用・フロント用のログ出力とも、同じファイル(site.log)に出力します。
     //  分けたい場合は、以下の関数呼び出しの第2引数にファイルパスを指定してください
     GC_Utils_Ex::gfPrintLog($mess);
 }
示例#5
0
 protected function log($msg)
 {
     $msg = sprintf("%s %s: %s", $this->plugin_code, $this->exec_func, $msg);
     GC_Utils::gfPrintLog($msg, PLUGIN_LOG_REALFILE);
 }
 /**
  * ユーザが作成したファイルをアーカイブしダウンロードさせる
  * TODO 要リファクタリング
  * @param void
  * @return void
  */
 function downloadArchiveFiles($dir)
 {
     $debug_message = "";
     // ダウンロードされるファイル名
     $dlFileName = 'tpl_package_' . date('YmdHis') . '.tar.gz';
     // ファイル一覧取得
     $arrFileHash = SC_Utils::sfGetFileList($dir);
     foreach ($arrFileHash as $val) {
         $arrFileList[] = $val['file_name'];
         $debug_message .= "圧縮:" . $val['file_name'] . "\n";
     }
     GC_Utils::gfDebugLog($debug_message);
     // ディレクトリを移動
     chdir($dir);
     // 圧縮をおこなう
     $tar = new Archive_Tar($dlFileName, true);
     $tar->create($arrFileList);
     // ダウンロード用HTTPヘッダ出力
     header("Content-disposition: attachment; filename={$dlFileName}");
     header("Content-type: application/octet-stream; name={$dlFileName}");
     header("Content-Length: " . filesize($dlFileName));
     readfile($dlFileName);
     unlink($dir . "/" . $dlFileName);
     exit;
 }
示例#7
0
 /**
  * 前方互換用
  *
  * @deprecated 2.12.0
  */
 function gfGetLogStr($mess, $log_level = 'Info')
 {
     trigger_error(t("c_A method for upward compatibility was used._01"), E_USER_WARNING);
     // メッセージの前に、ログ出力元関数名とログ出力関数呼び出し部分の行数を付与
     $mess = GC_Utils::gfGetCallerInfo(true) . $mess;
     // ログレベル=Debugの場合は、[Debug]を先頭に付与する
     if ($log_level === 'Debug') {
         $mess = '[Debug]' . $mess;
     }
     return $mess;
 }
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
/**
 * プラグイン設定をロードする。
 * GETのクエリにplugin_idを渡す。
 *
 * 管理画面から呼び出すことを想定しているので、
 * 認証は外さないこと
 */
require_once 'require.php';
// 認証可否の判定
SC_Utils::sfIsSuccess(new SC_Session());
$plugin_id = isset($_GET['plugin_id']) ? $_GET['plugin_id'] : null;
if (!empty($plugin_id) && is_numeric($plugin_id)) {
    GC_Utils::gfPrintLog('loading plugin ====> plugin_id = ' . $plugin_id);
    $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id);
    if (isset($plugin['plugin_code'])) {
        $config_path = PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/config.php';
        if (file_exists($config_path)) {
            require_once $config_path;
            exit;
        } else {
            die("プラグインの取得に失敗しました: {$config_path}");
        }
    } else {
        die("プラグインが存在しません: plugin_id => {$plugin_id}");
    }
}
示例#9
0
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'require.php';
// 認証可否の判定
SC_Utils::sfIsSuccess(new SC_Session());
$module_id = isset($_GET['module_id']) ? $_GET['module_id'] : null;
if (!empty($module_id) && is_numeric($module_id)) {
    GC_Utils::gfPrintLog("loading module ====> module_id = " . $module_id);
    $objQuery = new SC_Query();
    $arrRet = $objQuery->select("module_code", "dtb_module", "module_id = ?", array($module_id));
    if (isset($arrRet[0]['module_code'])) {
        $config_path = MODULE_PATH . $arrRet[0]['module_code'] . '/config.php';
        if (file_exists($config_path)) {
            require_once $config_path;
            exit;
        } else {
            die("モジュールの取得に失敗しました: {$config_path}");
        }
    } else {
        die("モジュールが存在しません: module_id => {$module_id}");
    }
}
示例#10
0
 /**
  * 各部分のナビ情報を取得する.
  *
  * @param array $arrNavi ナビ情報の配列
  * @param integer|string $target_id ターゲットID
  * @return array ブロック情報の配列
  */
 function lfGetNavi($arrNavi, $target_id)
 {
     $arrRet = array();
     if (is_array($arrNavi) === true) {
         reset($arrNavi);
         while (list($key, $val) = each($arrNavi)) {
             // 指定された箇所と同じデータだけを取得する
             if ($target_id == $val['target_id']) {
                 if ($val['php_path'] != '') {
                     $arrNavi[$key]['php_path'] = HTML_PATH . $val['php_path'];
                 } else {
                     $user_block_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . $val['tpl_path'];
                     if (is_file($user_block_path)) {
                         $arrNavi[$key]['tpl_path'] = $user_block_path;
                     } else {
                         $arrNavi[$key]['tpl_path'] = TEMPLATE_DIR . $val['tpl_path'];
                     }
                 }
                 // phpから呼び出されるか、tplファイルが存在する場合
                 if ($val['php_path'] != '' || is_file($arrNavi[$key]['tpl_path'])) {
                     $arrRet[] = $arrNavi[$key];
                 } else {
                     GC_Utils::gfPrintLog("ブロック読み込みエラー:" . $arrNavi[$key]['tpl_path']);
                 }
             }
         }
     }
     return $arrRet;
 }
示例#11
0
 /**
  * ログを出力.
  *
  * @param string $msg
  * @param mixed $data Dumpしたいデータ.デバッグ用.
  * @param string $suffix
  */
 function log($msg, $data = null, $suffix = '')
 {
     $path = DATA_PATH . 'logs/' . $this->getCode() . "{$suffix}.log";
     GC_Utils::gfPrintLog($msg, $path);
     if (!is_null($data)) {
         GC_Utils::gfPrintLog(print_r($data, true), $path);
     }
 }
示例#12
0
 /**
  * メッセージを出力
  *
  * @param string $message
  */
 function log($message)
 {
     GC_Utils::gfPrintLog($message, OSTORE_LOG_PATH);
 }
示例#13
0
<?php

require_once realpath(dirname(__FILE__)) . '/../require.php';
$qrcode = new Image_QRCode(array("path" => DATA_REALDIR . "module/Image/data", "image_path" => DATA_REALDIR . "module/Image/imagedata"));
GC_Utils::gfPrintLog(print_r($qrcode, true), DEBUG_LOG_REALFILE);
$objProduct = new SC_Product_Ex();
if ($objProduct->isValidProductId($_GET["product_id"])) {
    $qrcode->makeCode(HTTP_URL . substr(P_DETAIL_URLPATH, strlen(ROOT_URLPATH)) . $_GET["product_id"] . $_GET["product_id"], array('image_type' => 'jpeg', 'error_correct' => 'L'));
}
示例#14
0
 function sfMakeDir($path)
 {
     static $count = 0;
     $count++;
     // 無限ループ回避
     $dir = dirname($path);
     if (ereg("^[/]\$", $dir) || ereg("^[A-Z]:[\\]\$", $dir) || $count > 256) {
         // ルートディレクトリで終了
         return;
     } else {
         if (is_writable(dirname($dir))) {
             if (!file_exists($dir)) {
                 mkdir($dir);
                 GC_Utils::gfPrintLog("mkdir {$dir}");
             }
         } else {
             SC_Utils::sfMakeDir($dir);
             if (is_writable(dirname($dir))) {
                 if (!file_exists($dir)) {
                     mkdir($dir);
                     GC_Utils::gfPrintLog("mkdir {$dir}");
                 }
             }
         }
     }
     return;
 }
示例#15
0
 function gfPrintLog($mess, $path = '')
 {
     // 日付の取得
     $today = date("Y/m/d H:i:s");
     // 出力パスの作成
     if ($path == "") {
         $path = LOG_PATH;
     }
     // エスケープされている文字をもとに戻す
     $trans_tbl = get_html_translation_table(HTML_ENTITIES);
     $trans_tbl = array_flip($trans_tbl);
     $mess = strtr($mess, $trans_tbl);
     $fp = fopen($path, "a+");
     if ($fp) {
         fwrite($fp, $today . " [" . $_SERVER['PHP_SELF'] . "] " . $mess . " from " . $_SERVER['REMOTE_ADDR'] . "\n");
         fclose($fp);
     }
     // ログテーション
     GC_Utils::gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, $path);
 }
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
/**
 * モジュール設定スクリプトをロードする。
 * GETのクエリにmodule_idを渡す。
 *
 * 管理画面から呼び出すことを想定しているので、
 * 認証は外さないこと
 */
require_once 'require.php';
// 認証可否の判定
SC_Utils::sfIsSuccess(new SC_Session());
$module_id = isset($_GET['module_id']) ? $_GET['module_id'] : null;
if (!empty($module_id) && is_numeric($module_id)) {
    GC_Utils::gfPrintLog('loading module ====> module_id = ' . $module_id);
    $objQuery =& SC_Query_Ex::getSingletonInstance();
    $arrRet = $objQuery->select('module_code', 'dtb_module', 'module_id = ?', array($module_id));
    if (isset($arrRet[0]['module_code'])) {
        $config_path = MODULE_REALDIR . $arrRet[0]['module_code'] . '/config.php';
        if (file_exists($config_path)) {
            require_once $config_path;
            exit;
        } else {
            die("モジュールの取得に失敗しました: {$config_path}");
        }
    } else {
        die("モジュールが存在しません: module_id => {$module_id}");
    }
}
示例#17
0
 function printLog($msg)
 {
     GC_Utils::gfPrintLog($msg, DATA_PATH . 'logs/ownersstore_batch_update.log');
 }
/** テスト用スクリプトのログ出力関数 */
function lfPrintLog($mess)
{
    $path = DATA_REALDIR . "logs/" . basename(__FILE__, '.php') . ".log";
    GC_Utils::gfPrintLog($mess, $path);
}
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_AdminView();
     $this->objLayout = new SC_Helper_PageLayout_Ex();
     $package_path = USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/";
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     // ブロック一覧を取得
     $this->arrBlocList = $this->lfgetBlocData();
     // ブロックIDを取得
     if (isset($_POST['bloc_id'])) {
         $bloc_id = $_POST['bloc_id'];
     } else {
         if (isset($_GET['bloc_id'])) {
             $bloc_id = $_GET['bloc_id'];
         } else {
             $bloc_id = '';
         }
     }
     $this->bloc_id = $bloc_id;
     // bloc_id が指定されている場合にはブロックデータの取得
     if ($bloc_id != '') {
         $arrBlocData = $this->lfgetBlocData(" bloc_id = ? ", array($bloc_id));
         // ユーザー作成ブロックが存在する場合
         if (is_file($package_path . $arrBlocData[0]['tpl_path'])) {
             $arrBlocData[0]['tpl_path'] = $package_path . $arrBlocData[0]['tpl_path'];
             // 存在しない場合は指定テンプレートのブロックを取得
         } else {
             $arrBlocData[0]['tpl_path'] = TEMPLATE_DIR . $arrBlocData[0]['tpl_path'];
         }
         // テンプレートファイルの読み込み
         $arrBlocData[0]['tpl_data'] = file_get_contents($arrBlocData[0]['tpl_path']);
         $this->arrBlocData = $arrBlocData[0];
     }
     // メッセージ表示
     if (isset($_GET['msg']) && $_GET['msg'] == "on") {
         // 完了メッセージ
         $this->tpl_onload = "alert('登録が完了しました。');";
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'preview':
             // プレビューファイル作成
             $prev_path = USER_INC_PATH . 'preview/bloc_preview.tpl';
             // ディレクトリの作成
             SC_Utils::sfMakeDir($prev_path);
             $fp = fopen($prev_path, "w");
             fwrite($fp, $_POST['bloc_html']);
             // FIXME いきなり POST はちょっと...
             fclose($fp);
             // プレビューデータ表示
             $this->preview = "on";
             $this->arrBlocData['tpl_data'] = $_POST['bloc_html'];
             $this->arrBlocData['tpl_path'] = $prev_path;
             $this->arrBlocData['bloc_name'] = $_POST['bloc_name'];
             $this->arrBlocData['filename'] = $_POST['filename'];
             $this->text_row = $_POST['html_area_row'];
             break;
         case 'confirm':
             $this->preview = "off";
             // エラーチェック
             $this->arrErr = $this->lfErrorCheck($_POST);
             // エラーがなければ更新処理を行う
             if (count($this->arrErr) == 0) {
                 // DBへデータを更新する
                 $this->lfEntryBlocData($_POST);
                 // 旧ファイルの削除
                 $old_bloc_path = $package_path . $arrBlocData[0]['tpl_path'];
                 if (file_exists($old_bloc_path)) {
                     unlink($old_bloc_path);
                 }
                 // ファイル作成
                 $new_bloc_path = $package_path . BLOC_DIR . $_POST['filename'] . ".tpl";
                 // ディレクトリの作成
                 SC_Utils::sfMakeDir($new_bloc_path);
                 $fp = fopen($new_bloc_path, "w");
                 fwrite($fp, $_POST['bloc_html']);
                 // FIXME いきなり POST はちょっと...
                 fclose($fp);
                 $arrBlocData = $this->lfgetBlocData(" filename = ? ", array($_POST['filename']));
                 $bloc_id = $arrBlocData[0]['bloc_id'];
                 $this->sendRedirect($this->getLocation("./bloc.php", array("bloc_id" => $bloc_id, "msg" => "on")));
                 exit;
             } else {
                 // エラーがあれば入力時のデータを表示する
                 $this->arrBlocData = $_POST;
             }
             break;
         case 'delete':
             $this->preview = "off";
             // DBへデータを更新する
             $objDBConn = new SC_DbConn();
             // DB操作オブジェクト
             $sql = "";
             // データ更新SQL生成用
             $ret = "";
             // データ更新結果格納用
             $arrDelData = array();
             // 更新データ生成用
             // 更新データ生成
             $arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
             // bloc_id が空でない場合にはdeleteを実行
             if ($_POST['bloc_id'] !== '') {
                 // SQL生成
                 $sql = " DELETE FROM dtb_bloc WHERE bloc_id = ?";
                 // SQL実行
                 $ret = $objDBConn->query($sql, array($_POST['bloc_id']));
                 // ページに配置されているデータも削除する
                 $sql = "DELETE FROM dtb_blocposition WHERE bloc_id = ?";
                 // SQL実行
                 $ret = $objDBConn->query($sql, array($_POST['bloc_id']));
                 // ファイルの削除
                 $del_file = $package_path . BLOC_DIR . $arrBlocData[0]['filename'] . '.tpl';
                 if (file_exists($del_file)) {
                     unlink($del_file);
                 }
             }
             $this->sendRedirect($this->getLocation("./bloc.php"));
             exit;
             break;
         default:
             if (isset($_POST['mode'])) {
                 GC_Utils::gfPrintLog("MODEエラー:" . $_POST['mode']);
             }
             break;
     }
     // 画面の表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
示例#20
0
 /**
  * 前方互換用
  *
  * @deprecated 2.12.0
  */
 function gfGetLogStr($mess, $log_level = 'Info')
 {
     trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING);
     // メッセージの前に、ログ出力元関数名とログ出力関数呼び出し部分の行数を付与
     $mess = GC_Utils::gfGetCallerInfo(true) . $mess;
     // ログレベル=Debugの場合は、[Debug]を先頭に付与する
     if ($log_level === 'Debug') {
         $mess = '[Debug]' . $mess;
     }
     return $mess;
 }
 public function lfAddBlankLine($arrResults, $type, $st, $ed)
 {
     $arrRet = parent::lfAddBlankLine($arrResults, $type, $st, $ed);
     $stoc_point = 0;
     $total_history_sum = 0;
     switch ($type) {
         case 'wday':
             $keys = array();
             $keys[] = date("D", strtotime("next mon"));
             $keys[] = date("D", strtotime("next tue"));
             $keys[] = date("D", strtotime("next wed"));
             $keys[] = date("D", strtotime("next thu"));
             $keys[] = date("D", strtotime("next fri"));
             $keys[] = date("D", strtotime("next sat"));
             $keys[] = date("D", strtotime("next sun"));
             // 曜日は埋めた後に月曜日からソートする
             $_arrRet = $arrRet;
             $arrRet = array();
             foreach ($keys as $key) {
                 foreach ($_arrRet as $row) {
                     switch ($row["str_date"]) {
                         case $key:
                             $arrRet[] = $row;
                     }
                 }
             }
             break;
     }
     foreach ($arrRet as $date => &$row) {
         $stoc_point += intval($row["total"]);
         $row["total_sum"] = $stoc_point;
         $total_history_sum += intval($row["total_history"]);
         $row["total_history_sum"] = $total_history_sum;
         GC_Utils::gfDebugLog(array($date, $row));
     }
     return $arrRet;
 }