merging some changes from the upstream master branch

This commit is contained in:
Gustavo Cruz
2012-11-30 11:27:38 -04:00
35 changed files with 497 additions and 1312 deletions

View File

@@ -2629,6 +2629,19 @@ function contractExpandSubtitle(subTitleName){
else contractSubtitle(subTitleName);
}
function concat_collection(obj1, obj2) {
var i;
var arr = new Array();
var len1 = obj1.length;
var len2 = obj2.length;
for (i=0; i<len1; i++) {
arr.push(obj1[i]);
}
for (i=0; i<len2; i++) {
arr.push(obj2[i]);
}
return arr;
}
var getControlsInTheRow = function(oRow) {
var aAux1 = [];
if (oRow.cells) {
@@ -2637,16 +2650,22 @@ var getControlsInTheRow = function(oRow) {
var sFieldName;
for (i = 0; i < oRow.cells.length; i++) {
var aAux2 = oRow.cells[i].getElementsByTagName('input');
aAux2 = concat_collection(aAux2, oRow.cells[i].getElementsByTagName('a'));
aAux2 = concat_collection(aAux2, oRow.cells[i].getElementsByTagName('select'));
aAux2 = concat_collection(aAux2, oRow.cells[i].getElementsByTagName('textarea'));
if (aAux2) {
for (j = 0; j < aAux2.length; j++) {
sFieldName = aAux2[j].id.replace('form[', '');
//sFieldName = sFieldName.replace(']', '');
sFieldName = sFieldName.replace(/]$/, '');
if (sFieldName != '') {
aAux1.push(sFieldName);
}
}
}
}
}
return aAux1;
};

View File

@@ -1166,7 +1166,10 @@ function expandSubtitle(subTitle){subTitle=getRow(subTitle);var c=subTitle.cells
t.rows[i].style.display='';var aAux=getControlsInTheRow(t.rows[i]);for(var j=0;j<aAux.length;j++){enableRequiredById(aAux[j]);}}}
function contractExpandSubtitle(subTitleName){subTitle=getRow(subTitleName);var c=subTitle.cells[0].className;var a=subTitle.rowIndex;var t=subTitle.parentNode;var contracted=false;for(var i=a+1,m=t.rows.length;i<m;i++){if(t.rows[i].cells.length==1)break;if(t.rows[i].style.display==='none'){contracted=true;}}
if(contracted)expandSubtitle(subTitleName);else contractSubtitle(subTitleName);}
var getControlsInTheRow=function(oRow){var aAux1=[];if(oRow.cells){var i;var j;var sFieldName;for(i=0;i<oRow.cells.length;i++){var aAux2=oRow.cells[i].getElementsByTagName('input');if(aAux2){for(j=0;j<aAux2.length;j++){sFieldName=aAux2[j].id.replace('form[','');sFieldName=sFieldName.replace(/]$/,'');aAux1.push(sFieldName);}}}}
function concat_collection(obj1,obj2){var i;var arr=new Array();var len1=obj1.length;var len2=obj2.length;for(i=0;i<len1;i++){arr.push(obj1[i]);}
for(i=0;i<len2;i++){arr.push(obj2[i]);}
return arr;}
var getControlsInTheRow=function(oRow){var aAux1=[];if(oRow.cells){var i;var j;var sFieldName;for(i=0;i<oRow.cells.length;i++){var aAux2=oRow.cells[i].getElementsByTagName('input');aAux2=concat_collection(aAux2,oRow.cells[i].getElementsByTagName('a'));aAux2=concat_collection(aAux2,oRow.cells[i].getElementsByTagName('select'));aAux2=concat_collection(aAux2,oRow.cells[i].getElementsByTagName('textarea'));if(aAux2){for(j=0;j<aAux2.length;j++){sFieldName=aAux2[j].id.replace('form[','');console.info(sFieldName);sFieldName=sFieldName.replace(/]$/,'');if(sFieldName!=''){aAux1.push(sFieldName);}}}}}
return aAux1;};var notValidateThisFields=[];function getElementsByClassNameCrossBrowser(searchClass,node,tag){var classElements=new Array();if(node==null)
node=document;if(tag==null)
tag='*';var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)");for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++;}}

View File

@@ -1,806 +0,0 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
* completely language independent but uses conventions that are familiar
* to programmers of the C-family of languages, including C, C++, C#, Java,
* JavaScript, Perl, TCL, and many others. These properties make JSON an
* ideal data-interchange language.
*
* This package provides a simple encoder and decoder for JSON notation. It
* is intended for use with client-side Javascript applications that make
* use of HTTPRequest to perform server communication functions - data can
* be encoded into JSON notation for use in a client-side javascript, or
* decoded from incoming Javascript requests. JSON format is native to
* Javascript, and can be directly eval()'ed with no further parsing
* overhead
*
* All strings should be in ASCII or UTF-8 format!
*
* LICENSE: Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met: Redistributions of source code must retain the
* above copyright notice, this list of conditions and the following
* disclaimer. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_SLICE', 1);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_STR', 2);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_ARR', 3);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_OBJ', 4);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_CMT', 5);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_LOOSE_TYPE', 16);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
/**
* Converts to and from JSON format.
*
* Brief example of use:
*
* <code>
* // create a new instance of Services_JSON
* $json = new Services_JSON();
*
* // convert a complexe value to JSON notation, and send it to the browser
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
* $output = $json->encode($value);
*
* print($output);
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
*
* // accept incoming POST data, assumed to be in JSON notation
* $input = file_get_contents('php://input', 1000000);
* $value = $json->decode($input);
* </code>
*/
class Services_JSON
{
/**
* constructs a new JSON instance
*
* @param int $use object behavior flags; combine with boolean-OR
*
* possible values:
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
* "{...}" syntax creates associative arrays
* instead of objects in decode().
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
* Values which can't be encoded (e.g. resources)
* appear as NULL instead of throwing errors.
* By default, a deeply-nested resource will
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
function Services_JSON($use = 0)
{
$this->use = $use;
}
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf16 UTF-16 character
* @return string UTF-8 character
* @access private
*/
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* convert a string from one UTF-8 char to one UTF-16 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf8 UTF-8 character
* @return string UTF-16 character
* @access private
*/
function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
switch(strlen($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
case 'NULL':
return 'null';
case 'integer':
return (int) $var;
case 'double':
case 'float':
return (float) $var;
case 'string':
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
$ascii = '';
$strlen_var = strlen($var);
/*
* Iterate over every character in the string,
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var{$c});
switch (true) {
case $ord_var_c == 0x08:
$ascii .= '\b';
break;
case $ord_var_c == 0x09:
$ascii .= '\t';
break;
case $ord_var_c == 0x0A:
$ascii .= '\n';
break;
case $ord_var_c == 0x0C:
$ascii .= '\f';
break;
case $ord_var_c == 0x0D:
$ascii .= '\r';
break;
case $ord_var_c == 0x22:
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF0) == 0xE0):
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF8) == 0xF0):
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFE) == 0xFC):
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
return '"'.$ascii.'"';
case 'array':
/*
* As per JSON spec if any array key is not an integer
* we must treat the the whole array as an object. We
* also try to catch a sparsely populated associative
* array with numeric keys here because some JS engines
* will create an array with empty indexes up to
* max_index which can cause memory issues and because
* the keys, which may be relevant, will be remapped
* otherwise.
*
* As per the ECMA and JSON specification an object may
* have any string as a property. Unfortunately due to
* a hole in the ECMA specification if the key is a
* ECMA reserved word or starts with a digit the
* parameter is only accessible using ECMAScript's
* bracket notation.
*/
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
}
// treat it like a regular array
$elements = array_map(array($this, 'encode'), $var);
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
return $element;
}
}
return '[' . join(',', $elements) . ']';
case 'object':
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
}
}
/**
* array-walking function for use in generating JSON-formatted name-value pairs
*
* @param string $name name of key to use
* @param mixed $value reference to an array element to be encoded
*
* @return string JSON-formatted name-value pair, like '"name":value'
* @access private
*/
function name_value($name, $value)
{
$encoded_value = $this->encode($value);
if(Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
return $this->encode(strval($name)) . ':' . $encoded_value;
}
/**
* reduce a string by removing leading and trailing comments and whitespace
*
* @param $str string string value to strip of comments and whitespace
*
* @return string string value stripped of comments and whitespace
* @access private
*/
function reduce_string($str)
{
$str = preg_replace(array(
// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'
), '', $str);
// eliminate extraneous space
return trim($str);
}
/**
* decodes a JSON string into appropriate variable
*
* @param string $str JSON-formatted string
*
* @return mixed number, boolean, string, array, or object
* corresponding to given JSON input string.
* See argument 1 to Services_JSON() above for object-output behavior.
* Note that decode() always returns strings
* in ASCII or UTF-8 format!
* @access public
*/
function decode($str)
{
$str = $this->reduce_string($str);
switch (strtolower($str)) {
case 'true':
return true;
case 'false':
return false;
case 'null':
return null;
default:
$m = array();
if (is_numeric($str)) {
// Lookie-loo, it's a number
// This would work on its own, but I'm trying to be
// good about returning integers where appropriate:
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// STRINGS RETURNED IN UTF-8 FORMAT
$delim = substr($str, 0, 1);
$chrs = substr($str, 1, -1);
$utf8 = '';
$strlen_chrs = strlen($chrs);
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
switch (true) {
case $substr_chrs_c_2 == '\b':
$utf8 .= chr(0x08);
++$c;
break;
case $substr_chrs_c_2 == '\t':
$utf8 .= chr(0x09);
++$c;
break;
case $substr_chrs_c_2 == '\n':
$utf8 .= chr(0x0A);
++$c;
break;
case $substr_chrs_c_2 == '\f':
$utf8 .= chr(0x0C);
++$c;
break;
case $substr_chrs_c_2 == '\r':
$utf8 .= chr(0x0D);
++$c;
break;
case $substr_chrs_c_2 == '\\"':
case $substr_chrs_c_2 == '\\\'':
case $substr_chrs_c_2 == '\\\\':
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
}
break;
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
// single, escaped unicode character
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
. chr(hexdec(substr($chrs, ($c + 4), 2)));
$utf8 .= $this->utf162utf8($utf16);
$c += 5;
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
// characters U-00000080 - U-000007FF, mask 110XXXXX
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 2);
++$c;
break;
case ($ord_chrs_c & 0xF0) == 0xE0:
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 3);
$c += 2;
break;
case ($ord_chrs_c & 0xF8) == 0xF0:
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 4);
$c += 3;
break;
case ($ord_chrs_c & 0xFC) == 0xF8:
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 5);
$c += 4;
break;
case ($ord_chrs_c & 0xFE) == 0xFC:
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= substr($chrs, $c, 6);
$c += 5;
break;
}
}
return $utf8;
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
if ($str{0} == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = array();
} else {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = new stdClass();
}
}
array_push($stk, array('what' => SERVICES_JSON_SLICE,
'where' => 0,
'delim' => false));
$chrs = substr($str, 1, -1);
$chrs = $this->reduce_string($chrs);
if ($chrs == '') {
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} else {
return $obj;
}
}
//print("\nparsing {$chrs}\n");
$strlen_chrs = strlen($chrs);
for ($c = 0; $c <= $strlen_chrs; ++$c) {
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
if (reset($stk) == SERVICES_JSON_IN_ARR) {
// we are in an array, so just push an element onto the stack
array_push($arr, $this->decode($slice));
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
// we are in an object, so figure
// out the property name and set an
// element in an associative array,
// for now
$parts = array();
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// "name":value pair
$key = $this->decode($parts[1]);
$val = $this->decode($parts[2]);
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
// name:value pair, where name is unquoted
$key = $parts[1];
$val = $this->decode($parts[2]);
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
}
}
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
//print("Found start of string at {$c}\n");
} elseif (($chrs{$c} == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
// we know that it's not escaped becase there is _not_ an
// odd number of backslashes at the end of the string so far
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($substr_chrs_c_2 == '/*') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a comment start, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
$c++;
//print("Found start of comment at {$c}\n");
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
// found a comment end, and we're in one now
array_pop($stk);
$c++;
for ($i = $top['where']; $i <= $c; ++$i)
$chrs = substr_replace($chrs, ' ', $i, 1);
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
}
}
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
return $obj;
}
}
}
}
/**
* @todo Ultimately, this should just call PEAR::isError()
*/
function isError($data, $code = null)
{
if (class_exists('pear')) {
return PEAR::isError($data, $code);
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))) {
return true;
}
return false;
}
}
if (class_exists('PEAR_Error')) {
class Services_JSON_Error extends PEAR_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
}
}
} else {
/**
* @todo Ultimately, this class shall be descended from PEAR_Error
*/
class Services_JSON_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
}
}
}
?>

View File

@@ -1,23 +0,0 @@
<?php
define('MABORAK_PATH',defined('PATH_GULLIVER_HOME')?PATH_GULLIVER_HOME.'js/maborak/':'../../');
//define('MABORAK_PATH','../'); #path normal
$modules = Array('rpc','validator','drop','drag','dom','abbr','fx','panel','app','rss','dashboard','xmlform','dynaform');
$l = ($_GET && $_GET['load'])?$_GET['load']:'';
$j = explode(',',$l);
$js= '';
header('Content-type: text/javascript');
for($i =0;$i<count($j);$i++)
{
if(in_array($j[$i],$modules))
{
$a = MABORAK_PATH.'core/module.'.$j[$i].'.js';
$r = fopen($a, "r");
$c = fread($r, filesize($a));
// $c = preg_replace("/(\/\*[\w\W]*?\*\/|\/\/[\w\W]*?\n|\t|\r|\n| {4})/","",$c);
$c = preg_replace("/(\/\*[\w\W]*?\*\/|\/\/[\w\W]*?\n|\t)/","",$c);
fclose($r);
$js.=$c;
}
}
echo $js;
?>

View File

@@ -1,94 +0,0 @@
<?php
$pget = ($_POST)?$_POST:$_GET;
$action = $pget['action'];
if($action=="proxy")
{
header('Content-Type: text/xml;');
$url = $pget['url'];
if($url)
{
$content = @file_get_contents($url);
echo ($content)?$content:"<error>Error loading RSS</error>";
}
}
else if($action=="add")
{
include_once('class.json.php');
$jsonFile = "../data/maborak.module.rss.feeds.json";
$json = new Services_JSON();
$data = $json->decode(stripslashes($pget['data']));
$gestor = @fopen($jsonFile, "r");
$contenido = ($gestor)?fread($gestor, filesize($jsonFile)):"[]";
$dataParent = $json->decode($contenido);
$dataParent = is_array($dataParent)?$dataParent:Array();
$data->hash = md5($data->url);
array_push($dataParent,$data);
$gestor = @fopen($jsonFile, 'w+');
$writed = @fwrite($gestor, $json->encode($dataParent));
$data->ok = (!$gestor || !$writed)?"read:".$gestor."\nwrite:".$writed:"ok";
echo $json->encode($data);
}
else if($action=="sendmail")
{
$gpc = (get_magic_quotes_gpc() && $_SERVER['REQUEST_METHOD']=="POST")?true:false;
//print_r($_SERVER);
//print_r($_GET);
//print_r($_POST);
$server_css= 'http://js.maborak.com/';
$to = $pget['to']?$pget['to']:'maborak@maborak.com';
$subject = $pget['subject']?(($gpc)?stripslashes($pget['subject']):$pget['subject']):"";
$feed = $pget['feed']?$pget['feed']:"";
$content = $pget['content']?(($gpc)?stripslashes($pget['content']):$pget['content']):"";
$link = $pget['link']?$pget['link']:"#";
$asunto = $subject;
$style = Array(
'table' =>'font:normal 8pt sans-serif;border-collapse:collapse;width:100%;',
'td' =>'border:1px solid #AAA;',
'ima' =>$server_css.'maborak/core/images/grid.title.gray.gif',
'im' =>'background-image:url('.$server_css.'maborak/core/images/grid.title.gray.gif);background-repeat:repeat-x;background-position:0 0;padding:2px;',
'tdh' =>'background-position:0 -10;text-align:right;padding-right:15px;',
'tdtitle' =>'font-weight:bold;padding-left:15px;background-color:#E7E7E7;',
'tdcontent' =>'padding:15px;background-color:#FAFAFA;',
'link' =>'color:#A62C2C;text-decoration:none;font-weight:bold;'
);
$header = htmlspecialchars(stripslashes($feed));
$title = htmlspecialchars($asunto);
$mensaje = "
<table style='".$style['table']."'>
<tr>
<td background='".$style['ima']."' style='".$style['td'].$style['im'].$style['tdh']."' colspan='2'>".$header."</td>
</tr>
<tr>
<td style='".$style['td'].$style['im'].$style['tdtitle']."' colspan='2'>".$title."</td>
</tr>
<tr>
<td style='".$style['td'].$style['tdcontent']."' colspan='2'>".$content."</td>
</tr>
<tr>
<td style='".$style['td'].$style['im'].$style['tdh']."'width:30%;>Link:</td>
<td style='".$style['td'].$style['im'].$style['tdh']."width:70%;text-align:left'><a style='".$style['link']."' href='".$link."'>".$link."</a></td>
</tr>
<tr>
<td style='".$style['td'].$style['im'].$style['tdh']."'width:30%;>Rss reader:</td>
<td style='".$style['td'].$style['im'].$style['tdh']."width:70%;text-align:left'><a href='http://rss.maborak.com'>http://rss.maborak.com</a></td>
</tr>
</table>
";
$content_type = 'Content-type: text/html; charset=utf-8';
$cabeceras = 'From: Maborak reader <maborak@maborak.com>' . "\r\n" .
'Reply-To: maborak@maborak.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion(). "\r\n".
'MIME-Version: 1.0' . "\r\n".
$content_type."\r\n";
$toArr = explode(",",$to);
for($i=0;$i<count($toArr);$i++)
{
if(strlen($toArr[$i])>8)
{
mail($toArr[$i], $asunto,$mensaje, $cabeceras);
}
}
echo "Mail enviado";
}
?>

View File

@@ -1,26 +0,0 @@
<?php
if ($_SERVER['REQUEST_METHOD']=="POST") {
include_once('class.json.php');
$valid_services=array("rate","comment");
$json = new Services_JSON();
$data =!empty($_POST['data'])?((get_magic_quotes_gpc()==1)?stripslashes($_POST['data']):$_POST['data']):array();
$d = $json->decode($data);
$service=isset($d->service)?$d->service:"none";
if (file_exists("services/service.{$service}.php")) {
require_once("services/service.{$service}.php");
$c = "Service_".ucfirst($service);
$s = new $c($d);
$s->db = mysql_connect("192.168.0.59","wilmer","sample");
mysql_select_db("services",$s->db);
echo $json->encode($s->{$d->action}());
}
else
{
die('Invalid service');
}
}
else
{
die("Invalid service");
}
?>

View File

@@ -1,56 +0,0 @@
<?php
header("content-Type:text/javascript");
//$data = isset($_GET)?$_GET:$_POST;
$data = isset($_GET)?$_GET:Array();
if(isset($data['tmp']) && isset($data['url']))
{
echo "try{\n";
echo"/*\n";
include_once('class.json.php');
$json = new Services_JSON();
$options= Array(
'method'=>(isset($data['method']) && in_array($data['method'],Array("GET","POST"))?$data['method']:"GET"),
'args' =>isset($data['args'])?$data['args']:" ",
'url' =>isset($data['url'])?$data['url']:""
);
$content=" ";
if($options['url'])
{
if($options['method']==="POST")
{
// echo"por POST:\n";
// print_r($_GET);
$toOpen = $options['args'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$options['args']);
curl_setopt($ch, CURLOPT_URL,$options['url']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$content = @curl_exec ($ch);
curl_close ($ch);
}
else
{
// echo"por GET:\n";
// print_r($_GET);
// echo"\nprint SERVER:------\n";
// print_r($_SERVER);
// echo"\n-----------------------\n";
$toOpen = $options['url']."?".($options['args']);
// echo "\n".$toOpen."\n";
$content= @file_get_contents($toOpen);
}
}
echo "\n*/";
echo 'window["'.addslashes($data['tmp']).'"]={data:"'.addslashes($json->encode($content)).'",loaded:true};';
//echo 'window["'.addslashes($data['tmp']).'"]={data:"'.addslashes($json->encode("")).'",loaded:true};';
echo"}catch(e){}";
}
else
{
}
?>

View File

@@ -1,35 +0,0 @@
<?php
class Service_Comments
{
private $options;
public $db;
function __construct($options = null)
{
$this->options = $options;
}
public function get()
{
$q="SELECT * FROM comments ORDER BY UID DESC LIMIT 100";
$a=mysql_query($q,$this->db) or die(mysql_error());
$r=array();
while ($e=mysql_fetch_array($a)) {
$r[]=array(
'name'=>htmlentities($e['NOMBRE']),
'comment'=>htmlentities($e['COMENTARIO'])
);
}
return $r;
}
public function post()
{
// The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0.
// $q="INSERT INTO comments (`UID`, `NOMBRE`, `COMENTARIO`) VALUES (NULL, '".mysql_escape_string($this->options->data->name)."', '".mysql_escape_string($this->options->data->comment)."')";
$q = "INSERT INTO comments (`UID`, `NOMBRE`, `COMENTARIO`) VALUES (NULL, '" . mysql_real_escape_string($this->options->data->name) . "', '". mysql_real_escape_string($this->options->data->comment). "')";
$w = mysql_query($q,$this->db) or die(mysql_error());
}
function __call($n,$a)
{
return isset($this->n)?$this->$n($a):"Invalid action";
}
}
?>

View File

@@ -1,62 +0,0 @@
<?php
class Service_Rate
{
private $options;
public $db;
function __construct($options = null)
{
$this->options = $options;
}
public function get()
{
if (!$this->exists()) {
$this->create();
}
$q="SELECT * FROM rate WHERE SERVICE='".$this->options->data->id."' LIMIT 1";
$a=mysql_query($q,$this->db) or die(mysql_error());
$r=mysql_fetch_array($a);
$r['e']=$this->valid();
return $r;
//return "pidiendo ID:".$this->options->id;
}
public function valid()
{
return $_SERVER['REMOTE_ADDR'];
}
public function exists()
{
$q="SELECT * FROM rate WHERE SERVICE='".$this->options->data->id."'";
//echo $q;
$a=mysql_query($q,$this->db) or die(mysql_error());
//echo "Verificando: ".$this->options->data->id;
$n = mysql_num_rows($a);
//echo $n;
return ($n>0)?true:false;
}
public function create()
{
$q="INSERT INTO rate (`UID`, `USERS`, `RATE`, `SERVICE`) VALUES (NULL, '0', '0', '{$this->options->data->id}')";
$w = mysql_query($q,$this->db) or die(mysql_error());
}
public function set()
{
//return "poniendo valor:".$this->options->data->value." al ID:".$this->options->data->id;
$a=$this->get();
//(promedio+usuarios)+actual/usuarios+actual
//$r=round(((($a['RATE']*$a['USERS'])+$this->options->data->value)/($a['USERS']+1)),2);
$r=round(((($a['RATE']*$a['USERS'])+$this->options->data->value)/($a['USERS']+1)),1);
/*$r=(($r%2)>0.5)?($r+1):($r-1);
$r=($r<0)?0:$r;
$r=($r>10)?10:$r;*/
//echo (int)round(((($a['RATE']*$a['USERS'])+$this->options->data->value)/($a['USERS']+1)),1);
$sql = "UPDATE rate SET `USERS` = '".($a['USERS']+1)."', `RATE` = '{$r}' WHERE SERVICE = '{$this->options->data->id}' LIMIT 1";
mysql_query($sql) or die($sql);
return $this->get();
}
function __call($n,$a)
{
return isset($this->n)?$this->$n($a):"Invalid action";
}
}
?>

View File

@@ -30,6 +30,8 @@
class G
{
public $sessionVar = array(); //SESSION temporary array store.
/**
* is_https
* @return void
@@ -4763,6 +4765,90 @@ class G
}
return false;
}
/**
* Save the $_SESSION variables into $sessionVar array, to unset them temporary.
*
*/
public function sessionVarSave()
{
//Unset any variable
$this->sessionVar = array();
if (isset($_SESSION["APPLICATION"])) {
$this->sessionVar["APPLICATION"] = $_SESSION["APPLICATION"];
}
if (isset($_SESSION["INDEX"])) {
$this->sessionVar["INDEX"] = $_SESSION["INDEX"];
}
if (isset($_SESSION["PROCESS"])) {
$this->sessionVar["PROCESS"] = $_SESSION["PROCESS"];
}
if (isset($_SESSION["TASK"])) {
$this->sessionVar["TASK"] = $_SESSION["TASK"];
}
if (isset($_SESSION["USER_LOGGED"])) {
$this->sessionVar["USER_LOGGED"] = $_SESSION["USER_LOGGED"];
}
if (isset($_SESSION["USR_USERNAME"])) {
$this->sessionVar["USR_USERNAME"] = $_SESSION["USR_USERNAME"];
}
if (isset($_SESSION["STEP_POSITION"])) {
$this->sessionVar["STEP_POSITION"] = $_SESSION["STEP_POSITION"];
}
}
/**
* Restore the session variables with values of $sessionVar array, if this is set.
*
*/
public function sessionVarRestore()
{
if (count($this->sessionVar) > 0) {
//Restore original values
unset($_SESSION["APPLICATION"]);
unset($_SESSION["INDEX"]);
unset($_SESSION["PROCESS"]);
unset($_SESSION["TASK"]);
unset($_SESSION["USER_LOGGED"]);
unset($_SESSION["USR_USERNAME"]);
unset($_SESSION["STEP_POSITION"]);
if (isset($this->sessionVar["APPLICATION"])) {
$_SESSION["APPLICATION"] = $this->sessionVar["APPLICATION"];
}
if (isset($this->sessionVar["INDEX"])) {
$_SESSION["INDEX"] = $this->sessionVar["INDEX"];
}
if (isset($this->sessionVar["PROCESS"])) {
$_SESSION["PROCESS"] = $this->sessionVar["PROCESS"];
}
if (isset($this->sessionVar["TASK"])) {
$_SESSION["TASK"] = $this->sessionVar["TASK"];
}
if (isset($this->sessionVar["USER_LOGGED"])) {
$_SESSION["USER_LOGGED"] = $this->sessionVar["USER_LOGGED"];
}
if (isset($this->sessionVar["USR_USERNAME"])) {
$_SESSION["USR_USERNAME"] = $this->sessionVar["USR_USERNAME"];
}
if (isset($this->sessionVar["STEP_POSITION"])) {
$_SESSION["STEP_POSITION"] = $this->sessionVar["STEP_POSITION"];
}
}
}
}
/**

View File

@@ -476,8 +476,8 @@ class Publisher
global $mainPanelScript;
global $panelName;
global $tabCount;
G::LoadThirdParty( 'pear/json', 'class.json' );
$json = new Services_JSON();
//G::LoadThirdParty( 'pear/json', 'class.json' );
//$json = new Services_JSON();
$tabCount = 0;
$panelName = $Part['Template'];
$data = $Part['File'];
@@ -493,7 +493,7 @@ class Publisher
. ($data['roll'] ? 'true' : 'false') . ',' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' resize:'
. ($data['resize'] ? 'true' : 'false') . '},' . 'fx:{' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' modal:'
. ($data['modal'] ? 'true' : 'false') . ',' . ' blinkToFront:' . ($data['blinkToFront'] ? 'true' : 'false') . '}' . '};'
. $panelName . '.setStyle=' . $json->encode( $data['style'] ) . ';' . $panelName . '.tab={' . 'width:'
. $panelName . '.setStyle=' . Bootstrap::json_encode( $data['style'] ) . ';' . $panelName . '.tab={' . 'width:'
. ($data['tabWidth'] + $data['tabSpace']) . ',' . 'optWidth:' . $data['tabWidth'] . ',' . 'step :' . $data['tabStep']
. ',' . 'options:[]' . '};';
print (' ') ;

View File

@@ -66,7 +66,7 @@ class PmBootstrap extends Bootstrap
// pm workflow classes (static load)
$this->autoloader->registerClass('System', PATH_CORE . 'classes/class.system');
$this->autoloader->registerClass('Services_JSON', PATH_THIRDPARTY .'pear/json/class.json');
//$this->autoloader->registerClass('Services_JSON', PATH_THIRDPARTY .'pear/json/class.json');
$this->autoloader->registerClass('Smarty', PATH_THIRDPARTY . 'smarty/libs/Smarty.class');
$this->autoloader->registerClass('Propel', PATH_THIRDPARTY . 'propel/Propel');

View File

@@ -1485,6 +1485,16 @@ function PMFAddInputDocument(
$file = "path_to_file/myfile.txt"
) {
G::LoadClass("case");
$g = new G();
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseUid;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["TASK"] = $taskUid;
$_SESSION["USER_LOGGED"] = $userUid;
$case = new Cases();
$appDocUid = $case->addInputDocument(
@@ -1502,6 +1512,8 @@ function PMFAddInputDocument(
$file
);
$g->sessionVarRestore();
return $appDocUid;
}
@@ -1518,14 +1530,26 @@ function PMFAddInputDocument(
*/
function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = null, $sUserLogged = null)
{
if (! $sApplication) {
$sApplication = $_SESSION['APPLICATION'];
$g = new G();
$g->sessionVarSave();
if ($sApplication) {
$_SESSION["APPLICATION"] = $sApplication;
} else {
$sApplication = $_SESSION["APPLICATION"];
}
if (! $index) {
$index = $_SESSION['INDEX'];
if ($index) {
$_SESSION["INDEX"] = $index;
} else {
$index = $_SESSION["INDEX"];
}
if (! $sUserLogged) {
$sUserLogged = $_SESSION['USER_LOGGED'];
if ($sUserLogged) {
$_SESSION["USER_LOGGED"] = $sUserLogged;
} else {
$sUserLogged = $_SESSION["USER_LOGGED"];
}
G::LoadClass( 'case' );
@@ -1688,6 +1712,8 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
break;
}
}
$g->sessionVarRestore();
}
/**
@@ -2157,7 +2183,15 @@ function PMFgetLabelOption ($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTE
*/
function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUid)
{
$g = new G();
$g->sessionVarSave();
$iDelegation = intval($iDelegation);
$_SESSION["APPLICATION"] = $sApplicationUID;
$_SESSION["INDEX"] = $iDelegation;
require_once 'classes/model/AppDelegation.php';
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
@@ -2206,10 +2240,15 @@ function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUi
$aFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase( $sApplicationUID, $aFields );
}
$g->sessionVarRestore();
G::header( 'Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction );
die();
}
}
$g->sessionVarRestore();
}
/**

View File

@@ -77,7 +77,6 @@ class wsBase
{
public $stored_system_variables; //boolean
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
private $originalValues = array (); // SESSION temporary array store.
public function __construct ($params = null)
{
@@ -1685,92 +1684,6 @@ class wsBase
}
}
/**
* save the $_SESSION variables into $originalValues array, to unset them temporary.
*
*/
private function saveTemporarySessionVars()
{
//Unset any variable, because we are starting a new case
if (isset( $_SESSION['APPLICATION'] )) {
$this->originalValues['APPLICATION'] = $_SESSION['APPLICATION'];
unset( $_SESSION['APPLICATION'] );
}
if (isset( $_SESSION['PROCESS'] )) {
$this->originalValues['PROCESS'] = $_SESSION['PROCESS'];
unset( $_SESSION['PROCESS'] );
}
if (isset( $_SESSION['TASK'] )) {
$this->originalValues['TASK'] = $_SESSION['TASK'];
unset( $_SESSION['TASK'] );
}
if (isset( $_SESSION['INDEX'] )) {
$this->originalValues['INDEX'] = $_SESSION['INDEX'];
unset( $_SESSION['INDEX'] );
}
if (isset( $_SESSION['USER_LOGGED'] )) {
$this->originalValues['USER_LOGGED'] = $_SESSION['USER_LOGGED'];
unset( $_SESSION['USER_LOGGED'] );
}
if (isset( $_SESSION['USR_USERNAME'] )) {
$this->originalValues['USR_USERNAME'] = $_SESSION['USR_USERNAME'];
unset( $_SESSION['USR_USERNAME'] );
}
if (isset( $_SESSION['STEP_POSITION'] )) {
$this->originalValues['STEP_POSITION'] = $_SESSION['STEP_POSITION'];
unset( $_SESSION['STEP_POSITION'] );
}
}
/**
* restore the Session variables with values of $originalValues array, if this is set.
*
*/
private function restoreSessionVars()
{
//Restore original values
if (isset( $this->originalValues['APPLICATION'] )) {
$_SESSION['APPLICATION'] = $this->originalValues['APPLICATION'];
unset( $this->originalValues['APPLICATION']);
}
if (isset( $this->originalValues['PROCESS'] )) {
$_SESSION['PROCESS'] = $this->originalValues['PROCESS'];
unset( $this->originalValues['PROCESS']);
}
if (isset( $this->originalValues['TASK'] )) {
$_SESSION['TASK'] = $this->originalValues['TASK'];
unset( $this->originalValues['TASK']);
}
if (isset( $this->originalValues['INDEX'] )) {
$_SESSION['INDEX'] = $this->originalValues['INDEX'];
unset( $this->originalValues['INDEX']);
}
if (isset( $this->originalValues['USR_USERNAME'] )) {
$_SESSION['USR_USERNAME'] = $this->originalValues['USR_USERNAME'];
unset( $this->originalValues['USR_USERNAME']);
}
if (isset( $this->originalValues['USER_LOGGED'] )) {
$_SESSION['USER_LOGGED'] = $this->originalValues['USER_LOGGED'];
unset( $this->originalValues['USER_LOGGED']);
}
if (isset( $this->originalValues['STEP_POSITION'] )) {
$_SESSION['STEP_POSITION'] = $this->originalValues['STEP_POSITION'];
unset( $this->originalValues['STEP_POSITION']);
}
}
/**
* new Case begins a new case under the name of the logged-in user.
*
@@ -1782,9 +1695,14 @@ class wsBase
*/
public function newCase ($processId, $userId, $taskId, $variables)
{
try {
$g = new G();
$this->saveTemporarySessionVars();
try {
$g->sessionVarSave();
$_SESSION["PROCESS"] = $processId;
$_SESSION["TASK"] = $taskId;
$_SESSION["USER_LOGGED"] = $userId;
$Fields = array ();
@@ -1797,7 +1715,9 @@ class wsBase
if (! $pro) {
$result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId );
$this->restoreSessionVars();
$g->sessionVarRestore();
return $result;
}
@@ -1828,14 +1748,18 @@ class wsBase
if ($tasksInThisProcess > 1) {
$result = new wsResponse( 13, G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) );
$this->restoreSessionVars();
$g->sessionVarRestore();
return $result;
}
}
if ($founded == '') {
$result = new wsResponse( 14, G::loadTranslation( 'ID_TASK_INVALID_USER_NOT_ASSIGNED_TASK' ) );
$this->restoreSessionVars();
$g->sessionVarRestore();
return $result;
}
@@ -1858,16 +1782,18 @@ class wsBase
$up_case = $oCase->updateCase( $caseId, $oldFields );
$this->restoreSessionVars();
$result = new wsResponse( 0, G::loadTranslation( 'ID_STARTED_SUCCESSFULLY' ) );
$result->caseId = $caseId;
$result->caseNumber = $caseNr;
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse( 100, $e->getMessage() );
$this->restoreSessionVars();
$g->sessionVarRestore();
return $result;
}
}
@@ -1969,7 +1895,15 @@ class wsBase
*/
public function derivateCase ($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseId;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userId;
$sStatus = 'TO_DO';
$varResponse = '';
@@ -2357,10 +2291,14 @@ class wsBase
$res['routing'] = $aCurrentUsers;
$g->sessionVarRestore();
return $res;
} catch (Exception $e) {
$result = new wsResponse( 100, $e->getMessage() );
$g->sessionVarRestore();
return $result;
}
}
@@ -2377,19 +2315,31 @@ class wsBase
*/
public function executeTrigger ($userId, $caseId, $triggerIndex, $delIndex)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseId;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userId;
$oAppDel = new AppDelegation();
$appdel = $oAppDel->Load( $caseId, $delIndex );
if ($userId != $appdel['USR_UID']) {
$result = new wsResponse( 17, G::loadTranslation( 'ID_CASE_ASSIGNED_ANOTHER_USER' ) );
$g->sessionVarRestore();
return $result;
}
if ($appdel['DEL_FINISH_DATE'] != null) {
$result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2408,6 +2358,8 @@ class wsBase
if ($aRow['APP_DISABLE_ACTION_USER'] != 0 && $aRow['APP_DISABLE_ACTION_DATE'] != '') {
$result = new wsResponse( 19, G::loadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] );
$g->sessionVarRestore();
return $result;
}
}
@@ -2448,17 +2400,22 @@ class wsBase
$data['TRIGGER_INDEX'] = $triggerIndex;
$result = new wsResponse( 100, G::loadTranslation( 'ID_INVALID_TRIGGER', SYS_LANG, $data ) );
$g->sessionVarRestore();
return $result;
}
$result = new wsResponse( 0, G::loadTranslation( 'ID_EXECUTED' ) . ": " . trim( $row['TRI_WEBBOT'] ) );
//$result = new wsResponse(0, 'executed: ' . print_r($oPMScript, 1));
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse( 100, $e->getMessage() );
$g->sessionVarRestore();
return $result;
}
}
@@ -2555,10 +2512,20 @@ class wsBase
*/
public function reassignCase ($sessionId, $caseId, $delIndex, $userIdSource, $userIdTarget)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseId;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userIdSource;
if ($userIdTarget == $userIdSource) {
$result = new wsResponse( 30, G::loadTranslation( 'ID_TARGET_ORIGIN_USER_SAME' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2576,6 +2543,8 @@ class wsBase
if (! is_array( $aRow )) {
$result = new wsResponse( 31, G::loadTranslation( 'ID_INVALID_ORIGIN_USER' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2588,6 +2557,8 @@ class wsBase
if (! is_array( $aRow )) {
$result = new wsResponse( 32, G::loadTranslation( 'ID_CASE_NOT_OPEN' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2612,6 +2583,8 @@ class wsBase
if (! is_array( $aRow )) {
$result = new wsResponse( 33, G::loadTranslation( 'ID_INVALID_CASE_DELEGATION_INDEX' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2622,6 +2595,8 @@ class wsBase
if (! in_array( $userIdTarget, $userList )) {
$result = new wsResponse( 34, G::loadTranslation( 'ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2639,6 +2614,8 @@ class wsBase
if (! is_array( $aRow )) {
$result = new wsResponse( 35, G::loadTranslation( 'ID_TARGET_USER_DESTINATION_INVALID' ) );
$g->sessionVarRestore();
return $result;
}
@@ -2650,16 +2627,22 @@ class wsBase
if (! $var) {
$result = new wsResponse( 36, G::loadTranslation( 'ID_CASE_COULD_NOT_REASSIGNED' ) );
$g->sessionVarRestore();
return $result;
}
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
);
$g->sessionVarRestore();
return $result;
}
}
@@ -2884,10 +2867,18 @@ class wsBase
*/
public function deleteCase ($caseUid)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseUid;
if (empty( $caseUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
$g->sessionVarRestore();
return $result;
}
@@ -2900,10 +2891,14 @@ class wsBase
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
);
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse(100, $e->getMessage());
$g->sessionVarRestore();
return $result;
}
}
@@ -2918,22 +2913,36 @@ class wsBase
*/
public function cancelCase ($caseUid, $delIndex, $userUid)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseUid;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userUid;
if (empty( $caseUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
$g->sessionVarRestore();
return $result;
}
if (empty( $delIndex )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
$g->sessionVarRestore();
return $result;
}
if (empty( $userUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
$g->sessionVarRestore();
return $result;
}
@@ -2946,10 +2955,14 @@ class wsBase
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
);
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse(100, $e->getMessage());
$g->sessionVarRestore();
return $result;
}
}
@@ -2966,22 +2979,36 @@ class wsBase
*/
public function pauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseUid;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userUid;
if (empty( $caseUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
$g->sessionVarRestore();
return $result;
}
if (empty( $delIndex )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
$g->sessionVarRestore();
return $result;
}
if (empty( $userUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
$g->sessionVarRestore();
return $result;
}
@@ -2989,6 +3016,8 @@ class wsBase
if (! preg_match( "/^\d{4}-\d{2}-\d{2}$/", $unpauseDate )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_INVALID_DATA" ) . " $unpauseDate" );
$g->sessionVarRestore();
return $result;
}
}
@@ -3002,10 +3031,14 @@ class wsBase
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
);
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse(100, $e->getMessage());
$g->sessionVarRestore();
return $result;
}
}
@@ -3020,22 +3053,36 @@ class wsBase
*/
public function unpauseCase ($caseUid, $delIndex, $userUid)
{
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["APPLICATION"] = $caseUid;
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userUid;
if (empty( $caseUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " caseUid" );
$g->sessionVarRestore();
return $result;
}
if (empty( $delIndex )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " delIndex" );
$g->sessionVarRestore();
return $result;
}
if (empty( $userUid )) {
$result = new wsResponse( 100, G::LoadTranslation( "ID_REQUIRED_FIELD" ) . " userUid" );
$g->sessionVarRestore();
return $result;
}
@@ -3048,10 +3095,14 @@ class wsBase
$result = array ("status_code" => $res->status_code,"message" => $res->message,"timestamp" => $res->timestamp
);
$g->sessionVarRestore();
return $result;
} catch (Exception $e) {
$result = new wsResponse(100, $e->getMessage());
$g->sessionVarRestore();
return $result;
}
}

View File

@@ -24,7 +24,6 @@
*/
class AppFolder extends BaseAppFolder
{
/**
*
* @param string $folderName
@@ -86,6 +85,52 @@ class AppFolder extends BaseAppFolder
}
}
/**
* Update the application document registry
*
* @param array $aData
* @return string
*
*/
public function update ($aData)
{
$oConnection = Propel::getConnection( AppDocumentPeer::DATABASE_NAME );
try {
$oAppFolder = AppFolderPeer::retrieveByPK( $aData['FOLDER_UID'] );
if (! is_null( $oAppFolder )) {
$oAppFolder->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oAppFolder->validate()) {
$oConnection->begin();
if (isset( $aData['FOLDER_NAME'] )) {
$oAppFolder->setFolderName( $aData['FOLDER_NAME'] );
}
if (isset( $aData['FOLDER_UID'] )) {
$oAppFolder->setFolderUid( $aData['FOLDER_UID'] );
}
if (isset( $aData['FOLDER_UPDATE_DATE'] )) {
$oAppFolder->setFolderUpdateDate( $aData['FOLDER_UPDATE_DATE'] );
}
$iResult = $oAppFolder->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oAppFolder->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
/**
*
* @param string $folderPath

View File

@@ -309,8 +309,8 @@ class Content extends BaseContent
$this->rowsClustered = 0;
//Creating table CONTENT_BACKUP
$oConnection = Propel::getConnection( 'workflow' );
$oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
$connection = Propel::getConnection( 'workflow' );
$oStatement = $connection->prepareStatement( "CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
`CON_CATEGORY` VARCHAR(30) default '' NOT NULL,
`CON_PARENT` VARCHAR(32) default '' NOT NULL,
`CON_ID` VARCHAR(100) default '' NOT NULL,
@@ -320,10 +320,13 @@ class Content extends BaseContent
)Engine=MyISAM DEFAULT CHARSET='utf8' COMMENT='Table for add content';" );
$oStatement->executeQuery();
$con = Propel::getConnection( 'workflow' );
//set interactive timeout
$oStatement = $connection->prepareStatement( "set global interactive_timeout = 100;" );
$oStatement->executeQuery();
$sql = " SELECT DISTINCT CON_LANG
FROM CONTENT ";
$stmt = $con->createStatement();
$stmt = $connection->createStatement();
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
while ($rs->next()) {
$row = $rs->getRow();
@@ -341,7 +344,7 @@ class Content extends BaseContent
$workSpace = new workspaceTools( $workSpace );
$workSpace->getDBInfo();
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass ) or die( "Could not connect" );
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass, MYSQL_CLIENT_INTERACTIVE ) or die( "Could not connect" );
mysql_select_db( $workSpace->dbName, $link );
mysql_query( "SET NAMES 'utf8';" );
@@ -385,7 +388,7 @@ class Content extends BaseContent
}
mysql_free_result( $result );
$total = $this->rowsProcessed + $this->rowsInserted;
$connection = Propel::getConnection( 'workflow' );
$statement = $connection->prepareStatement( "INSERT INTO CONTENT
SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE
FROM CONTENT_BACKUP" );

View File

@@ -9,13 +9,12 @@
class newSiteProxy extends HttpProxyController
{
public function testingNW ($params)
{
public function testingNW ($params) {
if (isset( $_POST['NW_TITLE'] )) {
$action = (isset( $_POST['action'] )) ? trim( $_POST['action'] ) : 'test';
G::LoadClass( 'Installer' );
G::LoadClass( 'json' );
//G::LoadClass( 'json' );
$name = trim( $_POST['NW_TITLE'] );
$inst = new Installer();
$isset = $inst->isset_site( $name );
@@ -36,7 +35,7 @@ class newSiteProxy extends HttpProxyController
), ($action === 'create') ? true : false );
$result['result']['admin']['password'] = ($pass === $pass1) ? true : false;
$result['result']['action'] = $action;
$json = new Services_JSON();
//$json = new Services_JSON();
//G::pr($result['result']['database']);G::pr($action);
$dbWf = $result['result']['database']['ao']['ao_db_wf']['status'];
$dbRb = $result['result']['database']['ao']['ao_db_rb']['status'];
@@ -54,10 +53,10 @@ class newSiteProxy extends HttpProxyController
}
}
public function creatingNW ($params)
/* public function creatingNW ($params)
{
G::pr( $_POST );
G::pr( "krlossss" );
}
}*/
}

View File

@@ -13,11 +13,47 @@ if (! function_exists ($_REQUEST ['action'])) {
die ();
}
if (($_REQUEST['action']) != 'rename') {
$functionName = $_REQUEST ['action'];
$functionParams = isset ($_REQUEST ['params']) ? $_REQUEST ['params'] : array ();
$functionName ($functionParams);
} else {
$functionName = 'renameFolder';
$functionParams = isset ($_REQUEST ['params']) ? $_REQUEST ['params'] : array ();
$oldname = $_REQUEST ['item'];
$newname = $_REQUEST ['newitemname'];
$oUid = $_REQUEST ['selitems'];
if (isset($oUid[0])) {
$uid = $oUid[0];
} else {
$uid = $oUid;
}
renameFolder ($oldname, $newname, $uid);
}
/////////////////////////////////////////////
function renameFolder($oldname, $newname, $uid)
{
$folder = new AppFolder();
//Clean Folder name (delete spaces...)
$newname = trim( $newname );
$fields = array();
$fields['FOLDER_UID'] = $uid;
$fields['FOLDER_NAME'] = $newname;
$fields['FOLDER_UPDATE_DATE'] = date('Y-m-d H:i:s');
$folder->update($fields);
$msgLabel= G::LoadTranslation ('ID_EDIT_SUCCESSFULLY');
echo "{action: '', error:'error',message: '$msgLabel', success: 'success',folderUID: 'root'}";
}
/**
* delete folders and documents
* created by carlos pacha carlos@colosa.com, pckrlos@gmail.com

View File

@@ -46,8 +46,8 @@ try {
}
$aFields = $RBAC->getAuthSource( $_POST['sUID'] );
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
//G::LoadThirdParty( 'pear/json', 'class.json' );
//$oJSON = new Services_JSON();
$i = 0;
$oUser = new Users();
$aAux = $RBAC->searchUsers( $_POST['sUID'], $_POST['sKeyword'] );
@@ -59,7 +59,7 @@ try {
foreach ($aAux as $aUser) {
if (! in_array( $aUser['sUsername'], $pmUsers )) {
// add replace to change D'Souza to D*Souza by krlos
$sCheckbox = '<div align="center"><input type="checkbox" name="aUsers[' . $i . ']" id="aUsers[' . $i . ']" value=\'' . str_replace( "\'", "*", addslashes( $oJSON->encode( $aUser ) ) ) . '\' /></div>';
$sCheckbox = '<div align="center"><input type="checkbox" name="aUsers[' . $i . ']" id="aUsers[' . $i . ']" value=\'' . str_replace( "\'", "*", addslashes( Bootstrap::json_encode( $aUser ) ) ) . '\' /></div>';
$i ++;
} else {
$sCheckbox = G::LoadTranslation( 'ID_USER_REGISTERED' ) . ':<br />(' . $aUser['sUsername'] . ')';

View File

@@ -33,12 +33,12 @@ if (isset($aFields['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])) {
$aAttributes = $aFields['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'];
}
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
//G::LoadThirdParty( 'pear/json', 'class.json' );
//$oJSON = new Services_JSON();
foreach ($_POST['aUsers'] as $sUser) {
$matches = array ();
$aUser = (array) $oJSON->decode( stripslashes( $sUser ) );
$aUser = (array) Bootstrap::json_decode( stripslashes( $sUser ) );
$aData['USR_USERNAME'] = str_replace( "*", "'", $aUser['sUsername'] );
$aData['USR_PASSWORD'] = md5( str_replace( "*", "'", $aUser['sUsername'] ) );
// note added by gustavo gustavo-at-colosa.com

View File

@@ -554,7 +554,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$r->data = $aProcesses;
$r->totalCount = $totalCount;
echo G::json_encode( $r );
echo Bootstrap::json_encode( $r );
break;
case 'generateDocumentGrid_Ajax':
@@ -612,7 +612,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$r->totalCount = $totalCount;
$r->dataFormat = $dateFormat;
echo G::json_encode( $r );
echo Bootstrap::json_encode( $r );
break;
case 'showGeneratedDocument':
//require_once 'classes/model/AppDocument.php';
@@ -935,16 +935,16 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
G::RenderPage( 'publish', 'raw' );
break;
case "getCountCasesFolder":
$json = new Services_JSON();
//$json = new Services_JSON();
$aTypes = Array ('to_do','draft','cancelled','sent','paused','completed','selfservice','to_revise','to_reassign');
$aTypesID = Array ('to_do' => 'CASES_INBOX','draft' => 'CASES_DRAFT','cancelled' => 'CASES_CANCELLED','sent' => 'CASES_SENT','paused' => 'CASES_PAUSED','completed' => 'CASES_COMPLETED','selfservice' => 'CASES_SELFSERVICE','to_revise' => 'CASES_TO_REVISE','to_reassign' => 'CASES_TO_REASSIGN');
if (! isset( $_POST['A'] )) {
$oCases = new Cases();
$aCount = $oCases->getAllConditionCasesCount( $aTypes, true );
echo $json->encode( $aCount );
echo Bootstrap::json_encode( $aCount );
} else {
echo $json->encode( $aTypesID );
echo Bootstrap::json_encode( $aTypesID );
}
break;
case "previusJump":
@@ -965,7 +965,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$response['exists'] = false;
}
echo G::json_encode( $response );
echo Bootstrap::json_encode( $response );
break;
default:
echo 'default';

View File

@@ -273,13 +273,13 @@ switch ($action) {
}
break;
case 'showEncodes':
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
//G::LoadThirdParty( 'pear/json', 'class.json' );
//$oJSON = new Services_JSON();
$engine = $_POST['engine'];
if ($engine != "0") {
$dbs = new dbConnections();
echo $oJSON->encode( $dbs->getEncondeList( $engine ) );
echo Bootstrap::json_encode( $dbs->getEncondeList( $engine ) );
} else {
echo '[["0","..."]]';

View File

@@ -53,14 +53,14 @@ try {
$_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
$sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : '';
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' );
$aFilter = explode( ',', $sFilter );
$aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter );
print ($oJSON->encode( $aAvailableFields )) ;
print (Bootstrap::json_encode( $aAvailableFields )) ;
break;
case 'showDynavars':
G::LoadSystem( 'dynaformhandler' );

View File

@@ -64,14 +64,14 @@ if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
// the script responds an ajax request in order to check the dependent fields,
// and generate a json output of the values that the dependent field must have.
$sDynUid = G::getUIDName( urlDecode( $_POST['DYN_UID'] ) );
$json = new Services_JSON();
$formValues = ($json->decode( $_POST['fields'] ));
//$json = new Services_JSON();
$formValues = (Bootstrap::json_decode( $_POST['fields'] ));
$sFieldName = $_POST['fieldName'];
$sMasterField = '';
$sPath = PATH_DYNAFORM;
$G_FORM = new form( $sDynUid, $sPath );
$aux = array ();
$newValues = $json->decode( urlDecode( stripslashes( $_POST['form'] ) ) );
$newValues = Bootstrap::json_decode( urlDecode( stripslashes( $_POST['form'] ) ) );
if (isset( $_POST['grid'] )) {
$_POST['row'] = (int) $_POST['row'];

View File

@@ -30,8 +30,8 @@ if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] )) {
eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] );
}
//G::LoadSystem('json');
require_once (PATH_THIRDPARTY . 'pear/json/class.json.php');
$json = new Services_JSON();
//require_once (PATH_THIRDPARTY . 'pear/json/class.json.php');
//$json = new Services_JSON();
$G_FORM = new form( G::getUIDName( urlDecode( $_POST['form'] ) ) );
$G_FORM->id = urlDecode( $_POST['form'] );
$G_FORM->values = $_SESSION[$G_FORM->id];
@@ -44,7 +44,7 @@ define( 'DB_XMLDB_PASS', '' );
define( 'DB_XMLDB_NAME', '' );
define( 'DB_XMLDB_TYPE', 'myxml' );
$newValues = ($json->decode( urlDecode( stripslashes( $_POST['fields'] ) ) ));
$newValues = (Bootstrap::json_decode( urlDecode( stripslashes( $_POST['fields'] ) ) ));
//Resolve dependencies
//Returns an array ($dependentFields) with the names of the fields
//that depends of fields passed through AJAX ($_GET/$_POST)
@@ -84,7 +84,7 @@ foreach ($dependentFields as $d) {
$sendContent[$r]->value = $G_FORM->values[$d];
$r ++;
}
echo ($json->encode( $sendContent ));
echo (Bootstrap::json_encode( $sendContent ));
function toJSArray ($array)
{

View File

@@ -48,12 +48,12 @@ if (isset( $_POST['form']['NW_TITLE'] )) {
), ($action === 'create') ? true : false );
$result['result']['admin']['password'] = ($pass === $pass1) ? true : false;
$result['result']['action'] = $action;
$json = new Services_JSON();
//$json = new Services_JSON();
/*$ec;
$ec->created=($new)?true:false;
$ec->name=$name;
$ec->message=($new)?"Workspace created":"Workspace already exists or Name invalid";*/
echo $json->encode( $result );
echo Bootstrap::json_encode( $result );
} else {
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
G::LoadInclude( 'ajax' );
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
if (isset( $_POST['mode'] ) && $_POST['mode'] != '') {
$aData = $_POST;
} else {

View File

@@ -399,7 +399,7 @@ try {
break;
case 'loginPML':
G::LoadClass( 'processes' );
G::LoadThirdParty( 'pear/json', 'class.json' );
//G::LoadThirdParty( 'pear/json', 'class.json' );
$oProcesses = new Processes();
try {
if ($oProcesses->ws_open( $oData->u, $oData->p ) == 1) {
@@ -421,6 +421,7 @@ try {
$oResponse->sLink = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId;
}
$oResponse->bExists = $bExists;
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oResponse );
break;
case 'editFile':
@@ -605,7 +606,8 @@ try {
}
$response = new stdclass();
$response->casesNumRec = $casesNumRec;
echo Bootstrap::json_encode( $response );
//$json = new Services_JSON();
$sOutput = Bootstrap::json_encode( $response );
break;
}
if (isset( $sOutput )) {

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
G::LoadThirdParty( 'pear/json', 'class.json' );
//G::LoadThirdParty( 'pear/json', 'class.json' );
try {
@@ -49,8 +49,8 @@ try {
return $value;
}
$oJSON = new Services_JSON();
$stdObj = $oJSON->decode( $_POST['data'] );
//$oJSON = new Services_JSON();
$stdObj = Bootstrap::json_decode( $_POST['data'] );
if (isset( $stdObj->pro_uid ))
$sProUid = $stdObj->pro_uid;
else

View File

@@ -27,7 +27,7 @@
*
*/
G::LoadThirdParty( 'pear/json', 'class.json' );
//G::LoadThirdParty( 'pear/json', 'class.json' );
$function = isset( $_POST['function'] ) ? $_POST['function'] : '';
@@ -58,7 +58,7 @@ switch ($function) {
$oProcessMap = new ProcessMap();
if (! isset( $_POST['form']['PRO_UID'] )) {
$_POST['form']['USR_UID'] = $_SESSION['USER_LOGGED'];
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
require_once 'classes/model/Task.php';
$sProUid = $oProcessMap->createProcess( $_POST['form'] );

View File

@@ -29,10 +29,10 @@
* @Date 16/05/2008
* @LastModification none
*/
G::LoadThirdParty( 'pear/json', 'class.json' );
//G::LoadThirdParty( 'pear/json', 'class.json' );
try {
$oJSON = new Services_JSON();
$stdObj = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$stdObj = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
if (isset( $stdObj->pro_uid ))
$sProUid = $stdObj->pro_uid;
else

View File

@@ -199,8 +199,8 @@ try {
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
require_once 'classes/model/AppDelegation.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oProcess = new Process();
$aRow = $oProcess->load( $oData->uid );
$oSM->title->label = strip_tags( $aRow['PRO_TITLE'] );
@@ -262,13 +262,13 @@ try {
$oSM->stages[$iKey]->derivation->type = 0;
}
}
$oJSON = new Services_JSON();
echo $oJSON->encode( $oSM );
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oSM );
break;
case 'addStage':
require_once 'classes/model/Stage.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'STG_UID' );
$oCriteria->add( StagePeer::PRO_UID, $oData->uid );
@@ -313,13 +313,13 @@ try {
$oData->position->y *= - 1;
$oNewStage->uid = $oStage->create( array ('PRO_UID' => $oData->uid,'STG_TITLE' => $oNewStage->label,'STG_POSX' => $oData->position->x,'STG_POSY' => $oData->position->y,'STG_INDEX' => $iIndex) );
$oJSON = new Services_JSON();
echo $oJSON->encode( $oNewStage );
//$oJSON = new Services_JSON();
echo Bootstrap::json_encode( $oNewStage );
break;
case 'saveStagePosition':
require_once 'classes/model/Stage.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->uid );
$aFields['STG_UID'] = $oData->uid;
@@ -329,8 +329,8 @@ try {
break;
case 'deleteStage':
require_once 'classes/model/Stage.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$oStage->remove( $oData->stg_uid );
@@ -344,8 +344,8 @@ try {
break;
case 'editStage':
require_once 'classes/model/Stage.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oStage = new Stage();
$aFields = $oStage->load( $oData->stg_uid );
$aFields['THEINDEX'] = $oData->theindex;
@@ -365,8 +365,8 @@ try {
case 'tasksAssigned':
require_once 'classes/model/Stage.php';
require_once 'classes/model/Task.php';
$oJSON = new Services_JSON();
$oData = $oJSON->decode( stripslashes( $_POST['data'] ) );
//$oJSON = new Services_JSON();
$oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( TaskPeer::TAS_UID );
$oCriteria->addAsColumn( 'TAS_TITLE', ContentPeer::CON_VALUE );

View File

@@ -62,14 +62,14 @@
}
function simpleProcess ($oData ) {
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t3 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;
@@ -84,15 +84,15 @@
}
function simpleParallel ($oData ) {
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t5 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t5 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$t1->uid);
$oTask = new Task();
@@ -106,18 +106,18 @@
}
function fullParallel ($oData ) {
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 100, 160) );
$t3 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t4 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 500, 160) );
$t5 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 200, 250) );
$t6 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 500, 250) );
$t7 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 350, 340) );
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 100, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t4 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 500, 160) );
$t5 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 250) );
$t6 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 500, 250) );
$t7 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 350, 340) );
$aData = array("TAS_START"=>"TRUE","TAS_UID"=>$t1->uid);
$oTask = new Task();
@@ -136,15 +136,15 @@
function conditional ($oData ) {
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t4 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 160) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 160) );
$t4 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 250) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;
@@ -163,14 +163,14 @@
function doubleStart ($oData ) {
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
$sProUid = $oData['PRO_UID'];
$sTemplate = $oData['PRO_TEMPLATE'];
$oProcessMap = $oData['PROCESSMAP'];
$t1 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 200, 70) );
$t2 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 400, 70) );
$t3 = $oJSON->decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$t1 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 200, 70) );
$t2 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 400, 70) );
$t3 = Bootstrap::json_decode( $oProcessMap->addTask( $sProUid, 300, 160) );
$task1 = $t1->uid;
$task2 = $t2->uid;
$task3 = $t3->uid;

View File

@@ -73,6 +73,7 @@ streamFilefromPM=function(fileStream) {
};
var swHandleCallbackRootNodeLoad = 0;
var dirTreeEd;
function rootNodeCreate()
{
@@ -298,7 +299,6 @@ function openActionDialog( caller, action ) {
case 'edit':
case 'newFolder':
case 'moveAction':
case 'rename':
case 'search':
case 'uploadDocument':
requestParams = getRequestParams();
@@ -486,6 +486,9 @@ function openActionDialog( caller, action ) {
* messageText, false, true ); }else{ alert("sadasd"); }
*/
break;
case 'rename':
dirTreeEd.triggerEdit(Ext.getCmp('dirTreePanel').getSelectionModel().getSelectedNode());
break;
}
}
@@ -1441,7 +1444,7 @@ function dirContext(node, e) {
// Unselect all files in the grid
ext_itemgrid.getSelectionModel().clearSelections();
dirCtxMenu.items.get('dirCtxMenu_rename')[node.attributes.is_deletable ? 'disable': 'disable']();
dirCtxMenu.items.get('dirCtxMenu_rename')[node.attributes.is_deletable ? 'enable': 'disable']();
// dirCtxMenu.items.get('dirCtxMenu_remove')[node.attributes.is_deletable ? 'enable':'disable']();
dirCtxMenu.items.get('dirCtxMenu_remove')[permitodelete==1 && node.attributes.id!='root' ? 'show':'hide']();
@@ -1502,8 +1505,6 @@ var dirCtxMenu = new Ext.menu.Menu(
{
id : 'dirCtxMenu_rename',
iconCls: 'button_menu_ext ss_sprite ss_textfield_rename',// icon
// :
hidden: true, // '/images/documents/_fonts.png',
text : TRANSLATIONS.ID_RENAME,
handler : function() {
dirCtxMenu.hide();
@@ -1898,7 +1899,7 @@ var documentsTab = {
// create the editor for the directory
// tree
var dirTreeEd = new Ext.tree.TreeEditor(
dirTreeEd = new Ext.tree.TreeEditor(
dirTree,
{
allowBlank : false,

View File

@@ -372,6 +372,8 @@ if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath
// the request correspond to valid php page, now parse the URI
Bootstrap::parseURI( getenv( "REQUEST_URI" ), $isRestRequest );
//Bootstrap::mylog("sys_temp: ".SYS_TEMP);
if (Bootstrap::isPMUnderUpdating()) {
header( "location: /update/updating.php" );
if (DEBUG_TIME_LOG)
@@ -624,6 +626,7 @@ Bootstrap::registerClass('IsoCountry', PATH_HOME . "engine/classes/mode
Bootstrap::registerClass('BaseIsoSubdivision', PATH_HOME . "engine/classes/model/om/BaseIsoSubdivision.php");
Bootstrap::registerClass('IsoSubdivision', PATH_HOME . "engine/classes/model/IsoSubdivision.php");
Bootstrap::registerClass('BaseIsoLocation', PATH_HOME . "engine/classes/model/om/BaseIsoLocation.php");
Bootstrap::registerClass('IsoLocation', PATH_HOME . "engine/classes/model/IsoLocation.php");
Bootstrap::registerClass('Users', PATH_HOME . "engine/classes/model/Users.php");
Bootstrap::registerClass('UsersPeer', PATH_HOME . "engine/classes/model/UsersPeer.php");