function run_create_translation($args, $opts) { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $opts = $filter->xssFilterHard($opts); $args = $filter->xssFilterHard($args); $rootDir = realpath(__DIR__."/../../../../"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir); $loadConstants = false; $workspaces = get_workspaces_from_args($args); $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $translation = new Translation(); CLI::logging("Updating labels Mafe ...\n"); foreach ($workspaces as $workspace) { try { echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n"; $translation->generateTransaltionMafe($lang); } catch (Exception $e) { echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"; } } CLI::logging("Create successful\n"); }
function packPlugin($pluginName, $version) { $pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP; $pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName; $fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar'; G::LoadSystem('templatePower'); /* $pluginDirectory = PATH_PLUGINS . $pluginName; $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; $pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; //verify if plugin exists, $pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php'; if ( !is_file ( $pluginClassFilename ) ) { printf("The plugin %s doesn't exist in this file %s \n", pakeColor::colorize( $pluginName, 'ERROR'), pakeColor::colorize( $pluginClassFilename, 'INFO') ); die ; } */ G::LoadThirdParty('pear/Archive', 'Tar'); $tar = new Archive_Tar($fileTar); $tar->_compress = false; //$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome); addTarFolder($tar, $pathBase, $pathHome); $aFiles = $tar->listContent(); return $fileTar; }
function rangeDownload($location, $mimeType) { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $location = $filter->xssFilterHard($location, "path"); if (!file_exists($location)) { header("HTTP/1.0 404 Not Found"); return; } $size = filesize($location); $time = date('r', filemtime($location)); $fm = @fopen($location, 'rb'); if (!$fm) { header("HTTP/1.0 505 Internal server error"); return; } $begin = 0; $end = $size - 1; if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\\h*(\\d+)-(\\d*)[\\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { $begin = intval($matches[1]); if (!empty($matches[2])) { $end = intval($matches[2]); } } } header('HTTP/1.0 206 Partial Content'); header("Content-Type: {$mimeType}"); header('Cache-Control: public, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Accept-Ranges: bytes'); header('Content-Length:' . ($end - $begin + 1)); if (isset($_SERVER['HTTP_RANGE'])) { header("Content-Range: bytes {$begin}-{$end}/{$size}"); } header("Content-Disposition: inline; filename={$location}"); header("Content-Transfer-Encoding: binary"); header("Last-Modified: {$time}"); $cur = $begin; fseek($fm, $begin, 0); while (!feof($fm) && $cur <= $end && connection_status() == 0) { set_time_limit(0); print fread($fm, min(1024 * 16, $end - $cur + 1)); $cur += 1024 * 16; flush(); } }
function DumpHeaders($filename) { global $root_path; if (!$filename) { return; } $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $isIE = 0; if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false && strstr($HTTP_USER_AGENT, 'Opera') === false) { $isIE = 1; } if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false && strstr($HTTP_USER_AGENT, 'Opera') === false) { $isIE6 = 1; } $aux = preg_replace('[^-a-zA-Z0-9\\.]', '_', $filename); $aux = explode('_', $aux); $downloadName = $aux[count($aux) - 1]; // $downloadName = $filename; //$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename); if ($isIE && !isset($isIE6)) { // http://support.microsoft.com/support/kb/articles/Q182/3/15.asp // Do not have quotes around filename, but that applied to // "attachment"... does it apply to inline too? // This combination seems to work mostly. IE 5.5 SP 1 has // known issues (see the Microsoft Knowledge Base) header("Content-Disposition: inline; filename={$downloadName}"); // This works for most types, but doesn't work with Word files header("Content-Type: application/download; name=\"{$downloadName}\""); //header("Content-Type: $type0/$type1; name=\"$downloadName\""); //header("Content-Type: application/x-msdownload; name=\"$downloadName\""); //header("Content-Type: application/octet-stream; name=\"$downloadName\""); } else { header("Content-Disposition: attachment; filename=\"{$downloadName}\""); header("Content-Type: application/octet-stream; name=\"{$downloadName}\""); } //$filename = PATH_UPLOAD . "$filename"; G::LoadSystem('inputfilter'); $filter = new InputFilter(); $filename = $filter->xssFilterHard($filename, 'path'); readfile($filename); }
function print_endpoint_names() { global $iop; if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } G::LoadSystem('inputfilter'); $filter = new InputFilter(); $currTest = $filter->xssFilterHard($iop->currentTest); if (!$iop->getEndpoints($iop->currentTest)) { die("Unable to retrieve endpoints for {$currTest}\n"); } print "Interop Servers for {$currTestt}:\n"; foreach ($iop->endpoints as $server) { print " {$server->name}\n"; } }
require_once $unitFilename; require_once PATH_THIRDPARTY . '/lime/lime.php'; require_once PATH_THIRDPARTY . 'lime/yaml.class.php'; require_once PATH_CORE . "config/databases.php"; require_once "propel/Propel.php"; Propel::init(PATH_CORE . "config/databases.php"); G::LoadThirdParty('smarty/libs', 'Smarty.class'); G::LoadSystem('error'); G::LoadSystem('xmlform'); G::LoadSystem('xmlDocument'); G::LoadSystem('form'); G::LoadSystem('dbconnection'); G::LoadSystem('dbsession'); G::LoadSystem('dbrecordset'); G::LoadSystem('dbtable'); G::LoadSystem('testTools'); G::LoadClass('appDelegation'); require_once PATH_CORE . '/classes/model/AppDelegation.php'; $dbc = new DBConnection(); $ses = new DBSession($dbc); $obj = new AppDelegation($dbc); $t = new lime_test(1, new lime_output_color()); $t->diag('class AppDelegation'); $t->isa_ok($obj, 'AppDelegation', 'class AppDelegation created'); class AppDel extends unitTest { function CreateEmptyAppDelegation($data, $fields) { $obj = new AppDelegation(); $res = $obj->createAppDelegation($fields); return $res;
/** * * * Creates a Dynaform based on a PMTable * * @name createFromPMTable * @author gustavo cruz gustavo[at]colosa[dot]com * @param array $aData Fields with : * $aData['DYN_UID'] the dynaform id * $aData['USR_UID'] the userid * string $pmTableUid uid of the PMTable * */ public function createFromPMTable($aData, $pmTableUid) { $this->create($aData); $aData['DYN_UID'] = $this->getDynUid(); //krumo(BasePeer::getFieldnames('Content')); $fields = array(); //$oCriteria = new Criteria('workflow'); $pmTable = AdditionalTablesPeer::retrieveByPK($pmTableUid); $addTabName = $pmTable->getAddTabName(); $keys = ''; if (isset($aData['FIELDS'])) { foreach ($aData['FIELDS'] as $iRow => $row) { if ($keys != '') { $keys = $keys . '|' . $row['PRO_VARIABLE']; } else { $keys = $row['PRO_VARIABLE']; } } } else { $keys = ' '; } // $addTabKeys = $pmTable->getAddTabDynavars(); // $addTabKeys = unserialize($addTabKeys); // $keys = ''; // foreach ( $addTabKeys as $addTabKey ){ // if (trim($addTabKey['CASE_VARIABLE'])!=''&&$keys!=''){ // $keys = $keys.'|'.$addTabKey['CASE_VARIABLE']; // } else { // $keys = $addTabKey['CASE_VARIABLE']; // } // // } // Determines the engine to use // For a description of a table $sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $sql = $oDataBase->getTableDescription($addTabName); } else { $sql = 'DESC ' . $addTabName; } $dbh = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME); $sth = $dbh->createStatement(); $res = $sth->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $file = $aData['PRO_UID'] . '/' . $aData['DYN_UID']; $dbc = new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml'); $ses = new DBSession($dbc); $fieldXML = new DynaFormField($dbc); $pmConnectionName = $addTabName . '_CONNECTION'; if ($aData['DYN_TYPE'] == 'xmlform') { $labels = array(); $options = array(); $attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => $pmConnectionName, 'TYPE' => 'pmconnection', 'PMTABLE' => $pmTableUid, 'KEYS' => $keys); $fieldXML->Save($attributes, $labels, $options); } $keyRequered = ''; $countKeys = 0; while ($res->next()) { if ($res->get('Key') != '') { $countKeys++; } if ($res->get('Extra') == 'auto_increment') { $keyRequered .= $res->get('Field'); } } $dbh = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME); $sth = $dbh->createStatement(); $res = $sth->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); while ($res->next()) { // if(strtoupper($res->get('Null'))=='NO') { if (strtoupper($res->get($oDataBase->getFieldNull())) == 'NO') { if ($countKeys == 1 && $res->get('Field') == $keyRequered) { $required = '0'; } else { $required = '1'; } } else { $required = '0'; } $fieldName = $res->get('Field'); $defaultValue = $res->get('Default'); $labels = array(SYS_LANG => $fieldName); $options = array(); $type = explode('(', $res->get('Type')); switch ($type[0]) { case 'text': $type = 'textarea'; break; case 'date': $type = 'date'; break; default: $type = 'text'; break; } if ($aData['DYN_TYPE'] == 'xmlform') { $attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => $fieldName, 'TYPE' => $type, 'PMCONNECTION' => $pmConnectionName, 'PMFIELD' => $fieldName, 'REQUIRED' => $required, 'DEFAULTVALUE' => $defaultValue); } else { $attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => $fieldName, 'TYPE' => $type, 'REQUIRED' => $required, 'DEFAULTVALUE' => $defaultValue); } $fieldXML->Save($attributes, $labels, $options); } $labels = array(SYS_LANG => 'Submit'); $attributes = array('XMLNODE_NAME_OLD' => '', 'XMLNODE_NAME' => 'SUBMIT', 'TYPE' => 'submit'); $fieldXML->Save($attributes, $labels, $options); }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ if (!defined('PATH_THIRDPARTY')) { require_once $_SERVER['PWD'] . '/test/bootstrap/unit.php'; } require_once PATH_THIRDPARTY . 'lime/lime.php'; define('G_ENVIRONMENT', G_TEST_ENV); G::LoadThirdParty('smarty/libs', 'Smarty.class'); G::LoadSystem('xmlform'); G::LoadSystem('xmlDocument'); G::LoadSystem('form'); G::LoadSystem('pagedTable'); $t = new lime_test(2, new lime_output_color()); $obj = "pagedTable"; $method = array(); $testItems = 0; $method = get_class_methods('pagedTable'); $t->diag('class pagedTable'); $t->is(count($method), 10, "class pagedTable " . $testItems . " methods."); $t->todo('review all pendings in this class');
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ /** * @package gulliver.system */ G::LoadSystem('objectTemplate'); class Tree extends Xml_Node { var $template = 'tree.html'; var $nodeType = 'base'; var $nodeClass = 'treeNode'; var $contentClass = 'treeContent'; var $width = '100%'; var $contentWidth = '360'; var $contracted = false; var $showSign = true; var $isChild = false; var $plus = "<span style='position:absolute; width:16px;height:22px;cursor:pointer;'onclick='tree.expand(this.parentNode);'> </span>"; var $minus = "<span style='position:absolute; width:16px;height:22px;cursor:pointer' onclick='tree.contract(this.parentNode);'> </span>"; var $point = "<span style='position:absolute; width:5px;height:10px;cursor:pointer;' onclick='tree.select(this.parentNode);'> </span>"; /**
G::LoadSystem('dbrecordset'); G::LoadSystem('dbtable'); G::LoadSystem('rbac'); G::LoadSystem('publisher'); G::LoadSystem('templatePower'); G::LoadSystem('xmlDocument'); G::LoadSystem('xmlform'); G::LoadSystem('xmlformExtension'); G::LoadSystem('form'); G::LoadSystem('menu'); G::LoadSystem("xmlMenu"); G::LoadSystem('dvEditor'); //G::LoadSystem('table'); G::LoadSystem('controller'); G::LoadSystem('httpProxyController'); G::LoadSystem('pmException'); //G::LoadSystem('pagedTable'); // Installer, redirect to install if we don't have a valid shared data folder if (!defined('PATH_DATA') || !file_exists(PATH_DATA)) { // new installer, extjs based define('PATH_DATA', PATH_C); require_once PATH_CONTROLLERS . 'installer.php'; $controller = 'Installer'; // if the method name is empty set default to index method if (strpos(SYS_TARGET, '/') !== false) { list($controller, $controllerAction) = explode('/', SYS_TARGET); } else { $controllerAction = SYS_TARGET; } $controllerAction = $controllerAction != '' && $controllerAction != 'login' ? $controllerAction : 'index'; // create the installer controller and call its method
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ /** * * @package gulliver.system * */ G::LoadSystem('database_base'); class database extends database_base { public $iFetchType = MYSQL_ASSOC; /** * class database constructor * * @param $sType adapter type * @param $sServer server * @param $sUser db user * @param $sPass db user password * @param $sDataBase Database name */ public function __construct($sType = DB_ADAPTER, $sServer = DB_HOST, $sUser = DB_USER, $sPass = DB_PASS, $sDataBase = DB_NAME) { $this->sType = $sType;
function showPopUp($PopupText) { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $PopupText = $filter->xssFilterHard($PopupText); echo "<script type=\"text/javascript\" language=\"javascript\">alert (\"{$PopupText}\");</script>"; }
/** * processes request and returns response * * @param string $data usually is the value of $HTTP_RAW_POST_DATA * @access public */ function service($data) { global $HTTP_SERVER_VARS; if (isset($_SERVER['QUERY_STRING'])) { $qs = $_SERVER['QUERY_STRING']; } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $qs = $HTTP_SERVER_VARS['QUERY_STRING']; } else { $qs = ''; } $this->debug("In service, query string={$qs}"); if (ereg('wsdl', $qs)) { $this->debug("In service, this is a request for WSDL"); if ($this->externalWSDLURL) { if (strpos($this->externalWSDLURL, "://") !== false) { // assume URL header('Location: ' . $this->externalWSDLURL); } else { // assume file header("Content-Type: text/xml\r\n"); $fp = fopen($this->externalWSDLURL, 'r'); fpassthru($fp); } } elseif ($this->wsdl) { header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); print $this->wsdl->serialize($this->debug_flag); if ($this->debug_flag) { $this->debug('wsdl:'); $this->appendDebug($this->varDump($this->wsdl)); print $this->getDebugAsXMLComment(); } } else { header("Content-Type: text/html; charset=ISO-8859-1\r\n"); print "This service does not provide WSDL"; } } elseif ($data == '' && $this->wsdl) { $this->debug("In service, there is no data, so return Web description"); if (!class_exists('G')) { $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $docuroot = explode('/', $realdocuroot); array_pop($docuroot); $pathhome = implode('/', $docuroot) . '/'; array_pop($docuroot); $pathTrunk = implode('/', $docuroot) . '/'; require_once $pathTrunk . 'gulliver/system/class.g.php'; } G::LoadSystem('inputfilter'); $filter = new InputFilter(); $webDescription = $filter->xssFilterHard($this->wsdl->webDescription()); print $webDescription; } else { $this->debug("In service, invoke the request"); $this->parse_request($data); if (!$this->fault) { $this->invoke_method(); } if (!$this->fault) { $this->serialize_return(); } $this->send_response(); } }
/** * soapRequest * * make a SOAP request to Zimbra server, returns the XML * * @since version 1.0 * @access public * @param string $body body of page * @param boolean $header * @param boolean $footer * @return string $response */ protected function soapRequest($body, $header = false, $connecting = false) { G::LoadSystem('inputfilter'); $filter = new InputFilter(); if (!$connecting && !$this->_connected) { throw new Exception('zimbra.class: soapRequest called without a connection to Zimbra server'); } if ($header == false) { $header = '<context xmlns="urn:zimbra"> <authToken>' . $this->auth_token . '</authToken> <sessionId id="' . $this->session_id . '">' . $this->session_id . '</sessionId> </context>'; } $soap_message = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header>' . $header . '</soap:Header> <soap:Body>' . $body . '</soap:Body> </soap:Envelope>'; $this->message('SOAP message:<textarea>' . $soap_message . '</textarea>'); curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $soap_message); $this->_curl = $filter->xssFilterHard($this->_curl, "url"); $response = curl_exec($this->_curl); if (!$response) { $this->error = 'ERROR: curl_exec - (' . curl_errno($this->_curl) . ') ' . curl_error($this->_curl); return false; } elseif (strpos($response, '<soap:Body><soap:Fault>') !== false) { $error_code = $this->extractErrorCode($response); $this->error = 'ERROR: ' . $error_code . ':<textarea>' . $response . '</textarea>'; $this->message($this->error); $aError = array('error' => $error_code); return $aError; //return false; } $this->message('SOAP response:<textarea>' . $response . '</textarea><br/><br/>'); $this->_num_soap_calls++; return $response; }
public function verifyTable() { $oCriteria = new Criteria('workflow'); $del = DBAdapter::getStringDelimiter(); $sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $sql = $oDataBase->createTableObjectPermission(); } $con = Propel::getConnection("workflow"); $stmt = $con->prepareStatement($sql); $rs = $stmt->executeQuery(); }
function deleteSkin() { G::LoadSystem('inputfilter'); $filter = new InputFilter(); try { $_REQUEST['SKIN_FOLDER_ID'] = $filter->xssFilterHard($_REQUEST['SKIN_FOLDER_ID']); if (!isset($_REQUEST['SKIN_FOLDER_ID'])) { throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')); } if ($_REQUEST['SKIN_FOLDER_ID'] == "classic") { throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE')); } $folderId = $_REQUEST['SKIN_FOLDER_ID']; if (!is_dir(PATH_CUSTOM_SKINS . $folderId)) { throw new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS')); } //Delete G::rm_dir(PATH_CUSTOM_SKINS . $folderId); $response['success'] = true; $response['message'] = "{$folderId} deleted"; G::auditLog("DeleteSkin", "Skin Name: " . $folderId); } catch (Exception $e) { $response['success'] = false; $response['error'] = $response['message'] = $e->getMessage(); $response = $filter->xssFilterHard($response); print_r(G::json_encode($response)); } }
/** * Function tableExist * Check if table exists * * @access public * @return boolean */ public function tableExist() { /* $bExists = true; $oConnection = mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME); $oDataset = mysql_query('SELECT COUNT(*) FROM REPORT_TABLE') || ($bExists = false); return $bExists; */ $bExists = true; $sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $bExists = $oDataBase->reportTableExist(); } return $bExists; }
G::LoadSystem('dynaformhandler'); $o = new dynaFormHandler(PATH_DYNAFORM . "{$tmpfilename}.xml"); $list_elements = explode(',', $items); $e = array(); foreach ($list_elements as $element) { $e[] = $o->getNode($element); } $o->__cloneEmpty(); foreach ($e as $e1) { $o->setNode($e1); } } break; case 'saveHidden': $tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE']; G::LoadSystem('dynaformhandler'); $o = new dynaFormHandler(PATH_DYNAFORM . "{$tmpfilename}.xml"); $hidden_items = array(); $has_hidden_items = false; if (isset($_POST['hidden'])) { if ($_POST['hidden'] != '') { $has_hidden_items = true; $hidden_items = explode(',', $_POST['hidden']); $hidden_items_tmp = $hidden_items; $hidden_items = array(); foreach ($hidden_items_tmp as $hItem) { $tmp = explode("@", $hItem); $hidden_items[] = $tmp[1]; } $hidden_items_tmp = implode(',', $hidden_items); }
* GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ $path = PATH_DB; //using the opendir function if (!($dir_handle = @opendir(PATH_DB))) { header("location: /errors/error704.php"); die; } G::LoadSystem('inputfilter'); $filter = new InputFilter(); echo "<table class='basicTable' cellpadding='5' cellspacing='0' border='0'>"; echo "<tr class='Record'><td colspan='2' class='formTitle'>Please select a valid workspace to continue</td></tr>"; echo "<tr valign='top'>"; $curPage = getenv("REQUEST_URI"); $curPage = $filter->xssFilterHard($curPage, "url"); //running the while loop $first = 0; while ($file = readdir($dir_handle)) { if (substr($file, 0, 3) == 'db_') { if ($first == 0) { echo "<td><table class='Record' ><tr class='formLabel''><td>RBAC built-in workspaces</td></tr>"; $first = 1; } $name = substr(substr($file, 0, strlen($file) - 4), 3);
public function uninstallPlugin ($sNamespace) { $pluginFile = $sNamespace . ".php"; if (! file_exists( PATH_PLUGINS . $pluginFile )) { throw (new Exception( "File \"$pluginFile\" doesn't exist" )); } /////// $path = PATH_PLUGINS . $pluginFile; G::LoadSystem('inputfilter'); $filter = new InputFilter(); $path = $filter->validateInput($path, 'path'); require_once ($path); foreach ($this->_aPluginDetails as $namespace => $detail) { if ($namespace == $sNamespace) { $this->enablePlugin( $detail->sNamespace ); $this->disablePlugin( $detail->sNamespace ); /////// $plugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename ); $this->_aPlugins[$detail->sNamespace] = $plugin; if (method_exists( $plugin, "uninstall" )) { $plugin->uninstall(); } /////// $this->save(); /////// $pluginDir = PATH_PLUGINS . $detail->sPluginFolder; if (isset( $detail->sFilename ) && ! empty( $detail->sFilename ) && file_exists( $detail->sFilename )) { unlink( $detail->sFilename ); } if (isset( $detail->sPluginFolder ) && ! empty( $detail->sPluginFolder ) && file_exists( $pluginDir )) { G::rm_dir( $pluginDir ); } /////// $this->uninstallPluginWorkspaces( array ($sNamespace ) ); /////// break; } } }
<?php $unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php'; require_once $unitFilename; require_once PATH_THIRDPARTY . '/lime/lime.php'; require_once PATH_THIRDPARTY . 'lime/yaml.class.php'; require_once 'propel/Propel.php'; require_once "creole/Creole.php"; Propel::init(PATH_CORE . "config/databases.php"); G::LoadThirdParty('smarty/libs', 'Smarty.class'); G::LoadSystem('error'); G::LoadSystem('xmlform'); G::LoadSystem('xmlDocument'); G::LoadSystem('form'); require_once PATH_CORE . "config/databases.php"; G::LoadClass('smtp'); $obj = new Smtp($dbc); $t = new lime_test(29, new lime_output_color()); $className = Smtp; $className = strtolower(substr($className, 0, 1)) . substr($className, 1); $reflect = new ReflectionClass($className); $method = array(); $testItems = 0; foreach ($reflect->getMethods() as $reflectmethod) { $params = ''; foreach ($reflectmethod->getParameters() as $key => $row) { if ($params != '') { $params .= ', '; } $params .= '$' . $row->name; }
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ $unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php'; require_once $unitFilename; require_once PATH_THIRDPARTY . '/lime/lime.php'; require_once PATH_THIRDPARTY . 'lime/yaml.class.php'; G::LoadThirdParty('smarty/libs', 'Smarty.class'); G::LoadSystem('error'); G::LoadSystem('xmlform'); G::LoadSystem('xmlDocument'); G::LoadSystem('form'); G::LoadSystem('dbconnection'); G::LoadSystem('dbsession'); G::LoadSystem('dbrecordset'); G::LoadSystem('dbtable'); G::LoadClass('toolBar'); require_once PATH_CORE . "config/databases.php"; $dbc = new DBConnection(); $ses = new DBSession($dbc); $file = 'login/login'; $arg1 = ''; $arg2 = ''; $arg3 = ''; $obj = new ToolBar($file); $t = new lime_test(1, new lime_output_color()); $t->diag('class ToolBar'); $t->isa_ok($obj, 'ToolBar', 'class ToolBar created'); $t->diag(' XmlForm_Field_toolbar'); //$t->fail( 'review all pendings methods and CLASSES in this class');
/** * Set the javascript code * * @param object $A * @param string $fieldName * @param string $sCode * @return array */ public function set_javascript($A, $fieldName, $sCode, $meta = '') { if ($fieldName == '___pm_boot_strap___') { return 0; } $sCode = urldecode($sCode); try { $sCode = rtrim($sCode); $file = G::decrypt($A, URL_KEY); /* $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' ); $ses2 = new DBSession($dbc2); $ses2->execute(G::replaceDataField("UPDATE dynaForm SET XMLNODE_VALUE = @@CODE WHERE XMLNODE_NAME = @@FIELDNAME ", array('FIELDNAME'=>$fieldName,'CODE'=>$sCode), "myxml" )); */ G::LoadSystem('dynaformhandler'); $dynaform = new dynaFormHandler(PATH_DYNAFORM . "{$file}.xml"); $dynaform->replace($fieldName, $fieldName, array('type' => 'javascript', 'meta' => $meta, '#cdata' => $sCode)); return 0; } catch (Exception $e) { return (array) $e; } }
public function update($fields) { $con = Propel::getConnection(ReportTablePeer::DATABASE_NAME); try { $con->begin(); $this->load($fields['REP_TAB_UID']); $this->fromArray($fields, BasePeer::TYPE_FIELDNAME); $sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $oValidate = $oDataBase->getValidate($this->validate()); } else { $oValidate = $this->validate(); } // if($this->validate()) if ($oValidate) { $contentResult = 0; if (array_key_exists("REP_TAB_TITLE", $fields)) { $contentResult += $this->setRepTabTitle($fields["REP_TAB_TITLE"]); } $result = $this->save(); $result = $result == 0 ? $contentResult > 0 ? 1 : 0 : $result; $con->commit(); return $result; } else { $con->rollback(); $validationE = new Exception("Failed Validation in class " . get_class($this) . "."); $validationE->aValidationFailures = $this->getValidationFailures(); throw $validationE; } } catch (Exception $e) { $con->rollback(); throw $e; } }
/** * Stores a message in the log file, if the file size exceeds * specified log file is renamed and a new one is created. * * @param type $message * @param type $pathData * @param type $file */ public static function log($message, $pathData = PATH_DATA, $file = 'cron.log') { $config = System::getSystemConfiguration(); G::LoadSystem('logger'); $oLogger = Logger::getSingleton($pathData, PATH_SEP, $file); $oLogger->limitFile = $config['number_log_file']; $oLogger->limitSize = $config['size_log_file']; $oLogger->write($message); }
public function uploadLanguage($dyn_uid) { if (!isset($_FILES["LANGUAGE"])) { throw new Exception(G::LoadTranslation("ID_ERROR_UPLOADING_FILENAME")); } if (pathinfo($_FILES["LANGUAGE"]["name"], PATHINFO_EXTENSION) != "po") { throw new Exception(G::LoadTranslation("ID_FILE_UPLOAD_INCORRECT_EXTENSION")); } $translation = array(); G::LoadSystem('i18n_po'); $i18n = new i18n_PO($_FILES["LANGUAGE"]["tmp_name"]); $i18n->readInit(); while ($rowTranslation = $i18n->getTranslation()) { array_push($translation, $rowTranslation); } $name = $_FILES["LANGUAGE"]["name"]; $name = explode(".", $name); if (isset($name[1]) && isset($name[2]) && $name[1] . "." . $name[2] === "en.po") { return; } $content = $i18n->getHeaders(); $content["File-Name"] = $_FILES["LANGUAGE"]["name"]; $content["Labels"] = $translation; $con = Propel::getConnection(DynaformPeer::DATABASE_NAME); $con->begin(); $oPro = DynaformPeer::retrieveByPk($dyn_uid); $dyn_labels = new stdClass(); if ($oPro->getDynLabel() !== null && $oPro->getDynLabel() !== "") { $dyn_labels = G::json_decode($oPro->getDynLabel()); } $dyn_labels->$name[count($name) - 2] = $content; $oPro->setDynLabel(G::json_encode($dyn_labels)); $oPro->save(); $con->commit(); }
FROM TASK_USER AS TU LEFT JOIN USERS AS U ON ( TU.USR_UID = U.USR_UID ) WHERE TU.TAS_UID = '" . $_POST['TAS_UID'] . "' AND TU.TU_TYPE = 1 AND TU.TU_RELATION = 1 AND U.USR_STATUS = 1"); */ $sDataBase = 'database_' . strtolower(DB_ADAPTER); if (G::LoadSystemExist($sDataBase)) { G::LoadSystem($sDataBase); $oDataBase = new database(); $sConcat = $oDataBase->concatString("U.USR_LASTNAME", "' '", "U.USR_FIRSTNAME"); } $sSQL = " SELECT\n TU.USR_UID AS USR_UID, " . $sConcat . " AS USR_FULLNAME\n FROM\n TASK_USER AS TU\n LEFT JOIN\n USERS AS U\n ON (\n TU.USR_UID = U.USR_UID\n )\n WHERE\n TU.TAS_UID = '" . $_POST['TAS_UID'] . "' AND\n TU.TU_TYPE = 1 AND\n TU.TU_RELATION = 1 AND\n U.USR_STATUS = 1"; $oDataset = $oSession->Execute($sSQL); while ($aRow = $oDataset->Read()) { $sAux .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_FULLNAME'] . '</option>'; } $sAux .= '</select>'; echo $sAux; break; case 'EVALUATE': G::LoadClass('application'); $oApplication = new Application(new DBConnection()); $oApplication->load($_SESSION['APPLICATION']);
* License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * * @package workflow-engine-bin-tasks */ G::LoadSystem("g"); CLI::taskName('flush-cache'); CLI::taskDescription(<<<EOT Flush cache of all workspaces of a given workspace EOT ); CLI::taskArg('workspace', true, true); CLI::taskRun('run_flush_cache'); function run_flush_cache($args, $opts) { $rootDir = realpath(__DIR__."/../../../../"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir);
function startCase() { G::LoadClass('case'); G::LoadSystem('inputfilter'); $filter = new InputFilter(); $_POST = $filter->xssFilterHard($_POST); $_REQUEST = $filter->xssFilterHard($_REQUEST); $_SESSION = $filter->xssFilterHard($_SESSION); /* GET , POST & $_SESSION Vars */ /* unset any variable, because we are starting a new case */ if (isset($_SESSION['APPLICATION'])) { unset($_SESSION['APPLICATION']); } if (isset($_SESSION['PROCESS'])) { unset($_SESSION['PROCESS']); } if (isset($_SESSION['TASK'])) { unset($_SESSION['TASK']); } if (isset($_SESSION['INDEX'])) { unset($_SESSION['INDEX']); } if (isset($_SESSION['STEP_POSITION'])) { unset($_SESSION['STEP_POSITION']); } /* Process */ try { $oCase = new Cases(); lookinginforContentProcess($_POST['processId']); $aData = $oCase->startCase($_REQUEST['taskId'], $_SESSION['USER_LOGGED']); $aData = $filter->xssFilterHard($aData); $_SESSION['APPLICATION'] = $aData['APPLICATION']; $_SESSION['INDEX'] = $aData['INDEX']; $_SESSION['PROCESS'] = $aData['PROCESS']; $_SESSION['TASK'] = $_REQUEST['taskId']; $_SESSION['STEP_POSITION'] = 0; $_SESSION['CASES_REFRESH'] = true; /*----------------------------------********---------------------------------*/ $oCase = new Cases(); $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); $aNextStep['PAGE'] = 'open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft'; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; $aData['openCase'] = $aNextStep; $aData['status'] = 'success'; print G::json_encode($aData); } catch (Exception $e) { $aData['status'] = 'failure'; $aData['message'] = $e->getMessage(); print_r(G::json_encode($aData)); } }
public function getAllData($sUID, $start = null, $limit = null, $keyOrderUppercase = true, $filter = '', $appUid = false) { $addTab = new AdditionalTables(); $aData = $addTab->load($sUID, true); if (!isset($_SESSION['PROCESS'])) { $_SESSION["PROCESS"] = $aData['PRO_UID']; } $aData['DBS_UID'] = $aData['DBS_UID'] ? $aData['DBS_UID'] : 'workflow'; $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); if (file_exists($sPath . $sClassName . '.php')) { require_once $sPath . $sClassName . '.php'; } else { return null; } $sClassPeerName = $sClassName . 'Peer'; $con = Propel::getConnection($aData['DBS_UID']); $oCriteria = new Criteria($aData['DBS_UID']); //eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");'); /* * data type: * 'INTEGER' 'BIGINT' 'SMALLINT' 'TINYINT' 'DECIMAL' 'DOUBLE' 'FLOAT' 'REAL' * 'CHAR' 'VARCHAR' 'LONGVARCHAR' 'BOOLEAN' 'DATE' 'DATETIME' 'TIME' */ $types = array('DECIMAL', 'DOUBLE', 'FLOAT', 'REAL'); if ($keyOrderUppercase) { foreach ($aData['FIELDS'] as $aField) { $field = '$oCriteria->addSelectColumn(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ');'; if (in_array($aField['FLD_TYPE'], $types)) { $field = '$oCriteria->addAsColumn("' . $aField['FLD_NAME'] . '", "round(" . ' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ' . ", ' . ($aField['FLD_TYPE'] == 'DOUBLE' ? '8' : '2') . ')");'; } eval($field); /*if ($aField['FLD_KEY'] == '1') { eval('$oCriteria->addAscendingOrderByColumn('. $sClassPeerName . '::' . $aField['FLD_NAME'] . ');'); }*/ } } $oCriteriaCount = clone $oCriteria; //$count = $sClassPeerName::doCount($oCriteria); eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);'); if ($filter != '' && is_string($filter)) { $stringOr = ''; $closure = ''; $types = array('INTEGER', 'BIGINT', 'SMALLINT', 'TINYINT', 'DECIMAL', 'DOUBLE', 'FLOAT', 'REAL'); foreach ($aData['FIELDS'] as $aField) { if (($appUid == false && $aField['FLD_NAME'] != 'APP_UID') || ($appUid == true)) { if (in_array($aField['FLD_TYPE'], $types)) { if (is_numeric($filter)) { $stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "' . $filter . '", Criteria::EQUAL)' . $closure . ';'; $closure = '->addOr($a)'; } } else { $stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "%' . $filter . '%", Criteria::LIKE)' . $closure . ';'; $closure = '->addOr($a)'; } } } $stringOr = $stringOr . '$oCriteria->add($a);'; eval($stringOr); $oCriteriaCount = clone $oCriteria; eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);'); } G::LoadSystem('inputfilter'); $filter = new InputFilter(); $sClassPeerName = $filter->validateInput($sClassPeerName); if (isset($_POST['sort'])) { $_POST['sort'] = $filter->validateInput($_POST['sort']); $_POST['dir'] = $filter->validateInput($_POST['dir']); if ($_POST['dir'] == 'ASC') { if ($keyOrderUppercase) { eval('$oCriteria->addAscendingOrderByColumn("' . $_POST['sort'] . '");'); } else { eval('$oCriteria->addAscendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');'); } } else { if ($keyOrderUppercase) { eval('$oCriteria->addDescendingOrderByColumn("' . $_POST['sort'] . '");'); } else { eval('$oCriteria->addDescendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');'); } } } if (isset($limit)) { $oCriteria->setLimit($limit); } if (isset($start)) { $oCriteria->setOffset($start); } //$rs = $sClassPeerName::doSelectRS($oCriteria); eval('$rs = ' . $sClassPeerName . '::doSelectRS($oCriteria);'); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rows = Array(); while ($rs->next()) { $rows[] = $rs->getRow(); } return array('rows' => $rows, 'count' => $count); }