当前位置: 首页>>代码示例>>PHP>>正文


PHP invalid函数代码示例

本文整理汇总了PHP中invalid函数的典型用法代码示例。如果您正苦于以下问题:PHP invalid函数的具体用法?PHP invalid怎么用?PHP invalid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了invalid函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testInvalid

 public function testInvalid()
 {
     $data = array('username' => 'homer', 'email' => 'homer@simpson.com', 'zip' => 0, 'street' => '');
     $rules = array('name' => array('required'), 'username' => array('required'), 'zip' => array('required'), 'street' => array('required'));
     $messages = array('name' => 'The name is required', 'street' => 'The street is required');
     $invalid = invalid($data, $rules, $messages);
     $expected = array('name' => 'The name is required', 'street' => 'The street is required');
     $this->assertEquals($expected, $invalid);
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:9,代码来源:HelpersTest.php

示例2: validates

 public function validates()
 {
     $invalid = invalid($this->data, $this->rules, $this->messages);
     if ($invalid) {
         $this->addErrors($invalid);
         $this->saveData();
         return false;
     }
     return true;
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:10,代码来源:Form.php

示例3: iter1

function iter1($x, $y, $tx, $ty)
{
    global $n, $m, $el, $paths, $chp, $newpaths, $newchp;
    if (invalid($tx, $ty)) {
        return;
    }
    $changed = FALSE;
    $oldnewp = 1000000000000;
    for ($i = 9; $i >= 0; --$i) {
        $e = abs($i - $el[$tx][$ty]);
        $newp = min($newpaths[$x][$y][$i][0] + $e, $oldnewp);
        if (!isset($newpaths[$tx][$ty][$i]) || $newp < $newpaths[$tx][$ty][$i][0]) {
            $a = $newpaths[$x][$y][$i][1];
            $a[] = array($tx, $ty);
            $newpaths[$tx][$ty][$i] = array($newp, $a);
            $changed = TRUE;
        }
        $oldnewp = $newp;
    }
    if ($changed) {
        $newchp[] = array($tx, $ty);
    }
}
开发者ID:BastinRobin,项目名称:CodeSprints,代码行数:23,代码来源:ot.php

示例4: processNormal

function processNormal($id, $action)
{
    global $user, $table;
    $my = (int) $id == (int) $user->id;
    if (!$my && !$user->isAdmin()) {
        invalid();
    }
    if ($action == 'comment') {
        $comment = get($_POST, 'comment');
        if (strlen($comment) > 10000) {
            $comment = substr($comment, 0, 10000);
        }
        query("update {$table['user']} set comment = ? where id = ?", $comment, $id);
    } else {
        if ($action == 'password') {
            if (!$my) {
                invalid();
            }
            $oldp = md5(get($_POST, 'oldp'));
            $newp = md5(get($_POST, 'newp'));
            $q = query("update {$table['user']} set password = ? where id = ? and password = ?", $newp, $id, $oldp);
            if (!$q->num_rows) {
                error(2);
            }
        } else {
            if (!$user->isAdmin()) {
                invalid();
            }
            if ($action == 'admin_comment') {
                $comment = get($_POST, 'admin_comment');
                query("update {$table['user']} set admin_comment = ? where id = ?", $comment, $id);
            } else {
                if ($action == 'ban') {
                    $ban_date = strtotime(get($_POST, 'ban_date'));
                    if (!$ban_date || $ban_date <= time()) {
                        error(3);
                    }
                    $revert = get($_POST, 'ban_revert_all') == '1';
                    $ban_ips = get($_POST, 'ban_ips') == '1';
                    $ban_reason = get($_POST, 'ban_reason');
                    query("update {$table['user']} set ban_date = from_unixtime(?), banned_by = ?, ban_reason = ? where id = ?", $ban_date, $user->id, $ban_reason, $id);
                    if ($revert && !$ban_ips) {
                        revertUserChanges("main.user_id = '{$id}'", $ban_reason);
                    }
                    if ($ban_ips) {
                        $q = query("select distinct user_ip from translation where user_id = ?", $id);
                        $ips = $q->fetchAll();
                        foreach ($ips as $ip) {
                            banIp($ip[0], $ban_date, $ban_reason, $revert, false);
                        }
                    }
                } else {
                    if ($action == 'unban') {
                        $unban_reason = get($_POST, 'ban_reason');
                        query("update {$table['user']} set ban_date = from_unixtime(1), banned_by = ?, ban_reason = ? where id = ?", $user->id, $unban_reason, $id);
                    } else {
                        if ($action == 'promote') {
                            query("update {$table['user']} set role = 'admin' where id = ? and id != 1", $id);
                        } else {
                            if ($action == 'demote') {
                                query("update {$table['user']} set role = 'user' where id = ? and id != 1", $id);
                            } else {
                                invalid();
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:aaronboo95,项目名称:chiitrans,代码行数:71,代码来源:user.php

示例5: substr

				$year 	= substr($last_seen,0,4);
				$month	= substr($last_seen,5,2);
				$day	= substr($last_seen,6,2);
				$last_seen=mktime(0,0,0,$month,$day,$year);
	*/
            echo "<host>";
            echo "<hostname>" . $hostname . "</hostname>";
            echo "<last_audited>" . $last_seen . "</last_audited>";
            echo "</host>";
        }
        echo "</node>";
    } else {
        $nodata = 0;
        success($nodata);
    }
}
// include config file, also contains the API KEY
require_once '../include/config.php';
require_once '../include/dboa.php';
$api_key = strip_tags($_REQUEST['key']);
$hostname = strip_tags($_REQUEST['hostname']);
$num_rows = '';
// validate api key
if ($api_key != $API_KEY || $api_key == '') {
    invalid();
} else {
    $sql = "SELECT hostname,UNIX_TIMESTAMP(last_seen) FROM system WHERE hostname='{$hostname}'";
    $result = mysql_query($sql);
    $num_rows = mysql_num_rows($result);
    showxml($result, $num_rows);
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:31,代码来源:oa_audit_information.php

示例6: missing

                 if ($CONTEXT_MIN[$full_sub_tag] > 0 && !isset($count_plus_one[$sub_tag])) {
                     $err = missing($full_sub_tag);
                 }
             }
         }
         if ($err_level >= $warning && $err == '') {
             // WARNING CHECKS - data
             if (strpos($tmp, '_') === false && !preg_match('/^' . $CONTEXT[$tmp] . '$/i', $tag_data)) {
                 $err = invalid($pgv_lang['data']);
             } elseif ($tag_level == '0' && $xref != '' && !isset($used_xrefs[$xref . $tag])) {
                 $err = $pgv_lang['noref'];
             }
             if ($err_level >= $info && $err == '') {
                 // INFOMATIONAL CHECKS - spacing
                 if ($whitespace1 != '' || $whitespace2 != ' ' || $whitespace3 == ' ' && $xref == '' || $whitespace4 == ' ' && $tag == '') {
                     $err = invalid($pgv_lang['spacing']);
                 }
             }
             // info
         }
         // warning
     }
     // error
 }
 // critical
 //////////////////////////////////////////////////////////////////////////////
 // Record our current context for error logging and future checks.
 //////////////////////////////////////////////////////////////////////////////
 if ($tag_level == '0' && $tag != '') {
     $curr_xref = $xref;
     $curr_l0tag = $tag;
开发者ID:rathervague,项目名称:phpgedview,代码行数:31,代码来源:gedcheck.php

示例7: function

<?php

return function ($site, $pages, $page) {
    $alert = null;
    $data = array('name' => '', 'email' => '', 'phone' => '', 'text' => '');
    if (get('submit')) {
        $data = array('name' => get('name'), 'email' => get('email'), 'phone' => get('phone'), 'text' => get('text'));
        $rules = array('name' => array('required'), 'email' => array('required', 'email'), 'phone' => array('required', 'num'), 'text' => array('required', 'min' => 3, 'max' => 3000));
        $messages = array('name' => 'Enter a valid name.', 'email' => 'Enter a valid email address.', 'phone' => 'Enter a valid phone number.', 'text' => 'Please fill in the message textarea.');
        // some of the data is invalid
        if ($invalid = invalid($data, $rules, $messages)) {
            $alert = $invalid;
            // the data is fine, let's send the email
        } else {
            // create the body from a simple snippet
            $body = snippet('contactmail', $data, true);
            // build the email
            $email = email(array('to' => $site->email(), 'from' => $data['email'], 'subject' => 'New message from Paradise Construction', 'replyTo' => $data['email'], 'body' => $body));
            // try to send it and redirect to the
            // thank you page if it worked
            if ($email->send()) {
                go('contact/status:thank-you');
                // add the error to the alert list if it failed
            } else {
                $alert = array($email->error());
            }
        }
    }
    return compact('alert', 'data');
};
开发者ID:aguynamedirvin,项目名称:Paradise-Construction,代码行数:30,代码来源:contact.php

示例8: function

return function ($site, $pages, $page) {
    //set variables
    $troubleshootLink = null;
    $typeOfTroubleshoot = null;
    $invalid = null;
    //if $_POST data is present
    if (count($_POST) > 0) {
        //store specific sanitized $_POST variables into $data variable
        $data = r::postData(array('email', 'password'));
        //define validation rules for $data
        $rules = array('email' => array('required', 'email'), 'password' => array('required', 'match' => c::get('password.length.regex')));
        //define validation messages for $data
        $messages = array('email' => l('field.email.validation.message'), 'password' => l('field.password.validaton.message'));
        //if validation is passed
        if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
            //compute user's username (based upon user's email)
            $computedUsername = Auth::computeUsername($data['email']);
            //get user
            $user = Auth::loadUser($computedUsername);
            //if user exists
            if ($user) {
                //get user's activation hash
                //(if user's activation hash is empty -> user is activated, otherwise not)
                //please note: in case the activation procedure is disabled
                //this test evaluates always to true, as if the user was activated
                $isActivated = $user->activation();
                //if user has been activated
                if (empty($isActivated)) {
                    //set login redirect page to tests page
                    $redirect = site()->find(c::get('tests.folder'))->url();
开发者ID:alkaest2002,项目名称:risky2,代码行数:30,代码来源:login.php

示例9: invalid

        if (isset($repodateDb['repo_date']) and $repodateDb['repo_date'] != '') {
            $result = invalid($repodateDb['repo_date'], $repodateDb['repo_gedcomnr'], 'repo_date');
        }
        if ($result === true) {
            $found = true;
        }
    }
    if ($found === false) {
        echo '<tr><td colspan=4 style="color:red">No invalid dates found</td></tr>';
    }
    echo '<tr><td colspan="4" style="text-align:' . $direction . ';font-weight:bold">' . __('Invalid source dates:') . '</td></tr>';
    $found = false;
    $sources = $dbh->query("SELECT * FROM humo_sources WHERE source_tree_id='" . $tree_id . "'");
    while ($sourcedateDb = $sources->fetch()) {
        if (isset($sourcedateDb['source_date']) and $sourcedateDb['source_date'] != '') {
            $result = invalid($sourcedateDb['source_date'], $sourcedateDb['source_gedcomnr'], 'source_date');
        }
        if ($result === true) {
            $found = true;
        }
    }
    if ($found === false) {
        echo '<tr><td colspan=4 style="color:red">No invalid dates found</td></tr>';
    }
    echo '</table>';
}
if (isset($_POST['tree']) and (isset($_POST['data_check']) or isset($_POST['unmark']) or isset($_POST['mark_all']))) {
    // displays menu for date consistency check
    // easily set other defaults:
    $b1_def = 50;
    //Birth date - more than X years after mother's birth
开发者ID:kalinin-sanja,项目名称:FamilyTree,代码行数:31,代码来源:tree_check.php


注:本文中的invalid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。