static function saveConfig($value = array(), $key = "free_field1", $plugin_code = "KisekaeTouch")
 {
     $objPlugin = new SC_Plugin_Util_Ex();
     $arrPlugin = $objPlugin->getPluginByPluginCode($plugin_code);
     if (!SC_Utils_Ex::isBlank($value) && is_array($value)) {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $table = 'dtb_plugin';
         $where = 'plugin_code = ?';
         $objQuery->update($table, array($key => serialize($value)), $where, array("KisekaeTouch"));
     }
     $config = unserialize($arrPlugin[$key]);
     return $config;
 }
 /**
  * 有効なプラグインのロード. プラグインエンジンが有効になっていない場合は
  * プラグインエンジン自身のインストール処理を起動する
  *
  * @return void
  */
 function load($plugin_activate_flg = true)
 {
     if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) {
         return;
     }
     // インストール前
     if (GC_Utils_Ex::isInstallFunction()) {
         return;
     }
     // インストール中
     if ($plugin_activate_flg === false) {
         return;
     }
     // 有効なプラグインを取得
     $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin();
     // pluginディレクトリを取得
     $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
     foreach ($arrPluginDataList as $arrPluginData) {
         // プラグイン本体ファイル名が取得したプラグインディレクトリ一覧にある事を確認
         if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
             // プラグイン本体ファイルをrequire.
             require_once PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . '/' . $arrPluginData['class_name'] . '.php';
             // プラグインのインスタンス生成.
             $objPlugin = new $arrPluginData['class_name']($arrPluginData);
             // メンバ変数にプラグインのインスタンスを登録.
             $this->arrPluginInstances[$arrPluginData['plugin_id']] = $objPlugin;
             $this->arrPluginIds[] = $arrPluginData['plugin_id'];
             // ローカルフックポイントの登録.
             $this->registerLocalHookPoint($objPlugin, $arrPluginData['priority']);
             // スーパーフックポイントの登録.
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PREPROCESS, 'preProcess', $arrPluginData['priority']);
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PROCESS, 'process', $arrPluginData['priority']);
         }
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrForm = array();
     switch ($this->getMode()) {
         case 'edit':
             $arrForm = $objFormParam->getHashArray();
             $this->arrErr = $objFormParam->checkError();
             // エラーなしの場合にはデータを更新
             if (count($this->arrErr) == 0) {
                 // データ更新
                 $this->arrErr = $this->save($arrForm);
                 if (count($this->arrErr) == 0) {
                     $this->tpl_onload = "alert('登録が完了しました。');";
                     $this->tpl_onload .= 'window.close();';
                 }
             }
             break;
         default:
             // プラグイン情報を取得.
             $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("BreadcrumbList");
             $arrForm['css_data'] = $plugin['free_field1'];
             break;
     }
     $this->arrForm = $arrForm;
     $this->setTemplate($this->tpl_mainpage);
 }
 protected function checkErrorExtended($arrParam)
 {
     $arrErr = array();
     // プラグインが有効化されている事を確認
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $enable = $objQuery->getOne("SELECT enable FROM dtb_plugin WHERE plugin_code = 'AddProduct'");
     if ($enable != PLUGIN_ENABLE_TRUE) {
         $arrErr['access_token'] = '※ プラグインが有効化されていません。';
         return $arrErr;
     }
     // アクセストークンをチェック
     if (!$this->isValidToken($arrParam['access_token'])) {
         $arrErr['access_token'] = '※ 有効なアクセストークンではありません。';
         return $arrErr;
     }
     // プラグイン設定(SSL)を取得
     $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("AddProduct");
     if ($plugin['free_field1'] === 'Only') {
         if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
             // SSLアクセス
         } else {
             $arrErr['not ssl'] = '※ 必ずSSLでアクセスしてください。';
             return $arrErr;
         }
     }
     return $arrErr;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrForm = array();
     switch ($this->getMode()) {
         case 'edit':
             $arrForm = $objFormParam->getHashArray();
             $this->arrErr = $objFormParam->checkError();
             // エラーなしの場合にはデータを更新
             if (count($this->arrErr) == 0) {
                 // データ更新
                 $this->arrErr = $this->updateData($arrForm);
                 if (count($this->arrErr) == 0) {
                     // コンパイルファイルのクリア処理
                     SC_Utils_Ex::clearCompliedTemplate();
                     $this->tpl_onload = "alert('登録が完了しました。');";
                 }
             }
             break;
         default:
             // プラグイン情報を取得.
             $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("AddProduct");
             $arrForm['ssl'] = $plugin['free_field1'];
             break;
     }
     $this->arrForm = $arrForm;
     $this->setTemplate($this->tpl_mainpage);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $this->arrErr = $this->lfCheckError($objFormParam);
     $arrForm = array();
     switch ($this->getMode()) {
         case 'edit':
             $arrForm = $objFormParam->getHashArray();
             $this->arrErr = $objFormParam->checkError();
             // エラーなしの場合にはデータを更新
             if (count($this->arrErr) == 0) {
                 // データ更新
                 $this->arrErr = $this->updateData($arrForm);
                 if (count($this->arrErr) == 0) {
                     $this->tpl_onload = "alert('登録が完了しました。');";
                     $this->tpl_onload .= 'window.close();';
                 }
             }
             break;
         default:
             // プラグイン情報を取得.
             $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("VideoPlayer");
             $arrForm['product_id'] = $plugin['product_id'];
             $arrForm['video_url'] = $plugin['video_url'];
             $arrForm['disp_width'] = $plugin['disp_width'];
             $arrForm['disp_height'] = $plugin['disp_height'];
             break;
     }
     $this->arrForm = $arrForm;
     $this->setTemplate($this->tpl_mainpage);
 }
Beispiel #7
0
 /**
  * 有効なプラグインのロード. プラグインエンジンが有効になっていない場合は
  * プラグインエンジン自身のインストール処理を起動する
  *
  * @return void
  */
 public function load($plugin_activate_flg = true)
 {
     if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) {
         return;
     }
     // インストール前
     if (GC_Utils_Ex::isInstallFunction()) {
         return;
     }
     // インストール中
     if ($plugin_activate_flg === false) {
         return;
     }
     // 有効なプラグインを取得
     $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin();
     // pluginディレクトリを取得
     $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
     foreach ($arrPluginDataList as $arrPluginData) {
         // プラグイン本体ファイル名が取得したプラグインディレクトリ一覧にある事を確認
         if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
             $plugin_file_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . '/' . $arrPluginData['class_name'] . '.php';
             // プラグイン本体ファイルが存在しない場合
             if (!file_exists($plugin_file_path)) {
                 // エラー出力
                 $msg = 'プラグイン本体ファイルが存在しない。当該プラグインを無視して続行する。';
                 $msg .= 'ファイル=' . var_export($plugin_file_path, true) . '; ';
                 trigger_error($msg, E_USER_WARNING);
                 // 次のプラグインへ続行
                 continue 1;
             }
             // プラグイン本体ファイルをrequire.
             require_once $plugin_file_path;
             // プラグインのインスタンス生成.
             $objPlugin = new $arrPluginData['class_name']($arrPluginData);
             // メンバ変数にプラグインのインスタンスを登録.
             $this->arrPluginInstances[$arrPluginData['plugin_id']] = $objPlugin;
             $this->arrPluginIds[] = $arrPluginData['plugin_id'];
             // ローカルフックポイントの登録.
             $this->registerLocalHookPoint($objPlugin, $arrPluginData['priority']);
             // スーパーフックポイントの登録.
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PREPROCESS, 'preProcess', $arrPluginData['priority']);
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PROCESS, 'process', $arrPluginData['priority']);
         }
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrForm = array();
     switch ($this->getMode()) {
         case 'edit':
             $arrForm = $objFormParam->getHashArray();
             $this->arrErr = $objFormParam->checkError();
             // エラーなしの場合にはデータを更新
             if (count($this->arrErr) == 0) {
                 // データ更新
                 $this->arrErr = $this->updateData($arrForm);
                 if (count($this->arrErr) == 0) {
                     $this->tpl_onload = "alert('登録が完了しました。');";
                     $this->tpl_onload .= 'window.close();';
                 }
             }
             break;
         default:
             // プラグイン情報を取得.
             $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("VideoPlayer");
             $arrForm['disp_rule'] = $plugin['free_field1'];
             if ($plugin['free_field2']) {
                 $arrForm['disp_count'] = unserialize($plugin['free_field2']);
                 $arrForm['disp_count_pc'] = $arrForm['disp_count'][10];
                 $arrForm['disp_count_mb'] = $arrForm['disp_count'][1];
                 $arrForm['disp_count_sp'] = $arrForm['disp_count'][2];
             }
             if ($plugin['free_field3']) {
                 $arrForm['product_status'] = unserialize($plugin['free_field3']);
             }
             break;
     }
     $this->arrForm = $arrForm;
     $this->setTemplate($this->tpl_mainpage);
 }
 *
 * 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}");
    }
}
 /**
  * plugin_idをキーにdtb_plugin, dtb_plugin_hookpointから物理削除します.
  *
  * @param  int    $plugin_id   プラグインID.
  * @param  string $plugin_code プラグインコード.
  * @return array  $arrErr エラー情報を格納した連想配列.
  */
 public function deletePlugin($plugin_id, $plugin_code)
 {
     $arrErr = array();
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objQuery->begin();
     SC_Plugin_Util_Ex::deletePluginByPluginId($plugin_id);
     if (SC_Helper_FileManager_Ex::deleteFile($this->getPluginDir($plugin_code)) === false) {
         // TODO エラー処理
     }
     if (SC_Helper_FileManager_Ex::deleteFile($this->getHtmlPluginDir($plugin_code)) === false) {
         // TODO エラー処理
     }
     $objQuery->commit();
     return $arrErr;
 }
 /**
  * 新着商品の情報を取得
  *
  * @return array
  * @setcookie array
  */
 function lfGetVideoPlayer()
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     // プラグイン情報を取得.
     $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("VideoPlayer");
     //表示条件
     $disp_rule = is_numeric($plugin['free_field1']) ? $plugin['free_field1'] : 0;
     //表示件数
     $disp_count = unserialize($plugin['free_field2']);
     //表示ステータス
     $product_status = $plugin['free_field3'];
     //デバイスフラグ
     $disp_device == SC_Display_Ex::detectDevice();
     // 新着商品情報取得
     $col = 'product_id';
     $table = 'dtb_products';
     $where = 'status = 1 and del_flg = 0';
     if ($product_status) {
         $arrStatus = unserialize($product_status);
         if (is_array($arrStatus)) {
             $strstatus = '';
             foreach ($arrStatus as $status) {
                 if ($strstatus) {
                     $strstatus .= ',';
                 }
                 $strstatus .= $status;
             }
             $where .= ' ' . 'AND product_id IN (' . '    SELECT product_id FROM dtb_product_status WHERE product_status_id IN (' . $strstatus . ')' . ')';
         }
     }
     switch ($disp_rule) {
         case 1:
             //登録日順
             $objQuery->setOrder('create_date desc');
             break;
         case 2:
             //更新日順
             $objQuery->setOrder('update_date desc');
             break;
     }
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_PC) {
         $objQuery->setLimit($disp_count[10]);
     } elseif (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $objQuery->setLimit($disp_count[1]);
     } elseif (SC_Display_Ex::detectDevice() == DEVICE_TYPE_SMARTPHONE) {
         $objQuery->setLimit($disp_count[2]);
     }
     $arrProducts = $objQuery->select($col, $table, $where);
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     if (count($arrProducts) > 0) {
         $arrProductId = array();
         foreach ($arrProducts as $key => $val) {
             $arrProductId[] = $val['product_id'];
         }
         // 商品詳細情報取得
         $arrTmp = $objProduct->getListByProductIds($objQuery, $arrProductId);
         foreach ($arrTmp as $key => $arrRow) {
             $_row = $arrRow;
             $arrProductList[] = $_row;
         }
     }
     return $arrProductList;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     // パラメーター管理クラス
     $objFormParam = new SC_FormParam_Ex();
     $this->initParam($objFormParam);
     $objFormParam->setParam($_POST);
     $mode = $this->getMode();
     switch ($mode) {
         // ON/OFF
         case 'update_use':
             // エラーチェック
             $this->arrErr = $objFormParam->checkError();
             if (!(count($this->arrErr) > 0)) {
                 $arrPluginHookpointUse = $objFormParam->getValue('plugin_hookpoint_use');
                 $plugin_hookpoint_id = $objFormParam->getValue('plugin_hookpoint_id');
                 $use_flg = $arrPluginHookpointUse[$plugin_hookpoint_id] == 1 ? 1 : 0;
                 SC_Plugin_Util_Ex::setPluginHookPointChangeUse($plugin_hookpoint_id, $use_flg);
                 // Smartyコンパイルファイルをクリア
                 SC_Utils_Ex::clearCompliedTemplate();
             }
             break;
         default:
             break;
     }
     // DBからプラグイン情報を取得
     $arrRet = SC_Plugin_Util_Ex::getPluginHookPointList();
     // 競合チェック
     $this->arrConflict = SC_Plugin_Util_Ex::checkConflictPlugin();
     $arrHookPoint = array();
     foreach ($arrRet as $key => $val) {
         $arrHookPoint[$val['hook_point']][$val['plugin_id']] = $val;
     }
     $this->arrHookPoint = $arrHookPoint;
 }
 /**
  * Get a list of locale files.
  *
  * @param   string  $lang_code      language code
  * @param   integer $device_type_id device type ID
  * @return  array   file list
  */
 function get_locale_file_list($lang_code, $device_type_id = FALSE)
 {
     $file_list = array();
     // Path to the EC-CUBE Core locale file.
     $core_locale_path = DATA_REALDIR . "locales/{$lang_code}.mo";
     // If a locale file of specified language is exist, add to the file list.
     if (file_exists($core_locale_path)) {
         $file_list[] = $core_locale_path;
     }
     // Get a list of enabled plugins.
     if (defined('ECCUBE_INSTALL')) {
         $arrPluginDataList = SC_Plugin_Util_Ex::getAllPlugin();
         // Get the plugins directory.
         $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
         foreach ($arrPluginDataList as $arrPluginData) {
             // Check that the plugin filename is contained in the list of plugins directory.
             if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
                 // Path to the plugin locale file.
                 $plugin_locale_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . "/locales/{$lang_code}.mo";
                 // If a locale file of specified language is exist, add to the file list.
                 if (file_exists($plugin_locale_path)) {
                     $file_list[] = $plugin_locale_path;
                 }
             }
         }
     }
     // Path to the template locale file.
     if ($device_type_id !== FALSE) {
         $template_locale_path = HTML_REALDIR . SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true) . "locales/{$lang_code}.mo";
         // If a locale file of specified language is exist, add to the file list.
         if (file_exists($template_locale_path)) {
             $file_list[] = $template_locale_path;
         }
     }
     return $file_list;
 }
 function loadData()
 {
     $arrRet = array();
     $arrData = SC_Plugin_Util_Ex::getPluginByPluginCode("BreadcrumbList");
     if (!SC_Utils_Ex::isBlank($arrData['free_field1'])) {
         $arrRet['css_data'] = $arrData['free_field1'];
     }
     return $arrRet;
 }