mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-51239 core_blog: coding style fixes
This commit is contained in:
parent
c18acb8997
commit
0e32a56591
8 changed files with 88 additions and 84 deletions
|
@ -40,13 +40,13 @@ $search = optional_param('search', null, PARAM_RAW);
|
|||
|
||||
comment::init();
|
||||
|
||||
$url_params = compact('id', 'start', 'tag', 'userid', 'tagid', 'modid', 'entryid', 'groupid', 'courseid', 'search');
|
||||
foreach ($url_params as $var => $val) {
|
||||
$urlparams = compact('id', 'start', 'tag', 'userid', 'tagid', 'modid', 'entryid', 'groupid', 'courseid', 'search');
|
||||
foreach ($urlparams as $var => $val) {
|
||||
if (empty($val)) {
|
||||
unset($url_params[$var]);
|
||||
unset($urlparams[$var]);
|
||||
}
|
||||
}
|
||||
$PAGE->set_url('/blog/index.php', $url_params);
|
||||
$PAGE->set_url('/blog/index.php', $urlparams);
|
||||
|
||||
// Correct tagid if a text tag is provided as a param.
|
||||
if (!empty($tag)) {
|
||||
|
@ -121,7 +121,7 @@ if (!empty($groupid) && empty($courseid)) {
|
|||
|
||||
if (!$userid && has_capability('moodle/blog:view', $sitecontext) && $CFG->bloglevel > BLOG_USER_LEVEL) {
|
||||
if ($entryid) {
|
||||
if (!$entryobject = $DB->get_record('post', array('id'=>$entryid))) {
|
||||
if (!$entryobject = $DB->get_record('post', array('id' => $entryid))) {
|
||||
print_error('nosuchentry', 'blog');
|
||||
}
|
||||
$userid = $entryobject->userid;
|
||||
|
@ -148,12 +148,12 @@ if ((empty($courseid) ? true : $courseid == SITEID) && empty($userid)) {
|
|||
print_error('cannotviewsiteblog', 'blog');
|
||||
}
|
||||
|
||||
$COURSE = $DB->get_record('course', array('format'=>'site'));
|
||||
$COURSE = $DB->get_record('course', array('format' => 'site'));
|
||||
$courseid = $COURSE->id;
|
||||
}
|
||||
|
||||
if (!empty($courseid)) {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ if (!empty($groupid)) {
|
|||
print_error(get_string('invalidgroupid', 'blog'));
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$group->courseid))) {
|
||||
if (!$course = $DB->get_record('course', array('id' => $group->courseid))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ if (!empty($userid)) {
|
|||
print_error('blogdisable', 'blog');
|
||||
}
|
||||
|
||||
if (!$user = $DB->get_record('user', array('id'=>$userid))) {
|
||||
if (!$user = $DB->get_record('user', array('id' => $userid))) {
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue