function getPlanState($workflowID, $formName) { $table = 'workflowState'; $where = 'workflowid=' . $workflowID; $field = 'state'; $workflowPlan = dbs::selrecord($field, $table, $where, false, 2); return unserialize(stripslashes($workflowPlan[0])); }
function getallmembers($groupid) { $field = 'members'; $resultsarray = array(); if (is_array($groupid)) { foreach ($groupid as $group) { $result = dbs::selrecord($field, 'groups', 'groupid=' . $group, '0', '1'); $memberlist = arrays::array_explode($result[$field], ','); if ($memberslist) { array_merge($resultsarray, $memberlist); } } } else { $result = dbs::selrecord($field, 'groups', 'groupid=' . $groupid, '0', '1'); $resultsarray = arrays::array_explode($result[$field], ','); } return $resultsarray; }
/** * @return Boolean * @param String $mode * @param String $username * @param String $password * @desc Checks the users password and if valid adds their username to the session */ function authenticateLogin($mode, $username, $password) { if ($mode == 'login') { // encode password to check against what's stored in the db //$password = dbs::passencdec($password,$salt,'1'); // query database to authenticate user - check username / password combo $result = dbs::selrecord('*', 'users', "username = '******' and password = '******'", '0', '1'); // check if an entry exists in the db if (sizeof($result)) { // password/username authenticated - register the user session $_SESSION['valid_user'] = $result[0]['username']; $_SESSION['authentic_user'] = true; return true; } else { return false; } } else { return false; } }
} if (!isset($start)) { // record number to start the query from $start = 0; } // limit the number of records returned $end = 10; if ($mode == 'preview') { $check = dbs::selrecord('*', $table, $sql, '0', '0'); $count = dbs::numrecords($check); $result = dbs::selrecord('*', $table, $sql, 'name ASC LIMIT ' . $start . ',' . $end, '0'); $final = dbs::numrecords($result); } else { $check = dbs::selrecord('*', $table, '0', '0', '0'); $count = dbs::numrecords($check); $result = dbs::selrecord('*', $table, '0', 'name ASC LIMIT ' . $start . ',' . $end, '0'); $final = dbs::numrecords($result); } if ($count > 0) { hr(2); ?> <tr> <td class="bodybold">GROUPNAME</td><td class="bodybold" align="right">ACTIONS</td> </tr> <?php while ($row = dbs::fetchrecord($result)) { hr(2); ?> <tr> <td valign="top" class="bodybold" title="ID: <?php echo $row[$key];
saveCachePlans($planGraphList, $keyinserted, $modelId); } else { savePlans($planGraphList, $keyinserted, true); } $newstoptime = time::stoptiming() - $stoptime; performance::message("Database updating"); echo '<br><Br>'; systemMessages::message("Plan generation complete!"); systemMessages::message("Number of plans:" . sizeof($planGraphList)); } } else { $workFlowvalues = array(); $workFlowvalues['timestamp'] = $modified = time::ts_unix_mysql(time::timestamp()); //Create a new workflow item $keyinserted = dbs::irrecord('workflow', $workFlowvalues, false); $planGraphList = dbs::selrecord('plan', 'workflowcachingstore', "modelId={$modelId}", 0, 3); savePlans($planGraphList, $keyinserted, false); echo '<br><Br>'; systemMessages::message("Plan generation using caching feature complete!"); systemMessages::message("Number of plans:" . sizeof($planGraphList)); } function savePlans($planGraphList, $workflowKey, $seralise) { $planValues = array(); $dbValues = array(); for ($index = 0; $index < sizeof($planGraphList); $index++) { if ($seralise) { $plan = addslashes(serialize($planGraphList[$index])); } else { $plan = addslashes($planGraphList[$index]); }
<?php if (${$key} != 'new') { // it's an existing record so pull the details from the db $row = dbs::selrecord('*', $table, $key . '=' . ${$key}, '0', '1'); //print_r($row); } ?> <table border="0" cellspacing="1" cellpadding="1" width="100%"> <tr> <td class="bodybold" colspan="2"><a href="<?php echo $pageref; ?> ">Groups</a> <?php if (${$key} != 'new') { // this is not a new record echo " ~ " . string::up($row[$identifier]); } ?> </td> </tr> <?php hr(2); if (isset($mesg)) { html_displaymesg($mesg, 2); } ?>
function displayWorkflow($workflowID) { $data['text1'] = dbs::selrecord('text1', 'text1', 'workflowid=' . $workflowID, 0, 3); $data['text2'] = dbs::selrecord('text2', 'text2', 'workflowid=' . $workflowID, 0, 3); html_display($data, $workflowID); }
function displayArchiveItem($xmlPackage, $workflowId, $table, $title, $mode) { global $db; $workflowIDs = array($workflowId); $workflowTimestamp = dbs::selrecord('timestamp', $table, 'workflowId=' . $workflowId, 0, 3); $db = connect($xmlPackage->getDb()); debug::message("connect to db:" . $xmlPackage->getDb()); workflowDisplayHTML::archiveTableHead($xmlPackage->getDisplayFields(), "", $title); xmlPackage::__testDatabaseFields($workflowIDs, $workflowTimestamp, $xmlPackage, $mode); //workflowDisplayHTML::tableMainOpen(); workflowDisplayHTML::tableMainClose(); $db = connect('iWFMS'); }
/** * @return String * @param String $table * @desc return the primary key of table */ function getprimarykey($table) { $result = dbs::selrecord('*', $table, '0', '0', '0'); $i = 0; while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result); if (!$meta) { errors::errorMessage("No information available<br />\n"); mysql_free_result($result); return false; } //multiple_key: $meta->multiple_key //primary_key: $meta->primary_key //unique_key: $meta->unique_key if (!$meta->multiple_key && $meta->primary_key) { $primkey = $meta->name; mysql_free_result($result); return $primkey; } elseif ($meta->multiple_key) { errors::errorMessage('Support for multiple keys is not setup'); } $i++; } }
/** * @return unknown * @param unknown $name * @param unknown $dbfield * @param unknown $current * @param unknown $datasource * @param unknown $populate * @param unknown $where * @param unknown $orderby * @desc get the data for multiple radio buttons */ function getdata_radiobtns($name, $dbfield, $current, $datasource, $populate, $where, $orderby) { if (!is_array($datasource)) { // populate values from a database table //$datasource = table //$populate = display $default = true; // first item assumed default $index = 0; $radios = dbs::selrecord($dbfield . ',' . $populate, $datasource, $where, $orderby, '0'); while ($radio = dbs::fetchrecord($radios)) { $result[$index]['radiobtn'] = formdata::getdata_radiobtn($name, $current, $radio[$dbfield], $radio[$populate], $default); $default = false; $index++; } } else { // populate values from an array if (sizeof($datasource) != 0) { $default = true; // first item assumed default $index = 0; foreach ($datasource as $populateitem) { $result[$index]['radiobtn'] = formdata::getdata_radiobtn($name, $current, $populateitem, $populate[$index], $default); $default = false; $index++; } } else { $result = false; } } return $result; }
function testDatabaseSelect() { $db = connect('iWFMS'); $result = dbs::selrecord('*', 'users', 0, 0, 1); $this->assertNotNull($result); }