/**
  * 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));
 }
 static function gfPrintLog($msg, $path = '', $verbose = USE_VERBOSE_LOG)
 {
     GC_Utils::gfPrintLog($msg, $path, $verbose);
     if (strlen($path) === 0) {
         $path = GC_Utils::isAdminFunction() ? ADMIN_LOG_REALFILE : LOG_REALFILE;
     }
     // 日付を毎のログにする
     $dir = dirname($path);
     $file = basename($path);
     // {LOGDIR}/YYYY/MM/DD/AM|PM/{LOGFILE}
     $expath = sprintf("%s/%s/%s", $dir, date("Y/m/d/a"), $file);
     $exdir = dirname($expath);
     SC_Utils_Ex::recursiveMkdir($exdir);
     GC_Utils::gfPrintLog($msg, $expath, false);
 }
 *
 * 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}");
    }
}
/** テスト用スクリプトのログ出力関数 */
function lfPrintLog($mess)
{
    $path = DATA_REALDIR . "logs/" . basename(__FILE__, '.php') . ".log";
    GC_Utils::gfPrintLog($mess, $path);
}
Example #5
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}");
    }
}
 * 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}");
    }
}
 protected function log($msg)
 {
     $msg = sprintf("%s %s: %s", $this->plugin_code, $this->exec_func, $msg);
     GC_Utils::gfPrintLog($msg, PLUGIN_LOG_REALFILE);
 }
 /**
  * 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);
 }
Example #9
0
 function printLog($msg)
 {
     GC_Utils::gfPrintLog($msg, DATA_PATH . 'logs/ownersstore_batch_update.log');
 }
 /**
  * 各部分のナビ情報を取得する.
  *
  * @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;
 }
Example #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);
     }
 }
 /**
  * メッセージを出力
  *
  * @param string $message
  */
 function log($message)
 {
     GC_Utils::gfPrintLog($message, OSTORE_LOG_PATH);
 }
Example #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'));
}
Example #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;
 }
Example #15
0
 function gfDebugLog($obj)
 {
     if (DEBUG_MODE === true) {
         GC_Utils::gfPrintLog("*** start Debug ***");
         ob_start();
         print_r($obj);
         $buffer = ob_get_contents();
         ob_end_clean();
         $fp = fopen(LOG_PATH, "a+");
         fwrite($fp, $buffer . "\n");
         fclose($fp);
         GC_Utils::gfPrintLog("*** end Debug ***");
         // ログテーション
         GC_Utils::gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, LOG_PATH);
     }
 }