Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Jan 13, 2022
2 parents 4274dfc + e57d28c commit 1d0bfa1
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 38 deletions.
3 changes: 3 additions & 0 deletions public_html/.htaccess.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Options -Indexes -MultiViews
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

## Redirect 404 error to Geeklog error page
ErrorDocument 404 /404.php
9 changes: 5 additions & 4 deletions public_html/docs/english/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1907,20 +1907,20 @@ <h3><a name="misc_html">Miscellaneous: HTML Filtering</a></h3>
<td valign="top"><a name="desc_user_html">user_html</a></td>
<td valign="top">&lt;p&gt;, &lt;b&gt;, &lt;i&gt;, &lt;a&gt;, &lt;em&gt;, &lt;br&gt;, &lt;tt&gt;, &lt;hr&gt;, &lt;ol&gt;, &lt;ul&gt;, &lt;li&gt;, &lt;code&gt;, &lt;pre&gt;</td>
<td valign="top">HTML tags and attributes that normal users are allowed to
use in article submissions and comments.</td></tr>
use in article submissions and comments. To add an attribute for a tag click the plus button beside it.</td></tr>
<tr>
<td valign="top"><a name="desc_admin_html">admin_html</a></td>
<td valign="top">additional HTML tags, e.g. for tables</td>
<td valign="top">HTML tags and attributes that admin users are allowed to
use (in addition to those from user_html). Redefining a tag with
additional attributes will overwrite the definition from user_html.</td></tr>
additional attributes will overwrite the definition from user_html. To add an attribute for a tag click the plus button beside it.</td></tr>
<tr>
<td valign="top"><a name="desc_advanced_html">advanced_html</a></td>
<td valign="top">additional HTML tags for use with the Advanced Editor, e.g.
for images</td>
<td valign="top">Additional HTML tags and attributes that users are allowed
to use when the <a href="#desc_advanced_editor">Advanced Editor</a> is
enabled.</td></tr>
enabled. To add an attribute for a tag click the plus button beside it.</td></tr>
<tr>
<td valign="top"><a name="desc_skip_html_filter_for_root">skip_html_filter_for_root</a></td>
<td valign="top">0</td>
Expand Down Expand Up @@ -2553,7 +2553,8 @@ <h2><a name="url-routing">URL Routing</a></h2>
route in the URL Routing screen (admin/router.php).</p>
<p><strong>Note:</strong> This feature may not work with all web servers. It uses PHP's
$_SERVER['PATH_INFO'] variable. Please try it out before you go public with your site.</p>
<p><strong>Note:</strong> If you use URL Routing but remove or disable one of the predefined routes, that route will fallback to how URL Rewrite will display the URL. The only time this is not true is with Topics. If their routes are removed or disabled the URL Rewrite will be "https://www.example.com/@topic" and for paging "https://www.example.com/@topic/@page". The "topic" text place holder will not be present (see above URL Rewrite for examples). This is a current limitation of Geeklog and the router but shouldn't cause an issue as you could change the route to reflect the URL Rewrite url if needed.</p>
<p><strong>Note:</strong> The priority of the rules are important. For example a 301 redirect rule for an article will only get triggered if it is before other rules related to routing articles.</p>
<p><strong>Note:</strong> If you use URL Routing but remove or disable one of the predefined routes that also supports URL Rewrite, that route will fallback to how URL Rewrite will display the URL.</p>
<p><strong>Note:</strong> Only the Status Code "200" should be used. The other options currently do not work correctly and if used may cause unforeseen problems.</p>
<p><strong>Advanced feature:</strong> If you use IIS as a Web server and want to remove "index.php"
from URLs you access, you will have to create the appropriate web.config file in the same directory as lib-common.php, with the proper redirects defined.
Expand Down
1 change: 1 addition & 0 deletions public_html/docs/english/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ <h2><a name="changes222">Theme changes in Geeklog 2.2.2</a></h2>
<ul>
<li>New Block Header Child template called <span class="tt">blockheader-child.thtml</span>. This is used by User Profile page and allows for nesting blocks within the main block. This change required bumping Geeklog minimum version for themes to 2.2.2.</li>
<li>For the <span class="tt">users\profile.thtml</span> file, all {end_block} template variables updated with unique names.</li>
<li>Edit link for topics added to <span class="tt">topic.thtml</li>
</ul>

<h2><a name="changes221">Theme changes in Geeklog 2.2.1</a></h2>
Expand Down
1 change: 1 addition & 0 deletions public_html/docs/japanese/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ <h2><a name="changes222">Theme changes in Geeklog 2.2.2</a></h2>
<ul>
<li>New Block Header Child template called <span class="tt">blockheader-child.thtml</span>. This is used by User Profile page and allows for nesting blocks within the main block. This change required bumping Geeklog minimum version for themes to 2.2.2.</li>
<li>For the <span class="tt">users\profile.thtml</span> file, all {end_block} template variables updated with unique names.</li>
<li>Edit link for topics added to <span class="tt">topic.thtml</li>
</ul>

<h2><a name="changes221">Geeklog 2.2.1におけるテーマの変更点</a></h2>
Expand Down
26 changes: 26 additions & 0 deletions public_html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,32 @@ function fixTopic(&$A, $tid_list)
if ($page == 1) {
$tt->set_var('first_page', true);
}

if (!empty($current_topic) && SEC_hasRights('topic.edit') &&
(TOPIC_hasMultiTopicAccess('topic', $current_topic) == 3)) {
$editUrl = $_CONF['site_admin_url'] . '/topic.php?mode=edit&amp;tid=' . $current_topic;
$linkIcon = rtrim($_CONF['path_layout'], '/') . '/images/edit.' . $_IMAGE_TYPE;
$sizeAttributes = COM_getImgSizeAttributes($linkIcon);
$editiconhtml = '<img ' . $sizeAttributes . 'src="' . $_CONF['layout_url']
. '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG01[4]
. '" title="' . $LANG01[4] . '"' . XHTML . '>';
$tt->set_var('edit_link', COM_createLink($LANG01[4], $editUrl));
$tt->set_var('edit_url', $editUrl);
$tt->set_var('lang_edit_text', $LANG01[4]);
$tt->set_var(
'edit_icon',
COM_createLink(
$editiconhtml,
$editUrl,
array(
'class' => 'editlink',
'rel' => 'nofollow',
)
)
);
$tt->set_var('edit_image', $editiconhtml);
}

$tt->parse('output', 'topic');
$display = $tt->finish($tt->get_var('output'));

Expand Down
10 changes: 7 additions & 3 deletions public_html/layout/denim/topic.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
{# variables - index_page (first page) are available as well to use #}

{!if topic_id}
{!if topic_title}
<h1>{topic_title}</h1>
{!endif}
<h1>{topic_title}
{!if edit_icon}
<span class="story_icon">
<a title="{lang_edit_text}" href="{edit_url}" class="uk-icon-hover uk-icon-pencil" rel="nofollow" aria-label="{lang_edit_text}"></a>
</span>
{!endif}
</h1>
{!else}
{# If topic id does not exist then on homepage #}

Expand Down
10 changes: 7 additions & 3 deletions public_html/layout/denim_three/topic.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
{# variables - index_page (first page) are available as well to use #}

{!if topic_id}
{!if topic_title}
<h1>{topic_title}</h1>
{!endif}
<h1>{topic_title}
{!if edit_icon}
<span class="story_icon">
<a title="{lang_edit_text}" href="{edit_url}" class="uk-icon-link" rel="nofollow" uk-tooltip="{lang_edit_text}" uk-icon="pencil" aria-label="{lang_edit_text}"></a>
</span>
{!endif}
</h1>
{!else}
{# If topic id does not exist then on homepage #}

Expand Down
10 changes: 7 additions & 3 deletions public_html/layout/modern_curve/topic.thtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
{# variables - index_page (first page) are available as well to use #}

{!if topic_id}
{!if topic_title}
<h1>{topic_title}</h1>
{!endif}
<h1>{topic_title}
{!if edit_icon}
<span style="float:right;">
{edit_icon}
</span>
{!endif}
</h1>
{!else}
{# If topic id does not exist then on homepage #}

Expand Down
12 changes: 7 additions & 5 deletions system/classes/article.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -952,11 +952,13 @@ public function loadFromArgsArray(array &$array)
}

// Load up the topic name and icon
$topic = DB_query("SELECT tid, topic, imageurl FROM {$_TABLES['topics']} WHERE tid='" . TOPIC_getTopicDefault('topic') . "'");
$topic = DB_fetchArray($topic);
$this->_tid = $topic['tid'];
$this->_topic = $topic['topic'];
$this->_imageurl = $topic['imageurl'];
$result = DB_query("SELECT tid, topic, imageurl FROM {$_TABLES['topics']} WHERE tid='" . TOPIC_getTopicDefault('topic') . "'");
if ($result && (DB_numRows($result) > 0)) {
$topic = DB_fetchArray($result);
$this->_tid = $topic['tid'];
$this->_topic = $topic['topic'];
$this->_imageurl = $topic['imageurl'];
}

// Load the title, page title
$this->_title = $this->_applyTitleFilter($array['title']);
Expand Down
7 changes: 0 additions & 7 deletions system/classes/router.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ public static function dispatch()
}
}

// when URL routing is enabled but no rules for topics have matched the pathinfo,
// redirect to [site_url]/index.php/topic/{topic_id}
if (stripos($pathInfo, '/topic/') === 0) {
$url = $_CONF['site_url'] . '/index.php?topic=' . substr($pathInfo, strlen('/topic/'));
header('Location: ' . $url);
}

return false;
}

Expand Down
23 changes: 14 additions & 9 deletions system/classes/url.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,22 @@ public function setArgNames(array $names)
if ($this->urlRouting) {
// Grab converted original route url from router class and then parse query string into array
parse_str( parse_url(Router::getRoute(), PHP_URL_QUERY), $this->arguments);
} else {
$this->arguments = $this->originalArguments;

$newArray = array();

// If empty array returned then possible no routes found so fallback to rewrite
if(!empty($this->arguments)) {
return true;
}
}

$this->arguments = $this->originalArguments;

$newArray = array();

foreach ($names as $name) {
$newArray[$name] = array_shift($this->arguments);
}
foreach ($names as $name) {
$newArray[$name] = array_shift($this->arguments);
}

$this->arguments = $newArray;
}
$this->arguments = $newArray;

return true;
} else {
Expand Down
10 changes: 6 additions & 4 deletions system/lib-topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,11 @@ function TOPIC_getList($sortcol = 0, $ignorelang = true, $title = true, $access
*
* @param string $type Type of object to find topic access about. If 'topic' then
* will check post array for topic selection control
* @param string/array $id ID of object to check topic access for (not requried
* @param string/array $id ID of object to check topic access for (not required
* if $type is 'topic')
* @param string/array $tid ID of topic to check topic access for (not requried
* @param string/array $tid ID of topic to check topic access for (not required
* and not used if $type is 'topic'). Also can just specify this
* @param string $sub_type Sub type of plugin to allow plugins to have topic assigments for more than one type of item.
* @param string $sub_type Sub type of plugin to allow plugins to have topic assignments for more than one type of item.
* @return int returns 3 for read/edit 2 for read only 0 for no access
*/
function TOPIC_hasMultiTopicAccess($type, $id = '', $tid = '', $sub_type = '')
Expand Down Expand Up @@ -668,7 +668,9 @@ function TOPIC_hasMultiTopicAccess($type, $id = '', $tid = '', $sub_type = '')
$result = DB_query($sql);
$A = DB_fetchArray($result);
$nrows = DB_numRows($result);
$tid = $A['tid'];
if ($nrows > 0) {
$tid = $A['tid'];
}
} else {
if (is_array($tid)) {
$nrows = count($tid);
Expand Down

0 comments on commit 1d0bfa1

Please sign in to comment.