eSmalsa
Skip to main content

Blog entry by Smalsa Admin

Whoops! There was an error.
comment_exception
Invalid comment parameters comment_exception thrown with message "Invalid comment parameters" Stacktrace: #6 comment_exception in /home/elearningsmalsas/public_html/comment/lib.php:966 #5 comment:validate in /home/elearningsmalsas/public_html/comment/lib.php:975 #4 comment:can_view in /home/elearningsmalsas/public_html/comment/lib.php:441 #3 comment:output in /home/elearningsmalsas/public_html/theme/edash/renderers/blog-renderer.php:221 #2 theme_edash_core_blog_renderer:render_blog_entry in /home/elearningsmalsas/public_html/lib/classes/output/plugin_renderer_base.php:78 #1 core\output\plugin_renderer_base:render in /home/elearningsmalsas/public_html/blog/locallib.php:839 #0 blog_listing:print_entries in /home/elearningsmalsas/public_html/blog/index.php:174
Stack frames (7)
6
comment_exception
/comment/lib.php966
5
comment validate
/comment/lib.php975
4
comment can_view
/comment/lib.php441
3
comment output
/theme/edash/renderers/blog-renderer.php221
2
theme_edash_core_blog_renderer render_blog_entry
/lib/classes/output/plugin_renderer_base.php78
1
core\output\plugin_renderer_base render
/blog/locallib.php839
0
blog_listing print_entries
/blog/index.php174
/home/elearningsmalsas/public_html/comment/lib.php
        $replacements[] = html_writer::link($cmt->profileurl, $cmt->fullname);
        $replacements[] = $cmt->content;
        $replacements[] = $cmt->time;
 
        // use html template to format a single comment.
        return str_replace($patterns, $replacements, $this->template);
    }
 
    /**
     * Revoke validate callbacks
     *
     * @param array $params addtionall parameters need to add to callbacks
     */
    protected function validate($params=array()) {
        foreach ($params as $key=>$value) {
            $this->comment_param->$key = $value;
        }
        $validation = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'validate', array($this->comment_param), false);
        if (!$validation) {
            throw new comment_exception('invalidcommentparam');
        }
    }
 
    /**
     * Returns true if the user is able to view comments
     * @return bool
     */
    public function can_view() {
        $this->validate();
        return !empty($this->viewcap);
    }
 
    /**
     * Returns true if the user can add comments against this comment description
     * @return bool
     */
    public function can_post() {
        $this->validate();
        return isloggedin() && !empty($this->postcap);
    }
/home/elearningsmalsas/public_html/comment/lib.php
     * Revoke validate callbacks
     *
     * @param array $params addtionall parameters need to add to callbacks
     */
    protected function validate($params=array()) {
        foreach ($params as $key=>$value) {
            $this->comment_param->$key = $value;
        }
        $validation = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'validate', array($this->comment_param), false);
        if (!$validation) {
            throw new comment_exception('invalidcommentparam');
        }
    }
 
    /**
     * Returns true if the user is able to view comments
     * @return bool
     */
    public function can_view() {
        $this->validate();
        return !empty($this->viewcap);
    }
 
    /**
     * Returns true if the user can add comments against this comment description
     * @return bool
     */
    public function can_post() {
        $this->validate();
        return isloggedin() && !empty($this->postcap);
    }
 
    /**
     * Returns true if the user can delete this comment.
     *
     * The user can delete comments if it is one they posted and they can still make posts,
     * or they have the capability to delete comments.
     *
     * A database call is avoided if a comment record is passed.
     *
/home/elearningsmalsas/public_html/comment/lib.php
     * Prepare comment code in html
     * @param  boolean $return
     * @return string|void
     */
    public function output($return = true) {
        global $PAGE, $OUTPUT;
        static $template_printed;
 
        $this->initialise_javascript($PAGE);
 
        if (!empty(self::$nonjs)) {
            // return non js comments interface
            return $this->print_comments(self::$comment_page, $return, true);
        }
 
        $html = '';
 
        // print html template
        // Javascript will use the template to render new comments
        if (empty($template_printed) && $this->can_view()) {
            $html .= html_writer::tag('div', $this->template, array('style' => 'display:none', 'id' => 'cmt-tmpl'));
            $template_printed = true;
        }
 
        if ($this->can_view()) {
            // print commenting icon and tooltip
            $html .= html_writer::start_tag('div', array('class' => 'mdl-left'));
            $html .= html_writer::link($this->get_nojslink($PAGE), get_string('showcommentsnonjs'), array('class' => 'showcommentsnonjs'));
 
            if (!$this->notoggle) {
                // If toggling is enabled (notoggle=false) then print the controls to toggle
                // comments open and closed
                $countstring = '';
                if ($this->displaytotalcount) {
                    $countstring = '(' . html_writer::span($this->count(), 'comment-link-count') . ')';
                }
                $collapsedimage= 't/collapsed';
                if (right_to_left()) {
                    $collapsedimage= 't/collapsed_rtl';
                } else {
/home/elearningsmalsas/public_html/theme/edash/renderers/blog-renderer.php
                // Comments.
                if (!empty($entry->renderable->comment)) {
                    
                    global $DB, $CFG, $PAGE, $USER, $COURSE;

                    $cmt = new stdClass();
                    $cmt->context = context_user::instance($entry->userid);
                    $cmt->courseid = $PAGE->course->id;
                    $cmt->area = 'format_blog';
                    $cmt->itemid = $entry->id;
                    $cmt->notoggle  = true;
                    $cmt->showcount = $CFG->blogshowcommentscount;
                    $cmt->component = 'blog';
                    $cmt->autostart = true;
                    $cmt->displaycancel = false;
                    $edash_comments = new comment($cmt);
                    $edash_comments->set_view_permission(true);
                    $edash_comments->set_fullwidth();

                    $o .= $edash_comments->output(true);
                }
            $o .= $this->output->container_end();
            // Closing maincontent div.
            $o .= $this->output->container('', 'side options');
            $o .= $this->output->container_end();

        endif;
        return $o;
    }

    /**
     * Renders an entry attachment
     *
     * Print link for non-images and returns images as HTML
     *
     * @param blog_entry_attachment $attachment
     * @return string List of attachments depending on the $return input
     */
    public function render_blog_entry_attachment(blog_entry_attachment $attachment) {

/home/elearningsmalsas/public_html/lib/classes/output/plugin_renderer_base.php
     * @param renderable $widget instance with renderable interface
     * @return string
     */
    public function render(renderable $widget) {
        $classname = get_class($widget);
 
        // Strip namespaces.
        $classname = preg_replace('/^.*\\\/', '', $classname);
 
        // Keep a copy at this point, we may need to look for a deprecated method.
        $deprecatedmethod = "render_{$classname}";
 
        // Remove _renderable suffixes.
        $classname = preg_replace('/_renderable$/', '', $classname);
        $rendermethod = "render_{$classname}";
 
        if (method_exists($this, $rendermethod)) {
            // Call the render_[widget_name] function.
            // Note: This has a higher priority than the named_templatable to allow the theme to override the template.
            return $this->$rendermethod($widget);
        }
 
        if ($widget instanceof named_templatable) {
            // This is a named templatable.
            // Fetch the template name from the get_template_name function instead.
            // Note: This has higher priority than the deprecated method which is not overridable by themes anyway.
            return $this->render_from_template(
                $widget->get_template_name($this),
                $widget->export_for_template($this)
            );
        }
 
        if ($rendermethod !== $deprecatedmethod && method_exists($this, $deprecatedmethod)) {
            // This is exactly where we don't want to be.
            // If you have arrived here you have a renderable component within your plugin that has the name
            // blah_renderable, and you have a render method render_blah_renderable on your plugin.
            // In 2.8 we revamped output, as part of this change we changed slightly how renderables got rendered
            // and the _renderable suffix now gets removed when looking for a render method.
            // You need to change your renderers render_blah_renderable to render_blah.
            // Until you do this it will not be possible for a theme to override the renderer to override your method.
/home/elearningsmalsas/public_html/blog/locallib.php
                                   'search' => optional_param('search', null, PARAM_INT));
 
                $urlparams = array_filter($urlparams);
                $addurl->params($urlparams);
 
                $addlink = '<div class="addbloglink">';
                $addlink .= '<a href="'.$addurl->out().'">'. $blogheaders['stradd'].'</a>';
                $addlink .= '</div>';
                echo $addlink;
            }
        }
 
        if ($entries) {
            $count = 0;
            foreach ($entries as $entry) {
                $blogentry = new blog_entry(null, $entry);
 
                // Get the required blog entry data to render it.
                $blogentry->prepare_render();
                echo $output->render($blogentry);
 
                $count++;
            }
 
            echo $OUTPUT->render($pagingbar);
 
            if (!$count) {
                print '<br /><div style="text-align:center">'. get_string('noentriesyet', 'blog') .'</div><br />';
            }
 
            print $morelink.'<br />'."\n";
            return;
        }
    }
 
    // Find the base url from $_GET variables, for print_paging_bar.
    public function get_baseurl() {
        $getcopy  = $_GET;
 
        unset($getcopy['blogpage']);
/home/elearningsmalsas/public_html/blog/index.php
    echo $OUTPUT->header();
 
    if (!empty($user)) {
        $backurl = new moodle_url('/user/view.php', ['id' => $user->id, 'course' => $courseid]);
        echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']);
 
        $headerinfo = array('heading' => fullname($user), 'user' => $user);
        echo $OUTPUT->context_header($headerinfo, 2);
    }
} else if (isset($userid)) {
    $PAGE->set_heading(fullname($user));
    echo $OUTPUT->header();
} else if ($courseid == SITEID) {
    echo $OUTPUT->header();
}
 
echo $OUTPUT->heading($blogheaders['heading'], 2);
 
$bloglisting = new blog_listing($blogheaders['filters']);
$bloglisting->print_entries();
 
if ($CFG->enablerssfeeds) {
    blog_rss_print_link($rsscontext, $filtertype, $thingid, $tagid, get_string('rssfeed', 'blog'));
}
 
echo $OUTPUT->footer();
$eventparams = array(
    'other' => array('entryid' => $entryid, 'tagid' => $tagid, 'userid' => $userid, 'modid' => $modid, 'groupid' => $groupid,
                     'search' => $search, 'fromstart' => $start)
);
if (!empty($userid)) {
    $eventparams['relateduserid'] = $userid;
}
$eventparams['other']['courseid'] = ($courseid === SITEID) ? 0 : $courseid;
$event = \core\event\blog_entries_viewed::create($eventparams);
$event->trigger();
 

Environment & details:

Key Value
entryid 1
empty
empty
empty
Key Value
USER stdClass Object ( [id] => 0 [mnethostid] => 1 [access] => Array ( [ra] => Array ( [/1] => Array ( [6] => 6 ) ) [time] => 1750213815 [rsw] => Array ( ) ) [enrol] => Array ( [enrolled] => Array ( ) [tempguest] => Array ( ) ) [sesskey] => HLioOHivIx [preference] => Array ( ) )
SESSION stdClass Object ( [isnewsessioncookie] => 1 )
Key Value
TZ UTC
REDIRECT_UNIQUE_ID aFIks1C-doQ0hpK7q5_cxwAAAAA
REDIRECT_SCRIPT_URL /blog/index.php
REDIRECT_SCRIPT_URI https://elearning.smalsa.sch.id/blog/index.php
REDIRECT_HTTPS on
REDIRECT_SSL_TLS_SNI elearning.smalsa.sch.id
REDIRECT_HANDLER application/x-httpd-ea-php82
REDIRECT_STATUS 200
UNIQUE_ID aFIks1C-doQ0hpK7q5_cxwAAAAA
SCRIPT_URL /blog/index.php
SCRIPT_URI https://elearning.smalsa.sch.id/blog/index.php
HTTPS on
SSL_TLS_SNI elearning.smalsa.sch.id
HTTP_USER_AGENT CCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.5
HTTP_ACCEPT_ENCODING br,gzip
HTTP_HOST elearning.smalsa.sch.id
HTTP_CONNECTION Keep-Alive
HTTP_X_HTTPS 1
PATH /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
SERVER_SIGNATURE
SERVER_SOFTWARE Apache
SERVER_NAME elearning.smalsa.sch.id
SERVER_ADDR 202.52.147.180
SERVER_PORT 443
REMOTE_ADDR 18.97.9.175
DOCUMENT_ROOT /home/elearningsmalsas/public_html
REQUEST_SCHEME https
CONTEXT_PREFIX /cgi-sys
CONTEXT_DOCUMENT_ROOT /usr/local/cpanel/cgi-sys/
SERVER_ADMIN webmaster@elearning.smalsa.sch.id
SCRIPT_FILENAME /home/elearningsmalsas/public_html/blog/index.php
REMOTE_PORT 33924
REDIRECT_URL /blog/index.php
REDIRECT_QUERY_STRING entryid=1
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING entryid=1
REQUEST_URI /blog/index.php?entryid=1
SCRIPT_NAME /blog/index.php
ORIG_SCRIPT_FILENAME /usr/local/cpanel/cgi-sys/ea-php82
ORIG_PATH_INFO /blog/index.php
ORIG_PATH_TRANSLATED /home/elearningsmalsas/public_html/blog/index.php
ORIG_SCRIPT_NAME /cgi-sys/ea-php82
PHP_SELF /blog/index.php
REQUEST_TIME_FLOAT 1750213811.0801
REQUEST_TIME 1750213811
argv Array ( [0] => entryid=1 )
argc 1
empty
0. Whoops\Handler\PrettyPageHandler
1. Whoops\Handler\CallbackHandler