/** * Applies action * * @return boolean success */ protected function main() { $mode = 0775; //see if a path is given. we default to Nexista temp dir if (!($dest = Nexista_Path::get($this->params['dest'], 'flow'))) { $dest = empty($this->params['dest']) ? NX_PATH_TMP : trim($this->params['dest'], '/') . '/'; } //websvn: stream wrapper if (strpos($dest, "websvn")) { require 'HTTP/WebDAV/Client.php'; } if (!empty($_FILES[$this->params['file']]['tmp_name'])) { $name = $_FILES[$this->params['file']]['name']; $prefix = Nexista_Path::get($this->params['prefix'], "flow"); if ($prefix != '') { $unique_id = $prefix; $name = $unique_id . "_" . $name; } if (!is_dir($dest)) { mkdir($dest, $mode, TRUE); } if (!move_uploaded_file($_FILES[$this->params['file']]['tmp_name'], $dest . $name)) { Nexista_Error::init('Upload action was unable to move uploaded file: ' . $name . '. Check ' . $dest . ' permissions', NX_ERROR_WARNING); return false; } //assign full destination path to flow as it can be useful $res = Nexista_Flow::find('//_files/file'); if ($res->length === 1) { Nexista_Flow::add('new_dir', $dest, $res->item(0)); Nexista_Flow::add('new_name', $dest . $name, $res->item(0)); } //chmod($dest.$name,0644); } return true; }
/** * Applies action * * @return boolean success */ protected function main() { $mytext = Nexista_Path::get($this->params['text']); $new_text = strip_tags($mytext); Nexista_Flow::add('no_html_text', $new_text); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { $this->result = strlen($data) <= (int) $this->params['length']; return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { $this->result = !strcasecmp($data, $this->params['value']); return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data) || $data === '0') { $this->result = true; return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { $this->result = preg_match('~^\\D+$~', $data); return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { $data = eregi_replace("(\\(|\\)|\\-|\\+|\\.)", "", $data); $this->result = preg_match('~^\\d{7,13}$~', $data); return true; } $this->setEmpty(); return true; }
/** * Applies filter * * @return boolean success * @access private */ function main() { // Right now this filter only converts from 12 to 24 hour time formats. $year = Nexista_Path::get($this->params['year'], 'flow'); $month = Nexista_Path::get($this->params['month'], 'flow'); $day = Nexista_Path::get($this->params['day'], 'flow'); $name = $this->params['name']; $mydate = "{$year}-{$month}-{$day} 01:01:01"; Nexista_Flow::add($name, $mydate); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { //$result = preg_match('~^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,4}$~', $data); $this->result = preg_match('~^.+@.+\\..{2,4}$~', $data); return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); //see if there is a declaration if (!strstr($data, '<?xml')) { //no. let's add one as well //we also add root tags anyways whether they are there or not since all we need is basic validation $data = '<?xml version="1.0"?><xml>' . $data . '</xml>'; } $this->result = simplexml_load_string($data); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { if (is_callable($this->params['function'])) { $res = call_user_func($this->params['function'], $data, &$this->result); return $res; } return false; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { include_once NX_PATH_LIB . 'gd/gdimage.php'; $gd = new GdImage(); $this->message = 'is an invalid image type. supported types are: .' . implode($gd->getSupportedTypes(), ', .'); $data = Nexista_Path::get($this->params['var'], 'flow'); if (!empty($data)) { $this->result = $gd->isSupported($data); return true; } $this->setEmpty(); return true; }
/** * Applies validator * * @return boolean success */ public function main() { $var = Nexista_Path::get($this->params['var'], 'flow'); if (empty($var)) { $this->setEmpty(); } $match = Nexista_Path::get($this->params['match'], 'flow'); if (!strcmp($match, $var)) { $this->result = true; return true; } $this->result = false; return true; }
/** * Applies action * * @return boolean success */ protected function main() { $text = Nexista_Path::get($this->params['haystack']); $tokens = Nexista_Flow::getbypath($this->params['token_array_xpath']); /* echo "<pre>"; print_r($tokens); echo "</pre>"; echo "<br/>"; */ foreach ($tokens as $token) { $text = str_replace($token['key'], Nexista_Flow::getbypath($token['value']), $text); } Nexista_Flow::add('new_text', $text); return true; }
/** * Applies filter * * @return boolean success * @access private */ function main() { $xpath = $this->params['source_datetime']; $node = Nexista_Flow::find($xpath); $sformat = Nexista_Path::get($this->params['source_format']); $tformat = Nexista_Path::get($this->params['target_format']); $tz = Nexista_Path::get($this->params['timezone_offset']); $tz = $tz * 3600; foreach ($node as $item) { if ($sformat == 'unix_epoch') { $item->nodeValue = gmdate($tformat, $item->nodeValue + $tz); } else { $unix_epoch_str = strtotime($item->nodeValue); $item->nodeValue = gmdate($tformat, $unix_epoch_str + $tz); } } }
/** * Applies filter * * @return boolean success * @access private */ function main() { // Right now this filter only converts from 12 to 24 hour time formats. $hours = Nexista_Path::get($this->params['hours'], "flow"); $minutes = Nexista_Path::get($this->params['minutes'], "flow"); $am_pm = Nexista_Path::get($this->params['am_pm'], "flow"); $when = $this->params['when']; if ($am_pm == "PM" && $hours != "12") { $hours = $hours + 12; } if ($am_pm == "AM" && $hours == "12") { $hours = "00"; } $iso = "{$hours}:{$minutes}:00"; $when = $when . "_iso_time"; Nexista_Flow::add($when, $iso); return true; }
/** * Applies action * * @return boolean success */ protected function main() { // openssl genrsa -out key.pem // openssl rsa -in key.pem -noout -modulus // str_replace('Modulus=','',$modulus); // put modulus in config.xml defaults $mpk = Nexista_Path::get($this->params['private_key']); $pk = file_get_contents($mpk); $my_private_key = openssl_pkey_get_private($pk); $cipher_text = Nexista_Flow::find($this->params['ciphered_text']); if ($cipher_text->length === 1) { $my_cipher_text = $cipher_text->item(0)->nodeValue; } $my_cipher_text_bin = pack("H*", $my_cipher_text); //$my_cipher_text_bin = base64_decode($my_cipher_text); if (openssl_private_decrypt($my_cipher_text_bin, &$my_clear_text, $my_private_key)) { // success $cipher_text->item(0)->nodeValue = $my_clear_text; } else { return false; } }
// create OpenID consumer // read response from OpenID provider $consumer = new Auth_OpenID_Consumer($store); $httphost = $_SERVER['HTTP_HOST']; $response = $consumer->complete($httphost . $link_prefix . 'x-openid-login-done'); // set session variable depending on authentication result if ($response->status == Auth_OpenID_SUCCESS) { $_SESSION['OPENID_AUTH'] = true; } else { $_SESSION['OPENID_AUTH'] = false; } $_SESSION['OPENID_AUTH'] = true; $username = Nexista_Path::get('//user_login/user_login/username', 'flow'); $user_id = Nexista_Path::get('//user_login/user_login/id', 'flow'); $group_id = Nexista_Path::get('//user_login/user_login/group_id', 'flow'); $user_last_visit = Nexista_Path::get('//user_login/user_login/last_visit', 'flow'); $last_visit = gmdate('Y-m-d H:i:s', $user_last_visit); // Remove duplicate roles if (is_array($roles)) { $tmparr = array_unique($roles); $i = 0; foreach ($tmparr as $v) { $newarr[$i] = $v; $i++; } } else { $newarr = $roles; } $newarr = array('phunky_user'); $auth =& new Nexista_Auth(); if (!$auth->registerUser($newarr)) {
$i->setName('entire_key'); $i->moveTo($key_x_position, $key_y_position); } unset($i); /* NOW BEGINS THE FIXTURE ICONS THAT ARE IN INVENTORY!!! */ $assets['x_pos'] = Nexista_Path::get('//equipment_get_all/x_position', 'flow'); if ($assets['x_pos'] != NULL) { $assets['y_pos'] = (array) Nexista_Path::get('//equipment_get_all/equipment_get_all/y_position', 'flow'); $assets['rotation_angle'] = (array) Nexista_Path::get('//equipment_get_all/rotation_angle', 'flow'); $assets['equipment_type_id'] = (array) Nexista_Path::get('//equipment_get_all/equipment_type_id', 'flow'); $assets['location_equipment_id'] = (array) Nexista_Path::get('//equipment_get_all/location_equipment_id', 'flow'); $assets['equipment_id'] = (array) Nexista_Path::get('//equipment_get_all/my_equipment_id', 'flow'); $assets['asset_id'] = (array) Nexista_Path::get('//equipment_get_all/asset_id', 'flow'); $assets['equipment_type_image_id'] = (array) Nexista_Path::get('//equipment_get_all/equipment_type_image_id', 'flow'); $assets['status_id'] = (array) Nexista_Path::get('//equipment_get_all/status_id', 'flow'); $assets['container'] = Nexista_Path::get('//equipment_get_all', 'flow'); // should container be an array - no, see below?? $num_icons = count($assets['y_pos']); } if ($number_of_symbols > 0) { if (is_array($assets['x_pos'])) { // Now loop through the actual asset lists at that location? $inventory_as = "Object.registerClass('container',positionFixture);"; for ($j = 0; $j < $num_icons; $j++) { $e_id = $assets['equipment_type_id'][$j]; $my_x = $assets['x_pos'][$j]; $my_y = $assets['y_pos'][$j]; $my_rotation_angle = $assets['rotation_angle'][$j]; $equipment_status = $assets['status_id'][$j]; $my_aid = $assets['asset_id'][$j]; $my_leid = $assets['location_equipment_id'][$j];
$i = 0; foreach ($tmparr as $v) { $newarr[$i] = $v; $i++; } } else { $newarr = $roles; } $newarr = array('phunky_user', 'phunky_admin'); $auth =& new Nexista_Auth(); if (!$auth->registerUser($newarr)) { trigger_error(Nexista_Error::getError() . ' in login.php', WARNING); } $auth->setSessionData('user_id', $user_id); $auth->setSessionData('group_id', $group_id); $auth->setSessionData('username', $username); $auth->setSessionData('last_visit', $last_visit); $auth->setSessionData('last_visit_timestamp', $user_last_visit); //go back where we were called from $redirect = Nexista_Path::get('//_post/redirect', 'flow'); if (isset($_SESSION['NX_AUTH']['requestedUrl']) && !$_SESSION['NX_AUTH']['requestedUrl'] == "") { $redirect = $_SESSION['NX_AUTH']['requestedUrl']; } else { $redirect = Nexista_Config::get('//build/default'); } if ($_GET['nid'] == 'x-login') { echo '<result>Success</result>'; exit; } else { header('Location: ' . $redirect); }
/** * Processes and parsers the xml definition file * and retrieves query info * */ private function parseDefinition() { // Here we use see whether to use the default table names or if // a entity set has been specified. $server_name = $_SERVER['SERVER_NAME']; $myPrefix = Nexista_Config::get('./datasource[@id="' . $server_name . '"]/prefix'); $mydtd = Nexista_Config::get('./datasource[@id="' . $server_name . '"]/dtd'); // this can customize the table prefix based on vhosts in config if (!empty($myPrefix)) { $xmlString = "<!DOCTYPE query [" . file_get_contents(dirname($this->definition) . "/" . $mydtd); $rment = '/(\\<\\!ENTITY prefix "[a-z0-9A-Z]*"\\>)/'; $xmlString = preg_replace($rment, '', $xmlString); $xmlString .= '<!ENTITY prefix "' . $myPrefix . '">]>'; $xmlString .= file_get_contents($this->definition); $rmme = '/(\\<\\!DOCTYPE query SYSTEM "' . $mydtd . '"\\>)/'; $xmlString = preg_replace($rmme, '', $xmlString); $xml = simplexml_load_string($xmlString, null, LIBXML_COMPACT | LIBXML_DTDLOAD); } else { $xml = simplexml_load_file($this->definition, null, LIBXML_COMPACT | LIBXML_DTDLOAD); } $this->queryName = (string) $xml['name']; if (!empty($xml['name'])) { $this->queryType = (string) $xml['type']; } $defaultval = (string) $xml['default']; $loopvar = (string) $xml['loop']; if (!empty($loopvar)) { if (is_numeric($loopvar)) { $this->queryLoop = $loopvar; } else { $array = Nexista_Path::get($loopvar, 'flow'); if (is_array($array)) { $this->queryLoop = sizeof($array); } elseif (empty($array) && $array !== '0' && empty($defaultval)) { // No values at all $this->queryLoop = 0; } elseif (empty($array) && $array !== '0' && $defaultval === 'true') { // Use default value $array = array($defaultval); } else { //single value. loop once and make into array $array = array($array); } } } //get array of query info (query itself, args, etc) if (!($this->query['sql'] = (string) $xml->sql)) { // no sql node, maybe an ldap search? if (!($this->query['searchbase'] = (string) $xml->searchbase)) { Nexista_Error::init('No query specified in ' . $this->definition, NX_ERROR_FATAL); } else { $this->query['filter'] = (string) $xml->filter; $this->query['options'] = (string) $xml->options; } } if (!($this->query['connection'] = (string) $xml->connection)) { Nexista_Error::init('No database connection specified!', NX_ERROR_FATAL); } //make a nice array from in and out values $key = 0; if (isset($xml->params->param)) { foreach ($xml->params->param as $val) { $name = (string) $val['name']; $this->query['params'][$key]['name'] = !empty($name) ? $name : false; $array = (string) $val['array']; $this->query['params'][$key]['array'] = !empty($array) ? $array : false; $array = (string) $val['node-name-array']; $this->query['params'][$key]['node-name-array'] = !empty($array) ? $array : false; $default = (string) $val['default']; $this->query['params'][$key]['default'] = (!empty($default) or $default === '0') ? $default : false; $type = (string) $val['type']; $this->query['params'][$key]['type'] = !empty($type) ? $type : false; $key++; } } return true; }
License: Gnu Affero Public License version 3 http://www.gnu.org/licenses This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the 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 or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --> */ include 'fork.php'; $filename = Nexista_Path::get('_files/file/name', 'flow'); /* FIXME */ $file = ''; $c_root = $b_path . '$filename'; $c_ppm = $c_root . '-000001.ppm'; $ext = '.png'; $bitmap_file = $file . $ext; $bitmap_filename = $filename . $ext; Nexista_Flow::add('bitmap_filename', $filename); /* This requires pdftoppm, from xpdf */ $my_commands = "pdftoppm {$file} -r 288 {$c_root} && \\\nconvert {$c_ppm} -resize 25% -quality 75% -interlace none {$bitmap_file} && \\\nrm {$c_ppm}"; fork($my_commands);