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
f3810d35
Commit
f3810d35
authored
Jan 12, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (index)
parent
daeb8c4a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
37 deletions
+32
-37
index.php
index.php
+2
-8
qa-index.php
qa-include/qa-index.php
+30
-29
No files found.
index.php
View file @
f3810d35
...
...
@@ -22,11 +22,6 @@
// Set base path here so this works with symbolic links for multiple installations
define
(
'QA_BASE_DIR'
,
dirname
(
empty
(
$_SERVER
[
'SCRIPT_FILENAME'
])
?
__FILE__
:
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/'
);
define
(
'QA_BASE_DIR'
,
dirname
(
empty
(
$_SERVER
[
'SCRIPT_FILENAME'
])
?
__FILE__
:
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/'
);
require
'qa-include/qa-index.php'
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
require
'qa-include/qa-index.php'
;
qa-include/qa-index.php
View file @
f3810d35
...
...
@@ -22,22 +22,26 @@
// Try our best to set base path here just in case it wasn't set in index.php (pre version 1.0.1)
if
(
!
defined
(
'QA_BASE_DIR'
))
define
(
'QA_BASE_DIR'
,
dirname
(
empty
(
$_SERVER
[
'SCRIPT_FILENAME'
])
?
dirname
(
__FILE__
)
:
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/'
);
if
(
!
defined
(
'QA_BASE_DIR'
))
{
define
(
'QA_BASE_DIR'
,
dirname
(
empty
(
$_SERVER
[
'SCRIPT_FILENAME'
])
?
dirname
(
__FILE__
)
:
$_SERVER
[
'SCRIPT_FILENAME'
])
.
'/'
);
}
// If this is an special non-page request, branch off here
if
(
isset
(
$_POST
[
'qa'
])
&&
$_POST
[
'qa'
]
==
'ajax'
)
if
(
isset
(
$_POST
[
'qa'
])
&&
$_POST
[
'qa'
]
==
'ajax'
)
{
require
'qa-ajax.php'
;
}
elseif
(
isset
(
$_GET
[
'qa'
])
&&
$_GET
[
'qa'
]
==
'image'
)
elseif
(
isset
(
$_GET
[
'qa'
])
&&
$_GET
[
'qa'
]
==
'image'
)
{
require
'qa-image.php'
;
}
elseif
(
isset
(
$_GET
[
'qa'
])
&&
$_GET
[
'qa'
]
==
'blob'
)
elseif
(
isset
(
$_GET
[
'qa'
])
&&
$_GET
[
'qa'
]
==
'blob'
)
{
require
'qa-blob.php'
;
}
else
{
else
{
// Otherwise, load the Q2A base file which sets up a bunch of crucial stuff
...
...
@@ -68,7 +72,7 @@
$questionpos
=
strpos
(
$origpath
,
'?'
);
if
(
is_numeric
(
$questionpos
))
{
$params
=
explode
(
'&'
,
substr
(
$origpath
,
$questionpos
+
1
));
$params
=
explode
(
'&'
,
substr
(
$origpath
,
$questionpos
+
1
));
foreach
(
$params
as
$param
)
{
if
(
preg_match
(
'/^([^\=]*)(\=(.*))?$/'
,
$param
,
$matches
))
{
...
...
@@ -101,28 +105,25 @@
}
$relativedepth
=
count
(
$requestparts
);
}
elseif
(
isset
(
$_GET
[
'qa'
]))
{
}
elseif
(
isset
(
$_GET
[
'qa'
]))
{
if
(
strpos
(
$_GET
[
'qa'
],
'/'
)
===
false
)
{
$urlformat
=
(
empty
(
$_SERVER
[
'REQUEST_URI'
])
||
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'/index.php'
)
!==
false
)
$urlformat
=
(
empty
(
$_SERVER
[
'REQUEST_URI'
])
||
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'/index.php'
)
!==
false
)
?
QA_URL_FORMAT_SAFEST
:
QA_URL_FORMAT_PARAMS
;
$requestparts
=
array
(
qa_gpc_to_string
(
$_GET
[
'qa'
]));
for
(
$part
=
1
;
$part
<
10
;
$part
++
)
{
if
(
isset
(
$_GET
[
'qa_'
.
$part
]))
{
$requestparts
[]
=
qa_gpc_to_string
(
$_GET
[
'qa_'
.
$part
]);
unset
(
$_GET
[
'qa_'
.
$part
]);
}
if
(
isset
(
$_GET
[
'qa_'
.
$part
]))
{
$requestparts
[]
=
qa_gpc_to_string
(
$_GET
[
'qa_'
.
$part
]);
unset
(
$_GET
[
'qa_'
.
$part
]);
}
}
else
{
}
else
{
$urlformat
=
QA_URL_FORMAT_PARAM
;
$requestparts
=
explode
(
'/'
,
qa_gpc_to_string
(
$_GET
[
'qa'
]));
}
unset
(
$_GET
[
'qa'
]);
}
else
{
}
else
{
$normalizedpath
=
strtr
(
$_SERVER
[
'PHP_SELF'
],
'+'
,
' '
);
// seems necessary, and plus does not work with this scheme
$indexpath
=
'/index.php/'
;
$indexpos
=
strpos
(
$normalizedpath
,
$indexpath
);
...
...
@@ -142,8 +143,7 @@
$urlformat
=
QA_URL_FORMAT_INDEX
;
$requestparts
=
explode
(
'/'
,
substr
(
$normalizedpath
,
$indexpos
+
strlen
(
$indexpath
)));
$relativedepth
=
1
+
count
(
$requestparts
);
}
else
{
}
else
{
$urlformat
=
null
;
// at home page so can't identify path type
$requestparts
=
array
();
}
...
...
@@ -176,19 +176,20 @@
$requestlower
=
strtolower
(
qa_request
());
if
(
$requestlower
==
'install'
)
require
QA_INCLUDE_DIR
.
'qa-install.php'
;
elseif
(
$requestlower
==
'url/test/'
.
QA_URL_TEST_STRING
)
require
QA_INCLUDE_DIR
.
'qa-url-test.php'
;
else
{
if
(
$requestlower
==
'install'
)
{
require
QA_INCLUDE_DIR
.
'qa-install.php'
;
}
elseif
(
$requestlower
==
'url/test/'
.
QA_URL_TEST_STRING
)
{
require
QA_INCLUDE_DIR
.
'qa-url-test.php'
;
}
else
{
// enable gzip compression for output (needs to come early)
qa_initialize_buffering
(
$requestlower
);
if
(
substr
(
$requestlower
,
0
,
5
)
==
'feed/'
)
require
QA_INCLUDE_DIR
.
'qa-feed.php'
;
else
require
QA_INCLUDE_DIR
.
'qa-page.php'
;
if
(
substr
(
$requestlower
,
0
,
5
)
==
'feed/'
)
{
require
QA_INCLUDE_DIR
.
'qa-feed.php'
;
}
else
{
require
QA_INCLUDE_DIR
.
'qa-page.php'
;
}
}
}
qa_report_process_stage
(
'shutdown'
);
qa_report_process_stage
(
'shutdown'
);
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