cotonti.com : Parsing HTML in custom module question https://www.cotonti.com Последние сообщения в теме Cotonti en Wed, 26 Nov 2025 18:12:29 -0000 lukgoh Thanks Xerora!

]]>
чт, 02 фев 2012 22:42:38 -0000
Xerora

Is this a safe method: 604800 + time()
 

Yup, that's exactly it

]]>
чт, 02 фев 2012 20:08:54 -0000
lukgoh I have a new question:

I am trying to set a start and end date for a page in my custom module (not an actual page in the page module). To set the date the page is submitted I am using this: (int)$sys['now'] which is working just fine. What I would like to know is how to automatically add 1 week to that value and set it as the end date?

Thanks,

Luke.

Added 8 minutes later:

Is this a safe method: 604800 + time()

]]>
чт, 02 фев 2012 19:20:46 -0000
Trustmaster This piece of code checks file extension, runs cot_file_check() to check if file contents is secure and uses cot_safename() to generate safe filename for storage:

$gd_supported = array('jpg', 'jpeg', 'png', 'gif');
$file_ext = strtolower(end(explode(".", $file['name'])));
$fcheck = cot_file_check($file['tmp_name'], $file['name'], $file_ext);
if(in_array($file_ext, $gd_supported) && $fcheck == 1)
{
	$file['name']= cot_safename($file['name'], true);
	$filename_full = $usr['id'].'-'.strtolower($file['name']);
]]>
чт, 26 янв 2012 18:00:56 -0000
lukgoh Oh, okay and then checks to make sure the uploaded file is supported as an image file?

]]>
чт, 26 янв 2012 16:41:25 -0000
Trustmaster Basicly it's just old plain PHP file uploads.

]]>
чт, 26 янв 2012 14:48:05 -0000
lukgoh Was looking in completely the wrong place, thanks once again Trustmaster. 

Added 5 minutes later:

Although, this is a little over my head as I am knew to php, everything I have learnt so far is from backwards engineering what I can understand from the core files...

]]>
чт, 26 янв 2012 13:41:19 -0000
Trustmaster That's in userimages.profile.update.php

]]>
чт, 26 янв 2012 13:34:02 -0000
lukgoh Thank you Trustmaster, seems to of fixed it! I have another question, about how Cotonti uploads files to the avatar folder. I need something similar for my module. 

I am trying to see how I can upload images to a certain folder the same way Cotonti does. I have been looking through the core files but I cant seem to find where this happens.

Luke.

]]>
чт, 26 янв 2012 10:41:46 -0000
Trustmaster If the problem is that it shows you page source after you submit it, it might be because of 2 things.

First, make sure you allow HTML upon variable import, so use HTM filter instead of TXT:

$form['jobs_info'] = cot_import('jobs_info', 'P', 'HTM');

Then, make sure you don't apply htmlspecialchars to it. So the output is something like this:

'MY_TEXT' => cot_parse($form['jobs_info']),

About the editor selection question, that is done by site administrator, not by user. Administrator picks a default parser and associates an editor with it. It is Cotonti's duty then to display that editor in modules. You can use a different parser in your module though, that is achieved by setting $sys['parser'] variable and passing it as a 3rd parameter to cot_parse().

]]>
чт, 26 янв 2012 06:02:24 -0000
lukgoh Yeah, I couldnt get the other editors working at all for some reason. Followed all the instructions but CKEditor is the only one that will work. I guess I want to use it exactly how it used in the forums here, just not for the forums.

Added 1 minute later:

I am assigning it to a tag by the way, like this: 

cot_textarea('jobs_info', $form['jobs_info'], 24, 120, '', 'input_textarea_editor'),
]]>
ср, 25 янв 2012 22:38:34 -0000
ez You cannot this is default ck.... I think

you can prevent it using shift enter in stead of enter

this thing really bugs me too, i always tend to edit in pure html when ck is used

but other less skillfull users cannot do this, i never give my clients ck unless they really really ask for it

]]>
ср, 25 янв 2012 22:33:53 -0000
lukgoh Hey guys!

I'm writing a new module for my website and it requires user input via the text editor (I am using CKEditor) the text it outputs shows html, for example <p> the paragraph tags. I was wondering how to fix this.

Thanks in advance,

Luke.

]]>
ср, 25 янв 2012 22:12:32 -0000