示例#1
0
 function _getposteddata()
 {
     $arr['version'] = system_ver();
     $arr['subject'] = $_POST['subject'];
     $arr['content'] = $_POST['content'];
     $author = user_get();
     $arr['author'] = $author['userid'];
     $arr['date'] = !empty($_POST['timestamp']) ? $_POST['timestamp'] : date_time();
     $cats = !empty($_POST['cats']) ? $_POST['cats'] : array();
     $flags = !empty($_POST['flags']) ? $_POST['flags'] : array();
     //$arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
     return $arr;
 }
示例#2
0
function shared_entry_form_onsubmit()
{
    $arr['version'] = system_ver();
    $arr['subject'] = stripslashes($_POST['subject']);
    $arr['content'] = stripslashes($_POST['content']);
    $author = user_get();
    $arr['author'] = $author['NAME'];
    $arr['date'] = !empty($_POST['timestamp']) ? $_POST['timestamp'] : time();
    $cats = !empty($_POST['cats']) ? $_POST['cats'] : array();
    $flags = !empty($_POST['flags']) ? $_POST['flags'] : array();
    $arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
    //sess_add('entry', $arr);
    return $arr;
}
示例#3
0
function contact_form_validate()
{
    $arr['version'] = system_ver();
    $arr['name'] = $_POST['name'];
    if (!empty($_POST['email'])) {
        $arr['email'] = $_POST['email'];
    }
    if (!empty($_POST['url'])) {
        $arr['url'] = $_POST['url'];
    }
    $arr['content'] = $_POST['content'];
    $arr['ip-address'] = utils_ipget();
    if (apply_filters('comment_validate', true, $arr)) {
        return $arr;
    } else {
        return false;
    }
}
示例#4
0
function theme_wp_head()
{
    global $fp_config;
    echo "\n<!-- FP STD HEADER -->\n";
    echo "\n<meta name=\"generator\" content=\"FlatPress " . system_ver() . "\" />\n";
    echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"" . theme_feed_link('rss2') . "\" />\n";
    echo "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Get Atom 1.0 Feed\" href=\"" . theme_feed_link('atom') . "\" />\n";
    echo "<!-- EOF FP STD HEADER -->\n";
}
示例#5
0
function comment_validate()
{
    global $smarty, $lang;
    $lerr =& $lang['comments']['error'];
    $r = true;
    /*			$lang['comments']['error'] = array(
    		'name'		=> 'You must enter a name',
    		'email'		=> 'You must enter a valid email',
    		'www'		=> 'You must enter a valid URL',
    		'comment'	=> 'You must enter a comment',
    	);*/
    $content = isset($_POST['content']) ? trim(stripslashes($_POST['content'])) : null;
    $errors = array();
    $loggedin = false;
    if (user_loggedin()) {
        $user = user_get();
        $loggedin = $arr['loggedin'] = true;
        $email = $user['email'];
        $url = $user['www'];
        $name = $user['userid'];
    } else {
        $name = trim(htmlspecialchars(@$_POST['name']));
        $email = isset($_POST['email']) ? trim(htmlspecialchars($_POST['email'])) : null;
        $url = isset($_POST['url']) ? trim(stripslashes(htmlspecialchars($_POST['url']))) : null;
        /*
         * check name
         *
         */
        if (!$name) {
            $errors['name'] = $lerr['name'];
        }
        /*
         * check email
         *
         */
        if ($email) {
            $_is_valid = !(preg_match('!@.*@|\\.\\.|\\,|\\;!', $email) || !preg_match('!^.+\\@(\\[?)[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$!', $email));
            if (!$_is_valid) {
                $errors['email'] = $lerr['email'];
            }
        }
        /*
         * check url
         *
         */
        if ($url) {
            if (!preg_match('!^http(s)?://[\\w-]+\\.[\\w-]+(\\S+)?$!i', $url)) {
                // || preg_match('!^http(s)?://localhost!', $value);
                $errors['url'] = $lerr['www'];
            }
        }
    }
    if (!$content) {
        $errors['content'] = $lerr['comment'];
    }
    if ($errors) {
        $smarty->assign('error', $errors);
        return false;
    }
    $arr['version'] = system_ver();
    $arr['name'] = $name;
    if (!$loggedin) {
        setcookie('comment_author_' . COOKIEHASH, $arr['name'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
    }
    if ($email) {
        $arr['email'] = $email;
        if (!$loggedin) {
            setcookie('comment_author_email_' . COOKIEHASH, $arr['email'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
        }
    }
    if ($url) {
        $arr['url'] = $url;
        if (!$loggedin) {
            setcookie('comment_author_url_' . COOKIEHASH, $arr['url'], time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
        }
    }
    $arr['content'] = $content;
    if ($v = utils_ipget()) {
        $arr['ip-address'] = $v;
    }
    if ($loggedin || apply_filters('comment_validate', true, $arr)) {
        return $arr;
    } else {
        return false;
    }
}