Commit 54148456 by Scott

Update all qa-util-* includes

parent b4844889
......@@ -3,7 +3,7 @@
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-include/qa-util-debug.php
File: qa-include/Q2A/Util/Usage.php
Description: Debugging stuff, currently used for tracking resource usage
......
......@@ -21,7 +21,7 @@
*/
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
require_once QA_INCLUDE_DIR.'app/users.php';
require_once QA_INCLUDE_DIR.'app/format.php';
......
......@@ -51,7 +51,7 @@
require_once QA_INCLUDE_DIR.'app/cookies.php';
require_once QA_INCLUDE_DIR.'pages/question-view.php';
require_once QA_INCLUDE_DIR.'pages/question-submit.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
// Try to create the new comment
......
......@@ -25,7 +25,7 @@
require_once QA_INCLUDE_DIR.'app/cookies.php';
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'pages/question-view.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
// Load relevant information about this question and check it exists
......
......@@ -55,7 +55,7 @@
return false;
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.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
......
......@@ -55,7 +55,7 @@
null to use now.
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
require_once QA_INCLUDE_DIR.'db/post-create.php';
$tagwordids=qa_db_word_mapto_ids(array_unique(qa_tagstring_to_tags($tagstring)));
......
......@@ -141,7 +141,7 @@
if (isset($loginuserid)) {
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$favoritenonqs=qa_db_get_pending_result('favoritenonqs', qa_db_user_favorite_non_qs_selectspec($loginuserid));
......@@ -255,7 +255,7 @@
require_once QA_INCLUDE_DIR.'app/updates.php';
if (isset($options['blockwordspreg']))
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$fields=array('raw' => $post);
......@@ -900,7 +900,7 @@
{
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.'util/sort.php';
foreach ($questions as $key => $question) // collect information about action referenced by each $question
$questions[$key]['sort']=-(isset($question['opostid']) ? $question['otime'] : $question['created']);
......@@ -919,7 +919,7 @@
{
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.'util/sort.php';
foreach ($questions as $key => $question) { // collect information about action referenced by each $question
if (isset($question['opostid'])) {
......@@ -1515,7 +1515,7 @@
Get a list of user-entered tags submitted from a field that was created with qa_set_up_tag_field(...)
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$text=qa_post_text($fieldname);
......@@ -1954,7 +1954,7 @@
{
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.'util/image.php';
if (strlen($blobid) && ($size>0)) {
qa_image_constrain($width, $height, $size);
......
......@@ -485,7 +485,7 @@
break;
case 'form_security_salt':
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$value=qa_random_alphanum(32);
break;
......@@ -694,7 +694,7 @@
$blockwordstring=qa_opt('block_bad_words');
if (strlen($blockwordstring)) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$qa_blockwordspreg=qa_block_words_to_preg($blockwordstring);
} else
......
......@@ -29,7 +29,7 @@
require_once QA_INCLUDE_DIR.'db/post-create.php';
require_once QA_INCLUDE_DIR.'db/points.php';
require_once QA_INCLUDE_DIR.'db/hotness.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
function qa_combine_notify_email($userid, $notify, $email)
......@@ -220,7 +220,7 @@
require_once QA_INCLUDE_DIR.'app/emails.php';
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (!isset($parent))
$parent=$question; // for backwards compatibility with old answer parameter
......
......@@ -364,7 +364,7 @@
if ($wasqueued && ($status==QA_POST_STATUS_NORMAL) && !$wasrequeued) {
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
qa_report_event('q_post', $oldquestion['userid'], $oldquestion['handle'], $oldquestion['cookieid'], $eventparams + array(
'notify' => isset($oldquestion['notify']),
......@@ -473,7 +473,7 @@
of user. Updates points and reports events as appropriate.
*/
{
require_once QA_INCLUDE_DIR . 'db/votes.php';
require_once QA_INCLUDE_DIR.'db/votes.php';
$postid = $oldquestion['postid'];
......@@ -676,7 +676,7 @@
));
if ($wasqueued && ($status==QA_POST_STATUS_NORMAL) && !$wasrequeued) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
qa_report_event('a_post', $oldanswer['userid'], $oldanswer['handle'], $oldanswer['cookieid'], $eventparams + array(
'notify' => isset($oldanswer['notify']),
......@@ -736,7 +736,7 @@
of user. Updates points and reports events as appropriate.
*/
{
require_once QA_INCLUDE_DIR . 'db/votes.php';
require_once QA_INCLUDE_DIR.'db/votes.php';
$postid = $oldanswer['postid'];
......@@ -999,7 +999,7 @@
if ($wasqueued && ($status==QA_POST_STATUS_NORMAL) && !$wasrequeued) {
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$commentsfollows=qa_db_single_select(qa_db_full_child_posts_selectspec(null, $oldcomment['parentid']));
$thread=array();
......@@ -1057,7 +1057,7 @@
of user. Updates points and reports events as appropriate.
*/
{
require_once QA_INCLUDE_DIR . 'db/votes.php';
require_once QA_INCLUDE_DIR.'db/votes.php';
$postid = $oldcomment['postid'];
......
......@@ -31,7 +31,7 @@
require_once QA_INCLUDE_DIR.'app/post-create.php';
require_once QA_INCLUDE_DIR.'app/post-update.php';
require_once QA_INCLUDE_DIR.'app/users.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
function qa_post_create($type, $parentid, $title, $content, $format='', $categoryid=null, $tags=null, $userid=null, $notify=null, $email=null, $extravalue=null, $name=null)
......
......@@ -269,7 +269,7 @@
if (count($questionids)) {
require_once QA_INCLUDE_DIR.'app/events.php';
require_once QA_INCLUDE_DIR.'app/updates.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
$lastquestionid=max($questionids);
......
......@@ -149,7 +149,7 @@
// If appropriate, get more accurate image size and apply constraints to it
require_once QA_INCLUDE_DIR.'qa-util-image.php';
require_once QA_INCLUDE_DIR.'util/image.php';
if ($isimage && qa_has_gd_image()) {
$image=@imagecreatefromstring($content);
......
......@@ -81,7 +81,7 @@
Make $handle valid and unique in the database - if $allowuserid is set, allow it to match that user only
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
require_once QA_INCLUDE_DIR.'db/maxima.php';
require_once QA_INCLUDE_DIR.'db/users.php';
......@@ -361,7 +361,7 @@
{
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.'util/string.php';
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'app/emails.php';
require_once QA_INCLUDE_DIR.'app/cookies.php';
......@@ -404,7 +404,7 @@
{
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.'util/image.php';
$imagedata=qa_image_constrain_data($imagedata, $width, $height, qa_opt('avatar_store_size'));
......
......@@ -653,7 +653,7 @@
of the returned array will match the $handles provided, not necessary those in the DB.
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (QA_FINAL_EXTERNAL_USERS)
$rawhandleuserids=qa_get_userids_from_public($handles);
......@@ -1047,7 +1047,7 @@ in a category for which they have elevated privileges).
$qa_form_key_cookie_set=true;
if (strlen(@$_COOKIE['qa_key'])!=QA_FORM_KEY_LENGTH) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$_COOKIE['qa_key']=qa_random_alphanum(QA_FORM_KEY_LENGTH);
}
......
......@@ -1006,7 +1006,7 @@
{
$count=isset($count) ? min($count, QA_DB_RETRIEVE_QS_AS) : QA_DB_RETRIEVE_QS_AS;
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$selectspec=qa_db_posts_basic_selectspec($voteuserid, $full);
......
......@@ -42,7 +42,7 @@
Create a new user in the database with $email, $password, $handle, privilege $level, and $ip address
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$salt=isset($password) ? qa_random_alphanum(16) : null;
......@@ -152,7 +152,7 @@
{
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.'util/string.php';
$salt=qa_random_alphanum(16);
......@@ -182,7 +182,7 @@
{
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.'util/string.php';
return qa_random_alphanum(8);
}
......@@ -195,7 +195,7 @@
{
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.'util/string.php';
return qa_random_alphanum(8);
}
......
......@@ -29,7 +29,7 @@
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'app/users.php';
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-image.php';
require_once QA_INCLUDE_DIR.'util/image.php';
// Check we're not using single-sign on integration, that we're logged in
......@@ -66,7 +66,7 @@
$errors['avatar'] = qa_lang('main/file_upload_limit_exceeded');
else {
if (qa_clicked('dosaveprofile') && !$isblocked) {
require_once QA_INCLUDE_DIR . 'app/users-edit.php';
require_once QA_INCLUDE_DIR.'app/users-edit.php';
$inhandle = $changehandle ? qa_post_text('handle') : $useraccount['handle'];
$inemail = qa_post_text('email');
......@@ -116,7 +116,7 @@
if ($avatarfileerror === 1)
$errors['avatar'] = qa_lang('main/file_upload_limit_exceeded');
elseif ($avatarfileerror === 0 && $_FILES['file']['size'] > 0) {
require_once QA_INCLUDE_DIR . 'app/limits.php';
require_once QA_INCLUDE_DIR.'app/limits.php';
switch (qa_user_permit_error(null, QA_LIMIT_UPLOADS)) {
case 'limit':
......@@ -168,7 +168,7 @@
// Process change password if clicked
if (qa_clicked('dochangepassword')) {
require_once QA_INCLUDE_DIR . 'app/users-edit.php';
require_once QA_INCLUDE_DIR.'app/users-edit.php';
$inoldpassword = qa_post_text('oldpassword');
$innewpassword1 = qa_post_text('newpassword1');
......
......@@ -127,7 +127,7 @@
}
} else {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$inname=qa_post_text('name');
$incontent=qa_post_text('content');
......
......@@ -303,7 +303,7 @@
$showoptions = array('show_notice_visitor', 'notice_visitor');
if (!QA_FINAL_EXTERNAL_USERS) {
require_once QA_INCLUDE_DIR.'qa-util-image.php';
require_once QA_INCLUDE_DIR.'util/image.php';
array_push($showoptions, 'show_custom_register', 'custom_register', 'show_register_terms', 'register_terms', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome');
......@@ -706,12 +706,12 @@
break;
case 'block_ips_write':
require_once QA_INCLUDE_DIR . 'app/limits.php';
require_once QA_INCLUDE_DIR.'app/limits.php';
$optionvalue = implode(' , ', qa_block_ips_explode($optionvalue));
break;
case 'block_bad_words':
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$optionvalue = implode(' , ', qa_block_words_explode($optionvalue));
break;
}
......@@ -729,7 +729,7 @@
if ($avatarfileerror === 1)
$errors['avatar_default_show'] = qa_lang('main/file_upload_limit_exceeded');
elseif ($avatarfileerror === 0 && $_FILES['avatar_default_file']['size'] > 0) {
require_once QA_INCLUDE_DIR . 'qa-util-image.php';
require_once QA_INCLUDE_DIR.'util/image.php';
$oldblobid = qa_opt('avatar_default_blobid');
......@@ -742,7 +742,7 @@
$imagedata = qa_image_constrain_data(file_get_contents($_FILES['avatar_default_file']['tmp_name']), $width, $height, qa_opt('avatar_store_size'));
if (isset($imagedata)) {
require_once QA_INCLUDE_DIR . 'app/blobs.php';
require_once QA_INCLUDE_DIR.'app/blobs.php';
$newblobid = qa_create_blob($imagedata, 'jpeg');
......@@ -956,7 +956,7 @@
switch ($optionname) { // special treatment for certain options
case 'site_language':
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
qa_optionfield_make_select($optionfield, qa_admin_language_options(), $value, '');
......@@ -1685,7 +1685,7 @@
break;
case 'mailing':
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
if (isset($mailingprogress)) {
unset($qa_content['form']['buttons']['save']);
......
......@@ -111,7 +111,7 @@
} elseif (qa_clicked('dosavepage')) {
require_once QA_INCLUDE_DIR.'db/admin.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (!qa_check_form_security_code('admin/pages', qa_post_text('code')))
$securityexpired=true;
......
......@@ -29,7 +29,7 @@
require_once QA_INCLUDE_DIR.'db/points.php';
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'app/admin.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
// Check admin privileges
......
......@@ -58,7 +58,7 @@
elseif (qa_clicked('dosavefield')) {
require_once QA_INCLUDE_DIR.'db/admin.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (!qa_check_form_security_code('admin/userfields', qa_post_text('code')))
$securityexpired=true;
......
......@@ -52,7 +52,7 @@
qa_redirect('admin/users');
elseif (qa_clicked('dosavetitle')) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (!qa_check_form_security_code('admin/usertitles', qa_post_text('code')))
$securityexpired=true;
......
......@@ -29,7 +29,7 @@
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'app/limits.php';
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
// Check whether this is a follow-on question and get some info we need from the database
......@@ -100,7 +100,7 @@
if (qa_clicked('doask')) {
require_once QA_INCLUDE_DIR.'app/post-create.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$categoryids=array_keys(qa_category_path($categories, @$in['categoryid']));
$userlevel=qa_user_level_for_categories($categoryids);
......@@ -131,7 +131,7 @@
$errors['categoryid']=qa_lang_html('question/category_ask_not_allowed');
if ($captchareason) {
require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR.'app/captcha.php';
qa_captcha_validate_post($errors);
}
......@@ -271,7 +271,7 @@
isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], @$errors['email']);
if ($captchareason) {
require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR.'app/captcha.php';
qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors, qa_captcha_reason_note($captchareason));
}
......
......@@ -103,7 +103,7 @@
);
} elseif (isset($loginuserid)) { // if logged in, allow sending a fresh link
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (strlen($incode))
$qa_content['error']=qa_lang_html('users/confirm_wrong_resend');
......
......@@ -60,7 +60,7 @@
if (qa_clicked('dofeedback')) {
require_once QA_INCLUDE_DIR.'app/emails.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$inmessage=qa_post_text('message');
$inname=qa_post_text('name');
......
......@@ -633,7 +633,7 @@
Returns a $qa_content form for editing an answer and sets up other parts of $qa_content accordingly
*/
{
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$answerid=$answer['postid'];
$prefix='a'.$answerid.'_';
......
......@@ -28,8 +28,8 @@
require_once QA_INCLUDE_DIR.'app/cookies.php';
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
require_once QA_INCLUDE_DIR.'util/string.php';
require_once QA_INCLUDE_DIR.'app/captcha.php';
require_once QA_INCLUDE_DIR.'pages/question-view.php';
require_once QA_INCLUDE_DIR.'app/updates.php';
......
......@@ -26,7 +26,7 @@ class qa_event_notify
{
require_once QA_INCLUDE_DIR.'app/emails.php';
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
switch ($event) {
......
......@@ -21,7 +21,7 @@
*/
require_once QA_INCLUDE_DIR.'db/maxima.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
class qa_filter_basic
{
......
......@@ -78,7 +78,7 @@ class qa_html_theme_layer extends qa_html_theme_base
private function get_post_voters_flaggers($post, $postid)
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
if (!isset($this->qa_voters_flaggers_cache[$postid])) {
$this->queue_post_voters_flaggers($post);
......
......@@ -110,7 +110,7 @@ class qa_search_basic
public function process_search($query, $start, $count, $userid, $absoluteurls, $fullcontent)
{
require_once QA_INCLUDE_DIR.'db/selects.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$words=qa_string_to_words($query);
......
......@@ -47,7 +47,7 @@ class qa_viewer_basic
$html=qa_sanitize_html($content, @$options['linksnewwindow'], false); // sanitize again for display, for extra safety, and due to new window setting
if (isset($options['blockwordspreg'])) { // filtering out blocked words inline within HTML is pretty complex, e.g. p<b>oo</b>p must be caught
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$html=preg_replace('/<\s*('.$this->htmllineseparators.')[^A-Za-z0-9]/i', "\n\\0", $html); // tags to single new line
$html=preg_replace('/<\s*('.$this->htmlparagraphseparators.')[^A-Za-z0-9]/i', "\n\n\\0", $html); // tags to double new line
......@@ -90,7 +90,7 @@ class qa_viewer_basic
}
if (@$options['showurllinks']) { // we need to ensure here that we don't put new links inside existing ones
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$htmlunlinkeds=array_reverse(preg_split('|<[Aa]\s+[^>]+>.*</[Aa]\s*>|', $html, -1, PREG_SPLIT_OFFSET_CAPTURE)); // start from end so we substitute correctly
......@@ -112,7 +112,7 @@ class qa_viewer_basic
}
elseif ($format=='') {
if (isset($options['blockwordspreg'])) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$content=qa_block_words_replace($content, $options['blockwordspreg']);
}
......@@ -162,7 +162,7 @@ class qa_viewer_basic
$text='[no viewer found for format: '.$format.']'; // for unknown formats
if (isset($options['blockwordspreg'])) {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$text=qa_block_words_replace($text, $options['blockwordspreg']);
}
......
......@@ -39,7 +39,7 @@
function qa_autoload($class)
{
if (strpos($class, 'Q2A_') === 0)
require QA_INCLUDE_DIR . strtr($class, '_', '/') . '.php';
require QA_INCLUDE_DIR.strtr($class, '_', '/') . '.php';
}
spl_autoload_register('qa_autoload');
......@@ -1090,7 +1090,7 @@
{
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.'util/string.php';
$useragent=@$_SERVER['HTTP_USER_AGENT'];
......@@ -1108,7 +1108,7 @@
{
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.'util/string.php';
// inspired by: http://dangerousprototypes.com/docs/PhpBB3_MOD:_Replacement_mobile_browser_detection_for_mobile_themes
......@@ -1188,7 +1188,7 @@
if (isset($qa_lang_file_pattern[$group]))
$include=str_replace('*', 'default', $qa_lang_file_pattern[$group]);
else
$include=QA_INCLUDE_DIR.'qa-lang-'.$group.'.php';
$include=QA_INCLUDE_DIR.'lang/qa-lang-'.$group.'.php';
$qa_phrases_default[$group]=@include_once $include;
}
......@@ -1370,7 +1370,7 @@
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
$title=qa_block_words_replace($title, qa_get_block_words_preg());
......
......@@ -586,7 +586,7 @@
// By contrast, MySQL's ORDER BY does seem to give the results in a reliable order.
if (isset($selectspec['sortasc'])) {
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
$index=0;
foreach ($outresult as $key => $value)
......@@ -595,7 +595,7 @@
qa_sort_by($outresult, $selectspec['sortasc'], '_order_');
} elseif (isset($selectspec['sortdesc'])) {
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
if (isset($selectspec['sortdesc_2']))
qa_sort_by($outresult, $selectspec['sortdesc'], $selectspec['sortdesc_2']);
......
......@@ -271,7 +271,7 @@
require_once QA_INCLUDE_DIR.'app/format.php';
require_once QA_INCLUDE_DIR.'app/updates.php';
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if ( ($feedtype!='search') && ($feedtype!='hot') ) // leave search results and hot questions sorted by relevance
$questions=qa_any_sort_and_dedupe($questions);
......
......@@ -60,7 +60,7 @@
} else {
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'app/blobs.php';
require_once QA_INCLUDE_DIR.'qa-util-image.php';
require_once QA_INCLUDE_DIR.'util/image.php';
// Otherwise retrieve the raw image and scale as appropriate
......
......@@ -726,7 +726,7 @@
$qa_content['notices'][]=qa_notice_form($notice['noticeid'], qa_viewer_html($notice['content'], $notice['format']), $notice);
} else {
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
if (!QA_FINAL_EXTERNAL_USERS) {
$loginmodules=qa_load_modules_with('login', 'login_html');
......
......@@ -160,10 +160,10 @@ class qa_html_theme_base
public function reorder_parts($parts, $beforekey=null, $reorderrelative=true)
/*
Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this
before main_parts(). See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
before main_parts(). See the docs for qa_array_reorder() in util/sort.php for the other parameters.
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
qa_array_reorder($this->content, $parts, $beforekey, $reorderrelative);
}
......@@ -935,10 +935,10 @@ class qa_html_theme_base
public function form_reorder_fields(&$form, $keys, $beforekey=null, $reorderrelative=true)
/*
Reorder the fields of $form according to the $keys array which contains the field keys in their new order. Call
before any fields are output. See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
before any fields are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters.
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
if (is_array($form['fields']))
qa_array_reorder($form['fields'], $keys, $beforekey, $reorderrelative);
......@@ -1114,10 +1114,10 @@ class qa_html_theme_base
public function form_reorder_buttons(&$form, $keys, $beforekey=null, $reorderrelative=true)
/*
Reorder the buttons of $form according to the $keys array which contains the button keys in their new order. Call
before any buttons are output. See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
before any buttons are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters.
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
if (is_array($form['buttons']))
qa_array_reorder($form['buttons'], $keys, $beforekey, $reorderrelative);
......
......@@ -3,7 +3,7 @@
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-include/qa-util-image.php
File: qa-include/util/image.php
Description: Some useful image-related functions (using GD)
......
......@@ -3,7 +3,7 @@
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-include/qa-util-sort.php
File: qa-include/util/sort.php
Description: A useful general-purpose 'sort by' function
......
......@@ -3,7 +3,7 @@
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-include/qa-util-string.php
File: qa-include/util/string.php
Description: Some useful string-related stuff
......
......@@ -110,7 +110,7 @@ class qa_tag_cloud
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR.'db/selects.php';
$populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
......
......@@ -48,7 +48,7 @@ class qa_xml_sitemap
public function admin_form()
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
require_once QA_INCLUDE_DIR.'util/sort.php';
$saved=false;
......
<?php
require_once QA_INCLUDE_DIR.'qa-util-string.php';
require_once QA_INCLUDE_DIR.'util/string.php';
class UtilStringTest extends PHPUnit_Framework_TestCase
{
......
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