Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on #2972 Template Conversion to Twig Format (warnings.php) #2975

Merged
merged 4 commits into from
Jan 8, 2018
Merged

Working on #2972 Template Conversion to Twig Format (warnings.php) #2975

merged 4 commits into from
Jan 8, 2018

Conversation

Starpaul20
Copy link
Member

@Starpaul20 Starpaul20 commented Jan 6, 2018

Working on #2972

This PR is for the warning system (warnings.php).

@euantorano
Copy link
Member

Nice!

@@ -0,0 +1,31 @@
{% set row = alt_trow() %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinsoltesz was talking about completely removing alternating row classes. I've left them in the templates I've done too, but we might end up removing them (and the function) completely...

<tr>
<td class="thead" colspan="5">
{% if warning_level > 0 %}
<div class="float_right">{{ trans('current_warning_level', warning_level, user.warningpoints, mybb.settings.maxwarningpoints)|raw }}</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth marking the trans function as HTML safe... There are quite a few translations that have HTML in them unfortunately.

warnings.php Outdated
ORDER BY w.expired ASC, w.dateline DESC
LIMIT {$start}, {$perpage}
");
while($warning = $db->fetch_array($query))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you've fixed codestyle elsewhere in this code, here's another one 😄

}

$warning['username'] = htmlspecialchars_uni($warning['username']);
$warning['issuedby'] = build_profile_link($warning['username'], $warning['issuedby']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add this as a Twig function which is HTML safe. It's used fairly often afterall.

We should maybe add a CoreExtension (or MybbExtension or some other name) with some utilities like this, my_date, and probably afew others.

warnings.php Outdated
$warning_type = $warning['title'];
}

$warning['warning_type'] = htmlspecialchars_uni($warning_type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be escaped in the template too, so you can remove the htmlspecialchars_uni here or else it will be double escaped and look weird.

@Ben-MyBB Ben-MyBB added the b:1.9 Branch: 1.9.x label Jan 7, 2018
@Starpaul20
Copy link
Member Author

Done. All templates in warnings.php have been converted

@Starpaul20
Copy link
Member Author

We should consider adding some Twig functions for the following:

  • inline errors
  • codebuttons and smilieinserter

@euantorano
Copy link
Member

@PaulBender Mind starting an issue for any Twig functions you find that would be useful? We can build a list in a single issue and cross them off as we implement them.

@euantorano euantorano merged commit 9bca15a into mybb:develop/1.9 Jan 8, 2018
@Starpaul20 Starpaul20 deleted the develop-1.9-warnings branch January 8, 2018 22:51
@JordanMussi JordanMussi mentioned this pull request Jan 9, 2018
13 tasks
euantorano pushed a commit that referenced this pull request Mar 16, 2018
…2975)

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 1 - User warning log

* Coding standards

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 2 - Warning details

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 3 - Warning a user
euantorano pushed a commit to euantorano/mybb that referenced this pull request Mar 23, 2019
mybb#2975)

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 1 - User warning log

* Coding standards

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 2 - Warning details

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 3 - Warning a user
euantorano pushed a commit to euantorano/mybb that referenced this pull request Mar 23, 2019
mybb#2975)

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 1 - User warning log

* Coding standards

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 2 - Warning details

* Working on mybb#2972 Template Conversion to Twig Format (warnings.php)
Part 3 - Warning a user
euantorano pushed a commit that referenced this pull request Jun 2, 2019
…2975)

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 1 - User warning log

* Coding standards

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 2 - Warning details

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 3 - Warning a user
euantorano pushed a commit that referenced this pull request Jun 2, 2019
…2975)

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 1 - User warning log

* Coding standards

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 2 - Warning details

* Working on #2972 Template Conversion to Twig Format (warnings.php)
Part 3 - Warning a user
@euantorano euantorano mentioned this pull request Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:1.9 Branch: 1.9.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants