Location: PHPKode > projects > LDAPted > ldapted/includes/extsource/File.php
<?php
/***************************************************************************
 *
 *                                  File.php
 *                              -------------------
 *
 *   begin                : Friday, Jul 5, 2002
 *   copyright            : (C) 2002 The Kabramps Team
 *   email                : hide@address.com,
 *                          hide@address.com
 *
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 *   See the GNU General Public License for more details.
 *   (http://www.gnu.org/licenses/gpl.html)
 *
 ***************************************************************************/

class File extends Selection {
  
  function File ($attribute, $xmlDoc) {
    $this->init($attribute, $xmlDoc);
  }
  
  function get_selections($value = array()) {
    $fields = $this->xmlDoc->get_selection_fields($this->attribute);
    $filename = $fields["filename"];
    
    $filebuffer = fopen ($filename,"r");
    if ($filebuffer) {
      $content = fread($filebuffer, filesize($filename));
      fclose($filebuffer);
      return split("\n", $content);
    }
    fclose($filebuffer);
    return array();
  }
  
}
?>
Return current item: LDAPted