/**
  * 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 testSfIsInt_正の小数の場合_FALSEが返る()
 {
   $this->expected = FALSE;
   $this->actual = SC_Utils::sfIsInt('123.456');
 
   $this->verify('整数かどうか');
 }
 */
 public function testSfIsInt_負の整数の場合_TRUEが返る()
 {
     $this->expected = TRUE;
     $this->actual = SC_Utils::sfIsInt('-12345678');
     $this->verify('整数かどうか');
 }
 protected function getAccountDay()
 {
     $accountDay = $_REQUEST["accountDay"];
     // 日付形式でない場合は 当月1日
     if (!SC_Utils::sfIsInt($accountDay) || strlen($accountDay) != 8) {
         return date("Ym01");
     }
     $y = substr($accountDay, 0, 4);
     $m = substr($accountDay, 4, 2);
     $d = substr($accountDay, 6, 2);
     if (!checkdate($m, $d, $y)) {
         SC_Response_Ex::reload(array(), true);
     }
     return $accountDay;
 }
예제 #4
0
 /**
  * INT型の数値チェック
  * ・FIXME: マイナス値の扱いが不明確
  * ・XXX: INT_LENには収まるが、INT型の範囲を超えるケースに対応できないのでは?
  *
  * @param mixed $value
  * @return bool
  */
 public static function sfIsInt($value)
 {
     // 文字列 or 数字の場合のみチェック
     return (is_numeric($value) || is_string($value)) && SC_Utils::sfIsInt($value);
 }
 /**
  * defaultアクションを実行する.
  * 初回表示時に実行される.
  * $GET['id']が渡された場合、編集モードとして表示,
  * 無い場合は新規登録モードとして表示する.
  *
  * @param void
  * @return void
  */
 function execDefaultMode()
 {
     // $_GET['id']があれば編集モードで表示する
     if (isset($_GET['id']) && SC_Utils::sfIsInt($_GET['id'])) {
         $this->tpl_mode = 'edit';
         $this->tpl_member_id = $_GET['id'];
         $this->tpl_onfocus = "fnClearText(this.name);";
         $this->arrForm = $this->getMemberData($_GET['id']);
         $this->arrForm['password'] = DUMMY_PASS;
         $this->tpl_old_login_id = $this->arrForm['login_id'];
         // 新規作成モードで表示
     } else {
         $this->tpl_mode = "new";
         $this->arrForm['authority'] = -1;
     }
 }
예제 #6
0
 function sfPrePoint($price, $point_rate, $rule = POINT_RULE, $product_id = "")
 {
     if (SC_Utils::sfIsInt($product_id)) {
         $objQuery = new SC_Query();
         $where = "now() >= cast(start_date as date) AND ";
         $where .= "now() < cast(end_date as date) AND ";
         $where .= "del_flg = 0 AND campaign_id IN (SELECT campaign_id FROM dtb_campaign_detail where product_id = ? )";
         //登録(更新)日付順
         $objQuery->setorder('update_date DESC');
         //キャンペーンポイントの取得
         $arrRet = $objQuery->select("campaign_name, campaign_point_rate", "dtb_campaign", $where, array($product_id));
     }
     //複数のキャンペーンに登録されている商品は、最新のキャンペーンからポイントを取得
     if (isset($arrRet[0]['campaign_point_rate']) && $arrRet[0]['campaign_point_rate'] != "") {
         $campaign_point_rate = $arrRet[0]['campaign_point_rate'];
         $real_point = $campaign_point_rate / 100;
     } else {
         $real_point = $point_rate / 100;
     }
     $ret = $price * $real_point;
     switch ($rule) {
         // 四捨五入
         case 1:
             $ret = round($ret);
             break;
             // 切り捨て
         // 切り捨て
         case 2:
             $ret = floor($ret);
             break;
             // 切り上げ
         // 切り上げ
         case 3:
             $ret = ceil($ret);
             break;
             // デフォルト:切り上げ
         // デフォルト:切り上げ
         default:
             $ret = ceil($ret);
             break;
     }
     //キャンペーン商品の場合
     if (isset($campaign_point_rate) && $campaign_point_rate != "") {
         $ret = "(" . $arrRet[0]['campaign_name'] . "ポイント率" . $campaign_point_rate . "%)" . $ret;
     }
     return $ret;
 }