Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 13,807
» Latest member: Bloodseeker
» Forum threads: 69,556
» Forum posts: 431,987

Full Statistics

Latest Threads
How to work with timestam...
Forum: General Help
1 hour ago
» Replies: 5   » Views: 95
Help me: Search engine fo...
Forum: Addins
1 hour ago
» Replies: 1   » Views: 12
Problem on migration use
Forum: CodeIgniter 4 Support
3 hours ago
» Replies: 1   » Views: 71
Doc pages little misses
Forum: Issues
5 hours ago
» Replies: 1   » Views: 28
Search engine that connec...
Forum: General Help
5 hours ago
» Replies: 2   » Views: 61
[Done] Email package prot...
Forum: CodeIgniter 4 Roadmap
6 hours ago
» Replies: 5   » Views: 1,069
how to update ?
Forum: CodeIgniter 4 Support
7 hours ago
» Replies: 7   » Views: 182
Routes with a variable
Forum: General Help
Yesterday, 05:48 PM
» Replies: 3   » Views: 139
Problem with inserting cs...
Forum: General Help
Yesterday, 05:40 PM
» Replies: 4   » Views: 126
CI programming services
Forum: Jobs
Yesterday, 04:56 AM
» Replies: 0   » Views: 107

 
  hiding CI paths for CSS Images etc....
Posted by: El Forum - 08-03-2007, 02:19 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]Unknown[/eluser]
hello

I'have looked into CI www source kode and find this (for CSS src):

Code:
.... src="http://codeigniter.com/?css=global/sIFR-print.css" ...

how is this done???

hiding paths seems more elegant and secure

I would like to hide all css, js and images paths.

Please help


  Email library
Posted by: El Forum - 08-03-2007, 01:18 AM - Forum: Archived Development & Programming - No Replies

[eluser]Unknown[/eluser]
file: libraries/Email.php

Current code:

Code:
function message($body)
{
    $this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
}
The problem is that if you want to use "\r\n" as new-line for the (text) email body you will not succeed. All "\r\n"s will be converted to "\n". (And some SMTP servers will raise an error!).

In order to fix this I added an extra line:
Code:
function message($body)
{
    $this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
    $this->_body = str_replace("\n", "".$this->newline, $body);        
}
So it will change all \r\n to \n and after that it will change all \n to whatever new-line character you set.


PS: I didn't fill a Bug Report because I don't know if this is a bug or if I am missing something.


  Another CSV thread
Posted by: El Forum - 08-02-2007, 04:56 PM - Forum: Archived General Discussion - Replies (2)

[eluser]scottzirkel[/eluser]
I've looked through all the problems with uploading csv's and I've added as many additions to the mime type array as I could find, but it's still not working. Here is what I've put into the mimes.php file in the config folder.

Code:
'csv'    =>    array('text/comma-separated-values', 'text/x-comma-separated-values', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.ms-excel', 'application/vnd.msexcel', 'text/anytext', 'text/plain', 'application/octet-stream'),
Any ideas?


  The upload path does not appear to be valid. Help? - SOLVED
Posted by: El Forum - 08-02-2007, 02:30 PM - Forum: Archived Development & Programming - No Replies

[eluser]eedfwChris[/eluser]

Code:
/**
* ----------------------------------------------------
* Validate Form
* ----------------------------------------------------
* Validates the RTD search form.
*
*/
function _validate_form()
{
    $this->load->library('validation');

    /* Set field names */
    $fields['name']         = "Site/Community Name";
    $fields['state']         = "State";
    //$fields['userfile']    = "CSV File";

    $this->validation->set_fields($fields);

    /* Set validation parameters */
    $rules['name']             = "required|max_length[50]";
    $rules['state']            = "required|max_length[2]|min_length[2]";
    //$rules['userfile']     = "required";

    $this->validation->set_rules($rules);

    /* Run validation */
    if ($this->validation->run() == FALSE)
    {
        $this->view->set('validation_error', $this->validation->error_string);
        $this->view->part('body', 'rtd/rtd_search_form_view');
    }
    else
    {
        $this->_validate_csv();
    }
}

/**
* ----------------------------------------------------
* Validate CSV
* ----------------------------------------------------
* Validates the uploaded CSV file to ensure that the proper type of CSV is uploaded (or it is a CSV at all)
*
*/

function _validate_csv()
{
    $config['upload_path'] = './rtd_tmp/';
    $config['allowed_types'] = 'csv';

    $this->load->library('upload', $config);

    if ($this->upload->do_upload() == FALSE)
    {
        $this->view->set('validation_error', $this->upload->display_errors());
        $this->view->part('body', 'rtd/rtd_search_form_view');
        return FALSE;
    }
    else
    {
        return TRUE;
    }
}

I am getting a "The upload path does not appear to be valid." error...

Where exactly does codeigniter want the upload directory? I have my file path like this

-System
---application
------controller
---rtd_tmp
-Webroot


Sorry.... Figured it out I needed to use ../rtd_tmp/


  Yet another "index.php" problem
Posted by: El Forum - 08-02-2007, 12:22 PM - Forum: Archived General Discussion - Replies (9)

[eluser]Lionel H[/eluser]
Hello everybody,

I'm a french autodidact PHP developper ; I've just discovered CI and I really love it !

I have a "index.php" problem ; a sample of code is much clear than a long explanation :

"home" controller (set as the default controller in config/routes.php) :

Code:
class Home extends Controller {
    function Home() {
        parent::Controller();    
        $this->load->helper('form');    
    }
    
    function index() {
        $this->load->view('home_view');
    }
}

"home_view" :
Code:
<html>
...
<?= form_open('blog/insert') ?>
    <p>&lt;input type="text" name="titre" /&gt;</p>
    <p>&lt;textarea name="article" cols="40" rows="10"&gt;&lt;/textarea&gt;</p>
    <p>&lt;input type="text" name="auteur" /&gt;</p>
    <p>&lt;input type="submit" value="Poster" /&gt;</p>
&lt;/form&gt;
...
&lt;/html&gt;

"blog" controller :
Code:
class Blog extends Controller {
    function Blog() {
        parent::Controller();
        $this->load->helper('url');
    }
    
    function insert() {
        $this->db->insert('codeigniter', $_POST);
        redirect('home/index');
    }
}
So, everything work, except for the redirect() function ; I get this in my address bar :
http://myserver/ci/index.php/home/index.php/blog/insert and, of course, a 404 error.

Can I resolve this problem by removing the "index.php" ?
I've read The User Guide and The Wiki about removing the index.php, and many posts in forum too, but I'm not able at all to remove this "index.php" (I've tried many .htaccess configurations, on my local server on my Mac and on distant pro servers).

I'm sorry if this question has been already asked, but I've spent all the day to search the solution for nothing...
Thanks in advance ! :-)


  query binding error
Posted by: El Forum - 08-02-2007, 12:20 PM - Forum: Archived Development & Programming - Replies (9)

[eluser]EugeneS[/eluser]
it seems to me a bug

when i send through the form this data for example 435345\' i receive wrong SQL query.

my model query:

Code:
$sql_item = '
                    UPDATE Item
                    SET Articul = ?,
                        Name = ?,
                        Price = ?,
                        isNew = ?,
                        isLeader = ?,
                        Description = ?,
                        whenAdded = ?,
                        whenNewFinish = ?,
                        isVisible = ?,
                        Image = ?
                    WHERE ItemID = ?
        ';
        $this->db->query($sql_item, array(
                                              $data['Articul'],
                                            $data['Name'],
                                            $data['Price'],
                                              $data['isNew'],
                                            $data['isLeader'],
                                            $data['Description'],
                                              $data['whenAdded'],
                                            $data['whenNewFinish'],
                                            $data['isVisible'],
                                            $data['Image'],
                                            $data['ItemID'],
                                    )
        );


wrong final query:

Code:
UPDATE Item SET Articul = '435435', Name = '435345\\'', Price = '435435', isNew = '1', isLeader = 0, Description = '345435435', whenAdded = 1186074782, whenNewFinish = 1182286800, isVisible = '1', Image = '' WHERE ItemID = '3'


  Converting html into plain text
Posted by: El Forum - 08-02-2007, 12:02 PM - Forum: Archived General Discussion - Replies (5)

[eluser]Unknown[/eluser]
Is anyone there who knows a way to convert html into plain text....it could be a function or a pluggin or anything ´cause I´m supposed


  Add variable to native Controller class
Posted by: El Forum - 08-02-2007, 11:35 AM - Forum: Archived Development & Programming - Replies (9)

[eluser]rokkan[/eluser]
I would like to add variables to the base Controller class so every controller can access it similar to $this->load and $this->db. I tried to overwrite the native Controller class but that doesn't seem possible (though it appears possible in the documentation). Has anyone done this before?


  setcookie natively with PHP
Posted by: El Forum - 08-02-2007, 11:09 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]davidk43[/eluser]
I'm wondering whether the session library sets up cookies with any write protection or if that's is in anyway possible?

I've a cookie I'm trying to write to and update its expiry time. I'm having some issues with set_cookie so decided to at least get it working with native php code and troubleshoot from there. I can't seem to update the the default 'ci_session' cookie expiry time. Data within it is updated fine but not the cookie's own attributes. To confirm to myself I wasn't going mad I did this:

Code:
setcookie("ci_session",$_COOKIE['ci_session'],time()+1209600,"/");

and then this at the same point on the next line:

Code:
setcookie("ci_session_test",$_COOKIE['ci_session'],time()+1209600,"/");

the test version created absolutely fine, but the default ci_session cookie remained the same. I just can't seem to manipulate the cookies attributes once its been setup by config.


  Using the file upload class and validation class together.
Posted by: El Forum - 08-02-2007, 11:02 AM - Forum: Archived Development & Programming - Replies (1)

[eluser]eedfwChris[/eluser]
I'm a little confused as to how to get the two to work seemlessly together. I have a form with a simple upload field for a CSV file. The callback would be analized to be sure it has the right columns and all that jazz.

My question is, should you use the file upload in a callback? If so, am I doing anything right below?

I'm using the alternative view class.

Code:
/**
* ----------------------------------------------------
* Validate Form
* ----------------------------------------------------
* Validates the RTD search form.
*
*/
function _validate_form()
{
    $this->load->library('validation');

    /* Set field names */
    $fields['name']         = "Site/Community Name";
    $fields['state']         = "State";
    $fields['file_upload']    = "CSV File";

    $this->validation->set_fields($fields);

    /* Set validation parameters */
    $rules['name']             = "required|max_length[50]";
    $rules['state']            = "required|max_length[2]|min_length[2]";
    $rules['file_upload']     = "callback__validate_csv";

    $this->validation->set_rules($rules);

    /* Run validation */
    if ($this->validation->run() == FALSE)
    {
        $this->view->set('validation_error', $this->validation->error_string);
        $this->view->part('body', 'rtd/rtd_search_form_view');
    }
    else
    {
        echo 'true';
    }
}

/**
* ----------------------------------------------------
* Validate CSV
* ----------------------------------------------------
* Validates the uploaded CSV file to ensure that the proper type of CSV is uploaded (or it is a CSV at all)
*
*/

function _validate_csv()
{
    $config['upload_path'] = './rtd_tmp/';
    $config['allowed_types'] = 'csv';

    $this->load->library('upload', $config);

    if ($this->upload->do_upload() == FALSE)
    {
        $this->view->append('validation_error', 'CSV is invalid');
        return FALSE;
    }
    else
    {
        return TRUE;
    }
}



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.