Ejemplo n.º 1
0
/**
 * this function get the fields that are part of the temporal
 * dynaform file.
 *
 * @name getTemporalFields
 * @author gustavo cruz
 * @access public
 * @param $file - the name of the dynaform file
 * @return invalidFields string
 */
function getTemporalFields($file)
{
    try {
        //$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
        $i = 0;
        $aFields = array();
        $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
        $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml'));
        $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
        $iMaximun = $oDataset->count();
        while ($aRow = $oDataset->Read()) {
            $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
            $i++;
        }
        // print_r($aFields);
        // die;
    } catch (Exception $e) {
    }
    $invalidFields = validateGridConversion($aFields);
    if (count($invalidFields) > 0) {
        return implode(", ", $invalidFields);
    } else {
        return "ok";
    }
}
Ejemplo n.º 2
0
function createUser($userName, $authSource, $dn, $fullname, $email, $roles)
{
    global $DB_MODULE;
    // :(
    G::LoadClassRBAC('user');
    $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
    $obj = new RBAC_User();
    $obj->SetTo($dbc);
    //is ProcessMaker?
    $isPM = false;
    foreach ($DB_MODULE as $index => $module) {
        if ($module = 'ProcessMaker') {
            $isPM = true;
        }
    }
    if ($isPM) {
        $dbcPM = new DBConnection(DB_HOST, DB_USER, DB_PASS, DB_NAME);
        $sesPM = new DBSession($dbcPM);
    }
    $res = $obj->UserNameRepetido(0, $userName);
    if ($res != 0) {
        $result = "-1";
    } else {
        $aux = explode(' ', $fullname);
        $last = str_replace($aux[0] . ' ', '', $fullname);
        $uid = $obj->createUser($last, '', $aux[0], $email);
        $result = $obj->createUserName($uid, $userName, 'LDAP');
        $obj->updateLDAP($uid, $authSource, $dn);
        $rol = explode(',', $roles);
        foreach ($rol as $key => $val) {
            if ($val != 0) {
                $obj->assignUserRole($uid, $val);
            }
        }
        if ($isPM) {
            $sql = "insert into USER (UID, USR_USER_NAME, USR_LASTNAME, USR_MIDNAME, USR_FIRSTNAME, USR_EMAIL) VALUES ( " . $uid . ", '" . $userName . "', '" . $last . "','', '" . $aux[0] . "', '" . $email . "' ) ";
            //$f =fopen ( '/shared/security.log', "a+" );fwrite ( $f, date("Y-m-d h:i:s") . "$isPM $sql \n" );  fclose ($f);
            $sesPM->Execute($sql);
        }
    }
    header("Content-Type: text/xml");
    print '<?xml version="1.0" encoding="UTF-8"?>';
    print '<data>';
    print "<value>{$result}</value>";
    print '</data>';
}
Ejemplo n.º 3
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
$G_MAIN_MENU = "rbac";
$G_SUB_MENU = "rbac.userEdit";
$G_MENU_SELECTED = 0;
$uid = $HTTP_SESSION_VARS['CURRENT_USER'];
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession($dbc);
$stQry = "SELECT UID, USR_USE_LDAP FROM USERS where UID = {$uid} ";
$dset = $ses->Execute($stQry);
$row = $dset->Read();
$useLdap = $row['USR_USE_LDAP'] == 'Y';
$access = $RBAC->userCanAccess("RBAC_CREATE_USERS");
G::LoadClassRBAC("user");
$obj = new RBAC_User();
$obj->SetTo($dbc);
$obj->Load($uid);
$G_PUBLISH = new Publisher();
$G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent("xmlform", "xmlform", "rbac/userChangeLdap", "", $obj->Fields, "userChangeLdap2");
G::RenderPage("publish");
Ejemplo n.º 4
0
                                     TU.USR_UID = U.USR_UID
                                 )
                                 WHERE
                                     TU.TAS_UID     = '" . $_POST['TAS_UID'] . "' AND
                                     TU.TU_TYPE     = 1 AND
                                     TU.TU_RELATION = 1 AND
                                     U.USR_STATUS   = 1");
     */
     $sDataBase = 'database_' . strtolower(DB_ADAPTER);
     if (G::LoadSystemExist($sDataBase)) {
         G::LoadSystem($sDataBase);
         $oDataBase = new database();
         $sConcat = $oDataBase->concatString("U.USR_LASTNAME", "' '", "U.USR_FIRSTNAME");
     }
     $sSQL = "   SELECT\n                                    TU.USR_UID AS USR_UID, " . $sConcat . " AS USR_FULLNAME\n                                FROM\n                                    TASK_USER AS TU\n                                    LEFT JOIN\n                                    USERS AS U\n                                    ON (\n                                        TU.USR_UID = U.USR_UID\n                                    )\n                                WHERE\n                                    TU.TAS_UID     = '" . $_POST['TAS_UID'] . "' AND\n                                    TU.TU_TYPE     = 1 AND\n                                    TU.TU_RELATION = 1 AND\n                                    U.USR_STATUS   = 1";
     $oDataset = $oSession->Execute($sSQL);
     while ($aRow = $oDataset->Read()) {
         $sAux .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_FULLNAME'] . '</option>';
     }
     $sAux .= '</select>';
     echo $sAux;
     break;
 case 'EVALUATE':
     G::LoadClass('application');
     $oApplication = new Application(new DBConnection());
     $oApplication->load($_SESSION['APPLICATION']);
     $sUser = '';
     if ($_POST['TAS_ASSIGN_VARIABLE'] != '') {
         if (isset($oApplication->Fields['APP_DATA'][str_replace('@@', '', $_POST['TAS_ASSIGN_VARIABLE'])])) {
             $sUser = $oApplication->Fields['APP_DATA'][str_replace('@@', '', $_POST['TAS_ASSIGN_VARIABLE'])];
         }
Ejemplo n.º 5
0
 /**
  *
  * @author Fernando Ontiveros Lira <*****@*****.**>
  * @access public
  * @param string $permission
  * @param string $urlNoAccess
  * @return void
  */
 public function forceLogin($permission = "", $urlNoAccess = "")
 {
     global $RBAC;
     if (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] == '') {
         $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS;
         $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG;
         $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN;
         $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login'), URL_KEY) : 'login';
         $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login.html'), URL_KEY) : 'login.html';
         $direction = "/{$sys}/{$lang}/{$skin}/{$login}/{$loginhtml}";
         die;
     }
     $Connection = new DBConnection();
     $ses = new DBSession($Connection);
     $stQry = "SELECT LOG_STATUS FROM LOGIN WHERE LOG_SID = '" . session_id() . "'";
     $dset = $ses->Execute($stQry);
     $row = $dset->read();
     $sessionPc = defined('SESSION_PC') ? SESSION_PC : '';
     $sessionBrowser = defined('SESSION_BROWSER') ? SESSION_BROWSER : '';
     if ($sessionPc == "1" or $sessionBrowser == "1") {
         if ($row['LOG_STATUS'] == 'X') {
             $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS;
             $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG;
             $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN;
             $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login'), URL_KEY) : 'login';
             $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode('login.html'), URL_KEY) : 'login.html';
             $direction = "/{$sys}/{$lang}/{$skin}/{$login}/{$loginhtml}";
             G::SendMessageXml('ID_CLOSE_SESSION', "warning");
             header("location: {$direction}");
             die;
             return;
         }
     }
     if (defined('SIN_COMPATIBILIDAD_RBAC') and SIN_COMPATIBILIDAD_RBAC == 1) {
         return;
     }
     if ($permission == "") {
         return;
     }
     if (is_array($permission)) {
         $aux = $permission;
     } else {
         $aux[0] = $permission;
     }
     $sw = 0;
     for ($i = 0; $i < count($aux); $i++) {
         $res = $RBAC->userCanAccess($aux[$i]);
         if ($res == 1) {
             $sw = 1;
         }
     }
     if ($sw == 0 && $urlNoAccess != "") {
         $aux = explode('/', $urlNoAccess);
         $sys = ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "/sys" . SYS_LANG;
         $lang = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_LANG), URL_KEY) : SYS_LANG;
         $skin = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode(SYS_SKIN), URL_KEY) : SYS_SKIN;
         $login = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode($aux[0]), URL_KEY) : $aux[0];
         $loginhtml = ENABLE_ENCRYPT == 'yes' ? G::encrypt(urldecode($aux[1]), URL_KEY) : $aux[1];
         //header ("location: /$sys/$lang/$skin/$login/$loginhtml");
         header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw");
         die;
     }
     if ($sw == 0) {
         header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw");
         die;
     }
 }
Ejemplo n.º 6
0
 /**
  * Prints the DynaformEditor
  *
  * @return void
  */
 public function _render()
 {
     global $G_PUBLISH;
     $script = '';
     /* Start Block: Load (Create if doesn't exist) the xmlform */
     $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor);
     $_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
     $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '');
     $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY));
     $A = G::encrypt($this->file, URL_KEY);
     try {
         $openDoc = new Xml_Document();
         $fileName = $this->home . $this->file . '.xml';
         if (file_exists($fileName)) {
             $openDoc->parseXmlFile($fileName);
         } else {
             $this->_createDefaultXmlForm($fileName);
             $openDoc->parseXmlFile($fileName);
         }
         //$form = new Form( $this->file , $this->home, SYS_LANG, true );
         $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid);
         /* Start Block: Prepare the XMLDB connection */
         define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
         define('DB_XMLDB_USER', '');
         define('DB_XMLDB_PASS', '');
         define('DB_XMLDB_NAME', '');
         define('DB_XMLDB_TYPE', 'myxml');
         /* Start Block: Prepare the dynaformEditor */
         $G_PUBLISH = new Publisher();
         $sName = 'dynaformEditor';
         $G_PUBLISH->publisherId = $sName;
         $oHeadPublisher =& headPublisher::getSingleton();
         $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
         $G_PUBLISH->AddContent('blank');
         $this->panelConf['title'] = '';
         $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
         if ($Properties['DYN_TYPE'] == 'xmlform') {
             $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
         } else {
             $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
         }
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
         $G_PUBLISH->AddContent('blank');
         $i = 0;
         $aFields = array();
         $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
         $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
         $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
         $iMaximun = $oDataset->count();
         while ($aRow = $oDataset->Read()) {
             $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
             $i++;
             break;
         }
         global $_DBArray;
         $_DBArray['fields'] = $aFields;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('fields');
         /**
          * *@Erik-> this is deprecated,.
          * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
          */
         $G_PUBLISH->AddContent('blank');
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
     } catch (Exception $e) {
     }
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
     //for showHide tab option @Neyek
     $G_PUBLISH->AddContent('blank');
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
     if ($Properties['DYN_TYPE'] != 'grid') {
         $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
     }
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
     if ($Properties["DYN_TYPE"] != "grid") {
         $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
     }
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
     //for showHide tab option @Neyek
     if ($Properties["DYN_TYPE"] != "grid") {
         $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide");
     }
     $G_PUBLISH->AddContent('panel-close');
     $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js", 2);
     $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
     //$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js');
     //$oHeadPublisher->addScriptFile('/codepress/codepress.js',1);
     $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js', 1);
     $oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
     $oHeadPublisher->addScriptCode('
     var DYNAFORM_URL="' . $Parameters['URL'] . '";
     leimnud.event.add(window,"load",function(){ loadEditor(); });
     ');
     $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLogged__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";');
     $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($Parameters) . '\';');
     G::RenderPage("publish", 'blank');
 }
Ejemplo n.º 7
0
    public function getCurrentDelegationCase($sApplicationUID = '')

    {

        $oSession = new DBSession(new DBConnection());

        $oDataset = $oSession->Execute('

            SELECT

            DEL_INDEX

            FROM

            APP_DELEGATION

            WHERE

            APP_UID = "' . $sApplicationUID . '"

            ORDER BY DEL_DELEGATE_DATE DESC

        ');

        $aRow = $oDataset->Read();

        return $aRow['DEL_INDEX'];

    }
Ejemplo n.º 8
0
function walkLevel($level, $label, $parent)
{
    global $collapsed;
    global $appid;
    global $dbc;
    $sql = "SELECT UID, PRM_CODE, PRM_DESCRIPTION from PERMISSION WHERE PRM_APPLICATION = {$appid} AND PRM_PARENT = " . $parent;
    $ses = new DBSession($dbc);
    $dset = $ses->Execute($sql);
    $row = $dset->Read();
    $c = 1;
    while (is_array($row)) {
        if ($label === "*") {
            $label = "";
            $locLabel = $c;
        } else {
            $locLabel = $label . "." . $c;
        }
        showLevel($level, $locLabel, $row['PRM_CODE'], $row['PRM_DESCRIPTION'], $row['UID']);
        walkLevel($level + 1, $locLabel, $row['UID']);
        $c++;
        $row = $dset->Read();
    }
}
Ejemplo n.º 9
0
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
<?php 
$frm = $HTTP_POST_VARS;
$dbc = new dbconnection();
$ses = new DBSession($dbc);
$sql = "update tickets set tipo = ' " . $frm['tipo'] . "', resultado = ' " . $frm['curso'] . "' where ticket =  '" . $frm['ticket'] . "' ";
$ses->Execute($sql);
?>
<script language = "JavaScript">
  window.close();
 
</script>


Ejemplo n.º 10
0
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = '******' );
G::LoadClass('dynaFormField');
if (!(isset($_POST['A']) && $_POST['A'] !== '')) {
    return;
}
$file = G::decrypt($_POST['A'], URL_KEY);
$dbc = new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml');
$ses = new DBSession($dbc);
$fields = new DynaFormField($dbc);
if (!isset($_POST['XMLNODE_NAME'])) {
    return;
}
$fields->Delete($_POST['XMLNODE_NAME']);
G::LoadClass('xmlDb');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )');
$iMaximun = $oDataset->count();
while ($aRow = $oDataset->Read()) {
    $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '');
    $i++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
Ejemplo n.º 11
0
 /**
  * Obtains number of elements of asociated query
  *
  * @author Fernando Ontiveros Lira <*****@*****.**>
  * @access public
  * @return int
  */
 function TotalCount()
 {
     global $HTTP_GET_VARS;
     global $HTTP_SESSION_VARS;
     $stQry = $this->_source;
     if ($this->WhereClause != "") {
         $stQry .= " WHERE " . $this->WhereClause;
     }
     if ($this->_ordered == true) {
         $stOrderBy = isset($HTTP_GET_VARS[$this->orderprefix . 'order']) ? $HTTP_GET_VARS[$this->orderprefix . 'order'] : '';
         if ($stOrderBy == "") {
             if ($this->DefaultOrder != "") {
                 $stQry .= " ORDER BY " . $this->DefaultOrder;
             }
         } else {
             $stQry .= " ORDER BY " . $stOrderBy;
         }
     } else {
         if ($this->DefaultOrder != "") {
             $stQry .= " ORDER BY " . $this->DefaultOrder;
         }
     }
     $dbses = new DBSession($this->_dbc);
     $dbses->UseDB(DB_NAME);
     $dset = $dbses->Execute($stQry);
     return $dset->Count();
 }
Ejemplo n.º 12
0
global $G_ENVIRONMENTS;
if (isset($G_ENVIRONMENTS)) {
    $dbfile = $G_ENVIRONMENTS[G_TEST_ENV]['dbfile'];
    if (!file_exists($dbfile)) {
        printf("%s \n", pakeColor::colorize("dbfile {$dbfile} doesn't exist for environment " . G_ENVIRONMENT, 'ERROR'));
        exit(200);
    } else {
        include $dbfile;
    }
} else {
    exit(201);
}
require_once PATH_GULLIVER . 'class.dbconnection.php';
require_once PATH_GULLIVER . 'class.dbsession.php';
require_once PATH_GULLIVER . 'class.dbrecordset.php';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$dset = $ses->Execute("SELECT * from APPLICATION");
$method = array();
$testItems = 0;
$methods = get_class_methods('DBRecordSet');
$t = new lime_test(8, new lime_output_color());
$t->diag('class DBRecordset');
$t->is(count($methods), 6, "class G " . count($methods) . " methods.");
$t->isa_ok($dset, 'DBRecordSet', 'class DBRecordset created');
$t->can_ok($dset, 'SetTo', 'SetTo()');
$t->can_ok($dset, 'Free', 'Free()');
$t->can_ok($dset, 'Count', 'Count()');
$t->can_ok($dset, 'Read', 'Read()');
$t->can_ok($dset, 'ReadAbsolute', 'ReadAbsolute()');
$t->todo('review all pendings in this class');
Ejemplo n.º 13
0
/**
 * loadRoleProp.php
 *  
 * ProcessMaker Open Source Edition
 * Copyright (C) 2004 - 2008 Colosa Inc.23
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
$_SESSION['CURRENT_ROLE'] = $_GET['ROL_UID'];
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession();
$ses->SetTo($dbc);
$dset = $ses->Execute('SELECT ROL_APPLICATION FROM USER_ROLE LEFT JOIN ROLE ON (ROL_UID = UID) WHERE ROL_UID = ' . $_SESSION['CURRENT_ROLE']);
$row = $dset->Read();
$_SESSION['CURRENT_APPLICATION'] = $row['ROL_APPLICATION'];
header('location: userRoleProp.htm');
Ejemplo n.º 14
0
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
G::GenericForceLogin('RBAC_LOGIN', 'login/noViewPage', 'login/login');
$G_MAIN_MENU = 'rbac';
$G_SUB_MENU = 'rbac.userEdit';
$G_MENU_SELECTED = 0;
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession($dbc);
$dset = $ses->Execute('SELECT UID, USR_USE_LDAP FROM USERS where UID = ' . $_SESSION['CURRENT_USER']);
$row = $dset->Read();
$useLdap = $row['USR_USE_LDAP'] == 'Y';
$access = $RBAC->userCanAccess('RBAC_CREATE_USERS');
G::LoadClassRBAC('user');
$obj = new RBAC_User();
$obj->SetTo($dbc);
$obj->Load($_SESSION['CURRENT_USER']);
$G_PUBLISH = new Publisher();
$G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/userEdit', '', $obj->Fields, 'userEdit2');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/userChangePwd', '', $obj->Fields, 'userChangePwd2');
$G_PUBLISH->AddContent('xmlform', 'pagedTable', 'rbac/usersRolesList', '', array('CURRENT_USER' => $_SESSION['CURRENT_USER']), '');
G::RenderPage('publish');
?>
<script language='Javascript'>
Ejemplo n.º 15
0
function LoadOptions($stQry, $dbc)
{
    $stQry = str_replace("''''", "''", $stQry);
    //cuando la conexion es normal... se intenta realizar el query
    $dses = new DBSession();
    $dses->SetTo($dbc);
    $dses->UseDB(DB_NAME);
    $dset = $dses->Execute($stQry, false, 3);
    $data = $dset->ReadAbsolute();
    while ($data) {
        $key = $data[0];
        $val = $data[1];
        $result[$key] = $val;
        $data = $dset->ReadAbsolute();
    }
    return $result;
}
Ejemplo n.º 16
0
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
$rolid = isset($_GET['ROL_UID']) ? $_GET['ROL_UID'] : '';
if ($rolid != "") {
    $_SESSION['CURRENT_ROLE'] = $rolid;
}
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession();
$ses->SetTo($dbc);
$sql = "select ROL_APPLICATION FROM USER_ROLE LEFT JOIN ROLE ON (ROL_UID = UID) WHERE ROL_UID = {$rolid} ";
$dset = $ses->Execute($sql);
$row = $dset->Read();
if (is_array($row)) {
    $_SESSION['CURRENT_APPLICATION'] = $row['ROL_APPLICATION'];
}
header("location: roleProp.htm");