Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
af7fb73a
Commit
af7fb73a
authored
Jul 31, 2020
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (admin controllers)
parent
2076b209
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
100 additions
and
119 deletions
+100
-119
.travis.yml
.travis.yml
+1
-1
Approve.php
qa-src/Controllers/Admin/Approve.php
+2
-2
Categories.php
qa-src/Controllers/Admin/Categories.php
+46
-39
Flagged.php
qa-src/Controllers/Admin/Flagged.php
+2
-2
Hidden.php
qa-src/Controllers/Admin/Hidden.php
+2
-2
Moderate.php
qa-src/Controllers/Admin/Moderate.php
+2
-2
Pages.php
qa-src/Controllers/Admin/Pages.php
+16
-26
Plugins.php
qa-src/Controllers/Admin/Plugins.php
+7
-9
UserFields.php
qa-src/Controllers/Admin/UserFields.php
+8
-12
UserTitles.php
qa-src/Controllers/Admin/UserTitles.php
+8
-11
Widgets.php
qa-src/Controllers/Admin/Widgets.php
+4
-12
DbSelect.php
qa-src/Database/DbSelect.php
+0
-1
ruleset-strict.xml
qa-tests/phpcs/ruleset-strict.xml
+2
-0
No files found.
.travis.yml
View file @
af7fb73a
...
...
@@ -18,7 +18,7 @@ notifications:
before_script
:
# PHP_CodeSniffer
-
curl -L -o phpcs.phar https://github.com/squizlabs/PHP_CodeSniffer/releases/download/
2.9.1
/phpcs.phar
-
curl -L -o phpcs.phar https://github.com/squizlabs/PHP_CodeSniffer/releases/download/
3.4.2
/phpcs.phar
# PHPUnit - manually download old version so that it works on PHP 7
-
curl -L -o phpunit.phar https://phar.phpunit.de/phpunit-4.8.35.phar
# Basic config required for PHPUnit
...
...
qa-src/Controllers/Admin/Approve.php
View file @
af7fb73a
...
...
@@ -133,9 +133,9 @@ class Approve extends BaseController
$qa_content
[
'message_list'
][
'messages'
][]
=
$message
;
}
}
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html
(
'admin/no_unapproved_found'
);
}
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
...
...
qa-src/Controllers/Admin/Categories.php
View file @
af7fb73a
...
...
@@ -66,12 +66,10 @@ class Categories extends BaseController
$parentid
=
qa_get
(
'addsub'
);
if
(
isset
(
$parentid
))
$editcategory
=
array
(
'parentid'
=>
$parentid
);
}
else
{
if
(
qa_clicked
(
'doaddcategory'
))
if
(
qa_clicked
(
'doaddcategory'
))
{
$editcategory
=
array
();
elseif
(
qa_clicked
(
'dosavecategory'
))
{
}
elseif
(
qa_clicked
(
'dosavecategory'
))
{
$parentid
=
qa_post_text
(
'parent'
);
$editcategory
=
array
(
'parentid'
=>
strlen
(
$parentid
)
?
$parentid
:
null
);
}
...
...
@@ -94,10 +92,9 @@ class Categories extends BaseController
$securityexpired
=
false
;
if
(
qa_clicked
(
'dosaveoptions'
))
{
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
else
{
}
else
{
qa_set_option
(
'allow_no_category'
,
(
int
)
qa_post_text
(
'option_allow_no_category'
));
qa_set_option
(
'allow_no_sub_category'
,
(
int
)
qa_post_text
(
'option_allow_no_sub_category'
));
$savedoptions
=
true
;
...
...
@@ -114,29 +111,24 @@ class Categories extends BaseController
qa_redirect
(
qa_request
());
else
qa_redirect
(
qa_request
(),
array
(
'edit'
=>
@
$editcategory
[
'parentid'
]));
}
elseif
(
qa_clicked
(
'dosetmissing'
))
{
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
else
{
}
else
{
$inreassign
=
qa_get_category_field_value
(
'reassign'
);
qa_db_category_reassign
(
$editcategory
[
'categoryid'
],
$inreassign
);
qa_redirect
(
qa_request
(),
array
(
'recalc'
=>
1
,
'edit'
=>
$editcategory
[
'categoryid'
]));
}
}
elseif
(
qa_clicked
(
'dosavecategory'
))
{
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/categories'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
elseif
(
qa_post_text
(
'dodelete'
))
{
}
elseif
(
qa_post_text
(
'dodelete'
))
{
if
(
!
$hassubcategory
)
{
$inreassign
=
qa_get_category_field_value
(
'reassign'
);
qa_db_category_reassign
(
$editcategory
[
'categoryid'
],
$inreassign
);
qa_db_category_delete
(
$editcategory
[
'categoryid'
]);
qa_redirect
(
qa_request
(),
array
(
'recalc'
=>
1
,
'edit'
=>
$editcategory
[
'parentid'
]));
}
}
else
{
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
...
...
@@ -152,11 +144,11 @@ class Categories extends BaseController
// Verify the name is legitimate for that parent ID
if
(
empty
(
$inname
))
if
(
empty
(
$inname
))
{
$errors
[
'name'
]
=
qa_lang
(
'main/field_required'
);
elseif
(
qa_strlen
(
$inname
)
>
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
)
}
elseif
(
qa_strlen
(
$inname
)
>
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
)
{
$errors
[
'name'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
);
else
{
}
else
{
foreach
(
$incategories
as
$category
)
{
if
(
!
strcmp
(
$category
[
'parentid'
],
$inparentid
)
&&
strcmp
(
$category
[
'categoryid'
],
@
$editcategory
[
'categoryid'
])
&&
...
...
@@ -240,7 +232,6 @@ class Categories extends BaseController
));
qa_redirect
(
qa_request
(),
array
(
'edit'
=>
$editcategory
[
'categoryid'
],
'saved'
=>
true
,
'recalc'
=>
(
int
)
$recalc
));
}
else
{
// creating a new one
$categoryid
=
qa_db_category_create
(
$inparentid
,
$inname
,
$inslug
);
...
...
@@ -307,10 +298,15 @@ class Categories extends BaseController
),
);
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'reassign'
],
'reassign'
,
$categories
,
@
$editcategory
[
'categoryid'
],
qa_opt
(
'allow_no_category'
),
qa_opt
(
'allow_no_sub_category'
));
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'reassign'
],
'reassign'
,
$categories
,
@
$editcategory
[
'categoryid'
],
qa_opt
(
'allow_no_category'
),
qa_opt
(
'allow_no_sub_category'
)
);
}
elseif
(
isset
(
$editcategory
))
{
$qa_content
[
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_path_html
(
qa_request
())
.
'"'
,
...
...
@@ -386,20 +382,26 @@ class Categories extends BaseController
$childdepth
=
qa_db_category_child_depth
(
$editcategory
[
'categoryid'
]);
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'parent'
],
'parent'
,
isset
(
$incategories
)
?
$incategories
:
$categories
,
isset
(
$inparentid
)
?
$inparentid
:
@
$editcategory
[
'parentid'
],
true
,
true
,
QA_CATEGORY_DEPTH
-
1
-
$childdepth
,
@
$editcategory
[
'categoryid'
]);
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'parent'
],
'parent'
,
isset
(
$incategories
)
?
$incategories
:
$categories
,
isset
(
$inparentid
)
?
$inparentid
:
@
$editcategory
[
'parentid'
],
true
,
true
,
QA_CATEGORY_DEPTH
-
1
-
$childdepth
,
@
$editcategory
[
'categoryid'
]
);
$qa_content
[
'form'
][
'fields'
][
'parent'
][
'options'
][
''
]
=
qa_lang_html
(
'admin/category_top_level'
);
@
$qa_content
[
'form'
][
'fields'
][
'parent'
][
'note'
]
.=
qa_lang_html_sub
(
'admin/category_max_depth_x'
,
QA_CATEGORY_DEPTH
);
}
elseif
(
isset
(
$editcategory
[
'categoryid'
]))
{
// existing category
if
(
$hassubcategory
)
{
$qa_content
[
'form'
][
'fields'
][
'name'
][
'note'
]
=
qa_lang_html
(
'admin/category_no_delete_subs'
);
unset
(
$qa_content
[
'form'
][
'fields'
][
'delete'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'reassign'
]);
}
else
{
$qa_content
[
'form'
][
'fields'
][
'delete'
]
=
array
(
'tags'
=>
'name="dodelete" id="dodelete"'
,
...
...
@@ -415,8 +417,17 @@ class Categories extends BaseController
'tags'
=>
'name="reassign"'
,
);
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'reassign'
],
'reassign'
,
$categories
,
$editcategory
[
'parentid'
],
true
,
true
,
null
,
$editcategory
[
'categoryid'
]);
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
][
'reassign'
],
'reassign'
,
$categories
,
$editcategory
[
'parentid'
],
true
,
true
,
null
,
$editcategory
[
'categoryid'
]
);
}
$qa_content
[
'form'
][
'fields'
][
'questions'
]
=
array
(
...
...
@@ -452,7 +463,6 @@ class Categories extends BaseController
'reassign_shown'
=>
'dodelete'
,
'reassign_hidden'
=>
'!dodelete'
,
));
}
else
{
// new category
unset
(
$qa_content
[
'form'
][
'fields'
][
'delete'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'reassign'
]);
...
...
@@ -505,10 +515,9 @@ class Categories extends BaseController
}
}
if
(
isset
(
$editcategory
[
'position'
]))
if
(
isset
(
$editcategory
[
'position'
]))
{
$positionvalue
=
$positionoptions
[
$editcategory
[
'position'
]];
else
{
}
else
{
$positionvalue
=
isset
(
$previous
)
?
qa_lang_html_sub
(
'admin/after_x'
,
qa_html
(
$previous
[
'title'
]))
:
qa_lang_html
(
'admin/first'
);
$positionoptions
[
1
+
@
max
(
array_keys
(
$positionoptions
))]
=
$positionvalue
;
}
...
...
@@ -551,10 +560,8 @@ class Categories extends BaseController
}
else
{
$qa_content
[
'form'
][
'fields'
][
'name'
][
'note'
]
=
qa_lang_html_sub
(
'admin/category_no_add_subs_x'
,
QA_CATEGORY_DEPTH
);
}
}
}
}
else
{
$qa_content
[
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_path_html
(
qa_request
())
.
'"'
,
...
...
@@ -637,10 +644,10 @@ class Categories extends BaseController
'type'
=>
'checkbox'
,
'value'
=>
qa_opt
(
'allow_no_sub_category'
),
);
}
else
}
else
{
unset
(
$qa_content
[
'form'
][
'buttons'
][
'save'
]);
}
}
if
(
qa_get
(
'recalc'
))
{
$qa_content
[
'form'
][
'ok'
]
=
'<span id="recalc_ok">'
.
qa_lang_html
(
'admin/recalc_categories'
)
.
'</span>'
;
...
...
qa-src/Controllers/Admin/Flagged.php
View file @
af7fb73a
...
...
@@ -134,9 +134,9 @@ class Flagged extends BaseController
$qa_content
[
'q_list'
][
'qs'
][]
=
$htmlfields
;
}
}
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html
(
'admin/no_flagged_found'
);
}
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
...
...
qa-src/Controllers/Admin/Hidden.php
View file @
af7fb73a
...
...
@@ -168,9 +168,9 @@ class Hidden extends BaseController
$qa_content
[
'q_list'
][
'qs'
][]
=
$htmlfields
;
}
}
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html
(
'admin/no_hidden_found'
);
}
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
...
...
qa-src/Controllers/Admin/Moderate.php
View file @
af7fb73a
...
...
@@ -156,9 +156,9 @@ class Moderate extends BaseController
$qa_content
[
'q_list'
][
'qs'
][]
=
$htmlfields
;
}
}
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html
(
'admin/no_approve_found'
);
}
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
...
...
qa-src/Controllers/Admin/Pages.php
View file @
af7fb73a
...
...
@@ -54,9 +54,9 @@ class Pages extends BaseController
if
((
qa_clicked
(
'doaddpage'
)
||
qa_clicked
(
'doaddlink'
)
||
qa_get
(
'doaddlink'
)
||
qa_clicked
(
'dosavepage'
))
&&
!
isset
(
$editpage
))
{
$editpage
=
array
(
'title'
=>
qa_get
(
'text'
),
'tags'
=>
qa_get
(
'url'
),
'nav'
=>
qa_get
(
'nav'
),
'position'
=>
1
);
$isexternal
=
qa_clicked
(
'doaddlink'
)
||
qa_get
(
'doaddlink'
)
||
qa_post_text
(
'external'
);
}
elseif
(
isset
(
$editpage
))
}
elseif
(
isset
(
$editpage
))
{
$isexternal
=
$editpage
[
'flags'
]
&
QA_PAGE_FLAGS_EXTERNAL
;
}
// Check admin privileges (do late to allow one DB query)
...
...
@@ -110,22 +110,20 @@ class Pages extends BaseController
$securityexpired
=
false
;
if
(
qa_clicked
(
'docancel'
))
if
(
qa_clicked
(
'docancel'
))
{
$editpage
=
null
;
elseif
(
qa_clicked
(
'dosaveoptions'
)
||
qa_clicked
(
'doaddpage'
)
||
qa_clicked
(
'doaddlink'
))
{
}
elseif
(
qa_clicked
(
'dosaveoptions'
)
||
qa_clicked
(
'doaddpage'
)
||
qa_clicked
(
'doaddlink'
))
{
if
(
!
qa_check_form_security_code
(
'admin/pages'
,
qa_post_text
(
'code'
)))
$securityexpired
=
true
;
else
foreach
(
$navoptions
as
$optionname
=>
$langkey
)
qa_set_option
(
$optionname
,
(
int
)
qa_post_text
(
'option_'
.
$optionname
));
}
elseif
(
qa_clicked
(
'dosavepage'
))
{
require_once
QA_INCLUDE_DIR
.
'db/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
if
(
!
qa_check_form_security_code
(
'admin/pages'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/pages'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
else
{
}
else
{
$reloadpages
=
false
;
if
(
qa_post_text
(
'dodelete'
))
{
...
...
@@ -137,7 +135,6 @@ class Pages extends BaseController
$editpage
=
null
;
$reloadpages
=
true
;
}
else
{
$inname
=
qa_post_text
(
'name'
);
$inposition
=
qa_post_text
(
'position'
);
...
...
@@ -150,7 +147,6 @@ class Pages extends BaseController
$errors
=
array
();
// Verify the name (navigation link) is legitimate
if
(
empty
(
$inname
))
$errors
[
'name'
]
=
qa_lang
(
'main/field_required'
);
elseif
(
qa_strlen
(
$inname
)
>
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
)
...
...
@@ -158,20 +154,16 @@ class Pages extends BaseController
if
(
$isexternal
)
{
// Verify the url is legitimate (vaguely)
if
(
empty
(
$inurl
))
$errors
[
'url'
]
=
qa_lang
(
'main/field_required'
);
elseif
(
qa_strlen
(
$inurl
)
>
QA_DB_MAX_CAT_PAGE_TAGS_LENGTH
)
$errors
[
'url'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TAGS_LENGTH
);
}
else
{
// Verify the heading is legitimate
if
(
qa_strlen
(
$inheading
)
>
QA_DB_MAX_TITLE_LENGTH
)
$errors
[
'heading'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_TITLE_LENGTH
);
// Verify the slug is legitimate (and try some defaults if we're creating a new page, and it's not)
for
(
$attempt
=
0
;
$attempt
<
100
;
$attempt
++
)
{
switch
(
$attempt
)
{
case
0
:
...
...
@@ -217,22 +209,24 @@ class Pages extends BaseController
// Perform appropriate database action
if
(
isset
(
$editpage
[
'pageid'
]))
{
// changing existing page
$title
=
isset
(
$errors
[
'name'
])
?
$editpage
[
'title'
]
:
$inname
;
if
(
$isexternal
)
{
qa_db_page_set_fields
(
$editpage
[
'pageid'
],
isset
(
$errors
[
'name'
])
?
$editpage
[
'title'
]
:
$inname
,
qa_db_page_set_fields
(
$editpage
[
'pageid'
],
$title
,
QA_PAGE_FLAGS_EXTERNAL
|
(
$innewwindow
?
QA_PAGE_FLAGS_NEW_WINDOW
:
0
),
isset
(
$errors
[
'url'
])
?
$editpage
[
'tags'
]
:
$inurl
,
null
,
null
,
$inpermit
);
null
,
null
,
$inpermit
);
}
else
{
$setheading
=
isset
(
$errors
[
'heading'
])
?
$editpage
[
'heading'
]
:
$inheading
;
$setslug
=
isset
(
$errors
[
'slug'
])
?
$editpage
[
'tags'
]
:
$inslug
;
$setcontent
=
isset
(
$errors
[
'content'
])
?
$editpage
[
'content'
]
:
$incontent
;
qa_db_page_set_fields
(
$editpage
[
'pageid'
],
isset
(
$errors
[
'name'
])
?
$editpage
[
'title'
]
:
$inname
,
0
,
$setslug
,
$setheading
,
$setcontent
,
$inpermit
);
qa_db_page_set_fields
(
$editpage
[
'pageid'
],
$title
,
0
,
$setslug
,
$setheading
,
$setcontent
,
$inpermit
);
$searchmodules
=
qa_load_modules_with
(
'search'
,
'unindex_page'
);
foreach
(
$searchmodules
as
$searchmodule
)
...
...
@@ -253,7 +247,6 @@ class Pages extends BaseController
$editpage
=
null
;
else
$editpage
=
@
$pages
[
$editpage
[
'pageid'
]];
}
else
{
// creating a new one
if
(
empty
(
$errors
))
{
if
(
$isexternal
)
{
...
...
@@ -448,7 +441,6 @@ class Pages extends BaseController
unset
(
$qa_content
[
'form'
][
'fields'
][
'slug'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'heading'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'content'
]);
}
else
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'url'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'newwindow'
]);
...
...
@@ -462,7 +454,6 @@ class Pages extends BaseController
(
$isexternal
?
'newwindow_display'
:
'heading_display'
)
=>
'!dodelete'
,
'content_display'
=>
'!dodelete'
,
));
}
else
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'slug'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'delete'
]);
...
...
@@ -472,7 +463,6 @@ class Pages extends BaseController
unset
(
$qa_content
[
'form'
][
'buttons'
][
'saveview'
]);
$qa_content
[
'focusid'
]
=
'name'
;
}
else
{
// List of standard navigation links
$qa_content
[
'form'
]
=
array
(
...
...
qa-src/Controllers/Admin/Plugins.php
View file @
af7fb73a
...
...
@@ -105,10 +105,9 @@ class Plugins extends BaseController
$queries
=
$module
->
init_queries
(
$tables
);
if
(
!
empty
(
$queries
))
{
if
(
qa_is_http_post
())
if
(
qa_is_http_post
())
{
qa_redirect
(
'install'
);
else
{
}
else
{
$qa_content
[
'error'
]
=
strtr
(
qa_lang_html
(
'admin/module_x_database_init'
),
array
(
'^1'
=>
qa_html
(
$name
),
'^2'
=>
qa_html
(
$type
),
...
...
@@ -170,7 +169,6 @@ class Plugins extends BaseController
$authorhtml
=
'<a href="'
.
qa_html
(
$metadata
[
'author_uri'
])
.
'">'
.
$authorhtml
.
'</a>'
;
$authorhtml
=
qa_lang_html_sub
(
'main/by_x'
,
$authorhtml
);
}
else
$authorhtml
=
''
;
...
...
@@ -182,9 +180,9 @@ class Plugins extends BaseController
$qa_content
[
'script_onloads'
][]
=
array
(
"qa_version_check("
.
qa_js
(
$metadata
[
'update_uri'
])
.
", "
.
qa_js
(
$metadata
[
'version'
],
true
)
.
", "
.
qa_js
(
$elementid
)
.
", false);"
);
}
else
}
else
{
$updatehtml
=
''
;
}
if
(
isset
(
$metadata
[
'description'
]))
$deschtml
=
qa_html
(
$metadata
[
'description'
]);
...
...
@@ -204,13 +202,13 @@ class Plugins extends BaseController
$pluginhtml
.=
$deschtml
.
(
strlen
(
$deschtml
)
>
0
?
'<br>'
:
''
);
$pluginhtml
.=
'<small style="color:#666">'
.
qa_html
(
$pluginDirectoryPath
)
.
'/</small>'
;
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
{
$pluginhtml
=
'<s style="color:#999">'
.
$pluginhtml
.
'</s><br><span style="color:#f00">'
.
qa_lang_html_sub
(
'admin/requires_q2a_version'
,
qa_html
(
$metadata
[
'min_q2a'
]))
.
'</span>'
;
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
}
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
{
$pluginhtml
=
'<s style="color:#999">'
.
$pluginhtml
.
'</s><br><span style="color:#f00">'
.
qa_lang_html_sub
(
'admin/requires_php_version'
,
qa_html
(
$metadata
[
'min_php'
]))
.
'</span>'
;
}
$qa_content
[
'form_plugin_'
.
$pluginIndex
]
=
array
(
'tags'
=>
'id="'
.
qa_html
(
$hash
)
.
'"'
,
...
...
qa-src/Controllers/Admin/UserFields.php
View file @
af7fb73a
...
...
@@ -64,21 +64,18 @@ class UserFields extends BaseController
$securityexpired
=
false
;
if
(
qa_clicked
(
'docancel'
))
if
(
qa_clicked
(
'docancel'
))
{
qa_redirect
(
'admin/users'
);
elseif
(
qa_clicked
(
'dosavefield'
))
{
}
elseif
(
qa_clicked
(
'dosavefield'
))
{
require_once
QA_INCLUDE_DIR
.
'db/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
if
(
!
qa_check_form_security_code
(
'admin/userfields'
,
qa_post_text
(
'code'
)))
$securityexpired
=
true
;
else
{
if
(
qa_post_text
(
'dodelete'
))
{
qa_db_userfield_delete
(
$editfield
[
'fieldid'
]);
qa_redirect
(
'admin/users'
);
}
else
{
$inname
=
qa_post_text
(
'name'
);
$intype
=
qa_post_text
(
'type'
);
...
...
@@ -100,16 +97,15 @@ class UserFields extends BaseController
qa_db_userfield_set_fields
(
$editfield
[
'fieldid'
],
isset
(
$errors
[
'name'
])
?
$editfield
[
'content'
]
:
$inname
,
$inflags
,
$inpermit
);
qa_db_userfield_move
(
$editfield
[
'fieldid'
],
$inposition
);
if
(
empty
(
$errors
))
if
(
empty
(
$errors
))
{
qa_redirect
(
'admin/users'
);
else
{
}
else
{
$userfields
=
qa_db_select_with_pending
(
qa_db_userfields_selectspec
());
// reload after changes
foreach
(
$userfields
as
$userfield
)
foreach
(
$userfields
as
$userfield
)
{
if
(
$userfield
[
'fieldid'
]
==
$editfield
[
'fieldid'
])
$editfield
=
$userfield
;
}
}
}
elseif
(
empty
(
$errors
))
{
// creating a new user field
for
(
$attempt
=
0
;
$attempt
<
1000
;
$attempt
++
)
{
$suffix
=
$attempt
?
(
'-'
.
(
1
+
$attempt
))
:
''
;
...
...
@@ -160,9 +156,9 @@ class UserFields extends BaseController
$previous
=
$userfield
;
}
if
(
isset
(
$editfield
[
'position'
]))
if
(
isset
(
$editfield
[
'position'
]))
{
$positionvalue
=
$positionoptions
[
$editfield
[
'position'
]];
else
{
}
else
{
$positionvalue
=
isset
(
$previous
)
?
qa_lang_html_sub
(
'admin/after_x'
,
qa_html
(
qa_user_userfield_label
(
$previous
)))
:
qa_lang_html
(
'admin/first'
);
$positionoptions
[
1
+
@
max
(
array_keys
(
$positionoptions
))]
=
$positionvalue
;
}
...
...
qa-src/Controllers/Admin/UserTitles.php
View file @
af7fb73a
...
...
@@ -58,19 +58,16 @@ class UserTitles extends BaseController
$securityexpired
=
false
;
if
(
qa_clicked
(
'docancel'
))
if
(
qa_clicked
(
'docancel'
))
{
qa_redirect
(
'admin/users'
);
elseif
(
qa_clicked
(
'dosavetitle'
))
{
}
elseif
(
qa_clicked
(
'dosavetitle'
))
{
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
if
(
!
qa_check_form_security_code
(
'admin/usertitles'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/usertitles'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
else
{
}
else
{
if
(
qa_post_text
(
'dodelete'
))
{
unset
(
$pointstitle
[
$oldpoints
]);
}
else
{
$intitle
=
qa_post_text
(
'title'
);
$inpoints
=
qa_post_text
(
'points'
);
...
...
@@ -82,9 +79,9 @@ class UserTitles extends BaseController
if
(
!
strlen
(
$intitle
))
$errors
[
'title'
]
=
qa_lang
(
'main/field_required'
);
if
(
!
is_numeric
(
$inpoints
))
if
(
!
is_numeric
(
$inpoints
))
{
$errors
[
'points'
]
=
qa_lang
(
'main/field_required'
);
else
{
}
else
{
$inpoints
=
(
int
)
$inpoints
;
if
(
isset
(
$pointstitle
[
$inpoints
])
&&
((
!
strlen
(
@
$oldpoints
))
||
(
$inpoints
!=
$oldpoints
)))
...
...
@@ -99,10 +96,10 @@ class UserTitles extends BaseController
unset
(
$pointstitle
[
$oldpoints
]);
$pointstitle
[
$newpoints
]
=
$newtitle
;
}
elseif
(
empty
(
$errors
))
// creating a new user title
}
elseif
(
empty
(
$errors
))
{
// creating a new user title
$pointstitle
[
$inpoints
]
=
$intitle
;
}
}
// Save the new option value
...
...
qa-src/Controllers/Admin/Widgets.php
View file @
af7fb73a
...
...
@@ -56,7 +56,6 @@ class Widgets extends BaseController
if
(
$widget
[
'widgetid'
]
==
$widgetid
)
$editwidget
=
$widget
;
}
}
else
{
$editwidget
=
array
(
'title'
=>
qa_post_text
(
'title'
));
if
(
!
isset
(
$editwidget
[
'title'
]))
...
...
@@ -129,7 +128,6 @@ class Widgets extends BaseController
if
(
$isPagePlugin
||
!
(
$page
[
'flags'
]
&
QA_PAGE_FLAGS_EXTERNAL
))
$templateoptions
[
'custom-'
.
$page
[
'pageid'
]]
=
qa_html
(
$page
[
'title'
]);
}
}
}
...
...
@@ -138,20 +136,17 @@ class Widgets extends BaseController
$securityexpired
=
false
;
if
(
qa_clicked
(
'docancel'
))
if
(
qa_clicked
(
'docancel'
))
{
qa_redirect
(
'admin/layout'
);
elseif
(
qa_clicked
(
'dosavewidget'
))
{
}
elseif
(
qa_clicked
(
'dosavewidget'
))
{
require_once
QA_INCLUDE_DIR
.
'db/admin.php'
;
if
(
!
qa_check_form_security_code
(
'admin/widgets'
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'admin/widgets'
,
qa_post_text
(
'code'
)))
{
$securityexpired
=
true
;
else
{
}
else
{
if
(
qa_post_text
(
'dodelete'
))
{
qa_db_widget_delete
(
$editwidget
[
'widgetid'
]);
qa_redirect
(
'admin/layout'
);
}
else
{
if
(
$widgetfound
)
{
$intitle
=
qa_post_text
(
'title'
);
...
...
@@ -173,7 +168,6 @@ class Widgets extends BaseController
if
(
isset
(
$editwidget
[
'widgetid'
]))
{
// changing existing widget
$widgetid
=
$editwidget
[
'widgetid'
];
qa_db_widget_set_fields
(
$widgetid
,
$intags
);
}
else
$widgetid
=
qa_db_widget_create
(
$intitle
,
$intags
);
...
...
@@ -325,7 +319,6 @@ class Widgets extends BaseController
'templates_display'
=>
'!(dodelete||template_all)'
,
'all_display'
=>
'!dodelete'
,
));
}
else
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'delete'
]);
qa_set_display_rules
(
$qa_content
,
array
(
...
...
@@ -341,7 +334,6 @@ class Widgets extends BaseController
unset
(
$qa_content
[
'form'
][
'fields'
][
'templates'
]);
if
(
!
isset
(
$editwidget
[
'widgetid'
]))
unset
(
$qa_content
[
'form'
][
'buttons'
][
'save'
]);
}
elseif
(
!
count
(
$positionoptions
))
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'title'
][
'tight'
]);
$qa_content
[
'form'
][
'fields'
][
'title'
][
'error'
]
=
qa_lang_html
(
'admin/widget_no_positions'
);
...
...
qa-src/Database/DbSelect.php
View file @
af7fb73a
...
...
@@ -394,5 +394,4 @@ class DbSelect
$outresult
=
count
(
$outresult
)
?
reset
(
$outresult
)
:
null
;
}
}
}
qa-tests/phpcs/ruleset-strict.xml
View file @
af7fb73a
...
...
@@ -13,6 +13,8 @@
<rule
ref=
"PSR2"
>
<exclude
name=
"Generic.WhiteSpace.DisallowTabIndent"
/>
<exclude
name=
"Generic.Files.LineLength.TooLong"
/>
<exclude
name=
"Generic.ControlStructures.InlineControlStructure"
/>
<exclude
name=
"Squiz.ControlStructures.ControlSignature"
/>
<!-- doesn't work without above rule -->
</rule>
<arg
name=
"tab-width"
value=
"4"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment