Changeset 364 for trunk/profile.php
- Timestamp:
- Feb 19, 2004, 1:31:09 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/profile.php
r362 r364 28 28 // customize appearance of the site for a user 29 29 //----------------------------------------------------------- include 30 $phpwg_root_path = './';31 include_once( $phpwg_root_path.'include/common.inc.php' );30 define('PHPWG_ROOT_PATH','./'); 31 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 32 32 //-------------------------------------------------- access authorization check 33 33 check_login_authorization(); … … 86 86 if ( count( $errors ) == 0 ) 87 87 { 88 $query = 'UPDATE '. PREFIX_TABLE.'users';88 $query = 'UPDATE '.USERS_TABLE; 89 89 $query.= ' SET '; 90 90 foreach ( $infos as $i => $info ) { … … 101 101 if ( isset( $_POST['use_new_pwd'] ) ) 102 102 { 103 $query = 'UPDATE '. PREFIX_TABLE.'users';103 $query = 'UPDATE '.USERS_TABLE; 104 104 $query.= " SET password = '".md5( $_POST['password'] )."'"; 105 105 $query.= ' WHERE id = '.$user['id']; … … 112 112 cookie_path() ); 113 113 // update the expiration date of the session 114 $query = 'UPDATE '. PREFIX_TABLE.'sessions';114 $query = 'UPDATE '.SESSIONS_TABLE; 115 115 $query.= ' SET expiration = '.$_POST['cookie_expiration']; 116 116 $query.= " WHERE id = '".$page['session_id']."'"; … … 134 134 include('include/page_header.php'); 135 135 136 $ handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp');136 $template->set_filenames(array('profile'=>'profile.tpl')); 137 137 initialize_template(); 138 $tpl = array( 'customize_title','password','new', 139 'reg_confirm','submit','create_cookie' ); 140 templatize_array( $tpl, 'lang', $handle ); 141 //----------------------------------------------------------------- form action 142 $url = './profile.php'; 143 $vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) ); 138 139 $template->assign_vars(array( 140 'L_TITLE' => $lang['customize_title'], 141 'L_PASSWORD' => $lang['password'], 142 'L_NEW' => $lang['new'], 143 'L_CONFIRM' => $lang['reg_confirm'], 144 'L_SUBMIT' => $lang['submit'], 145 'L_COOKIE' => $lang['create_cookie'], 146 147 'F_ACTION' => add_session_id( './profile.php' ), 148 149 'U_RETURN' => add_session_id('./category.php?'.$_SERVER['QUERY_STRING']) 150 )); 151 144 152 //-------------------------------------------------------------- errors display 145 if ( count( $errors ) != 0 ) 146 { 147 $vtp->addSession( $handle, 'errors' ); 148 foreach ( $errors as $error ) { 149 $vtp->addSession( $handle, 'li' ); 150 $vtp->setVar( $handle, 'li.li', $error ); 151 $vtp->closeSession( $handle, 'li' ); 152 } 153 $vtp->closeSession( $handle, 'errors' ); 154 } 155 //---------------------------------------------------- number of images per row 156 if ( in_array( 'nb_image_line', $infos ) ) 157 { 158 $vtp->addSession( $handle, 'line' ); 159 $vtp->setVar( $handle, 'line.name', $lang['customize_nb_image_per_row'] ); 160 $vtp->addSession( $handle, 'select' ); 161 $vtp->setVar( $handle, 'select.name', 'nb_image_line' ); 162 for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ ) 163 { 164 $vtp->addSession( $handle, 'option' ); 165 $vtp->setVar( $handle, 'option.option', $conf['nb_image_row'][$i] ); 166 if ( $conf['nb_image_row'][$i] == $user['nb_image_line'] ) 167 { 168 $vtp->setVar( $handle, 'option.selected', ' selected="selected"' ); 169 } 170 $vtp->closeSession( $handle, 'option' ); 171 } 172 $vtp->closeSession( $handle, 'select' ); 173 $vtp->closeSession( $handle, 'line' ); 174 } 175 //------------------------------------------------------ number of row per page 176 if ( in_array( 'nb_line_page', $infos ) ) 177 { 178 $vtp->addSession( $handle, 'line' ); 179 $vtp->setVar( $handle, 'line.name', $lang['customize_nb_row_per_page'] ); 180 $vtp->addSession( $handle, 'select' ); 181 $vtp->setVar( $handle, 'select.name', 'nb_line_page' ); 182 for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ ) 183 { 184 $vtp->addSession( $handle, 'option' ); 185 $vtp->setVar( $handle, 'option.option', $conf['nb_row_page'][$i] ); 186 if ( $conf['nb_row_page'][$i] == $user['nb_line_page'] ) 187 { 188 $vtp->setVar( $handle, 'option.selected', ' selected="selected"' ); 189 } 190 $vtp->closeSession( $handle, 'option' ); 191 } 192 $vtp->closeSession( $handle, 'select' ); 193 $vtp->closeSession( $handle, 'line' ); 194 } 195 //-------------------------------------------------------------------- template 196 if ( in_array( 'template', $infos ) ) 197 { 198 $vtp->addSession( $handle, 'line' ); 199 $vtp->setVar( $handle, 'line.name', $lang['customize_template'] ); 200 $vtp->addSession( $handle, 'select' ); 201 $vtp->setVar( $handle, 'select.name', 'template' ); 202 $option = get_dirs( './template' ); 203 for ( $i = 0; $i < sizeof( $option ); $i++ ) 204 { 205 $vtp->addSession( $handle, 'option' ); 206 $vtp->setVar( $handle, 'option.option', $option[$i] ); 207 if ( $option[$i] == $user['template'] ) 208 { 209 $vtp->setVar( $handle, 'option.selected', ' selected="selected"' ); 210 } 211 $vtp->closeSession( $handle, 'option' ); 212 } 213 $vtp->closeSession( $handle, 'select' ); 214 $vtp->closeSession( $handle, 'line' ); 215 } 216 //-------------------------------------------------------------------- language 217 if ( in_array( 'language', $infos ) ) 218 { 219 $vtp->addSession( $handle, 'line' ); 220 $vtp->setVar( $handle, 'line.name', $lang['customize_language'] ); 221 $vtp->addSession( $handle, 'select' ); 222 $vtp->setVar( $handle, 'select.name', 'language' ); 223 $option = get_languages( './language/' ); 224 for ( $i = 0; $i < sizeof( $option ); $i++ ) 225 { 226 $vtp->addSession( $handle, 'option' ); 227 $vtp->setVar( $handle, 'option.option', $option[$i] ); 228 if( $option[$i] == $user['language'] ) 229 { 230 $vtp->setVar( $handle, 'option.selected', ' selected="selected"' ); 231 } 232 $vtp->closeSession( $handle, 'option' ); 233 } 234 $vtp->closeSession( $handle, 'select' ); 235 $vtp->closeSession( $handle, 'line' ); 236 } 237 //---------------------------------------------------------------- short period 238 if ( in_array( 'short_period', $infos ) ) 239 { 240 $vtp->addSession( $handle, 'line' ); 241 $vtp->setVar( $handle, 'line.name', $lang['customize_short_period'] ); 242 $vtp->addSession( $handle, 'text' ); 243 $vtp->setVar( $handle, 'text.name', 'short_period' ); 244 $vtp->setVar( $handle, 'text.value', $user['short_period'] ); 245 $vtp->closeSession( $handle, 'text' ); 246 $vtp->closeSession( $handle, 'line' ); 247 } 248 //----------------------------------------------------------------- long period 249 if ( in_array( 'long_period', $infos ) ) 250 { 251 $vtp->addSession( $handle, 'line' ); 252 $vtp->setVar( $handle, 'line.name', $lang['customize_long_period'] ); 253 $vtp->addSession( $handle, 'text' ); 254 $vtp->setVar( $handle, 'text.name', 'long_period' ); 255 $vtp->setVar( $handle, 'text.value', $user['long_period'] ); 256 $vtp->closeSession( $handle, 'text' ); 257 $vtp->closeSession( $handle, 'line' ); 258 } 259 //--------------------------------------------------------- max displayed width 260 if ( in_array( 'maxwidth', $infos ) ) 261 { 262 $vtp->addSession( $handle, 'line' ); 263 $vtp->setVar( $handle, 'line.name', $lang['maxwidth'] ); 264 $vtp->addSession( $handle, 'text' ); 265 $vtp->setVar( $handle, 'text.name', 'maxwidth' ); 266 $vtp->setVar( $handle, 'text.value', $user['maxwidth'] ); 267 $vtp->closeSession( $handle, 'text' ); 268 $vtp->closeSession( $handle, 'line' ); 269 } 270 //-------------------------------------------------------- max displayed height 271 if ( in_array( 'maxheight', $infos ) ) 272 { 273 $vtp->addSession( $handle, 'line' ); 274 $vtp->setVar( $handle, 'line.name', $lang['maxheight'] ); 275 $vtp->addSession( $handle, 'text' ); 276 $vtp->setVar( $handle, 'text.name', 'maxheight' ); 277 $vtp->setVar( $handle, 'text.value', $user['maxheight'] ); 278 $vtp->closeSession( $handle, 'text' ); 279 $vtp->closeSession( $handle, 'line' ); 280 } 281 //---------------------------------------------------------------- mail address 282 if ( in_array( 'mail_address', $infos ) ) 283 { 284 $vtp->addSession( $handle, 'line' ); 285 $vtp->setVar( $handle, 'line.name', $lang['mail_address'] ); 286 $vtp->addSession( $handle, 'text' ); 287 $vtp->setVar( $handle, 'text.name', 'mail_address' ); 288 $vtp->setVar( $handle, 'text.value', $user['mail_address'] ); 289 $vtp->closeSession( $handle, 'text' ); 290 $vtp->closeSession( $handle, 'line' ); 291 } 292 //----------------------------------------------------- expand all categories ? 293 if ( in_array( 'expand', $infos ) ) 294 { 295 $vtp->addSession( $handle, 'line' ); 296 $vtp->setVar( $handle, 'line.name', $lang['customize_expand'] ); 297 $vtp->addSession( $handle, 'group' ); 298 $vtp->addSession( $handle, 'radio' ); 299 $vtp->setVar( $handle, 'radio.name', 'expand' ); 300 $vtp->setVar( $handle, 'radio.value', 'true' ); 301 $checked = ''; 302 if ( $user['expand'] ) 303 { 304 $checked = ' checked="checked"'; 305 } 306 $vtp->setVar( $handle, 'radio.checked', $checked ); 307 $vtp->setVar( $handle, 'radio.option', $lang['yes'] ); 308 $vtp->closeSession( $handle, 'radio' ); 309 $vtp->addSession( $handle, 'radio' ); 310 $vtp->setVar( $handle, 'radio.name', 'expand' ); 311 $vtp->setVar( $handle, 'radio.value', 'false' ); 312 $checked = ''; 313 if ( !$user['expand'] ) 314 { 315 $checked = ' checked="checked"'; 316 } 317 $vtp->setVar( $handle, 'radio.checked', $checked ); 318 $vtp->setVar( $handle, 'radio.option', $lang['no'] ); 319 $vtp->closeSession( $handle, 'radio' ); 320 $vtp->closeSession( $handle, 'group' ); 321 $vtp->closeSession( $handle, 'line' ); 322 } 323 //---------------------------------- show number of comments on thumbnails page 324 if ( in_array( 'show_nb_comments', $infos ) ) 325 { 326 $vtp->addSession( $handle, 'line' ); 327 $vtp->setVar( $handle, 'line.name', $lang['customize_show_nb_comments'] ); 328 $vtp->addSession( $handle, 'group' ); 329 $vtp->addSession( $handle, 'radio' ); 330 $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' ); 331 $vtp->setVar( $handle, 'radio.value', 'true' ); 332 $checked = ''; 333 if ( $user['show_nb_comments'] ) 334 { 335 $checked = ' checked="checked"'; 336 } 337 $vtp->setVar( $handle, 'radio.checked', $checked ); 338 $vtp->setVar( $handle, 'radio.option', $lang['yes'] ); 339 $vtp->closeSession( $handle, 'radio' ); 340 $vtp->addSession( $handle, 'radio' ); 341 $vtp->setVar( $handle, 'radio.name', 'show_nb_comments' ); 342 $vtp->setVar( $handle, 'radio.value', 'false' ); 343 $checked = ''; 344 if ( !$user['show_nb_comments'] ) 345 { 346 $checked = ' checked="checked"'; 347 } 348 $vtp->setVar( $handle, 'radio.checked', $checked ); 349 $vtp->setVar( $handle, 'radio.option', $lang['no'] ); 350 $vtp->closeSession( $handle, 'radio' ); 351 $vtp->closeSession( $handle, 'group' ); 352 $vtp->closeSession( $handle, 'line' ); 353 } 153 if ( sizeof( $errors ) != 0 ) 154 { 155 $template->assign_block_vars('errors',array()); 156 for ( $i = 0; $i < sizeof( $errors ); $i++ ) 157 { 158 $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); 159 } 160 } 161 162 $template->assign_block_vars('select',array( 163 'F_LABEL'=>$lang['customize_nb_image_per_row'], 164 'F_NAME'=>'nb_image_line', 165 'F_OPTIONS'=>make_jumpbox($conf['nb_image_row'], $user['nb_image_line']) 166 )); 167 168 $template->assign_block_vars('select',array( 169 'F_LABEL'=>$lang['customize_nb_row_per_page'], 170 'F_NAME'=>'nb_line_page', 171 'F_OPTIONS'=>make_jumpbox($conf['nb_row_page'], $user['nb_line_page']) 172 )); 173 174 $template->assign_block_vars('select',array( 175 'F_LABEL'=>$lang['customize_template'], 176 'F_NAME'=>'template', 177 'F_OPTIONS'=>make_jumpbox(get_dirs( './template' ), $user['template']) 178 )); 179 180 $template->assign_block_vars('select',array( 181 'F_LABEL'=>$lang['customize_language'], 182 'F_NAME'=>'language', 183 'F_OPTIONS'=>make_jumpbox($lang['lang'], $user['language'], true) 184 )); 185 186 $template->assign_block_vars('text',array( 187 'F_LABEL'=>$lang['customize_short_period'], 188 'F_NAME'=>'short_period', 189 'F_VALUE'=>$user['short_period'] 190 )); 191 192 $template->assign_block_vars('text',array( 193 'F_LABEL'=>$lang['customize_long_period'], 194 'F_NAME'=>'long_period', 195 'F_VALUE'=>$user['long_period'] 196 )); 197 198 $template->assign_block_vars('text',array( 199 'F_LABEL'=>$lang['maxwidth'], 200 'F_NAME'=>'maxwidth', 201 'F_VALUE'=>$user['maxwidth'] 202 )); 203 204 $template->assign_block_vars('text',array( 205 'F_LABEL'=>$lang['maxheight'], 206 'F_NAME'=>'maxheight', 207 'F_VALUE'=>$user['maxheight'] 208 )); 209 210 $template->assign_block_vars('text',array( 211 'F_LABEL'=>$lang['mail_address'], 212 'F_NAME'=>'mail_address', 213 'F_VALUE'=>$user['mail_address'] 214 )); 215 216 $template->assign_block_vars('radio',array( 217 'F_LABEL'=>$lang['customize_expand'], 218 'F_OPTIONS'=>make_radio('expand', array(true=>$lang['yes'], false=>$lang['no']), $user['expand'], true) 219 )); 220 221 $template->assign_block_vars('radio',array( 222 'F_LABEL'=>$lang['customize_show_nb_comments'], 223 'F_OPTIONS'=>make_radio('show_nb_comments', array(true=>$lang['yes'], false=>$lang['no']), $user['show_nb_comments'], true) 224 )); 225 354 226 //--------------------------------------------------------------- create cookie 355 227 if ( $conf['authorize_cookies'] ) … … 375 247 } 376 248 //----------------------------------------------------------- html code display 377 $code = $vtp->Display( $handle, 0 ); 378 echo $code; 249 $template->pparse('profile'); 379 250 include('include/page_tail.php'); 380 251 ?>
Note: See TracChangeset
for help on using the changeset viewer.