* replace "$twig->render()" with "$this->display"

This commit is contained in:
slawkens
2018-05-29 21:29:08 +02:00
parent 68d74a490b
commit c654ea329c
69 changed files with 413 additions and 413 deletions

View File

@@ -18,7 +18,7 @@ if(!Validator::guildName($guild_name)) {
if(empty($errors)) {
$guild = new OTS_Guild();
$guild->find($guild_name);
if(!$guild->isLoaded()) {
$errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
}
@@ -29,7 +29,7 @@ if(empty($errors)) {
$guild_leader_char = $guild->getOwner();
$guild_leader = false;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player) {
if($guild_leader_char->getId() == $player->getId()) {
$guild_vice = true;
@@ -37,7 +37,7 @@ if(empty($errors)) {
$level_in_guild = 3;
}
}
if($guild_leader)
{
$max_image_size_b = $config['guild_image_size_kb'] * 1024;
@@ -53,7 +53,7 @@ if(empty($errors)) {
if($file['size'] > $max_image_size_b) {
$upload_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
}
$type = strtolower($file['type']);
if(!in_array($type, $allowed_ext)) {
$upload_errors[] = 'Your file type isn\' allowed. Allowed: <b>gif, jpg, bmp, png</b>. Your file type: <b>'.$type.'</b> If it\'s valid image contact with admin.';
@@ -62,14 +62,14 @@ if(empty($errors)) {
else {
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['guild_image_size_kb'].' KB</b>.';
}
if(empty($upload_errors)) {
$extension = $ext_name[$type];
if(!move_uploaded_file($file['tmp_name'], $save_path.'.'.$extension)) {
$upload_errors[] = "Sorry! Can't save your image.";
}
}
if(empty($upload_errors))
{
$guild_logo = $guild->getCustomField('logo_name');
@@ -77,33 +77,33 @@ if(empty($errors)) {
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
$guild_logo = "default.gif";
}
if($guild_logo != "default.gif" && $guild_logo != $save_file_name.'.'.$extension) {
unlink('images/guilds/' . $guild_logo);
}
}
//show errors or save file
if(!empty($upload_errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $upload_errors));
$twig->display('error_box.html.twig', array('errors' => $upload_errors));
}
else {
success('Logo has been changed.');
$guild->setCustomField('logo_name', $save_file_name.'.'.$extension);
}
}
$guild_logo = $guild->getCustomField('logo_name');
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
$guild_logo = "default.gif";
}
echo $twig->render('guilds.change_logo.html.twig', array(
$twig->display('guilds.change_logo.html.twig', array(
'guild_logo' => $guild_logo,
'guild' => $guild,
'max_image_size_b' => $max_image_size_b
));
}
else {
$errors[] = 'You are not a leader of guild!';
@@ -115,9 +115,9 @@ if(empty($errors)) {
}
}
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
echo $twig->render('guilds.back_button.html.twig', array(
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true,
'action' => '?subtopic=guilds'
));