Example #1
0
 /**
  * Amend a file
  *
  * @param $path
  *
  * @param $content
  *
  * @return null
  */
 public static function AmendFile($path, $content)
 {
     /**
      * Gets the corrected path
      */
     $corrected_path = Path::Get($path);
     /**
      * If it exists
      */
     if (file_exists($corrected_path)) {
         /**
          * Open the contents
          */
         $opened_contents = File::Read($path);
         /**
          * Join the two
          */
         $merged_contents = $opened_contents . "\n" . $content;
         /**
          * Write this to file
          */
         File::WriteFile($path, $merged_contents);
     }
     /**
      * Else return null
      */
     return null;
 }
 /**
  * Este metodo se llama cada vez que se instancia la clase.
  * Se utiliza para crear los objetos del formulario
  */
 function form_init_elements()
 {
     //Debug::oneVar(Util::app_Path('install/include/gpl.txt'), __FILE__, __LINE__);
     if (file_exists(Util::app_Path('install/include/gpl.txt'))) {
         $str_content = File::Read(Util::app_Path('install/include/gpl.txt'));
     }
     $textarea = new FETextArea("Licence", false, 15, 90);
     $textarea->set_value($str_content);
     $this->add_element($textarea);
     $this->add_element($this->_formatElem("base_SubmitButton", "Salir", "quit", agt("Salir")));
     $this->add_element($this->_formatElem("base_SubmitButton", "Acepto", "submit", agt("Acepto") . " >"));
     $this->add_element($this->_formatElem("base_SubmitButton", "Regresar", "back", "< " . agt("Regresar")));
 }
Example #3
0
    if (array_search($post['autor_link'], $previous) === false) {
        $previous[] = $post['autor_link'];
        $blog_list .= "<li><a href='" . $post['autor_link'] . "'><img src='/gfx/feed-icon-10x10.png' " . "alt='RSS feed' /></a>" . "<a href='" . $post['blog_url'] . "'>" . $post['blog_title'] . "</a></li>\n";
        $fOutput->writeOpml(File::ReadAndParse('xml/opml_item.xml', $post));
    }
}
$fOutput->writeOpml(File::ReadAndParse('xml/opml_foot.xml'));
$blog_list .= "</ul>\n";
define('BLOG_LIST', $blog_list);
unset($blog_list);
# Other similar planets:
$planets = $Config->getPlanetas();
$planet_list = "<ul>\n";
foreach ($planets as $planet) {
    $planet_list .= "<li><a href='" . $planet['rss'] . "'><img src='/gfx/feed-icon-10x10.png' alt='Feed RSS' /></a>" . "<a href='" . $planet['url'] . "'>" . $planet['name'] . "</a></li>\n";
}
$planet_list .= "</ul>\n";
define('PLANET_LIST', $planet_list);
unset($planet_list);
# Sidebar generation:
$fOutput->write(File::ReadAndParse('html/sidebar.html'));
# Extended content initially hidden:
$fOutput->write('<script type="text/javascript">$(".content").hide();</script>');
# Statistics:
Debug::info("HTML: Statistics code");
$fOutput->write(File::ReadAndParse('html/stats.html'));
# Closure:
Debug::info("Closures");
$fOutput->write(File::ReadAndParse('html/footer.html'));
$fOutput->writeRss(File::Read('xml/rss20_foot.xml'));
Debug::info("EOF");
 /**
  * Lee el contenido de un fichero
  * @access private
  */
 function _addFileContent($filename)
 {
     return File::Read($filename);
 }
 /**
  * Arranca el controlador y ejecuta su funcionalidad
  *
  */
 function Exec()
 {
     //Recuperamos los par·metros recibidos
     if (!empty($_POST)) {
         foreach ($_POST as $key => $value) {
             $this->arr_form[$key] = $value;
         }
     }
     if (!empty($_GET)) {
         foreach ($_GET as $key => $value) {
             $this->arr_form[$key] = $value;
         }
     }
     if (isset($this->arr_form)) {
         foreach ($this->arr_form as $key => $value) {
             $this->setViewVariable($key, $value);
         }
     }
     //Controlamos que el usuario esta logeado. Para evitar retornos desde el navegador
     if (!$this->getSessionElement('session')) {
         $this->alertView('Sesión no activa', 'Para continuar trabajando en este Campus Virtual debe regresar a la página de inicio y acceder de nuevo');
         //Session::setValue('session', true);
     } else {
         //Abrimos y Activamos acceso a BBDD
         if ($this->str_modelClass != '') {
             if (file_exists(Util::app_Path($this->str_moduleName . '/model/classes/' . strtolower($this->str_modelClass) . ".class.php"))) {
                 include Util::app_Path($this->str_moduleName . '/model/classes/' . strtolower($this->str_modelClass) . ".class.php");
                 $this->obj_data = new $this->str_modelClass();
                 $this->obj_data->openModel();
             }
         }
         //Procesamos lÛgica de negocio
         $this->processPetition();
         //Desactivamos y Cerramos acceso a Base de datos
         if ($this->str_modelClass != '') {
             $this->obj_data->closeModel();
             unset($this->obj_data);
         }
     }
     //Damos de alta en el registro el mÛdulo.
     $this->registry->pushApp($this->str_moduleName);
     //Preparamos el contenido de la pagina
     if ($this->bol_isCacheable && file_exists($this->str_cacheFile) && time() - filemtime($this->str_cacheFile) < MIGUELBASE_CACHE_TIME) {
         $str_content = File::Read($this->str_cacheFile);
     } else {
         $this->_menuFile();
         $str_content = $this->_getViewContent();
     }
     if ($this->bol_isCacheable) {
         File::Write($this->str_cacheFile, $str_content);
     }
     //Visualizamos la pagina
     print $str_content;
     unset($str_content);
 }
 /**
  * Obtiene los modulos a incluiren el ·rea principal
  * @internal
  */
 function _getModuleElements()
 {
     $ret_val = null;
     if (file_exists(Util::app_Path("course/include/moduleelements.data"))) {
         $str_content = File::Read(Util::app_Path("course/include/moduleelements.data"));
     }
     $arr_elem = explode("\n", $str_content);
     $int_elem = count($arr_elem);
     for ($i = 0; $i < $int_elem; $i++) {
         $ret_val[] = explode(",", $arr_elem[$i]);
     }
     return $ret_val;
 }