From: Eloi G. <ada...@us...> - 2004-09-15 20:53:45
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4007/class Modified Files: Manager.php Log Message: Standardized code spacing Index: Manager.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Manager.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Manager.php 15 Sep 2004 20:24:42 -0000 1.45 --- Manager.php 15 Sep 2004 20:53:34 -0000 1.46 *************** *** 622,661 **** if ($this->_use_avatars) { ! // If an avatar was selected from the gallery, place its information into the form. ! if (isset($_POST['IMGLib_selected_image'])) ! { ! $user['avatar_file'] = $_POST['IMGLib_selected_image']; ! $user['avatar_dir'] = $_POST['IMGLib_selected_gallery']; ! } ! // If a local avatar is selected, show it ! if (!empty($user['avatar_dir']) && !empty($user['avatar_file'])) ! { ! $user['AVATAR'] = '<img src="images/phpwsbb/'.$user['avatar_dir'].$user['avatar_file'].'" alt="" title="" border="0" />'; ! $form->add('IMGLib_current_image', 'hidden', $user['avatar_file']); ! $form->add('IMGLib_current_gallery', 'hidden', $user['avatar_dir']); ! } ! ! if ($this->_use_offsite_avatars) ! { ! // If a remote avatar is selected, show it ! if(empty($user['avatar_dir']) && !empty($user['avatar_file'])) ! $form->add('SETTINGS_avatar_file', 'text', $user['avatar_file']); ! // otherwise, display an empty textfield ! else ! $form->add('SETTINGS_avatar_file', 'text'); ! ! $form->setMaxSize('SETTINGS_avatar_file', 100); ! $form->setWidth('SETTINGS_avatar_file', 70); ! $form->add('SETTINGS_avatar_file_oldvalue', 'hidden', $user['avatar_file']); ! } ! // If any type of avatar was selected, prepare hidden image values ! if ($user['avatar_file']) ! { ! $form->add('SETTINGS_delete_image', 'checkbox'); ! $form->add('avatar_file', 'hidden', $user['avatar_file']); ! $form->add('avatar_dir', 'hidden', $user['avatar_dir']); ! } ! $form->add('IMGLib_return_data', 'hidden', 'edit'); ! $form->add('IMGLib_op', 'submit', $_SESSION['translate']->it('Show Gallery')); } --- 622,661 ---- if ($this->_use_avatars) { ! // If an avatar was selected from the gallery, place its information into the form. ! if (isset($_POST['IMGLib_selected_image'])) ! { ! $user['avatar_file'] = $_POST['IMGLib_selected_image']; ! $user['avatar_dir'] = $_POST['IMGLib_selected_gallery']; ! } ! // If a local avatar is selected, show it ! if (!empty($user['avatar_dir']) && !empty($user['avatar_file'])) ! { ! $user['AVATAR'] = '<img src="images/phpwsbb/'.$user['avatar_dir'].$user['avatar_file'].'" alt="" title="" border="0" />'; ! $form->add('IMGLib_current_image', 'hidden', $user['avatar_file']); ! $form->add('IMGLib_current_gallery', 'hidden', $user['avatar_dir']); ! } ! ! if ($this->_use_offsite_avatars) ! { ! // If a remote avatar is selected, show it ! if(empty($user['avatar_dir']) && !empty($user['avatar_file'])) ! $form->add('SETTINGS_avatar_file', 'text', $user['avatar_file']); ! // otherwise, display an empty textfield ! else ! $form->add('SETTINGS_avatar_file', 'text'); ! ! $form->setMaxSize('SETTINGS_avatar_file', 100); ! $form->setWidth('SETTINGS_avatar_file', 70); ! $form->add('SETTINGS_avatar_file_oldvalue', 'hidden', $user['avatar_file']); ! } ! // If any type of avatar was selected, prepare hidden image values ! if ($user['avatar_file']) ! { ! $form->add('SETTINGS_delete_image', 'checkbox'); ! $form->add('avatar_file', 'hidden', $user['avatar_file']); ! $form->add('avatar_dir', 'hidden', $user['avatar_dir']); ! } ! $form->add('IMGLib_return_data', 'hidden', 'edit'); ! $form->add('IMGLib_op', 'submit', $_SESSION['translate']->it('Show Gallery')); } *************** *** 682,704 **** if ($this->_use_avatars) { ! $tags['AVATAR_TITLE'] = $_SESSION['translate']->it('Avatar Control Panel'); ! if(!empty($user['avatar_file'])) { ! $tags['CURRENT_AVATAR_LABEL'] = $_SESSION['translate']->it('Current Avatar'); ! $tags['CURRENT_AVATAR_IMG'] = $user['AVATAR']; ! $tags['REMOVE_AVATAR_LABEL'] = $_SESSION['translate']->it('Remove Avatar'); ! if (!empty($user['avatar_dir'])) ! $tags['CURRENT_AVATAR_TEXT'] = $_SESSION['translate']->it('Gallery Avatar "[var1]" is currently selected', preg_replace("/[^a-zA-Z0-9]/", ' ', str_replace(strrchr($user['avatar_file'], '.'), '', $user['avatar_file']))); ! elseif (empty($user['avatar_dir'])) ! $tags['CURRENT_AVATAR_TEXT'] = $_SESSION['translate']->it('A Remote Avatar is currently selected'); ! } ! ! $tags['SELECT_AVATAR_LABEL'] = $_SESSION['translate']->it('Pick a Local Avatar'); ! $tags['SELECT_AVATAR_HELP'] = $_SESSION['translate']->it('Choose an avatar from one of our galleries that will represent you on the online forums'); ! ! if ($this->_use_offsite_avatars) ! { ! $tags['REMOTE_AVATAR_LABEL'] = $_SESSION['translate']->it('Link to off-site Avatar'); ! $tags['REMOTE_AVATAR_HELP'] = $_SESSION['translate']->it('Enter a URL to an online avatar image. The image must be no greater than [var1] pixels high by [var2] pixels wide, and its filesize can be no greater than [var3]Kb.', $this->_max_avatar_height, $this->_max_avatar_width, $this->_max_avatar_size); ! } } --- 682,704 ---- if ($this->_use_avatars) { ! $tags['AVATAR_TITLE'] = $_SESSION['translate']->it('Avatar Control Panel'); ! if(!empty($user['avatar_file'])) { ! $tags['CURRENT_AVATAR_LABEL'] = $_SESSION['translate']->it('Current Avatar'); ! $tags['CURRENT_AVATAR_IMG'] = $user['AVATAR']; ! $tags['REMOVE_AVATAR_LABEL'] = $_SESSION['translate']->it('Remove Avatar'); ! if (!empty($user['avatar_dir'])) ! $tags['CURRENT_AVATAR_TEXT'] = $_SESSION['translate']->it('Gallery Avatar "[var1]" is currently selected', preg_replace("/[^a-zA-Z0-9]/", ' ', str_replace(strrchr($user['avatar_file'], '.'), '', $user['avatar_file']))); ! elseif (empty($user['avatar_dir'])) ! $tags['CURRENT_AVATAR_TEXT'] = $_SESSION['translate']->it('A Remote Avatar is currently selected'); ! } ! ! $tags['SELECT_AVATAR_LABEL'] = $_SESSION['translate']->it('Pick a Local Avatar'); ! $tags['SELECT_AVATAR_HELP'] = $_SESSION['translate']->it('Choose an avatar from one of our galleries that will represent you on the online forums'); ! ! if ($this->_use_offsite_avatars) ! { ! $tags['REMOTE_AVATAR_LABEL'] = $_SESSION['translate']->it('Link to off-site Avatar'); ! $tags['REMOTE_AVATAR_HELP'] = $_SESSION['translate']->it('Enter a URL to an online avatar image. The image must be no greater than [var1] pixels high by [var2] pixels wide, and its filesize can be no greater than [var3]Kb.', $this->_max_avatar_height, $this->_max_avatar_width, $this->_max_avatar_size); ! } } *************** *** 730,756 **** $data['location'] = ''; if(isset($_POST['SETTINGS_location'])) ! $data['location'] = PHPWS_Text::parseInput($_POST['SETTINGS_location']); $data['signature'] = ''; if(isset($_POST['SETTINGS_signature'])) ! $data['signature'] = PHPWS_Text::parseInput($_POST['SETTINGS_signature']); if($this->_use_avatars) { ! // If desired, remove all image information ! if(isset($_POST['SETTINGS_delete_image'])) ! $data['avatar_file'] = $data['avatar_dir'] = ''; ! // otherwise, if a gallery directory was given, save the gallery avatar ! elseif (isset($_POST['avatar_dir'])) { ! $data['avatar_file'] = $_POST['avatar_file']; ! $data['avatar_dir'] = $_POST['avatar_dir']; ! } ! // otherwise, if an offsite avatar is specified, save just the image url ! elseif($this->_use_offsite_avatars && isset($_POST['SETTINGS_avatar_file'])) { ! $url = str_replace(array('http://',' ','<','>'), '', $_POST['SETTINGS_avatar_file']); ! if($url!=$_POST['SETTINGS_avatar_file_oldvalue']) { ! $data['avatar_file'] = $url; ! $data['avatar_dir'] = ''; } - } } --- 730,756 ---- $data['location'] = ''; if(isset($_POST['SETTINGS_location'])) ! $data['location'] = PHPWS_Text::parseInput($_POST['SETTINGS_location']); $data['signature'] = ''; if(isset($_POST['SETTINGS_signature'])) ! $data['signature'] = PHPWS_Text::parseInput($_POST['SETTINGS_signature']); if($this->_use_avatars) { ! // If desired, remove all image information ! if(isset($_POST['SETTINGS_delete_image'])) ! $data['avatar_file'] = $data['avatar_dir'] = ''; ! // otherwise, if a gallery directory was given, save the gallery avatar ! elseif (isset($_POST['avatar_dir'])) { ! $data['avatar_file'] = $_POST['avatar_file']; ! $data['avatar_dir'] = $_POST['avatar_dir']; ! } ! // otherwise, if an offsite avatar is specified, save just the image url ! elseif($this->_use_offsite_avatars && isset($_POST['SETTINGS_avatar_file'])) { ! $url = str_replace(array('http://',' ','<','>'), '', $_POST['SETTINGS_avatar_file']); ! if($url!=$_POST['SETTINGS_avatar_file_oldvalue']) { ! $data['avatar_file'] = $url; ! $data['avatar_dir'] = ''; ! } } } *************** *** 894,911 **** $opts['find'] = array('RANKROW_RANK_ID', 'RANKROW_RANK_TITLE', 'RANKROW_RANK_MIN', 'RANKROW_RANK_SPECIAL'); foreach ($this->_user_ranks as $rank) { ! $tbl = new EZform('PHPWSBB_Settings_edit'); ! $tbl->add('RANKROW_RANK_TITLE', 'text', $rank['rank_title']); ! $tbl->setWidth('RANKROW_RANK_TITLE', 100); ! $tbl->add('RANKROW_RANK_MIN', 'text', $rank['rank_min'].' '); ! $tbl->setSize('RANKROW_RANK_MIN', 5); ! $tbl->add('RANKROW_RANK_SPECIAL', 'checkbox'); ! $tbl->setMatch('RANKROW_RANK_SPECIAL', $rank['rank_special']); ! $row = PHPWS_Template::processTemplate($tbl->getTemplate(), 'phpwsbb', 'rank_tbl_row.tpl'); ! $p = 'PHPWSBB_RANK['.$rank['rank_id'].']['; ! $opts['replace'] = array($p.'rank_id]', $p.'rank_title]', $p.'rank_min]', $p.'rank_special]'); ! if($rank['rank_special']) ! $tags['RANK_SPECIAL_ROWS'] .= str_replace($opts['find'], $opts['replace'] , $row); ! else ! $tags['RANK_MEMBER_ROWS'] .= str_replace($opts['find'], $opts['replace'] , $row); } // Create input form for a new user rank. --- 894,911 ---- $opts['find'] = array('RANKROW_RANK_ID', 'RANKROW_RANK_TITLE', 'RANKROW_RANK_MIN', 'RANKROW_RANK_SPECIAL'); foreach ($this->_user_ranks as $rank) { ! $tbl = new EZform('PHPWSBB_Settings_edit'); ! $tbl->add('RANKROW_RANK_TITLE', 'text', $rank['rank_title']); ! $tbl->setWidth('RANKROW_RANK_TITLE', 100); ! $tbl->add('RANKROW_RANK_MIN', 'text', $rank['rank_min'].' '); ! $tbl->setSize('RANKROW_RANK_MIN', 5); ! $tbl->add('RANKROW_RANK_SPECIAL', 'checkbox'); ! $tbl->setMatch('RANKROW_RANK_SPECIAL', $rank['rank_special']); ! $row = PHPWS_Template::processTemplate($tbl->getTemplate(), 'phpwsbb', 'rank_tbl_row.tpl'); ! $p = 'PHPWSBB_RANK['.$rank['rank_id'].']['; ! $opts['replace'] = array($p.'rank_id]', $p.'rank_title]', $p.'rank_min]', $p.'rank_special]'); ! if($rank['rank_special']) ! $tags['RANK_SPECIAL_ROWS'] .= str_replace($opts['find'], $opts['replace'] , $row); ! else ! $tags['RANK_MEMBER_ROWS'] .= str_replace($opts['find'], $opts['replace'] , $row); } // Create input form for a new user rank. *************** *** 996,1029 **** // If changes to the user ranks were posted, save them now. if(isset($_POST['PHPWSBB_RANK'])) { ! $data = array(); ! foreach($_POST['PHPWSBB_RANK'] as $rank_id=>$rank) { ! if(!empty($rank['rank_title'])) { ! $data['rank_title'] = $rank['rank_title']; ! $data['rank_min'] = $rank['rank_min']; ! if(isset($rank['rank_special'])) ! $data['rank_special'] = 1; ! else ! $data['rank_special'] = 0; ! $GLOBALS['core']->sqlUpdate($data, 'mod_phpwsbb_user_ranks', 'rank_id', $rank_id); ! } ! else { ! // Erase rank if title is empty ! $GLOBALS['core']->sqlDelete('mod_phpwsbb_user_ranks', 'rank_id', $rank_id); } - } } // If a new user rank is requested, create it. if(!empty($_POST['PHPWSBB_NEW_RANK_TITLE'])) { ! $data = array(); ! $data['rank_title'] = $_POST['PHPWSBB_NEW_RANK_TITLE']; ! if(!empty($_POST['PHPWSBB_NEW_RANK_MIN'])) ! $data['rank_min'] = $_POST['PHPWSBB_NEW_RANK_MIN']; ! else ! $data['rank_min'] = 0; ! if(!empty($_POST['PHPWSBB_NEW_RANK_SPECIAL'])) ! $data['rank_special'] = 1; ! else ! $data['rank_special'] = 0; ! $GLOBALS['core']->sqlInsert($data, 'mod_phpwsbb_user_ranks', 'rank_id'); } // Now, reload the rank data into this class --- 996,1029 ---- // If changes to the user ranks were posted, save them now. if(isset($_POST['PHPWSBB_RANK'])) { ! $data = array(); ! foreach($_POST['PHPWSBB_RANK'] as $rank_id=>$rank) { ! if(!empty($rank['rank_title'])) { ! $data['rank_title'] = $rank['rank_title']; ! $data['rank_min'] = $rank['rank_min']; ! if(isset($rank['rank_special'])) ! $data['rank_special'] = 1; ! else ! $data['rank_special'] = 0; ! $GLOBALS['core']->sqlUpdate($data, 'mod_phpwsbb_user_ranks', 'rank_id', $rank_id); ! } ! else { ! // Erase rank if title is empty ! $GLOBALS['core']->sqlDelete('mod_phpwsbb_user_ranks', 'rank_id', $rank_id); ! } } } // If a new user rank is requested, create it. if(!empty($_POST['PHPWSBB_NEW_RANK_TITLE'])) { ! $data = array(); ! $data['rank_title'] = $_POST['PHPWSBB_NEW_RANK_TITLE']; ! if(!empty($_POST['PHPWSBB_NEW_RANK_MIN'])) ! $data['rank_min'] = $_POST['PHPWSBB_NEW_RANK_MIN']; ! else ! $data['rank_min'] = 0; ! if(!empty($_POST['PHPWSBB_NEW_RANK_SPECIAL'])) ! $data['rank_special'] = 1; ! else ! $data['rank_special'] = 0; ! $GLOBALS['core']->sqlInsert($data, 'mod_phpwsbb_user_ranks', 'rank_id'); } // Now, reload the rank data into this class |