Skip to content

Commit

Permalink
Fixed a bug where clicking on 'comment' link caused an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Dec 11, 2016
1 parent 370ba49 commit cc0f09f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
2 changes: 2 additions & 0 deletions public_html/article.php
Expand Up @@ -133,6 +133,8 @@
);

$output = STORY_LOADED_OK;
$svc_msg = array();
$output = array();
$result = PLG_invokeService('story', 'get', $args, $output, $svc_msg);

if ($result == PLG_RET_OK) {
Expand Down
6 changes: 3 additions & 3 deletions system/lib-plugins.php
Expand Up @@ -2770,13 +2770,13 @@ function PLG_invokeService($type, $action, $args, &$output, &$svc_msg)

$retval = PLG_RET_ERROR;

if ($type == 'story') {
if ($type === 'story') {
// ensure we can see the service_XXX_story functions
require_once $_CONF['path_system'] . 'lib-story.php';
}

$output = '';
$svc_msg = '';
$output = array();
$svc_msg = array();

// Check if the plugin type and action are valid
$function = 'service_' . $action . '_' . $type;
Expand Down
62 changes: 31 additions & 31 deletions system/lib-story.php
Expand Up @@ -58,10 +58,10 @@
* Formats the given article into HTML. Called by index.php, article.php,
* submit.php and admin/story.php (Preview mode for the last two).
*
* @param Story $story The story to display, an instance of the Story class.
* @param string $index n = Full display of article. p = 'Preview' mode. Else introtext only.
* @param string $storyTpl The template to use to render the story.
* @param string $query A search query, if one was specified.
* @param Story $story The story to display, an instance of the Story class.
* @param string $index n = Full display of article. p = 'Preview' mode. Else introtext only.
* @param string $storyTpl The template to use to render the story.
* @param string $query A search query, if one was specified.
* @return string Article as formatted HTML.
* Note: Formerly named COM_Article, and re-written totally since then.
*/
Expand Down Expand Up @@ -894,8 +894,8 @@ function STORY_deleteStory($sid)
'sid' => $sid,
);

$output = '';

$output = array();
$svc_msg = array();
PLG_invokeService('story', 'delete', $args, $output, $svc_msg);

return $output;
Expand Down Expand Up @@ -1458,26 +1458,25 @@ function plugin_group_changed_story($grp_id, $mode)
/**
* Implements the [story:] autotag.
*
* @param string $op operation to perform
* @param string $content item (e.g. story text), including the autotag
* @param array $autotag parameters used in the autotag
* @param mixed tag names (for $op='tagname') or formatted content
* @param string $op operation to perform
* @param string $content item (e.g. story text), including the autotag
* @param array $autotag parameters used in the autotag
* @return mixed tag names (for $op='tagname') or formatted content
*/
function plugin_autotags_story($op, $content = '', $autotag = '')
function plugin_autotags_story($op, $content = '', $autotag = array())
{
global $_CONF, $_TABLES, $LANG24, $_GROUPS;

if ($op == 'tagname') {
if ($op === 'tagname') {
return 'story';
} elseif ($op == 'permission' || $op == 'nopermission') {
} elseif ($op === 'permission' || $op === 'nopermission') {
$flag = ($op == 'permission');
$tagnames = array();

if (isset($_GROUPS['Story Admin'])) {
$group_id = $_GROUPS['Story Admin'];
} else {
$group_id = DB_getItem($_TABLES['groups'], 'grp_id',
"grp_name = 'Story Admin'");
$group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Story Admin'");
}
$owner_id = SEC_getDefaultRootUser();
$p = 'autotag_permissions_story';
Expand Down Expand Up @@ -1739,9 +1738,9 @@ function plugin_configchange_article($group, $changes = array())
/**
* Submit a new or updated story. The story is updated if it exists, or a new one is created
*
* @param array args Contains all the data provided by the client
* @param string &output OUTPUT parameter containing the returned text
* @return int Response code as defined in lib-plugins.php
* @param array $args Contains all the data provided by the client
* @param string $output OUTPUT parameter containing the returned text
* @return int Response code as defined in lib-plugins.php
*/
function service_submit_story($args, &$output, &$svc_msg)
{
Expand Down Expand Up @@ -2030,7 +2029,6 @@ function service_submit_story($args, &$output, &$svc_msg)
}

if (count($_FILES) > 0 && $_CONF['maximagesperarticle'] > 0) {
require_once($_CONF['path_system'] . 'classes/upload.class.php');
$upload = new Upload();

if (isset ($_CONF['debug_image_upload']) && $_CONF['debug_image_upload']) {
Expand Down Expand Up @@ -2166,9 +2164,10 @@ function service_submit_story($args, &$output, &$svc_msg)
/**
* Delete an existing story
*
* @param array args Contains all the data provided by the client
* @param string &output OUTPUT parameter containing the returned text
* @return int Response code as defined in lib-plugins.php
* @param array $args Contains all the data provided by the client
* @param string $output OUTPUT parameter containing the returned text
* @param array $svc_msg
* @return int Response code as defined in lib-plugins.php
*/
function service_delete_story($args, &$output, &$svc_msg)
{
Expand Down Expand Up @@ -2209,19 +2208,19 @@ function service_delete_story($args, &$output, &$svc_msg)
/**
* Get an existing story
*
* @param array args Contains all the data provided by the client
* @param string &output OUTPUT parameter containing the returned text
* @return int Response code as defined in lib-plugins.php
* @param array $args Contains all the data provided by the client
* @param array $output OUTPUT parameter containing the returned text
* @param array $svc_msg
* @return int Response code as defined in lib-plugins.php
*/
function service_get_story($args, &$output, &$svc_msg)
{
global $_CONF, $_TABLES, $_USER;

$output = array();
$retval = '';
$retval = 0;

if (!isset($_CONF['atom_max_stories'])) {
$_CONF['atom_max_stories'] = 10; // set a resonable default
$_CONF['atom_max_stories'] = 10; // set a reasonable default
}

$svc_msg['output_fields'] = array(
Expand Down Expand Up @@ -2409,9 +2408,10 @@ function service_get_story($args, &$output, &$svc_msg)
/**
* Get all the topics available
*
* @param array args Contains all the data provided by the client
* @param string &output OUTPUT parameter containing the returned text
* @return int Response code as defined in lib-plugins.php
* @param array $args Contains all the data provided by the client
* @param array $output OUTPUT parameter containing the returned text
* @param array $svc_msg
* @return int Response code as defined in lib-plugins.php
*/
function service_getTopicList_story($args, &$output, &$svc_msg)
{
Expand Down

0 comments on commit cc0f09f

Please sign in to comment.