public function __construct($pageName = '', $blockCounter = 1, $pageId = 0) { $this->pageName = $pageName; $this->pageId = $pageId; $this->blockCounter = $blockCounter; $this->domainDa = InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(); }
public function generateSource() { $event_data = new WuiEventRawData($this->mArgs['disp'], $this->mName); $this->mLayout = $this->mComments ? '<!-- begin ' . $this->mName . ' fckeditor -->' : ''; $value = str_ireplace("\n", "", $this->mValue); $value = str_ireplace("\r", "", $value); require_once InnomaticContainer::instance('innomaticcontainer')->getHome() . '/shared/fckeditor/fckeditor_php5.php'; $editor = new FCKeditor($this->mName); $editor->BasePath = InnomaticContainer::instance('innomaticcontainer')->getBaseUrl(false) . '/shared/fckeditor/'; $editor->Width = $this->mArgs['width']; $editor->Height = $this->mArgs['height']; $editor->Value = $this->mArgs['value']; $this->mLayout .= $editor->CreateHtml(); $this->mLayout .= $this->mComments ? '<!-- end ' . $this->mName . " fckeditor -->\n" : ''; return true; }
public function doGet(WebAppRequest $req, WebAppResponse $res) { // Bootstraps Innomatic require_once 'innomatic/core/InnomaticContainer.php'; $innomatic = InnomaticContainer::instance('innomaticcontainer'); // Sets Innomatic base URL $baseUrl = ''; $webAppPath = $req->getUrlPath(); if (!is_null($webAppPath) && $webAppPath != '/') { $baseUrl = $req->generateControllerPath($webAppPath, true); } $innomatic->setBaseUrl($baseUrl); $innomatic->setInterface(InnomaticContainer::INTERFACE_WEB); $home = WebAppContainer::instance('webappcontainer')->getCurrentWebApp()->getHome(); $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini'); $id = basename($req->getParameter('id')); //$id = basename($_GET['id']); $args = unserialize(file_get_contents(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id)); require_once 'phplot/PHPlot.php'; $graph = new PHPlot($args['width'], $args['height']); $graph->SetIsInline('1'); //$graph->SetDataColors( array("blue",'white'),array("black") ); //$graph->$line_style = array('dashed','dashed','solid','dashed','dashed','solid'); // Base $graph->SetDataValues($args['data']); $graph->SetPlotType($args['plottype']); // Appearance $graph->SetPointShape($args['pointshape']); $graph->SetPointSize($args['pointsize']); $graph->SetTitle($args['title']); // Color $graph->SetBackgroundColor($args['backgroundcolor']); $graph->SetGridColor($args['gridcolor']); if (count($args['legend'])) { $graph->SetLegend($args['legend']); } $graph->SetLineWidth($args['linewidth']); $graph->SetTextColor($args['textcolor']); $graph->SetDataColors(array(array(145, 165, 207), array(114, 167, 112), array(71, 85, 159), array(175, 83, 50), array(247, 148, 53), array(240, 231, 125), array(154, 204, 203), array(201, 164, 196)), 'black'); //$graph->data_color = array( array(145,165,207), array(114,167,112), array(71,85,159), array(175,83,50), array(247,148,53), array(240,231,125), array(154,204,203), array(201,164,196) ); //array('blue','green','yellow','red','orange'); $graph->DrawGraph(); unlink(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id); }
protected function undeployApplication(PackageInterface $package) { // Add vendor autoloads to access Innomatic Legacy Kernel bridge $vendorDir = $this->composer->getConfig()->get('vendor-dir'); require $vendorDir . '/autoload.php'; $appName = $package->getName(); $appName = substr($appName, strpos($appName, '/') + 1); $legacyKernel = new Kernel(); $result = $legacyKernel->runCallback(function () use($appName) { $appId = \Innomatic\Application\Application::getAppIdFromName($appName); $app = new \Innomatic\Application\Application(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), $appId); return $app->uninstall(); /* * Due to different handling of dependencies uninstall order * in Composer, we ignore applications that cannot be * uninstalled. */ }); if (!$result) { $this->io->write("<error>Application {$appName} must be manually uninstalled from Innomatic due to reversed dependencies</error>"); } }
public function doUpdateDomainAction($domainid, $params) { $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}"); if (!$domainQuery->getNumberRows()) { return false; } $domain = $domainQuery->getFields('domainid'); $fileDestName = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/' . basename($params['file']); if (!file_exists(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/')) { DirectoryUtils::mkTree(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/layouts/', 0755); } if (!copy(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->appname . '/layouts/' . basename($params['file']), $fileDestName)) { return false; } return true; }
/** * Innomatic * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE. * * @copyright 1999-2014 Innoteam Srl * @license http://www.innomatic.io/license/ New BSD License * @link http://www.innomatic.io */ /* if (file_exists(InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml.old')) { @copy(InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml.old', InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml.old2' ); } if (file_exists(InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml')) { @copy(InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml', InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer')->getHome() . 'core/db/innomatic_root.xml.old' ); } */ chmod(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/temp/pids', 0777);
/** * Used only when the component is a domain override. * * @param string $domainid * @param array $params * @return bool */ public function doDisableDomainAction($domainid, $params) { if (!strlen($params['name'])) { return false; } if (!isset($params['override']) and $params['override'] = self::OVERRIDE_DOMAIN) { return true; } $domain_query = $this->rootda->execute('SELECT domainid FROM domains WHERE id=' . $domainid); if ($domain_query == false or $domain_query->getNumberRows() == 0) { return false; } $domain_id = $domain_query->getFields('domainid'); if (file_exists(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domain_id . '/overrides/classes/' . $params['name'])) { return unlink(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domain_id . '/overrides/classes/' . $params['name']); // TODO add removal of empty class directory } return false; }
<?php require_once 'innomatic/io/filesystem/DirectoryUtils.php'; DirectoryUtils::unlinkTree(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'shared/fckeditor/'); DirectoryUtils::dircopy($this->basedir . '/shared/fckeditor/', InnomaticContainer::instance('innomaticcontainer')->getHome() . 'shared/fckeditor/');
<?php require_once 'innomatic/io/filesystem/DirectoryUtils.php'; DirectoryUtils::dircopy($this->basedir . '/WEB-INF/squirrelmail/', InnomaticContainer::instance('innomaticcontainer')->getHome() . 'WEB-INF/applications/squirrelmaillib/squirrelmail/');
<label>Pie</label> <action type="encoded">' . urlencode(WuiEventsCall::buildEventsCallString('', array(array('view', 'default', array('plottype' => 'pie'))))) . '</action> </args> </button> </children> </horizgroup> </children> </vertgroup>'; } $gMain_disp->Dispatch(); $gWui->AddChild(new WuiInnomaticPage('page', array('pagetitle' => 'phplot test', 'maincontent' => new WuiXml('page', array('definition' => $gXml_def)), 'icon' => 'txt'))); $gWui->Render(); // -------------- InnomaticContainer::instance('innomaticcontainer')->halt(); require_once 'phplot/PHPlot.php'; //Define the Object $graph = new PHPlot(500, 300); //Define some data //include("./regression_data.php"); $example_data = array(array("A", 0.0, 20, 4, 5, 6), array("B", 2.0, 30, 5, 6, 7), array("C", 3.0, 40, 5, 7, 8), array("D", 4.0, 50, 3, 6, 3), array("E", 4.4, 40, 3, 6, 5), array("F", 5.4, 40, 5, 6, 5), array("G", 5.5, 40, 7, 6, 5), array("H", 7, 35, 0.0, 0.0, ""), array("I", 7.4, 40, 14, 16, 25), array("J", 7.6, 40, 6, 6, 5), array("K", 8.199999999999999, 40, 3, 6, 5), array("L", 8.5, 40, 8, 6, 9), array("M", 9.300000000000001, 40, 5, 6, 5), array("N", 9.6, 40, 9, 6, 7), array("O", 9.9, 40, 2, 6, 5), array("P", 10.0, 40, 3, 6, 8), array("Q", 10.4, 40, 3, 6, 5), array("R", 10.5, 40, 3, 6, 5), array("S", 10.8, 40, 3, 6, 5), array("T", 11.4, 40, 3, 6, 5), array("U", 12.0, 40, 3, 7, 5), array("V", 13.4, 40, 3, 5, 3), array("W", 14.0, 30, 3, 5, 6)); //$graph->SetXGridLabelType("time"); //Set the data type //$graph->SetDataType("linear-linear"); //$graph->SetPointShape("halfline"); //Remove the X data labels //$graph->SetXGridLabelType("none"); //Load the data into data array $graph->SetDataValues($example_data); $graph->SetDataColors(array("blue", 'white'), array("black"));
<?php require_once 'innomatic/io/filesystem/DirectoryUtils.php'; DirectoryUtils::unlinkTree(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'WEB-INF/applications/squirrelmaillib/squirrelmail');
function PHPlot($which_width = 600, $which_height = 400, $which_output_file = NULL, $which_input_file = NULL) { /* * Please see http://www.php.net/register_shutdown_function * PLEASE NOTE: register_shutdown_function() will take a copy of the object rather than a reference * so we put an ampersand. However, the function registered will work on the object as it * was upon registration. To solve this, one of two methods can be used: * $obj = new object(); * register_shutdown_function(array(&$obj,'shutdown')); * OR * $obj = &new object(); * HOWEVER, as the second statement assigns $obj a reference to the current object, it might be that * several instances mess things up... (CHECK THIS) * * AND * as $this->img is set upon construction of the object, problems will not arise for us (for the * moment maybe, so I put all this here just in case) */ register_shutdown_function(array(&$this, '_PHPlot')); $this->ttf_path = InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/applications/phplot/'; $this->SetRGBArray($this->color_array); $this->background_done = FALSE; // Set to TRUE after background image first drawn if ($which_output_file) { $this->SetOutputFile($which_output_file); } if ($which_input_file) { $this->SetInputFile($which_input_file); } else { $this->image_width = $which_width; $this->image_height = $which_height; $this->img = ImageCreate($this->image_width, $this->image_height); if (!$this->img) { $this->PrintError('PHPlot(): Could not create image resource.'); } } $this->SetDefaultStyles(); $this->SetDefaultFonts(); /* $this->font = InnomaticContainer::instance('innomaticcontainer')->getHome().'core/applications/phplot/benjamingothic.ttf'; $this->title_ttffont = InnomaticContainer::instance('innomaticcontainer')->getHome().'core/applications/phplot/benjamingothic.ttf'; $this->axis_ttffont = InnomaticContainer::instance('innomaticcontainer')->getHome().'core/applications/phplot/benjamingothic.ttf'; $this->x_label_ttffont = InnomaticContainer::instance('innomaticcontainer')->getHome().'core/applications/phplot/benjamingothic.ttf'; $this->y_label_ttffont = InnomaticContainer::instance('innomaticcontainer')->getHome().'core/applications/phplot/benjamingothic.ttf'; */ $this->SetTitle(''); $this->SetXTitle(''); $this->SetYTitle(''); $this->print_image = TRUE; // Use for multiple plots per image (TODO: automatic) }
print ' update Updates the AppCentral applications list' . "\n"; $script->cleanExit(); break; case 'deploy': $app = new \Innomatic\Application\Application(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()); if ((is_dir($argv[2]) or file_exists($argv[2])) and $app->install($argv[2])) { print "Application {$app->appname} deployed\n"; $script->cleanExit(); } else { print "Application not deployed\n"; $script->cleanExit(1); } break; case 'undeploy': $appid = \Innomatic\Application\Application::getAppIdFromName($argv[2]); $app = new \Innomatic\Application\Application(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), $appid); if ($app->uninstall()) { print "Application {$argv['2']} undeployed\n"; $script->cleanExit(); } else { print "Application {$argv['2']} not undeployed\n"; $script->cleanExit(1); } break; case 'update': $appCentral = new \Innomatic\Application\AppCentralHelper(); $appCentral->updateApplicationsList(function ($serverId, $serverName, $repoId, $repoData) { print 'Server ' . $serverName . ' - Repository ' . $repoData['name'] . '... '; }, function ($result) { print 'done' . PHP_EOL; });
/** * Delete a object media from innomedia_blocks * @param string $fieldName name of field image in innomedia_blocks * @return boolean return if the action is successful or not */ public function deleteFromBlock($fieldName) { // Delete ref image from innomedia_blocks $domainDa = InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(); $checkQuery = $domainDa->execute("SELECT id, params\n FROM innomedia_blocks\n WHERE block = '{$this->blockName}'\n AND counter = {$this->blockCounter}\n AND page " . (!empty($this->pageName) ? "= '{$this->pageName}'" : "is NULL") . "\n AND pageid " . ($this->pageId != 0 ? "= {$this->pageId}" : "is NULL")); if ($checkQuery->getNumberRows() > 0) { $row_id = $checkQuery->getFields('id'); $json_params = json_decode($checkQuery->getFields('params'), true); // $ris = \Innomedia\Locale\LocaleWebApp::isTranslatedParams($json_params); list($blockModule, $blockName) = explode("/", $this->blockName); $context = \Innomedia\Context::instance('\\Innomedia\\Context'); $is_nolocale = \Innomedia\Block::isNoLocale($context, $blockModule, $blockName); if ($is_nolocale) { $current_language = 'nolocale'; } else { $current_language = \Innomedia\Locale\LocaleWebApp::getCurrentLanguage('backend'); } $params = \Innomedia\Locale\LocaleWebApp::getParamsDecodedByLocales($this->blockName, $json_params, 'backend'); $key = @array_search($this->id, $params[$fieldName]); // remove id image selected unset($params[$fieldName][$key]); // convet array in a not-associative array $params[$fieldName] = @array_values($params[$fieldName]); $json_params[$current_language] = $params; $domainDa->execute("UPDATE innomedia_blocks\n SET params=" . $domainDa->formatText(json_encode($json_params)) . " WHERE id={$row_id}"); } }
/** * Innomatic * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE. * * @copyright 1999-2014 Innomatic Company * @license http://www.innomatic.io/license/ New BSD License * @link http://www.innomatic.io */ require_once 'scripts_container.php'; $script = \Innomatic\Scripts\ScriptContainer::instance('\\Innomatic\\Scripts\\ScriptContainer'); ob_end_flush(); echo "\n Innomatic Cloud Applications Platform\n\n http://www.innomatic.io\n\n\n\n"; if (InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() != InnomaticContainer::STATE_SETUP) { echo "Innomatic has been already installed.\n"; $script->cleanExit(1); } if (!isset($argv[1])) { $argv[1] = ''; } echo "Starting setup...\n"; if (\Innomatic\Setup\InnomaticSetup::setup_by_config_file($argv[1], true)) { echo "Setup successfull.\n"; $script->cleanExit(); } else { echo "ERROR. Setup unsuccessfull.\n"; $script->cleanExit(1); }
public static function dieKey($applicationName, $domainName = '') { InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->abort('Key for application ' . $applicationName . (strlen($domainName) ? ', domain ' . $domainName : '') . ' is missing or has expired', \Innomatic\Core\InnomaticContainer::INTERFACE_WEB); }
/** * Executes update domain action. * * It should be called by update() method only. It should be redefined * by the extending class. * * @param string $domainid Domain identifier name * @param array $params Parameters in the component definition * @access public * @return void */ public function doUpdateDomainAction($domainid, $params) { $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}"); if (!$domainQuery->getNumberRows()) { return false; } $domain = $domainQuery->getFields('domainid'); $fileDestName = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/' . basename($params['file']); // Checks if the "keep" parameter is set to true. // If so, the configuration file will not be overwritten. if (isset($params['keep']) and $params['keep'] == true and file_exists($fileDestName)) { return true; } if (!file_exists(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/')) { DirectoryUtils::mkTree(RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/core/conf/', 0755); } if (!copy(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->appname . '/conf/' . basename($params['file']), $fileDestName)) { return false; } return true; }
protected function generateSource() { require_once 'phplot/PHPlot.php'; $id = md5('phplot_' . microtime() . rand(1, 9999)); // Base $args['width'] = $this->mRetina == 'true' ? $this->mWidth * 2 : $this->mWidth; $args['height'] = $this->mRetina == 'true' ? $this->mHeight * 2 : $this->mHeight; $args['data'] = $this->mArgs['data']; $args['plottype'] = $this->mPlotType; // Appearance $args['pointshape'] = $this->mPointShape; $args['pointsize'] = $this->mPointSize; $args['title'] = $this->mTitle; // Color $args['backgroundcolor'] = $this->mBackgroundColor; $args['gridcolor'] = $this->mGridColor; $args['legend'] = $this->mLegend; $args['linewidth'] = $this->mLineWidth; $args['textcolor'] = $this->mTextColor; if ($fh = fopen(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id, 'w')) { fwrite($fh, serialize($args)); fclose($fh); } $this->mLayout = ($this->mComments ? '<!-- begin ' . $this->mName . ' phplot -->' : '') . '<img src="' . InnomaticContainer::instance('innomaticcontainer')->getBaseUrl(true) . '/phplot/?id=' . $id . '" width="' . $this->mWidth . '" height="' . $this->mHeight . '">' . ($this->mComments ? '<!-- end ' . $this->mName . " phplot -->\n" : ''); return true; }
public function doUpdateDomainAction($domainid, $params) { $domainQuery = $this->rootda->execute("SELECT domainid FROM domains WHERE id={$domainid}"); if (!$domainQuery->getNumberRows()) { return false; } $domain = $domainQuery->getFields('domainid'); $assetDestFolder = RootContainer::instance('\\Innomatic\\Core\\RootContainer')->getHome() . $domain . '/assets/' . basename($params['asset']) . '/'; if (!DirectoryUtils::dirCopy(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->appname . '/assets/' . basename($params['asset']) . '/', $assetDestFolder)) { return false; } return true; }
} $script->cleanExit(); break; case 'appenable': $tenant = new \Innomatic\Domain\Domain(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), $argv[2], null); $appid = \Innomatic\Application\Application::getAppIdFromName($argv[3]); if ($tenant->enableApplication($appid)) { print "Application {$argv['3']} enabled to tenant {$argv['2']}\n"; $script->cleanExit(); } else { print "Application {$argv['3']} not enabled to tenant {$argv['2']}\n"; $script->cleanExit(1); } break; case 'appdisable': $tenant = new \Innomatic\Domain\Domain(InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), $argv[2], null); $appid = \Innomatic\Application\Application::getAppIdFromName($argv[3]); if ($tenant->disableApplication($appid)) { print "Application {$argv['3']} disabled from tenant {$argv['2']}\n"; $script->cleanExit(); } else { print "Application {$argv['3']} not disabled from tenant {$argv['2']}\n"; $script->cleanExit(1); } break; default: print 'Usage: php innomatic/core/scripts/tenant.php command' . "\n"; print 'Type tenant.php -h for a list of supported commands' . "\n"; } } catch (\Exception $e) { echo $e;
/** * Constructor * optional parameter can be either a string containing the path to the * mime.types files, or an associative array holding the extension * as key and the MIME type as value. * Example: * $mime =& new Mime_Types('/usr/local/apache/conf/mime.types'); * or * $mime =& new Mime_Types(array( * 'application/pdf' => 'pdf', * 'application/postscript' => array('ai','eps') * )); * @param mixed $mime_types */ function __construct($mime_types = null) { if (is_string($mime_types)) { $this->load_file($mime_types); } elseif (is_array($mime_types)) { $this->set($mime_types); } else { $this->load_file(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/applications/mimetypeslib/mime.types'); } }
/** * Returns the id number of a role by its name. * * @param string $name Role internal name. * @return int|bool Role id number or false if the role with the given name doesn't exists. */ public static function getIdFromName($name) { $dataAccess = InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(); $idQuery = $dataAccess->execute("SELECT id FROM domain_roles WHERE name=" . $dataAccess->formatText($name)); if ($idQuery->getNumberRows() == 0) { return false; } return $idQuery->getFields('id'); }
<?php require_once 'innomatic/io/filesystem/DirectoryUtils.php'; DirectoryUtils::unlinkTree(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'shared/fckeditor/');