function sql($m) { /*{{{*/ require_once 'api/function.sqlquery.php'; if ($m->getNumParams() > 1) { $error = "Invalid number of parameters. SQL query required"; return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'], $error); } $db = $GLOBALS['dsn'] . $GLOBALS['datadb']; // get the SQL statement $query = $m->getParam(0); // return an error if the query is not allowed if (!ereg("^(select|show|describe) ", strtolower($query->scalarval()))) { $error = 'Invalid query, only "SELECT", "SHOW", or "DESCRIBE" statements are accepted'; return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'], $error); } // perform the query $result = @sqlquery($db, $query->scalarval(), true); if (is_object($result) && DB::isError($result)) { $error = $result->getCode() . ": " . $result->getMessage(); return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'], $error); } $res = db2XMLRPC($result); return new XML_RPC_Response($res); }
function buildVariableEnv($uid, $gid, $tid, &$vardisp, &$bounds, &$privilege, &$tree, &$condensed, &$autoDisplay) { $result = sqlquery("SELECT view_row.name AS user_name, variable.name AS var_name, path, warning_bound, error_bound, alarm_order, view_row.filter as varfilter, view_table.filter as viewfilter, display, auto_display, view_row.vid AS vid " . "FROM variable, view_row, view_table " . "WHERE variable.command='variable' AND (view_table.uid='{$uid}' OR view_table.uid='{$gid}') AND view_table.tid='{$tid}' AND view_row.tid='{$tid}' AND variable.vid=view_row.vid ORDER BY view_row.ordering"); while ($result && ($arr = sqlfetch($result))) { $vid = $arr["vid"]; if (!hasAccessToVariable($vid)) { continue; } $path = $arr["path"]; if ($arr["varfilter"] != "" && ($path = filterPath($path, $arr["varfilter"])) == "") { continue; } if ($arr["viewfilter"] != "" && ($path = filterPath($path, $arr["viewfilter"])) == "") { continue; } $condensed = $arr["display"] == "condensed"; $autoDisplay = $arr["auto_display"] == "auto"; $varName = getVarName($path); $vardisp[$varName] = $arr["user_name"]; $bounds[$varName] = array($arr["warning_bound"], $arr["error_bound"], $arr["alarm_order"]); $privilege[$varName] = getVariableRight($vid); $address = explode(".", $path); //echo "add to tree address $path<br>\n"; if (!isset($numsteps)) { $numsteps = count($address); } if ($numsteps != count($address)) { echo "Invalid table <b>{$tid}</b>, contains different variable path length (typically, mixed shard/server/service variables with entity variables)\n"; return; } addToNode($tree, $address, 0); } }
function __construct($gateway_override = false) { $s = BigTreeAdmin::getSetting("bigtree-internal-payment-gateway"); // Setting doesn't exist? Create it. if ($s === false) { sqlquery("INSERT INTO bigtree_settings (`id`,`system`,`encrypted`) VALUES ('bigtree-internal-payment-gateway','on','on')"); $s = array("service" => "", "settings" => array()); BigTreeAdmin::updateSettingValue("bigtree-internal-payment-gateway", $s); } // If for some reason the setting doesn't exist, make one. $this->Service = isset($s["value"]["service"]) ? $s["value"]["service"] : ""; $this->Settings = isset($s["value"]["settings"]) ? $s["value"]["settings"] : array(); // If you specifically request a certain service, use it instead of the default if ($gateway_override) { $this->Service = $gateway_override; } if ($this->Service == "authorize.net") { $this->setupAuthorize(); } elseif ($this->Service == "paypal") { $this->setupPayPal(); } elseif ($this->Service == "paypal-rest") { $this->setupPayPalREST(); } elseif ($this->Service == "payflow") { $this->setupPayflow(); } elseif ($this->Service == "linkpoint") { $this->setupLinkPoint(); } }
function getShardLockState() { global $shardLockState, $uid, $REMOTE_ADDR, $enablelock, $shardList; global $ASHost, $ASPort; $shardLockState = array(); if (count($shardList) > 0) { foreach ($shardList as $shard => $s) { $shardLockState[$shard]['lock_state'] = $enablelock ? 0 : 1; } } $result = sqlquery("SELECT * FROM shard_annotation"); while ($result && ($arr = sqlfetch($result))) { if ($enablelock) { if ($arr['lock_user'] == 0) { $lockState = 0; // unlocked } else { if ($arr['lock_user'] == $uid && $arr['lock_ip'] == $REMOTE_ADDR) { $lockState = 1; // locked by user } else { $lockState = 2; // locked by another user } } } else { $lockState = 1; } $shardLockState[$arr['shard']] = array('user_annot' => $arr['user'], 'annot' => htmlentities($arr['annotation'], ENT_QUOTES), 'post_date' => $arr['post_date'], 'lock_user' => $arr['lock_user'], 'lock_ip' => $arr['lock_ip'], 'lock_date' => $arr['lock_date'], 'lock_state' => $lockState, 'ASAddr' => $arr['ASAddr'], 'alias' => $arr['alias']); } }
function loghistory($link, $userid, $ip, $ua, $outcome) { $sql = "SELECT max(`id`) AS `m` FROM `history`"; $res = sqlquery($sql, $link); $r = $res->fetch(PDO::FETCH_ASSOC); $i = $r == FALSE ? 0 : (int) $r['m'] + 1; $sql = "INSERT INTO `history` VALUES (?,?,?,?,?,CURRENT_TIMESTAMP)"; $res = sqlexec($sql, array($i, $userid, $ip, $ua, $outcome), $link); }
function selectorder($conn, $select, $from, $where, $order) { if ($where == "") { $where = "1=1"; } if ($where == "") { $where = "1=1"; } return sqlquery($conn, "SELECT " . $select . " FROM " . $from . " WHERE " . $where . " ORDER BY " . $order); }
function delete_old_process($link) { $ret = sqlquery('SELECT * FROM `process` where 1', $link); while ($i = $ret->fetch(PDO::FETCH_ASSOC)) { if (!pstatus($i['pid'])) { sqlexec('DELETE FROM `process` where pid=?', array($i['pid']), $link); deldir('qqbot/' . $i['id']); } } }
function __construct() { $s = BigTreeAdmin::getSetting("bigtree-internal-email-service"); // Setting doesn't exist? Create it. if ($s === false) { sqlquery("INSERT INTO bigtree_settings (`id`,`system`,`encrypted`) VALUES ('bigtree-internal-email-service','on','on')"); $s = array("service" => "", "settings" => array()); BigTreeAdmin::updateSettingValue("bigtree-internal-email-service", $s); } $this->Service = !empty($s["value"]["service"]) ? $s["value"]["service"] : "local"; $this->Settings = !empty($s["value"]["settings"]) ? $s["value"]["settings"] : array(); }
function sql($query) { if (!eregi("^(select|show|describe)", $query)) { trigger_error('Invalid query. Only SELECT, SHOW and DESCRIBE allowed', E_USER_ERROR); } $db = $GLOBALS['dsn'] . $GLOBALS['datadb']; $result = @sqlquery($db, $query, false); if (is_object($result) && PEAR::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } else { return new SOAP_Value('result', 'Struct', $result); } }
static function getForm($id) { $id = sqlescape($id); $form = sqlfetch(sqlquery("SELECT * FROM btx_form_builder_forms WHERE id = '{$id}'")); if (!$form) { return false; } $fields = array(); $object_count = 0; $field_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE form = '{$id}' AND `column` = '0' ORDER BY position DESC, id ASC"); while ($field = sqlfetch($field_query)) { $object_count++; if ($field["type"] == "column") { // Get left column $column_fields = array(); $column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '" . $field["id"] . "' AND `alignment` = 'left' ORDER BY position DESC, id ASC"); while ($sub_field = sqlfetch($column_query)) { $column_fields[] = $sub_field; $object_count++; } $field["fields"] = $column_fields; $fields[] = $field; // Get right column $column_fields = array(); $column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '" . $field["id"] . "' AND `alignment` = 'right' ORDER BY position DESC, id ASC"); while ($sub_field = sqlfetch($column_query)) { $column_fields[] = $sub_field; $object_count++; } $field["fields"] = $column_fields; $fields[] = $field; // Column start/end count as objects so we add 3 since there's two columns $object_count += 3; } else { $fields[] = $field; } } $form["fields"] = $fields; $form["object_count"] = $object_count - 1; // We start at 0 return $form; }
function sql() { /*{{{*/ if (!$_REQUEST['query']) { echo "<b>ERROR: Missing parameters.</b>\n"; return false; } // allow only SELECT, SHOW or DESCRIBE queries $allowed = "^(select|show|describe)"; if (!eregi($allowed, trim($_REQUEST['query']))) { echo "<b>ERROR: Only 'SELECT', 'SHOW', or 'DESCRIBE' queries are allowed.</b>\n"; return false; } $result = sqlquery(MDB_DATA_DSN, $_REQUEST['query']); if (is_object($result) && DB::isError($result)) { echo "<b>ERROR " . $result->getCode() . ": " . $result->getMessage() . "</b>\n"; return false; } $format = isset($_REQUEST['format']) ? strtolower($_REQUEST['format']) : "csv"; switch ($format) { case "wddx": $out = wddx_serialize_value($result); break; case "serialize": $out = serialize($result); break; case "table": $out = toTable($result); break; case "csv": default: $fields = array_keys($result[0]); $out = toCSV($fields); for ($i = 0; $i < count($result); $i++) { $out .= toCSV(array_values($result[$i])); } break; } echo $out; return true; }
function checkpseudo($pseudo) { if ($pseudo == '') { return 'empty'; } else { if (strlen($pseudo) < 3) { return 'tooshort'; } else { if (strlen($pseudo) > 32) { return 'toolong'; } else { $result = sqlquery("SELECT COUNT(*) AS nbr FROM membres WHERE membre_pseudo = '" . mysql_real_escape_string($pseudo) . "'", 1); global $queries; $queries++; if ($result['nbr'] > 0) { return 'exists'; } else { return 'ok'; } } } } }
function _local_bigtree_update_201() { setcookie("bigtree_admin[password]", "", time() - 3600, str_replace(DOMAIN, "", WWW_ROOT)); sqlquery("CREATE TABLE `bigtree_user_sessions` (`id` varchar(255) NOT NULL DEFAULT '', `email` varchar(255) DEFAULT NULL, `chain` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `email` (`email`), KEY `chain` (`chain`)) ENGINE=InnoDB DEFAULT CHARSET=utf8"); }
function handle404($url) { $url = sqlescape(htmlspecialchars(strip_tags(rtrim($url, "/")))); $f = sqlfetch(sqlquery("SELECT * FROM bigtree_404s WHERE broken_url = '{$url}'")); if (!$url) { return true; } if ($f["redirect_url"]) { if ($f["redirect_url"] == "/") { $f["redirect_url"] = ""; } if (substr($f["redirect_url"], 0, 7) == "http://" || substr($f["redirect_url"], 0, 8) == "https://") { $redirect = $f["redirect_url"]; } else { $redirect = WWW_ROOT . str_replace(WWW_ROOT, "", $f["redirect_url"]); } sqlquery("UPDATE bigtree_404s SET requests = (requests + 1) WHERE id = '" . $f["id"] . "'"); BigTree::redirect($redirect, "301"); return false; } else { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); if ($f) { sqlquery("UPDATE bigtree_404s SET requests = (requests + 1) WHERE id = '" . $f["id"] . "'"); } else { sqlquery("INSERT INTO bigtree_404s (`broken_url`,`requests`) VALUES ('{$url}','1')"); } define("BIGTREE_DO_NOT_CACHE", true); return true; } }
static function updatePendingItemField($id, $field, $value) { $id = sqlescape($id); $item = sqlfetch(sqlquery("SELECT * FROM bigtree_pending_changes WHERE id = '{$id}'")); $changes = json_decode($item["changes"], true); if (is_array($value)) { $value = BigTree::translateArray($value); } $changes[$field] = $value; $changes = sqlescape(json_encode($changes)); sqlquery("UPDATE bigtree_pending_changes SET changes = '{$changes}' WHERE id = '{$id}'"); }
static function updateUserPassword($id, $password) { global $bigtree; $id = sqlescape($id); $phpass = new PasswordHash($bigtree["config"]["password_depth"], TRUE); $password = sqlescape($phpass->HashPassword(trim($password))); sqlquery("UPDATE bigtree_users SET password = '******' WHERE id = '{$id}'"); }
} } // Sanitize the form data so it fits properly in the database (convert dates to MySQL-friendly format and such) $bigtree["entry"] = BigTreeAutoModule::sanitizeData($bigtree["form"]["table"], $bigtree["entry"]); // Make some easier to write out vars for below. $tags = $_POST["_tags"]; $edit_id = $_POST["id"] ? $_POST["id"] : false; $new_id = false; $table = $bigtree["form"]["table"]; $item = $bigtree["entry"]; $many_to_many = $bigtree["many-to-many"]; // Check to see if this is a positioned element // If it is and the form is setup to create new items at the top and this is a new record, update the position column. $table_description = BigTree::describeTable($table); if (isset($table_description["columns"]["position"]) && $bigtree["form"]["default_position"] == "Top" && !$_POST["id"]) { $max = sqlrows(sqlquery("SELECT id FROM `{$table}`")) + sqlrows(sqlquery("SELECT id FROM `bigtree_pending_changes` WHERE `table` = '" . sqlescape($table) . "'")); $item["position"] = $max; } // Let's stick it in the database or whatever! $data_action = $_POST["save_and_publish"] || $_POST["save_and_publish_x"] || $_POST["save_and_publish_y"] ? "publish" : "save"; $did_publish = false; // We're an editor or "Save" was chosen if ($bigtree["access_level"] == "e" || $data_action == "save") { // We have an existing module entry we're saving a change to. if ($edit_id) { BigTreeAutoModule::submitChange($bigtree["module"]["id"], $table, $edit_id, $item, $many_to_many, $tags); $admin->growl($bigtree["module"]["name"], "Saved " . $bigtree["form"]["title"] . " Draft"); // It's a new entry, so we create a pending item. } else { $edit_id = "p" . BigTreeAutoModule::createPendingItem($bigtree["module"]["id"], $table, $item, $many_to_many, $tags); $admin->growl($bigtree["module"]["name"], "Created " . $bigtree["form"]["title"] . " Draft");
$numRows = current($arr); $numLines = ($numRes - $numRows - 2) / $numRows; next($arr); for ($i = 0; $i < $numRows; ++$i) { $vars[] = current($arr); next($arr); } unset($shards); for ($i = 0; $i < $numLines; ++$i) { unset($l); foreach ($vars as $var) { $l[$var] = current($arr); next($arr); } $sql_query = "SELECT * FROM server WHERE name='" . $l['server'] . "'"; $sql_res = sqlquery($sql_query); if ($sql_res && ($sql_arr = sqlfetch($sql_res))) { $l['address'] = $sql_arr['address']; } $availableLAS[] = $l; } } /* echo "<pre>"; print_r($availableLAS); echo "</pre>"; */ importParam('exec_query'); importParam('refresh_result'); importParam('query'); importParam('query_id');
bt_touch_writable("templates/basic/_404.php", "<h1>404 - Page Not Found</h1>"); bt_touch_writable("templates/basic/_maintenance.php", "<h1>Under Construction</h1><p>Maintenance mode has been enabled.</p>"); bt_touch_writable("templates/basic/_sitemap.php", "<h1>Sitemap</h1>"); bt_touch_writable("templates/basic/home.php"); bt_touch_writable("templates/basic/content.php", '<h1><?=$page_header?></h1> <?=$page_content?>'); bt_mkdir_writable("templates/callouts/"); bt_touch_writable("custom/environment.php", str_replace($find, $replace, file_get_contents("core/config.environment.php"))); // Install the example site if they asked for it. if ($install_example_site) { bt_copy_dir("core/example-site/", ""); $sql_queries = explode("\n", file_get_contents("example-site.sql")); foreach ($sql_queries as $query) { $query = trim($query); if ($query != "") { $q = sqlquery($query); } } bt_touch_writable("custom/settings.php", str_replace($find, $replace, file_get_contents("core/example-site/custom/settings.php"))); } else { bt_touch_writable("custom/settings.php", str_replace($find, $replace, file_get_contents("core/config.settings.php"))); } // Create site/index.php, site/.htaccess, and .htaccess (masks the 'site' directory) bt_touch_writable("site/index.php", '<? $server_root = str_replace("site/index.php","",strtr(__FILE__, "\\\\", "/")); include "../core/launch.php"; ?>'); if ($routing == "advanced") { bt_touch_writable("site/.htaccess", '<IfModule mod_deflate.c> <IfModule mod_setenvif.c> <IfModule mod_headers.c>
function update($id, $fields, $values = false, $ignore_cache = false) { $id = sqlescape($id); // Turn a key => value array into pairs if ($values === false && is_array($fields)) { $values = $fields; $fields = array_keys($fields); } // Multiple columns to update if (is_array($fields)) { $query_parts = array(); foreach ($fields as $key) { $val = current($values); if (is_array($val)) { $val = BigTree::json(BigTree::translateArray($val)); } else { $val = BigTreeAdmin::autoIPL($val); } $query_parts[] = "`{$key}` = '" . sqlescape($val) . "'"; next($values); } sqlquery("UPDATE `" . $this->Table . "` SET " . implode(", ", $query_parts) . " WHERE id = '{$id}'"); // Single column to update } else { if (is_array($values)) { $val = json_encode(BigTree::translateArray($values)); } else { $val = BigTreeAdmin::autoIPL($values); } sqlquery("UPDATE `" . $this->Table . "` SET `{$fields}` = '" . sqlescape($val) . "' WHERE id = '{$id}'"); } if (!$ignore_cache) { BigTreeAutoModule::recacheItem($id, $this->Table); } }
<?php $db_error = false; $is_group_based_perm = false; $list = array(); // Database populated list. if ($field["options"]["list_type"] == "db") { $list_table = $field["options"]["pop-table"]; $list_id = $field["options"]["pop-id"]; $list_title = $field["options"]["pop-description"]; $list_sort = $field["options"]["pop-sort"]; // If debug is on we're going to check if the tables exists... if ($bigtree["config"]["debug"] && !BigTree::tableExists($list_table)) { $db_error = true; } else { $q = sqlquery("SELECT `id`,`{$list_title}` FROM `{$list_table}` ORDER BY {$list_sort}"); // Check if we're doing module based permissions on this table. if ($bigtree["module"] && $bigtree["module"]["gbp"]["enabled"] && $form["table"] == $bigtree["module"]["gbp"]["table"] && $key == $bigtree["module"]["gbp"]["group_field"]) { $is_group_based_perm = true; while ($f = sqlfetch($q)) { // Find out whether the logged in user can access a given group, and if so, specify the access level. $access_level = $admin->canAccessGroup($bigtree["module"], $f["id"]); if ($access_level) { $list[] = array("value" => $f["id"], "description" => $f[$list_title], "access_level" => $access_level); } } // We're not doing module group based permissions, get a regular list. } else { while ($f = sqlfetch($q)) { $list[] = array("value" => $f["id"], "description" => $f[$list_title]); }
} //echo $trimmed; $word = $trimmed; //'accueillir'; $word = utf8_decode($word); $time_start = microtime(true); /*$text = sqlquery($conn,$word); if(isset($text) && count($text)>=1) print_r("$word=".$text[1]."\t"); else print_r("no such word translation |");*/ while ($i < $j) { $word = trim($pieces[$i++]); $word = utf8_decode($word); //print_r($word); $text = sqlquery($conn, $word); //$word); if (isset($text) && count($text) >= 2) { echo $word . "="; if (count($text[1]) >= 1) { $text[1] = array_unique($text[1]); for ($ii = 0; $ii <= count($text[1]); $ii++) { if (!empty($text[1][$ii])) { print_r("" . $text[1][$ii] . " , "); } //change this to arrive at synsets } } echo "<br>"; //print_r($text[1] . " "); } else {
$type["use_cases"] = array("templates" => $type["pages"], "modules" => $type["modules"], "callouts" => $type["callouts"], "settings" => $type["settings"]); } $use_cases = is_array($type["use_cases"]) ? sqlescape(json_encode($type["use_cases"])) : sqlescape($type["use_cases"]); $self_draw = $type["self_draw"] ? "'on'" : "NULL"; sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`) VALUES ('" . sqlescape($type["id"]) . "','" . sqlescape($type["name"]) . "','{$use_cases}',{$self_draw})"); } } // Import files foreach ($json["files"] as $file) { BigTree::copyFile(SERVER_ROOT . "cache/package/{$file}", SERVER_ROOT . $file); } // Run SQL foreach ($json["sql"] as $sql) { sqlquery($sql); } // Empty view cache sqlquery("DELETE FROM bigtree_module_view_cache"); // Remove the package directory, we do it backwards because the "deepest" files are last $contents = @array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/package/")); foreach ($contents as $file) { @unlink($file); @rmdir($file); } @rmdir(SERVER_ROOT . "cache/package/"); // Clear module class cache and field type cache. @unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json"); @unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json"); sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($json["id"]) . "','package','" . sqlescape($json["title"]) . "','" . sqlescape($json["version"]) . "',NOW(),'" . sqlescape(json_encode($json)) . "')"); sqlquery("SET foreign_key_checks = 1"); $admin->growl("Developer", "Installed Package"); BigTree::redirect(DEVELOPER_ROOT . "packages/install/complete/");
<?php // Update the count sqlquery("UPDATE btx_form_builder_forms SET entries = (entries - 1) WHERE id = '" . sqlescape($_POST["form"]) . "'"); BigTreeAutoModule::recacheItem($_POST["form"], "btx_form_builder_forms"); // Delete the entry BigTreeAutoModule::deleteItem("btx_form_builder_entries", $_POST["id"]); // Show the growl and update the table header("Content-type: text/javascript"); ?> BigTree.growl("Form Builder","Deleted Entry"); $("#row_<?php echo $_POST["id"]; ?> ").remove();
echo "//----------------------------------\n"; echo "function submitForm(entity)\n"; echo "{\n"; echo "\treturn true;\n"; echo "}\n"; echo "\n"; echo "//--></script>\n"; // input variables : // - $preselServ : preselected service address // - $execCommand : executed command on preselected service, like a normal service // echo "<br><br>\n"; echo "<table border=0><tr valign=top>\n"; echo "<form method=post action='" . $_SERVER['PHP_SELF'] . "' name='cmdform'>\n"; echo "<td>\n"; $result = sqlquery("SELECT DISTINCT shard FROM service ORDER BY shard"); echo "<select multiple size=" . sqlnumrows($result) . " name='selshards[]'>"; while ($result && ($arr = sqlfetch($result))) { $selected = isset($selshards) && in_array($arr["shard"], $selshards) || (isset($admfilter_shard) && $admfilter_shard != "" && strstr($arr["shard"], $admfilter_shard) || $admfilter_shard == "" && !isset($selshards)); if ($selected) { $selected_shards[] = $arr["shard"]; } echo "<option value='" . $arr["shard"] . "'" . ($selected ? " selected" : "") . ">" . $arr["shard"]; } echo "</select>\n"; echo "</td>\n"; echo "<td width=30> </td>\n"; echo "<td>\n"; echo "<table border=0>\n"; echo "<tr><th align=left>Player/Character name</th></tr>\n"; echo "<tr><td><input name=char_name value='" . stripslashes($char_name) . "' size=50 maxlength=20480></td>\n";
// Throw an exception if they didn't setup the field type properly if (!$field["options"]["table"] || !$field["options"]["title_column"]) { throw Exception("One-to-Many field type requires a table and a title field to be setup to function."); } $entries = array(); $sort = $field["options"]["sort_by_column"] ? $field["options"]["sort_by_column"] : $field["options"]["title_column"] . " ASC"; // Get existing entries' titles foreach ($field["value"] as $entry) { $g = sqlfetch(sqlquery("SELECT `id`,`" . $field["options"]["title_column"] . "` FROM `" . $field["options"]["table"] . "` WHERE id = '" . sqlescape($entry) . "'")); if ($g) { $entries[$g["id"]] = $g[$field["options"]["title_column"]]; } } // Gather a list of the items that could possibly be used $list = array(); $q = sqlquery("SELECT `id`,`" . $field["options"]["title_column"] . "` FROM `" . $field["options"]["table"] . "` ORDER BY {$sort}"); while ($f = sqlfetch($q)) { $list[$f["id"]] = $f[$field["options"]["title_column"]]; } // If we have a parser, send a list of the entries and available items through it. if (!empty($field["options"]["parser"])) { $list = call_user_func($field["options"]["parser"], $list, true); $entries = call_user_func($field["options"]["parser"], $entries, false); } // Remove items from the list that have already been used foreach ($entries as $k => $v) { unset($list[$k]); } // A count of the number of entries $x = 0; // Only show the field if there are items that could be used or removed
/** * Return patient import status using patient Id * @param integer $patientId Id of patient * @return integer Import status for specified patient: [1 = Prescription Press, 2 = Prescription Import, 3 = Allergy Press, 4 = Allergy Import] */ public function getPatientImportStatusByPatientId($patientId) { $return = sqlquery('SELECT soap_import_status FROM patient_data WHERE pid = ?;', array($patientId)); return $return['soap_import_status']; }
if ($ldapConn) { $ldapBind = ldap_bind($ldapConn, $ldapDn, $ldapPass); if ($ldapBind) { //echo "Bound<br>"; $filter = "(&(objectclass=*)(uid=" . $studentUser . "))"; $ldapDn = "dc=ldap,dc=iitm,dc=ac,dc=in"; $result = ldap_search($ldapConn, $ldapDn, $filter) or die("Error in search query: " . ldap_error($ldapConn)); $entries = ldap_get_entries($ldapConn, $result); foreach ($entries as $values => $values1) { $logindn = $values1['dn']; } $loginbind = ldap_bind($ldapConn, $logindn, $studentPass); //var_dump($loginbind); if ($loginbind) { $qry = "SELECT * FROM users WHERE username='******' "; $result = sqlquery($qry); if ($result) { if (mysqli_num_rows($result) > 0) { $jsonData = array(); while ($row = mysqli_fetch_assoc($result)) { //echo "Tutorial ID :{$row['name']} <br> " . "Title: {$row['event']} <br> " . "Author: {$row['venue']} <br> " . "Submission Date : {$row['description']} <br> " . "--------------------------------<br>"; $jsonData[] = $row; } echo json_encode(array_reverse($jsonData)); } else { // $array=array("val"=>"s2"); // echo json_encode($array); echo "{'success':2}"; exit; } }
$code = ''; for ($i = 1; $i <= 6; $i++) { $c = rand(0, 35); if ($c < 10) { $code = $code . $c; } else { $code = $code . chr($c - 10 + ord("a")); } } $sql = "SELECT COUNT(*) FROM `talkrecord` WHERE `code`=?"; $res = sqlexec($sql, array($code), $link); $num = $res->fetch(PDO::FETCH_NUM); $num = $num[0]; if ($num == 0) { break; } } $sql = "SELECT max(`id`) FROM `talkrecord`"; $res = sqlquery($sql, $link); $num = $res->fetch(PDO::FETCH_NUM); if ($num == FALSE) { $id = 0; } else { $id = $num[0]; } $id = $id + 1; $sql = "INSERT INTO `talkrecord` VALUES (?,?,?,?,?,?);"; $res = sqlexec($sql, array($id, $m, $expire, $code, $p, $phint), $link); $_SESSION['c'] = $DOMAIN_NAME . $code; die($code); }
file_put_contents(SERVER_ROOT . "cache/package/manifest.json", $json); // Create the zip @unlink(SERVER_ROOT . "cache/package.zip"); include BigTree::path("inc/lib/pclzip.php"); $zip = new PclZip(SERVER_ROOT . "cache/package.zip"); $zip->create(BigTree::directoryContents(SERVER_ROOT . "cache/package/"), PCLZIP_OPT_REMOVE_PATH, SERVER_ROOT . "cache/package/"); // Remove the package directory, we do it backwards because the "deepest" files are last $contents = array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/package/")); foreach ($contents as $file) { @unlink($file); @rmdir($file); } @rmdir(SERVER_ROOT . "cache/package/"); // Store it in the database for future updates if (sqlrows(sqlquery("SELECT * FROM bigtree_extensions WHERE id = '" . sqlescape($id) . "'"))) { sqlquery("UPDATE bigtree_extensions SET name = '" . sqlescape($title) . "', version = '" . sqlescape($version) . "', last_updated = NOW(), manifest = '" . sqlescape($json) . "' WHERE id = '" . sqlescape($id) . "'"); } else { sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($id) . "','package','" . sqlescape($title) . "','" . sqlescape($version) . "',NOW(),'" . sqlescape($json) . "')"); } ?> <div class="container"> <section> <p>Package created successfully.</p> </section> <footer> <a href="<?php echo DEVELOPER_ROOT; ?> packages/build/download/" class="button blue">Download</a> </footer> </div>