Changeset 11984 for branches/comu/data/lib
- Timestamp:
- 2007/03/28 15:05:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu/data/lib/slib.php
r11730 r11984 84 84 } 85 85 86 // ¥«¥é¥à¤Î¸ºß¥Á¥§¥Ã¥¯ 86 // ¥«¥é¥à¤Î¸ºß¥Á¥§¥Ã¥¯¤ÈºîÀ® 87 87 function sfColumnExists($table_name, $col_name, $col_type = "", $dsn = "", $add = false) { 88 88 if($dsn == "") { … … 117 117 } 118 118 119 return false; 120 } 121 122 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß¥Á¥§¥Ã¥¯¤ÈºîÀ® 123 function sfIndexExists($table_name, $col_name, $index_name, $length = "", $dsn = "", $add = false) { 124 if($dsn == "") { 125 if(defined('DEFAULT_DSN')) { 126 $dsn = DEFAULT_DSN; 127 } else { 128 return; 129 } 130 } 131 132 // ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼ 133 if(!sfTabaleExists($table_name, $dsn)) return false; 134 135 $objQuery = new SC_Query($dsn, true, true); 136 // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç 137 if(!$objQuery->isError()) { 138 list($db_type) = split(":", $dsn); 139 switch($db_type) { 140 case 'pgsql': 141 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß³Îǧ 142 $arrRet = $objQuery->getAll("SELECT relname FROM pg_class WHERE relname = ?", array($index_name)); 143 break; 144 case 'mysql': 145 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß³Îǧ 146 $arrRet = $objQuery->getAll("SHOW INDEX FROM ? WHERE Key_name = ?", array($table_name, $index_name)); 147 break; 148 default: 149 return false; 150 } 151 // ¤¹¤Ç¤Ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬Â¸ºß¤¹¤ë¾ì¹ç 152 if(count($arrRet) > 0) { 153 return true; 154 } 155 } 156 157 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤òºîÀ®¤¹¤ë 158 if($add){ 159 switch($db_type) { 160 case 'pgsql': 161 $objQuery->query("CREATE INDEX ? ON ? (?)", array($index_name, $table_name, $col_name)); 162 break; 163 case 'mysql': 164 $objQuery->query("CREATE INDEX ? ON ? (?(?))", array($index_name, $table_name, $col_name, $length)); 165 break; 166 default: 167 return false; 168 } 169 return true; 170 } 119 171 return false; 120 172 } … … 143 195 144 196 return $ret; 197 } 198 199 /* 200 * ¥µ¥¤¥È´ÉÍý¾ðÊ󤫤éÃͤò¼èÆÀ¤¹¤ë¡£ 201 * ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢É¬¤º1°Ê¾å¤Î¿ôÃͤ¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£ 202 * 0¤òÊÖ¤·¤¿¾ì¹ç¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤ÇÂбþ¤¹¤ë¤³¤È¡£ 203 * 204 * @param $control_id ´ÉÍýID 205 * @param $dsn DataSource 206 * @return $control_flg ¥Õ¥é¥° 207 */ 208 function sfGetSiteControlFlg($control_id, $dsn = "") { 209 210 // ¥Ç¡¼¥¿¥½¡¼¥¹ 211 if($dsn == "") { 212 if(defined('DEFAULT_DSN')) { 213 $dsn = DEFAULT_DSN; 214 } else { 215 return; 216 } 217 } 218 219 // ¥¯¥¨¥êÀ¸À® 220 $target_column = "control_flg"; 221 $table_name = "dtb_site_control"; 222 $where = "control_id = ?"; 223 $arrval = array($control_id); 224 $control_flg = 0; 225 226 // ¥¯¥¨¥êȯ¹Ô 227 $objQuery = new SC_Query($dsn, true, true); 228 $arrSiteControl = $objQuery->select($target_column, $table_name, $where, $arrval); 229 230 // ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ì¤Ð¥Õ¥é¥°¤ò¼èÆÀ¤¹¤ë 231 if (count($arrSiteControl) > 0) { 232 $control_flg = $arrSiteControl[0]["control_flg"]; 233 } 234 235 return $control_flg; 145 236 } 146 237 … … 265 356 266 357 /* ¥µ¥¤¥È¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ */ 267 function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "" ) {358 function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "", $is_mobile = false) { 268 359 global $objCampaignSess; 269 360 … … 281 372 282 373 $objPage = new LC_ErrorPage(); 283 $objView = new SC_SiteView(); 374 375 if($is_mobile === true) { 376 $objView = new SC_MobileView(); 377 } else { 378 $objView = new SC_SiteView(); 379 } 284 380 285 381 switch ($type) { … … 382 478 383 479 /* Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¤¬¹Ô¤ï¤ì¤¿¤«È½Äê */ 384 function sfIsPrePage($objSiteSess ) {480 function sfIsPrePage($objSiteSess, $is_mobile = false) { 385 481 $ret = $objSiteSess->isPrePage(); 386 482 if($ret != true) { 387 483 // ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ 388 sfDispSiteError(PAGE_ERROR, $objSiteSess );484 sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile); 389 485 } 390 486 } … … 475 571 function sfReload($get = "") { 476 572 if ($_SERVER["SERVER_PORT"] == "443" ){ 477 $ protocol = "https";573 $url = ereg_replace(URL_DIR . "$", "", SSL_URL); 478 574 } else { 479 $ protocol = "http";480 } 481 575 $url = ereg_replace(URL_DIR . "$", "", SITE_URL); 576 } 577 482 578 if($get != "") { 483 header("Location: ". $protocol."://" .$_SERVER["SERVER_NAME"]. $_SERVER['PHP_SELF'] . "?" . $get);579 header("Location: ". $url . $_SERVER['PHP_SELF'] . "?" . $get); 484 580 } else { 485 header("Location: ". $protocol."://" .$_SERVER["SERVER_NAME"]. $_SERVER['PHP_SELF']);581 header("Location: ". $url . $_SERVER['PHP_SELF']); 486 582 } 487 583 exit; … … 812 908 function sfGetCommaList($array, $space=true) { 813 909 if (count($array) > 0) { 910 $line = ""; 814 911 foreach($array as $val) { 815 912 if ($space) { … … 1740 1837 $sqlval['order_tel02'] = $objCustomer->getValue('tel02'); 1741 1838 $sqlval['order_tel03'] = $objCustomer->getValue('tel03'); 1742 $sqlval['order_email'] = $objCustomer->getValue('email'); 1839 if (defined('MOBILE_SITE')) { 1840 $sqlval['order_email'] = $objCustomer->getValue('email_mobile'); 1841 } else { 1842 $sqlval['order_email'] = $objCustomer->getValue('email'); 1843 } 1743 1844 $sqlval['order_job'] = $objCustomer->getValue('job'); 1744 1845 $sqlval['order_birth'] = $objCustomer->getValue('birth'); … … 1768 1869 /* ²ñ°÷¤Î¥á¥ë¥Þ¥¬ÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯(²¾²ñ°÷¤ò´Þ¤Þ¤Ê¤¤) */ 1769 1870 function sfCheckCustomerMailMaga($email) { 1770 $col = " T1.email, T1.mail_flag, T2.customer_id";1771 $from = "dtb_customer _mail AS T1 LEFT JOIN dtb_customer AS T2 ON T1.email = T2.email";1772 $where = " T1.email = ? AND T2.status = 2";1871 $col = "email, mailmaga_flg, customer_id"; 1872 $from = "dtb_customer"; 1873 $where = "email = ? AND status = 2"; 1773 1874 $objQuery = new SC_Query(); 1774 1875 $arrRet = $objQuery->select($col, $from, $where, array($email)); … … 2046 2147 if(strlen($str) > ($len + 2)) { 2047 2148 $ret =substr($str, 0, $len); 2149 $cut = substr($str, $len); 2048 2150 } else { 2049 2151 $ret = $str; … … 2053 2155 if(mb_strlen($str) > ($len + 1)) { 2054 2156 $ret = mb_substr($str, 0, $len); 2157 $cut = mb_substr($str, $len); 2055 2158 } else { 2056 2159 $ret = $str; … … 2058 2161 } 2059 2162 } 2163 2164 // ³¨Ê¸»ú¥¿¥°¤ÎÅÓÃæ¤ÇʬÃǤµ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£ 2165 if (isset($cut)) { 2166 // ʬ³ä°ÌÃÖ¤è¤êÁ°¤ÎºÇ¸å¤Î [ °Ê¹ß¤ò¼èÆÀ¤¹¤ë¡£ 2167 $head = strrchr($ret, '['); 2168 2169 // ʬ³ä°ÌÃÖ¤è¤ê¸å¤ÎºÇ½é¤Î ] °ÊÁ°¤ò¼èÆÀ¤¹¤ë¡£ 2170 $tail_pos = strpos($cut, ']'); 2171 if ($tail_pos !== false) { 2172 $tail = substr($cut, 0, $tail_pos + 1); 2173 } 2174 2175 // ʬ³ä°ÌÃÖ¤è¤êÁ°¤Ë [¡¢¸å¤Ë ] ¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ï¡¢[ ¤«¤é ] ¤Þ¤Ç¤ò 2176 // Àܳ¤·¤Æ³¨Ê¸»ú¥¿¥°1¸Äʬ¤Ë¤Ê¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£ 2177 if ($head !== false && $tail_pos !== false) { 2178 $subject = $head . $tail; 2179 if (preg_match('/^\[emoji:e?\d+\]$/', $subject)) { 2180 // ³¨Ê¸»ú¥¿¥°¤¬¸«¤Ä¤«¤Ã¤¿¤Î¤Çºï½ü¤¹¤ë¡£ 2181 $ret = substr($ret, 0, -strlen($head)); 2182 } 2183 } 2184 } 2185 2060 2186 if($commadisp){ 2061 2187 $ret = $ret . "..."; … … 2200 2326 index.php?tpl=test.tpl 2201 2327 */ 2202 function sfCustomDisplay($objPage ) {2328 function sfCustomDisplay($objPage, $is_mobile = false) { 2203 2329 $basename = basename($_SERVER["REQUEST_URI"]); 2204 2330 … … 2219 2345 $template_path = TEMPLATE_FTP_DIR . $tpl_name; 2220 2346 2221 if(file_exists($template_path)) { 2347 if($is_mobile === true) { 2348 $objView = new SC_MobileView(); 2349 $objView->assignobj($objPage); 2350 $objView->display(SITE_FRAME); 2351 } else if(file_exists($template_path)) { 2222 2352 $objView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR); 2223 2353 $objView->assignobj($objPage); … … 2253 2383 $arrRegist["update_date"] = "NOW()"; 2254 2384 2255 $sqlval["create_date"] = "NOW()";2256 $sqlval["update_date"] = "NOW()";2257 $sqlval['email'] = $array['email'];2258 $sqlval['mail_flag'] = $array['mail_flag'];2259 2385 //-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô 2386 if (defined('MOBILE_SITE')) { 2387 $arrRegist['email_mobile'] = $arrRegist['email']; 2388 unset($arrRegist['email']); 2389 } 2260 2390 $objQuery->begin(); 2261 2391 $objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id'])); 2262 $objQuery->delete("dtb_customer_mail", "email = ?", array($array['email']));2263 $objQuery->insert("dtb_customer_mail", $sqlval);2264 2392 $objQuery->commit(); 2265 2393 } … … 2517 2645 2518 2646 // »ØÄꤷ¤¿¥«¥Æ¥´¥ê¡¼ID¤ÎÂ祫¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë 2519 function GetFirstCat($category_id){2647 function sfGetFirstCat($category_id){ 2520 2648 // ¾¦Éʤ¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ 2521 2649 $objQuery = new SC_Query();
Note: See TracChangeset
for help on using the changeset viewer.