public function edit($id)
 {
     if (IS_POST) {
         if ($this->model->create() !== false) {
             if ($this->model->save($this->usePostAllParams ? I('post.') : '') !== false) {
                 $this->success('更新成功', cookie('__FORWARD__'));
                 return;
             }
         }
         $this->error('更新失败' . showErrors($this->model));
     } else {
         $result = $this->model->find($id);
         $this->assign($result);
         $this->assign('meta_title', $this->meta_title);
         $this->_before_edit_view();
         $this->display('edit');
     }
 }
 public function edit($id)
 {
     if (IS_POST) {
         if (($data = $this->model->create()) !== false) {
             $data['content'] = I('post.content', '', false);
             if ($this->model->save($data) !== false) {
                 $this->success('更新成功', cookie('__FORWARD__'));
                 return;
             }
         }
         $this->error('更新失败' . showErrors($this->model));
     } else {
         $result = $this->model->find($id);
         $this->assign($result);
         $this->assign('meta_title', $this->meta_title);
         $this->_before_edit_view();
         $this->display('edit');
     }
 }
 public function edit($id)
 {
     if (IS_POST) {
         if ($this->model->create() !== false) {
             $requestAll = I('post.');
             //I('post.intro',false)中第三个参数false表示不做数据处理,保留了intro文本的html代码
             $requestAll['intro'] = I('post.intro', '', false);
             if ($this->model->save($requestAll) !== false) {
                 $this->success('更新成功', cookie('__FORWARD__'));
                 return;
             }
         }
         $this->error('更新失败' . showErrors($this->model));
     } else {
         $result = $this->model->find($id);
         $this->assign($result);
         $this->assign('meta_title', $this->meta_title);
         $this->_before_edit_view();
         $this->display('edit');
     }
 }
                        $group->scrambles = array();
                    }
                    $num = 1;
                    foreach ($group->scrambles as $scramble) {
                        $wcadb_conn->boundCommand("INSERT INTO Scrambles\n                  (competitionId, eventId, roundId, groupId, isExtra, scrambleNum, scramble)\n                  VALUES (?, ?, ?, ?, 0, ?, ?)", array('ssssis', &$compId, &$eventId, &$roundId, &$groupId, &$num, &$scramble));
                        $num++;
                    }
                    // Store extra scrambles
                    if (property_exists($group, 'extraScrambles')) {
                        // no alert if these don't exist
                        $num = 1;
                        foreach ($group->extraScrambles as $scramble) {
                            $wcadb_conn->boundCommand("INSERT INTO Scrambles\n                    (competitionId, eventId, roundId, groupId, isExtra, scrambleNum, scramble)\n                    VALUES (?, ?, ?, ?, 1, ?, ?)", array('ssssis', &$compId, &$eventId, &$roundId, &$groupId, &$num, &$scramble));
                            $num++;
                        }
                    }
                }
            }
            // end cycling through rounds
        }
        // end cycling through events
        if ($round_errors) {
            showErrors($round_errors);
        }
    } else {
        showErrors($form->validate());
    }
}
// render form
print $form->render();
require '../includes/_footer.php';
Example #5
0
<?php

include "system-header.php";
showErrors();
?>
<h4>Member Details</h4>
<!--  Start of content -->
<?php 
$memberid = $_SESSION['SESS_MEMBER_ID'];
if (isset($_GET['id'])) {
    global $memberid;
    $memberid = $_GET['id'];
}
$qry = "SELECT A.* " . "FROM {$_SESSION['DB_PREFIX']}members A " . "WHERE A.member_id = {$memberid} ";
$result = mysql_query($qry);
//Check whether the query was successful or not
if ($result) {
    while ($member = mysql_fetch_assoc($result)) {
        ?>
	<form id="loginForm" class="manualform" enctype="multipart/form-data" name="loginForm" method="post" action="system-register-exec.php?id=<?php 
        echo $memberid;
        ?>
">
	  <table border="0" align="left" width='100%'>
	    <tr>
	      <td>First Name </td>
	      <td><input required="true" name="fname" type="text" class="textfield" id="fname" value="<?php 
        echo $member['firstname'];
        ?>
" /></td>
	    </tr>
    array( 'Misc',         'misc'         ),
  );

  // "Remember" administrators - try to make this link persistent if people have visited an admin page.
  // (see _session.php file for implementation)
  if ($is_admin) {
    $sections[] = array('Admin', 'admin', 'admin/');
  }

  if (!preg_match( '/^www.worldcubeassociation.org$/', $_SERVER["SERVER_NAME"])) {
    noticeBox3( 0, "Note: This is only a copy of the WCA results system used for testing stuff. The official WCA results are at:<br /><a href='https://www.worldcubeassociation.org/results/'>https://www.worldcubeassociation.org/results/</a>" );
  }

  // only show errors in admin section
  if($currentSection == 'admin' && isset($installation_errors) && !empty($installation_errors)) {
    showErrors($installation_errors);
  }
?>
<!-- TODO: Remove or reappropriate for Bootstrap.
<div id="pageMenuFrame">
  <div id="pageMenu">
    <ul class="navigation">
      <?php print_menu($sections, $currentSection); ?>
    </ul>
  </div>
</div>

<div id='header'><a href='https://www.worldcubeassociation.org/'>World Cube Association<br />Official Results</a></div>
<?php } ?>
 -->
<?php startTimer(); ?>
<?php

defined('SYSPATH') or die('No direct script access.');
?>
<style>body {background: #52A19D;} table{color: white} table tr:nth-child(odd){background:none} input.button, #menu a {color: #52A19D}</style>
<h1><?php 
echo ___('Configure database');
?>
</h1>
<?php 
echo showErrors($errors);
?>
<p><?php 
echo ___('Configure your database by filling out the following fields.');
?>
</p> 
<form method="post" action="">
  <table>
    <tr>
      <th><?php 
echo ___('Database server host');
?>
</th>
      <td><input type="text" name="host" value="<?php 
if (!empty($_POST['host'])) {
    echo $_POST['host'];
}
?>
" required autofocus /></td>
    </tr>
    <tr>
Example #8
0
            }
            /*			if ($admin)
            				message(L('ticket.successfully_posted'));
            			else
            				message(L('ticket.user_successfully_posted'));*/
            if ($admin) {
                goU('tickets.branch', array('id' => $obReply->id()));
            } else {
                goU('tickets');
            }
            //goU('messages');
        } else {
            error(L('ticket.cannot_create'));
        }
    } catch (RM_Validator_Exception $e) {
        $error_map = array('body' => array('not_empty' => L('common.required_fields')));
        showErrors($e, $error_map);
    }
} else {
    if ($admin && !$phone_call && !isNull($obRecipient)) {
        $data['body'] = L('ticket.good_afternoon', array('name' => $obRecipient->getAddressTo()));
    }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @(!$result)) {
    $data = $_POST;
}
$tpl = $phone_call ? 'call' : 'reply';
show('/tickets/' . $tpl, array('admin' => $admin, 'obTicket' => $obTicket, 'data' => @$data));
/*
старый запрос выглядел вот так:
$nMsgId = $rh->db->Insert("INSERT INTO panelie_message (user_id_from, user_id_to, parent_id, body, posted, modified, level) VALUES(".$rh->db->Quote($principal->data["user_id"]).", ".$rh->db->Quote($MSG[0]["user_id_from"]).", ".$rh->db->Quote($MSG[0]["id"]).", ".$rh->db->Quote($sMsgText).", now(), '', ".$rh->db->Quote(floor($MSG[0]["level"]+1)).")");*/
Example #9
0
 protected function _validate(&$data, $admin, $action, RM_User_Object $obUser = NULL)
 {
     $fields = $this->_getFields($admin, $action, $obUser);
     // validate form fields
     $validator_array = array();
     foreach (array('status_id' => array('and', 'not_empty', array('in_list', array_keys(M('User')->getProjectStatusList()))), 'deny_status' => 'not_empty', 'first_name' => 'not_empty', 'middle_name' => 'not_empty', 'login' => array('and', 'not_empty', 'email'), 'phone' => array('and', 'not_empty', 'phone'), 'city_id' => 'not_empty', 'home_address' => 'not_empty', 'sex' => array('and', 'not_empty', array('in_list', array(1, 2))), 'setup_date' => array('and', 'not_empty', 'date'), 'who_set_scanner' => 'not_empty') as $k => $v) {
         if (isset($fields[$k])) {
             $validator_array[$k] = $v;
         }
     }
     if (!$this->_needSetupInfo($admin, $data)) {
         unset($validator_array['setup_date']);
         unset($validator_array['who_set_scanner']);
     }
     // день рождения
     if (isset($fields['birthday']) && @$data['bd'][Year] && @$data['bd'][Month] && @$data['bd'][Day]) {
         $data['birthday'] = M('Tools')->date()->dbDate(@$data['bd'][Year] . '-' . @$data['bd'][Month] . '-' . @$data['bd'][Day]);
     }
     //причина отказа
     if (!$this->_needStatusDeny($admin, $data)) {
         unset($validator_array['deny_status']);
     }
     // платежная информация
     // _needPaymentInfo($admin, $data)
     if (isset($fields['payment_method']) && !$this->onlyPresent($obUser)) {
         if (!$this->_me_is_admin) {
             $validator_array['payment_method'] = 'not_empty';
         }
         if (!$this->_me_is_admin && $data['payment_method'] != 6) {
             $validator_array['payment_info'] = array('and', 'not_empty');
         }
         // способ вознаграждения и информация куда высылать деньги
         if (isset($data['payment_method'])) {
             if ($data['payment_method'] == 4) {
                 $arr = array();
                 foreach ($data['payment_info_4'] as $k => $v) {
                     $data[$k] = $arr[$k] = TF($v, 'post');
                     if (!$this->_me_is_admin) {
                         $validator_array[$k] = array('not_empty');
                     }
                 }
                 if (!$this->_me_is_admin) {
                     $validator_array['post_index'] = array_merge(array('and', 'post_index'), $validator_array['post_index']);
                 }
                 $data['payment_info'] = serialize($arr);
             } else {
                 if ($data['payment_method'] == 1) {
                     if (!$this->_me_is_admin) {
                         $validator_array['payment_info'][] = 'phone';
                     }
                 }
                 if ($data['payment_method'] == 3) {
                     if (!$this->_me_is_admin) {
                         $validator_array['payment_info'][] = 'webmoney';
                     }
                 }
                 $data['payment_info'] = @TF($data['payment_info_' . $data['payment_method']], 'post');
             }
         }
     }
     if ($this->onlyPresent($obUser)) {
         if (@$data['city_id'] == 13 && @$data['payment_type'] != 6) {
             $data['payment_type'] = 6;
             message(L('user.moscow_payment_type_error'));
         }
     }
     // выплаты компенсаций (смотрим только, еслт в вознаграждениях выбран подарок)
     if (isset($fields['compensation_method']) && @$data['payment_method'] == 6) {
         if (!$this->_me_is_admin) {
             $validator_array['compensation_method'] = 'not_empty';
         }
         if (!$this->_me_is_admin && @$data['compensation_method'] != 6) {
             $validator_array['compensation_info'] = array('and', 'not_empty');
         }
         // способ вознаграждения и информация куда высылать деньги
         if (isset($data['compensation_method'])) {
             if ($data['compensation_method'] == 4) {
                 $arr = array();
                 foreach ($data['compensation_info_4'] as $k => $v) {
                     $data[$k] = $arr[$k] = TF($v, 'post');
                     if (!$this->_me_is_admin) {
                         $validator_array[$k] = array('not_empty');
                     }
                 }
                 if (!$this->_me_is_admin) {
                     $validator_array['post_index'] = array_merge(array('and', 'post_index'), $validator_array['post_index']);
                 }
                 $data['compensation_info'] = serialize($arr);
             } else {
                 if ($data['compensation_method'] == 1) {
                     if (!$this->_me_is_admin) {
                         $validator_array['compensation_info'][] = 'phone';
                     }
                 }
                 if ($data['compensation_method'] == 3) {
                     if (!$this->_me_is_admin) {
                         $validator_array['compensation_info'][] = 'webmoney';
                     }
                 }
                 $data['compensation_info'] = @TF($data['compensation_info_' . $data['compensation_method']], 'post');
             }
         }
     } else {
         $data['compensation_method'] = NULL;
         $data['compensation_info'] = NULL;
     }
     if ($this->_me_is_admin) {
         unset($validator_array['compensation_method']);
         unset($validator_array['compensation_info']);
     }
     // логин (он же емейл)
     if (isset($fields['login'])) {
         if ($action == 'add' || $action == 'edit' && $data['login'] != $obUser->login) {
             $validator_array['login'][] = 'email_unique';
         }
     }
     // дата установки
     $data['setup_date'] = M('Tools')->date()->dbDateTime();
     // по умолчанию
     if (isset($fields['setup_date'])) {
         if (@$data['sd'][Year] && @$data['sd'][Month] && @$data['sd'][Day]) {
             $data['setup_date'] = M('Tools')->date()->dbDate(@$data['sd'][Year] . '-' . @$data['sd'][Month] . '-' . @$data['sd'][Day]);
         }
     }
     // пароль
     if ($action == 'add' || $action == 'edit' && !empty($data['new_password'])) {
         $validator_array['new_password'] = array('and', 'not_empty', array('in_list', array(@$data['confirm_new_password'])), 'password_length', 'password_simple');
         $validator_array['confirm_new_password'] = array('and', 'not_empty');
     }
     try {
         M('Validator')->create(array_reverse($validator_array))->check($data);
         return TRUE;
     } catch (RM_Validator_Exception $e) {
         $error_map = array('status_id' => array('not_empty' => $this->_required('status'), 'in_list' => L('user.wrong_status_id')), 'deny_status' => array('not_empty' => $this->_required('deny_status')), 'first_name' => array('not_empty' => $this->_required('first_name')), 'middle_name' => array('not_empty' => $this->_required('middle_name')), 'login' => array('not_empty' => $this->_required('email'), 'email' => L('user.wrong_email'), 'email_unique' => L('user.email_not_unique')), 'phone' => array('not_empty' => $this->_required('phone'), 'phone' => L('user.wrong_phone')), 'city_id' => array('not_empty' => $this->_required('common.city')), 'home_address' => array('not_empty' => $this->_required('home_address')), 'home_index' => array('not_empty' => $this->_required('home_index'), 'post_index' => L('user.post_index')), 'sex' => array('not_empty' => $this->_required('sex'), 'in_list' => L('user.wrong_sex')), 'birthday' => array('not_empty' => $this->_required('birthday'), 'date' => L('user.wrong_birthday')), 'setup_date' => array('not_empty' => $this->_required('setup_date'), 'date' => L('user.wrong_setup_date')), 'who_set_scanner' => array('not_empty' => $this->_required('who_set_scanner')), 'payment_method' => array('not_empty' => $this->_required('payment_method')), 'payment_info' => array('not_empty' => L('user.please_specify_payment_info'), 'webmoney' => L('user.wrong_webmoney'), 'phone' => L('user.wrong_payment_phone')), 'compensation_method' => array('not_empty' => $this->_required('compensation_method')), 'compensation_info' => array('not_empty' => L('user.please_specify_compensation_info'), 'webmoney' => L('user.wrong_webmoney'), 'phone' => L('user.wrong_payment_phone')), 'post_name' => array('not_empty' => L('user.specify_post_name')), 'post_address' => array('not_empty' => L('user.specify_post_address')), 'post_index' => array('not_empty' => L('user.specify_post_index'), 'post_index' => L('user.wrong_post_index')), 'new_password' => array('not_empty' => L('user.please_enter_password'), 'in_list' => L('user.confirm_password_not_match'), 'password_length' => L('user.password_length', array('min' => C('user.password.min-length'), 'max' => C('user.password.max-length'))), 'password_simple' => L('user.password_simple')), 'confirm_new_password' => array('not_empty' => L('user.please_confirm_password')));
         showErrors($e, $error_map);
         return FALSE;
     }
 }
				<select id="operator" name="operator">
					<option value = "sum">+</option>
					<option value = "subtraction">-</option>
					<option value = "partition">/</option>
					<option value = "multiplication">*</option>
				</select>
				
			</div>
			<div class = "<?php 
echo addErrorClass($errors, 'number2');
?>
">
				<label for="number2">nuber2</label>
				<input type = "text" id='number2' name = 'number2' />	
				
				<?php 
showErrors('number2', $errors);
?>
			
			
			</div>
			<div>
				<input type = "submit" />
			</div>
		</form>
	</div>
</body>
</html>


?>
">
				<label for="pass1">password</label>
				<input type = "password" id='pass1' name = 'pass1' value=''/>
				<?php 
echo showErrors('pass1', $errors);
?>
			</div>
			<div class = "<?php 
echo addErrorClass($errors, 'pass2');
?>
">
				<label for="pass2">password confirm</label>
				<input type = "password" id='pass2' name = 'pass2' value=''/>
				<?php 
echo showErrors('pass2', $errors);
?>
			</div>
			<?php 
echo criptPass($pass2, $errors);
?>
			
			<div>
				<input type = "submit" />
			</div>
		</form>
	</div>
</body>
</html>

'/>
				<?php 
echo showErrors('month', $errors);
?>
			</div>
			<div class = "<?php 
echo addErrorClass($errors, 'year');
?>
">
				<label for="year">Year</label>
				<input type = "number" id='year' name = 'year' value='<?php 
echo $year;
?>
'/>
				<?php 
echo showErrors('year', $errors);
?>
			</div>
			
			
			
			
			
			
			<div>
				<input type = "submit" />
			</div>
		</form>
	</div>
</body>
</html>