Example #1
0
 public function process()
 {
     $args = func_get_args();
     $this->result->js = '';
     if (!isset($this->aSess['isAdmin']) || true !== $this->aSess['isAdmin']) {
         $this->result->out = 'set config ERROR: You are not logged in as Admin';
         return;
     }
     if (true !== $this->loadConfigFromFile(true)) {
         $this->result->out = 'config ERROR: cannot readf config file';
         return;
     }
     if (isset($this->argtoks['flags']['d'])) {
         ini_set('display_errors', 1);
         error_reporting(E_ALL);
     }
     try {
         $this->_db = \frdl\xGlobal\webfan::db();
         if ('create-tables' === strtolower($this->argtoks['arguments'][0]['cmd']) && intval($this->argtoks['arguments'][0]['pos']) === 1) {
             return $this->create_tables();
         }
     } catch (\Exception $e) {
         $this->result->out = $e->getMessage();
         return $this->result;
     }
     //  $this->result->out = 'tewsto';
     // $this->result->args = $this->argtoks;
 }
Example #2
0
File: html.php Project: frdl/webfan
 public function process()
 {
     $args = func_get_args();
     $this->result->out = '';
     $this->result->js = '';
     $this->result->html = '';
     $this->item = $this->getRequestOption('item');
     $this->result->item = strip_tags($this->item);
     $this->loadConfigFromFile(false);
     try {
         $this->db = \frdl\xGlobal\webfan::db();
         $this->db->Connect();
         $this->connected = $this->db->connected;
     } catch (\Exception $e) {
         $this->connected = false;
     }
     try {
         if (null !== $this->item) {
             $this->html .= $this->{'item_' . $this->result->item}();
         }
     } catch (\Exception $e) {
         $this->statusText = 'Error: ' . $e->getMessage();
     }
     $this->result->js = $this->m(trim($this->result->js));
     $this->result->html = base64_encode(trim($this->html));
 }
Example #3
0
 public function schema($settings = null, $rootfile = null)
 {
     $this->settings($settings);
     $this->db = null === $this->db ? \frdl\xGlobal\webfan::db() : $this->db;
     $rootfile = !is_string($rootfile) ? 'composer.json' : $rootfile;
     $schema = new \frdl\o();
     $schema->version = self::VERSION;
     $repos = 'repositories';
     $packages = 'packages';
     $versions = 'versions';
     $installations = 'installations';
     $oids = 'oids';
     $nodes = 'nodes';
     $schema->tables = array(TableAlias::ALIAS => array('tablename' => 'table_alias', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\TableAlias', 'exists' => false, 'version' => TableAlias::VERSION, 'table' => null, 'sql' => array()), Label::ALIAS => array('tablename' => 'labels', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Label', 'exists' => false, 'version' => Label::VERSION, 'table' => null, 'sql' => array()), Node::ALIAS => array('tablename' => $nodes, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Node', 'exists' => false, 'version' => Node::VERSION, 'table' => null, 'sql' => array("INSERT INTO " . $this->settings['pfx'] . $nodes . " \n                     SET \n                     id=1,\n                       id_parent=0,\n                      `id_root`=0,\n                      `table_alias`='" . Project::ALIAS . "',\n                      `file`='" . (file_exists($rootfile) ? $rootfile : '') . "'\n                      \n                      ")), Edge::ALIAS => array('tablename' => 'edges', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Edge', 'exists' => false, 'version' => Edge::VERSION, 'table' => null, 'sql' => array()), Project::ALIAS => array('tablename' => 'projects', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Project', 'exists' => false, 'version' => Project::VERSION, 'table' => null, 'sql' => array("INSERT INTO " . $this->settings['pfx'] . 'projects' . " \n                     SET \n                        `node`=1,\n                            `node_parent`=0,\n\t\t\t\t            `node_root`=0,\n\t\t\t\t            `public`=1,\n\t\t\t\t            `title` ='Application Composer',\n\t\t\t\t            `dir`='" . getcwd() . "',\n\t\t\t\t            `description`='My Application Composer Project'\n                      \n                      ")), OID::ALIAS => array('tablename' => $oids, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\OID', 'exists' => false, 'version' => OID::VERSION, 'table' => null, 'sql' => array("INSERT INTO " . $this->settings['pfx'] . $oids . " \n                     SET \n                      `weid`='',\n                      `oid`='1.3.6.1.4.1.37553',\n                      `oid_ra`='1.3.6.1.4.1'\n                      ", "INSERT INTO " . $this->settings['pfx'] . $oids . " \n                     SET \n                      `weid`='weid:1-8-8-5-1T-2-9',\n                      `oid`='1.3.6.1.4.1.37553.8.1.8.8.5.65.2',\n                      `oid_ra`='1.3.6.1.4.1.37553'\n                      ", "INSERT INTO " . $this->settings['pfx'] . $oids . " \n                     SET \n                      `weid`='weid:1-8-8-5-1T-59',\n                      `oid`='1.3.6.1.4.1.37553.8.1.8.8.5.65',\n                      `oid_ra`='1.3.6.1.4.1.37553'\n                      ", "INSERT INTO " . $this->settings['pfx'] . $oids . " \n                     SET \n                      `weid`='weid:1-8-3-D-1-6-3',\n                      `oid`='1.3.6.1.4.1.37553.8.1.8.3.13.1.6',\n                      `oid_ra`='1.3.6.1.4.1.37553'\n                      ", "INSERT INTO " . $this->settings['pfx'] . $oids . " \n                     SET \n                      `weid`='weid:1-8-3-D-1-1-4,\n                      `oid`='1.3.6.1.4.1.37553.8.1.8.3.13.1.1',\n                      `oid_ra`='1.3.6.1.4.1.37553'\n                      ")), Repository::ALIAS => array('tablename' => $repos, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Repository', 'exists' => false, 'version' => Repository::VERSION, 'table' => null, 'sql' => array("INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=1,\n                      def=1,\n                       `priority`=8,\n                      `name`='Packagist',\n                      `host`='packagist.org',\n                      `homepage`='https://packagist.org/',\n                      `description`='The main Composer repository',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\Packagist') . "'\n                      \n                      ", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=0,\n                      def=1,\n                       `priority`=0,\n                      `name`='Composer [Package]',\n                      `host`='github.com',\n                      `homepage`='https://github.com/composer/composer',\n                      `description`='Composer source',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\Composer') . "'\n                      \n                      ", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=1,\n                      def=1,\n                       `priority`=0,\n                      `name`='PragmaMx [Package]',\n                      `host`='www.pragmamx.org',\n                      `homepage`='http://www.pragmamx.org',\n                      `description`='Just another CMS',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\PragmaMx') . "'\n                      \n                      ", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=1,\n                      def=1,\n                       `priority`=0,\n                      `name`='PHPclasses.org',\n                      `host`='www.phpclasses.org',\n                      `homepage`='http://webfan.users.phpclasses.org',\n                      `description`='The phpclasses composer repository',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\phpclasses') . "'\n                      \n                      ", "UPDATE " . $this->settings['pfx'] . $repos . " SET `host`='www.phpclasses.org' WHERE `name`='PHPclasses.org' LIMIT 1", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=1,\n                      def=1,\n                       `priority`=0,\n                      `name`='JSclasses.org',\n                      `host`='jsclasses.org',\n                      `homepage`='http://webfan.users.jsclasses.org',\n                      `description`='The jsclasses composer repository',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\jsclasses') . "'\n                      \n                      ", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=0,\n                      def=1,\n                       `priority`=9,\n                      `name`='Webfan',\n                      `host`='api.webfan.de',\n                      `homepage`='http://www.webfan.de',\n                      `description`='Webfan Software Server',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\webfan') . "'\n                      \n                      ", "INSERT INTO " . $this->settings['pfx'] . $repos . " \n                     SET \n                      _use=0,\n                      def=1,\n                       `priority`=10,\n                      `name`='Local',\n                      `host`='localhost',\n                      `homepage`='frdl://repository.webfan/ApplicationComposer/',\n                      `description`='Webfan Software Server',\n                      `fetcher_class`='" . urlencode('\\frdl\\ApplicationComposer\\Repos\\webfan') . "'\n                      \n                      ", "UPDATE " . $this->settings['pfx'] . $repos . " SET _use=1 WHERE \n                      `name`='Packagist' \n                  OR  `name`='PragmaMx [Package]' \n                  OR  `name`='PHPclasses.org'\n                  OR  `name`='JSclasses.org'\n                  \n                ", "ALTER TABLE " . $this->settings['pfx'] . $repos . " \n                  ADD `auth` TEXT\n                  \n                ")), 'Installations' => array('tablename' => $installations, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Installations', 'exists' => false, 'version' => Installations::VERSION, 'table' => null, 'sql' => array()), Version::ALIAS => array('tablename' => $versions, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Version', 'exists' => false, 'version' => Version::VERSION, 'table' => null, 'sql' => array()), Feature::ALIAS => array('tablename' => 'features', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Feature', 'exists' => false, 'version' => Feature::VERSION, 'table' => null, 'sql' => array()), User::ALIAS => array('tablename' => 'users', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\User', 'exists' => false, 'version' => User::VERSION, 'table' => null, 'sql' => array("INSERT INTO " . $this->settings['pfx'] . 'users' . " \n                     SET \n                      `active`='1',\n                      `blocked`='0',\n                      `wuid`='2',\n                      `time`='" . time() . "',\n                      `username`='webfan',\n                      `email`='" . $_SERVER['SERVER_NAME'] . ".supportaccount.software.frdl.de'\n                      ")), SInterface::ALIAS => array('tablename' => 's_interfaces', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\SInterface', 'exists' => false, 'version' => SInterface::VERSION, 'table' => null, 'sql' => array()), 'Packages' => array('tablename' => $packages, 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Package', 'exists' => false, 'version' => Package::VERSION, 'table' => null, 'sql' => array()), Download::ALIAS => array('tablename' => 'downloads', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Download', 'exists' => false, 'version' => Download::VERSION, 'table' => null, 'sql' => array()), Batch::ALIAS => array('tablename' => 'batches', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\Batch', 'exists' => false, 'version' => Batch::VERSION, 'table' => null, 'sql' => array()), ClosureTreeHelper::ALIAS => array('tablename' => 'ct_tree', 'ORM_CLASS' => '\\frdl\\ApplicationComposer\\ClosureTreeHelper', 'exists' => false, 'version' => ClosureTreeHelper::VERSION, 'table' => null, 'sql' => array()));
     foreach ($schema->tables as $title => &$t) {
         $t['table'] = $this->settings['pfx'] . $t['tablename'];
     }
     return $schema;
 }
 function __construct($options = array())
 {
     $this->o = array_merge($this->defaultOptions(), $options);
     $this->db = \frdl\xGlobal\webfan::db();
 }
Example #5
0
File: Man.php Project: frdl/webfan
 public function assignDB(&$db = null)
 {
     $db = \frdl\xGlobal\webfan::db();
     return $this;
 }
Example #6
0
File: pm.php Project: frdl/webfan
 public function find($o)
 {
     if (!isset($this->argtoks['arguments'][1]) || intval($this->argtoks['arguments'][1]['pos']) !== 2) {
         return $this->wrongArgumentCount();
     }
     $this->packagefullname = str_replace(array('"', "'"), array('', ''), $this->argtoks['arguments'][1]['cmd']);
     try {
         $this->F = new \frdl\ApplicationComposer\Repos\Fetch($o);
         $this->result->searchresults = $this->F->search($this->packagefullname);
         $this->result->searchresults = array_unique($this->result->searchresults);
     } catch (\Exception $e) {
         \webdof\wResponse::status(409);
         $this->result->out = $e->getMessage();
         return;
     }
     if (isset($this->argtoks['flags']['s']) && true === $this->aSess['isAdmin']) {
         $p = new \frdl\ApplicationComposer\Package(array(), \frdl\xGlobal\webfan::db()->settings(), $this->db);
         $p->db()->begin();
         foreach ($this->result->searchresults as $num => $s) {
             if (is_array($s)) {
                 foreach ($s as $num2 => $s2) {
                     $v = explode('/', $s2->name);
                     if (2 === count($v) && !$p->find($v[0], $v[1])) {
                         $p->vendor = $v[0];
                         $p->package = $v[1];
                         $p->url = $s2->url;
                         $p->description = $s2->description;
                         $p->time_last_fetch_info = time();
                         $p->create();
                     }
                 }
             } else {
                 $v = explode('/', $s->name);
                 if (2 === count($v) && !$p->find($v[0], $v[1])) {
                     $p->vendor = $v[0];
                     $p->package = $v[1];
                     $p->url = $s->url;
                     $p->description = $s->description;
                     $p->time_last_fetch_info = time();
                     $p->create();
                 }
             }
         }
         $p->db()->commit();
     }
     $this->result->out = 'OK';
 }
Example #7
0
 public final function connect($settings = null, \frdl\DB &$db = null)
 {
     $this->settings($settings);
     $this->db = null === $db ? \frdl\xGlobal\webfan::db() : $db;
 }