phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: sitemgr/modules class.module_filecontents.inc.p


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/modules class.module_filecontents.inc.php,NONE,1.1.2.1
Date: Thu, 24 Apr 2003 23:01:22 -0400

Update of /cvsroot/phpgroupware/sitemgr/modules
In directory subversions:/tmp/cvs-serv24231

Added Files:
      Tag: Version-0_9_16-branch
        class.module_filecontents.inc.php 
Log Message:
new module for including contents of a file

--- NEW FILE ---
<?php

class module_filecontents extends Module 
{
        function module_filecontents()
        {
                $this->arguments = array(
                        'filepath' => array(
                                'type' => 'textfield', 
                                'label' => 'The complete path to the file to be 
included'
                        )
                );
                $this->title = "File contents";
                $this->description = "This module includes the contents of a 
(world readable) file";
        }

        function get_content(&$arguments,$properties)
        {
                if ($this->validate($arguments))
                {
                        return implode('', file($arguments['filepath']));
                }
                else
                {
                        return "File is not world readable";
                }
        }

        function validate(&$data)
        {
                if (!(fileperms($data['filepath']) & 00004))
                {
                        $this->validation_error = "File is not world readable";
                        return false;
                }
                else
                {
                        return true;
                }
        }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]