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
2e578079
Commit
2e578079
authored
Nov 21, 2016
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch Q2A version from GitHub using AJAX
parent
a5be93fa
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
24 deletions
+39
-24
qa-admin.js
qa-content/qa-admin.js
+2
-2
version.php
qa-include/ajax/version.php
+30
-18
admin-default.php
qa-include/pages/admin/admin-default.php
+1
-1
admin-plugins.php
qa-include/pages/admin/admin-plugins.php
+1
-1
admin-stats.php
qa-include/pages/admin/admin-stats.php
+5
-2
No files found.
qa-content/qa-admin.js
View file @
2e578079
...
@@ -134,9 +134,9 @@ function qa_admin_click(target)
...
@@ -134,9 +134,9 @@ function qa_admin_click(target)
return
false
;
return
false
;
}
}
function
qa_version_check
(
uri
,
version
,
elem
)
function
qa_version_check
(
uri
,
version
,
elem
,
isCore
)
{
{
var
params
=
{
uri
:
uri
,
version
:
version
};
var
params
=
{
uri
:
uri
,
version
:
version
,
isCore
:
isCore
};
qa_ajax_post
(
'version'
,
params
,
qa_ajax_post
(
'version'
,
params
,
function
(
lines
)
{
function
(
lines
)
{
...
...
qa-include/ajax/version.php
View file @
2e578079
...
@@ -30,41 +30,53 @@
...
@@ -30,41 +30,53 @@
$uri
=
qa_post_text
(
'uri'
);
$uri
=
qa_post_text
(
'uri'
);
$version
=
qa_post_text
(
'version'
);
$version
=
qa_post_text
(
'version'
);
$isCore
=
qa_post_text
(
'isCore'
)
===
"true"
;
if
(
$isCore
)
{
$contents
=
qa_retrieve_url
(
$uri
);
if
(
strlen
(
$contents
)
>
0
)
{
if
(
qa_qa_version_below
(
$contents
))
{
$response
=
'<a href="https://github.com/q2a/question2answer/releases" style="color:#d00;">'
.
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$contents
))
.
'</a>'
;
}
else
{
$response
=
qa_html
(
$contents
);
// Output the current version number
}
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest_unknown'
);
}
}
else
{
$metadataUtil
=
new
Q2A_Util_Metadata
();
$metadataUtil
=
new
Q2A_Util_Metadata
();
$metadata
=
$metadataUtil
->
fetchFromUrl
(
$uri
);
$metadata
=
$metadataUtil
->
fetchFromUrl
(
$uri
);
if
(
strlen
(
@
$metadata
[
'version'
])
)
{
if
(
strlen
(
@
$metadata
[
'version'
])
>
0
)
{
if
(
strcmp
(
$metadata
[
'version'
],
$version
))
{
if
(
strcmp
(
$metadata
[
'version'
],
$version
))
{
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
{
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_q2a'
),
array
(
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_q2a'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_q2a'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_q2a'
]),
));
));
}
}
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
{
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_php'
),
array
(
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_php'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_php'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_php'
]),
));
));
}
}
else
{
$response
=
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$metadata
[
'version'
]));
else
{
if
(
strlen
(
@
$metadata
[
'uri'
])){
$response
=
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$metadata
[
'version'
]));
$response
=
'<a href="'
.
qa_html
(
$metadata
[
'uri'
])
.
'" style="color:#d00;">'
.
$response
.
'</a>'
;
if
(
strlen
(
@
$metadata
[
'uri'
]))
$response
=
'<a href="'
.
qa_html
(
$metadata
[
'uri'
])
.
'" style="color:#d00;">'
.
$response
.
'</a>'
;
}
}
}
}
else
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest'
);
$response
=
qa_lang_html
(
'admin/version_latest'
);
}
}
else
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest_unknown'
);
$response
=
qa_lang_html
(
'admin/version_latest_unknown'
);
}
}
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$response
;
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$response
;
...
...
qa-include/pages/admin/admin-default.php
View file @
2e578079
...
@@ -1075,7 +1075,7 @@ foreach ($showoptions as $optionname) {
...
@@ -1075,7 +1075,7 @@ foreach ($showoptions as $optionname) {
$updatehtml
=
'(<span id="'
.
$elementid
.
'">...</span>)'
;
$updatehtml
=
'(<span id="'
.
$elementid
.
'">...</span>)'
;
$qa_content
[
'script_onloads'
][]
=
array
(
$qa_content
[
'script_onloads'
][]
=
array
(
"qa_version_check("
.
qa_js
(
$metadata
[
'update_uri'
])
.
", "
.
qa_js
(
$metadata
[
'version'
],
true
)
.
", "
.
qa_js
(
$elementid
)
.
");"
"qa_version_check("
.
qa_js
(
$metadata
[
'update_uri'
])
.
", "
.
qa_js
(
$metadata
[
'version'
],
true
)
.
", "
.
qa_js
(
$elementid
)
.
"
, false
);"
);
);
}
}
...
...
qa-include/pages/admin/admin-plugins.php
View file @
2e578079
...
@@ -153,7 +153,7 @@ if (!empty($pluginfiles)) {
...
@@ -153,7 +153,7 @@ if (!empty($pluginfiles)) {
$updatehtml
=
'(<span id="'
.
$elementid
.
'">...</span>)'
;
$updatehtml
=
'(<span id="'
.
$elementid
.
'">...</span>)'
;
$qa_content
[
'script_onloads'
][]
=
array
(
$qa_content
[
'script_onloads'
][]
=
array
(
"qa_version_check("
.
qa_js
(
$metadata
[
'update_uri'
])
.
", "
.
qa_js
(
$metadata
[
'version'
],
true
)
.
", "
.
qa_js
(
$elementid
)
.
");"
"qa_version_check("
.
qa_js
(
$metadata
[
'update_uri'
])
.
", "
.
qa_js
(
$metadata
[
'version'
],
true
)
.
", "
.
qa_js
(
$elementid
)
.
"
, false
);"
);
);
}
else
}
else
...
...
qa-include/pages/admin/admin-stats.php
View file @
2e578079
...
@@ -74,8 +74,7 @@ $qa_content['form'] = array(
...
@@ -74,8 +74,7 @@ $qa_content['form'] = array(
'q2a_latest'
=>
array
(
'q2a_latest'
=>
array
(
'label'
=>
qa_lang_html
(
'admin/q2a_latest_version'
),
'label'
=>
qa_lang_html
(
'admin/q2a_latest_version'
),
'type'
=>
'custom'
,
'type'
=>
'custom'
,
'html'
=>
'<iframe src="http://www.question2answer.org/question2answer-latest.php?version='
.
urlencode
(
QA_VERSION
)
.
'&language='
.
urlencode
(
qa_opt
(
'site_language'
))
.
'html'
=>
'<span id="q2a-version">...</span>'
,
'" width="100" height="16" style="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" scrolling="no" frameborder="0"></iframe>'
,
),
),
'break0'
=>
array
(
'break0'
=>
array
(
...
@@ -274,6 +273,10 @@ if (defined('QA_BLOBS_DIRECTORY')) {
...
@@ -274,6 +273,10 @@ if (defined('QA_BLOBS_DIRECTORY')) {
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-admin.js?'
.
QA_VERSION
;
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-admin.js?'
.
QA_VERSION
;
$qa_content
[
'script_var'
][
'qa_warning_recalc'
]
=
qa_lang
(
'admin/stop_recalc_warning'
);
$qa_content
[
'script_var'
][
'qa_warning_recalc'
]
=
qa_lang
(
'admin/stop_recalc_warning'
);
$qa_content
[
'script_onloads'
][]
=
array
(
"qa_version_check('https://raw.githubusercontent.com/q2a/question2answer/master/VERSION.txt', "
.
qa_js
(
qa_html
(
QA_VERSION
),
true
)
.
", 'q2a-version', true);"
);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
$qa_content
[
'navigation'
][
'sub'
]
=
qa_admin_sub_navigation
();
...
...
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