コード例 #1
0
function key_confirmation($args)
{
    global $FC;
    $data_key = key($args['form_data']['data']);
    if (validate_hash($_GET['uid'], $_GET['hash'])) {
        update_user_meta($_GET['uid'], $args['meta_name'], $args['meta_value']);
        $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $args['msg_true'];
    } else {
        $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $args['msg_false'];
    }
}
コード例 #2
0
ファイル: validator.php プロジェクト: kennho/router
/* retrieves the variable name of the passed in variable as a string 
   however function does not return the correct variable is value is same. */
echo 'Signature: variable_name($variable)<br/>';
echo '//returns the variable name that was passed in';
$selected_item = 'item';
$arraylist_item = array('lalala');
echo 'variable_name($selected_item): ' . variable_name($selected_item) . '<br/>';
echo 'variable_name("test_item"): "' . variable_name("test_item") . '" >br/> //returns empty if variable is not an item<br/>';
echo 'variable_name($arraylist_item): ' . variable_name($arraylist_item) . '<br/>';
echo '<br/>Passed<br/><hr/>';
/* validates if input is a valid md5 string, checks for corresponding regex in /tools/contants/regex when defined in /tools/constants/constants $allowed_hash_types */
echo 'Signature: validate_hash($hash, $hash_type = "md5")<br/>';
echo '#checks if hash type is valid based on list in constants.php, checks if hash given matches the relevant regex<br/><br/>';
echo 'validate_hash("123asd", "md5): ' . (validate_hash('123asd', 'md5') ? 'true' : 'false') . '<br/>';
echo 'validate_hash("123asd", "lalalhash"): ' . (validate_hash('123asd', 'lalahash') ? 'true' : 'false') . '//if hash type not valid false <br/>';
echo 'validate_hash("5f4dcc3b5aa765d61d8327deb882cf99"): ' . (validate_hash('5f4dcc3b5aa765d61d8327deb882cf99') ? 'true' : 'false') . '<br/>';
echo '<br/>Passed<br/><hr/>';
/* validates the email address formatting and ensure that the domain exist */
echo 'Signature: validate_email($email)<br/><br/>';
echo 'validate_email("*****@*****.**"): ' . (validate_email("*****@*****.**") ? 'true' : 'false') . '<br/>';
echo 'validate_email("*****@*****.**"): ' . (validate_email("*****@*****.**") ? 'true' : 'false') . '<br/>';
echo 'validate_email("*****@*****.**"): ' . (validate_email("*****@*****.**") ? 'true' : 'false') . '<br/>';
echo 'validate_email("*****@*****.**"): ' . (validate_email("*****@*****.**") ? 'true' : 'false') . '<br/>';
echo 'validate_email("googogo@123.123"): ' . (validate_email("googogo@123.123") ? 'true' : 'false') . ' //must be valid tld<br/>';
echo 'validate_email("googogo@123.123.123.123"): ' . (validate_email("googogo@123.123.123.123") ? 'true' : 'false') . '//ip address will not work<br/>';
echo '<br/>Passed<br/><hr/>';
/* check if server is requested with ssl */
echo 'Signature: validate_https()';
echo 'validate_https(): ' . (validate_https() ? 'true' : 'false') . '<br/>';
echo '<br/>Passed<br/><hr/>';
?>
コード例 #3
0
ファイル: index.php プロジェクト: n3wtron/viewgit
        // Take the last hash from the tree
        if (count($page['pathinfo']) > 0) {
            $page['tree_id'] = $page['pathinfo'][count($page['pathinfo']) - 1]['hash'];
        } else {
            $page['tree_id'] = 'HEAD';
        }
    }
    $page['subtitle'] = "Tree " . substr($page['tree_id'], 0, 6);
    $page['entries'] = git_ls_tree($page['project'], $page['tree_id']);
} elseif ($action === 'viewblob') {
    $template = 'blob';
    $page['project'] = validate_project($_REQUEST['p']);
    $page['hash'] = validate_hash($_REQUEST['h']);
    $page['title'] = "{$page['project']} - Blob - ViewGit";
    if (isset($_REQUEST['hb'])) {
        $page['commit_id'] = validate_hash($_REQUEST['hb']);
    } else {
        $page['commit_id'] = 'HEAD';
    }
    $page['subtitle'] = "Blob " . substr($page['hash'], 0, 6);
    $page['path'] = '';
    if (isset($_REQUEST['f'])) {
        $page['path'] = $_REQUEST['f'];
        // TODO validate?
    }
    // For the header's pagenav
    $info = git_get_commit_info($page['project'], $page['commit_id']);
    $page['commit_id'] = $info['h'];
    $page['tree_id'] = $info['tree'];
    $page['pathinfo'] = git_get_path_info($page['project'], $page['commit_id'], $page['path']);
    $page['data'] = fix_encoding(join("\n", run_git($page['project'], "cat-file blob {$page['hash']}")));