Explorar el Código

Removing unused libs, external libraries should be added via composer, in the composer.json file.

Julio Montoya hace 11 años
padre
commit
9a6d15368c
Se han modificado 39 ficheros con 4 adiciones y 5416 borrados
  1. 0 395
      main/inc/lib/db.class.php
  2. 0 92
      main/inc/lib/system/closure_compiler.class.php
  3. 0 92
      main/inc/lib/system/code_utilities.class.php
  4. 0 1
      main/inc/lib/system/media/renderer/__README.txt
  5. 0 56
      main/inc/lib/system/media/renderer/asset_aggregated_renderer.class.php
  6. 0 107
      main/inc/lib/system/media/renderer/asset_renderer.class.php
  7. 0 662
      main/inc/lib/system/media/renderer/http_resource.class.php
  8. 0 113
      main/inc/lib/system/media/renderer/lab/asset_google_calendar_renderer.class.php
  9. 0 57
      main/inc/lib/system/media/renderer/lab/asset_mahara_group_renderer.class.php
  10. 0 63
      main/inc/lib/system/media/renderer/lab/asset_mahara_person_renderer.class.php
  11. 0 46
      main/inc/lib/system/media/renderer/lab/asset_wiki_renderer.class.php
  12. 0 75
      main/inc/lib/system/media/renderer/protocol/asset_google_document_renderer.class.php
  13. 0 95
      main/inc/lib/system/media/renderer/protocol/asset_google_document_viewer_renderer.class.php
  14. 0 129
      main/inc/lib/system/media/renderer/protocol/asset_google_map_renderer.class.php
  15. 0 90
      main/inc/lib/system/media/renderer/protocol/asset_google_widget_renderer.class.php
  16. 0 44
      main/inc/lib/system/media/renderer/protocol/asset_image_renderer.class.php
  17. 0 65
      main/inc/lib/system/media/renderer/protocol/asset_media_renderer.class.php
  18. 0 65
      main/inc/lib/system/media/renderer/protocol/asset_mediaserver_renderer.class.php
  19. 0 124
      main/inc/lib/system/media/renderer/protocol/asset_oembed_renderer.class.php
  20. 0 201
      main/inc/lib/system/media/renderer/protocol/asset_og_renderer.class.php
  21. 0 83
      main/inc/lib/system/media/renderer/protocol/asset_page_renderer.class.php
  22. 0 95
      main/inc/lib/system/media/renderer/protocol/asset_rss_renderer.class.php
  23. 0 76
      main/inc/lib/system/media/renderer/protocol/asset_scratch_renderer.class.php
  24. 0 131
      main/inc/lib/system/net/curl.class.php
  25. 0 72
      main/inc/lib/system/net/http_channel.class.php
  26. 0 149
      main/inc/lib/system/portfolio/artefact.class.php
  27. 0 35
      main/inc/lib/system/portfolio/download.class.php
  28. 0 59
      main/inc/lib/system/portfolio/mahara.class.php
  29. 0 106
      main/inc/lib/system/portfolio/portfolio.class.php
  30. 0 19
      main/inc/lib/system/portfolio/user.class.php
  31. 0 86
      main/inc/lib/system/web/header.class.php
  32. 0 70
      main/inc/lib/system/web/request.class.php
  33. 0 302
      main/inc/lib/system/web/request_server.class.php
  34. 0 1170
      main/inc/lib/tools/entity_generator.class.php
  35. 0 138
      main/inc/lib/tools/entity_repository_generator.class.php
  36. 0 214
      main/inc/lib/tools/yaml_exporter.class.php
  37. 1 1
      vendor/autoload.php
  38. 0 35
      vendor/composer/autoload_classmap.php
  39. 3 3
      vendor/composer/autoload_real.php

+ 0 - 395
main/inc/lib/db.class.php

@@ -1,395 +0,0 @@
-<?php
-
-/**
- * This is a draft 
- *  
- */
-use Doctrine\ORM\Tools\Setup;
-use Doctrine\ORM\EntityManager;
-use Doctrine\ORM\Configuration;
-use Tools\EntityGenerator;
-use Tools\EntityRepositoryGenerator;
-use Doctrine\Common\Util\Inflector;
-use Doctrine\ORM\Mapping\ClassMetadataInfo;
-
-function save($data)
-{
-    db::instance()->save($data);
-}
-
-/**
- *
- * @license see /license.txt 
- */
-class db
-{
-
-    /**
-     * @return db 
-     */
-    public static function instance()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self();
-        }
-        return $result;
-    }
-
-    private static function register_autoload()
-    {
-        static $has_run = false;
-        if ($has_run) {
-            return true;
-        }
-        require_once api_get_path(LIBRARY_PATH) . 'symfony/Doctrine/ORM/Tools/Setup.php';
-        $directory = api_get_path(LIBRARY_PATH) . 'symfony';
-
-        if (!class_exists('Doctrine\Common\ClassLoader', false)) {
-            require_once $directory . '/doctrine/Common/ClassLoader.php';
-        }
-
-        $loader = new Doctrine\Common\ClassLoader('Doctrine', $directory);
-        $loader->register();
-
-        $loader = new Doctrine\Common\ClassLoader('Symfony\Component', $directory);
-        $loader->register();
-
-        $has_run = true;
-    }
-
-    protected $config;
-    protected $em;
-
-    protected function __construct()
-    {
-        self::register_autoload();
-        $connection_parameters = $this->get_connection_parameters();
-        $this->config = Setup::createYAMLMetadataConfiguration(array($this->get_entity_path() . '/mapping'), true);
-        $this->em = EntityManager::create($connection_parameters, $this->config);
-    }
-
-    public function save($data)
-    {
-        $em = $this->em;
-        $em->persist($data);
-        $em->flush();
-    }
-
-    public function remove($data)
-    {
-        $em = $this->em;
-        $em->remove($data);
-        $em->flush();
-    }
-
-    public function flush($data = null)
-    {
-        $em = $this->em;
-        $em->flush($data);
-    }
-
-    function test()
-    {
-        $_SESSION['_real_cid'] = 2;
-        
- //       $repo = Entity\User::repository();
-//        $user = Entity\User::create();
-//        $user->set_username('salut1');
-//        $user->set_password('salut');
-//        $user->set_status(1);
-//        $user->set_chatcall_user_id(1);
-//        $user->set_chatcall_date(new DateTime());
-//        $user->set_chatcall_text('');
-//        $user->set_registration_date(new DateTime());
-//        $user->set_expiration_date(new DateTime());
-//        $user->set_active(true);
-//        $user->set_hr_dept_id(0);
-//        $em = $this->em();
-//        $em->persist($user);
-//        $em->flush();
-//        echo "Created User with ID " . $user->get_user_id() . "\n";
-//        $user = $repo->find(3);
-//        $this->remove($user);
-//        $this->flush();
-
-
-        $doc = \Entity\Document::create();
-        $doc->set_path('path');
-        $doc->set_title('title');
-        //$doc->set_c_id(1);
-        $doc->set_comment('comment');
-        $doc->set_size(0);
-        $doc->set_session_id(0);
-        $doc->set_filetype('dd');
-        $doc->set_readonly(false);
-
-        //$repo = \Entity\Document::repository();
-        //$id = $repo->next_id($doc);
-        //echo "next id: $id <br/>";
-
-
-        //$doc->set_id($id);
-        $this->save($doc);
-        $this->flush();
-    }
-
-    /**
-     *
-     * @return EntityManager The created EntityManager.
-     */
-    public function em()
-    {
-        return $this->em;
-    }
-
-    /**
-     *
-     * @param string $entity_name
-     * @return EntityRepository 
-     */
-    public function get_repository($entity_name)
-    {
-        return $this->em()->getRepository($entity_name);
-    }
-
-    /**
-     * 
-     * @return type 
-     */
-    public function get_entity_path()
-    {
-        $result = __DIR__ . '/../entity';
-        $result = realpath($result);
-        return $result;
-    }
-
-    public function is_production()
-    {
-        return Chamilo::is_production_server();
-    }
-
-    public function is_dev()
-    {
-        return !Chamilo::is_production_server();
-    }
-
-    /**
-     * Reverse engineering of the model from the database structure.
-     * Write result to the entity folder
-     * 
-     * WARNING THIS WILL OVERWRITE EXISTING MODEL.
-     * 
-     * @return boolean 
-     */
-    public function generate_model()
-    {
-        if (!$this->is_dev()) {
-            return false;
-        }
-
-        $root = $this->get_entity_path();
-
-        $connection_parameters = $this->get_connection_parameters();
-        $connection = Doctrine\DBAL\DriverManager::getConnection($connection_parameters);
-        $platform = $connection->getDatabasePlatform();
-        $platform->registerDoctrineTypeMapping('enum', 'string');
-        $platform->registerDoctrineTypeMapping('set', 'string');
-
-        $config = Setup::createConfiguration($this->is_dev());
-        $config->setMetadataDriverImpl(new Doctrine\ORM\Mapping\Driver\DatabaseDriver(new Doctrine\DBAL\Schema\MySqlSchemaManager($connection)));
-
-        $em = EntityManager::create($connection, $config);
-
-        $cmf = new Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
-        $cmf->setEntityManager($em);
-        $metadatas = $cmf->getAllMetadata();
-
-
-        $repo_factory = new EntityRepositoryGenerator();
-
-        $course = null;
-        foreach ($metadatas as $metadata) {
-            $n = strtolower($metadata->name);
-            if ($n == 'course') {
-                $course = $metadata;
-                break;
-            }
-        }
-
-        foreach ($metadatas as $metadata) {
-            echo sprintf('Processing entity "<info>%s</info>"', $metadata->name) . '<br/>';
-
-            foreach ($metadata->identifier as $key => $value) {
-                //$mapping = $metadata->fieldMappings[$value];                
-                $metadata->identifier[$key] = Inflector::tableize($value);
-            }
-
-            $fields = array();
-            foreach ($metadata->fieldMappings as $fieldMapping) {
-                $name = Inflector::tableize($fieldMapping['fieldName']);
-                $fieldMapping['fieldName'] = $name;
-                $fields[$name] = $fieldMapping;
-            }
-            $metadata->fieldMappings = $fields;
-
-            $n = $metadata->name;
-            if ($n == 'CDocument') {
-                $i = 1;
-            }
-            $name = $metadata->name;
-            $name = Inflector::tableize($name);
-            $is_course_table = (strpos($name, 'c_') === 0);
-            if ($is_course_table) {
-                $name = substr($name, 2, strlen($name) - 2);
-            }
-            //$metadata->namespace = 'Entity';
-            $metadata->customRepositoryClassName = 'Entity\\Repository\\' . Inflector::classify($name) . 'Repository';
-            //if(is_course_table){
-            $metadata->name = 'Entity\\' . Inflector::classify($name);
-
-            $metadata->lifecycleCallbacks['prePersist'] = array('before_save');
-
-            //}
-            //$metadata->rootEntityName = Inflector::classify($name);
-            if ($is_course_table) {
-                foreach ($metadata->fieldMappings as $mapping) {
-                    $name = $mapping['columnName'];
-                    $is_id = isset($mapping['id']) ? $mapping['id'] : false;
-                    if ($name != 'c_id' && $is_id) {
-                        
-                    }
-                }
-            }
-            if ($is_course_table) {
-                $metadata->is_course_table = true;
-//                $mapping = array();
-//                $mapping['cascade'] = array();
-//                $mapping['joinColumns'][0] = array('name' => 'c_id', 'referencedColumnName' => 'id');
-//                $mapping['sourceToTargetKeyColumns']['c_id'] = 'id';
-//                $mapping['joinColumnFieldNames']['c_id'] = 'c_id';
-//                $mapping['targetToSourceKeyColumns']['id'] = 'c_id';
-//                $mapping['id'] = 1;
-//                $mapping['isOwningSide'] = 0;
-//                $mapping['isCascadeRemove'] = 0;
-//                $mapping['isCascadePersist'] = 0;
-//                $mapping['isCascadeRefresh'] = 0;
-//                $mapping['isCascadeMerge'] = 0;
-//                $mapping['isCascadeDetach'] = 0;
-//                $mapping['orphanRemoval'] = 0;
-//                $mapping['type'] = ClassMetadataInfo::MANY_TO_ONE;
-//                $mapping['fetch'] = ClassMetadataInfo::FETCH_LAZY;
-//                $mapping['fieldName'] = 'course';
-//                $mapping['targetEntity'] = 'Entity\\Course';
-//                $mapping['sourceEntity'] = $metadata->name;
-//
-//                $metadata->associationMappings['course'] = $mapping;
-//                $metadata->identifier['course'];
-                
-//                unset($metadata->identifier['c_id']);
-//                unset($metadata->fieldMappings['c_id']);
-
-
-//                $mapping = array();
-//                $mapping['cascade'] = array();
-//                $mapping['joinColumns'][0] = array('name' => 'id', 'referencedColumnName' => 'c_id');
-//                $mapping['sourceToTargetKeyColumns']['id'] = 'c_id';
-//                $mapping['joinColumnFieldNames']['id'] = 'id';
-//                $mapping['targetToSourceKeyColumns']['c_id'] = 'id';
-//                $mapping['id'] = 1;
-//                $mapping['isOwningSide'] = 1;
-//                $mapping['isCascadeRemove'] = 0;
-//                $mapping['isCascadePersist'] = 0;
-//                $mapping['isCascadeRefresh'] = 0;
-//                $mapping['isCascadeMerge'] = 0;
-//                $mapping['isCascadeDetach'] = 0;
-//                $mapping['orphanRemoval'] = 0;
-//                $mapping['type'] = ClassMetadataInfo::ONE_TO_MANY;
-//                $mapping['fetch'] = ClassMetadataInfo::FETCH_LAZY;
-//                $name = explode('\\' ,$metadata->name);
-//                $name = end($name);
-//                $name = Inflector::tableize($name);
-//                $mapping['fieldName'] = $name;
-//                $mapping['targetEntity'] = $metadata->name;
-//                $mapping['sourceEntity'] = 'Entity\\Course';
-//                $course->associationMappings[$name] = $mapping;
-            }
-            $metadata->class_to_extend = $is_course_table ? 'CourseEntity' : 'Entity';
-            
-
-            $repo_factory->writeEntityRepositoryClass($metadata->name, $root . '\\repository\\');
-        }
-
-        $generator = new EntityGenerator();
-        
-        $generator->setClassToExtend('Entity');
-        $generator->setGenerateAnnotations(false);
-        $generator->setGenerateStubMethods(true);
-        $generator->setRegenerateEntityIfExists(false);
-        $generator->setUpdateEntityIfExists(false);
-        $generator->setBackupExisting(false);
-        $generator->setExtension('.class.php');
-        $generator->setNumSpaces(4);
-
-        // Generating Entities
-        $generator->generate($metadatas, $root);
-
-        $exporter = new \Doctrine\ORM\Tools\Export\Driver\YamlExporter();
-        $exporter->setOutputDir($root . '/mapping');
-        foreach ($metadatas as $metadata) {
-            echo $metadata->name . '<br/>';
-            try {
-                $exporter->setMetadata(array($metadata));
-                $exporter->export();
-            } catch (Exception $e) {
-                echo $e->getMessage();
-            }
-        }
-    }
-
-    public function update_schema($paths, $save_mode)
-    {
-//        $is_dev = $this->is_dev();
-//
-//        $ext = explode('.', $path);
-//        $ext = end($ext);
-//        if ($ext == 'yml') {
-//            $config = Setup::createYAMLMetadataConfiguration($paths, $is_dev);
-//        } else if ($ext == 'xml') {
-//            $config = Setup::createXMLMetadataConfiguration($paths, $is_dev);
-//        } else if ($ext == 'php') {
-//            $config = Setup::createAnnotationMetadataConfiguration($paths, $is_dev);
-//        } else {
-//            return false;
-//        }
-//
-//        $em = $this->em;
-//
-//        $cmf = new Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
-//        $cmf->setEntityManager($em);
-//        $classes = $cmf->getAllMetadata();
-//
-//        $tool = new Doctrine\ORM\Tools\SchemaTool($em);
-//        return $tool->updateSchema($classes, $save_mode);
-    }
-
-    protected function get_config()
-    {
-        return $this->config;
-    }
-
-    protected function get_connection_parameters()
-    {
-        global $_configuration;
-        $result = array(
-            'dbname' => $_configuration['main_database'],
-            'user' => $_configuration['db_user'],
-            'password' => $_configuration['db_password'],
-            'host' => $_configuration['db_host'],
-            'driver' => 'pdo_mysql',
-        );
-        return $result;
-    }
-
-}
-

+ 0 - 92
main/inc/lib/system/closure_compiler.class.php

@@ -1,92 +0,0 @@
-<?php
-
-/**
- * Proxy for the closure compiler. Allows to minify javascript files.
- * This makes use of CURL and calls the closure service.
- * 
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- * @see http://closure-compiler.appspot.com/home
- * @see https://developers.google.com/closure/compiler/
- *
- */
-class ClosureCompiler
-{
-
-    const PARAM_OUTPUT_FORMAT = 'output_format';
-    const PARAM_OUTPUT_INFO = 'output_info';
-    const PARAM_COMPILATION_LEVEL = 'compilation_level';
-    const PARAM_JS_CODE = 'js_code';
-    const LEVEL_SIMPLE = 'SIMPLE_OPTIMIZATIONS';
-    const LEVEL_WHITESPACE = 'WHITESPACE_ONLY';
-    const LEVEL_ADVANCED = 'ADVANCED_OPTIMIZATIONS';
-    const OUTPUT_FORMAT_TEXT = 'text';
-    const OUTPUT_INFO_CODE = 'compiled_code';
-
-    /**
-     * Url of the service
-     * 
-     * @return string 
-     */
-    public static function url()
-    {
-        return 'closure-compiler.appspot.com/compile';
-    }
-
-    /**
-     * Post data the closure compiler service. By default it returns minimized code
-     * with the simple option.
-     * 
-     * @param string $code Javascript code to minimify
-     * @param array $params parameters to pass to the service
-     * @return string minimified code
-     */
-    public static function post($code, $params = array())
-    {
-        if (!isset($params[self::PARAM_OUTPUT_FORMAT]))
-        {
-            $params[self::PARAM_OUTPUT_FORMAT] = self::OUTPUT_FORMAT_TEXT;
-        }
-        if (!isset($params[self::PARAM_OUTPUT_INFO]))
-        {
-            $params[self::PARAM_OUTPUT_INFO] = self::OUTPUT_INFO_CODE;
-        }
-        if (!isset($params[self::PARAM_COMPILATION_LEVEL]))
-        {
-            $params[self::PARAM_JS_CODE] = $code;
-        }
-
-        $params[self::PARAM_COMPILATION_LEVEL] = self::LEVEL_SIMPLE;
-
-        $fields = array();
-        foreach ($params as $key => $value)
-        {
-            $fields[] = $key . '=' . urlencode($value);
-        }
-        $fields = implode('&', $fields);
-
-        $headers = array("Content-type: application/x-www-form-urlencoded");
-
-        $url = self::url();
-
-        $ch = curl_init();
-
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($ch, CURLOPT_POST, true);
-        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
-        //curl_setopt($ch, CURLOPT_HEADER, false);
-        //curl_setopt($ch, CURLOPT_VERBOSE, true);
-
-        $content = curl_exec($ch);
-        $error = curl_error($ch);
-        $info = curl_getinfo($ch);
-
-        curl_close($ch);
-
-        return $content;
-    }
-
-}

+ 0 - 92
main/inc/lib/system/code_utilities.class.php

@@ -1,92 +0,0 @@
-<?php
-
-/**
- * Description of code_utilities
- *
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva 
- */
-class CodeUtilities
-{
-
-    const CLASS_PATTERN = '/(?:\s+class\s+[a-zA-Z_0-9\x7f-\xff]+\s*{)|(?:\s+class\s+[a-zA-Z_0-9\x7f-\xff]+\s*extends)|(?:\s+class\s+[a-zA-Z_0-9\x7f-\xff]+\s*implements)|(?:\s+interface\s+[a-zA-Z_0-9\x7f-\xff]+\s*{)|(?:\s+interface\s+[a-zA-Z_0-9\x7f-\xff]+\s*extends)/mi';
-    const INLINE_COMMENT_PATTERN = '#//.*$#m';
-    const MULTILINE_COMMENT_PATTERN = '#/\*.*?\*/#ms';
-    const NAMESPACE_PATTERN = '/namespace\s*(.*);/';
-    const IDENTIFIER_PATTERN = '/^[a-zA-Z_][a-zA-Z0-9_]*$/';
-
-    static function remove_comments($content)
-    {
-        $content = preg_replace(self::INLINE_COMMENT_PATTERN, '', $content);
-        $content = preg_replace(self::MULTILINE_COMMENT_PATTERN, '', $content);
-        return $content;
-    }
-
-    /**
-     * Returns the name of classes and interfaces contained in content.
-     * 
-     * @param text $content
-     * @return array
-     */
-    static function get_classes($content)
-    {
-        $result = array();
-        $cls_pattern = self::CLASS_PATTERN;
-
-        $content = self::remove_comments($content); //comments may contains class declaration we don't want to capture.      
-
-        $matches = array();
-        if (preg_match_all($cls_pattern, $content, $matches)) {
-            $matches = reset($matches);
-            foreach ($matches as $match) {
-                $match = str_replace("\n", ' ', $match);
-                $match = str_replace('{', ' ', $match);
-                $words = explode(' ', $match);
-                foreach ($words as $word) {
-                    $word = trim($word);
-                    //we capture the interface/class name with the current pattern
-                    if (strtolower($word) != 'class' && strtolower($word) != 'interface' && strtolower($word) != 'implements' && strtolower($word) != 'extends' && !empty($word)) {
-                        $result[] = $word;
-                        break; //we only take the first name as we don't want to capture the name of the interface or of the parent class name
-                    }
-                }
-            }
-        }
-        return $result;
-    }
-
-    static function get_namespace($content)
-    {
-        $namespace_pattern = self::NAMESPACE_PATTERN;
-        if (preg_match($namespace_pattern, $content, $matches)) {
-            $result = end($matches);
-            return trim($result);
-        } else {
-            return false;
-        }
-    }
-
-    static function is_valid_identifier($name)
-    {
-        $pattern = self::IDENTIFIER_PATTERN;
-        $r = preg_match($pattern, $name);
-        return $r;
-    }
-
-    /**
-     * Make path relative to root.
-     * 
-     * @param string $root
-     * @param string $path
-     * @return string
-     */
-    static function relative_path($root, $path)
-    {
-        $path = realpath($path);
-        $root = realpath($root);
-        $path = str_ireplace($root, '', $path);
-        $path = str_ireplace('\\', '/', $path);
-        return $path;
-    }
-
-}

+ 0 - 1
main/inc/lib/system/media/renderer/__README.txt

@@ -1 +0,0 @@
-Used to extract metadata from external resources : youtube, dailymotion, etc

+ 0 - 56
main/inc/lib/system/media/renderer/asset_aggregated_renderer.class.php

@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Process all renderers attached in order.
- * 
- * If a renderer returns an key value that has not already been set add it
- * to the result. Otherwise let the previous value unchanged.
- *
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetAggregatedRenderer extends AssetRenderer
-{
-
-    protected $renderers = array();
-
-    public function __construct($renderers)
-    {
-        $this->renderers = $renderers;
-    }
-
-    /**
-     *
-     * @return array
-     */
-    public function renderers()
-    {
-        return $this->renderers;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset
-     * @return array
-     */
-    public function render($asset)
-    {
-        $result = array();
-        $plugins = self::plugins();
-        foreach ($this->renderers as $renderer)
-        {
-            $data = $renderer->render($asset);
-            $data = $data ? $data : array();
-            foreach ($data as $key => $value)
-            {
-                if (!isset($result[$key]) && !empty($value))
-                {
-                    $result[$key] = $value;
-                }
-            }
-        }
-        return $result;
-    }
-
-}

+ 0 - 107
main/inc/lib/system/media/renderer/asset_renderer.class.php

@@ -1,107 +0,0 @@
-<?php
-
-require_once dirname(__FILE__) . '/http_resource.class.php';
-require_once dirname(__FILE__) . '/asset_aggregated_renderer.class.php';
-
-/**
- * Renderer for an http resource. 
- * Extract meta data and snippet html view from an given url/resource.
- * 
- * Base class. Other renderers must inherit from it.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetRenderer
-{
-
-    const THUMBNAIL = 'thumbnail';
-    const EMBED_SNIPPET = 'embed_snippet';
-    const EMBED_TYPE = 'embed_type';
-    const EMBED_URL = 'embed_url';
-    const WIDTH = 'width';
-    const HEIGHT = 'height';
-    const LANGUAGE = 'language';
-    const URL = 'url';
-    const TAGS = 'tags';
-    const TITLE = 'title';
-    const CREATED_TIME = 'created_time';
-    const DURATION = 'duration';
-    const DESCRIPTION = 'description';
-    const ICON = 'icon';
-
-    static function get($url, $config = array())
-    {
-        if (strpos('url', 'javascript:') !== false)
-        {
-            return array();
-        }
-        $result = array();
-        $url = trim($url);
-        if (empty($url))
-        {
-            return array();
-        }
-        $asset = new HttpResource($url, $config);
-        $renderer = new AssetAggregatedRenderer(self::plugins());
-        $result = $renderer->render($asset);
-        $result['url'] = $url;
-        return $result;
-    }
-
-    static function plugins()
-    {
-        static $result = array();
-        if (!empty($result))
-        {
-            return $result;
-        }
-
-        /*
-         * We make sure we load them from most specialized to less specialized.
-         * The first that provides a value for a field wins.
-         */
-        $protocols = array(
-            'oembed',
-            'og',
-            'image',
-            'media',
-            'rss',
-            'google_map',
-            'google_document',
-            'google_document_viewer',
-            'google_widget',
-            'mediaserver',
-            'scratch',
-            'page');
-
-        foreach ($protocols as $protocol)
-        {
-            $file = "asset_{$protocol}_renderer.class.php";
-            require_once dirname(__FILE__) . '/protocol/' . $file;
-            
-            $class = "asset_{$protocol}_renderer";
-            $class = explode('_', $class);
-            $class = array_map('ucfirst', $class);
-            $class = implode($class);
-            
-            $result[] = new $class();
-        }
-        return $result;
-    }
-
-    /**
-     * Renderer function. Take a http asset as input and return an array containing
-     * various properties: metadata, html snippet, etc.
-     * 
-     * @param HttpResource $asset
-     * @return array
-     */
-    public function render($asset)
-    {
-        $result = array();
-        return $result;
-    }
-
-}

+ 0 - 662
main/inc/lib/system/media/renderer/http_resource.class.php

@@ -1,662 +0,0 @@
-<?php
-
-/**
- * An HTTP resource. In most cases an HTML document.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class HttpResource
-{
-
-    /**
-     * Fetch the content and metadata of an url. 
-     * 
-     * If the content type is not parsable, i.e. it is not made of text, 
-     * only fetch the metadata and not the content. This is mostly done to 
-     * avoid downloading big files - videos, images, etc - which is unnecessary.
-     * 
-     * @param string $url   the url to fetch
-     * @return array        array containing the content and various info
-     */
-    static function fetch($url, $fetch_content = null)
-    {
-        static $cache = array();
-        if (isset($cache[$url]))
-        {
-            return $cache;
-        }
-
-        if (is_null($fetch_content) || $fetch_content === false)
-        {
-            // create a new cURL resource
-            $ch = curl_init();
-
-            // set URL and other appropriate options
-            curl_setopt($ch, CURLOPT_URL, $url);
-            curl_setopt($ch, CURLOPT_HEADER, false);
-            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-            curl_setopt($ch, CURLOPT_NOBODY, true);
-
-            $content = curl_exec($ch);
-            $error = curl_error($ch);
-            $info = curl_getinfo($ch);
-
-            // close cURL resource, and free up system resources
-            curl_close($ch);
-            $info['content'] = $content;
-            $info['error'] = $error;
-
-            if ($fetch_content === false)
-            {
-                return $cache[$url] = $info;
-            }
-
-            if (isset($info['content_type']) && strpos($info['content_type'], 'text') === false)
-            {
-                return $cache[$url] = $info;
-            }
-        }
-
-        // create a new cURL resource
-        $ch = curl_init();
-
-        // set URL and other appropriate options
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_HEADER, false);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-
-        //curl_setopt($ch, CURLOPT_VERBOSE, true);
-
-        $content = curl_exec($ch);
-        $error = curl_error($ch);
-        $info = curl_getinfo($ch);
-
-        // close cURL resource, and free up system resources
-        curl_close($ch);
-        $info['content'] = $content;
-        $info['error'] = $error;
-
-        return $cache[$url] = $info;
-    }
-
-    static function fetch_json($url)
-    {
-        $content = self::fetch($url, true);
-        $content = $content['content'];
-        if ($content)
-        {
-            $result = (array) json_decode($content);
-        }
-        else
-        {
-            $result = array();
-        }
-        return $result;
-    }
-
-    protected $url;
-    protected $url_params = null;
-    protected $info = null;
-    protected $source = null;
-    protected $metadata = null;
-    protected $links = null;
-    protected $title = null;
-    protected $mime = null;
-    protected $doc = null;
-    protected $config = array();
-
-    public function __construct($url, $config = array())
-    {
-        $this->url = $url;
-        $this->config = $config;
-    }
-
-    public function config($key = '', $default = null)
-    {
-        return isset($this->config[$key]) ? $this->config[$key] : $default;
-    }
-
-    /**
-     * Url of the resource
-     * 
-     * @return string
-     */
-    public function url()
-    {
-        return $this->url;
-    }
-
-    public function url_domain()
-    {
-        $url = $this->url();
-        $url = trim($url, '/');
-        if (strpos($url, '//') !== false)
-        {
-            $parts = explode('//', $url);
-            $url = end($parts);
-        }
-        $parts = explode('/', $url);
-        $result = reset($parts);
-        return $result;
-    }
-
-    /**
-     *
-     * @param array|string $part
-     * @return boolean 
-     */
-    public function url_match($part)
-    {
-        $params = func_get_args();
-        $params = is_array($params) ? $params : array($params);
-
-        $url = strtolower($this->url());
-        foreach ($params as $param)
-        {
-            if (strpos($url, strtolower($param)) !== false)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public function url_params()
-    {
-        if (!is_null($this->url_params))
-        {
-            return $this->url_params;
-        }
-
-        $url = $this->url();
-        if (strpos($url, '?') === false)
-        {
-            return $this->url_params = array();
-        }
-
-        $result = array();
-        $params = explode('?', $url);
-        $params = end($params);
-        $params = explode('&', $params);
-        foreach ($params as $param)
-        {
-            list($key, $val) = explode('=', $param);
-            $result[$key] = $val;
-        }
-
-        return $this->url_params = $result;
-    }
-
-    public function url_param($name, $default = false)
-    {
-        $params = $this->url_params();
-        return isset($params[$name]) ? $params[$name] : $default;
-    }
-
-    /**
-     * The name of the resource. I.e. the last part of the url without the ext
-     * 
-     * @return string
-     */
-    public function name()
-    {
-        $url = $this->url();
-        $url = explode('/', $url);
-        $title = end($url);
-        $title = explode('.', $title);
-        $title = reset($title);
-        return $title;
-    }
-
-    /**
-     * Extention of the url
-     * 
-     * @return string
-     */
-    public function ext()
-    {
-        $url = $this->url();
-        $url = explode('.', $url);
-        $ext = end($url);
-        $ext = strtolower($ext);
-        return $ext;
-    }
-
-    /**
-     * Return true if the object has one of the extentions. Overloaded:
-     * 
-     *      $res->has_ext('pdf');
-     *      $res->has_ext('pdf', 'doc');
-     *      $res->has_ext(array('pdf', 'doc'));
-     * 
-     * @param array|string $_
-     * @return boolean true if the resource has one of the extentions passed
-     */
-    public function has_ext($_)
-    {
-        if (is_array($_))
-        {
-            $params = $_;
-        }
-        else
-        {
-            $params = func_get_args();
-            $params = is_array($params) ? $params : array($params);
-        }
-        $ext = $this->ext();
-        foreach ($params as $param)
-        {
-            if (strtolower($param) == $ext)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public function charset()
-    {
-        $info = $this->info();
-
-        $content_type = isset($info['content_type']) ? $info['content_type'] : '';
-        if (empty($content_type))
-        {
-            return null;
-        }
-        $items = explode(';', $content_type);
-        foreach ($items as $item)
-        {
-            $parts = explode('=', $item);
-            if (count($parts) == 2 && reset($parts) == 'charset')
-            {
-                return strtolower(end($parts));
-            }
-        }
-        return null;
-    }
-
-    /**
-     * The mime type of the resource or the empty string if none has been specified
-     * 
-     * @return string
-     */
-    public function mime()
-    {
-        if (!is_null($this->mime))
-        {
-            return $this->mime;
-        }
-        $info = $this->info();
-
-        $content_type = isset($info['content_type']) ? $info['content_type'] : '';
-        if ($content_type)
-        {
-            $result = reset(explode(';', $content_type));
-            $result = strtolower($result);
-            return $this->mime = $result;
-        }
-
-        return $this->mime = '';
-    }
-
-    public function is_xml()
-    {
-        $mime = $this->mime();
-        if (!empty($mime))
-        {
-            return strpos($mime, 'xml') !== false;
-        }
-        return $this->ext() == 'xml';
-    }
-
-    public function is_image()
-    {
-        $mime = $this->mime();
-        if ($mime)
-        {
-            return strpos($mime, 'image') !== false;
-        }
-
-        $ext = $this->ext();
-        $formats = array('gif', 'jpeg', 'jpg', 'jpe', 'pjpeg', 'png', 'svg', 'tiff', 'ico');
-        foreach ($formats as $format)
-        {
-            if ($format == $ext)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public function is_video()
-    {
-        $mime = $this->mime();
-        if ($mime)
-        {
-            return strpos($mime, 'video') !== false;
-        }
-
-        $ext = $this->ext();
-        $formats = array('mpeg', 'mp4', 'ogg', 'wmv', 'mkv');
-        foreach ($formats as $format)
-        {
-            if ($format == $ext)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public function is_audio()
-    {
-        $mime = $this->mime();
-        if ($mime)
-        {
-            return strpos($mime, 'audio') !== false;
-        }
-
-        $ext = $this->ext();
-        $formats = array('mp3');
-        foreach ($formats as $format)
-        {
-            if ($format == $ext)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public function is_rss()
-    {
-        if (!$this->is_xml())
-        {
-            return false;
-        }
-
-        $doc = $this->doc();
-        $nodes = $doc->getElementsByTagName('rss');
-        return $nodes->length != 0;
-    }
-
-    public function is_gadget()
-    {
-        if (!$this->is_xml())
-        {
-            return false;
-        }
-
-        $doc = $this->doc();
-        $nodes = $doc->getElementsByTagName('ModulePrefs');
-        return $nodes->length != 0;
-    }
-
-    public function canonic_url($src)
-    {
-        if (strpos($src, '//') === 0)
-        {
-            $src = "http:$src";
-        }
-        else if (strpos($src, '/') === 0) //relative url to the root 
-        {
-            $url = $this->url();
-            $protocol = reset(explode('://', $url));
-            $domain = end(explode('://', $url));
-            $domain = reset(explode('/', $domain));
-            $src = "$protocol://$domain/$src";
-        }
-        else if (strpos($src, 'http') !== 0) //relative url to the document
-        {
-            $url = $this->url();
-            $tail = end(explode('/', $url));
-            $base = str_replace($tail, '', $url);
-
-            $src = $base . $src;
-        }
-        return $src;
-    }
-
-    /**
-     * Content of the resource.
-     * 
-     * @return string
-     */
-    public function source()
-    {
-        if (!is_null($this->source))
-        {
-            return $this->source;
-        }
-        $info = $this->info();
-
-        return $this->source = $info['content'];
-    }
-
-    /**
-     * Array of arrays containing the page's metadata. 
-     * 
-     * @return array
-     */
-    public function metadata()
-    {
-        if (!is_null($this->metadata))
-        {
-            return $this->metadata;
-        }
-        return $this->metadata = $this->get_metadata();
-    }
-
-    public function title()
-    {
-        if (!is_null($this->title))
-        {
-            return $this->title;
-        }
-        return $this->title = $this->get_title();
-    }
-
-    /**
-     *
-     * @return DOMDocument|boolean
-     */
-    public function doc()
-    {
-        if (!is_null($this->doc))
-        {
-            return $this->doc;
-        }
-        return $this->doc = $this->get_doc($this->source());
-    }
-
-    function get_meta($name)
-    {
-        $metadata = $this->metadata();
-        $name = strtolower($name);
-        foreach ($metadata as $attributes)
-        {
-            $key = isset($attributes['name']) ? $attributes['name'] : false;
-            $key = $key ? strtolower($key) : $key;
-            if ($name == $key)
-            {
-                return $attributes['content'];
-            }
-            $key = isset($attributes['property']) ? $attributes['property'] : false;
-            $key = $key ? strtolower($key) : $key;
-            if ($name == $key)
-            {
-                return isset($attributes['content']) ? $attributes['content'] : false;
-            }
-        }
-        return false;
-    }
-
-    function get_link($key, $value)
-    {
-        $links = $this->links();
-        $key = strtolower($key);
-        $value = strtolower($value);
-        foreach ($links as $attributes)
-        {
-            $a = isset($attributes[$key]) ? $attributes[$key] : false;
-            $a = $a ? strtolower($a) : $a;
-            if ($a == $value)
-            {
-                return $attributes;
-            }
-        }
-        return false;
-    }
-
-    public function links()
-    {
-        if (!is_null($this->links))
-        {
-            return $this->links;
-        }
-        return $this->links = $this->get_links();
-    }
-
-    /**
-     *
-     * @param string $xpath dom xpath
-     * @return string
-     */
-    public function findx($query)
-    {
-        $doc = $this->doc();
-        if (empty($doc))
-        {
-            return array();
-        }
-        $xpath = new DOMXpath($doc);
-        $nodes = $xpath->query($query);
-        if ($nodes->length > 0)
-        {
-            return $doc->saveXML($nodes->item(0));
-        }
-        else
-        {
-            return '';
-        }
-    }
-
-    protected function info()
-    {
-        if (!is_null($this->info))
-        {
-            return $this->info;
-        }
-        return $this->info = self::fetch($this->url());
-    }
-
-    /**
-     *
-     * @param string $source
-     * @return boolean|DOMDocument 
-     */
-    protected function get_doc($source)
-    {
-        if ($source == false)
-        {
-            return false;
-        }
-        $source = $this->source();
-        $result = new DOMDocument();
-        libxml_clear_errors();
-        libxml_use_internal_errors(true);
-        if ($this->is_xml())
-        {
-            $success = $result->loadXML($source);
-        }
-        else
-        {
-            $success = $result->loadHTML($source);
-        }
-        //$e = libxml_get_errors();
-        return $result ? $result : false;
-    }
-
-    protected function get_metadata()
-    {
-        $result = array();
-
-        $doc = $this->doc();
-        if ($doc == false)
-        {
-            return array();
-        }
-        $metas = $doc->getElementsByTagName('meta');
-        if ($metas->length == 0)
-        {
-            return $result;
-        }
-        foreach ($metas as $meta)
-        {
-            $values = array();
-            $attributes = $meta->attributes;
-            $length = $attributes->length;
-            for ($i = 0; $i < $length; ++$i)
-            {
-                $name = $attributes->item($i)->name;
-                $value = $attributes->item($i)->value;
-                $value = $attributes->item($i)->value;
-                $values[$name] = $value;
-            }
-            $result[] = $values;
-        }
-        return $result;
-    }
-
-    protected function get_title()
-    {
-        $doc = $this->doc();
-        if ($doc == false)
-        {
-            return '';
-        }
-        $titles = $doc->getElementsByTagName('title');
-        if ($titles->length == 0)
-        {
-            return false;
-        }
-        $result = $titles->item(0)->nodeValue;
-        return $result;
-    }
-
-    protected function get_links()
-    {
-        $doc = $this->doc();
-        if ($doc == false)
-        {
-            return array();
-        }
-        $result = array();
-
-        $metas = $doc->getElementsByTagName('link');
-        if ($metas->length == 0)
-        {
-            return $result;
-        }
-        foreach ($metas as $meta)
-        {
-            $values = array();
-            $attributes = $meta->attributes;
-            $length = $attributes->length;
-            for ($i = 0; $i < $length; ++$i)
-            {
-                $name = $attributes->item($i)->name;
-                $value = $attributes->item($i)->value;
-                $values[$name] = $value;
-            }
-            $result[] = $values;
-        }
-        return $result;
-    }
-
-}

+ 0 - 113
main/inc/lib/system/media/renderer/lab/asset_google_calendar_renderer.class.php

@@ -1,113 +0,0 @@
-<?php
-
-/**
- * Google calendar renderer. 
- * 
- * @todo: 
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetGoogleCalendarRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        $url = $asset->url();
-        $url = str_replace('http://', '', $url);
-        $url = str_replace('https://', '', $url);
-
-        $domain = reset(split('/', $url));
-        return strpos($domain, 'google.com/calendar') !== false;
-    }
-
-    /**
-     *
-     * @param string $url 
-     */
-    public function explode_url_parameters($url = null)
-    {
-        if (strpos($url, '?') === false)
-        {
-            return array();
-        }
-
-        $result = array();
-        $params = explode('?', $url);
-        $params = end($params);
-        $params = explode('&', $params);
-        foreach ($params as $param)
-        {
-            list($key, $val) = explode('=', $param);
-            $result[$key] = $val;
-        }
-
-        return $result;
-    }
-
-    public function implode_url_parameters($params)
-    {
-        $result = array();
-        foreach ($params as $key => $value)
-        {
-            if ($value)
-            {
-                $result[] = "$key=$value";
-            }
-        }
-        return join('&', $result);
-    }
-
-    protected function url($base = 'http:://map.google.com/', $params = array())
-    {
-        $head = reset(explode('?', $base));
-        $items = $this->explode_url_parameters($base);
-        foreach ($params as $key => $value)
-        {
-                $items[$key] = $value;
-        }
-        $tail = $this->implode_url_parameters($items);
-        $tail = empty($tail) ? '' : "?$tail";
-        return $head . $tail;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-        $params = array('output' => 'embed');
-        
-        $base = $asset->url();
-        $url = $this->url($base, $params);
-        
-        $title = $asset->title();
-        $description = $asset->get_meta('description');
-
-        $keywords = $asset->get_meta('keywords');
-
-        $embed = <<<EOT
-        <iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$url"></iframe>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::THUMBNAIL] = $image_src;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 57
main/inc/lib/system/media/renderer/lab/asset_mahara_group_renderer.class.php

@@ -1,57 +0,0 @@
-<?php
-
-/**
- * Internal group. I.e. a group from this instance of Mahara.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetMaharaGroupRenderer extends AssetRenderer
-{
-
-    public static function get_group_id($ref)
-    {
-        $ref = trim($ref);
-        $pattern = '#group/view.php\?id\=([0123456789]+)#';
-        $matches = array();
-        //mahara group's profile
-        if (preg_match($pattern, $ref, $matches))
-        {
-            return $matches[1];
-        }
-        //group id
-        if ($val = intval($ref))
-        {
-            return $val;
-        }
-
-        return false;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        $url = $asset->url();
-        $group_id = self::get_group_id($url);
-        if (empty($group_id))
-        {
-            return false;
-        }
-
-        $data = get_record('group', 'id', $group_id);
-
-        $result = array();
-        safe_require('blocktype', 'ple/group');
-        $result[self::EMBED_SNIPPET] = PluginBlocktypeGroup::render_preview($group_id);
-        $result[self::THUMBNAIL] = PluginBlocktypeGroup::get_thumbnail($group_id);
-        $result[self::TITLE] = $data->name;
-        $result[self::DESCRIPTION] = $data->description;
-
-        return $result;
-    }
-
-}

+ 0 - 63
main/inc/lib/system/media/renderer/lab/asset_mahara_person_renderer.class.php

@@ -1,63 +0,0 @@
-<?php
-
-/**
- *
- * Internal person. I.e. a person from this instance of Mahara.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetMaharaPersonRenderer extends AssetRenderer
-{
-
-    public static function get_user_id($ref)
-    {
-        $ref = trim($ref);
-        $pattern = '#user/view.php\?id\=([0123456789]+)#';
-        $matches = array();
-        //mahara user's profile
-        if (preg_match($pattern, $ref, $matches))
-        {
-            return $matches[1];
-        }
-        //email
-        if ($user = get_record('usr', 'email', $ref))
-        {
-            return $user->id;
-        }
-        //user id
-        if ($val = intval($ref))
-        {
-            return $val;
-        }
-
-        return false;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        $url = $asset->url();
-        $id = self::get_user_id($url);
-        if (empty($id))
-        {
-            return false;
-        }
-
-        $data = get_record('usr', 'id', $id);
-
-        $result = array();
-        safe_require('blocktype', 'ple/person');
-        $result[self::EMBED_SNIPPET] = PluginBlocktypePerson::render_preview($id);
-        $result[self::THUMBNAIL] = PluginBlocktypePerson::get_thumbnail($id);
-        $result[self::TITLE] = $data->prefferedname ? $data->prefferedname : $data->firstname . ' ' . $data->lastname;
-        $result[self::DESCRIPTION] = isset($data->description) ? $data->description : '';
-
-        return $result;
-    }
-
-}

+ 0 - 46
main/inc/lib/system/media/renderer/lab/asset_wiki_renderer.class.php

@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Wiki renderer. 
- * 
- * @see http://en.wikipedia.org/w/api.php
- * 
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetWikiRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {       
-        return $asset->url_match('wikipedia.org/wiki', 'mediawiki.org/wiki');
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     * 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $domain = $asset->url_domain();
-        $description = $asset->findx('//div[@id="bodyContent"]/p');
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $description;
-        $result[self::TITLE] = $title;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 75
main/inc/lib/system/media/renderer/protocol/asset_google_document_renderer.class.php

@@ -1,75 +0,0 @@
-<?php
-
-/**
- * Google document renderer. 
- * 
- * @see http://support.google.com/docs/bin/answer.py?hl=en&answer=86101&topic=1360911&ctx=topic
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetGoogleDocumentRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {       
-        $url = $asset->url();
-        
-        return strpos($url, 'docs.google.com/document/pub') !== false;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $url = $asset->url();
-
-        $title = $asset->title();
-        $description = $asset->get_meta('description');
-        $keywords = $asset->get_meta('keywords');
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        $embed = <<<EOT
-        
-        <div style="height:{$size}px;" class="resize vertical" >
-            <iframe style=background-color:#ffffff;" width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$url"></iframe>
-        </div>
-        <style type="text/css">
-        div.resize.vertical {
-            background-color: #EEEEEE;
-            border-color: #EEEEEE;
-            border-style: solid;
-            border-width: 1px;
-            resize:vertical;
-            overflow: hidden; 
-            padding-bottom:15px; 
-            min-height:24px; 
-            max-height:800px;
-}
-        </style>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 95
main/inc/lib/system/media/renderer/protocol/asset_google_document_viewer_renderer.class.php

@@ -1,95 +0,0 @@
-<?php
-
-/**
- * Google document viewer renderer. Provide an embeded viewer for the following
- * documetn types:
- * 
- *     Microsoft Word (.DOC and .DOCX)
- *     Microsoft Excel (.XLS and .XLSX)
- *     Microsoft PowerPoint (.PPT and .PPTX)
- *     Adobe Portable Document Format (.PDF)
- *     Apple Pages (.PAGES)
- *     Adobe Illustrator (.AI)
- *     Adobe Photoshop (.PSD)
- *     Tagged Image File Format (.TIFF)
- *     Autodesk AutoCad (.DXF)
- *     Scalable Vector Graphics (.SVG)
- *     PostScript (.EPS, .PS)
- *     TrueType (.TTF)
- *     XML Paper Specification (.XPS)
- *     Archive file types (.ZIP and .RAR)
- * 
- * @see https://docs.google.com/viewer
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetGoogleDocumentViewerRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        $supported_extentions = array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'pages', 'ai', 'psd', 'tiff', 'dxf', 'svg', 'eps', 'ps', 'eps', 'ttf', 'zip', 'rar');
-        return $asset->has_ext($supported_extentions);
-    }
-
-    protected function url($document_url)
-    {
-        return 'https://docs.google.com/viewer?embedded=true&url=' . urlencode($document_url);
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $url = $this->url($asset->url());
-
-        $title = $asset->title();
-        $description = $asset->get_meta('description');
-
-        $keywords = $asset->get_meta('keywords');
-
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        $embed = <<<EOT
-        <div style="height:{$size}px;" class="resize vertical" >
-            <iframe style=background-color:#ffffff;" width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$url"></iframe>
-        </div>
-        <style type="text/css">
-        div.resize.vertical {
-            background-color: #EEEEEE;
-            border-color: #EEEEEE;
-            border-style: solid;
-            border-width: 1px;
-            resize:vertical;
-            overflow: hidden; 
-            padding-bottom:15px; 
-            min-height:24px; 
-            max-height:800px;
-}
-        </style>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        //$result[self::THUMBNAIL] = $image_src;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 129
main/inc/lib/system/media/renderer/protocol/asset_google_map_renderer.class.php

@@ -1,129 +0,0 @@
-<?php
-
-/**
- * Google map page renderer. 
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetGoogleMapRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        $url = $asset->url();
-        $url = str_replace('http://', '', $url);
-        $url = str_replace('https://', '', $url);
-
-        $domain = reset(explode('/', $url));
-        return strpos($domain, 'maps.google') !== false;
-    }
-
-    /**
-     *
-     * @param string $url 
-     */
-    public function explode_url_parameters($url = null)
-    {
-        if (strpos($url, '?') === false)
-        {
-            return array();
-        }
-
-        $result = array();
-        $params = explode('?', $url);
-        $params = end($params);
-        $params = explode('&', $params);
-        foreach ($params as $param)
-        {
-            list($key, $val) = explode('=', $param);
-            $result[$key] = $val;
-        }
-
-        return $result;
-    }
-
-    public function implode_url_parameters($params)
-    {
-        $result = array();
-        foreach ($params as $key => $value)
-        {
-            if ($value)
-            {
-                $result[] = "$key=$value";
-            }
-        }
-        return join('&', $result);
-    }
-
-    protected function url($base = 'http:://map.google.com/', $params = array())
-    {
-        $head = reset(explode('?', $base));
-        $items = $this->explode_url_parameters($base);
-        foreach ($params as $key => $value)
-        {
-                $items[$key] = $value;
-        }
-        $tail = $this->implode_url_parameters($items);
-        $tail = empty($tail) ? '' : "?$tail";
-        return $head . $tail;
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $params = array('output' => 'embed');
-        
-        $base = $asset->url();
-        $url = $this->url($base, $params);
-        
-        $title = $asset->title();
-        $description = $asset->get_meta('description');
-
-        $keywords = $asset->get_meta('keywords');
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        $embed = <<<EOT
-        <div style="height:{$size}px;" class="resize vertical" >
-            <iframe style=background-color:#ffffff;" width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$url"></iframe>
-        </div>
-        <style type="text/css">
-        div.resize.vertical {
-            background-color: #EEEEEE;
-            border-color: #EEEEEE;
-            border-style: solid;
-            border-width: 1px;
-            resize:vertical;
-            overflow: hidden; 
-            padding-bottom:15px; 
-            min-height:24px; 
-            max-height:800px;
-}
-        </style>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 90
main/inc/lib/system/media/renderer/protocol/asset_google_widget_renderer.class.php

@@ -1,90 +0,0 @@
-<?php
-
-/**
- * Google widget/gadget renderer.
- * Accept the following urls:
- * 
- *      module:             http://www.google.com/ig/directory?type=gadgets&url=www.google.com/ig/modules/eyes/eyes.xml
- *      directory entry:    www.google.com/ig/modules/eyes/eyes.xml
- *      configured url:     www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/eyes/eyes.xml&amp;synd=open&amp;w=320&amp;h=121&amp;title=__MSG_title__&amp;lang=fr&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js
- * 
- * @see http://www.google.com/ig/directory?type=gadgets&url=www.google.com/ig/modules/eyes/eyes.xml
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetGoogleWidgetRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        
-        if ($asset->url_match('gmodules.com/ig/') && $asset->url_param('url') != false)
-        {
-            $url = $asset->url();
-            $title = $asset->url_param('title');
-            $title = ($title == '__MSG_title__') ? '' : $title;
-            
-            $embed = <<<EOT
-                <script src="$url"></script>
-EOT;
-            
-            $result = array();
-            $result[self::EMBED_SNIPPET] = $embed;
-            $result[self::TITLE] = $title;
-            return $result;
-        }
-
-        if (!$asset->is_gadget())
-        {
-            $url = $asset->url();
-
-            if (!$asset->url_match('google.com/ig/directory'))
-            {
-                return false;
-            }
-            if (!$asset->url_match('type=gadgets'))
-            {
-                return false;
-            }
-
-            $url = $asset->url_param('url');
-            if (empty($url))
-            {
-                return false;
-            }
-            $asset = new HttpResource($url);
-            if (!$asset->is_gadget())
-            {
-                return false;
-            }
-        }
-
-        $url = $asset->url();
-        if (strpos($url, 'http') !== 0)
-        {
-            $url = "http://$url";
-        }
-        $url = urlencode($url);
-        $title = $asset->title();
-        $title = $title ? $title : $asset->name();
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        $embed = <<<EOT
-        <script src="//www.gmodules.com/ig/ifr?url=$url&amp;w=$size&amp;output=js"></script>
-EOT;
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        return $result;
-    }
-
-}

+ 0 - 44
main/inc/lib/system/media/renderer/protocol/asset_image_renderer.class.php

@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Process image resources. I.e. png, jpeg, etc.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetImageRenderer extends AssetRenderer
-{
-    
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (! $asset->is_image())
-        {
-            return false;
-        }
-        
-        global $THEME;
-        $url = $asset->url();
-        $title = $asset->title();
-        $title = $title ? $title : $asset->name();
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-        
-        $embed = <<<EOT
-        <div style="text-align:center"><a href="$url"><img src="{$url}" width="$size" alt="{$title}" title="{$title}"></a></div>
-EOT;
-
-        $result = array();
-        $result[self::URL] = $url;
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::THUMBNAIL] = $url;
-        return $result;
-    }
-
-}

+ 0 - 65
main/inc/lib/system/media/renderer/protocol/asset_media_renderer.class.php

@@ -1,65 +0,0 @@
-<?php
-
-/**
- * Media renderer. I.e. video streams that can be embeded through an embed tag.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetMediaRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        if ($asset->is_video())
-        {
-            return true;
-        }
-        
-        //swf mime type is application/x-shockwave-flash
-        return $asset->has_ext('swf');
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $url = $asset->url();
-
-        $title = $asset->title();
-        $description = $asset->get_meta('description');
-        $keywords = $asset->get_meta('keywords');
-        
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-        
-        $width = $size;
-        $height = $size *9/16;
-
-        $embed = <<<EOT
-        <div style="text-align:center;"><embed style="display:inline-block;" width="{$width}px" height="{$height}px" name="plugin" src="$url" ></div>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-}

+ 0 - 65
main/inc/lib/system/media/renderer/protocol/asset_mediaserver_renderer.class.php

@@ -1,65 +0,0 @@
-<?php
-
-/**
- * Media Server renderer. 
- * 
- * Note that some videos are protected. It is therefore not possible to use the
- * autodiscovery feature. That is to get the web page, look at the meta data headers
- * and read the oembed api call. This would only work for public content/javascript
- * bookmarklet. 
- * 
- * So here we bypass the discovery service and directly call the API endpoint 
- * with the page url to retrieve oembed metadata - which happens to be public.
- * 
- * @see https://mediaserver.unige.ch
- * 
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetMediaserverRenderer extends AssetRenderer
-{
-    
-    const API_ENDPOINT = 'http://129.194.20.121/oembed/unige-oembed-provider-test.php';
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        return $asset->url_match('https://mediaserver.unige.ch/play/') ||$asset->url_match('http://mediaserver.unige.ch/play/');
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $width = (int) $asset->config('size');
-        $width = (24 <= $width && $width <= 800) ? $width : 300;
-        
-        $url = $asset->url();
-        
-        $oembed = self::API_ENDPOINT . '?url=' . urlencode($url) . '&maxwidth=' . $width;
-
-        $data = HttpResource::fetch_json($oembed); 
-        if (empty($data))
-        {
-            return false;
-        }
-
-        $result[self::THUMBNAIL] = isset($data['thumbnail_url']) ? $data['thumbnail_url'] : '';
-        $result[self::TITLE] = isset($data['title']) ? $data['title'] : '';
-        $result[self::EMBED_SNIPPET] = isset($data['html']) ? $data['html'] : '';
-
-        return $result;
-    }
-
-}

+ 0 - 124
main/inc/lib/system/media/renderer/protocol/asset_oembed_renderer.class.php

@@ -1,124 +0,0 @@
-<?php
-
-/**
- * Process html pages that support the oembed protocol.
- * 
- * Note that here we rely on the discovery service. That is each page that contains in
- * its metadata the oembed request.
- * 
- * @see http://oembed.com/
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- * 
- */
-class AssetOembedRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        $link = $asset->get_link('type', 'application/json+oembed');
-        if (empty($link))
-        {
-            return false;
-        }
-
-        $width = (int) $asset->config('size');
-        $width = (24 <= $width && $width <= 800) ? $width : 300;
-
-        $href = $link['href'];
-        $data = HttpResource::fetch_json("$href&maxwidth=$width"); //&maxheight=$height
-        if (empty($data))
-        {
-            return false;
-        }
-
-        $data['title'] = isset($data['title']) ? $data['title'] : '';
-        $data['width'] = isset($data['width']) ? intval($data['width']) : '';
-        $data['height'] = isset($data['height']) ? intval($data['height']) : '';
-
-        $type = $data['type'];
-        $f = array($this, "render_$type");
-        if (is_callable($f))
-        {
-            $result = call_user_func($f, $asset, $data);
-        }
-        else
-        {
-            $result = array();
-        }
-        $result[self::THUMBNAIL] = isset($data['thumbnail_url']) ? $data['thumbnail_url'] : '';
-        $result[self::TITLE] = isset($data['title']) ? $data['title'] : '';
-
-        return $result;
-    }
-
-    protected function render_photo($asset, $data)
-    {
-        if ($data['type'] != 'photo')
-        {
-            return array();
-        }
-
-        $result = array();
-        $html = isset($data['html']) ? $data['html'] : '';
-        if ($html)
-        {
-            $result[self::EMBED_SNIPPET] = '<div style="display:inline-block">' . $html . '</div>';
-            return $result;
-        }
-
-        $title = $data['title'];
-        $width = (int)$data['width'];
-        $height = (int)$data['height'];
-//        $ratio = $height / $width;
-//        $height = $ratio * $width;
-
-        $url = $data['url'];
-
-        $embed = <<<EOT
-        <div><a href="$url"><img src="{$url}" width="{$width}" height="{$height}" "alt="{$title}" title="{$title}"></a></div>
-EOT;
-
-        $result[self::EMBED_SNIPPET] = $embed;
-        return $result;
-    }
-
-    protected function render_video($asset, $data)
-    {
-        if ($data['type'] != 'video')
-        {
-            return array();
-        }
-        $result = array();
-        $result[self::EMBED_SNIPPET] = '<div style="display:inline-block">' . $data['html'] . '</div>';
-        return $result;
-    }
-
-    protected function render_rich($asset, $data)
-    {
-        if ($data['type'] != 'rich')
-        {
-            return array();
-        }
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = '<div style="display:inline-block">' . $data['html'] . '</div>';
-        return $result;
-    }
-
-    protected function render_link($asset, $data)
-    {
-        if ($data['type'] != 'link')
-        {
-            return array();
-        }
-        return array();
-    }
-
-}

+ 0 - 201
main/inc/lib/system/media/renderer/protocol/asset_og_renderer.class.php

@@ -1,201 +0,0 @@
-<?php
-
-/**
- * Process pages that support the open graph protocol
- * 
- * @see http://ogp.me/
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetOgRenderer extends AssetRenderer
-{
-
-    /**
-     * Renderer function. Take a http asset as input and return an array containing
-     * various properties: metadata, html snippet, etc.
-     * 
-     * @param HttpResource $asset
-     * @return array
-     */
-    public function render($asset)
-    {
-        $type = $asset->get_meta('og:type');
-        if (empty($type))
-        {
-            if ($video = $asset->get_meta('og:video'))
-            {
-                $type = 'video';
-            }
-            else if ($video = $asset->get_meta('og:image'))
-            {
-                $type = 'default';
-            }
-        }
-        if (empty($type))
-        {
-            return array();
-        }
-
-        $type = explode('.', $type);
-        $type = reset($type);
-        $f = array($this, "render_$type");
-        if (is_callable($f))
-        {
-            $result = call_user_func($f, $asset);
-        }
-        else
-        {
-            $result = $this->render_default($asset);
-        }
-
-        $result[self::TITLE] = $asset->get_meta('og:title');
-        $result[self::THUMBNAIL] = $asset->get_meta('og:image');
-        $result[self::LANGUAGE] = $asset->get_meta('og:language');
-
-        return $result;
-    }
-
-    /**
-     * @param HttpResource $asset
-     * @return array
-     */
-    protected function render_video($asset)
-    {
-        $url = $asset->get_meta('og:video');
-        $url = str_replace('?autoPlay=1', '?', $url);
-        $url = str_replace('&autoPlay=1', '', $url);
-
-        if (empty($url))
-        {
-            return array();
-        }
-
-        $type = $asset->get_meta('og:video:type');
-        if ($type)
-        {
-            $type = ' type="' . $type . '" ';
-        }
-        
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-        
-        $width = $asset->get_meta('og:video:width');
-        $width = $width ? $width : $asset->get_meta('video_width');
-        $height = $asset->get_meta('og:video:height');
-        $height = $height ? $height : $asset->get_meta('video_height');
-
-        if ($width)
-        {
-            $ratio = $height / $width;
-            $base = min($size, $width);
-            $width = $base;
-            $height = $ratio * $base;
-            $size = 'width="' . $width . '" height="' . $height . '"';
-        }
-        else
-        {
-            $size = 'width="' . $size . '"';
-        }
-
-        $embed = <<<EOT
-        <embed $type $size src="$url" />        
-EOT;
-
-        $result[self::EMBED_TYPE] = $type;
-        $result[self::EMBED_URL] = $url;
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TAGS] = $asset->get_meta('og:video:tag');
-        $result[self::CREATED_TIME] = $asset->get_meta('og:video:release_date');
-        $result[self::DURATION] = $asset->get_meta('og:duration');
-        return $result;
-    }
-
-    protected function render_article($asset)
-    {
-        $result = $this->render_default($asset);
-        return $result;
-    }
-
-    protected function render_audio($asset)
-    {
-        $result = $this->render_default($asset);
-        return $result;
-    }
-
-    protected function render_book($asset)
-    {
-        $result = $this->render_default($asset);
-        return $result;
-    }
-
-    /**
-     * 
-     * @param HttpResource $asset
-     * @return array
-     */
-    protected function render_default($asset)
-    {
-        $url = $asset->get_meta('og:url');
-        $url = htmlentities($url);
-        $title = $asset->get_meta('og:title');
-        $image = $asset->get_meta('og:image');
-        $image = htmlentities($image);
-        $width = $asset->get_meta('og:image:width');
-        $height = $asset->get_meta('og:image:height');
-        $description = $asset->get_meta('og:description');
-        $description = $description ? $description : $asset->get_meta('description');
-
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        if ($width)
-        {
-            $ratio = $height / $width;
-            $base = min($size, $width);
-            $width = $base;
-            $height = $ratio * $base;
-            $size = 'width="' . $width . '" height="' . $height . '"';
-        }
-        else
-        {
-            $size = 'width="' . $size . '"';
-        }
-        $embed = <<<EOT
-        <div>
-            <a href="$url" style="float:left; margin-right:5px; margin-bottom:5px; display:block;"><img src="{$image}" {$size} alt="{$title}" title="{$title}"></a>
-            <div style="clear:both;"></div>
-        </div>
-EOT;
-
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::DESCRIPTION] = $asset->get_meta('description');
-        return $result;
-    }
-
-    /**
-     * @param HttpResource $asset
-     * @return array
-     */
-    protected function render_image($asset)
-    {
-        $size = (int) $asset->config('size');
-        $size = (24 <= $size && $size <= 800) ? $size : 300;
-
-        $title = $data['title'];
-        $width = $data['width'];
-        $height = $data['height'];
-        $ratio = $height / $width;
-        $base = min($size, $width);
-        $width = $base;
-        $height = $ratio * $base;
-
-        $url = $data['url'];
-
-        $embed = <<<EOT
-        <a href="$url"><img src="{$url}" width="{$width}" height="{$height} "alt="{$title}" title="{$title}"></a>
-EOT;
-    }
-
-}

+ 0 - 83
main/inc/lib/system/media/renderer/protocol/asset_page_renderer.class.php

@@ -1,83 +0,0 @@
-<?php
-
-/**
- * Generic HTML page renderer. Process any html page.
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetPageRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        global $THEME;
-        $url = $asset->url();
-        $title = $asset->title();
-        $title = $title ? $title : $asset->name();
-        $description = $asset->get_meta('description');
-        $description = $description;
-
-        $keywords = $asset->get_meta('keywords');
-
-        $image_src = $asset->get_link('rel', 'image_src');
-        $image_src = $image_src ? $image_src['href'] : false;
-
-        if (empty($image_src))
-        {
-            $image_src = $this->get_icon($asset);
-        }
-
-        $icon = $this->get_icon($asset);
-        
-        $image_src = $asset->canonic_url($image_src);
-        $icon = $asset->canonic_url($icon);
-
-        $embed = <<<EOT
-        <a href="$url">
-            <img src="{$image_src}" alt="{$title}" title="{$title}" style="float:left; margin-right:5px; margin-bottom:5px; " >
-        </a>
-        $description
-        <span style="clear:both;"></span>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        $result[self::THUMBNAIL] = $image_src;
-        $result[self::DESCRIPTION] = $description;
-        $result[self::ICON] = $icon;
-        $result[self::TAGS] = $keywords;
-        return $result;
-    }
-
-    function get_icon($asset)
-    {
-
-        $icon = $asset->get_link('rel', 'apple-touch-icon');
-        $icon = $icon ? $icon['href'] : false;
-        if (empty($icon))
-        {
-            $icon = $asset->get_link('rel', 'fluid-icon');
-            $icon = $icon ? $icon['href'] : false;
-        }
-        if (empty($icon))
-        {
-            $icon = $asset->get_link('rel', 'shortcut icon');
-            $icon = $icon ? $icon['href'] : false;
-        }
-        if (empty($icon))
-        {
-            $icon = $asset->get_link('rel', 'icon');
-            $icon = $icon ? $icon['href'] : false;
-        }
-        return $icon;
-    }
-
-}

+ 0 - 95
main/inc/lib/system/media/renderer/protocol/asset_rss_renderer.class.php

@@ -1,95 +0,0 @@
-<?php
-
-/**
- * Rss renderer. Display RSS thanks to Google feed control.
- * 
- * @see http://www.google.com/uds/solutions/dynamicfeed/reference.html
- * @see http://code.google.com/apis/ajax/playground/#dynamic_feed_control_-_vertical
- * 
- * @copyright (c) 2011 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetRssRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$asset->is_rss())
-        {
-            return;
-        }
-
-        $url = $asset->url();
-        $title = $asset->title();
-        $id = 'a' . md5($url);
-
-        $embed = <<<EOT
-        <style type="text/css">
-            .gfg-root {
-                border: none;
-                font-family: inherit;
-            }
-        </style>
-        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
-        <script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js" type="text/javascript"></script> 
-        <script type="text/javascript">
-        
-            function init()
-            {
-                if (typeof this.has_run == 'undefined' )
-                {
-                    this.has_run = true;
-                }
-                else
-                {
-                    return;
-                }
-                var head = document.getElementsByTagName('head')[0];
-        
-                var element = document.createElement('link');
-                element.type = 'text/css';
-                element.rel = 'stylesheet';
-                element.href = 'http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css';
-                head.appendChild(element);
-            }
-
-            function load_$id() {
-                var feeds = [
-                    {
-                    title: ' ',
-                    url: '$url'
-                    }
-                ];
-
-                var options = {
-                    stacked : false,
-                    horizontal : false,
-                    title : '',
-                    numResults : 10
-                };
-
-                new GFdynamicFeedControl(feeds, '$id', options);
-                document.getElementById('content').style.width = "500px";
-            }
-        
-        
-            init();
-            google.load('feeds', '1');
-            google.setOnLoadCallback(load_$id);
-       </script>        
-       <div id="$id" style="min-height:271px;">Loading...</div>
-EOT;
-
-
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::TITLE] = $title;
-        return $result;
-    }
-
-}

+ 0 - 76
main/inc/lib/system/media/renderer/protocol/asset_scratch_renderer.class.php

@@ -1,76 +0,0 @@
-<?php
-
-/**
- * Scratch renderer. 
- * 
- * @see http://scratch.mit.edu/projects/
- * 
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht
- */
-class AssetScratchRenderer extends AssetRenderer
-{
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function accept($asset)
-    {
-        return $asset->url_match('http://scratch.mit.edu/projects/');
-    }
-
-    /**
-     *
-     * @param HttpResource $asset 
-     */
-    public function render($asset)
-    {
-        if (!$this->accept($asset))
-        {
-            return;
-        }
-
-        $matches = array();
-        $pattern = "#http:\/\/scratch.mit.edu\/projects\/(\w+)/(\d*)\/?#ims";
-        preg_match($pattern, $asset->url(), $matches);
-
-        $url = $matches[0];
-        $author = $matches[1];
-        $project_id = $matches[2];
-
-        $project_url = "../../static/projects/$author/$project_id.sb";
-        $image_url = "http://scratch.mit.edu/static/projects/$author/{$project_id}_med.png";
-        $thumb_url = "http://scratch.mit.edu/static/projects/$author/{$project_id}_sm.png";
-
-        $height = 387;
-        $width = 482;
-
-        if (function_exists('get_string'))
-        {
-            $no_java = get_string('no_java', 'artefact.extresource');
-        }
-        else
-        {
-            $no_java = 'Java is not installed on your computer. You must install java first.';
-        }
-
-        $embed = <<<EOT
-        <object type="application/x-java-applet" width="$width" height="$height"  style="display:block" id="ProjectApplet">
-
-            <param name="codebase" value="http://scratch.mit.edu/static/misc">
-            <param name="archive" value="ScratchApplet.jar">
-            <param name="code" value="ScratchApplet">
-            <param name="project" value="$project_url">
-            <pre>$no_java</pre>
-            <img alt="" src="$image_url">
-        </object>
-EOT;
-        $result = array();
-        $result[self::EMBED_SNIPPET] = $embed;
-        $result[self::THUMBNAIL] = $thumb_url;
-        return $result;
-    }
-
-}

+ 0 - 131
main/inc/lib/system/net/curl.class.php

@@ -1,131 +0,0 @@
-<?php
-
-/**
- * 
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class Curl
-{
-
-    protected static $default_options = array();
-
-    static function get_default_options($options = array())
-    {
-        if (empty(self::$default_options)) {
-            self::$default_options[CURLOPT_HEADER] = false;
-            self::$default_options[CURLOPT_RETURNTRANSFER] = true;
-            self::$default_options[CURLOPT_SSL_VERIFYPEER] = false;
-        }
-
-        $result = self::$default_options;
-        foreach ($options as $key => $value) {
-            $result[$key] = $value;
-        }
-        return $result;
-    }
-
-    static function set_default_option($key, $value)
-    {
-        $options = $this->get_options(array($key => $value));
-        self::$default_options = $options;
-    }
-
-    /**
-     *
-     * @param string $url
-     * @param array $options
-     * @return Curl
-     */
-    static function get($url, $options = array())
-    {
-        $options[CURLOPT_HTTPGET] = true;
-        $result = new self($url, $options);
-        return $result;
-    }
-
-    /**
-     *
-     * @param string $url
-     * @param array $fields
-     * @param array $options
-     * @return Curl 
-     */
-    static function post($url, $fields, $options = array())
-    {
-        $options[CURLOPT_POST] = true;
-        $options[CURLOPT_POSTFIELDS] = $fields;
-        $result = new self($url, $options);
-        return $result;
-    }
-
-    protected $url = '';
-    protected $options = array();
-    protected $content = '';
-    protected $info = array();
-    protected $error = '';
-    protected $error_no = 0;
-
-    function __construct($url, $options = array())
-    {
-        $this->url = $url;
-        $this->options = self::get_default_options($options);
-    }
-
-    function url()
-    {
-        return $this->url;
-    }
-
-    function options()
-    {
-        return $this->options;
-    }
-
-    function execute()
-    {
-        $ch = curl_init();
-
-        $options = $this->options;
-        $options[CURLOPT_URL] = $this->url;
-        curl_setopt_array($ch, $options);
-
-        $this->content = curl_exec($ch);
-        $this->error = curl_error($ch);
-        $this->info = curl_getinfo($ch);
-        $this->error_no = curl_errno($ch);
-
-        curl_close($ch);
-
-        return $this->content;
-    }
-
-    function content()
-    {
-        return $this->content;
-    }
-
-    /**
-     * @return array|string
-     */
-    function info($key = false)
-    {
-        if ($key) {
-            return isset($this->info[$key]) ? $this->info[$key] : false;
-        } else {
-            return $this->info;
-        }
-    }
-
-    function error()
-    {
-        return $this->error;
-    }
-
-    function error_no()
-    {
-        return $this->error_no;
-    }
-
-}

+ 0 - 72
main/inc/lib/system/net/http_channel.class.php

@@ -1,72 +0,0 @@
-<?php
-
-namespace net;
-
-use Curl;
-
-/**
- * Description of channel
- *
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class HttpChannel
-{
-
-    /**
-     *
-     * @param string $url
-     * @param type $modules
-     * @return HttpChannel 
-     */
-    static function create($url, $modules = array())
-    {
-        return new self($url, $modules);
-    }
-
-    protected $base_url = '';
-    protected $modules = array();
-
-    public function __construct($base_url = '', $modules = array())
-    {
-        $this->base_url = $base_url;
-        $this->modules = $modules;
-    }
-    
-    function modules()
-    {
-        return $this->modules;
-    }
-
-    function get($url, $parameters)
-    {
-        $options = $this->get_options();
-        $url = $this->base_url . $url;
-        return Curl::get($url, $options)->execute();
-    }
-
-    function post($url, $fields)
-    {
-        $options = $this->get_options();
-        $url = $this->base_url . $url;
-        return Curl::post($url, $fields, $options)->execute();
-    }
-
-    protected function get_options()
-    {
-        $result = array();
-        $modules = $this->modules();
-        foreach ($modules as $module) {
-            if (is_array($module)) {
-                $options = $module;
-            } else {
-
-                $options = $module->get_options();
-            }
-            $result = array_merge($result, $options);
-        }
-        return $result;
-    }
-
-}

+ 0 - 149
main/inc/lib/system/portfolio/artefact.class.php

@@ -1,149 +0,0 @@
-<?php
-
-namespace Portfolio;
-
-/**
- * An artefact is any object the user can display in its portfolio. 
- * 
- * The artefact point either to a local file or to a url from which the object's content
- * can be fetched.
- * 
- * Usage
- * 
- *      $artefact = new artefact();
- *      $artefact->set_path('...');
- * 
- * or 
- * 
- * 
- *      $artefact = new artefact();
- *      $artefact->set_url('...');
- *
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class Artefact
-{
-
-    protected $id = '';
-    protected $mime_type = '';
-    protected $name = '';
-    protected $description = '';
-    protected $path = '';
-    protected $url = '';
-    protected $creation_date = '';
-    protected $modification_date = '';
-    protected $metadata = null;
-
-    /**
-     *
-     * @param string $file Either url or file path
-     */
-    public function __construct($file = '')
-    {
-        if ($file) {
-            if (strpos($file, 'http') !== false) {
-                $this->url = $file;
-            } else {
-                $this->path = $file;
-            }
-        }
-        $this->id = uniqid('', true);
-        $this->mime_type = '';
-        $time = time();
-        $this->creation_date = $time;
-        $this->modification_date = $time;
-    }
-
-    public function get_id()
-    {
-        return $this->id;
-    }
-
-    public function set_id($value)
-    {
-        $this->id = $value;
-    }
-
-    public function get_name()
-    {
-        return $this->name;
-    }
-
-    public function set_name($value)
-    {
-        $this->name = $value;
-    }
-
-    public function get_mime_type()
-    {
-        return $this->mime_type;
-    }
-
-    public function set_mime_type($value)
-    {
-        $this->mime_type = $value;
-    }
-
-    public function get_description()
-    {
-        return $this->description;
-    }
-
-    public function set_description($value)
-    {
-        $this->description = $value;
-    }
-
-    public function get_path()
-    {
-        return $this->path;
-    }
-
-    public function set_path($value)
-    {
-        $this->path = $value;
-    }
-
-    public function get_url()
-    {
-        return $this->url;
-    }
-
-    public function set_url($value)
-    {
-        $this->url = $value;
-    }
-
-    public function get_creation_date()
-    {
-        return $this->creation_date;
-    }
-
-    public function set_creation_date($value)
-    {
-        $this->creation_date = $value;
-    }
-
-    public function get_modification_date()
-    {
-        return $this->modification_date;
-    }
-
-    public function set_modification_date($value)
-    {
-        $this->modification_date = $value;
-    }
-
-    public function get_metadata()
-    {
-        return $this->metadata;
-    }
-
-    public function set_metadata($value)
-    {
-        $this->metadata = $value;
-    }
-
-}

+ 0 - 35
main/inc/lib/system/portfolio/download.class.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace Portfolio;
-
-use Header;
-
-/**
- * Download file to your desktop
- *
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class Download extends Portfolio
-{
-
-    function __construct()
-    {
-        parent::__construct('download', null);
-    }
-
-    /**
-     *
-     * @param User $user
-     * @param Artefact $artefact
-     * @return bool
-     */
-    function send($user, $artefact)
-    {
-        if ($artefact->get_url()) {
-            Header::location($artefact->get_url());
-        }
-    }
-
-}

+ 0 - 59
main/inc/lib/system/portfolio/mahara.class.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace Portfolio;
-
-use Header;
-
-/**
- * Interface with a Mahara portfolio.
- * 
- * This class requires that the connect mahara plugin is installed and enabled.
- *
- * @see https://mahara.org/
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class Mahara extends Portfolio
-{
-
-    protected $url = '';
-
-    /**
-     *
-     * @param string $url       The root url 
-     */
-    function __construct($url)
-    {
-        $name = md5($url);
-        parent::__construct($name, null);
-        $this->url = $url;
-    }
-
-    function get_url()
-    {
-        return $this->url;
-    }
-    
-    function get_title(){
-        $result = parent::get_title();
-        $result = $result ? $result : 'Mahara';
-        return $result;
-    }
-
-    /**
-     *
-     * @param User $user
-     * @param Artefact $artefact
-     * @return bool
-     */
-    function send($user, $artefact)
-    {
-        $root = $this->get_url();
-        rtrim($root, '/');
-        $url = $artefact->get_url();
-        $url = $root . '/artefact/connect/upload.php?url=' . urlencode($url) . '&extract=true';
-        Header::location($url);
-    }
-
-}

+ 0 - 106
main/inc/lib/system/portfolio/portfolio.class.php

@@ -1,106 +0,0 @@
-<?php
-
-namespace Portfolio;
-
-/**
- * Portfolio are used to display and share content. The porfolio class represents
- * one (external) portfolio application and allows to share content with an it. 
- *
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class Portfolio
-{
-
-    public static function none()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self('empty', null);
-        }
-        return $result;
-    }
-
-    public static function all()
-    {
-        
-    }
-
-    protected $name;
-    protected $title = '';
-    protected $description = '';
-    protected $channel;
-
-    function __construct($name, $channel = null)
-    {
-        $this->name = $name;
-        $this->title = $name;
-        $this->channel = $channel;
-    }
-
-    /**
-     * The name of the portfolio - i.e. the unique id.
-     * @return type 
-     */
-    function get_name()
-    {
-        return $this->name;
-    }
-    
-    /**
-     * Title for the end user.
-     * 
-     * @return type 
-     */
-    function get_title()
-    {
-        return $this->title;
-    }
-    
-    function set_title($value)
-    {
-        $this->title = $value;
-    }
-    
-    /**
-     * Description for the end user.
-     * 
-     * @return type 
-     */
-    function get_description()
-    {
-        return $this->description;
-    }
-    
-    function set_description($value)
-    {
-        $this->description = $value;
-    }
-
-    /**
-     *
-     * @return HttpChannel
-     */
-    function channel()
-    {
-        return $this->channel;
-    }
-
-    function __toString()
-    {
-        return $this->name;
-    }
-
-    /**
-     *
-     * @param User $user
-     * @param Artefact $artefact
-     * @return bool
-     */
-    function send($user, $artefact)
-    {
-        return false;
-    }
-
-}

+ 0 - 19
main/inc/lib/system/portfolio/user.class.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace Portfolio;
-
-/**
- * A portfolio user is used to share identity between two applications.
- * Not used at this point.
- *
- * @copyright (c) 2012 University of Geneva
- * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
- * @author Laurent Opprecht <laurent@opprecht.info>
- */
-class User
-{
-    public $id;
-    public $email;
-    public $token;
-        
-}

+ 0 - 86
main/inc/lib/system/web/header.class.php

@@ -1,86 +0,0 @@
-<?php
-
-/**
- * Header utility functions.
- *
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- */
-class Header
-{
-
-    public static function response_code($response_code)
-    {
-        if (function_exists('http_response_code')) {
-            http_response_code($response_code);
-            return;
-        }
-
-        switch ($response_code) {
-            case 400:
-                header("HTTP/1.0 $response_code Bad Request");
-            case 401:
-                header("HTTP/1.0 $response_code Unauthorized");
-            case 402:
-                header("HTTP/1.0 $response_code Payment Required");
-            case 403:
-                header("HTTP/1.0 $response_code Forbidden");
-            case 404:
-                header("HTTP/1.0 $response_code Not Found");
-            default:
-                header("HTTP/1.0 $response_code");
-        }
-    }
-
-    public static function content_type($mime_type, $charset = '')
-    {
-        if (empty($mime_type)) {
-            return;
-        }
-        $type = $charset ? "$mime_type;charset=$charset" : $mime_type;
-        header('Content-type: ' . $type);
-    }
-
-    public static function content_type_xml()
-    {
-        header('Content-type: text/xml');
-    }
-
-    public static function content_type_json()
-    {
-        header('Content-type: application/json');
-    }
-
-    public static function content_type_javascript()
-    {
-        header('Content-type: application/javascript');
-    }
-
-    /**
-     * Redirect the navigator to the specified url.
-     * 
-     * @param string $url 
-     */
-    public static function location($url)
-    {
-        header("Location: $url");
-        exit;
-    }
-
-    public static function expires($timestamp)
-    {
-        $value = gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
-        header('Expires: ' . $value);
-    }
-
-    public static function cache_control($value)
-    {
-        header('Cache-Control: ' . $value);
-    }
-
-    public static function pragma($value)
-    {
-        header('Pragma: ' . $value);
-    }
-
-}

+ 0 - 70
main/inc/lib/system/web/request.class.php

@@ -1,70 +0,0 @@
-<?php
-
-/**
- * Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters.
-
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
- */
-
-class Request2
-{
-
-    public static function get($key, $default = null)
-    {
-        return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
-    }
-
-    public static function has($key){
-        return isset($_REQUEST[$key]);
-    }
-
-    /**
-     * Returns true if the request is a GET request. False otherwise.
-     *
-     * @return bool
-     */
-    public static function is_get()
-    {
-        $method = self::server()->request_method();
-        $method = strtoupper($method);
-        return $method == 'GET';
-    }
-
-    public static function post($key, $default = null)
-    {
-        return isset($_POST[$key]) ? $_POST[$key] : $default;
-    }
-
-    /**
-     * Returns true if the request is a POST request. False otherwise.
-     *
-     * @return bool
-     */
-    public static function is_post()
-    {
-        $method = self::server()->request_method();
-        $method = strtoupper($method);
-        return $method == 'POST';
-    }
-
-    /**
-     *
-     * @return RequestServer
-     */
-    static function server()
-    {
-        return RequestServer::instance();
-    }
-
-    static function file($key, $default = null)
-    {
-        return isset($_FILES[$key]) ? $_FILES[$key] : $default;
-    }
-
-    static function environment($key, $default = null)
-    {
-        return isset($_ENV[$key]) ? $_ENV[$key] : $default;
-    }
-
-}

+ 0 - 302
main/inc/lib/system/web/request_server.class.php

@@ -1,302 +0,0 @@
-<?php
-
-/**
- * Provides access to the $_SERVER variable. Useful to have autocompletion working. 
- * Access through the Request class.
- * 
- * Example:
- * 
- *  Request :: server()-> request_uri()
- * 
- * 
- * @license see /license.txt
- * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva 
- */
-class RequestServer
-{
-
-    public static function instance()
-    {
-        static $result = null;
-        if (empty($result)) {
-            $result = new self();
-        }
-        return $result;
-    }
-
-    function get($key, $default = null)
-    {
-        return isset($_SERVER[$key]) ? $_SERVER[$key] : null;
-    }
-
-    /**
-     * The timestamp of the start of the request. Available since PHP 5.1.0. 
-     * 
-     * @return string 
-     */
-    function request_time()
-    {
-        return isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : null;
-    }
-
-    /**
-     * Contents of the Host: header from the current request, if there is one. 
-     * 
-     * @return string 
-     */
-    function http_host()
-    {
-        return isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
-    }
-
-    /**
-     * Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent. 
-     * 
-     * @return string 
-     */
-    function http_user_agent()
-    {
-        return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
-    }
-
-    /**
-     * Contents of the Accept: header from the current request, if there is one. 
-     * 
-     * @return string 
-     */
-    function http_accept()
-    {
-        return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
-    }
-
-    /**
-     * Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'. 
-     * 
-     * @return string 
-     */
-    function http_accept_language()
-    {
-        return isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
-    }
-
-    /**
-     * Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'. 
-     * 
-     * @return string 
-     */
-    function http_accept_encoding()
-    {
-        return isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : null;
-    }
-
-    /**
-     * Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'. 
-     * 
-     * @return string 
-     */
-    function http_connection()
-    {
-        return isset($_SERVER['HTTP_CONNECTION']) ? $_SERVER['HTTP_CONNECTION'] : null;
-    }
-
-    function http_cookie()
-    {
-        return isset($_SERVER['HTTP_COOKIE']) ? $_SERVER['HTTP_COOKIE'] : null;
-    }
-
-    function http_cache_control()
-    {
-        return isset($_SERVER['HTTP_CACHE_CONTROL']) ? $_SERVER['HTTP_CACHE_CONTROL'] : null;
-    }
-
-    function path()
-    {
-        return isset($_SERVER['PATH']) ? $_SERVER['PATH'] : null;
-    }
-
-    function systemroot()
-    {
-        return isset($_SERVER['SystemRoot']) ? $_SERVER['SystemRoot'] : null;
-    }
-
-    function comspec()
-    {
-        return isset($_SERVER['COMSPEC']) ? $_SERVER['COMSPEC'] : null;
-    }
-
-    function pathext()
-    {
-        return isset($_SERVER['PATHEXT']) ? $_SERVER['PATHEXT'] : null;
-    }
-
-    function windir()
-    {
-        return isset($_SERVER['WINDIR']) ? $_SERVER['WINDIR'] : null;
-    }
-
-    function server_signature()
-    {
-        return isset($_SERVER['SERVER_SIGNATURE']) ? $_SERVER['SERVER_SIGNATURE'] : null;
-    }
-
-    /**
-     * Server identification string, given in the headers when responding to requests. 
-     * 
-     * @return string 
-     */
-    function server_software()
-    {
-        return isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : null;
-    }
-
-    /**
-     * The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
-     * 
-     * @return string
-     */
-    function server_name()
-    {
-        return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
-    }
-
-    /**
-     * The IP address of the server under which the current script is executing. 
-     * 
-     * @return string 
-     */
-    function server_addr()
-    {
-        return isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : null;
-    }
-
-    function server_port()
-    {
-        return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
-    }
-
-    /**
-     * The IP address from which the user is viewing the current page. 
-     * 
-     * @return string 
-     */
-    function remote_addr()
-    {
-        return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
-    }
-
-    /**
-     * The document root directory under which the current script is executing, as defined in the server's configuration file. 
-     * @return string 
-     */
-    function document_root()
-    {
-        return isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : null;
-    }
-
-    /**
-     * The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. 
-     * 
-     * @return string 
-     */
-    function server_admin()
-    {
-        return isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : null;
-    }
-
-    /**
-     * The absolute pathname of the currently executing script.
-     * 
-     * Note:
-     * 
-     *  If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user. 
-     * 
-     * @return string 
-     */
-    function script_filename()
-    {
-        return isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null;
-    }
-
-    /**
-     * The port being used on the user's machine to communicate with the web server. 
-     * 
-     * @return string 
-     */
-    function remote_port()
-    {
-        return isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : null;
-    }
-
-    /**
-     * What revision of the CGI specification the server is using; i.e. 'CGI/1.1'. 
-     * 
-     * @return string 
-     */
-    function gateway_interface()
-    {
-        return isset($_SERVER['GATEWAY_INTERFACE']) ? $_SERVER['GATEWAY_INTERFACE'] : null;
-    }
-
-    /**
-     * Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0'; 
-     * 
-     * @return string 
-     */
-    function server_protocol()
-    {
-        return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null;
-    }
-
-    /**
-     * Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
-     * 
-     * Note:
-     *  PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD. 
-     * 
-     * @return string 
-     */
-    function request_method()
-    {
-        return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
-    }
-
-    /**
-     * The query string, if any, via which the page was accessed. 
-     * 
-     * @return string 
-     */
-    function query_string()
-    {
-        return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
-    }
-
-    /**
-     * The URI which was given in order to access this page; for instance, '/index.html'. 
-     * @return string 
-     */
-    function request_uri()
-    {
-        return isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
-    }
-
-    /**
-     * Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. 
-     * 
-     * @return string 
-     */
-    function script_name()
-    {
-        return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null;
-    }
-
-    /**
-     * The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
-     * 
-     * @return string
-     */
-    function php_self()
-    {
-        return isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : null;
-    }
-
-}

+ 0 - 1170
main/inc/lib/tools/entity_generator.class.php

@@ -1,1170 +0,0 @@
-<?php
-
-/**
- * Modifications of the entity generator class from Doctrine (Doctrine\ORM\Tools\EntityGenerator)
- * to account for chamilo.
- * 
- * Most functions being private it is not possible to inherit from it.
- * 
- * Original work, credits, licence see Docrine
- * 
- *  
- */
-
-namespace Tools;
-
-use Doctrine\ORM\Mapping\ClassMetadataInfo,
-    Doctrine\ORM\Mapping\AssociationMapping,
-    Doctrine\Common\Util\Inflector;
-
-/**
- * Generic class used to generate PHP5 entity classes from ClassMetadataInfo instances
- *
- *     [php]
- *     $classes = $em->getClassMetadataFactory()->getAllMetadata();
- *
- *     $generator = new \Doctrine\ORM\Tools\EntityGenerator();
- *     $generator->setGenerateAnnotations(true);
- *     $generator->setGenerateStubMethods(true);
- *     $generator->setRegenerateEntityIfExists(false);
- *     $generator->setUpdateEntityIfExists(true);
- *     $generator->generate($classes, '/path/to/generate/entities');
- *
- * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link    www.doctrine-project.org
- * @since   2.0
- * @version $Revision$
- * @author  Benjamin Eberlei <kontakt@beberlei.de>
- * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
- * @author  Jonathan Wage <jonwage@gmail.com>
- * @author  Roman Borschel <roman@code-factory.org>
- */
-class EntityGenerator
-{
-
-    /**
-     * @var bool
-     */
-    private $_backupExisting = true;
-
-    /** The extension to use for written php files */
-    private $_extension = '.php';
-
-    /** Whether or not the current ClassMetadataInfo instance is new or old */
-    private $_isNew = true;
-    private $_staticReflection = array();
-
-    /** Number of spaces to use for indention in generated code */
-    private $_numSpaces = 4;
-
-    /** The actual spaces to use for indention */
-    private $_spaces = '    ';
-
-    /** The class all generated entities should extend */
-    private $_classToExtend;
-
-    /** Whether or not to generation annotations */
-    private $_generateAnnotations = false;
-
-    /**
-     * @var string
-     */
-    private $_annotationsPrefix = '';
-
-    /** Whether or not to generated sub methods */
-    private $_generateEntityStubMethods = false;
-
-    /** Whether or not to update the entity class if it exists already */
-    private $_updateEntityIfExists = false;
-
-    /** Whether or not to re-generate entity class if it exists already */
-    private $_regenerateEntityIfExists = false;
-    private static $_classTemplate =
-        '<?php
-
-namespace Entity;
-
-use Doctrine\ORM\Mapping as ORM;
-
-/**
- *
- * @license see /license.txt
- * @author autogenerated
- */
-<entityClassName>
-{
-<spaces>/**
-<spaces> * @return \Entity\Repository\<entityName>Repository
-<spaces> */
-<spaces> public static function repository(){
-<spaces><spaces>return \Entity\Repository\<entityName>Repository::instance();
-<spaces>}
-
-<spaces>/**
-<spaces> * @return \Entity\<entityName>
-<spaces> */
-<spaces> public static function create(){
-<spaces><spaces>return new self();
-<spaces>}
-
-<entityBody>
-}';
-    private static $_getMethodTemplate =
-        '/**
- * <description>
- *
- * @return <variableType>
- */
-public function <methodName>()
-{
-<spaces>return $this-><fieldName>;
-}';
-    private static $_setMethodTemplate =
-        '/**
- * <description>
- *
- * @param <variableType>$<variableName>
- * @return <entity>
- */
-public function <methodName>(<methodTypeHint>$<variableName><variableDefault>)
-{
-<spaces>$this-><fieldName> = $<variableName>;
-<spaces>return $this;
-}';
-    private static $_addMethodTemplate =
-        '/**
- * <description>
- *
- * @param <variableType>$<variableName>
- * @return <entity>
- */
-public function <methodName>(<methodTypeHint>$<variableName>)
-{
-<spaces>$this-><fieldName>[] = $<variableName>;
-<spaces>return $this;
-}';
-    private static $_lifecycleCallbackMethodTemplate =
-        '/**
- * @<name>
- */
-public function <methodName>()
-{
-<spaces>// Add your code here
-}';
-    private static $_constructorMethodTemplate =
-        'public function __construct()
-{
-<spaces><collections>
-}
-';
-
-    public function __construct()
-    {
-        if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) {
-            $this->_annotationsPrefix = 'ORM\\';
-        }
-    }
-
-    /**
-     * Generate and write entity classes for the given array of ClassMetadataInfo instances
-     *
-     * @param array $metadatas
-     * @param string $outputDirectory
-     * @return void
-     */
-    public function generate(array $metadatas, $outputDirectory)
-    {
-        foreach ($metadatas as $metadata) {
-            $this->writeEntityClass($metadata, $outputDirectory);
-        }
-    }
-
-    /**
-     * Generated and write entity class to disk for the given ClassMetadataInfo instance
-     *
-     * @param ClassMetadataInfo $metadata
-     * @param string $outputDirectory
-     * @return void
-     */
-    public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory)
-    {
-        //change
-        $name = $metadata->name;
-        $name = explode('\\', $name);
-        $name = end($name);
-        $name = Inflector::tableize($name);
-        $is_course_table = (strpos($name, 'c_') === 0);
-        if ($is_course_table) {
-            $name = substr($name, 2, strlen($name) - 2);
-        }
-        $name = Inflector::tableize($name);
-        //
-
-        $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $name) . $this->_extension;
-        $dir = dirname($path);
-
-        if (!is_dir($dir)) {
-            mkdir($dir, 0777, true);
-        }
-
-        $this->_isNew = !file_exists($path) || (file_exists($path) && $this->_regenerateEntityIfExists);
-
-        if (!$this->_isNew) {
-            $this->_parseTokensInEntityFile(file_get_contents($path));
-        } else {
-            $this->_staticReflection[$metadata->name] = array('properties' => array(), 'methods' => array());
-        }
-
-        if ($this->_backupExisting && file_exists($path)) {
-            $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~";
-            if (!copy($path, $backupPath)) {
-                throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed.");
-            }
-        }
-
-        // If entity doesn't exist or we're re-generating the entities entirely
-        if ($this->_isNew) {
-            file_put_contents($path, $this->generateEntityClass($metadata));
-            // If entity exists and we're allowed to update the entity class
-        } else if (!$this->_isNew && $this->_updateEntityIfExists) {
-            file_put_contents($path, $this->generateUpdatedEntityClass($metadata, $path));
-        }
-    }
-
-    /**
-     * Generate a PHP5 Doctrine 2 entity class from the given ClassMetadataInfo instance
-     *
-     * @param ClassMetadataInfo $metadata
-     * @return string $code
-     */
-    public function generateEntityClass(ClassMetadataInfo $metadata)
-    {
-        $placeHolders = array(
-            '<namespace>',
-            '<entityAnnotation>',
-            '<entityClassName>',
-            '<entityBody>'
-        );
-
-        $replacements = array(
-            $this->_generateEntityNamespace($metadata),
-            $this->_generateEntityDocBlock($metadata),
-            $this->_generateEntityClassName($metadata),
-            $this->_generateEntityBody($metadata)
-        );
-
-        
-        $code = str_replace($placeHolders, $replacements, self::$_classTemplate);
-        $result = str_replace('<spaces>', $this->_spaces, $code);
-        $result = str_replace('<entityName>', $this->_getClassName($metadata), $result);
-        return $result;
-    }
-
-    /**
-     * Generate the updated code for the given ClassMetadataInfo and entity at path
-     *
-     * @param ClassMetadataInfo $metadata
-     * @param string $path
-     * @return string $code;
-     */
-    public function generateUpdatedEntityClass(ClassMetadataInfo $metadata, $path)
-    {
-        $currentCode = file_get_contents($path);
-
-        $body = $this->_generateEntityBody($metadata);
-        $body = str_replace('<spaces>', $this->_spaces, $body);
-        $last = strrpos($currentCode, '}');
-
-        return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}";
-    }
-
-    /**
-     * Set the number of spaces the exported class should have
-     *
-     * @param integer $numSpaces
-     * @return void
-     */
-    public function setNumSpaces($numSpaces)
-    {
-        $this->_spaces = str_repeat(' ', $numSpaces);
-        $this->_numSpaces = $numSpaces;
-    }
-
-    /**
-     * Set the extension to use when writing php files to disk
-     *
-     * @param string $extension
-     * @return void
-     */
-    public function setExtension($extension)
-    {
-        $this->_extension = $extension;
-    }
-
-    /**
-     * Set the name of the class the generated classes should extend from
-     *
-     * @return void
-     */
-    public function setClassToExtend($classToExtend)
-    {
-        $this->_classToExtend = $classToExtend;
-    }
-
-    /**
-     * Set whether or not to generate annotations for the entity
-     *
-     * @param bool $bool
-     * @return void
-     */
-    public function setGenerateAnnotations($bool)
-    {
-        $this->_generateAnnotations = $bool;
-    }
-
-    /**
-     * Set an annotation prefix.
-     *
-     * @param string $prefix
-     */
-    public function setAnnotationPrefix($prefix)
-    {
-        $this->_annotationsPrefix = $prefix;
-    }
-
-    /**
-     * Set whether or not to try and update the entity if it already exists
-     *
-     * @param bool $bool
-     * @return void
-     */
-    public function setUpdateEntityIfExists($bool)
-    {
-        $this->_updateEntityIfExists = $bool;
-    }
-
-    /**
-     * Set whether or not to regenerate the entity if it exists
-     *
-     * @param bool $bool
-     * @return void
-     */
-    public function setRegenerateEntityIfExists($bool)
-    {
-        $this->_regenerateEntityIfExists = $bool;
-    }
-
-    /**
-     * Set whether or not to generate stub methods for the entity
-     *
-     * @param bool $bool
-     * @return void
-     */
-    public function setGenerateStubMethods($bool)
-    {
-        $this->_generateEntityStubMethods = $bool;
-    }
-
-    /**
-     * Should an existing entity be backed up if it already exists?
-     */
-    public function setBackupExisting($bool)
-    {
-        $this->_backupExisting = $bool;
-    }
-
-    private function _generateEntityNamespace(ClassMetadataInfo $metadata)
-    {
-        if ($this->_hasNamespace($metadata)) {
-            return 'namespace ' . $this->_getNamespace($metadata) . ';';
-        }
-    }
-
-    private function _generateEntityClassName(ClassMetadataInfo $metadata)
-    {
-        return 'class ' . $this->_getClassName($metadata) .
-            ($this->_extendsClass() ? ' extends ' . $this->_getClassToExtendName($metadata) : null);
-    }
-
-    private function _generateEntityBody(ClassMetadataInfo $metadata)
-    {
-        $fieldMappingProperties = $this->_generateEntityFieldMappingProperties($metadata);
-        $associationMappingProperties = $this->_generateEntityAssociationMappingProperties($metadata);
-        $stubMethods = $this->_generateEntityStubMethods ? $this->_generateEntityStubMethods($metadata) : null;
-        $lifecycleCallbackMethods = $this->_generateEntityLifecycleCallbackMethods($metadata);
-
-        $code = array();
-
-        if ($fieldMappingProperties) {
-            $code[] = $fieldMappingProperties;
-        }
-
-        if ($associationMappingProperties) {
-            $code[] = $associationMappingProperties;
-        }
-
-        $code[] = $this->_generateEntityConstructor($metadata);
-
-        if ($stubMethods) {
-            $code[] = $stubMethods;
-        }
-
-        if ($lifecycleCallbackMethods) {
-            $code[] = $lifecycleCallbackMethods;
-        }
-
-        return implode("\n", $code);
-    }
-
-    private function _generateEntityConstructor(ClassMetadataInfo $metadata)
-    {
-        if ($this->_hasMethod('__construct', $metadata)) {
-            return '';
-        }
-
-        $collections = array();
-
-        foreach ($metadata->associationMappings AS $mapping) {
-            if ($mapping['type'] & ClassMetadataInfo::TO_MANY) {
-                $collections[] = '$this->' . $mapping['fieldName'] . ' = new \Doctrine\Common\Collections\ArrayCollection();';
-            }
-        }
-
-        if ($collections) {
-            return $this->_prefixCodeWithSpaces(str_replace("<collections>", implode("\n" . $this->_spaces, $collections), self::$_constructorMethodTemplate));
-        }
-
-        return '';
-    }
-
-    /**
-     * @todo this won't work if there is a namespace in brackets and a class outside of it.
-     * @param string $src
-     */
-    private function _parseTokensInEntityFile($src)
-    {
-        $tokens = token_get_all($src);
-        $lastSeenNamespace = "";
-        $lastSeenClass = false;
-
-        $inNamespace = false;
-        $inClass = false;
-        for ($i = 0; $i < count($tokens); $i++) {
-            $token = $tokens[$i];
-            if (in_array($token[0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT))) {
-                continue;
-            }
-
-            if ($inNamespace) {
-                if ($token[0] == T_NS_SEPARATOR || $token[0] == T_STRING) {
-                    $lastSeenNamespace .= $token[1];
-                } else if (is_string($token) && in_array($token, array(';', '{'))) {
-                    $inNamespace = false;
-                }
-            }
-
-            if ($inClass) {
-                $inClass = false;
-                $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1];
-                $this->_staticReflection[$lastSeenClass]['properties'] = array();
-                $this->_staticReflection[$lastSeenClass]['methods'] = array();
-            }
-
-            if ($token[0] == T_NAMESPACE) {
-                $lastSeenNamespace = "";
-                $inNamespace = true;
-            } else if ($token[0] == T_CLASS) {
-                $inClass = true;
-            } else if ($token[0] == T_FUNCTION) {
-                if ($tokens[$i + 2][0] == T_STRING) {
-                    $this->_staticReflection[$lastSeenClass]['methods'][] = $tokens[$i + 2][1];
-                } else if ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) {
-                    $this->_staticReflection[$lastSeenClass]['methods'][] = $tokens[$i + 3][1];
-                }
-            } else if (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i + 2][0] != T_FUNCTION) {
-                $this->_staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1);
-            }
-        }
-    }
-
-    private function _hasProperty($property, ClassMetadataInfo $metadata)
-    {
-        if ($this->_extendsClass()) {
-            // don't generate property if its already on the base class.
-            $reflClass = new \ReflectionClass($this->_getClassToExtend($metadata));
-            if ($reflClass->hasProperty($property)) {
-                return true;
-            }
-        }
-
-        return (
-            isset($this->_staticReflection[$metadata->name]) &&
-            in_array($property, $this->_staticReflection[$metadata->name]['properties'])
-            );
-    }
-
-    private function _hasMethod($method, ClassMetadataInfo $metadata)
-    {
-        if ($this->_extendsClass()) {
-            // don't generate method if its already on the base class.
-            $reflClass = new \ReflectionClass($this->_getClassToExtend($metadata));
-            if ($reflClass->hasMethod($method)) {
-                return true;
-            }
-        }
-
-        return (
-            isset($this->_staticReflection[$metadata->name]) &&
-            in_array($method, $this->_staticReflection[$metadata->name]['methods'])
-            );
-    }
-
-    private function _hasNamespace(ClassMetadataInfo $metadata)
-    {
-        return strpos($metadata->name, '\\') ? true : false;
-    }
-
-    private function _extendsClass()
-    {
-        return $this->_classToExtend ? true : false;
-    }
-
-    private function _getClassToExtend($metadata)
-    {
-        return isset($metadata->class_to_extend) ? $metadata->class_to_extend : $this->_classToExtend;
-    }
-
-    private function _getClassToExtendName($metadata)
-    {
-        $refl = new \ReflectionClass($this->_getClassToExtend($metadata));
-
-        return '\\' . $refl->getName();
-    }
-
-    private function _getClassName(ClassMetadataInfo $metadata)
-    {
-        //changed
-        $name = $metadata->name;
-        $name = explode('\\', $name);
-        $name = end($name);
-        $name = Inflector::tableize($name);
-        $is_course_table = (strpos($name, 'c_') === 0);
-        if ($is_course_table) {
-            $name = substr($name, 2, strlen($name) - 2);
-        }
-        $name = Inflector::classify($name);
-
-        $result = ($pos = strrpos($name, '\\')) ? substr($name, $pos + 1, strlen($name)) : $name;
-        return $result;
-    }
-
-    private function _getNamespace(ClassMetadataInfo $metadata)
-    {
-        return substr($metadata->name, 0, strrpos($metadata->name, '\\'));
-    }
-
-    private function _generateEntityDocBlock(ClassMetadataInfo $metadata)
-    {
-        $lines = array();
-        $lines[] = '/**';
-        $lines[] = ' * ' . $metadata->name;
-
-        if ($this->_generateAnnotations) {
-            $lines[] = ' *';
-
-            $methods = array(
-                '_generateTableAnnotation',
-                '_generateInheritanceAnnotation',
-                '_generateDiscriminatorColumnAnnotation',
-                '_generateDiscriminatorMapAnnotation'
-            );
-
-            foreach ($methods as $method) {
-                if ($code = $this->$method($metadata)) {
-                    $lines[] = ' * ' . $code;
-                }
-            }
-
-            if ($metadata->isMappedSuperclass) {
-                $lines[] = ' * @' . $this->_annotationsPrefix . 'MappedSuperClass';
-            } else {
-                $lines[] = ' * @' . $this->_annotationsPrefix . 'Entity';
-            }
-
-            if ($metadata->customRepositoryClassName) {
-                $lines[count($lines) - 1] .= '(repositoryClass="' . $metadata->customRepositoryClassName . '")';
-            }
-
-            if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) {
-                $lines[] = ' * @' . $this->_annotationsPrefix . 'HasLifecycleCallbacks';
-            }
-        }
-
-        $lines[] = ' */';
-
-        return implode("\n", $lines);
-    }
-
-    private function _generateTableAnnotation($metadata)
-    {
-        $table = array();
-
-        if (isset($metadata->table['schema'])) {
-            $table[] = 'schema="' . $metadata->table['schema'] . '"';
-        }
-
-        if (isset($metadata->table['name'])) {
-            $table[] = 'name="' . $metadata->table['name'] . '"';
-        }
-
-        if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) {
-            $constraints = $this->_generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']);
-            $table[] = 'uniqueConstraints={' . $constraints . '}';
-        }
-
-        if (isset($metadata->table['indexes']) && $metadata->table['indexes']) {
-            $constraints = $this->_generateTableConstraints('Index', $metadata->table['indexes']);
-            $table[] = 'indexes={' . $constraints . '}';
-        }
-
-        return '@' . $this->_annotationsPrefix . 'Table(' . implode(', ', $table) . ')';
-    }
-
-    private function _generateTableConstraints($constraintName, $constraints)
-    {
-        $annotations = array();
-        foreach ($constraints as $name => $constraint) {
-            $columns = array();
-            foreach ($constraint['columns'] as $column) {
-                $columns[] = '"' . $column . '"';
-            }
-            $annotations[] = '@' . $this->_annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})';
-        }
-        return implode(', ', $annotations);
-    }
-
-    private function _generateInheritanceAnnotation($metadata)
-    {
-        if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
-            return '@' . $this->_annotationsPrefix . 'InheritanceType("' . $this->_getInheritanceTypeString($metadata->inheritanceType) . '")';
-        }
-    }
-
-    private function _generateDiscriminatorColumnAnnotation($metadata)
-    {
-        if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
-            $discrColumn = $metadata->discriminatorValue;
-            $columnDefinition = 'name="' . $discrColumn['name']
-                . '", type="' . $discrColumn['type']
-                . '", length=' . $discrColumn['length'];
-
-            return '@' . $this->_annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')';
-        }
-    }
-
-    private function _generateDiscriminatorMapAnnotation($metadata)
-    {
-        if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
-            $inheritanceClassMap = array();
-
-            foreach ($metadata->discriminatorMap as $type => $class) {
-                $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"';
-            }
-
-            return '@' . $this->_annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})';
-        }
-    }
-
-    private function _generateEntityStubMethods(ClassMetadataInfo $metadata)
-    {
-        $methods = array();
-
-        foreach ($metadata->fieldMappings as $fieldMapping) {
-            if (!isset($fieldMapping['id']) || !$fieldMapping['id'] || $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE) {
-                if ($code = $this->_generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'])) {
-                    $methods[] = $code;
-                }
-            }
-
-            if ($code = $this->_generateEntityStubMethod($metadata, 'get', $fieldMapping['fieldName'], $fieldMapping['type'])) {
-                $methods[] = $code;
-            }
-        }
-
-        foreach ($metadata->associationMappings as $associationMapping) {
-            if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
-                $nullable = $this->_isAssociationIsNullable($associationMapping) ? 'null' : null;
-                if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], $nullable)) {
-                    $methods[] = $code;
-                }
-                if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
-                    $methods[] = $code;
-                }
-            } else if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) {
-                if ($code = $this->_generateEntityStubMethod($metadata, 'add', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
-                    $methods[] = $code;
-                }
-                if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], 'Doctrine\Common\Collections\Collection')) {
-                    $methods[] = $code;
-                }
-            }
-        }
-        
-        return implode("\n\n", $methods);
-    }
-
-    private function _isAssociationIsNullable($associationMapping)
-    {
-        if (isset($associationMapping['id']) && $associationMapping['id']) {
-            return false;
-        }
-        if (isset($associationMapping['joinColumns'])) {
-            $joinColumns = $associationMapping['joinColumns'];
-        } else {
-            //@todo thereis no way to retreive targetEntity metadata
-            $joinColumns = array();
-        }
-        foreach ($joinColumns as $joinColumn) {
-            if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    private function _generateEntityLifecycleCallbackMethods(ClassMetadataInfo $metadata)
-    {
-        if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) {
-            $methods = array();
-
-            foreach ($metadata->lifecycleCallbacks as $name => $callbacks) {
-                foreach ($callbacks as $callback) {
-                    if ($code = $this->_generateLifecycleCallbackMethod($name, $callback, $metadata)) {
-                        $methods[] = $code;
-                    }
-                }
-            }
-
-            return implode("\n\n", $methods);
-        }
-
-        return "";
-    }
-
-    private function _generateEntityAssociationMappingProperties(ClassMetadataInfo $metadata)
-    {
-        $lines = array();
-
-        foreach ($metadata->associationMappings as $associationMapping) {
-            if ($this->_hasProperty($associationMapping['fieldName'], $metadata)) {
-                continue;
-            }
-
-            $lines[] = $this->_generateAssociationMappingPropertyDocBlock($associationMapping, $metadata);
-            $lines[] = $this->_spaces . 'protected $' . $associationMapping['fieldName']
-                . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n";
-        }
-
-        return implode("\n", $lines);
-    }
-
-    private function _generateEntityFieldMappingProperties(ClassMetadataInfo $metadata)
-    {
-        $lines = array();
-
-        foreach ($metadata->fieldMappings as $fieldMapping) {
-            if ($this->_hasProperty($fieldMapping['fieldName'], $metadata) ||
-                $metadata->isInheritedField($fieldMapping['fieldName'])) {
-                continue;
-            }
-
-            $fieldMapping['fieldName'] = Inflector::tableize($fieldMapping['fieldName']);
-
-            $lines[] = $this->_generateFieldMappingPropertyDocBlock($fieldMapping, $metadata);
-            $lines[] = $this->_spaces . 'protected $' . $fieldMapping['fieldName']
-                . (isset($fieldMapping['default']) ? ' = ' . var_export($fieldMapping['default'], true) : null) . ";\n";
-        }
-
-        return implode("\n", $lines);
-    }
-
-    private function _generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null)
-    {
-
-        $fieldName = Inflector::tableize($fieldName);
-        if ($type == "add") {
-            $addMethod = explode("\\", $typeHint);
-            $addMethod = end($addMethod);
-            $methodName = $type . $addMethod;
-        } else {
-            //change
-            $methodName = $type . '_' . Inflector::tableize($fieldName);
-            //
-        }
-
-        if ($this->_hasMethod($methodName, $metadata)) {
-            return;
-        }
-        $this->_staticReflection[$metadata->name]['methods'][] = $methodName;
-
-        $var = sprintf('_%sMethodTemplate', $type);
-        $template = self::$$var;
-
-        $variableType = $typeHint ? $typeHint . ' ' : null;
-
-        $types = \Doctrine\DBAL\Types\Type::getTypesMap();
-        $methodTypeHint = $typeHint && !isset($types[$typeHint]) ? '\\' . $typeHint . ' ' : null;
-
-        $replacements = array(
-            '<description>' => ucfirst($type) . ' ' . $fieldName,
-            '<methodTypeHint>' => $methodTypeHint,
-            '<variableType>' => $variableType,
-            '<variableName>' => 'value',
-            '<methodName>' => $methodName,
-            '<fieldName>' => $fieldName,
-            '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '',
-            '<entity>' => $this->_getClassName($metadata)
-        );
-
-        $method = str_replace(
-            array_keys($replacements), array_values($replacements), $template
-        );
-
-        return $this->_prefixCodeWithSpaces($method);
-    }
-
-    private function _generateLifecycleCallbackMethod($name, $methodName, $metadata)
-    {
-        if ($this->_hasMethod($methodName, $metadata)) {
-            return;
-        }
-        $this->_staticReflection[$metadata->name]['methods'][] = $methodName;
-
-        $replacements = array(
-            '<name>' => $this->_annotationsPrefix . $name,
-            '<methodName>' => $methodName,
-        );
-
-        $method = str_replace(
-            array_keys($replacements), array_values($replacements), self::$_lifecycleCallbackMethodTemplate
-        );
-
-        return $this->_prefixCodeWithSpaces($method);
-    }
-
-    private function _generateJoinColumnAnnotation(array $joinColumn)
-    {
-        $joinColumnAnnot = array();
-
-        if (isset($joinColumn['name'])) {
-            $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"';
-        }
-
-        if (isset($joinColumn['referencedColumnName'])) {
-            $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"';
-        }
-
-        if (isset($joinColumn['unique']) && $joinColumn['unique']) {
-            $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false');
-        }
-
-        if (isset($joinColumn['nullable'])) {
-            $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false');
-        }
-
-        if (isset($joinColumn['onDelete'])) {
-            $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"');
-        }
-
-        if (isset($joinColumn['columnDefinition'])) {
-            $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"';
-        }
-
-        return '@' . $this->_annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')';
-    }
-
-    private function _generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata)
-    {
-        $lines = array();
-        $lines[] = $this->_spaces . '/**';
-
-        if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) {
-            $lines[] = $this->_spaces . ' * @var \Doctrine\Common\Collections\ArrayCollection';
-        } else {
-            $lines[] = $this->_spaces . ' * @var ' . $associationMapping['targetEntity'];
-        }
-
-        if ($this->_generateAnnotations) {
-            $lines[] = $this->_spaces . ' *';
-
-            if (isset($associationMapping['id']) && $associationMapping['id']) {
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'Id';
-
-                if ($generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
-                    $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")';
-                }
-            }
-
-            $type = null;
-            switch ($associationMapping['type']) {
-                case ClassMetadataInfo::ONE_TO_ONE:
-                    $type = 'OneToOne';
-                    break;
-                case ClassMetadataInfo::MANY_TO_ONE:
-                    $type = 'ManyToOne';
-                    break;
-                case ClassMetadataInfo::ONE_TO_MANY:
-                    $type = 'OneToMany';
-                    break;
-                case ClassMetadataInfo::MANY_TO_MANY:
-                    $type = 'ManyToMany';
-                    break;
-            }
-            $typeOptions = array();
-
-            if (isset($associationMapping['targetEntity'])) {
-                $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"';
-            }
-
-            if (isset($associationMapping['inversedBy'])) {
-                $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"';
-            }
-
-            if (isset($associationMapping['mappedBy'])) {
-                $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"';
-            }
-
-            if ($associationMapping['cascade']) {
-                $cascades = array();
-
-                if ($associationMapping['isCascadePersist'])
-                    $cascades[] = '"persist"';
-                if ($associationMapping['isCascadeRemove'])
-                    $cascades[] = '"remove"';
-                if ($associationMapping['isCascadeDetach'])
-                    $cascades[] = '"detach"';
-                if ($associationMapping['isCascadeMerge'])
-                    $cascades[] = '"merge"';
-                if ($associationMapping['isCascadeRefresh'])
-                    $cascades[] = '"refresh"';
-
-                $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}';
-            }
-
-            if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) {
-                $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false');
-            }
-
-            $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')';
-
-            if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) {
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'JoinColumns({';
-
-                $joinColumnsLines = array();
-
-                foreach ($associationMapping['joinColumns'] as $joinColumn) {
-                    if ($joinColumnAnnot = $this->_generateJoinColumnAnnotation($joinColumn)) {
-                        $joinColumnsLines[] = $this->_spaces . ' *   ' . $joinColumnAnnot;
-                    }
-                }
-
-                $lines[] = implode(",\n", $joinColumnsLines);
-                $lines[] = $this->_spaces . ' * })';
-            }
-
-            if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) {
-                $joinTable = array();
-                $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"';
-
-                if (isset($associationMapping['joinTable']['schema'])) {
-                    $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"';
-                }
-
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ',';
-                $lines[] = $this->_spaces . ' *   joinColumns={';
-
-                foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) {
-                    $lines[] = $this->_spaces . ' *     ' . $this->_generateJoinColumnAnnotation($joinColumn);
-                }
-
-                $lines[] = $this->_spaces . ' *   },';
-                $lines[] = $this->_spaces . ' *   inverseJoinColumns={';
-
-                foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) {
-                    $lines[] = $this->_spaces . ' *     ' . $this->_generateJoinColumnAnnotation($joinColumn);
-                }
-
-                $lines[] = $this->_spaces . ' *   }';
-                $lines[] = $this->_spaces . ' * )';
-            }
-
-            if (isset($associationMapping['orderBy'])) {
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'OrderBy({';
-
-                foreach ($associationMapping['orderBy'] as $name => $direction) {
-                    $lines[] = $this->_spaces . ' *     "' . $name . '"="' . $direction . '",';
-                }
-
-                $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1);
-                $lines[] = $this->_spaces . ' * })';
-            }
-        }
-
-        $lines[] = $this->_spaces . ' */';
-
-        return implode("\n", $lines);
-    }
-
-    private function _generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata)
-    {
-
-        $lines = array();
-        $lines[] = $this->_spaces . '/**';
-        $lines[] = $this->_spaces . ' * @var ' . $fieldMapping['type'] . ' $' . $fieldMapping['fieldName'];
-
-        if ($this->_generateAnnotations) {
-            $lines[] = $this->_spaces . ' *';
-
-            $column = array();
-            if (isset($fieldMapping['columnName'])) {
-                $column[] = 'name="' . $fieldMapping['columnName'] . '"';
-            }
-
-            if (isset($fieldMapping['type'])) {
-                $column[] = 'type="' . $fieldMapping['type'] . '"';
-            }
-
-            if (isset($fieldMapping['length'])) {
-                $column[] = 'length=' . $fieldMapping['length'];
-            }
-
-            if (isset($fieldMapping['precision'])) {
-                $column[] = 'precision=' . $fieldMapping['precision'];
-            }
-
-            if (isset($fieldMapping['scale'])) {
-                $column[] = 'scale=' . $fieldMapping['scale'];
-            }
-
-            if (isset($fieldMapping['nullable'])) {
-                $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true);
-            }
-
-            if (isset($fieldMapping['columnDefinition'])) {
-                $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"';
-            }
-
-            if (isset($fieldMapping['unique'])) {
-                $column[] = 'unique=' . var_export($fieldMapping['unique'], true);
-            }
-
-            $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'Column(' . implode(', ', $column) . ')';
-
-            if (isset($fieldMapping['id']) && $fieldMapping['id']) {
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'Id';
-
-                if ($generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
-                    $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")';
-                }
-
-                if ($metadata->sequenceGeneratorDefinition) {
-                    $sequenceGenerator = array();
-
-                    if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) {
-                        $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"';
-                    }
-
-                    if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) {
-                        $sequenceGenerator[] = 'allocationSize="' . $metadata->sequenceGeneratorDefinition['allocationSize'] . '"';
-                    }
-
-                    if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) {
-                        $sequenceGenerator[] = 'initialValue="' . $metadata->sequenceGeneratorDefinition['initialValue'] . '"';
-                    }
-
-                    $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')';
-                }
-            }
-
-            if (isset($fieldMapping['version']) && $fieldMapping['version']) {
-                $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'Version';
-            }
-        }
-
-        $lines[] = $this->_spaces . ' */';
-
-        return implode("\n", $lines);
-    }
-
-    private function _prefixCodeWithSpaces($code, $num = 1)
-    {
-        $lines = explode("\n", $code);
-
-        foreach ($lines as $key => $value) {
-            $lines[$key] = str_repeat($this->_spaces, $num) . $lines[$key];
-        }
-
-        return implode("\n", $lines);
-    }
-
-    private function _getInheritanceTypeString($type)
-    {
-        switch ($type) {
-            case ClassMetadataInfo::INHERITANCE_TYPE_NONE:
-                return 'NONE';
-
-            case ClassMetadataInfo::INHERITANCE_TYPE_JOINED:
-                return 'JOINED';
-
-            case ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE:
-                return 'SINGLE_TABLE';
-
-            case ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS:
-                return 'PER_CLASS';
-
-            default:
-                throw new \InvalidArgumentException('Invalid provided InheritanceType: ' . $type);
-        }
-    }
-
-    private function _getChangeTrackingPolicyString($policy)
-    {
-        switch ($policy) {
-            case ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT:
-                return 'DEFERRED_IMPLICIT';
-
-            case ClassMetadataInfo::CHANGETRACKING_DEFERRED_EXPLICIT:
-                return 'DEFERRED_EXPLICIT';
-
-            case ClassMetadataInfo::CHANGETRACKING_NOTIFY:
-                return 'NOTIFY';
-
-            default:
-                throw new \InvalidArgumentException('Invalid provided ChangeTrackingPolicy: ' . $policy);
-        }
-    }
-
-    private function _getIdGeneratorTypeString($type)
-    {
-        switch ($type) {
-            case ClassMetadataInfo::GENERATOR_TYPE_AUTO:
-                return 'AUTO';
-
-            case ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE:
-                return 'SEQUENCE';
-
-            case ClassMetadataInfo::GENERATOR_TYPE_TABLE:
-                return 'TABLE';
-
-            case ClassMetadataInfo::GENERATOR_TYPE_IDENTITY:
-                return 'IDENTITY';
-
-            case ClassMetadataInfo::GENERATOR_TYPE_NONE:
-                return 'NONE';
-
-            default:
-                throw new \InvalidArgumentException('Invalid provided IdGeneratorType: ' . $type);
-        }
-    }
-
-}

+ 0 - 138
main/inc/lib/tools/entity_repository_generator.class.php

@@ -1,138 +0,0 @@
-<?php
-
-/*
- *  $Id$
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This software consists of voluntary contributions made by many individuals
- * and is licensed under the LGPL. For more information, see
- * <http://www.doctrine-project.org>.
- */
-
-namespace Tools;
-
-use Doctrine\ORM\Mapping\ClassMetadataInfo,
-    Doctrine\ORM\Mapping\AssociationMapping,
-    Doctrine\Common\Util\Inflector;
-
-/**
- * Class to generate entity repository classes
- *
- * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link    www.doctrine-project.org
- * @since   2.0
- * @version $Revision$
- * @author  Benjamin Eberlei <kontakt@beberlei.de>
- * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
- * @author  Jonathan Wage <jonwage@gmail.com>
- * @author  Roman Borschel <roman@code-factory.org>
- */
-class EntityRepositoryGenerator
-{
-
-    protected static $_template =
-        '<?php
-
-namespace Entity\Repository;
-use \db;
-
-/**
- * 
- * @license see /license.txt
- * @author autogenerated
- */
-class <className> extends <extends>
-{
-
-    /**
-     * @return \Entity\Repository\<className>
-     */
-    public static function instance(){
-        static $result = false;
-        if($result === false){
-            $result = db::instance()->get_repository(\'\\Entity\\<entityName>\');
-        }
-        return $result;
-    }
-    
-    /**
-     * 
-     * @param EntityManager $em The EntityManager to use.
-     * @param ClassMetadata $class The class descriptor.
-     */
-    public function __construct($em, $class){
-        parent::__construct($em, $class);
-    }
-    
-}';
-
-    public function generateEntityRepositoryClass($name)
-    {
-        $name = Inflector::tableize($name);
-        $is_course_table = (strpos($name, 'c_') === 0);
-        if ($is_course_table) {
-            $name = substr($name, 2, strlen($name) - 2);
-        }
-        $name = Inflector::classify($name);
-        $className = $name;
-        //$namespace = substr($fullClassName, 0, strrpos($fullClassName, '\\'));
-        //$className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
-
-        $is_course_table = $metadata->is_course_table;
-        
-        
-        $variables = array(
-            '<namespace>' => $namespace,
-            '<className>' => $className,
-            '<entityName>' => str_replace('Repository', '', $className),
-            '<extends>' => $is_course_table ? '\CourseEntityRepository' : '\EntityRepository'
-        );
-        return str_replace(array_keys($variables), array_values($variables), self::$_template);
-    }
-
-    /**
-     *
-     * @param type $name
-     * @param type $outputDirectory 
-     */
-    public function writeEntityRepositoryClass($name, $outputDirectory)
-    {
-        $name = explode('\\', $name);
-        $name = end($name);
-        $name = Inflector::tableize($name);
-        $is_course_table = (strpos($name, 'c_') === 0);
-        if ($is_course_table) {
-            $name = substr($name, 2, strlen($name) - 2);
-        }
-        $name = Inflector::classify($name) . 'Repository';
-        $fullClassName = $name;
-        
-        $file_name = Inflector::tableize($name);
-
-        $code = $this->generateEntityRepositoryClass($fullClassName);
-
-        $path = $outputDirectory . DIRECTORY_SEPARATOR
-            . str_replace('\\', \DIRECTORY_SEPARATOR, $file_name) . '.class.php';
-        $dir = dirname($path);
-
-        if (!is_dir($dir)) {
-            mkdir($dir, 0777, true);
-        }
-
-        if (!file_exists($path)) {
-            file_put_contents($path, $code);
-        }
-    }
-
-}

+ 0 - 214
main/inc/lib/tools/yaml_exporter.class.php

@@ -1,214 +0,0 @@
-<?php
-
-/*
- *  $Id$
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This software consists of voluntary contributions made by many individuals
- * and is licensed under the LGPL. For more information, see
- * <http://www.doctrine-project.org>.
- */
-
-namespace Tools;
-
-use Doctrine\ORM\Mapping\ClassMetadataInfo;
-use Doctrine\ORM\Tools\Export\Driver\AbstractExporter;
-
-/**
- * ClassMetadata exporter for Doctrine YAML mapping files
- *
- * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link    www.doctrine-project.org
- * @since   2.0
- * @version $Revision$
- * @author  Jonathan Wage <jonwage@gmail.com>
- */
-class YamlExporter extends AbstractExporter
-{
-    protected $_extension = '.dcm.yml';
-
-    /**
-     * Converts a single ClassMetadata instance to the exported format
-     * and returns it
-     *
-     * TODO: Should this code be pulled out in to a toArray() method in ClassMetadata
-     *
-     * @param ClassMetadataInfo $metadata
-     * @return mixed $exported
-     */
-    public function exportClassMetadata(ClassMetadataInfo $metadata)
-    {
-        $array = array();
-
-        if ($metadata->isMappedSuperclass) {
-            $array['type'] = 'mappedSuperclass';
-        } else {
-            $array['type'] = 'entity';
-        }
-
-        $array['table'] = $metadata->table['name'];
-
-        if (isset($metadata->table['schema'])) {
-            $array['schema'] = $metadata->table['schema'];
-        }
-
-        $inheritanceType = $metadata->inheritanceType;
-        if ($inheritanceType !== ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
-            $array['inheritanceType'] = $this->_getInheritanceTypeString($inheritanceType);
-        }
-
-        if ($column = $metadata->discriminatorColumn) {
-            $array['discriminatorColumn'] = $column;
-        }
-
-        if ($map = $metadata->discriminatorMap) {
-            $array['discriminatorMap'] = $map;
-        }
-
-        if ($metadata->changeTrackingPolicy !== ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT) {
-            $array['changeTrackingPolicy'] = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy);
-        }
-
-        if (isset($metadata->table['indexes'])) {
-            $array['indexes'] = $metadata->table['indexes'];
-        }
-
-        if ($metadata->customRepositoryClassName) {
-            $array['repositoryClass'] = $metadata->customRepositoryClassName;
-        }
-
-        if (isset($metadata->table['uniqueConstraints'])) {
-            $array['uniqueConstraints'] = $metadata->table['uniqueConstraints'];
-        }
-
-        $fieldMappings = $metadata->fieldMappings;
-
-        $ids = array();
-        foreach ($fieldMappings as $name => $fieldMapping) {
-            $fieldMapping['column'] = $fieldMapping['columnName'];
-            unset(
-                $fieldMapping['columnName'],
-                $fieldMapping['fieldName']
-            );
-
-            if ($fieldMapping['column'] == $name) {
-                unset($fieldMapping['column']);
-            }
-
-            if (isset($fieldMapping['id']) && $fieldMapping['id']) {
-                $ids[$name] = $fieldMapping;
-                unset($fieldMappings[$name]);
-                continue;
-            }
-
-            $fieldMappings[$name] = $fieldMapping;
-        }
-
-        if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
-            $ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $this->_getIdGeneratorTypeString($metadata->generatorType);
-        }else{
-            if(count($metadata->identifier) == 2){
-                foreach($metadata->identifier as $identifier){
-                    if($identifier != 'c_id'){
-                        $ids[$identifier]['generator']['strategy'] = 'IDENTITY';
-                    }
-                }
-            }
-            
-        }
-
-        if ($ids) {
-            $array['fields'] = $ids;
-        }
-
-        if ($fieldMappings) {
-            if ( ! isset($array['fields'])) {
-                $array['fields'] = array();
-            }
-            $array['fields'] = array_merge($array['fields'], $fieldMappings);
-        }
-
-        $associations = array();
-        foreach ($metadata->associationMappings as $name => $associationMapping) {
-            $cascade = array();
-            if ($associationMapping['isCascadeRemove']) {
-                $cascade[] = 'remove';
-            }
-            if ($associationMapping['isCascadePersist']) {
-                $cascade[] = 'persist';
-            }
-            if ($associationMapping['isCascadeRefresh']) {
-                $cascade[] = 'refresh';
-            }
-            if ($associationMapping['isCascadeMerge']) {
-                $cascade[] = 'merge';
-            }
-            if ($associationMapping['isCascadeDetach']) {
-                $cascade[] = 'detach';
-            }
-            if (count($cascade) === 5) {
-                $cascade = array('all');
-            }
-            $associationMappingArray = array(
-                'targetEntity' => $associationMapping['targetEntity'],
-                'cascade'     => $cascade,
-            );
-
-            if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
-                $joinColumns = $associationMapping['joinColumns'];
-                $newJoinColumns = array();
-                foreach ($joinColumns as $joinColumn) {
-                    $newJoinColumns[$joinColumn['name']]['referencedColumnName'] = $joinColumn['referencedColumnName'];
-                    if (isset($joinColumn['onDelete'])) {
-                        $newJoinColumns[$joinColumn['name']]['onDelete'] = $joinColumn['onDelete'];
-                    }
-                }
-                $oneToOneMappingArray = array(
-                    'mappedBy'      => $associationMapping['mappedBy'],
-                    'inversedBy'    => $associationMapping['inversedBy'],
-                    'joinColumns'   => $newJoinColumns,
-                    'orphanRemoval' => $associationMapping['orphanRemoval'],
-                );
-
-                $associationMappingArray = array_merge($associationMappingArray, $oneToOneMappingArray);
-                $array['oneToOne'][$name] = $associationMappingArray;
-            } else if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_MANY) {
-                $oneToManyMappingArray = array(
-                    'mappedBy'      => $associationMapping['mappedBy'],
-                    'inversedBy'    => $associationMapping['inversedBy'],
-                    'orphanRemoval' => $associationMapping['orphanRemoval'],
-                    'orderBy'       => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null
-                );
-
-                $associationMappingArray = array_merge($associationMappingArray, $oneToManyMappingArray);
-                $array['oneToMany'][$name] = $associationMappingArray;
-            } else if ($associationMapping['type'] == ClassMetadataInfo::MANY_TO_MANY) {
-                $manyToManyMappingArray = array(
-                    'mappedBy'   => $associationMapping['mappedBy'],
-                    'inversedBy' => $associationMapping['inversedBy'],
-                    'joinTable'  => isset($associationMapping['joinTable']) ? $associationMapping['joinTable'] : null,
-                    'orderBy'    => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null
-                );
-
-                $associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray);
-                $array['manyToMany'][$name] = $associationMappingArray;
-            }
-        }
-        if (isset($metadata->lifecycleCallbacks)) {
-            $array['lifecycleCallbacks'] = $metadata->lifecycleCallbacks;
-        }
-
-        return \Symfony\Component\Yaml\Yaml::dump(array($metadata->name => $array), 10);
-    }
-}

+ 1 - 1
vendor/autoload.php

@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer' . '/autoload_real.php';
 
-return ComposerAutoloaderInitd2cc221a7969047de8d2e10bc490c049::getLoader();
+return ComposerAutoloaderInit453f6dfa16f7a1d69e2abd2171eecd5b::getLoader();

+ 0 - 35
vendor/composer/autoload_classmap.php

@@ -29,24 +29,6 @@ return array(
     'Answer' => $baseDir . '/main/exercice/answer.class.php',
     'AppPlugin' => $baseDir . '/main/inc/lib/plugin.lib.php',
     'ArrayClass' => $baseDir . '/main/inc/lib/array.lib.php',
-    'AssetAggregatedRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/asset_aggregated_renderer.class.php',
-    'AssetGoogleCalendarRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/lab/asset_google_calendar_renderer.class.php',
-    'AssetGoogleDocumentRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_google_document_renderer.class.php',
-    'AssetGoogleDocumentViewerRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_google_document_viewer_renderer.class.php',
-    'AssetGoogleMapRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_google_map_renderer.class.php',
-    'AssetGoogleWidgetRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_google_widget_renderer.class.php',
-    'AssetImageRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_image_renderer.class.php',
-    'AssetMaharaGroupRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/lab/asset_mahara_group_renderer.class.php',
-    'AssetMaharaPersonRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/lab/asset_mahara_person_renderer.class.php',
-    'AssetMediaRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_media_renderer.class.php',
-    'AssetMediaserverRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_mediaserver_renderer.class.php',
-    'AssetOembedRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_oembed_renderer.class.php',
-    'AssetOgRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_og_renderer.class.php',
-    'AssetPageRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_page_renderer.class.php',
-    'AssetRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/asset_renderer.class.php',
-    'AssetRssRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_rss_renderer.class.php',
-    'AssetScratchRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/protocol/asset_scratch_renderer.class.php',
-    'AssetWikiRenderer' => $baseDir . '/main/inc/lib/system/media/renderer/lab/asset_wiki_renderer.class.php',
     'Attendance' => $baseDir . '/main/inc/lib/attendance.lib.php',
     'AttendanceLink' => $baseDir . '/main/gradebook/lib/be/attendancelink.class.php',
     'Attribute_Translator' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/attribute_translator.cls.php',
@@ -84,8 +66,6 @@ return array(
     'ChamiloSession' => $baseDir . '/main/inc/lib/chamilo_session.class.php',
     'Chat' => $baseDir . '/main/inc/lib/chat.lib.php',
     'ClassManager' => $baseDir . '/main/inc/lib/classmanager.lib.php',
-    'ClosureCompiler' => $baseDir . '/main/inc/lib/system/closure_compiler.class.php',
-    'CodeUtilities' => $baseDir . '/main/inc/lib/system/code_utilities.class.php',
     'Collator' => $vendorDir . '/symfony/intl/Symfony/Component/Intl/Resources/stubs/Collator.php',
     'ConditionalLogin' => $baseDir . '/main/inc/lib/conditional_login.class.php',
     'Controller' => $baseDir . '/main/inc/lib/controller.class.php',
@@ -192,7 +172,6 @@ return array(
     'CsvObjectWriter' => $baseDir . '/main/inc/lib/system/io/csv_object_writer.class.php',
     'CsvReader' => $baseDir . '/main/inc/lib/system/io/csv_reader.class.php',
     'CsvWriter' => $baseDir . '/main/inc/lib/system/io/csv_writer.class.php',
-    'Curl' => $baseDir . '/main/inc/lib/system/net/curl.class.php',
     'CurrentCourse' => $baseDir . '/main/inc/lib/current_course.class.php',
     'CurrentUser' => $baseDir . '/main/inc/lib/current_user.class.php',
     'CustomPages' => $baseDir . '/main/inc/lib/custom_pages.class.php',
@@ -359,13 +338,11 @@ return array(
     'HTML_QuickForm_xbutton' => $baseDir . '/main/inc/lib/pear/HTML/QuickForm/xbutton.php',
     'HTML_Table' => $baseDir . '/main/inc/lib/pear/HTML/Table.php',
     'HTML_Table_Storage' => $baseDir . '/main/inc/lib/pear/HTML/Table/Storage.php',
-    'Header' => $baseDir . '/main/inc/lib/system/web/header.class.php',
     'History' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.history.php',
     'HotSpot' => $baseDir . '/main/exercice/hotspot.class.php',
     'HotSpotDelineation' => $baseDir . '/main/exercice/hotspot.class.php',
     'HotpotatoesExerciseResult' => $baseDir . '/main/exercice/hotpotatoes_exercise_result.class.php',
     'Html_Quickform_Rule_Date' => $baseDir . '/main/inc/lib/pear/HTML/QuickForm/Rule/Date.php',
-    'HttpResource' => $baseDir . '/main/inc/lib/system/media/renderer/http_resource.class.php',
     'Image' => $baseDir . '/main/inc/lib/image.lib.php',
     'ImageAjaxFileManager' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php',
     'ImageEditor' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageEditor.php',
@@ -536,11 +513,6 @@ return array(
     'PortfolioBulkAction' => $baseDir . '/main/inc/lib/portfolio.class.php',
     'PortfolioController' => $baseDir . '/main/inc/lib/portfolio.class.php',
     'PortfolioShare' => $baseDir . '/main/inc/lib/portfolio.class.php',
-    'Portfolio\\Artefact' => $baseDir . '/main/inc/lib/system/portfolio/artefact.class.php',
-    'Portfolio\\Download' => $baseDir . '/main/inc/lib/system/portfolio/download.class.php',
-    'Portfolio\\Mahara' => $baseDir . '/main/inc/lib/system/portfolio/mahara.class.php',
-    'Portfolio\\Portfolio' => $baseDir . '/main/inc/lib/system/portfolio/portfolio.class.php',
-    'Portfolio\\User' => $baseDir . '/main/inc/lib/system/portfolio/user.class.php',
     'Positioner' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/positioner.cls.php',
     'Promotion' => $baseDir . '/main/inc/lib/promotion.lib.php',
     'QRbitstream' => $vendorDir . '/jmontoyaa/phpqrcode/qrbitstream.php',
@@ -569,8 +541,6 @@ return array(
     'RSSCache' => $baseDir . '/main/inc/lib/magpierss/rss_cache.inc',
     'Redirect' => $baseDir . '/main/inc/lib/redirect.class.php',
     'Renderer' => $baseDir . '/main/inc/lib/phpdocx/pdf/include/renderer.cls.php',
-    'Request2' => $baseDir . '/main/inc/lib/system/web/request.class.php',
-    'RequestServer' => $baseDir . '/main/inc/lib/system/web/request_server.class.php',
     'Resource' => $baseDir . '/main/coursecopy/classes/Resource.class.php',
     'Response' => $baseDir . '/main/inc/lib/response.class.php',
     'Result' => $baseDir . '/main/gradebook/lib/be/result.class.php',
@@ -719,9 +689,6 @@ return array(
     'Thumbnail' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/Thumbnail.php',
     'Timeline' => $baseDir . '/main/inc/lib/timeline.lib.php',
     'ToolIntro' => $baseDir . '/main/coursecopy/classes/ToolIntro.class.php',
-    'Tools\\EntityGenerator' => $baseDir . '/main/inc/lib/tools/entity_generator.class.php',
-    'Tools\\EntityRepositoryGenerator' => $baseDir . '/main/inc/lib/tools/entity_repository_generator.class.php',
-    'Tools\\YamlExporter' => $baseDir . '/main/inc/lib/tools/yaml_exporter.class.php',
     'Tracking' => $baseDir . '/main/inc/lib/tracking.lib.php',
     'TrackingCourseLog' => $baseDir . '/main/inc/lib/tracking.lib.php',
     'TrackingUserLog' => $baseDir . '/main/inc/lib/tracking.lib.php',
@@ -781,7 +748,6 @@ return array(
     'ch_personality' => $baseDir . '/main/survey/survey.lib.php',
     'ch_score' => $baseDir . '/main/survey/survey.lib.php',
     'ch_yesno' => $baseDir . '/main/survey/survey.lib.php',
-    'db' => $baseDir . '/main/inc/lib/db.class.php',
     'directw' => $vendorDir . '/mpdf/mpdf/classes/directw.php',
     'document_processor' => $baseDir . '/main/inc/lib/search/tool_processors/document_processor.class.php',
     'elFinder' => $baseDir . '/main/inc/lib/elfinder/php/elFinder.class.php',
@@ -816,7 +782,6 @@ return array(
     'mPDF' => $vendorDir . '/mpdf/mpdf/mpdf.php',
     'manager' => $baseDir . '/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php',
     'meter' => $vendorDir . '/mpdf/mpdf/classes/meter.php',
-    'net\\HttpChannel' => $baseDir . '/main/inc/lib/system/net/http_channel.class.php',
     'nusoap_base' => $baseDir . '/main/inc/lib/nusoap/class.nusoap_base.php',
     'nusoap_client' => $baseDir . '/main/inc/lib/nusoap/class.soapclient.php',
     'nusoap_client_mime' => $baseDir . '/main/inc/lib/nusoap/nusoapmime.php',

+ 3 - 3
vendor/composer/autoload_real.php

@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInitd2cc221a7969047de8d2e10bc490c049
+class ComposerAutoloaderInit453f6dfa16f7a1d69e2abd2171eecd5b
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitd2cc221a7969047de8d2e10bc490c049
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInitd2cc221a7969047de8d2e10bc490c049', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit453f6dfa16f7a1d69e2abd2171eecd5b', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInitd2cc221a7969047de8d2e10bc490c049', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit453f6dfa16f7a1d69e2abd2171eecd5b', 'loadClassLoader'));
 
         $vendorDir = dirname(__DIR__);
         $baseDir = dirname($vendorDir);