Firefox PHP

some modifications for lan network version ...this is how I made them

Posted by abubasil 
some modifications for lan network version ...this is how I made them
January 01, 2019 09:48AM
Good day and happy new year.

I am abubasil (man 49yrs ) from Iraq.
I would like to thank you for this awesome phorum.
I would like to share with you these ideas about how to deploy phorum to be used in lan network for better results.

1- date format . because the date in utf8 languages does not show properly.
inside the include/foramt_functions.php file change the date function to be like this

function phorum_date( $picture, $ts )
{
//use your timezone
date_default_timezone_set("Asia/Baghdad");
$thedate = strftime( $ts );
return gmdate('Y-m-d',$thedate );

}

this will display this format 2019-1-1 of today.

2- inside posting.php file i add
<script src="[js.nicedit.com]; type="text/javascript"></script>
<script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script>

this will include the nicedit.js wyswyg rich text editor.

The posting.php file will htmlspecialchars the message.
so I went to the format_functions.php file again
and renamed the phorum_format_messages function into phorum_format_messages_old
and make a new one with the original name phorum_format_messages
and this will be like this

function phorum_format_messages ($data, $author_specs = NULL) { return $data;}

this will allow formatting the post properly

now what if someone wants to upload -insert an image via that editor?
I have a modified version of nicedit with a php file that receives the images uploaded by users and save them into upload directory at the root path. but I could not upload them here for I am not allow to upload php or js files.

That's all the talk.

What I need is to increase the files size for users to upload big files (my php.in file set to 528mb)
the print view too does have much unnecessary details that should not show in a printable version of the pages.

Thank you.



Edited 1 time(s). Last edit at 01/01/2019 09:50AM by abubasil.
Re: some modifications for lan network version ...this is how I made them
January 01, 2019 10:11PM
File sizes are determined by php, and the web server, and phorum.
The issue here is: after a while of allowing large pictures, backing the phorum becomes a problem.
Re: some help needed
January 02, 2019 12:10PM
I am working on creating a "follow up system" out of this forum for my contract office.
I liked the user files management ..
as for my above modification, I hope someone help me in it, it throws some error sometimes when I create reply.
I should not cancel all the job of phorum_format_messages() function .. some trailed details are lost and one cannot send reply.

UPDATE . No errors in my modifications. the error was becuase of the emerlad_rtl style. in the read.tpl file. I replaced the file with the original English one , and everything is fine. now I can add image into the nicedit and save them locally in "upload" folder.

Thank you again for this gift.



Edited 1 time(s). Last edit at 01/03/2019 06:07PM by abubasil.
Re: some modifications for lan network version ...this is how I made them
January 02, 2019 04:31PM
Thank you for your kind explanation. Yes I understand the limitation of storing files in the database.
I wish there is an option to upload large files and save them locally in the phorum path using filesystem functions.
I am using nicedit not for the sake of text formatting tools that are available here in this window, but I need to make my people insert images of scanned documents and see them all inside the topic and its replies like an article.

Well this forum has its own philosophy . I will keep trying to tame it to my goals.

thank you all for this great job.
Re: some modifications for lan network version ...this is how I made them
January 02, 2019 04:45PM
There is a module to store files on disk. (I have not used it)


[www.phorum.org]
Re: some modifications for lan network version ...this is how I made them
January 04, 2019 04:41AM
I just discovered the modules of this forum. I tried that one for saving in disk. it is great and answer my question. I did not know how to use it at first. now I know where to place it and how to activate it, this is similar to Wordpress plugins.
Gee thanks.
Now for anyone interested in testing my idea.
this is how to make nicedite upload files to your local path ..
lookup this line inside nicedit.js
var nicUploadButton = nicEditorAdvancedButton.extend({

and change the below line to
nicURI : 'img.php',

or any filename you like
and that img.php file should look like

Language: PHP
<?php     if (!is_dir("upload")){ mkdir("upload",0777,true); }   //Check if we are getting the image if(isset($_FILES[';image';])){ //Get the image array of details $img = $_FILES[';image';]; //The new path of the uploaded image. $path = "upload/" . uniqid().".".extension($img["name"]); //Move the file to our new path move_uploaded_file($img[';tmp_name';],$path); //Get image info, reuiqred to biuld the JSON object $data = getimagesize($path); //The direct link to the uploaded image, this might varyu depending on your script location $link = "http://$_SERVER[HTTP_HOST]"."/".basename(__dir__)."/".$path; //Here we are constructing the JSON Object $res = array("data" => array( "link" => $link, "width" => $data[0], "height" => $data[1])); //echo out the response :) echo json_encode($res); }   function extension($thefile) { $extension = pathinfo($thefile, PATHINFO_EXTENSION); return $extension;} ?>

Now one needs a tool to manage the images inside the upload directory. this depends in the way you use the forum
but I think I need to edit a CORE file to delete the linked image inside upload folder if a post is deleted. this is beyond my skills.
Sorry, only registered users may post in this forum.

Click here to login