本文整理匯總了PHP中Flyspray::check_email方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::check_email方法的具體用法?PHP Flyspray::check_email怎麽用?PHP Flyspray::check_email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flyspray
的用法示例。
在下文中一共展示了Flyspray::check_email方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_task
//.........這裏部分代碼省略.........
$sql_values[] = $plugins;
// Token for anonymous users
$token = '';
if ($user->isAnon()) {
$token = md5(uniqid(mt_rand(), true));
$sql_params[] = 'task_token';
$sql_values[] = $token;
}
$sql_params[] = 'anon_email';
$sql_values[] = array_get($args, 'anon_email', '');
$sql_cols = array_merge(array('date_opened', 'last_edited_time', 'project_id', 'item_summary', 'detailed_desc', 'opened_by', 'percent_complete'), $sql_params);
$db->x->autoExecute('{tasks}', array_combine($sql_cols, $sql_values));
$task_id = $db->lastInsertID();
// [RED] Add task to redundancy table (opened by, last_changed_time)
$db->x->autoExecute('{redundant}', array('task_id' => $task_id, 'last_changed_time' => time(), 'opened_by_real_name' => $user->infos['real_name'], 'opened_by_user_name' => $user->infos['user_name'], 'last_changed_by_real_name' => $user->infos['real_name'], 'last_changed_by_user_name' => $user->infos['user_name']));
// Per project task ID
$prefix_id = $db->x->GetOne('SELECT MAX(prefix_id)+1 FROM {tasks} WHERE project_id = ?', null, $proj->id);
$db->x->execParam('UPDATE {tasks} SET prefix_id = ? WHERE task_id = ?', array($prefix_id, $task_id));
// Now the custom fields
if (count($proj->fields)) {
$stmt = $db->x->autoPrepare('{field_values}', array('task_id', 'field_id', 'field_value'));
foreach ($proj->fields as $field) {
$stmt->execute(array($task_id, $field->id, $field->read(array_get($args, 'field' . $field->id, 0))));
}
$stmt->free();
}
$assignees = array();
if (isset($args['assigned_to'])) {
// Prepare assignee list
$assignees = explode(';', trim($args['assigned_to']));
$assignees = array_map(array('Flyspray', 'UserNameToId'), $assignees);
$assignees = array_filter($assignees, create_function('$x', 'return ($x > 0);'));
// Log the assignments and send notifications to the assignees
if (count($assignees)) {
// Convert assigned_to and store them in the 'assigned' table
foreach ($assignees as $val) {
$fields = array('user_id' => array('value' => $val, 'key' => true), 'task_id' => array('value' => $task_id, 'key' => true));
$db->Replace('{assigned}', $fields);
}
Flyspray::logEvent($task_id, 14, implode(' ', $assignees));
// Notify the new assignees what happened. This obviously won't happen if the task is now assigned to no-one.
Notifications::send($assignees, ADDRESS_USER, NOTIFY_NEW_ASSIGNEE, array('task_id' => $task_id));
}
}
// Log that the task was opened
Flyspray::logEvent($task_id, 1);
// find category owners
$owners = array();
foreach ($proj->fields as $field) {
if ($field->prefs['list_type'] != LIST_CATEGORY) {
continue;
}
$cat = $db->x->getRow('SELECT *
FROM {list_category}
WHERE category_id = ?', null, array_get($args, 'field' . $field->id, 0));
if ($cat['category_owner']) {
$owners[] = $cat['category_owner'];
} else {
// check parent categories
$sql = $db->x->getAll('SELECT *
FROM {list_category}
WHERE lft < ? AND rgt > ? AND list_id = ?
ORDER BY lft DESC', null, array($cat['lft'], $cat['rgt'], $cat['list_id']));
foreach ($sql as $row) {
// If there's a parent category owner, send to them
if ($row['category_owner']) {
$owners[] = $row['category_owner'];
break;
}
}
}
}
// last try...
if (!count($owners) && $proj->prefs['default_cat_owner']) {
$owners[] = $proj->prefs['default_cat_owner'];
}
if (count($owners)) {
foreach ($owners as $owner) {
if ($proj->prefs['auto_assign'] && !in_array($owner, $assignees)) {
Backend::add_to_assignees($owner, $task_id, true);
}
Backend::add_notification($owner, $task_id, true);
}
}
// Create the Notification
if (Backend::upload_files($task_id)) {
Notifications::send($task_id, ADDRESS_TASK, NOTIFY_TASK_OPENED, array('files' => true));
} else {
Notifications::send($task_id, ADDRESS_TASK, NOTIFY_TASK_OPENED);
}
// If the reporter wanted to be added to the notification list
if (isset($args['notifyme']) && $args['notifyme'] == '1' && !in_array($user->id, $owners)) {
Backend::add_notification($user->id, $task_id, true);
}
// this is relaxed, if the anonymous email is not valid, just dont bother..
if ($user->isAnon() && Flyspray::check_email($args['anon_email'])) {
Notifications::send($args['anon_email'], ADDRESS_EMAIL, NOTIFY_ANON_TASK, array('task_id' => $task_id, 'token' => $token));
}
return array($task_id, $token, true);
}
示例2: ucfirst
Flyspray::Redirect(CreateURL('admin', 'groups'));
} else {
Flyspray::show_error(L('lastuser'));
break;
}
}
}
if (!Post::val('onlypmgroup')) {
if ($user->perms('is_admin') || $user->id == Post::val('user_id')) {
// only admin or user himself can change
if (!Post::val('real_name') || !Post::val('email_address') && !Post::val('jabber_id')) {
Flyspray::show_error(L('realandnotify'));
break;
}
// Check email format
if (!Post::val('email_address') || !Flyspray::check_email(Post::val('email_address'))) {
Flyspray::show_error(L('novalidemail'));
break;
}
# current CleanFS template skips oldpass input requirement for admin accounts: if someone is able to catch an admin session he could simply create another admin acc for example.
#if ( (!$user->perms('is_admin') || $user->id == Post::val('user_id')) && !Post::val('oldpass')
if (!$user->perms('is_admin') && !Post::val('oldpass') && (Post::val('changepass') || Post::val('confirmpass'))) {
Flyspray::show_error(L('nooldpass'));
break;
}
if ($user->infos['oauth_uid'] && Post::val('changepass')) {
Flyspray::show_error(sprintf(L('oauthreqpass'), ucfirst($uesr->infos['oauth_provider'])));
break;
}
if (Post::val('changepass') || Post::val('confirmpass')) {
if (Post::val('changepass') != Post::val('confirmpass')) {
示例3: strtolower
if (!$user->can_register()) {
break;
}
if (!Post::val('user_name') || !Post::val('real_name') || !Post::val('email_address')) {
// If the form wasn't filled out correctly, show an error
Flyspray::show_error(L('registererror'));
break;
}
if (Post::val('email_address') != Post::val('verify_email_address')) {
Flyspray::show_error(L('emailverificationwrong'));
break;
}
$email = strtolower(Post::val('email_address'));
$jabber_id = strtolower(Post::val('jabber_id'));
//email is mandatory
if (!$email || !Flyspray::check_email($email)) {
Flyspray::show_error(L('novalidemail'));
break;
}
//jabber_id is optional
if ($jabber_id && !Jabber::check_jid($jabber_id)) {
Flyspray::show_error(L('novalidjabber'));
break;
}
$user_name = Backend::clean_username(Post::val('user_name'));
// Limit length
$real_name = substr(trim(Post::val('real_name')), 0, 100);
// Remove doubled up spaces and control chars
$real_name = preg_replace('![\\x00-\\x1f\\s]+!u', ' ', $real_name);
if (!$user_name || empty($user_name) || !$real_name) {
Flyspray::show_error(L('entervalidusername'));
示例4: action_sendcode
function action_sendcode()
{
global $user, $db, $fs, $conf, $baseurl;
if (!Post::val('user_name') || !Post::val('real_name') || !Post::val('email_address')) {
// If the form wasn't filled out correctly, show an error
return array(ERROR_RECOVER, L('registererror'));
}
$email = Post::val('email_address');
$jabber_id = Post::val('jabber_id');
//email is mandatory
if (!$email || !Flyspray::check_email($email)) {
return array(ERROR_RECOVER, L('novalidemail'));
}
//jabber_id is optional
if ($jabber_id && !Jabber::check_jid($jabber_id)) {
return array(ERROR_RECOVER, L('novalidjabber'));
}
$user_name = Backend::clean_username(Post::val('user_name'));
// Limit lengths
$real_name = substr(trim(Post::val('real_name')), 0, 100);
// Remove doubled up spaces and control chars
$real_name = preg_replace('![\\x00-\\x1f\\s]+!u', ' ', $real_name);
if (!$user_name || !$real_name) {
return array(ERROR_RECOVER, L('entervalidusername'));
}
// Delete registration codes older than 24 hours
$yesterday = time() - 86400;
$db->x->execParam('DELETE FROM {registrations} WHERE reg_time < ?', $yesterday);
$taken = $db->x->getRow('SELECT u.user_id FROM {users} u, {registrations} r
WHERE u.user_name = ? OR r.user_name = ?', null, array($user_name, $user_name));
if ($taken) {
return array(ERROR_RECOVER, L('usernametaken'));
}
$taken = $db->x->getRow("SELECT user_id\n FROM {users}\n WHERE jabber_id = ? AND jabber_id != NULL\n OR email_address = ? AND email_address != NULL", null, array($jabber_id, $email));
if ($taken) {
return array(ERROR_RECOVER, L('emailtaken'));
}
if ($fs->prefs['use_recaptcha']) {
$solution = new reCAPTCHA_Solution();
$solution->privatekey = $fs->prefs['recaptcha_priv_key'];
$solution->challenge = Post::val('recaptcha_challenge_field');
$solution->response = Post::val('recaptcha_response_field');
$solution->remoteip = $_SERVER['REMOTE_ADDR'];
if (!$solution->isValid()) {
return array(ERROR_RECOVER, $solution->error_code);
}
}
$magic_url = substr(md5(uniqid(rand(), true)), 0, 20);
//send the email first.
if (Notifications::send(Post::val('email_address'), ADDRESS_EMAIL, NOTIFY_CONFIRMATION, array($baseurl, $magic_url, $user_name))) {
//email sent succefully, now update the database.
$reg_values = array('reg_time' => time(), 'user_name' => $user_name, 'real_name' => $real_name, 'email_address' => Post::val('email_address'), 'jabber_id' => Post::val('jabber_id'), 'notify_type' => Post::num('notify_type'), 'magic_url' => $magic_url, 'time_zone' => Post::num('time_zone'));
// Insert everything into the database
$query = $db->x->autoExecute('{registrations}', $reg_values);
if (!PEAR::isError($query)) {
return array(SUBMIT_OK, L('codesent'), $baseurl);
}
} else {
return array(ERROR_INPUT, L('codenotsent'));
}
}