avs-code / PREM-Podium-race-E-manager

Description PREM (Podium race e manager) is management software for races and race leagues. It can be used to create overviews of race results. Based on Paddock 7.10beta by: demontpx
https://arv187.github.io/PREM-Podium-race-E-manager/
GNU General Public License v3.0
5 stars 1 forks source link

No rules showing #5

Closed avs-code closed 8 years ago

avs-code commented 8 years ago

http://sparkadsl.0lx.net/PREM/?page=show_rules

<? if(!defined("CONFIG")) exit(); ?>

<?php

$handle = fopen("rules.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    }

    fclose($handle);
} else {
    // error opening the file.
}
?>
avs-code commented 8 years ago

http://sparkadsl.0lx.net/pruebas/?page=show_rules

Fixed with :

<?php 
$str= file_get_contents("rules.rtf");
$str = nl2br($str, true);
// for XHMTL (in other words <br />). Use false for <br>. i.e $str = nl2br($str, false);
echo $str;
?>

But don't read special characters

avs-code commented 8 years ago

May be best using the php upload funtion to insert a link in data base and this showing in show_rules.php, for example to pdf link. Its this best option?

inguni commented 8 years ago

For the show_rules u should have an editor into the admin section, so with an WYSIWYG editor the user (admin user) will be able to modify it, without the needing of upload anything into the server.

avs-code commented 8 years ago

investigating about wysiwyg

avs-code commented 8 years ago

In index file I have this:

<script src="tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
  tinymce.init({
    selector: '#tinyeditor',
    theme: 'modern',
    width: 600,
    height: 300,
    plugins: [
      'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
      'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
      'save table contextmenu directionality emoticons template paste textcolor'
    ],
    content_css: 'href="http://www.w3schools.com/lib/w3.css"',
    toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons'
  });
</script>

basic script with extra options and plugins. I dont know if is better insert the script into the editor php file (edit_rules_mods) or is right in index.php.

In edit_rules_mods.php I have this:

<? if(!defined("CONFIG")) exit(); ?>
<? if(!isset($login)) { show_error("You do not have administrator rights\n"); return; } ?>

<form method="post">
<textarea id='tinyeditor' cols="50" rows="15"></textarea>
<input type="submit" value="Save" />
</form>

<form method="post" action="show_rules_mods.php">

</form>

In show_rules.php I have this:

<? if(!defined("CONFIG")) exit(); ?>

<?php 
$str= file_get_contents("rules.rtf");
$str = nl2br($str, true); // for XHMTL (in other words <br />). Use false for <br>. i.e $str = nl2br($str, false);
echo $str;
?>

<?php

echo(stripslashes($_POST['content']));
?>