diff --git a/gulliver/system/class.form.php b/gulliver/system/class.form.php index d45e04ee0..63e3fd5bf 100755 --- a/gulliver/system/class.form.php +++ b/gulliver/system/class.form.php @@ -478,6 +478,14 @@ class Form extends XmlForm } } break; + case 'yesno': + $values[$k] = $newValues[$k]; + if($newValues[$k] == 1){ + $values[$k . "_label"] = G::LoadTranslation('ID_YES_VALUE'); + } else { + $values[$k . "_label"] = G::LoadTranslation('ID_NO_VALUE'); + } + break; case "link": $values[$k] = $newValues[$k]; $values[$k . "_label"] = $newValues[$k . "_label"]; diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 201409e23..846fbd558 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2634,6 +2634,20 @@ class G $oldumask = umask( 0 ); if (! is_dir( $path )) { G::verifyPath( $path, true ); + } + + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $file = str_replace("\\\\","\\",$file,$count); + if(!$count) { + $winPath = explode("\\",$file); + $file = ""; + foreach($winPath as $k => $v){ + if($v != "") { + $file.= $v."\\"; + } + } + $file = substr($file,0,-1); + } } G::LoadSystem('inputfilter'); diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 73b519c94..5f2c36a66 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1109,6 +1109,7 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText public $replaceTags = 0; public $renderMode = ''; public $comma_separator = '.'; + public $autocomplete = "on"; /** * Function render @@ -1121,6 +1122,13 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText */ public function render ($value = null, $owner = null) { + if ($this->autocomplete === '1') { + $this->autocomplete = "on"; + } else { + if ($this->autocomplete === '0') { + $this->autocomplete = "off"; + } + } if ($this->renderMode == '') { $this->renderMode = $this->mode; } @@ -1168,6 +1176,7 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText $html .= 'id="form[' . $this->name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; + $html .= 'autocomplete="' . $this->autocomplete . '" '; $html .= 'value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" '; $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; $html .= 'onkeypress="' . $this->htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '; @@ -4827,23 +4836,23 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText /* //Year - %Y year with the century - %y year without the century (range 00 to 99) - //Month - %m month, range 01 to 12 - %B full month name - %b abbreviated month name - //Day - %d the day of the month (range 01 to 31) - %e the day of the month (range 1 to 31) - //Hour - %H hour, range 00 to 23 (24h format) - %I hour, range 01 to 12 (12h format) - %k hour, range 0 to 23 (24h format) - %l hour, range 1 to 12 (12h format) - //Min - %M minute, range 00 to 59 - //Sec + %Y year with the century + %y year without the century (range 00 to 99) + //Month + %m month, range 01 to 12 + %B full month name + %b abbreviated month name + //Day + %d the day of the month (range 01 to 31) + %e the day of the month (range 1 to 31) + //Hour + %H hour, range 00 to 23 (24h format) + %I hour, range 01 to 12 (12h format) + %k hour, range 0 to 23 (24h format) + %l hour, range 1 to 12 (12h format) + //Min + %M minute, range 00 to 59 + //Sec %S seconds, range 00 to 59 */ function date_create_from_format( $dformat, $dvalue, $withHours = false ) diff --git a/gulliver/thirdparty/creole/Creole.php b/gulliver/thirdparty/creole/Creole.php index 175878527..7d6185ce1 100755 --- a/gulliver/thirdparty/creole/Creole.php +++ b/gulliver/thirdparty/creole/Creole.php @@ -189,10 +189,19 @@ class Creole { trigger_error("The Creole::NO_ASSOC_LOWER flag has been deprecated, and is now the default behavior. Use Creole::COMPAT_ASSOC_LOWER to lowercase resulset keys.", E_USER_WARNING); } + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } // sort $dsninfo by keys so the serialized result is always the same // for identical connection parameters, no matter what their order is ksort($dsninfo); - $connectionMapKey = crc32(serialize($dsninfo + array('compat_flags' => ($flags & Creole::COMPAT_ALL)))); + $connectionMapKey = G::encryptCrc32(serialize($dsninfo + array('compat_flags' => ($flags & Creole::COMPAT_ALL)))); // see if we already have a connection with these parameters cached if(isset(self::$connectionMap[$connectionMapKey]) && $dsninfo['phptype'] !== 'dbarray') diff --git a/gulliver/thirdparty/geshi/geshi.php b/gulliver/thirdparty/geshi/geshi.php index 31d2da49f..a97b012ec 100755 --- a/gulliver/thirdparty/geshi/geshi.php +++ b/gulliver/thirdparty/geshi/geshi.php @@ -3738,10 +3738,19 @@ class GeSHi { /** NOTE: memorypeak #1 */ $parsed_code = preg_replace('#]+>(\s*)#', '\\1', $parsed_code); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } // If we are using IDs for line numbers, there needs to be an overall // ID set to prevent collisions. if ($this->add_ids && !$this->overall_id) { - $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4); + $this->overall_id = 'geshi-' . substr(G::encryptOld(microtime()), 0, 4); } // Get code into lines diff --git a/gulliver/thirdparty/html2ps_pdf/box.checkbutton.php b/gulliver/thirdparty/html2ps_pdf/box.checkbutton.php index f38028a91..4e358d4d3 100755 --- a/gulliver/thirdparty/html2ps_pdf/box.checkbutton.php +++ b/gulliver/thirdparty/html2ps_pdf/box.checkbutton.php @@ -57,11 +57,20 @@ class CheckBox extends GenericFormattedBox { * @see CheckBox::CheckBox() */ function &create(&$root, &$pipeline) { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } $value = $root->get_attribute('value'); if (trim($value) == "") { error_log("Checkbox with empty 'value' attribute"); - $value = sprintf("___Value%s",md5(time().rand())); + $value = sprintf("___Value%s",G::encryptOld(time().rand())); }; $box =& new CheckBox($root->has_attribute('checked'), diff --git a/gulliver/thirdparty/html2ps_pdf/box.radiobutton.php b/gulliver/thirdparty/html2ps_pdf/box.radiobutton.php index 026a39d26..6e8cccdf8 100755 --- a/gulliver/thirdparty/html2ps_pdf/box.radiobutton.php +++ b/gulliver/thirdparty/html2ps_pdf/box.radiobutton.php @@ -19,12 +19,21 @@ class RadioBox extends SimpleInlineBox { var $_value; function &create(&$root, &$pipeline) { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } $checked = $root->has_attribute('checked'); $value = $root->get_attribute('value'); if (trim($value) == "") { error_log("Radiobutton with empty 'value' attribute"); - $value = sprintf("___Value%s",md5(time().rand())); + $value = sprintf("___Value%s",G::encryptOld(time().rand())); }; $css_state = $pipeline->getCurrentCSSState(); diff --git a/gulliver/thirdparty/html2ps_pdf/css.cache.class.php b/gulliver/thirdparty/html2ps_pdf/css.cache.class.php index 7152b3869..d9fe80a1d 100755 --- a/gulliver/thirdparty/html2ps_pdf/css.cache.class.php +++ b/gulliver/thirdparty/html2ps_pdf/css.cache.class.php @@ -15,7 +15,16 @@ class CSSCache { } function _getCacheFilename($url) { - return CACHE_DIR.md5($url).'.css.compiled'; + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + return CACHE_DIR.G::encryptOld($url).'.css.compiled'; } function _isCached($url) { diff --git a/gulliver/thirdparty/html2ps_pdf/image.class.php b/gulliver/thirdparty/html2ps_pdf/image.class.php index 91949db79..78e8b572c 100755 --- a/gulliver/thirdparty/html2ps_pdf/image.class.php +++ b/gulliver/thirdparty/html2ps_pdf/image.class.php @@ -80,7 +80,16 @@ class Image { // allowed file name length (especially after escaping specialy symbols) // thus, we generate long almost random 32-character name using the md5 hash function // - return CACHE_DIR.md5(time() + $url + rand()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + return CACHE_DIR.G::encryptOld(time() + $url + rand()); } // Checks if cache directory is available diff --git a/gulliver/thirdparty/pear/Log/console.php b/gulliver/thirdparty/pear/Log/console.php index 0c1f9b685..a52c15a57 100755 --- a/gulliver/thirdparty/pear/Log/console.php +++ b/gulliver/thirdparty/pear/Log/console.php @@ -67,7 +67,16 @@ class Log_console extends Log function Log_console($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/daemon.php b/gulliver/thirdparty/pear/Log/daemon.php index 9873f2a40..07ca7a832 100755 --- a/gulliver/thirdparty/pear/Log/daemon.php +++ b/gulliver/thirdparty/pear/Log/daemon.php @@ -74,7 +74,16 @@ class Log_daemon extends Log $name = LOG_SYSLOG; } - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_name = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/display.php b/gulliver/thirdparty/pear/Log/display.php index da8291a27..fb3667e09 100755 --- a/gulliver/thirdparty/pear/Log/display.php +++ b/gulliver/thirdparty/pear/Log/display.php @@ -54,7 +54,16 @@ class Log_display extends Log function Log_display($name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/error_log.php b/gulliver/thirdparty/pear/Log/error_log.php index 117e96c48..412f4cac9 100755 --- a/gulliver/thirdparty/pear/Log/error_log.php +++ b/gulliver/thirdparty/pear/Log/error_log.php @@ -52,7 +52,16 @@ class Log_error_log extends Log function Log_error_log($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_type = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/file.php b/gulliver/thirdparty/pear/Log/file.php index d0d03eeeb..fa352bcb0 100755 --- a/gulliver/thirdparty/pear/Log/file.php +++ b/gulliver/thirdparty/pear/Log/file.php @@ -98,7 +98,16 @@ class Log_file extends Log function Log_file($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_filename = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/firebug.php b/gulliver/thirdparty/pear/Log/firebug.php index 9f013f684..1dea4a7f5 100755 --- a/gulliver/thirdparty/pear/Log/firebug.php +++ b/gulliver/thirdparty/pear/Log/firebug.php @@ -81,7 +81,16 @@ class Log_firebug extends Log function Log_firebug($name = '', $ident = 'PHP', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); if (isset($conf['buffering'])) { diff --git a/gulliver/thirdparty/pear/Log/mail.php b/gulliver/thirdparty/pear/Log/mail.php index d4eea6c67..51538ae52 100755 --- a/gulliver/thirdparty/pear/Log/mail.php +++ b/gulliver/thirdparty/pear/Log/mail.php @@ -103,7 +103,16 @@ class Log_mail extends Log function Log_mail($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_recipients = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/mcal.php b/gulliver/thirdparty/pear/Log/mcal.php index ab88d457e..f2832cf48 100755 --- a/gulliver/thirdparty/pear/Log/mcal.php +++ b/gulliver/thirdparty/pear/Log/mcal.php @@ -74,7 +74,16 @@ class Log_mcal extends Log function Log_mcal($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_name = $name; $this->_ident = $ident; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/mdb2.php b/gulliver/thirdparty/pear/Log/mdb2.php index cc06787a3..34d35676b 100755 --- a/gulliver/thirdparty/pear/Log/mdb2.php +++ b/gulliver/thirdparty/pear/Log/mdb2.php @@ -115,7 +115,16 @@ class Log_mdb2 extends Log function Log_mdb2($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_table = $name; $this->_mask = Log::UPTO($level); diff --git a/gulliver/thirdparty/pear/Log/null.php b/gulliver/thirdparty/pear/Log/null.php index 58cb9b43f..20a510566 100755 --- a/gulliver/thirdparty/pear/Log/null.php +++ b/gulliver/thirdparty/pear/Log/null.php @@ -30,7 +30,16 @@ class Log_null extends Log function Log_null($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG) { - $this->_id = md5(microtime()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $this->_id = G::encryptOld(microtime()); $this->_ident = $ident; $this->_mask = Log::UPTO($level); } diff --git a/gulliver/thirdparty/pear/Net/DIME.php b/gulliver/thirdparty/pear/Net/DIME.php index 6c54208ea..1eaf321b8 100755 --- a/gulliver/thirdparty/pear/Net/DIME.php +++ b/gulliver/thirdparty/pear/Net/DIME.php @@ -167,7 +167,16 @@ class Net_DIME_Record extends PEAR function generateID() { - $id = md5(time()); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $id = G::encryptOld(time()); $this->setID($id); return $id; } @@ -373,6 +382,15 @@ class Net_DIME_Message extends PEAR function startChunk(&$data, $typestr='', $id=NULL, $type=NET_DIME_TYPE_UNKNOWN) { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } $this->me = 0; $this->cf = 1; $this->type = $type; @@ -380,7 +398,7 @@ class Net_DIME_Message extends PEAR if ($id) { $this->id = $id; } else { - $this->id = md5(time()); + $this->id = G::encryptOld(time()); } return $this->_makeRecord($data, $this->typestr, $this->id, $this->type); } diff --git a/gulliver/thirdparty/pear/Net/UserAgent/Detect/APC.php b/gulliver/thirdparty/pear/Net/UserAgent/Detect/APC.php index 467907217..7c8a23537 100755 --- a/gulliver/thirdparty/pear/Net/UserAgent/Detect/APC.php +++ b/gulliver/thirdparty/pear/Net/UserAgent/Detect/APC.php @@ -29,6 +29,15 @@ class Net_UserAgent_Detect_APC extends Net_UserAgent_Detect $restored = false; $ua_cache_timeout = apc_fetch('useragent:cache_timeout'); // don't cache after time period + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } if ($ua_cache_window > 0) { if (!$ua_cache_timeout) { // check apc uptime and disable after x mins @@ -49,7 +58,7 @@ class Net_UserAgent_Detect_APC extends Net_UserAgent_Detect if ($in_detect !== null) { $key_flags = implode('-', $in_detect); } - $this->key = 'useragent:'.md5($in_userAgent.$key_flags); + $this->key = 'useragent:'.G::encryptOld($in_userAgent.$key_flags); } if ($data = apc_fetch($this->key)) { diff --git a/gulliver/thirdparty/pear/PEAR/Installer.php b/gulliver/thirdparty/pear/PEAR/Installer.php index 6ef191c98..9c8e15c95 100755 --- a/gulliver/thirdparty/pear/PEAR/Installer.php +++ b/gulliver/thirdparty/pear/PEAR/Installer.php @@ -232,8 +232,17 @@ class PEAR_Installer extends PEAR_Common $fp = fopen($orig_file, "r"); $contents = fread($fp, filesize($orig_file)); fclose($fp); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } if (isset($atts['md5sum'])) { - $md5sum = md5($contents); + $md5sum = G::encryptOld($contents); } $subst_from = $subst_to = array(); foreach ($atts['replacements'] as $a) { @@ -863,11 +872,20 @@ class PEAR_Installer extends PEAR_Common if (!function_exists("md5_file")) { function md5_file($filename) { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } $fp = fopen($filename, "r"); if (!$fp) return null; $contents = fread($fp, filesize($filename)); fclose($fp); - return md5($contents); + return G::encryptOld($contents); } } diff --git a/gulliver/thirdparty/pear/class.wsdlcache.php b/gulliver/thirdparty/pear/class.wsdlcache.php index 4258ea112..048a8a4f3 100755 --- a/gulliver/thirdparty/pear/class.wsdlcache.php +++ b/gulliver/thirdparty/pear/class.wsdlcache.php @@ -53,7 +53,16 @@ class wsdlcache { * @access private */ function createFilename($wsdl) { - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + return $this->cache_dir.'/wsdlcache-' . G::encryptOld($wsdl); } /** @@ -112,15 +121,24 @@ class wsdlcache { * @access private */ function obtainMutex($filename, $mode) { - if (isset($this->fplock[md5($filename)])) { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + if (isset($this->fplock[G::encryptOld($filename)])) { $this->debug("Lock for $filename already exists"); return false; } $this->fplock[md5($filename)] = fopen($filename.".lock", "w"); if ($mode == "r") { - return flock($this->fplock[md5($filename)], LOCK_SH); + return flock($this->fplock[G::encryptOld($filename)], LOCK_SH); } else { - return flock($this->fplock[md5($filename)], LOCK_EX); + return flock($this->fplock[G::encryptOld($filename)], LOCK_EX); } } diff --git a/gulliver/thirdparty/phpmailer/class.phpmailer.php b/gulliver/thirdparty/phpmailer/class.phpmailer.php index 1002df591..830cd592d 100755 --- a/gulliver/thirdparty/phpmailer/class.phpmailer.php +++ b/gulliver/thirdparty/phpmailer/class.phpmailer.php @@ -1360,8 +1360,17 @@ class PHPMailer { public function CreateHeader() { $result = ''; + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } // Set the boundaries - $uniq_id = md5(uniqid(time())); + $uniq_id = G::encryptOld(uniqid(time())); $this->boundary[1] = 'b1_' . $uniq_id; $this->boundary[2] = 'b2_' . $uniq_id; $this->boundary[3] = 'b3_' . $uniq_id; @@ -1777,6 +1786,15 @@ class PHPMailer { $mime = array(); $cidUniq = array(); $incl = array(); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } // Add all attachments foreach ($this->attachment as $attachment) { @@ -1792,7 +1810,7 @@ class PHPMailer { $path = $attachment[0]; } - $inclhash = md5(serialize($attachment)); + $inclhash = G::encryptOld(serialize($attachment)); if (in_array($inclhash, $incl)) { continue; } $incl[] = $inclhash; $filename = $attachment[1]; @@ -2486,6 +2504,15 @@ class PHPMailer { */ public function MsgHTML($message, $basedir = '') { preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } if(isset($images[2])) { foreach($images[2] as $i => $url) { // do not change urls for absolute images (thanks to corvuscorax) @@ -2495,7 +2522,7 @@ class PHPMailer { if ($directory == '.') { $directory = ''; } - $cid = 'cid:' . md5($url); + $cid = 'cid:' . G::encryptOld($url); $ext = pathinfo($filename, PATHINFO_EXTENSION); $mimeType = self::_mime_types($ext); if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; } diff --git a/gulliver/thirdparty/propel/om/BaseObject.php b/gulliver/thirdparty/propel/om/BaseObject.php index 8ef9942e7..df12154c0 100755 --- a/gulliver/thirdparty/propel/om/BaseObject.php +++ b/gulliver/thirdparty/propel/om/BaseObject.php @@ -165,11 +165,20 @@ abstract class BaseObject { */ public function hashCode() { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } $ok = $this->getPrimaryKey(); if ($ok === null) { - return crc32(serialize($this)); + return G::encryptCrc32(serialize($this)); } - return crc32(serialize($ok)); // serialize because it could be an array ("ComboKey") + return G::encryptCrc32(serialize($ok)); // serialize because it could be an array ("ComboKey") } /** diff --git a/gulliver/thirdparty/propel/util/Criteria.php b/gulliver/thirdparty/propel/util/Criteria.php index 802122207..0eeb54262 100755 --- a/gulliver/thirdparty/propel/util/Criteria.php +++ b/gulliver/thirdparty/propel/util/Criteria.php @@ -1669,14 +1669,23 @@ class Criterion { */ public function hashCode() { - $h = crc32(serialize($this->value)) ^ crc32($this->comparison); + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } + $h = G::encryptCrc32(serialize($this->value)) ^ G::encryptCrc32($this->comparison); if ($this->table !== null) { - $h ^= crc32($this->table); + $h ^= G::encryptCrc32($this->table); } if ($this->column !== null) { - $h ^= crc32($this->column); + $h ^= G::encryptCrc32($this->column); } foreach ( $this->clauses as $clause ) { @@ -1687,7 +1696,7 @@ class Criterion { $sb = ''; $params = array(); $clause->appendPsTo($sb,$params); - $h ^= crc32(serialize(array($sb,$params))); + $h ^= G::encryptCrc32(serialize(array($sb,$params))); unset ( $sb, $params ); } diff --git a/gulliver/thirdparty/tcpdf/2dbarcodes.php b/gulliver/thirdparty/tcpdf/2dbarcodes.php index 6490dfa7e..b4cc36744 100644 --- a/gulliver/thirdparty/tcpdf/2dbarcodes.php +++ b/gulliver/thirdparty/tcpdf/2dbarcodes.php @@ -85,6 +85,15 @@ class TCPDF2DBarcode { * @public */ public function getBarcodeSVG($w=3, $h=3, $color='black') { + if(!class_exists('G')){ + $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] ); + $docuroot = explode( '/', $realdocuroot ); + array_pop( $docuroot ); + $pathhome = implode( '/', $docuroot ) . '/'; + array_pop( $docuroot ); + $pathTrunk = implode( '/', $docuroot ) . '/'; + require_once($pathTrunk.'gulliver/system/class.g.php'); + } // send headers $code = $this->getBarcodeSVGcode($w, $h, $color); header('Content-Type: application/svg+xml'); @@ -92,7 +101,7 @@ class TCPDF2DBarcode { header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - header('Content-Disposition: inline; filename="'.md5($code).'.svg";'); + header('Content-Disposition: inline; filename="'.G::encryptOld($code).'.svg";'); //header('Content-Length: '.strlen($code)); echo $code; } diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 634e9a222..d062d39ea 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2868,4 +2868,30 @@ function PMFRemoveMask ($field, $separator = '.', $currency = '') $field = floatval(trim($field)); return $field; +} + +/** + *@method + * + * Sends an array of case variables to a specified case. + * + * @name PMFSaveCurrentData + * @label PMF Save Current Data + * + * @return int | $result | Result of send variables | Returns 1 if the variables were sent successfully to the case; otherwise, returns 0 if an error occurred. + * + */ + +function PMFSaveCurrentData () +{ + global $oPMScript; + $result = 0; + + if (isset($_SESSION['APPLICATION']) && isset($oPMScript->aFields)) { + G::LoadClass( 'wsBase' ); + $ws = new wsBase(); + $result = $ws->sendVariables( $_SESSION['APPLICATION'], $oPMScript->aFields ); + } + + return $result; } \ No newline at end of file diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 3609135d0..58dbe0536 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -1012,9 +1012,11 @@ class wsBase * * @param string $caseId * @param string $iDelIndex + * @param bool $flagUseDelIndex + * * @return $result will return an object */ - public function getCaseInfo ($caseId, $iDelIndex) + public function getCaseInfo($caseId, $iDelIndex, $flagUseDelIndex = false) { try { $oCase = new Cases(); @@ -1057,8 +1059,15 @@ class wsBase $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $oCriteria->add( AppDelegationPeer::APP_UID, $caseId ); - $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); + + if ($flagUseDelIndex) { + $oCriteria->add(AppDelegationPeer::DEL_INDEX, $iDelIndex, Criteria::EQUAL); + } else { + $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + } $oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); $oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); @@ -1096,6 +1105,8 @@ class wsBase $currentUser->delIndex = $aAppDel['DEL_INDEX']; $currentUser->delThread = $aAppDel['DEL_THREAD']; $currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS']; + $currentUser->delInitDate = $aAppDel["DEL_INIT_DATE"]; + $currentUser->delTaskDueDate = $aAppDel["DEL_TASK_DUE_DATE"]; $aCurrentUsers[] = $currentUser; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 7509ff9f3..6f00f414f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -431,40 +431,51 @@ class Cases throw (new \Exception($arrayData)); } } else { + \G::LoadClass("wsBase"); + + //Verify data + $this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID")); + $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX); - $criteria->add(\AppCacheViewPeer::USR_UID, $userUid); - $criteria->add(\AppCacheViewPeer::APP_UID, $applicationUid); - $criteria->add( - //ToDo - getToDo() - $criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "TO_DO", \CRITERIA::EQUAL)->addAnd( - $criteria->getNewCriterion(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd( - $criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd( - $criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN")) - )->addOr( - //Draft - getDraft() - $criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "DRAFT", \CRITERIA::EQUAL)->addAnd( - $criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd( - $criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN")) - ); - $criteria->addDescendingOrderByColumn(\AppCacheViewPeer::APP_NUMBER); - $rsCriteria = \AppCacheViewPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - $row["DEL_INDEX"] = ''; - while ($rsCriteria->next()) { - $row = $rsCriteria->getRow(); + + $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); + $criteria->add(\AppDelegationPeer::APP_UID, $applicationUid); + $criteria->add(\AppDelegationPeer::USR_UID, $userUid); + + $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + + if (!$rsCriteria->next()) { + throw new \Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED")); } - \G::LoadClass('wsBase'); + + //Get data + $arrayStatusInfo = $this->getStatusInfo($applicationUid); + + $applicationStatus = ""; + $delIndex = 0; + $flagUseDelIndex = false; + + if (count($arrayStatusInfo) > 0) { + $applicationStatus = $arrayStatusInfo["APP_STATUS"]; + $delIndex = $arrayStatusInfo["DEL_INDEX"]; + + if (in_array($applicationStatus, array("DRAFT", "PAUSED", "CANCELLED"))) { + $flagUseDelIndex = true; + } + } + $ws = new \wsBase(); - $fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]); + + $fields = $ws->getCaseInfo($applicationUid, $delIndex, $flagUseDelIndex); $array = json_decode(json_encode($fields), true); + if ($array ["status_code"] != 0) { throw (new \Exception($array ["message"])); } else { $array['app_uid'] = $array['caseId']; $array['app_number'] = $array['caseNumber']; $array['app_name'] = $array['caseName']; - $array['app_status'] = $array['caseStatus']; + $array["app_status"] = ($applicationStatus != "")? $applicationStatus : $array["caseStatus"]; $array['app_init_usr_uid'] = $array['caseCreatorUser']; $array['app_init_usr_username'] = trim($array['caseCreatorUserName']); $array['pro_uid'] = $array['processId']; @@ -472,6 +483,9 @@ class Cases $array['app_create_date'] = $array['createDate']; $array['app_update_date'] = $array['updateDate']; $array['current_task'] = $array['currentUsers']; + + $aCurrent_task = array(); + for ($i = 0; $i<=count($array['current_task'])-1; $i++) { $current_task = $array['current_task'][$i]; $current_task['usr_uid'] = $current_task['userId']; @@ -481,6 +495,8 @@ class Cases $current_task['del_index'] = $current_task['delIndex']; $current_task['del_thread'] = $current_task['delThread']; $current_task['del_thread_status'] = $current_task['delThreadStatus']; + $current_task["del_init_date"] = $current_task["delInitDate"] . ""; + $current_task["del_task_due_date"] = $current_task["delTaskDueDate"]; unset($current_task['userId']); unset($current_task['userName']); unset($current_task['taskId']); @@ -551,6 +567,8 @@ class Cases $del = \DBAdapter::getStringDelimiter(); $oCriteria->addSelectColumn( \AppDelegationPeer::DEL_INDEX ); $oCriteria->addSelectColumn( \AppDelegationPeer::TAS_UID ); + $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE); + $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE); $oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' ); $oCriteria->addAlias( "C1", 'CONTENT' ); $tasTitleConds = array (); @@ -568,7 +586,9 @@ class Cases while ($aRow = $oDataset->getRow()) { $result = array ('tas_uid' => $aRow['TAS_UID'], 'tas_title' => $aRow['TAS_TITLE'], - 'del_index' => $aRow['DEL_INDEX']); + 'del_index' => $aRow['DEL_INDEX'], + "del_init_date" => $aRow["DEL_INIT_DATE"] . "", + "del_task_due_date" => $aRow["DEL_TASK_DUE_DATE"]); $oDataset->next(); } //Return @@ -811,6 +831,12 @@ class Cases } Validator::isInteger($del_index, '$del_index'); + $oDelay = new \AppDelay(); + + if (!$oDelay->isPaused($app_uid, $del_index)) { + throw (new \Exception(\G::LoadTranslation("ID_CASE_NOT_PAUSED", array($app_uid)))); + } + $case = new \Cases(); $case->unpauseCase( $app_uid, $del_index, $usr_uid ); } @@ -2205,5 +2231,108 @@ class Cases throw $e; } } + + /** + * Get status info Case + * + * @param string $applicationUid Unique id of Case + * + * return array Return an array with status info Case, array empty otherwise + */ + public function getStatusInfo($applicationUid) + { + try { + //Verify data + $this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID")); + + //Get data + //Status is PAUSED + $delimiter = \DBAdapter::getStringDelimiter(); + + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn($delimiter . "PAUSED" . $delimiter . " AS APP_STATUS"); + $criteria->addSelectColumn(\AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX"); + + $criteria->add(\AppDelayPeer::APP_UID, $applicationUid, \Criteria::EQUAL); + $criteria->add(\AppDelayPeer::APP_TYPE, "PAUSE", \Criteria::EQUAL); + $criteria->add( + $criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, null, \Criteria::ISNULL)->addOr( + $criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL)) + ); + + $rsCriteria = \AppDelayPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Return + return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]); + } + + //Status is TO_DO, DRAFT + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\ApplicationPeer::APP_STATUS); + $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); + + $arrayCondition = array(); + $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL); + $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppThreadPeer::APP_UID, \Criteria::EQUAL); + $arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $criteria->add( + $criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "TO_DO", \Criteria::EQUAL)->addAnd( + $criteria->getNewCriterion(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd( + $criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( + $criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN")) + )->addOr( + $criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "DRAFT", \Criteria::EQUAL)->addAnd( + $criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( + $criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN")) + ); + + $rsCriteria = \ApplicationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Return + return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]); + } + + //Status is CANCELLED, COMPLETED + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\ApplicationPeer::APP_STATUS); + $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); + + $arrayCondition = array(); + $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL); + $arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $criteria->add(\ApplicationPeer::APP_STATUS, array("CANCELLED", "COMPLETED"), \Criteria::IN); + $criteria->add(\AppDelegationPeer::DEL_LAST_INDEX, 1, \Criteria::EQUAL); + + $rsCriteria = \ApplicationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Return + return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]); + } + + //Return + return array(); + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index bc9607d6f..1a8e0fc51 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -24,7 +24,6 @@ class User "USR_STATUS" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("ACTIVE", "INACTIVE", "VACATION"), "fieldNameAux" => "usrStatus"), "USR_ROLE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "usrRole"), "USR_NEW_PASS" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "usrNewPass"), - "USR_CNF_PASS" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "usrCnfPass"), "USR_UX" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("NORMAL", "SIMPLIFIED", "SWITCHABLE", "SINGLE"), "fieldNameAux" => "usrUx"), "DEP_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "depUid"), "USR_BIRTHDAY" => array("type" => "date", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "usrBirthday"), @@ -216,14 +215,6 @@ class User if (isset($arrayData["USR_NEW_PASS"])) { $this->throwExceptionIfPasswordIsInvalid($arrayData["USR_NEW_PASS"], $this->arrayFieldNameForException["usrNewPass"]); - - if (!isset($arrayData["USR_CNF_PASS"])) { - throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayFieldNameForException["usrCnfPass"]))); - } - - if ($arrayData["USR_NEW_PASS"] != $arrayData["USR_CNF_PASS"]) { - throw new \Exception($this->arrayFieldNameForException["usrNewPass"] . ", " . $this->arrayFieldNameForException["usrCnfPass"] . ": " . \G::LoadTranslation("ID_NEW_PASS_SAME_OLD_PASS")); - } } if (isset($arrayData["USR_REPLACED_BY"]) && $arrayData["USR_REPLACED_BY"] != "") { @@ -609,13 +600,13 @@ class User $userProperty = new \UsersProperties(); $aUserProperty = $userProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array(\Bootstrap::hashPassword($arrayData["USR_PASSWORD"]))))); - //$memKey = "rbacSession" . session_id(); - //$memcache = & \PMmemcached::getSingleton(defined("SYS_SYS")? SYS_SYS : ""); - // - //if (($rbac->aUserInfo = $memcache->get($memKey)) == false) { - // $rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged); - // $memcache->set($memKey, $rbac->aUserInfo, \PMmemcached::EIGHT_HOURS); - //} + $memKey = "rbacSession" . session_id(); + $memcache = & \PMmemcached::getSingleton(defined("SYS_SYS")? SYS_SYS : ""); + + if (($rbac->aUserInfo = $memcache->get($memKey)) == false) { + $rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged); + $memcache->set($memKey, $rbac->aUserInfo, \PMmemcached::EIGHT_HOURS); + } if ($rbac->aUserInfo["PROCESSMAKER"]["ROLE"]["ROL_CODE"] == "PROCESSMAKER_ADMIN") { $aUserProperty["USR_LAST_UPDATE_DATE"] = date("Y-m-d H:i:s"); @@ -651,7 +642,7 @@ class User $sDescription = $sDescription . " - " . G::LoadTranslation("PASSWORD_HISTORY") . ": " . PPP_PASSWORD_HISTORY . "\n"; $sDescription = $sDescription . "\n" . G::LoadTranslation("ID_PLEASE_CHANGE_PASSWORD_POLICY") . ""; - throw new \Exception($this->arrayFieldNameForException["usrNewPass"] . ", " . $this->arrayFieldNameForException["usrCnfPass"] . ": " . $sDescription); + throw new \Exception($this->arrayFieldNameForException["usrNewPass"] . ": " . $sDescription); } if (count($aHistory) >= PPP_PASSWORD_HISTORY) { diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php index f90643fee..00c92a0f6 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php @@ -599,12 +599,12 @@ class Cases extends Api public function doGetCaseInfo($app_uid) { try { - $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); - $oData = $cases->getCaseInfo($app_uid, $userUid); - return $oData; + $case = new \ProcessMaker\BusinessModel\Cases(); + $case->setFormatFieldNameInUppercase(false); + + return $case->getCaseInfo($app_uid, $this->getUserId()); } catch (\Exception $e) { - throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/User.php b/workflow/engine/src/ProcessMaker/Services/Api/User.php index 28d578bf3..6a2fb83c4 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/User.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/User.php @@ -75,8 +75,6 @@ class User extends Api $userLoggedUid = $this->getUserId(); $user = new \ProcessMaker\BusinessModel\User(); $arrayData = $user->update($usr_uid, $request_data, $userLoggedUid); - $response = $arrayData; - return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -113,4 +111,3 @@ class User extends Api } } } - diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index 9a85d0a5a..9c74bd208 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -204,7 +204,7 @@ class Server implements iAuthenticate $clientId = $_GET['client_id']; $requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '*'; $requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope); - $client = $this->storage->getClientDetails($clientId);; + $client = $this->storage->getClientDetails($clientId); if (empty($client)) { // throw error, client does not exist. @@ -309,7 +309,17 @@ class Server implements iAuthenticate if ($returnResponse) { return $response; } else { - $response->send(); + if ($response->getStatusCode() == 400) { + $msg = $response->getParameter("error_description", ""); + $msg = ($msg != "")? $msg : $response->getParameter("error", ""); + + $rest = new \Maveriks\Extension\Restler(); + $rest->setMessage(new \Luracast\Restler\RestException(\ProcessMaker\Services\Api::STAT_APP_EXCEPTION, $msg)); + + exit(0); + } else { + $response->send(); + } } } diff --git a/workflow/engine/xmlform/login/forgotPassword.xml b/workflow/engine/xmlform/login/forgotPassword.xml index f33c100fa..015f67cc1 100755 --- a/workflow/engine/xmlform/login/forgotPassword.xml +++ b/workflow/engine/xmlform/login/forgotPassword.xml @@ -3,10 +3,10 @@
| {$form.TITLE} | @@ -15,8 +16,8 @@{$form.USR_USERNAME} | ||
| {$USR_PASSWORD} | -{$form.USR_PASSWORD} | +{$USR_PASSWORD_MASK} | +{$form.USR_PASSWORD_MASK} |
| {$USER_LANG} | @@ -37,12 +38,10 @@|||