Changeset 21038 for events

Show
Ignore:
Timestamp:
10/09/08 14:42:58 (3 months ago)
Author:
kunitsuji
Message:

merge trunk

Location:
events/phpframework/codeigniter/branches/kunitsujimobile
Files:
1 removed
21 modified
1 copied

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/branches/kunitsujimobile/system/application/config/autoload.php

    r19228 r21038  
    3737| Prototype: 
    3838| 
    39 |       $autoload['libraries'] = array('database', 'session', 'xmlrpc'); 
     39|   $autoload['libraries'] = array('database', 'session', 'xmlrpc'); 
    4040*/ 
    4141 
    42 $autoload['libraries'] = array('session', 'email', 'redux_auth'); 
     42$autoload['libraries'] = array('session', 'email', 'redux_auth', 'mobileid'); 
    4343 
    4444 
     
    4949| Prototype: 
    5050| 
    51 |       $autoload['helper'] = array('url', 'file'); 
     51|   $autoload['helper'] = array('url', 'file'); 
    5252*/ 
    5353 
     
    6161| Prototype: 
    6262| 
    63 |       $autoload['plugin'] = array('captcha', 'js_calendar'); 
     63|   $autoload['plugin'] = array('captcha', 'js_calendar'); 
    6464*/ 
    6565 
     
    7373| Prototype: 
    7474| 
    75 |       $autoload['config'] = array('config1', 'config2'); 
     75|   $autoload['config'] = array('config1', 'config2'); 
    7676| 
    7777| NOTE: This item is intended for use ONLY if you have created custom 
     
    8989| Prototype: 
    9090| 
    91 |       $autoload['language'] = array('lang1', 'lang2'); 
     91|   $autoload['language'] = array('lang1', 'lang2'); 
    9292| 
    93 | NOTE: Do not include the "_lang" part of your file.  For example  
     93| NOTE: Do not include the "_lang" part of your file.  For example 
    9494| "codeigniter_lang.php" would be referenced as array('codeigniter'); 
    9595| 
     
    105105| Prototype: 
    106106| 
    107 |       $autoload['model'] = array('model1', 'model2'); 
     107|   $autoload['model'] = array('model1', 'model2'); 
    108108| 
    109109*/ 
  • events/phpframework/codeigniter/branches/kunitsujimobile/system/application/config/config.php

    r20307 r21038  
    99| WITH a trailing slash: 
    1010| 
    11 |       http://example.com/ 
    12 | 
    13 */ 
    14 $config['base_url']     = "http://localhost/phwittr/"; 
     11|   http://example.com/ 
     12| 
     13*/ 
     14$config['base_url'] = "http://localhost/phwitter/kunitsujimobile/"; 
    1515 
    1616/* 
     
    3535| If your links do not seem to work, try one of the other delicious flavors: 
    3636| 
    37 | 'AUTO'                        Default - auto detects 
    38 | 'PATH_INFO'           Uses the PATH_INFO 
    39 | 'QUERY_STRING'        Uses the QUERY_STRING 
    40 | 'REQUEST_URI'         Uses the REQUEST_URI 
    41 | 'ORIG_PATH_INFO'      Uses the ORIG_PATH_INFO 
    42 | 
    43 */ 
    44 $config['uri_protocol'] = "PATH_INFO"; 
     37| 'AUTO'            Default - auto detects 
     38| 'PATH_INFO'       Uses the PATH_INFO 
     39| 'QUERY_STRING'    Uses the QUERY_STRING 
     40| 'REQUEST_URI'     Uses the REQUEST_URI 
     41| 'ORIG_PATH_INFO'  Uses the ORIG_PATH_INFO 
     42| 
     43*/ 
     44$config['uri_protocol'] = "PATH_INFO"; 
    4545 
    4646/* 
     
    6767| 
    6868*/ 
    69 $config['language']     = "japanese"; 
     69$config['language'] = "japanese"; 
    7070 
    7171/* 
     
    150150*/ 
    151151$config['enable_query_strings'] = FALSE; 
    152 $config['directory_trigger'] = 'd';      // experimental not currently in use 
     152$config['directory_trigger'] = 'd';  // experimental not currently in use 
    153153$config['controller_trigger'] = 'c'; 
    154154$config['function_trigger'] = 'm'; 
     
    159159|-------------------------------------------------------------------------- 
    160160| 
    161 | If you have enabled error logging, you can set an error threshold to  
     161| If you have enabled error logging, you can set an error threshold to 
    162162| determine what gets logged. Threshold options are: 
    163163| You can enable error logging by setting a threshold over zero. The 
    164164| threshold determines what gets logged. Threshold options are: 
    165165| 
    166 |       0 = Disables logging, Error logging TURNED OFF 
    167 |       1 = Error Messages (including PHP errors) 
    168 |       2 = Debug Messages 
    169 |       3 = Informational Messages 
    170 |       4 = All Messages 
     166|   0 = Disables logging, Error logging TURNED OFF 
     167|   1 = Error Messages (including PHP errors) 
     168|   2 = Debug Messages 
     169|   3 = Informational Messages 
     170|   4 = All Messages 
    171171| 
    172172| For a live site you'll usually only enable Errors (1) to be logged otherwise 
     
    229229| 'session_expiration'  = the number of SECONDS you want the session to last. 
    230230|  by default sessions last 7200 seconds (two hours).  Set to zero for no expiration. 
    231 | 'time_to_update'              = how many seconds between CI refreshing Session Information 
    232 | 
    233 */ 
    234 $config['sess_cookie_name']             = 'ci_session'; 
    235 $config['sess_expiration']              = 7200; 
    236 $config['sess_encrypt_cookie']  = TRUE; 
    237 $config['sess_use_database']    = FALSE; 
    238 $config['sess_table_name']              = 'ci_sessions'; 
    239 $config['sess_match_ip']                = FALSE; 
    240 $config['sess_match_useragent'] = TRUE; 
    241 $config['sess_time_to_update']          = 300; 
     231| 'time_to_update'      = how many seconds between CI refreshing Session Information 
     232| 
     233*/ 
     234$config['sess_cookie_name']     = 'ci_session'; 
     235$config['sess_expiration']      = 7200; 
     236$config['sess_encrypt_cookie']  = TRUE; 
     237$config['sess_use_database']    = FALSE; 
     238$config['sess_table_name']      = 'ci_sessions'; 
     239$config['sess_match_ip']        = FALSE; 
     240$config['sess_match_useragent'] = TRUE; 
     241$config['sess_time_to_update']      = 300; 
    242242 
    243243/* 
     
    251251| 
    252252*/ 
    253 $config['cookie_prefix']        = ""; 
    254 $config['cookie_domain']        = ""; 
    255 $config['cookie_path']          = "/"; 
     253$config['cookie_prefix']    = ""; 
     254$config['cookie_domain']    = ""; 
     255$config['cookie_path']      = "/"; 
    256256 
    257257/* 
  • events/phpframework/codeigniter/branches/kunitsujimobile/system/application/config/database.php

    r18734 r21038  
    1313| ------------------------------------------------------------------- 
    1414| 
    15 |       ['hostname'] The hostname of your database server. 
    16 |       ['username'] The username used to connect to the database 
    17 |       ['password'] The password used to connect to the database 
    18 |       ['database'] The name of the database you want to connect to 
    19 |       ['dbdriver'] The database type. ie: mysql.  Currently supported: 
    20                                 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8 
    21 |       ['dbprefix'] You can add an optional prefix, which will be added 
    22 |                                to the table name when using the  Active Record class 
    23 |       ['pconnect'] TRUE/FALSE - Whether to use a persistent connection 
    24 |       ['db_debug'] TRUE/FALSE - Whether database errors should be displayed. 
    25 |       ['cache_on'] TRUE/FALSE - Enables/disables query caching 
    26 |       ['cachedir'] The path to the folder where cache files should be stored 
    27 |       ['char_set'] The character set used in communicating with the database 
    28 |       ['dbcollat'] The character collation used in communicating with the database 
     15|   ['hostname'] The hostname of your database server. 
     16|   ['username'] The username used to connect to the database 
     17|   ['password'] The password used to connect to the database 
     18|   ['database'] The name of the database you want to connect to 
     19|   ['dbdriver'] The database type. ie: mysql.  Currently supported: 
     20                mysql, mysqli, postgre, odbc, mssql, sqlite, oci8 
     21|   ['dbprefix'] You can add an optional prefix, which will be added 
     22|                to the table name when using the  Active Record class 
     23|   ['pconnect'] TRUE/FALSE - Whether to use a persistent connection 
     24|   ['db_debug'] TRUE/FALSE - Whether database errors should be displayed. 
     25|   ['cache_on'] TRUE/FALSE - Enables/disables query caching 
     26|   ['cachedir'] The path to the folder where cache files should be stored 
     27|   ['char_set'] The character set used in communicating with the database 
     28|   ['dbcollat'] The character collation used in communicating with the database 
    2929| 
    3030| The $active_group variable lets you choose which connection group to 
     
    4040$db['default']['hostname'] = "localhost"; 
    4141$db['default']['username'] = "root"; 
    42 $db['default']['password'] = ""; 
     42$db['default']['password'] = "11091109"; 
    4343$db['default']['database'] = "phwittr"; 
    4444$db['default']['dbdriver'] = "mysql"; 
  • events/phpframework/codeigniter/branches/kunitsujimobile/system/application/config/routes.php

    r18585 r21038  
    4444$route['scaffolding_trigger'] = ""; 
    4545 
     46$route['js/(\S+)'] = "js/index/$1"; 
    4647 
    4748/* End of file routes.php */ 
  • events/phpframework/codeigniter/branches/kunitsujimobile/system/application/controllers/account.php

    r20392 r21038  
    11<?php 
    2                                  
    3 class Account extends Controller  
     2 
     3class Account extends My_Controller 
    44{ 
    5         function Account() 
    6         { 
    7                 parent::Controller(); 
    8                 if ( ! $this->redux_auth->logged_in()) 
    9                 { 
    10                         $this->load->helper('url'); 
    11                         redirect('login'); 
    12                 } 
    13                 //$this->output->enable_profiler(TRUE); 
    14         } 
    15  
    16         function index() 
    17         { 
    18                  
    19         } 
    20  
    21         function settings() 
    22         { 
    23                 $this->load->helper(array('url', 'form')); 
    24                 $this->load->library('validation'); 
    25                 $this->validation->set_error_delimiters('<div class="red">', '</div>'); 
    26  
    27                 $id = $this->session->userdata('id'); 
    28                  
    29                 $this->load->model('User_model', '', TRUE); 
    30                 $data = $this->User_model->get_user_settings($id); 
    31  
    32                 $rules['username']              = "trim|required|alpha_dash|min_length[3]|max_length[100]|callback_check_username"; 
    33                 $rules['email']                 = "trim|required|valid_email|max_length[255]|callback_check_email"; 
    34                 $this->validation->set_rules($rules); 
    35                  
    36                 $fields['username']     = "ユーザ名"; 
    37                 $fields['email']                = "メールアドレス"; 
    38                 $this->validation->set_fields($fields); 
    39  
    40                 if ($this->validation->run()) 
    41                 { 
    42                         // CSRF チェック 
    43                         $ticket = $this->session->flashdata('ticket'); 
    44                         if ( ! $this->input->post('ticket')  
    45                                 || $this->input->post('ticket') !== $ticket) 
    46                         { 
    47                                 header('Content-Type: text/html; charset=UTF-8'); 
    48                                 echo 'クッキーを有効にしてください。クッキーが有効な場合は、不正な操作がおこなわれました。'; 
    49                                 exit; 
    50                         } 
    51  
    52                         $users->username = $this->validation->username; 
    53                         $users->email    = $this->validation->email; 
    54                         $this->User_model->set_user_settings($id, $users); 
    55  
    56                         // CSRF 対策のワンタイムチケット 
    57                         $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    58                         $this->session->set_flashdata('ticket', $data->ticket); 
    59                          
    60                         $data->msg = '<h1 id="msg">設定を保存しました。</h1>'; 
    61                         $data->username = $users->username; 
    62                         $data->email    = $users->email; 
    63                         $data->title  = 'Phwittr'; 
    64                         $data->header = $this->load->view('account/header', '', TRUE); 
    65                         $data->main   = $this->load->view('account/main', $data, TRUE); 
    66                         $data->sub    = ''; 
    67                         $this->load->view('layout', $data); 
    68                 } 
    69                 else 
    70                 { 
    71                         // CSRF 対策のワンタイムチケット 
    72                         $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    73                         $this->session->set_flashdata('ticket', $data->ticket); 
    74                          
    75                         $data->msg = ''; 
    76                         $data->title  = 'Phwittr'; 
    77                         $data->header = $this->load->view('account/header', '', TRUE); 
    78                         $data->main   = $this->load->view('account/main', $data, TRUE); 
    79                         $data->sub    = ''; 
    80                         $this->load->view('layout', $data); 
    81                 } 
    82         } 
    83  
    84         function password() 
    85         { 
    86                 $this->load->helper(array('url', 'form')); 
    87                 $this->load->library('validation'); 
    88                 $this->validation->set_error_delimiters('<div class="red">', '</div>'); 
    89  
    90                 $data->username = $this->session->userdata('username'); 
    91  
    92                 $rules['password']              = "trim|required|alpha_numeric|min_length[6]|max_length[64]|matches[password2]"; 
    93                 $rules['password2']     = "trim|required|alpha_numeric|min_length[6]|max_length[64]"; 
    94                 $this->validation->set_rules($rules); 
    95  
    96                 $fields['password']     = "パスワード"; 
    97                 $fields['password2']    = "パスワード(確認)"; 
    98                 $this->validation->set_fields($fields); 
    99  
    100                 if ($this->validation->run()) 
    101                 { 
    102                         // CSRF チェック 
    103                         $ticket = $this->session->flashdata('ticket'); 
    104                         if ( ! $this->input->post('ticket')  
    105                                 || $this->input->post('ticket') !== $ticket) 
    106                         { 
    107                                 header('Content-Type: text/html; charset=UTF-8'); 
    108                                 echo 'クッキーを有効にしてください。クッキーが有効な場合は、不正な操作がおこなわれました。'; 
    109                                 exit; 
    110                         } 
    111  
    112                         $this->load->database(); 
    113                         $this->redux_auth->update_password($data->username, $this->validation->password); 
    114  
    115                         // CSRF 対策のワンタイムチケット 
    116                         $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    117                         $this->session->set_flashdata('ticket', $data->ticket); 
    118                          
    119                         $data->msg = '<h1 id="msg">設定を保存しました。</h1>'; 
    120                         $data->title  = 'Phwittr'; 
    121                         $data->header = $this->load->view('account/header', '', TRUE); 
    122                         $data->main   = $this->load->view('account/main_password', $data, TRUE); 
    123                         $data->sub    = ''; 
    124                         $this->load->view('layout', $data); 
    125                 } 
    126                 else 
    127                 { 
    128                         // CSRF 対策のワンタイムチケット 
    129                         $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    130                         $this->session->set_flashdata('ticket', $data->ticket); 
    131  
    132                         $data->msg = ''; 
    133                         $data->title  = 'Phwittr'; 
    134                         $data->header = $this->load->view('account/header', '', TRUE); 
    135                         $data->main   = $this->load->view('account/main_password', $data, TRUE); 
    136                         $data->sub    = ''; 
    137                         $this->load->view('layout', $data); 
    138                 } 
    139         } 
    140  
    141         function picture() 
    142         { 
    143                 $this->load->helper(array('url', 'form')); 
    144                 $this->load->library('validation'); 
    145                 $this->validation->set_error_delimiters('<div class="red">', '</div>'); 
    146  
    147                 $id = $this->session->userdata('id'); 
    148                 $data->username = $this->session->userdata('username'); 
    149  
    150                 if ($this->input->post('submit') == '保存する') 
    151                 { 
    152                         // CSRF チェック 
    153                         $ticket = $this->session->flashdata('ticket'); 
    154                         if ( ! $this->input->post('ticket')  
    155                                 || $this->input->post('ticket') !== $ticket) 
    156                         { 
    157                                 header('Content-Type: text/html; charset=UTF-8'); 
    158                                 echo 'クッキーを有効にしてください。クッキーが有効な場合は、不正な操作がおこなわれました。'; 
    159                                 exit; 
    160                         } 
    161  
    162                         $this->load->library('upload'); 
    163                         $config['upload_path']   = './img/icons/';      // ディレクトリ 
    164                         $config['allowed_types'] = 'gif|jpg|png';       // 許可するタイプ 
    165                         $config['max_size']          = '700';                   // 最大サイズ(700KB) 
    166                         $this->upload->initialize($config); 
    167  
    168                         if ( ! $this->upload->do_upload())      // アップロードの処理 
    169                         {       // エラーの場合 
    170                                 $data->msg = $this->upload->display_errors(); 
    171                         }        
    172                         else 
    173                         {       // 成功した場合 
    174                                 $upload_data = $this->upload->data(); 
    175  
    176                                 $this->load->library('image_lib'); 
    177                                 $config = array(); 
    178  
    179                                 // 縦横短い方に合わせて、画像を正方形にカット 
    180                                 $width  = $upload_data['image_width']; 
    181                                 $height = $upload_data['image_height']; 
    182  
    183                                 if ($width > $height) 
    184                                 { 
    185                                         $config['x_axis'] = intval(($width - $height)/2); 
    186                                         $config['y_axis'] = 0; 
    187                                         $config['width']  = $height; 
    188                                         $config['height'] = $height; 
    189                                 } 
    190                                 else  
    191                                 { 
    192                                         $config['x_axis'] = 0; 
    193                                         $config['y_axis'] = intval(($height - $width)/2); 
    194                                         $config['width']  = $width; 
    195                                         $config['height'] = $width; 
    196                                 } 
    197  
    198                                 $config['image_library']  = 'imagemagick'; 
    199                                 $config['library_path']   = '/usr/bin/'; 
    200                                 $config['source_image']   = $upload_data['full_path']; 
    201                                 $config['new_image']      = './img/icons/' . $id . $upload_data['file_ext']; 
    202                                 $config['maintain_ratio'] = FALSE; 
    203  
    204                                 //log_message('debug', print_r($config, TRUE)); 
    205  
    206                                 $this->image_lib->initialize($config); 
    207                                 if ( ! $this->image_lib->crop()) 
    208                                 {       // エラーだった場合のエラー表示 
    209                                         $data->msg = $this->image_lib->display_errors(); 
    210                                 } 
    211  
    212                                 // 73ピクセルの画像を作成 
    213                                 $config['source_image']   = './img/icons/' . $id . $upload_data['file_ext']; 
    214                                 $config['new_image']      = './img/icons/' . $id . '_73' . $upload_data['file_ext']; 
    215                                 $config['width']          = 73; 
    216                                 $config['height']         = 73; 
    217                                 $this->image_lib->initialize($config); 
    218                                 if ( ! $this->image_lib->resize()) 
    219                                 {       // エラーだった場合のエラー表示 
    220                                         $data->msg .= $this->image_lib->display_errors(); 
    221                                 } 
    222  
    223                                 // 48ピクセルの画像を作成 
    224                                 $config['new_image']      = './img/icons/' . $id . '_48' . $upload_data['file_ext']; 
    225                                 $config['width']          = 48; 
    226                                 $config['height']         = 48; 
    227                                 $this->image_lib->initialize($config); 
    228                                 if ( ! $this->image_lib->resize()) 
    229                                 {       // エラーだった場合のエラー表示 
    230                                         $data->msg .= $this->image_lib->display_errors(); 
    231                                 } 
    232  
    233                                 // 24ピクセルの画像を作成 
    234                                 $config['new_image']      = './img/icons/' . $id . '_24' . $upload_data['file_ext']; 
    235                                 $config['width']          = 24; 
    236                                 $config['height']         = 24; 
    237                                 $this->image_lib->initialize($config); 
    238                                 if ( ! $this->image_lib->resize()) 
    239                                 {       // エラーだった場合のエラー表示 
    240                                         $data->msg .= $this->image_lib->display_errors(); 
    241                                 } 
    242  
    243                                 unlink($upload_data['full_path']); 
    244  
    245                                 $this->load->model('User_model', '', TRUE); 
    246                                 $this->User_model->set_user_image($id, $id . $upload_data['file_ext']); 
    247  
    248                                 $data->msg .= '<h1 id="msg">これはいい画像ですね。</h1>'; 
    249                         } 
    250                 } 
    251                 else 
    252                 { 
    253                         $data->msg = ''; 
    254                 } 
    255  
    256                 // CSRF 対策のワンタイムチケット 
    257                 $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    258                 $this->session->set_flashdata('ticket', $data->ticket); 
    259  
    260                 $data->title  = 'Phwittr'; 
    261                 $data->header = $this->load->view('account/header', '', TRUE); 
    262                 $data->main   = $this->load->view('account/main_picture', $data, TRUE); 
    263                 $data->sub    = ''; 
    264                 $this->load->view('layout', $data); 
    265         } 
    266  
    267         function archive() 
    268         { 
    269                 $this->load->helper(array('url', 'pager')); 
    270  
    271                 // GET を使う裏技; $config['uri_protocol'] を PATH_INFO に 
    272                 parse_str($_SERVER['QUERY_STRING'], $_GET); 
    273  
    274                 // ページャ 
    275                 $page = intval($this->input->get('page')); 
    276                 $per_page = 20; 
    277                 $offset = offset($page, $per_page); 
    278  
    279                 $id = $this->session->userdata('id'); 
    280                 $this->load->model('Status_model', '', TRUE); 
    281                 list($data->list, $count) = $this->Status_model->get_archive_timeline($id, $per_page, $offset); 
    282  
    283                 // ページャ 
    284                 $data->pager = pager($page, $per_page, $count, 'account/archive'); 
    285  
    286                 // CSRF 対策のワンタイムチケット 
    287                 $data->ticket = md5(uniqid(mt_rand(), TRUE)); 
    288                 $this->session->set_flashdata('ticket', $data->ticket); 
    289  
    290                 $this->load->model('User_model'); 
    291                 list($data->last_comment, $data->posts_count) = $this->Status_model->get_last_comment($id); 
    292                 list($data->friends_list, $data->friends_count) = 
    293                                                                         $this->User_model->get_friends_list($id); 
    294 </