Beispiel #1
0
 /**
  * Processes raw data files and throws them in stream
  *
  *
  * @param   string      name of file
  * @param   string      file content, returned by ref
  * @return  boolean     function success
  */
 public function process($src, &$result)
 {
     if (!($result = file_get_contents(Nexista_Path::parseInlineFlow($src)))) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $flow = Nexista_Flow::Singleton('Nexista_Flow');
     $file_path = Nexista_Path::parseInlineFlow($this->params['xsl']);
     $xslfile = NX_PATH_APPS . $file_path;
     if (!is_file($xslfile)) {
         Nexista_Error::init('XSL Action - file unavailable: ' . $xslfile, NX_ERROR_FATAL);
     }
     $xsl = new DomDocument('1.0', 'UTF-8');
     $xsl->substituteEntities = false;
     $xsl->resolveExternals = false;
     $xslfilecontents .= file_get_contents($xslfile);
     $xsl->loadXML($xslfilecontents);
     $xsl->documentURI = $xslfile;
     $use_xslt_cache = "yes";
     if ($use_xslt_cache != "yes" || !class_exists('xsltCache')) {
         $xslHandler = new XsltProcessor();
     } else {
         $xslHandler = new xsltCache();
     }
     $xslHandler->importStyleSheet($xsl);
     $my_output = $xslHandler->transformToXML($flow->flowDocument);
     if ($my_output === false) {
         Nexista_Error::init('XSL Action - Error processing XSL file: ' . $xslfile, NX_ERROR_FATAL);
         return false;
     }
     $new_node = $this->params['new_node'];
     Nexista_Flow::add($new_node, $my_output);
     return true;
 }
Beispiel #3
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $recipient = Nexista_Path::parseInlineFlow($this->params['recipient']);
     $sender = Nexista_Path::parseInlineFlow($this->params['sender']);
     $subject = "Subject: " . Nexista_Path::parseInlineFlow($this->params['subject']) . "\n";
     $body = Nexista_Flow::getbypath($this->params['body']);
     $host = Nexista_Path::parseInlineFlow($this->params['host']);
     if (require 'Net/SMTP.php') {
         $smtp = new Net_SMTP($host);
         $e = $smtp->connect();
         $smtp->mailFrom($sender);
         $disclosed_recipients = "To: ";
         if (is_array($recipient)) {
             foreach ($recipient as $to) {
                 if (PEAR::isError($res = $smtp->rcptTo($to))) {
                     die("Unable to add recipients {$to}: " . $res->getMessage() . "\n");
                 }
                 $disclosed_recipients .= $to;
             }
         } else {
             if (PEAR::isError($res = $smtp->rcptTo($recipient))) {
                 die("Unable to add single recipient {$recipient} for {$host}: " . $res->getMessage() . "\n");
             }
             $disclosed_recipients .= $recipient;
         }
         $disclosed_recipients .= "\n";
         $headers = $disclosed_recipients . $subject;
         $smtp->data($headers . "\r\n" . $body);
         $smtp->disconnect();
     } else {
         // try using mail()
     }
 }
Beispiel #4
0
 /**
  * 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;
 }
Beispiel #5
0
 /**
  * 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;
 }
Beispiel #6
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $header = $this->params['header'];
     $value = Nexista_Path::parseInlineFlow($this->params['value']);
     // Can't use literal commas in the params section
     $value = str_replace(';', ',', $value);
     header($header . ': ' . $value);
 }
Beispiel #7
0
 /**
  * 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;
 }
Beispiel #8
0
 /**
  * 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;
 }
Beispiel #9
0
 /**
  * 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;
 }
Beispiel #10
0
 /**
  * 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;
 }
Beispiel #11
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $xpath = $this->params['var1'];
     $node = Nexista_Flow::find($xpath);
     $length = $this->params['var2'];
     $pad = Nexista_Path::parseInlineFlow($this->params['var3']);
     $type = $this->params['var4'];
     foreach ($node as $str) {
         $str->nodeValue = htmlspecialchars(str_pad($str->nodeValue, $length, $pad, STR_PAD_RIGHT), ENT_NOQUOTES, 'UTF-8', false);
     }
 }
Beispiel #12
0
 /**
  * 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;
 }
Beispiel #13
0
 /**
  * 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;
 }
Beispiel #14
0
 /**
  * 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;
 }
Beispiel #15
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $destination = $_SERVER['PHP_SELF'] . '?' . NX_ID . '=' . Nexista_Path::parseInlineFlow($this->params['url']);
     $appendSession = isset($this->params['session']) ? $this->params['session'] : null;
     if ($appendSession) {
         $destination .= '&' . SESSID;
     }
     session_write_close();
     header('Location: ' . $destination);
     exit;
 }
Beispiel #16
0
 /**
  * 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;
 }
Beispiel #17
0
 /**
  * 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;
 }
Beispiel #18
0
 /**
  * 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;
 }
Beispiel #19
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $destination = isset($this->params['url']) ? Nexista_Path::parseInlineFlow($this->params['url']) : null;
     $appendSession = isset($this->params['session']) ? $this->params['session'] : null;
     if (is_null($destination) and isset($_SERVER['HTTP_REFERER'])) {
         $destination = $_SERVER['HTTP_REFERER'];
     }
     if ($appendSession) {
         $destination .= '&' . SESSID;
     }
     session_write_close();
     header('Location: ' . $destination);
     exit;
 }
Beispiel #20
0
 /**
  * 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;
 }
Beispiel #21
0
 /**
  * Returns a string based on given protocol://path 
  *
  * @param string $path     path to resolve/render
  * @param string $protocol (optional) default protocol if none given
  *
  * @return string value of variable
  */
 public static function get($path, $protocol = 'string')
 {
     switch ($protocol) {
         case 'flow':
             $result = Nexista_Flow::getByPath($path);
             break;
         default:
             $result = Nexista_Path::parseInlineFlow($path);
     }
     if (!is_null($result)) {
         return $result;
     } else {
         return false;
     }
 }
Beispiel #22
0
 /**
  * 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;
 }
Beispiel #23
0
 /**
  * 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);
         }
     }
 }
Beispiel #24
0
 /**
  * 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;
 }
Beispiel #25
0
 /**
  * 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;
     }
 }
Beispiel #26
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     // if using a single node, use {}'s in sitemap
     // if referencing a nodeset, don't use {}'s
     $xpath1 = $this->params['var1'];
     $res1 = Nexista_Flow::find($xpath1);
     $xpath2 = $this->params['var2'];
     $res2 = Nexista_Flow::find($xpath2);
     $xpath3 = $this->params['var3'];
     $res3 = Nexista_Flow::find($xpath3);
     $i = 0;
     if ($res3->item(0)) {
         if ($res3->length === 1) {
             // there is a node, replace it, since its only one, res1 must
             // only be one as well
             $res3->item(0)->nodeValue = Nexista_Path::parseInlineFlow($this->params['var1']) . Nexista_Path::parseInlineFlow($this->params['var2']);
             return true;
         } elseif ($res3->length > 1) {
             // res3 is an array, so res3 is too
             foreach ($res1 as $str) {
                 if ($res2->length > 1 || $res2->length === 1) {
                     $res3->item($i)->nodeValue = $res1->item($i)->nodeValue . $res2->item($i)->nodeValue;
                 } else {
                     $res3->item($i)->nodeValue = $str->nodeValue . Nexista_Path::parseInlineFlow($this->params['var2']);
                 }
                 $i++;
             }
             return true;
         } else {
             // create a new node
             $new_node = $this->params['var3'];
             Nexista_Flow::add($new_node, $res1 . $res2);
             return true;
         }
     }
     return false;
 }
Beispiel #27
0
    $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);
}
Beispiel #28
0
 /**
  * Applies action
  *
  * @return  boolean     success
  */
 protected function main()
 {
     // For now, limit calls to the same domain and protocol.
     $mydomain = $_SERVER['SERVER_NAME'];
     if (isset($_SERVER['HTTPS'])) {
         $protocol = "https://";
     } else {
         $protocol = "http://";
     }
     $url = $this->params['url'];
     $the_params = $this->params['params'];
     $my_params = Nexista_Flow::getByPath($the_params, "ASSOC");
     $target_node = $this->params['target_node'];
     //print_r($my_params);
     if (is_array($my_params)) {
         foreach ($my_params as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $my_key => $my_value) {
                     //Only adds the query piece if its not already there.
                     //tried array_unique earlier but it didn't work with
                     //array of arrays.
                     $query_piece = "&" . urlencode($my_key) . "[]=" . urlencode($my_value);
                     if (strpos($query_string, $query_piece) === false) {
                         $query_string .= $query_piece;
                     }
                 }
             } else {
                 $query_string = "&" . urlencode($key) . "=" . urlencode($value);
             }
         }
     }
     //echo $query_string;
     $url .= $query_string;
     if (!strpos($url, "www.")) {
         $url = $protocol . $mydomain . $url;
     } else {
     }
     // Quick hack to allow overriding above logic with complete,
     // off-domain url
     if (strstr($this->params['url'], 'http://')) {
         $url = Nexista_Path::parseInlineFlow($this->params['url']);
     }
     if (strstr($_GET['myurl'], 'http://')) {
         $url = $_GET['myurl'];
     }
     if (function_exists(curl_init)) {
         session_write_close();
         $mysession = session_name() . '=' . session_id();
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
         curl_setopt($ch, CURLOPT_COOKIE, $mysession);
         curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
         curl_setopt($ch, CURLOPT_VERBOSE, 1);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_POST, 0);
         curl_setopt($ch, CURLOPT_TIMEOUT, 120);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         $xml = curl_exec($ch);
         if (curl_errno($ch)) {
             print curl_error($ch);
             exit;
         } else {
             curl_close($ch);
         }
     } else {
         $xml = "<{$target_node}>Curl PHP extension is not available.</{$target_node}>";
     }
     $config = array('indent' => true, 'output-xml' => true, 'wrap' => 0);
     // Tidy
     if (class_exists('tidy')) {
         $tidy = new tidy();
         $tidy->parseString($xml, $config, 'utf8');
         $tidy->cleanRepair();
         $xml = $tidy;
     }
     if (1 == 2) {
         // Should result be added to flow as XML?
         $doc = new DOMDocument('1.0', 'UTF-8');
         $doc->loadXML($xml);
         $flow = Nexista_Flow::singleton('Nexista_Flow');
         //import new doc into flow recursively
         $new = $flow->flowDocument->importNode($doc->documentElement, 1);
         //append back to node as parsed xml now
         $flow->root->appendChild($new);
     } else {
         Nexista_Flow::add($target_node, $xml);
     }
 }
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);
Beispiel #30
0
 /**
  * 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;
 }