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


PHP qa_lang_sub函数代码示例

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


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

示例1: qa_question_validate

function qa_question_validate($title, $content, $format, $text, $tagstring, $notify, $email)
{
    require_once QA_INCLUDE_DIR . 'qa-app-options.php';
    $options = qa_get_options(array('min_len_q_title', 'max_len_q_title', 'min_len_q_content', 'min_num_q_tags', 'max_num_q_tags'));
    $errors = array();
    $maxtitlelength = max($options['min_len_q_title'], min($options['max_len_q_title'], QA_DB_MAX_TITLE_LENGTH));
    qa_length_validate($errors, 'title', $title, $options['min_len_q_title'], $maxtitlelength);
    qa_length_validate($errors, 'content', $content, 0, QA_DB_MAX_CONTENT_LENGTH);
    // for storage
    qa_length_validate($errors, 'content', $text, $options['min_len_q_content'], null);
    // for display
    if (isset($tagstring)) {
        $counttags = count(qa_tagstring_to_tags($tagstring));
        $mintags = min($options['min_num_q_tags'], $options['max_num_q_tags']);
        // to deal with silly settings
        if ($counttags < $mintags) {
            $errors['tags'] = qa_lang_sub('question/min_tags_x', $mintags);
        } elseif ($counttags > $options['max_num_q_tags']) {
            $errors['tags'] = qa_lang_sub('question/max_tags_x', $options['max_num_q_tags']);
        } else {
            qa_length_validate($errors, 'tags', $tagstring, 0, QA_DB_MAX_TAGS_LENGTH);
        }
    }
    qa_notify_validate($errors, $notify, $email);
    return $errors;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:26,代码来源:qa-app-post-create.php

示例2: donut_options_lang

/**
 * Returns the language value as defined in lang/donut-options-lang-*.php
 *
 * @param      $indentifier
 * @param null $subs
 *
 * @return mixed|string
 */
function donut_options_lang($indentifier, $subs = null)
{
    if (!is_array($subs)) {
        return empty($subs) ? qa_lang('donut_options/' . $indentifier) : qa_lang_sub('donut_options/' . $indentifier, $subs);
    } else {
        return strtr(qa_lang('donut_options/' . $indentifier), $subs);
    }
}
开发者ID:microbye,项目名称:Donut,代码行数:16,代码来源:functions.php

示例3: qa_feed_load_ifcategory

function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title, $questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
{
    $countslugs = @count($categoryslugs);
    list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending($questionselectspec1, $questionselectspec2, $questionselectspec3, $questionselectspec4, $countslugs ? qa_db_category_nav_selectspec($categoryslugs, false) : null, $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null);
    if ($countslugs && !isset($categoryid)) {
        qa_feed_not_found();
    }
    if (isset($allkey)) {
        $title = isset($categoryid) && isset($catkey) ? qa_lang_sub($catkey, $categories[$categoryid]['title']) : qa_lang($allkey);
    }
    return array_merge(is_array($questions1) ? $questions1 : array(), is_array($questions2) ? $questions2 : array(), is_array($questions3) ? $questions3 : array(), is_array($questions4) ? $questions4 : array());
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:12,代码来源:qa-feed.php

示例4: qa_q_list_page_content

function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:53,代码来源:q-list.php

示例5: qa_send_notification

function qa_send_notification($userid, $email, $handle, $subject, $body, $subs, $html = false)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_notifications_suspended;
    if ($qa_notifications_suspended > 0) {
        return false;
    }
    require_once QA_INCLUDE_DIR . 'db/selects.php';
    require_once QA_INCLUDE_DIR . 'util/string.php';
    if (isset($userid)) {
        $needemail = !qa_email_validate(@$email);
        // take from user if invalid, e.g. @ used in practice
        $needhandle = empty($handle);
        if ($needemail || $needhandle) {
            if (QA_FINAL_EXTERNAL_USERS) {
                if ($needhandle) {
                    $handles = qa_get_public_from_userids(array($userid));
                    $handle = @$handles[$userid];
                }
                if ($needemail) {
                    $email = qa_get_user_email($userid);
                }
            } else {
                $useraccount = qa_db_select_with_pending(array('columns' => array('email', 'handle'), 'source' => '^users WHERE userid = #', 'arguments' => array($userid), 'single' => true));
                if ($needhandle) {
                    $handle = @$useraccount['handle'];
                }
                if ($needemail) {
                    $email = @$useraccount['email'];
                }
            }
        }
    }
    if (isset($email) && qa_email_validate($email)) {
        $subs['^site_title'] = qa_opt('site_title');
        $subs['^handle'] = $handle;
        $subs['^email'] = $email;
        $subs['^open'] = "\n";
        $subs['^close'] = "\n";
        return qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => strtr($subject, $subs), 'body' => (empty($handle) ? '' : qa_lang_sub('emails/to_handle_prefix', $handle)) . strtr($body, $subs), 'html' => $html));
    } else {
        return false;
    }
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:47,代码来源:emails.php

示例6: qa_time_to_string

function qa_time_to_string($seconds)
{
    $seconds = max($seconds, 1);
    $scales = array(31557600 => array('main/1_year', 'main/x_years'), 2629800 => array('main/1_month', 'main/x_months'), 604800 => array('main/1_week', 'main/x_weeks'), 86400 => array('main/1_day', 'main/x_days'), 3600 => array('main/1_hour', 'main/x_hours'), 60 => array('main/1_minute', 'main/x_minutes'), 1 => array('main/1_second', 'main/x_seconds'));
    foreach ($scales as $scale => $phrases) {
        if ($seconds >= $scale) {
            $count = floor($seconds / $scale);
            if ($count == 1) {
                $string = qa_lang($phrases[0]);
            } else {
                $string = qa_lang_sub($phrases[1], $count);
            }
            break;
        }
    }
    return $string;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:17,代码来源:qa-app-format.php

示例7: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     $widget_opt = @$themeobject->current_widget['param']['options'];
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     if (@$qa_content['q_view']['raw']['type'] != 'Q') {
         // question might not be visible, etc...
         return;
     }
     $questionid = $qa_content['q_view']['raw']['postid'];
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, (int) $widget_opt['count']));
     $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
     foreach ($questions as $key => $question) {
         if ($question['score'] < $minscore) {
             unset($questions[$key]);
         }
     }
     $titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
     if (@$themeobject->current_widget['param']['locations']['show_title']) {
         $themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/related_questions') . '</h3>');
     }
     $themeobject->output('<div class="ra-rq-widget">');
     $themeobject->output('<ul>');
     foreach ($questions as $p) {
         $timeCode = qa_when_to_html($p['created'], 7);
         $when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
         $themeobject->output('<li>' . cs_get_post_avatar($p, $p['userid'], 30, true));
         $themeobject->output('<div class="post-content">');
         $themeobject->output('<a class="title" href="' . qa_q_path_html($p['postid'], $p['title']) . '">' . qa_html($p['title']) . '</a>');
         $themeobject->output('<div class="meta">');
         $themeobject->output('<span>' . qa_lang_sub('cleanstrap/x_answers', $p['acount']) . '</span>');
         $themeobject->output('<span class="time icon-time">' . $when . '</span>');
         $themeobject->output('<span class="vote-count icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span>');
         $themeobject->output('</div>');
         $themeobject->output('</div>');
         $themeobject->output('</li>');
     }
     $themeobject->output('</ul>');
     $themeobject->output('</div>');
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:41,代码来源:widget_related_questions.php

示例8: cs_top_users

 function cs_top_users($limit = 5, $size)
 {
     $users = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^users JOIN ^userpoints ON ^users.userid=^userpoints.userid ORDER BY ^userpoints.points DESC LIMIT #', $limit));
     $output = '<ul class="top-users-list clearfix">';
     foreach ($users as $u) {
         if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
             require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
             $u['handle'] = qa_post_userid_to_handle($u['userid']);
         }
         $output .= '<li class="top-user clearfix">';
         $output .= cs_get_post_avatar($u, $u['userid'], $size, true);
         $output .= '<div class="top-user-data">';
         $output .= '<span class="points">' . $u['points'] . ' ' . qa_lang('cleanstrap/points') . '</span>';
         $output .= '<a href="' . qa_path_html('user/' . $u['handle']) . '" class="name">' . $u['handle'] . '</a>';
         $output .= '<p class="counts"><span>' . qa_lang_sub('cleanstrap/x_questions', $u['qposts']) . '</span> <span>' . qa_lang_sub('cleanstrap/x_answers', $u['aposts']) . '</span><span>' . qa_lang_sub('cleanstrap/x_comments', $u['cposts']) . '</span></p>';
         $output .= '</div>';
         $output .= '</li>';
     }
     $output .= '</ul>';
     return $output;
 }
开发者ID:aresthelord,项目名称:CleanStrap,代码行数:21,代码来源:widget_top_users.php

示例9: qa_db_points_set_bonus

    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    qa_db_points_set_bonus($userid, (int) qa_post_text('bonus'));
    qa_db_points_update_ifuser($userid, null);
    qa_redirect(qa_request(), null, null, null, 'activity');
}
//	Get information on user references in answers and other stuff need for page
$pagesize = qa_opt('page_size_user_posts');
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$usershtml[$userid] = $userhtml;
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
if (isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS) {
    $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));
}
//	General information about the user, only available if we're using internal user management
if (!QA_FINAL_EXTERNAL_USERS) {
    $qa_content['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('avatar' => array('type' => 'image', 'style' => 'tall', 'label' => '', 'html' => qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'], $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size'))), 'removeavatar' => null, 'duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_html(qa_time_to_string(qa_opt('db_time') - $useraccount['created']))), 'level' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'tags' => 'NAME="level"', 'value' => qa_html(qa_user_level_string($useraccount['level'])), 'note' => $useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED && isset($maxlevelassign) ? qa_lang_html('users/user_blocked') : '')));
    if (empty($qa_content['form_profile']['fields']['avatar']['html'])) {
        unset($qa_content['form_profile']['fields']['avatar']);
    }
    //	Private message form
    if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
        $qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<A HREF="' . qa_path_html('message/' . $handle) . '">', '^2' => '</A>'));
    }
    //	Show any extra privileges due to user's level or their points
    $showpermits = array();
    $permitoptions = qa_get_permit_options();
    foreach ($permitoptions as $permitoption) {
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例10: qa_get_logged_in_userid

$userid = qa_get_logged_in_userid();
//	Find the questions with this tag
if (!strlen($tag)) {
    qa_redirect('tags');
}
list($questions, $tagword) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag));
$pagesize = qa_opt('page_size_tag_qs');
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html($questions);
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag));
if (isset($userid) && isset($tagword)) {
    $favoritemap = qa_get_favorite_non_qs_map();
    $favorite = @$favoritemap['tag'][qa_strtolower($tagword['word'])];
    $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word']));
}
if (!count($questions)) {
    $qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found');
}
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
foreach ($questions as $postid => $question) {
    $qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question));
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagword['tagcount'], qa_opt('pages_prev_next'));
if (empty($qa_content['page_links'])) {
    $qa_content['suggest_next'] = qa_html_suggest_qs_tags(true);
}
if (qa_opt('feed_for_tag_qs')) {
    $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request('tag/' . $tag)), 'label' => qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)));
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-page-tag.php

示例11: qa_lang_sub

             $inslug = qa_lang_sub('admin/category_default_slug', $attempt - 1);
             break;
     }
     $matchcategoryid = qa_db_category_slug_to_id($inparentid, $inslug);
     // query against DB since MySQL ignores accents, etc...
     if (!isset($inparentid)) {
         $matchpage = qa_db_single_select(qa_db_page_full_selectspec($inslug, false));
     } else {
         $matchpage = null;
     }
     if (empty($inslug)) {
         $errors['slug'] = qa_lang('main/field_required');
     } elseif (qa_strlen($inslug) > QA_DB_MAX_CAT_PAGE_TAGS_LENGTH) {
         $errors['slug'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TAGS_LENGTH);
     } elseif (preg_match('/[\\+\\/]/', $inslug)) {
         $errors['slug'] = qa_lang_sub('admin/slug_bad_chars', '+ /');
     } elseif (!isset($inparentid) && qa_admin_is_slug_reserved($inslug)) {
         // only top level is a problem
         $errors['slug'] = qa_lang('admin/slug_reserved');
     } elseif (isset($matchcategoryid) && strcmp($matchcategoryid, @$editcategory['categoryid'])) {
         $errors['slug'] = qa_lang('admin/category_already_used');
     } elseif (isset($matchpage)) {
         $errors['slug'] = qa_lang('admin/page_already_used');
     } else {
         unset($errors['slug']);
     }
     if (isset($editcategory['categoryid']) || !isset($errors['slug'])) {
         // don't try other options if editing existing category
         break;
     }
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:admin-categories.php

示例12: qa_post_text

if (qa_clicked('dofeedback')) {
    require_once QA_INCLUDE_DIR . 'qa-util-emailer.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $inmessage = qa_post_text('message');
    $inname = qa_post_text('name');
    $inemail = qa_post_text('email');
    $inreferer = qa_post_text('referer');
    if (empty($inmessage)) {
        $errors['message'] = qa_lang('misc/feedback_empty');
    }
    if ($usecaptcha) {
        qa_captcha_validate($_POST, $errors);
    }
    if (empty($errors)) {
        $subs = array('^message' => $inmessage, '^name' => empty($inname) ? '-' : $inname, '^email' => empty($inemail) ? '-' : $inemail, '^previous' => empty($inreferer) ? '-' : $inreferer, '^url' => isset($qa_login_userid) ? qa_path('user/' . qa_get_logged_in_handle(), null, qa_opt('site_url')) : '-', '^ip' => qa_remote_ip_address(), '^browser' => @$_SERVER['HTTP_USER_AGENT']);
        if (qa_send_email(array('fromemail' => qa_email_validate(@$inemail) ? $inemail : qa_opt('from_email'), 'fromname' => $inname, 'toemail' => qa_opt('feedback_email'), 'toname' => qa_opt('site_title'), 'subject' => qa_lang_sub('emails/feedback_subject', qa_opt('site_title')), 'body' => strtr(qa_lang('emails/feedback_body'), $subs), 'html' => false))) {
            $feedbacksent = true;
        } else {
            $page_error = qa_lang_html('main/general_error');
        }
        qa_report_event('feedback', $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, array('email' => $inemail, 'name' => $inname, 'message' => $inmessage, 'previous' => $inreferer, 'browser' => @$_SERVER['HTTP_USER_AGENT']));
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/feedback_title');
$qa_content['error'] = @$page_error;
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')), 'tags' => 'NAME="message" ID="message"', 'value' => qa_html(@$inmessage), 'rows' => 8, 'error' => qa_html(@$errors['message'])), 'name' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_name'), 'tags' => 'NAME="name"', 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name'])), 'email' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_email'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'note' => $feedbacksent ? null : qa_opt('email_privacy'))), 'buttons' => array('send' => array('label' => qa_lang_html('main/send_button'))), 'hidden' => array('dofeedback' => '1', 'referer' => qa_html(isset($inreferer) ? $inreferer : @$_SERVER['HTTP_REFERER'])));
if ($usecaptcha && !$feedbacksent) {
    qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors);
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-feedback.php

示例13: qa_password_validate

function qa_password_validate($password, $olduser = null)
{
    $error = null;
    $filtermodules = qa_load_modules_with('filter', 'validate_password');
    foreach ($filtermodules as $filtermodule) {
        $error = $filtermodule->validate_password($password, $olduser);
        if (isset($error)) {
            break;
        }
    }
    if (!isset($error)) {
        $minpasslen = max(QA_MIN_PASSWORD_LEN, 1);
        if (qa_strlen($password) < $minpasslen) {
            $error = qa_lang_sub('users/password_min', $minpasslen);
        }
    }
    if (isset($error)) {
        return array('password' => $error);
    }
    return array();
}
开发者ID:robomartin,项目名称:Q2A-Mod-2,代码行数:21,代码来源:qa-app-users-edit.php

示例14: validate_length

 function validate_length(&$errors, $field, $input, $minlength, $maxlength)
 {
     if (isset($input)) {
         $length = qa_strlen($input);
         if ($length < $minlength) {
             $errors[$field] = $minlength == 1 ? qa_lang('main/field_required') : qa_lang_sub('main/min_length_x', $minlength);
         } elseif (isset($maxlength) && $length > $maxlength) {
             $errors[$field] = qa_lang_sub('main/max_length_x', $maxlength);
         }
     }
 }
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:11,代码来源:qa-filter-basic.php

示例15: qa_upload_file

function qa_upload_file($localfilename, $sourcefilename, $maxfilesize = null, $onlyimage = false, $imagemaxwidth = null, $imagemaxheight = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    $result = array();
    //	Check per-user upload limits
    require_once QA_INCLUDE_DIR . 'qa-app-users.php';
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    switch (qa_user_permit_error(null, QA_LIMIT_UPLOADS)) {
        case 'limit':
            $result['error'] = qa_lang('main/upload_limit');
            return $result;
        case false:
            qa_limits_increment(qa_get_logged_in_userid(), QA_LIMIT_UPLOADS);
            break;
        default:
            $result['error'] = qa_lang('users/no_permission');
            return $result;
    }
    //	Check the uploaded file is not too large
    $filesize = filesize($localfilename);
    if (isset($maxfilesize)) {
        $maxfilesize = min($maxfilesize, qa_get_max_upload_size());
    } else {
        $maxfilesize = qa_get_max_upload_size();
    }
    if ($filesize <= 0 || $filesize > $maxfilesize) {
        // if file was too big for PHP, $filesize will be zero
        $result['error'] = qa_lang_sub('main/max_upload_size_x', number_format($maxfilesize / 1048576, 1) . 'MB');
        return $result;
    }
    //	Find out what type of source file was uploaded and if appropriate, check it's an image and get preliminary size measure
    $pathinfo = pathinfo($sourcefilename);
    $format = strtolower(@$pathinfo['extension']);
    $isimage = $format == 'png' || $format == 'gif' || $format == 'jpeg' || $format == 'jpg';
    // allowed image extensions
    if ($isimage) {
        $imagesize = @getimagesize($localfilename);
        if (is_array($imagesize)) {
            $result['width'] = $imagesize[0];
            $result['height'] = $imagesize[1];
            switch ($imagesize['2']) {
                // reassign format based on actual content, if we can
                case IMAGETYPE_GIF:
                    $format = 'gif';
                    break;
                case IMAGETYPE_JPEG:
                    $format = 'jpeg';
                    break;
                case IMAGETYPE_PNG:
                    $format = 'png';
                    break;
            }
        }
    }
    $result['format'] = $format;
    if ($onlyimage) {
        if (!$isimage || !is_array($imagesize)) {
            $result['error'] = qa_lang_sub('main/image_not_read', 'GIF, JPG, PNG');
            return $result;
        }
    }
    //	Read in the raw file contents
    $content = file_get_contents($localfilename);
    //	If appropriate, get more accurate image size and apply constraints to it
    require_once QA_INCLUDE_DIR . 'qa-util-image.php';
    if ($isimage && qa_has_gd_image()) {
        $image = @imagecreatefromstring($content);
        if (is_resource($image)) {
            $result['width'] = $width = imagesx($image);
            $result['height'] = $height = imagesy($image);
            if (isset($imagemaxwidth) || isset($imagemaxheight)) {
                if (qa_image_constrain($width, $height, isset($imagemaxwidth) ? $imagemaxwidth : $width, isset($imagemaxheight) ? $imagemaxheight : $height)) {
                    qa_gd_image_resize($image, $width, $height);
                    if (is_resource($image)) {
                        $content = qa_gd_image_jpeg($image);
                        $result['format'] = $format = 'jpeg';
                        $result['width'] = $width;
                        $result['height'] = $height;
                    }
                }
            }
            if (is_resource($image)) {
                // might have been lost
                imagedestroy($image);
            }
        }
    }
    //	Create the blob and return
    require_once QA_INCLUDE_DIR . 'qa-app-blobs.php';
    $userid = qa_get_logged_in_userid();
    $cookieid = isset($userid) ? qa_cookie_get() : qa_cookie_get_create();
    $result['blobid'] = qa_create_blob($content, $format, $sourcefilename, $userid, $cookieid, qa_remote_ip_address());
    if (!isset($result['blobid'])) {
        $result['error'] = qa_lang('main/general_error');
        return $result;
    }
    $result['bloburl'] = qa_get_blob_url($result['blobid'], true);
//.........这里部分代码省略.........
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:101,代码来源:qa-app-upload.php


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