/**
  * 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));
 }
 public function testGetSaveImagePath_入力値が空の場合_NO_IMAGE_REALFILEを返す()
 {
     $input = '';
     $this->expected = NO_IMAGE_REALFILE;
     $this->actual = SC_Utils::getSaveImagePath($input);
     $this->verify();
 }
 public function testSfDispDBDate_時刻表示フラグがOFFの場合_時刻なしのフォーマット済み文字列が返る()
 {
     $dbdate = '2012-1-23 1:12:24';
     $this->expected = '2012/01/23';
     $this->actual = SC_Utils::sfDispDBDate($dbdate, false);
     $this->verify();
 }
 public function testSfCalcIncTax_それ以外の場合_切り上げの結果になる()
 {
     $this->expected = array(142, 152);
     $this->actual[0] = SC_Utils::sfCalcIncTax(140, 1, 4);
     $this->actual[1] = SC_Utils::sfCalcIncTax(150, 1, 4);
     $this->verify('税込価格');
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // ログインチェック
     SC_Utils::sfIsSuccess(new SC_Session());
     $mode = isset($_GET['mode']) ? $_GET['mode'] : '';
     switch ($mode) {
         case 'detail':
             $objForm = $this->initParam();
             if ($objForm->checkError()) {
                 SC_Utils::sfDispError('');
             }
             $this->arrLogDetail = $this->getLogDetail($objForm->getValue('log_id'));
             if (count($this->arrLogDetail) == 0) {
                 SC_Utils::sfDispError('');
             }
             $this->tpl_mainpage = 'ownersstore/log_detail.tpl';
             break;
         default:
             break;
     }
     $this->arrInstallLogs = $this->getLogs();
     // ページ出力
     $objView = new SC_AdminView();
     $objView->assignObj($this);
     $objView->display(MAIN_FRAME);
 }
 public function testSfUpDirName__1階層上のディレクトリ名が取得できる()
 {
     $_SERVER['SCRIPT_NAME'] = 'dir1/dir2/updir/current';
     $this->expected = 'updir';
     $this->actual = SC_Utils::sfUpDirName();
     $this->verify('ディレクトリ名');
 }
 public function testSfMakeHiddenArray__多段配列が1次元配列に変換される()
 {
     $input_array = array('vegetable' => '野菜', 'fruit' => array('apple' => 'りんご', 'banana' => 'バナナ'), 'drink' => array('alcohol' => array('beer' => 'ビール'), 'water' => '水'), 'rice' => '米');
     $this->expected = array('vegetable' => '野菜', 'fruit[apple]' => 'りんご', 'fruit[banana]' => 'バナナ', 'drink[alcohol][beer]' => 'ビール', 'drink[water]' => '水', 'rice' => '米');
     $this->actual = SC_Utils::sfMakeHiddenArray($input_array);
     $this->verify();
 }
 public function testSfGetUnderChildrenArray__与えられた親IDを持つ要素だけが抽出される()
 {
     $input_array = array(array('parent_id' => '1001', 'child_id' => '1001001'), array('parent_id' => '1002', 'child_id' => '1002001'), array('parent_id' => '1002', 'child_id' => '1002002'), array('parent_id' => '1003', 'child_id' => '1003001'), array('parent_id' => '1004', 'child_id' => '1004001'));
     $this->expected = array('1002001', '1002002');
     $this->actual = SC_Utils::sfGetUnderChildrenArray($input_array, 'parent_id', 'child_id', '1002');
     $this->verify();
 }
 public function testSfTrim_途中と文末にホワイトスペースがある場合_文末だけが除去できる()
 {
     $this->expected = 'あ い うえ' . chr(0xd) . 'お';
     // 0x0A=CR, 0x0d=LF
     $this->actual = SC_Utils::sfTrim('あ い うえ' . chr(0xd) . 'お  ' . chr(0xa) . chr(0xd));
     $this->verify('トリム結果');
 }
 public function testSfSwapArray_カラム名なしの指定の場合_キーに名称が入らない()
 {
     $input_array = array(array('id' => '1001', 'name' => 'name1001'), array('id' => '1002', 'name' => 'name1002'));
     $this->expected = array(array('1001', '1002'), array('name1001', 'name1002'));
     $this->actual = SC_Utils::sfSwapArray($input_array, false);
     $this->verify();
 }
 public function testSfTrimURL_URL末尾にスラッシュがない場合_文字列に変化がない()
 {
     $input = 'http://www.example.co.jp';
     $this->expected = $input;
     $this->actual = SC_Utils::sfTrimURL($input);
     $this->verify();
 }
 public function testSfRmDupSlash_上記以外の場合_全ての重複スラッシュが1つになる()
 {
     $input = 'hoge//www.example.co.jp///aaa//bb/co.php';
     $this->expected = 'hoge/www.example.co.jp/aaa/bb/co.php';
     $this->actual = SC_Utils::sfRmDupSlash($input);
     $this->verify();
 }
 public function testEncodeRFC3986_チルダが含まれる場合_エンコードされない()
 {
     $input = 'http://www.example.co.jp/~';
     $this->expected = 'http%3A%2F%2Fwww.example.co.jp%2F~';
     $this->actual = SC_Utils::encodeRFC3986($input);
     $this->verify();
 }
 public function testGetRealURL_httpsの場合_正しくパースできる()
 {
     $input = 'https://www.example.jp/aaa/./index.php';
     $this->expected = 'https://www.example.jp:/aaa/index.php';
     $this->actual = SC_Utils::getRealURL($input);
     $this->verify();
 }
 public function testSfPassLen_入力が正の数の場合_入力と同じ文字数のアスタリスクが返る()
 {
     $input = 17;
     $this->expected = '*****************';
     $this->actual = SC_Utils::sfPassLen($input);
     $this->verify();
 }
 public function testJsonEncode__JSON形式にエンコードされた文字列が返る()
 {
     $input = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
     $this->expected = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
     $this->actual = SC_Utils::jsonEncode($input);
     $this->verify();
 }
 public function testSfIsHTTPS_環境変数に値が入っていない場合_falseが返る()
 {
     unset($_SERVER['HTTPS']);
     $this->expected = false;
     $this->actual = SC_Utils::sfIsHTTPS();
     $this->verify();
 }
 public function testSfTax_それ以外の場合_切り上げの結果になる()
 {
     $this->expected = array(2, 2);
     $this->actual[0] = SC_Utils::sfTax(140, 1, 4);
     $this->actual[1] = SC_Utils::sfTax(150, 1, 4);
     $this->verify('税額');
 }
 public function testsfIsInternalDomain_ドメインが一致しない場合_falseが返る()
 {
     $url = 'http://test.local.jp/html/index.php';
     $this->expected = TRUE;
     $this->actual = SC_Utils::sfIsInternalDomain($url);
     $this->verify($url);
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     parent::action();
     $objProduct = new SC_Product_Ex();
     $objDb = new SC_Helper_DB_Ex();
     $this->tpl_buy_porduct = array_key_exists($this->tpl_product_id, $this->arrRedownloadProduct);
     $category_id = $objProduct->getCategoryIds($this->tpl_product_id);
     $this->arrProduct["category_id"] = array_shift($category_id);
     $this->arrProduct["category"] = $this->arrCategory[$this->arrProduct["category_id"]];
     $this->arrProduct["category_name"] = $this->arrProduct["category"]["category_name"];
     if ($objDb->sfColumnExists('dtb_category', 'category_code')) {
         $this->arrProduct["category_code"] = $this->arrProduct["category"]["category_code"];
         $this->arrProduct["category_image1"] = $this->arrProduct["category"]["category_image1"] ?: 0;
         $this->arrProduct["category_image2"] = $this->arrProduct["category"]["category_image2"] ?: 0;
         $this->arrProduct["category_image3"] = $this->arrProduct["category"]["category_image3"] ?: 0;
         $this->arrProduct["category_image4"] = $this->arrProduct["category"]["category_image4"] ?: 0;
         $this->arrProduct["category_image5"] = $this->arrProduct["category"]["category_image5"] ?: 0;
     }
     $config = SC_AuonePayment_Ex::getConfig("free_field2");
     $mode = $this->getMode();
     $this->mode = $mode;
     switch ($this->getMode()) {
         case "download":
         case "check_buy_and_download":
             $this->doCheckBuyAndDownload($config);
             break;
         case "download_ok":
         case "check_buy_and_download_ok":
             $this->doCheckBuyAndDownloadOk($config);
             break;
         case "download_ng":
         case "check_buy_and_download_ng":
             unset($_SESSION["product_ktc_vid"]);
             SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "このテーマには対応していません。");
             break;
     }
     $bgcolor = $this->arrProduct["bgcolor"];
     $fgcolor = $this->arrProduct["fgcolor"];
     $lkcolor = $this->arrProduct["lkcolor"];
     if (strlen($bgcolor) && strlen($fgcolor) && strlen($fgcolor)) {
         $this->tpl_onload .= "\$('section.cont01:eq(0)  ').css({\n            'background-color':'#{$bgcolor}','color':'#{$fgcolor}'\n        });";
         $this->tpl_onload .= "\$('section.cont01:eq(0) a[href*=\"www.kisekae-touch.com\"]').css({\n            'color':'#{$lkcolor}'\n        });";
     }
     switch (basename($_SERVER["SCRIPT_NAME"], ".php")) {
         case "detail":
             $this->check_os();
             break;
         case "detail_spass":
             if (!isset($this->arrProduct["product_code_spass"])) {
                 SC_Utils::sfDispSiteError(PRODUCT_NOT_FOUND);
             }
             $objQuery = SC_Query_Ex::getSingletonInstance();
             $objQuery->setWhere("spass_provide_start_date <= NOW()");
             $objQuery->andWhere("spass_provide_end_date   >= NOW()");
             $objQuery->andWhere("product_id                = ? ");
             $this->arrSpassProduct = $objProduct->findProductCount($objQuery, array($this->tpl_product_id));
             break;
     }
 }
 public function testSfArrKeyValue_キーサイズが短い場合_キーサイズでカットされる()
 {
     $len_max = 5;
     $keysize = 1;
     $this->expected = array('1...' => '2001', '2...' => '2002', '3...' => '2003', '4...' => '2004');
     $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max, $keysize);
     $this->verify();
 }
 public function testArrayDefineIndexes_チェック対象のキーが一部存在しない場合_配列に追加される()
 {
     $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
     $defineIndexes = array('tomato', 'banana', 'kiwi');
     $this->expected = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ', 'tomato' => '', 'kiwi' => '');
     $this->actual = SC_Utils::arrayDefineIndexes($input_array, $defineIndexes);
     $this->verify();
 }
 public function testGetHash2Array_必須キー指定がある場合_指定キーの値のみの配列が返る()
 {
     $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
     $requires = array('banana', 'apple');
     $this->expected = array('りんご', 'バナナ');
     $this->actual = SC_Utils::getHash2Array($input_array, $requires);
     $this->verify();
 }
 public function testSfArrCombine_入力のキー配列の方が長い場合_余ったキーの配列の要素は空になる()
 {
     $keys = array('apple', 'banana', 'orange', 'pear');
     $values = array('りんご', 'バナナ');
     $this->expected = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => null, 'pear' => null);
     $this->actual = SC_Utils::sfArrCombine($keys, $values);
     $this->verify();
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // ログインチェック
     SC_Utils::sfIsSuccess(new SC_Session());
     $objView = new SC_AdminView();
     $objView->assignObj($this);
     $objView->display(MAIN_FRAME);
 }
 public function testSfArrayIntersctKeys_指定キーに含まれるものがある場合_含まれるものだけが返る()
 {
     $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
     $key_array = array('orange', 'apple');
     $this->expected = array('apple' => 'りんご', 'orange' => 'オレンジ');
     $this->actual = SC_Utils::sfArrayIntersectKeys($input_array, $key_array);
     $this->verify();
 }
 public function testSfIsMatchHashPassword_saltが未指定の場合_旧バージョンの暗号化で比較される()
 {
     $pass = '******';
     $hashpass = sha1($pass . ':' . AUTH_MAGIC);
     $this->expected = TRUE;
     $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass);
     $this->verify('パスワード文字列比較結果');
 }
 public function testsfIsInternalDomain_ドメインが一致しない場合_falseが返る()
 {
     // 一致しないようなURLにする
     $url = 'http://unmatched.example.jp/html/index.php';
     $this->expected = false;
     $this->actual = SC_Utils::sfIsInternalDomain($url);
     $this->verify($url);
 }
 public function testRecursiveMkdir_パーミッションを指定しない場合_0777でディレクトリが作られる()
 {
     $path = realpath(dirname(__FILE__)) . "/../../../tmp/dir1/dir2/dir3/";
     $result = SC_Utils::recursiveMkdir($path);
     $this->expected = '0777';
     $this->actual = substr(sprintf('%o', fileperms($path)), -4);
     $this->verify('作成したディレクトリのパーミッション');
 }
 public function testSfGetTimestamp_最終時刻フラグがONの場合_時刻が深夜のものになる()
 {
     $year = '1999';
     $month = '09';
     $day = '23';
     $this->expected = '1999-09-23 23:59:59';
     $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day, true);
     $this->verify();
 }