Commit b12de3f3 by Gideon Greenspan

1.5

parent afab146b
...@@ -250,7 +250,10 @@ function qa_form_params(formname) ...@@ -250,7 +250,10 @@ function qa_form_params(formname)
for (var i=0; i<es.length; i++) { for (var i=0; i<es.length; i++) {
var e=es[i]; var e=es[i];
params[e.name]=e.value; var t=(e.type || '').toLowerCase();
if ( ((t!='checkbox') && (t!='radio')) || e.checked)
params[e.name]=e.value;
} }
return params; return params;
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
Return a sorted array of available languages, [short code] => [long name] Return a sorted array of available languages, [short code] => [long name]
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$codetolanguage=array( // 2-letter language codes as per ISO 639-1 $codetolanguage=array( // 2-letter language codes as per ISO 639-1
'ar' => 'Arabic - العربية', 'ar' => 'Arabic - العربية',
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
Return a sorted array of available themes, [theme name] => [theme name] Return a sorted array of available themes, [theme name] => [theme name]
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$options=array(); $options=array();
...@@ -251,109 +251,109 @@ ...@@ -251,109 +251,109 @@
Return the sub navigation structure common to admin pages Return the sub navigation structure common to admin pages
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$navigation=array(); $navigation=array();
if (qa_get_logged_in_level()>=QA_USER_LEVEL_ADMIN) { if (qa_get_logged_in_level()>=QA_USER_LEVEL_ADMIN) {
$navigation['admin/general']=array( $navigation['admin/general']=array(
'label' => qa_lang('admin/general_title'), 'label' => qa_lang_html('admin/general_title'),
'url' => qa_path_html('admin/general'), 'url' => qa_path_html('admin/general'),
); );
$navigation['admin/emails']=array( $navigation['admin/emails']=array(
'label' => qa_lang('admin/emails_title'), 'label' => qa_lang_html('admin/emails_title'),
'url' => qa_path_html('admin/emails'), 'url' => qa_path_html('admin/emails'),
); );
$navigation['admin/user']=array( $navigation['admin/user']=array(
'label' => qa_lang('admin/users_title'), 'label' => qa_lang_html('admin/users_title'),
'url' => qa_path_html('admin/users'), 'url' => qa_path_html('admin/users'),
); );
$navigation['admin/layout']=array( $navigation['admin/layout']=array(
'label' => qa_lang('admin/layout_title'), 'label' => qa_lang_html('admin/layout_title'),
'url' => qa_path_html('admin/layout'), 'url' => qa_path_html('admin/layout'),
); );
$navigation['admin/posting']=array( $navigation['admin/posting']=array(
'label' => qa_lang('admin/posting_title'), 'label' => qa_lang_html('admin/posting_title'),
'url' => qa_path_html('admin/posting'), 'url' => qa_path_html('admin/posting'),
); );
$navigation['admin/viewing']=array( $navigation['admin/viewing']=array(
'label' => qa_lang('admin/viewing_title'), 'label' => qa_lang_html('admin/viewing_title'),
'url' => qa_path_html('admin/viewing'), 'url' => qa_path_html('admin/viewing'),
); );
$navigation['admin/lists']=array( $navigation['admin/lists']=array(
'label' => qa_lang('admin/lists_title'), 'label' => qa_lang_html('admin/lists_title'),
'url' => qa_path_html('admin/lists'), 'url' => qa_path_html('admin/lists'),
); );
if (qa_using_categories()) if (qa_using_categories())
$navigation['admin/categories']=array( $navigation['admin/categories']=array(
'label' => qa_lang('admin/categories_title'), 'label' => qa_lang_html('admin/categories_title'),
'url' => qa_path_html('admin/categories'), 'url' => qa_path_html('admin/categories'),
); );
$navigation['admin/permissions']=array( $navigation['admin/permissions']=array(
'label' => qa_lang('admin/permissions_title'), 'label' => qa_lang_html('admin/permissions_title'),
'url' => qa_path_html('admin/permissions'), 'url' => qa_path_html('admin/permissions'),
); );
$navigation['admin/pages']=array( $navigation['admin/pages']=array(
'label' => qa_lang('admin/pages_title'), 'label' => qa_lang_html('admin/pages_title'),
'url' => qa_path_html('admin/pages'), 'url' => qa_path_html('admin/pages'),
); );
$navigation['admin/feeds']=array( $navigation['admin/feeds']=array(
'label' => qa_lang('admin/feeds_title'), 'label' => qa_lang_html('admin/feeds_title'),
'url' => qa_path_html('admin/feeds'), 'url' => qa_path_html('admin/feeds'),
); );
$navigation['admin/points']=array( $navigation['admin/points']=array(
'label' => qa_lang('admin/points_title'), 'label' => qa_lang_html('admin/points_title'),
'url' => qa_path_html('admin/points'), 'url' => qa_path_html('admin/points'),
); );
$navigation['admin/spam']=array( $navigation['admin/spam']=array(
'label' => qa_lang('admin/spam_title'), 'label' => qa_lang_html('admin/spam_title'),
'url' => qa_path_html('admin/spam'), 'url' => qa_path_html('admin/spam'),
); );
$navigation['admin/stats']=array( $navigation['admin/stats']=array(
'label' => qa_lang('admin/stats_title'), 'label' => qa_lang_html('admin/stats_title'),
'url' => qa_path_html('admin/stats'), 'url' => qa_path_html('admin/stats'),
); );
if (!QA_FINAL_EXTERNAL_USERS) if (!QA_FINAL_EXTERNAL_USERS)
$navigation['admin/mailing']=array( $navigation['admin/mailing']=array(
'label' => qa_lang('admin/mailing_title'), 'label' => qa_lang_html('admin/mailing_title'),
'url' => qa_path_html('admin/mailing'), 'url' => qa_path_html('admin/mailing'),
); );
$navigation['admin/plugins']=array( $navigation['admin/plugins']=array(
'label' => qa_lang('admin/plugins_title'), 'label' => qa_lang_html('admin/plugins_title'),
'url' => qa_path_html('admin/plugins'), 'url' => qa_path_html('admin/plugins'),
); );
} }
if (!qa_user_permit_error('permit_moderate')) if (!qa_user_permit_error('permit_moderate'))
$navigation['admin/moderate']=array( $navigation['admin/moderate']=array(
'label' => qa_lang('admin/moderate_title'), 'label' => qa_lang_html('admin/moderate_title'),
'url' => qa_path_html('admin/moderate'), 'url' => qa_path_html('admin/moderate'),
); );
if (qa_opt('flagging_of_posts') && !qa_user_permit_error('permit_hide_show')) if (qa_opt('flagging_of_posts') && !qa_user_permit_error('permit_hide_show'))
$navigation['admin/flagged']=array( $navigation['admin/flagged']=array(
'label' => qa_lang('admin/flagged_title'), 'label' => qa_lang_html('admin/flagged_title'),
'url' => qa_path_html('admin/flagged'), 'url' => qa_path_html('admin/flagged'),
); );
if ( (!qa_user_permit_error('permit_hide_show')) || (!qa_user_permit_error('permit_delete_hidden')) ) if ( (!qa_user_permit_error('permit_hide_show')) || (!qa_user_permit_error('permit_delete_hidden')) )
$navigation['admin/hidden']=array( $navigation['admin/hidden']=array(
'label' => qa_lang('admin/hidden_title'), 'label' => qa_lang_html('admin/hidden_title'),
'url' => qa_path_html('admin/hidden'), 'url' => qa_path_html('admin/hidden'),
); );
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
Return the URL which will output $blobid from the database when requested, $absolute or relative Return the URL which will output $blobid from the database when requested, $absolute or relative
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return qa_path('blob', array('qa_blobid' => $blobid), $absolute ? qa_opt('site_url') : null, QA_URL_FORMAT_PARAMS); return qa_path('blob', array('qa_blobid' => $blobid), $absolute ? qa_opt('site_url') : null, QA_URL_FORMAT_PARAMS);
} }
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
Return the maximum size of file that can be uploaded, based on database and PHP limits Return the maximum size of file that can be uploaded, based on database and PHP limits
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$mindb=16777215; // from MEDIUMBLOB column type $mindb=16777215; // from MEDIUMBLOB column type
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
Return the user identification cookie sent by the browser for this page request, or null if none Return the user identification cookie sent by the browser for this page request, or null if none
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return isset($_COOKIE['qa_id']) ? qa_gpc_to_string($_COOKIE['qa_id']) : null; return isset($_COOKIE['qa_id']) ? qa_gpc_to_string($_COOKIE['qa_id']) : null;
} }
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
Either way, extend for another year (this is used when an anonymous post is created) Either way, extend for another year (this is used when an anonymous post is created)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-cookies.php'; require_once QA_INCLUDE_DIR.'qa-db-cookies.php';
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
corresponding value, plus applying some standard substitutions such as ^site_title, ^handle and ^email. corresponding value, plus applying some standard substitutions such as ^site_title, ^handle and ^email.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_notifications_suspended; global $qa_notifications_suspended;
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
fromname, toemail, toname, subject, body, html fromname, toemail, toname, subject, body, html
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-class.phpmailer.php'; require_once QA_INCLUDE_DIR.'qa-class.phpmailer.php';
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
Return textual representation of $seconds Return textual representation of $seconds
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$seconds=max($seconds, 1); $seconds=max($seconds, 1);
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
Convert textual $tag to HTML representation Convert textual $tag to HTML representation
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return '<A HREF="'.qa_path_html('tag/'.$tag).'"'.($microformats ? ' rel="tag"' : '').' CLASS="qa-tag-link">'.qa_html($tag).'</A>'; return '<A HREF="'.qa_path_html('tag/'.$tag).'"'.($microformats ? ' rel="tag"' : '').' CLASS="qa-tag-link">'.qa_html($tag).'</A>';
} }
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
Return HTML to use for $ip address, which links to appropriate page with $anchorhtml Return HTML to use for $ip address, which links to appropriate page with $anchorhtml
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (!strlen($anchorhtml)) if (!strlen($anchorhtml))
$anchorhtml=qa_html($ip); $anchorhtml=qa_html($ip);
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
If something is missing from $post (e.g. ['content']), correponding HTML also omitted. If something is missing from $post (e.g. ['content']), correponding HTML also omitted.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-updates.php'; require_once QA_INCLUDE_DIR.'qa-app-updates.php';
...@@ -532,7 +532,7 @@ ...@@ -532,7 +532,7 @@
Return array of split HTML (prefix, data, suffix) to represent author of post Return array of split HTML (prefix, data, suffix) to represent author of post
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (isset($postuserid) && isset($usershtml[$postuserid])) { if (isset($postuserid) && isset($usershtml[$postuserid])) {
$whohtml=$usershtml[$postuserid]; $whohtml=$usershtml[$postuserid];
...@@ -559,7 +559,7 @@ ...@@ -559,7 +559,7 @@
more than $fulldatedays ago more than $fulldatedays ago
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$interval=qa_opt('db_time')-$timestamp; $interval=qa_opt('db_time')-$timestamp;
...@@ -587,7 +587,7 @@ ...@@ -587,7 +587,7 @@
$userid, $cookieid, $usershtml, $options are passed through to qa_post_html_fields(). $userid, $cookieid, $usershtml, $options are passed through to qa_post_html_fields().
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-updates.php'; require_once QA_INCLUDE_DIR.'qa-app-updates.php';
...@@ -727,7 +727,7 @@ ...@@ -727,7 +727,7 @@
Return it sorted by the date appropriate for each element, without removing duplicate references to the same question. Return it sorted by the date appropriate for each element, without removing duplicate references to the same question.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-sort.php'; require_once QA_INCLUDE_DIR.'qa-util-sort.php';
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
Return it sorted by the date appropriate for each element, and keep only the first item related to each question. Return it sorted by the date appropriate for each element, and keep only the first item related to each question.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-sort.php'; require_once QA_INCLUDE_DIR.'qa-util-sort.php';
...@@ -818,7 +818,7 @@ ...@@ -818,7 +818,7 @@
So this is something quick and dirty that should do the trick in most cases So this is something quick and dirty that should do the trick in most cases
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return trim(preg_replace('/([^A-Za-z0-9])((http|https|ftp):\/\/([^\s&<>"\'\.])+\.([^\s&<>"\']|&amp;)+)/i', '\1<A HREF="\2" rel="nofollow"'.($newwindow ? ' target="_blank"' : '').'>\2</A>', ' '.$html.' ')); return trim(preg_replace('/([^A-Za-z0-9])((http|https|ftp):\/\/([^\s&<>"\'\.])+\.([^\s&<>"\']|&amp;)+)/i', '\1<A HREF="\2" rel="nofollow"'.($newwindow ? ' target="_blank"' : '').'>\2</A>', ' '.$html.' '));
} }
...@@ -829,7 +829,7 @@ ...@@ -829,7 +829,7 @@
Return HTML representation of $url (if it appears to be an URL), linked with nofollow and in a new window if $newwindow Return HTML representation of $url (if it appears to be an URL), linked with nofollow and in a new window if $newwindow
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (is_numeric(strpos($url, '.'))) { if (is_numeric(strpos($url, '.'))) {
$linkurl=$url; $linkurl=$url;
...@@ -876,7 +876,7 @@ ...@@ -876,7 +876,7 @@
Show links to $prevnext pages before and after this one and include $params in the URLs. Show links to $prevnext pages before and after this one and include $params in the URLs.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$thispage=1+floor($start/$pagesize); $thispage=1+floor($start/$pagesize);
$lastpage=ceil(min($count, 1+QA_MAX_LIMIT_START)/$pagesize); $lastpage=ceil(min($count, 1+QA_MAX_LIMIT_START)/$pagesize);
...@@ -934,7 +934,7 @@ ...@@ -934,7 +934,7 @@
it's not null) and also popular tags if $usingtags is true it's not null) and also popular tags if $usingtags is true
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$hascategory=strlen($categoryrequest); $hascategory=strlen($categoryrequest);
...@@ -959,7 +959,7 @@ ...@@ -959,7 +959,7 @@
Return HTML that suggest getting things started by asking a question, in $categoryid if not null Return HTML that suggest getting things started by asking a question, in $categoryid if not null
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$htmlmessage=qa_lang_html('main/suggest_ask'); $htmlmessage=qa_lang_html('main/suggest_ask');
...@@ -980,7 +980,7 @@ ...@@ -980,7 +980,7 @@
and links beginning with $pathprefix, and showing question counts if $showqcount and links beginning with $pathprefix, and showing question counts if $showqcount
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$parentcategories=array(); $parentcategories=array();
...@@ -998,7 +998,7 @@ ...@@ -998,7 +998,7 @@
Recursion function used by qa_category_navigation(...) to build hierarchical category menu. Recursion function used by qa_category_navigation(...) to build hierarchical category menu.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$navigation=array(); $navigation=array();
...@@ -1382,7 +1382,7 @@ ...@@ -1382,7 +1382,7 @@
Return the theme that should be used for displaying the page Return the theme that should be used for displaying the page
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return qa_opt(qa_is_mobile_probably() ? 'site_theme_mobile' : 'site_theme'); return qa_opt(qa_is_mobile_probably() ? 'site_theme_mobile' : 'site_theme');
} }
...@@ -1394,7 +1394,7 @@ ...@@ -1394,7 +1394,7 @@
Also applies any registered plugin layers. Also applies any registered plugin layers.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_layers; global $qa_layers;
...@@ -1602,7 +1602,7 @@ ...@@ -1602,7 +1602,7 @@
Constrain the image to $size (width AND height) and pad it to that size if $padding is true Constrain the image to $size (width AND height) and pad it to that size if $padding is true
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-image.php'; require_once QA_INCLUDE_DIR.'qa-util-image.php';
...@@ -1632,7 +1632,7 @@ ...@@ -1632,7 +1632,7 @@
Return the <IMG...> HTML to display the Gravatar for $email, constrained to $size Return the <IMG...> HTML to display the Gravatar for $email, constrained to $size
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if ($size>0) if ($size>0)
return '<IMG SRC="http://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.(int)$size. return '<IMG SRC="http://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.(int)$size.
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
where $action is one of the QA_LIMIT_* constants defined above. where $action is one of the QA_LIMIT_* constants defined above.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
require_once QA_INCLUDE_DIR.'qa-db-limits.php'; require_once QA_INCLUDE_DIR.'qa-db-limits.php';
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
Return whether the requesting IP address has been blocked from write operations Return whether the requesting IP address has been blocked from write operations
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$blockipclauses=qa_block_ips_explode(qa_opt('block_ips_write')); $blockipclauses=qa_block_ips_explode(qa_opt('block_ips_write'));
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
where $action is one of the QA_LIMIT_* constants defined above. where $action is one of the QA_LIMIT_* constants defined above.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-limits.php'; require_once QA_INCLUDE_DIR.'qa-db-limits.php';
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
Load the options from the $results of the database selectspecs defined in qa_preload_options() Load the options from the $results of the database selectspecs defined in qa_preload_options()
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_options_cache, $qa_options_loaded; global $qa_options_cache, $qa_options_loaded;
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
$todatabase=false, in which case set it in the cache only $todatabase=false, in which case set it in the cache only
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_options_cache; global $qa_options_cache;
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
Reset the options in $names to their defaults Reset the options in $names to their defaults
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
foreach ($names as $name) foreach ($names as $name)
qa_set_option($name, qa_default_option($name)); qa_set_option($name, qa_default_option($name));
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
Return the default value for option $name Return the default value for option $name
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$fixed_defaults=array( $fixed_defaults=array(
'allow_change_usernames' => 1, 'allow_change_usernames' => 1,
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
break; break;
case 'custom_sidebar': case 'custom_sidebar':
$value=qa_lang_sub('options/default_sidebar', qa_html(qa_opt('site_title'))); $value=qa_lang_html_sub('options/default_sidebar', qa_html(qa_opt('site_title')));
break; break;
case 'editor_for_qs': case 'editor_for_qs':
...@@ -513,7 +513,7 @@ ...@@ -513,7 +513,7 @@
Return an array of defaults for the $options parameter passed to qa_post_html_fields() and its ilk Return an array of defaults for the $options parameter passed to qa_post_html_fields() and its ilk
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
...@@ -549,7 +549,7 @@ ...@@ -549,7 +549,7 @@
with buttons enabled if appropriate (based on whether $full post shown) unless $enabledif is false. with buttons enabled if appropriate (based on whether $full post shown) unless $enabledif is false.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$disabledsuffix=''; $disabledsuffix='';
...@@ -612,7 +612,7 @@ ...@@ -612,7 +612,7 @@
Return the regular expression fragment to match the blocked words options set in the database Return the regular expression fragment to match the blocked words options set in the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_blockwordspreg, $qa_blockwordspreg_set; global $qa_blockwordspreg, $qa_blockwordspreg_set;
...@@ -667,7 +667,7 @@ ...@@ -667,7 +667,7 @@
Return an array of relevant permissions settings, based on other options Return an array of relevant permissions settings, based on other options
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$permits=array('permit_view_q_page', 'permit_post_q', 'permit_post_a'); $permits=array('permit_view_q_page', 'permit_post_q', 'permit_post_a');
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-format.php'; require_once QA_INCLUDE_DIR.'qa-app-format.php';
require_once QA_INCLUDE_DIR.'qa-app-updates.php'; require_once QA_INCLUDE_DIR.'qa-app-updates.php';
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
} }
} }
qa_fatal_error('Could not create a valid and unique handle'); qa_fatal_error('Could not create a valid and unique handle from: '.$handle);
} }
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
Handles user points, notification and optional email confirmation. Handles user points, notification and optional email confirmation.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
require_once QA_INCLUDE_DIR.'qa-db-points.php'; require_once QA_INCLUDE_DIR.'qa-db-points.php';
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
Handles recalculations of votes and flags for posts this user has affected. Handles recalculations of votes and flags for posts this user has affected.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-votes.php'; require_once QA_INCLUDE_DIR.'qa-db-votes.php';
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
Set a new email confirmation code for the user and send it out Set a new email confirmation code for the user and send it out
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
Set a new email confirmation code for the user and return the corresponding link Set a new email confirmation code for the user and return the corresponding link
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
Complete the email confirmation process for the user Complete the email confirmation process for the user
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
require_once QA_INCLUDE_DIR.'qa-app-cookies.php'; require_once QA_INCLUDE_DIR.'qa-app-cookies.php';
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
Start the 'I forgot my password' process for $userid, sending reset code Start the 'I forgot my password' process for $userid, sending reset code
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
Successfully finish the 'I forgot my password' process for $userid, sending new password Successfully finish the 'I forgot my password' process for $userid, sending new password
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
...@@ -358,7 +358,7 @@ ...@@ -358,7 +358,7 @@
Set the avatar of $userid to the image in $imagedata, and remove $oldblobid from the database if not null Set the avatar of $userid to the image in $imagedata, and remove $oldblobid from the database if not null
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-image.php'; require_once QA_INCLUDE_DIR.'qa-util-image.php';
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
Open a PHP session if one isn't opened already Open a PHP session if one isn't opened already
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
@ini_set('session.gc_maxlifetime', 86400); // worth a try, but won't help in shared hosting environment @ini_set('session.gc_maxlifetime', 86400); // worth a try, but won't help in shared hosting environment
@ini_set('session.use_trans_sid', false); // sessions need cookies to work, since we redirect after login @ini_set('session.use_trans_sid', false); // sessions need cookies to work, since we redirect after login
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
Returns a suffix to be used for names of session variables to prevent them being shared between multiple Q2A sites on the same server Returns a suffix to be used for names of session variables to prevent them being shared between multiple Q2A sites on the same server
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return md5(QA_FINAL_MYSQL_HOSTNAME.'/'.QA_FINAL_MYSQL_USERNAME.'/'.QA_FINAL_MYSQL_PASSWORD.'/'.QA_FINAL_MYSQL_DATABASE.'/'.QA_MYSQL_TABLE_PREFIX); return md5(QA_FINAL_MYSQL_HOSTNAME.'/'.QA_FINAL_MYSQL_USERNAME.'/'.QA_FINAL_MYSQL_PASSWORD.'/'.QA_FINAL_MYSQL_DATABASE.'/'.QA_MYSQL_TABLE_PREFIX);
} }
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
Returns a verification code used to ensure that a user session can't be generated by another PHP script running on the same server Returns a verification code used to ensure that a user session can't be generated by another PHP script running on the same server
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return sha1($userid.'/'.QA_MYSQL_TABLE_PREFIX.'/'.QA_FINAL_MYSQL_DATABASE.'/'.QA_FINAL_MYSQL_PASSWORD.'/'.QA_FINAL_MYSQL_USERNAME.'/'.QA_FINAL_MYSQL_HOSTNAME); return sha1($userid.'/'.QA_MYSQL_TABLE_PREFIX.'/'.QA_FINAL_MYSQL_DATABASE.'/'.QA_FINAL_MYSQL_PASSWORD.'/'.QA_FINAL_MYSQL_USERNAME.'/'.QA_FINAL_MYSQL_HOSTNAME);
} }
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
Pass true if user checked 'Remember me' (either now or previously, as learned from cookie). Pass true if user checked 'Remember me' (either now or previously, as learned from cookie).
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
// if $remember is true, store in browser for a month, otherwise store only until browser is closed // if $remember is true, store in browser for a month, otherwise store only until browser is closed
setcookie('qa_session', $handle.'/'.$sessioncode.'/'.($remember ? 1 : 0), $remember ? (time()+2592000) : 0, '/', QA_COOKIE_DOMAIN); setcookie('qa_session', $handle.'/'.$sessioncode.'/'.($remember ? 1 : 0), $remember ? (time()+2592000) : 0, '/', QA_COOKIE_DOMAIN);
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
Remove session cookie from browser Remove session cookie from browser
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
setcookie('qa_session', false, 0, '/', QA_COOKIE_DOMAIN); setcookie('qa_session', false, 0, '/', QA_COOKIE_DOMAIN);
} }
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
Set the session variables to indicate that $userid is logged in from $source Set the session variables to indicate that $userid is logged in from $source
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$suffix=qa_session_var_suffix(); $suffix=qa_session_var_suffix();
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
Clear the session variables indicating that a user is logged in Clear the session variables indicating that a user is logged in
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$suffix=qa_session_var_suffix(); $suffix=qa_session_var_suffix();
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
$remember states if 'Remember me' was checked in the login form. $remember states if 'Remember me' was checked in the login form.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-cookies.php'; require_once QA_INCLUDE_DIR.'qa-app-cookies.php';
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
A new user is created based on $fields if it's a new combination of $source and $identifier A new user is created based on $fields if it's a new combination of $source and $identifier
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
Return the userid of the currently logged in user, or null if none logged in Return the userid of the currently logged in user, or null if none logged in
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_logged_in_userid_checked; global $qa_logged_in_userid_checked;
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
Get the source of the currently logged in user, from call to qa_log_in_external_user() or null if logged in normally Get the source of the currently logged in user, from call to qa_log_in_external_user() or null if logged in normally
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
$suffix=qa_session_var_suffix(); $suffix=qa_session_var_suffix();
...@@ -381,7 +381,7 @@ ...@@ -381,7 +381,7 @@
Return $field of the currently logged in user, cache to ensure only one call to external code Return $field of the currently logged in user, cache to ensure only one call to external code
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_cached_logged_in_user; global $qa_cached_logged_in_user;
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
Return the number of points of the currently logged in user, or null if none is logged in Return the number of points of the currently logged in user, or null if none is logged in
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return qa_get_logged_in_user_field('points'); return qa_get_logged_in_user_field('points');
} }
...@@ -427,7 +427,7 @@ ...@@ -427,7 +427,7 @@
Return HTML to display for user with username $handle Return HTML to display for user with username $handle
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return strlen($handle) ? ('<A HREF="'.qa_path_html('user/'.$handle). return strlen($handle) ? ('<A HREF="'.qa_path_html('user/'.$handle).
'" CLASS="qa-user-link'.($microformats ? ' url nickname' : '').'">'.qa_html($handle).'</A>') : ''; '" CLASS="qa-user-link'.($microformats ? ' url nickname' : '').'">'.qa_html($handle).'</A>') : '';
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
Pass the user's fields $flags, $email, $handle, and avatar $blobid, $width and $height Pass the user's fields $flags, $email, $handle, and avatar $blobid, $width and $height
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-format.php'; require_once QA_INCLUDE_DIR.'qa-app-format.php';
...@@ -473,7 +473,7 @@ ...@@ -473,7 +473,7 @@
Called after a database write $action performed by a user $userid Called after a database write $action performed by a user $userid
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
...@@ -486,7 +486,7 @@ ...@@ -486,7 +486,7 @@
Return textual representation of the user $level Return textual representation of the user $level
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if ($level>=QA_USER_LEVEL_SUPER) if ($level>=QA_USER_LEVEL_SUPER)
$string='users/level_super'; $string='users/level_super';
...@@ -640,7 +640,7 @@ ...@@ -640,7 +640,7 @@
false => the operation can go ahead false => the operation can go ahead
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
...@@ -670,7 +670,7 @@ ...@@ -670,7 +670,7 @@
If $userid is currently logged in, you can set $userpoints=null to retrieve them only if necessary. If $userid is currently logged in, you can set $userpoints=null to retrieve them only if necessary.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$permit=isset($permitoption) ? qa_opt($permitoption) : QA_PERMIT_ALL; $permit=isset($permitoption) ? qa_opt($permitoption) : QA_PERMIT_ALL;
...@@ -694,7 +694,7 @@ ...@@ -694,7 +694,7 @@
(generally retrieved from an option, but not always). Result as for qa_user_permit_error(...). (generally retrieved from an option, but not always). Result as for qa_user_permit_error(...).
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if ($permit>=QA_PERMIT_ALL) if ($permit>=QA_PERMIT_ALL)
$error=false; $error=false;
...@@ -744,7 +744,7 @@ ...@@ -744,7 +744,7 @@
Return whether a captcha should be presented to the current user for writing posts Return whether a captcha should be presented to the current user for writing posts
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$usecaptcha=false; $usecaptcha=false;
...@@ -770,7 +770,7 @@ ...@@ -770,7 +770,7 @@
false => moderation is not required false => moderation is not required
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$reason=false; $reason=false;
...@@ -779,13 +779,15 @@ ...@@ -779,13 +779,15 @@
qa_user_permit_error('permit_moderate') // if the user can approve posts, no point in moderating theirs qa_user_permit_error('permit_moderate') // if the user can approve posts, no point in moderating theirs
) { ) {
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
if (qa_opt('moderate_anon_post') && !isset($userid)) if (isset($userid)) {
if (qa_opt('confirm_user_emails') && qa_opt('moderate_unconfirmed') && !(qa_get_logged_in_flags() & QA_USER_FLAGS_EMAIL_CONFIRMED) )
$reason='confirm';
elseif (qa_opt('moderate_by_points') && (qa_get_logged_in_points() < qa_opt('moderate_points_limit')))
$reason='points';
} elseif (qa_opt('moderate_anon_post'))
$reason='login'; $reason='login';
elseif (qa_opt('confirm_user_emails') && qa_opt('moderate_unconfirmed') && !(qa_get_logged_in_flags() & QA_USER_FLAGS_EMAIL_CONFIRMED) )
$reason='confirm';
elseif (qa_opt('moderate_by_points') && (qa_get_logged_in_points() < qa_opt('moderate_points_limit')))
$reason='points';
} }
return $reason; return $reason;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
Return an HTML error to display if there was a problem, or false if it's OK. Return an HTML error to display if there was a problem, or false if it's OK.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
Handles user points, recounting and event reports as appropriate. Handles user points, recounting and event reports as appropriate.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-points.php'; require_once QA_INCLUDE_DIR.'qa-db-points.php';
require_once QA_INCLUDE_DIR.'qa-db-hotness.php'; require_once QA_INCLUDE_DIR.'qa-db-hotness.php';
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
Return an HTML error to display if there was a problem, or false if it's OK. Return an HTML error to display if there was a problem, or false if it's OK.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
Returns true if the post should now be hidden because it has accumulated enough flags. Returns true if the post should now be hidden because it has accumulated enough flags.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-votes.php'; require_once QA_INCLUDE_DIR.'qa-db-votes.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
Handles recounting and event reports as appropriate. Handles recounting and event reports as appropriate.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-votes.php'; require_once QA_INCLUDE_DIR.'qa-db-votes.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
Handles recounting and event reports as appropriate. Handles recounting and event reports as appropriate.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-votes.php'; require_once QA_INCLUDE_DIR.'qa-db-votes.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
Create a new blob in the database with $content and $format, returning its blobid Create a new blob in the database with $content and $format, returning its blobid
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
for ($attempt=0; $attempt<10; $attempt++) { for ($attempt=0; $attempt<10; $attempt++) {
$blobid=qa_db_random_bigint(); $blobid=qa_db_random_bigint();
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
Get the content of blob $blobid from the database Get the content of blob $blobid from the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return qa_db_read_one_assoc(qa_db_query_sub( return qa_db_read_one_assoc(qa_db_query_sub(
'SELECT content, format, filename FROM ^blobs WHERE blobid=#', 'SELECT content, format, filename FROM ^blobs WHERE blobid=#',
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
Delete blob $blobid in the database Delete blob $blobid in the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
qa_db_query_sub( qa_db_query_sub(
'DELETE FROM ^blobs WHERE blobid=#', 'DELETE FROM ^blobs WHERE blobid=#',
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
Check if blob $blobid exists in the database Check if blob $blobid exists in the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return qa_db_read_one_value(qa_db_query_sub( return qa_db_read_one_value(qa_db_query_sub(
'SELECT COUNT(*) FROM ^blobs WHERE blobid=#', 'SELECT COUNT(*) FROM ^blobs WHERE blobid=#',
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
Create (or replace) the item ($type, $cacheid) in the database cache table with $content Create (or replace) the item ($type, $cacheid) in the database cache table with $content
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
qa_db_query_sub( qa_db_query_sub(
'DELETE FROM ^cache WHERE lastread<NOW()-INTERVAL # SECOND', 'DELETE FROM ^cache WHERE lastread<NOW()-INTERVAL # SECOND',
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
Retrieve the item ($type, $cacheid) from the database cache table Retrieve the item ($type, $cacheid) from the database cache table
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$content=qa_db_read_one_value(qa_db_query_sub( $content=qa_db_read_one_value(qa_db_query_sub(
'SELECT content FROM ^cache WHERE type=$ AND cacheid=#', 'SELECT content FROM ^cache WHERE type=$ AND cacheid=#',
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
If $viewincrement is true, also increment the views counter for the post, and include that in the hotness calculation If $viewincrement is true, also increment the views counter for the post, and include that in the hotness calculation
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (qa_should_update_counts()) { if (qa_should_update_counts()) {
if (!isset($lastpostid)) if (!isset($lastpostid))
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
and the value is an array of column definitions, [column name] => [definition]. The column name is omitted for indexes. and the value is an array of column definitions, [column name] => [definition]. The column name is omitted for indexes.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-maxima.php'; require_once QA_INCLUDE_DIR.'qa-db-maxima.php';
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
Returns an array of option names required to perform calculations in userpoints table Returns an array of option names required to perform calculations in userpoints table
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return array( return array(
'points_post_q', 'points_select_a', 'points_per_q_voted_up', 'points_per_q_voted_down', 'points_q_voted_max_gain', 'points_q_voted_max_loss', 'points_post_q', 'points_select_a', 'points_per_q_voted_up', 'points_per_q_voted_down', 'points_q_voted_max_gain', 'points_q_voted_max_loss',
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
The element 'multiple' specifies what to multiply each column by to create the final sum in the points column. The element 'multiple' specifies what to multiply each column by to create the final sum in the points column.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
This dynamically builds some fairly crazy looking SQL, but it works, and saves repeat calculations. This dynamically builds some fairly crazy looking SQL, but it works, and saves repeat calculations.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (qa_should_update_counts() && isset($userid)) { if (qa_should_update_counts() && isset($userid)) {
require_once QA_INCLUDE_DIR.'qa-app-options.php'; require_once QA_INCLUDE_DIR.'qa-app-options.php';
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
If $user is true, get information about the user who wrote the post (or cookie if anonymous). If $user is true, get information about the user who wrote the post (or cookie if anonymous).
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$selectspec=array( $selectspec=array(
'columns' => array( 'columns' => array(
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
Return the expected value for the passcheck column given the $password and password $salt Return the expected value for the passcheck column given the $password and password $salt
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return sha1(substr($salt, 0, 8).$password.substr($salt, 8)); return sha1(substr($salt, 0, 8).$password.substr($salt, 8));
} }
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
Set the password of $userid to $password, and reset their salt at the same time Set the password of $userid to $password, and reset their salt at the same time
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
Return a random string to be used for a user's emailcode column Return a random string to be used for a user's emailcode column
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
Return a random string to be used for a user's sessioncode column (for browser session cookies) Return a random string to be used for a user's sessioncode column (for browser session cookies)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
(before this point, some plugins may not have had a chance to override some database access functions) (before this point, some plugins may not have had a chance to override some database access functions)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_db_allow_connect; global $qa_db_allow_connect;
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
Connect to the Q2A database, select the right database, optionally install the $failhandler (and call it if necessary) Connect to the Q2A database, select the right database, optionally install the $failhandler (and call it if necessary)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_db_connection, $qa_db_fail_handler, $qa_db_allow_connect; global $qa_db_connection, $qa_db_fail_handler, $qa_db_allow_connect;
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
If a DB error occurs, call the installed fail handler (if any) otherwise report error and exit immediately If a DB error occurs, call the installed fail handler (if any) otherwise report error and exit immediately
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_db_fail_handler; global $qa_db_fail_handler;
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
Return the current connection to the Q2A database, connecting if necessary and $connect is true Return the current connection to the Q2A database, connecting if necessary and $connect is true
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_db_connection; global $qa_db_connection;
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
Disconnect from the Q2A database Disconnect from the Q2A database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_db_connection; global $qa_db_connection;
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
If appropriate, also track the resources used by database queries, and the queries themselves, for performance debugging. If appropriate, also track the resources used by database queries, and the queries themselves, for performance debugging.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (QA_DEBUG_PERFORMANCE) { if (QA_DEBUG_PERFORMANCE) {
global $qa_database_usage, $qa_database_queries; global $qa_database_usage, $qa_database_queries;
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
Lower-level function to execute a query, which automatically retries if there is a MySQL deadlock error Lower-level function to execute a query, which automatically retries if there is a MySQL deadlock error
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$db=qa_db_connection(); $db=qa_db_connection();
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
Return $string escaped for use in queries to the Q2A database (to which a connection must have been made) Return $string escaped for use in queries to the Q2A database (to which a connection must have been made)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return mysql_real_escape_string($string, qa_db_connection()); return mysql_real_escape_string($string, qa_db_connection());
} }
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
Return the full name (with prefix) of database table $rawname, usually if it used after a ^ symbol Return the full name (with prefix) of database table $rawname, usually if it used after a ^ symbol
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$prefix=QA_MYSQL_TABLE_PREFIX; $prefix=QA_MYSQL_TABLE_PREFIX;
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
function qa_index_set_request() function qa_index_set_request()
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$relativedepth=0; $relativedepth=0;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
return array( return array(
'allow_change_usernames' => 'Allow users with posts to change their username:', 'allow_change_usernames' => 'Allow users with posts to change their username:',
'allow_close_questions' => 'Allow questions to be manually closed:', 'allow_close_questions' => 'Allow questions to be manually closed:',
'allow_login_email_only' => 'Only log in by email address (not username):',
'allow_multi_answers' => 'Allow multiple answers per user:', 'allow_multi_answers' => 'Allow multiple answers per user:',
'allow_no_category' => 'Allow questions with no category', 'allow_no_category' => 'Allow questions with no category',
'allow_no_sub_category' => 'Allow questions with a category but no sub-category', 'allow_no_sub_category' => 'Allow questions with a category but no sub-category',
......
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
'allow_change_usernames' => 'checkbox', 'allow_change_usernames' => 'checkbox',
'allow_close_questions' => 'checkbox', 'allow_close_questions' => 'checkbox',
'allow_login_email_only' => 'checkbox',
'allow_multi_answers' => 'checkbox', 'allow_multi_answers' => 'checkbox',
'allow_private_messages' => 'checkbox', 'allow_private_messages' => 'checkbox',
'allow_self_answer' => 'checkbox', 'allow_self_answer' => 'checkbox',
...@@ -291,7 +292,7 @@ ...@@ -291,7 +292,7 @@
array_push($showoptions, 'show_custom_register', 'custom_register', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome'); array_push($showoptions, 'show_custom_register', 'custom_register', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome');
array_push($showoptions, '' ,'allow_change_usernames', 'allow_private_messages', 'show_message_history', '', 'avatar_allow_gravatar'); array_push($showoptions, '' ,'allow_login_email_only', 'allow_change_usernames', 'allow_private_messages', 'show_message_history', '', 'avatar_allow_gravatar');
if (qa_has_gd_image()) if (qa_has_gd_image())
array_push($showoptions, 'avatar_allow_upload', 'avatar_store_size', 'avatar_default_show'); array_push($showoptions, 'avatar_allow_upload', 'avatar_store_size', 'avatar_default_show');
......
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
$qa_content['q_list']=array( $qa_content['q_list']=array(
'title' => count($questions) ? qa_lang_html('main/nav_qs') : qa_lang_html('misc/no_favorite_qs'), 'title' => count($questions) ? qa_lang_html('main/nav_qs') : qa_lang_html('misc/no_favorite_qs'),
'qs' => array(),
); );
if (count($questions)) { if (count($questions)) {
...@@ -71,8 +73,6 @@ ...@@ -71,8 +73,6 @@
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"',
); );
$qa_content['q_list']['qs']=array();
$options=qa_post_html_defaults('Q'); $options=qa_post_html_defaults('Q');
foreach ($questions as $question) foreach ($questions as $question)
......
...@@ -51,10 +51,14 @@ ...@@ -51,10 +51,14 @@
$errors=array(); $errors=array();
if (strpos($inemailhandle, '@')===false) // handles can't contain @ symbols if (strpos($inemailhandle, '@')===false) { // handles can't contain @ symbols
$matchusers=qa_db_user_find_by_handle($inemailhandle); $matchusers=qa_db_user_find_by_handle($inemailhandle);
else $passemailhandle=!qa_opt('allow_login_email_only');
} else {
$matchusers=qa_db_user_find_by_email($inemailhandle); $matchusers=qa_db_user_find_by_email($inemailhandle);
$passemailhandle=true;
}
if (count($matchusers)!=1) // if we get more than one match (should be impossible) also give an error if (count($matchusers)!=1) // if we get more than one match (should be impossible) also give an error
$errors['emailhandle']=qa_lang('users/user_not_found'); $errors['emailhandle']=qa_lang('users/user_not_found');
...@@ -65,7 +69,7 @@ ...@@ -65,7 +69,7 @@
if (empty($errors)) { if (empty($errors)) {
$inuserid=$matchusers[0]; $inuserid=$matchusers[0];
qa_start_reset_user($inuserid); qa_start_reset_user($inuserid);
qa_redirect('reset', array('e' => $inemailhandle)); // redirect to page where code is entered qa_redirect('reset', $passemailhandle ? array('e' => $inemailhandle) : null); // redirect to page where code is entered
} }
......
...@@ -58,10 +58,10 @@ ...@@ -58,10 +58,10 @@
$errors=array(); $errors=array();
if (strpos($inemailhandle, '@')===false) // handles can't contain @ symbols if (qa_opt('allow_login_email_only') || (strpos($inemailhandle, '@')!==false)) // handles can't contain @ symbols
$matchusers=qa_db_user_find_by_handle($inemailhandle);
else
$matchusers=qa_db_user_find_by_email($inemailhandle); $matchusers=qa_db_user_find_by_email($inemailhandle);
else
$matchusers=qa_db_user_find_by_handle($inemailhandle);
if (count($matchusers)==1) { // if matches more than one (should be impossible), don't log in if (count($matchusers)==1) { // if matches more than one (should be impossible), don't log in
$inuserid=$matchusers[0]; $inuserid=$matchusers[0];
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'label' => qa_lang_html('users/email_handle_label'), 'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'),
'tags' => 'NAME="emailhandle" ID="emailhandle"', 'tags' => 'NAME="emailhandle" ID="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
'error' => qa_html(@$errors['emailhandle']), 'error' => qa_html(@$errors['emailhandle']),
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
posts retrieved from the database, and these will be ignored. posts retrieved from the database, and these will be ignored.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
$cookieid=qa_cookie_get(); $cookieid=qa_cookie_get();
...@@ -624,7 +624,7 @@ ...@@ -624,7 +624,7 @@
if ($parent['commentbutton'] && qa_opt('show_c_reply_buttons') && ($comment['type']=='C')) if ($parent['commentbutton'] && qa_opt('show_c_reply_buttons') && ($comment['type']=='C'))
$buttons['comment']=array( $buttons['comment']=array(
'tags' => 'NAME="'.(($parent['basetype']=='Q') ? 'q' : 'a').qa_html($parent['postid']). 'tags' => 'NAME="'.(($parent['basetype']=='Q') ? 'q' : ('a'.qa_html($parent['postid']))).
'_docomment" onClick="return qa_toggle_element(\'c'.qa_html($parent['postid']).'\')"', '_docomment" onClick="return qa_toggle_element(\'c'.qa_html($parent['postid']).'\')"',
'label' => qa_lang_html('question/reply_button'), 'label' => qa_lang_html('question/reply_button'),
'popup' => qa_lang_html('question/reply_c_popup'), 'popup' => qa_lang_html('question/reply_c_popup'),
...@@ -716,12 +716,12 @@ ...@@ -716,12 +716,12 @@
} }
function qa_page_q_add_a_form(&$qa_content, $formid, $usecaptcha, $questionid, $in, $errors, $loadfocusnow, $formrequested) function qa_page_q_add_a_form(&$qa_content, $formid, $usecaptcha, $questionid, $in, $errors, $loadnow, $formrequested)
/* /*
Return a $qa_content form for adding an answer to $questionid. Pass an HTML element id to use for the form in Return a $qa_content form for adding an answer to $questionid. Pass an HTML element id to use for the form in
$formid and $usecaptcha if it should contain a captcha. Pass previous inputs from a submitted version of this form $formid and $usecaptcha if it should contain a captcha. Pass previous inputs from a submitted version of this form
in the array $in and resulting errors in $errors. If $loadfocusnow is true, the form will be loaded and focused in the array $in and resulting errors in $errors. If $loadnow is true, the form will be loaded immediately. Set
immediately. Set $formrequested to true if the user explicitly requested it, as opposed being shown automatically. $formrequested to true if the user explicitly requested it, as opposed being shown automatically.
*/ */
{ {
switch (qa_user_permit_error('permit_post_a')) { switch (qa_user_permit_error('permit_post_a')) {
...@@ -772,7 +772,7 @@ ...@@ -772,7 +772,7 @@
), ),
'content' => array_merge( 'content' => array_merge(
qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'a_content', 12, $loadfocusnow, $loadfocusnow), qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'a_content', 12, $formrequested, $loadnow),
array( array(
'error' => qa_html(@$errors['content']), 'error' => qa_html(@$errors['content']),
) )
...@@ -795,7 +795,7 @@ ...@@ -795,7 +795,7 @@
if (!strlen($custom)) if (!strlen($custom))
unset($form['fields']['custom']); unset($form['fields']['custom']);
if ($formrequested || !$loadfocusnow) if ($formrequested || !$loadnow)
$form['buttons']['cancel']=array( $form['buttons']['cancel']=array(
'tags' => 'NAME="docancel"', 'tags' => 'NAME="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
...@@ -816,14 +816,17 @@ ...@@ -816,14 +816,17 @@
$onloads[]='document.getElementById('.qa_js($formid).').qa_show=function() { '.$captchaloadscript.' }'; $onloads[]='document.getElementById('.qa_js($formid).').qa_show=function() { '.$captchaloadscript.' }';
} }
if (!$loadfocusnow) { if (!$loadnow) {
if (method_exists($editor, 'load_script')) if (method_exists($editor, 'load_script'))
$onloads[]='document.getElementById('.qa_js($formid).').qa_load=function() { '.$editor->load_script('a_content').' }'; $onloads[]='document.getElementById('.qa_js($formid).').qa_load=function() { '.$editor->load_script('a_content').' }';
if (method_exists($editor, 'focus_script'))
$onloads[]='document.getElementById('.qa_js($formid).').qa_focus=function() { '.$editor->focus_script('a_content').' }';
$form['buttons']['cancel']['tags'].=' onClick="return qa_toggle_element();"'; $form['buttons']['cancel']['tags'].=' onClick="return qa_toggle_element();"';
} }
if (!$formrequested) {
if (method_exists($editor, 'focus_script'))
$onloads[]='document.getElementById('.qa_js($formid).').qa_focus=function() { '.$editor->focus_script('a_content').' }';
}
if (count($onloads)) if (count($onloads))
$qa_content['script_onloads'][]=$onloads; $qa_content['script_onloads'][]=$onloads;
...@@ -831,7 +834,7 @@ ...@@ -831,7 +834,7 @@
} }
$form['id']=$formid; $form['id']=$formid;
$form['collapse']=!$loadfocusnow; $form['collapse']=!$loadnow;
$form['style']='tall'; $form['style']='tall';
return $form; return $form;
......
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
$errors=array(); $errors=array();
if (strpos($inemailhandle, '@')===false) // handles can't contain @ symbol if (qa_opt('allow_login_email_only') || (strpos($inemailhandle, '@')!==false)) // handles can't contain @ symbols
$matchusers=qa_db_user_find_by_handle($inemailhandle);
else
$matchusers=qa_db_user_find_by_email($inemailhandle); $matchusers=qa_db_user_find_by_email($inemailhandle);
else
$matchusers=qa_db_user_find_by_handle($inemailhandle);
if (count($matchusers)==1) { // if match more than one (should be impossible), consider it a non-match if (count($matchusers)==1) { // if match more than one (should be impossible), consider it a non-match
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'label' => qa_lang_html('users/email_handle_label'), 'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'),
'tags' => 'NAME="emailhandle" ID="emailhandle"', 'tags' => 'NAME="emailhandle" ID="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
'error' => qa_html(@$errors['emailhandle']), 'error' => qa_html(@$errors['emailhandle']),
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
), ),
); );
$qa_content['focusid']=isset($errors['emailhandle']) ? 'emailhandle' : 'code'; $qa_content['focusid']=(isset($errors['emailhandle']) || !strlen(@$inemailhandle)) ? 'emailhandle' : 'code';
return $qa_content; return $qa_content;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
Standard database failure handler function which bring up the install/repair/upgrade page Standard database failure handler function which bring up the install/repair/upgrade page
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$pass_failure_type=$type; $pass_failure_type=$type;
$pass_failure_errno=$errno; $pass_failure_errno=$errno;
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
Queue any pending requests which are required independent of which page will be shown Queue any pending requests which are required independent of which page will be shown
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
qa_preload_options(); qa_preload_options();
$loginuserid=qa_get_logged_in_userid(); $loginuserid=qa_get_logged_in_userid();
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
If the user has Javascript on, these should come through Ajax rather than here. If the user has Javascript on, these should come through Ajax rather than here.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_vote_error_html; global $qa_vote_error_html;
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
Run the appropriate qa-page-*.php file for this request and return back the $qa_content it passed Run the appropriate qa-page-*.php file for this request and return back the $qa_content it passed
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$requestlower=strtolower(qa_request()); $requestlower=strtolower(qa_request());
$requestparts=qa_request_parts(); $requestparts=qa_request_parts();
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
Output the $qa_content via the theme class after doing some pre-processing, mainly relating to Javascript Output the $qa_content via the theme class after doing some pre-processing, mainly relating to Javascript
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_template; global $qa_template;
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
If the key of an element ends in /, it should be used for any request with that key as its prefix If the key of an element ends in /, it should be used for any request with that key as its prefix
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return array( return array(
'account' => 'qa-page-account.php', 'account' => 'qa-page-account.php',
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
in the context of the categories in $categoryids (if not null) in the context of the categories in $categoryids (if not null)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_template, $qa_vote_error_html; global $qa_template, $qa_vote_error_html;
......
...@@ -91,7 +91,8 @@ ...@@ -91,7 +91,8 @@
Output each passed parameter on a separate line - see output_array() comments Output each passed parameter on a separate line - see output_array() comments
*/ */
{ {
$this->output_array(func_get_args()); $args=func_get_args();
$this->output_array($args);
} }
......
...@@ -67,12 +67,8 @@ ...@@ -67,12 +67,8 @@
{ {
if (is_numeric($a) && is_numeric($b)) // straight subtraction won't work for floating bits if (is_numeric($a) && is_numeric($b)) // straight subtraction won't work for floating bits
return ($a==$b) ? 0 : (($a<$b) ? -1 : 1); return ($a==$b) ? 0 : (($a<$b) ? -1 : 1);
else
else {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
return strcasecmp($a, $b); // doesn't do UTF-8 right but it will do for now return strcasecmp($a, $b); // doesn't do UTF-8 right but it will do for now
}
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
Set up some global tables to be used by other functions in this file Set up some global tables to be used by other functions in this file
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_utf8punctuation, $qa_utf8removeaccents; global $qa_utf8punctuation, $qa_utf8removeaccents;
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
splitting with $splitideographs and $splithyphens. splitting with $splitideographs and $splithyphens.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_utf8punctuation; global $qa_utf8punctuation;
...@@ -459,7 +459,7 @@ ...@@ -459,7 +459,7 @@
Return UTF-8 input $string with all accents (on Roman characters) removed Return UTF-8 input $string with all accents (on Roman characters) removed
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_utf8removeaccents; global $qa_utf8removeaccents;
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
Convert an array of tags into a string for storage in the database Convert an array of tags into a string for storage in the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return implode(',', $tags); return implode(',', $tags);
} }
...@@ -483,7 +483,7 @@ ...@@ -483,7 +483,7 @@
Convert a tag string as stored in the database into an array of tags Convert a tag string as stored in the database into an array of tags
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return empty($tagstring) ? array() : explode(',', $tagstring); return empty($tagstring) ? array() : explode(',', $tagstring);
} }
...@@ -495,7 +495,7 @@ ...@@ -495,7 +495,7 @@
removing words from the middle (and especially towards the end) removing words from the middle (and especially towards the end)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$string=strtr($string, "\r\n\t", ' '); $string=strtr($string, "\r\n\t", ' ');
...@@ -539,7 +539,7 @@ ...@@ -539,7 +539,7 @@
Return an array of the words within $wordstring, each of which can contain asterisks Return an array of the words within $wordstring, each of which can contain asterisks
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return preg_split('/'.QA_PREG_BLOCK_WORD_SEPARATOR.'+/', $wordstring, -1, PREG_SPLIT_NO_EMPTY); return preg_split('/'.QA_PREG_BLOCK_WORD_SEPARATOR.'+/', $wordstring, -1, PREG_SPLIT_NO_EMPTY);
} }
...@@ -550,7 +550,7 @@ ...@@ -550,7 +550,7 @@
Return a regular expression fragment corresponding to the block words $wordstring Return a regular expression fragment corresponding to the block words $wordstring
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$blockwords=qa_block_words_explode($wordsstring); $blockwords=qa_block_words_explode($wordsstring);
$patterns=array(); $patterns=array();
...@@ -567,7 +567,7 @@ ...@@ -567,7 +567,7 @@
Return an array of matches of the regular expression fragment $wordspreg in $string, [offset] => [length] Return an array of matches of the regular expression fragment $wordspreg in $string, [offset] => [length]
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
global $qa_utf8punctuation, $qa_utf8punctuation_keeplength; global $qa_utf8punctuation, $qa_utf8punctuation_keeplength;
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
Return $string with any words matching the regular expression fragment $wordspreg replaced with repeated $character Return $string with any words matching the regular expression fragment $wordspreg replaced with repeated $character
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (strlen($wordspreg)) { if (strlen($wordspreg)) {
$matches=qa_block_words_match_all($string, $wordspreg); $matches=qa_block_words_match_all($string, $wordspreg);
...@@ -635,7 +635,7 @@ ...@@ -635,7 +635,7 @@
Return true or false to indicate whether $email is a valid email (this is pretty flexible compared to most real emails out there) Return true or false to indicate whether $email is a valid email (this is pretty flexible compared to most real emails out there)
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return preg_match("/^[\-\!\#\$\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/", $email) ? true : false; return preg_match("/^[\-\!\#\$\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/", $email) ? true : false;
} }
...@@ -646,7 +646,7 @@ ...@@ -646,7 +646,7 @@
Return the number of characters in $string, preferably using PHP's multibyte string functions Return the number of characters in $string, preferably using PHP's multibyte string functions
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return function_exists('mb_strlen') ? mb_strlen($string, 'UTF-8') : strlen($string); return function_exists('mb_strlen') ? mb_strlen($string, 'UTF-8') : strlen($string);
} }
...@@ -657,7 +657,7 @@ ...@@ -657,7 +657,7 @@
Return a lower case version of $string, preferably using PHP's multibyte string functions Return a lower case version of $string, preferably using PHP's multibyte string functions
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return function_exists('mb_strtolower') ? mb_strtolower($string, 'UTF-8') : strtolower($string); return function_exists('mb_strtolower') ? mb_strtolower($string, 'UTF-8') : strtolower($string);
} }
...@@ -668,7 +668,7 @@ ...@@ -668,7 +668,7 @@
Return $length characters from $string, starting from $start, preferably using PHP's multibyte string functions Return $length characters from $string, starting from $start, preferably using PHP's multibyte string functions
*/ */
{ {
if (qa_to_override(__FUNCTION__)) return qa_call_override(__FUNCTION__, $args=func_get_args()); if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return function_exists('mb_substr') ? mb_substr($string, $start, $length, 'UTF-8') : substr($string, $start, $length); return function_exists('mb_substr') ? mb_substr($string, $start, $length, 'UTF-8') : substr($string, $start, $length);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment