/**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $mytext = Nexista_Flow::getByPath($this->params['text']);
     $name = $this->params['name'];
     Nexista_Flow::add($name, $new_text);
     return true;
 }
Exemple #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;
 }
 /**
  * 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;
 }
Exemple #4
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;
 }
Exemple #5
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     include 'HTML/BBCodeParser.php';
     $mytext = Nexista_Flow::getByPath($this->params['text']);
     $name = $this->params['name'];
     $parser = new HTML_BBCodeParser();
     $parser->addFilters('Basic,Extended,Links,Images,Lists');
     $new_text = $parser->qParse($mytext);
     Nexista_Flow::add($name, $new_text);
     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;
 }
 /**
  * Call this function to activate the processor
  *
  * @param   string    xpath to XML node, does not currently support nodesets
  * @param   string    node name to create and assign a value to
  * @return  boolean   success
  */
 public function process($name, $value)
 {
     $res = Nexista_Flow::find($name);
     //if var exists, set the new value
     if ($res->length === 1) {
         $res->item(0)->nodeValue = $value;
     } elseif ($res->length === 0) {
         //create new var/value
         Nexista_Flow::add($name, $value);
     } else {
         return false;
     }
     return true;
 }
Exemple #8
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     include 'HTML/Safe.php';
     $mytext = Nexista_Flow::getByPath($this->params['text']);
     $name = $this->params['name'];
     $parser =& new HTML_Safe();
     $new_text = $parser->parse($mytext);
     if (empty($name)) {
         $node = Nexista_Flow::find($this->params['text']);
         $node->item(0)->nodeValue = $new_text;
     } else {
         Nexista_Flow::add($name, $new_text);
     }
     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;
 }
Exemple #10
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $name = $this->params['name'];
     $count = $this->params['randomness'];
     if (!($count > 0)) {
         $count = 8;
     }
     if ($ph = @popen('xxd -p -l ' . $count . ' /dev/urandom', 'r')) {
         $rnd = fread($ph, $count);
         pclose($ph);
     }
     if (strlen($rnd) < $count) {
         $rnd = $rnd . mt_rand(100000, 2000000);
         $rnd = substr($rnd, 0, $count);
     }
     Nexista_Flow::add($name, $rnd);
     return true;
 }
 /**
  * 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;
 }
Exemple #12
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     // http://www.php.net/manual/en/function.crypt.php
     $pwd = Nexista_Flow::find($this->params['pwd']);
     $hash_type = $this->params['hash_type'];
     $count = 8;
     if ($pwd->length === 1) {
         $mypwd = $pwd->item(0)->nodeValue;
     }
     // If a cryptmd5 is selected, a hash is either provided or is generated.
     // The code used here to generate
     if ($hash_type == 'cryptmd5' || !empty($this->params['salt'])) {
         // Got salt?
         if ($this->params['salt'] == '') {
             $mysalt = '';
             if ($ph = @popen('xxd -p -l ' . $count . ' /dev/urandom', 'r')) {
                 $mysalt = fread($ph, $count);
                 pclose($ph);
             }
             if (strlen($mysalt) < $count) {
                 $mysalt = $mysalt . mt_rand(100000, 2000000);
                 $mysalt = substr($mysalt, 0, $count);
             }
             $mysalt = '$1$' . $mysalt . '$';
         } else {
             $salt = Nexista_Flow::find($this->params['salt']);
             $mysalt = $salt->item(0)->nodeValue;
         }
         $hash = crypt($mypwd, $mysalt);
         // Non-salted hash
         // http://www.php.net/manual/en/function.hash.php
     } elseif (in_array($hash_type, hash_algos())) {
         $hash = hash($hash_type, $mypwd);
     } else {
         return false;
     }
     Nexista_Flow::add('hash', $hash);
     return true;
 }
Exemple #13
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;
 }
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);
Exemple #15
0
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
--> */
if ($_GET['nid'] == 'logout') {
    $auth =& new Nexista_Auth();
    $auth->removeUser();
    $auth->removeUser();
    unset($_SESSION['NX_AUTH']);
    Nexista_Flow::delete('logged_in');
    Nexista_Flow::add('logged_in', 'false');
    session_start();
    // Unset all of the session variables.
    $_SESSION = array();
    // If it's desired to kill the session, also delete the session cookie.
    // Note: This will destroy the session, and not just the session data!
    if (isset($_COOKIE[session_name()])) {
        setcookie(session_name(), '', time() - 42000, '/');
    }
    // Finally, destroy the session.
    session_destroy();
}
Exemple #16
0
 /**
  * Accepts an xml file list of items and validates them according
  * to passed criteria.
  *
  * This function will check a number of fields based on criterias
  * passed along with each, such as required, validation type, etc..
  * It will return false if any fails and detailed results including
  * custom error messages are placed in a ValidationHandlerData object,
  * parts of which will be rendered into xmlStream for access from xsl
  *
  *
  * @param   string      the name of the xml data file
  * @param   boolean     (referece) result
  * @return  boolean     success
  */
 public function process($src, &$result)
 {
     //create a validator data object to hold procedure result
     require_once NX_PATH_HANDLERS . 'validatorhandlerdata.php';
     $validatorData = new Nexista_ValidatorHandlerData();
     //load validator file
     $xml = simplexml_load_file($src);
     //get the validator name as specified in xml file. this is used to name array in flow
     $validator_name = (string) $xml['name'];
     if (empty($validator_name)) {
         $validator_name = 'validator';
     }
     //load base validator class
     require_once NX_PATH_CORE . "validator.php";
     foreach ($xml->children() as $param) {
         //get the name of variable to set with good/bad result
         $result_name = (string) $param['name'];
         //process validators for this item
         foreach ($param->children() as $val) {
             $result = true;
             //get type of validator
             $type = (string) $val['type'];
             $required = (string) $val['required'];
             if (empty($required)) {
                 $required = 'false';
             }
             //and its parameters
             $args = preg_split('~(\\040)*,(\\040)*~', (string) $val['params']);
             //load the validator module file based on $type
             require_once NX_PATH_VALIDATORS . trim(strtolower($type)) . ".validator.php";
             //build the class name to load
             $class = 'Nexista_' . trim(ucfirst($type)) . "Validator";
             $validator =& new $class();
             if (!$validator->process($args, $required, $result)) {
                 return false;
             }
             //get any message from the validator
             if ($validator->isEmpty() && $validator->isRequired()) {
                 $text = $validator->getMessage();
             } else {
                 $text = (string) $val['text'];
                 //if no custom message we use default
                 if (empty($text)) {
                     $text = $validator->getMessage();
                 }
             }
             if (!$result) {
                 $validatorData->itemFail($result_name, trim(strtolower($type)), $text);
             }
             unset($validator);
         }
         $result_text = (string) $param['text'];
         if (!empty($result_text) && isset($validatorData->validatorData[$result_name])) {
             $validatorData->itemMessage($result_name, $result_text);
         }
     }
     if ((string) $xml['debug'] === 'true') {
         Nexista_Debug::dump($validatorData->validatorData, $validator_name . ' (validation data) ');
     }
     $result = $validatorData->getResult();
     //1 = valid data
     if (!$result) {
         //assign validator data to Flow
         Nexista_Flow::add($validator_name, $validatorData->validatorData);
     }
     //clean up
     unset($validatorData);
     return true;
 }
Exemple #17
0
google_ad_format = "234x60_as";
google_ad_type = "text";
//2007-10-29: Technology
google_ad_channel = "6222844825";
google_ad_channel = "6222844825";
google_color_border = "0066CC";
google_color_bg = "FFFFFF";
google_color_link = "0066CC";
google_color_text = "000000";
google_color_url = "1B703A";
google_ui_features = "rc:0";
//-->
</script>

<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

EOS;
/*
// This won't work until adsense works with xhtml
$f = new DOMDocument('1.0', 'UTF-8');
$f->loadXML('<pre_body_content><priority>10</priority><nodes>'.$admin_panel.'</nodes></pre_body_content>');
$n = $f->getElementsByTagName('pre_body_content')->item(0);
$g = $flow->flowDocument->importNode($n, true);
$flow->root->appendChild($g);
*/
$footer[] = array('string' => $google_adsense_code, 'priority' => $priority);
Nexista_Flow::add('footer', $footer, false);
Exemple #18
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);
     }
 }
Exemple #19
0
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
--> */
$path = $_SERVER['SCRIPT_NAME'];
if ($_GET['nxrw_path']) {
    $path = $_GET['nxrw_path'];
}
$path_prefix = dirname($path) . '/';
$link_prefix = $path . '?nid=';
$utcdate = gmdate('Y-m-d H:i:s');
// Prefix is needed for Mozilla as its the 0 position.
$ua = '_' . $_SERVER['HTTP_USER_AGENT'];
if (strpos($ua, 'Google') || strpos($ua, 'Yahoo') || strpos($ua, 'bot')) {
    $user_agent = 'bot';
} elseif (strpos($ua, 'Mozilla') || strpos($ua, 'Opera')) {
    $user_agent = 'gui_browser';
} elseif (strpos($ua, 'Elinks') || strpos($ua, 'w3m') || strpos($ua, 'Lynx')) {
    $user_agent = 'text_browser';
} else {
    $user_agent = 'bot';
}
if (isset($_GET['domain_id'])) {
    $_SESSION['domain_id'] = $_GET['domain_id'];
} elseif (!$_SESSION['domain_id']) {
    $_SESSION['domain_id'] = '%';
}
$domain_id = $_SESSION['domain_id'];
$runtime = array('path_prefix' => $path_prefix, 'link_prefix' => $link_prefix, 'user_agent' => $user_agent, 'domain_id' => $domain_id, 'utcdate' => $utcdate);
Nexista_Flow::add('runtime', $runtime, false);
Exemple #20
0
/* <!--
Program: PhunkyBB
Component: config_check.php
Copyright: Savonix Corporation
Author: Albert L. Lash, IV
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
--> */
$config_cache = NX_PATH_COMPILE . $_SERVER['HTTP_HOST'] . '_config_cache.php';
if (is_file($config_cache) && !NX_CONFIG_CACHE) {
    Nexista_Flow::add('config_cache', 'true');
    include $config_cache;
    Nexista_Flow::add('site_config', $config);
    define('NX_CONFIG_CACHE', 1);
}
Exemple #21
0
 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     Nexista_Flow::add("_SERVER", $_SERVER, false);
 }