本文整理汇总了PHP中get_db_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP get_db_sql函数的具体用法?PHP get_db_sql怎么用?PHP get_db_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_db_sql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_tasks_gantt
function get_tasks_gantt(&$tasks, $project_id, $project_start, $project_end, $parent_id = 0, $depth = 0, $show_actual = 0)
{
global $config;
$id_user = $config["id_user"];
$result = mysql_query('SELECT * FROM ttask
WHERE id_parent_task = ' . $parent_id . ' AND id_project = ' . $project_id);
if ($result === false) {
return;
}
while ($row = mysql_fetch_array($result)) {
// ACL Check for this task
// This user can see this task?
$task_access = get_project_access($config["id_user"], $project_id, $row['id'], false, true);
if ($task_access["read"]) {
$task['id'] = $row['id'];
$task['name'] = $row['name'];
if ($show_actual) {
$task["name"] .= " (" . __("Planned") . ")";
}
$task['parent'] = $parent_id;
$task['link'] = 'index.php?sec=projects&sec2=operation/projects/task_detail&id_project=' . $project_id . '&id_task=' . $row['id'] . '&operation=view';
// start > end
$task['start'] = fix_date($row['start'], $project_start);
$task['end'] = fix_date($row['end'], $project_end);
if (date_to_epoch($task['start']) > date_to_epoch($task['end'])) {
$temp = $task['start'];
$task['start'] = $task['end'];
$task['end'] = $temp;
}
$task['real_start'] = fix_date(get_db_sql('SELECT MIN(timestamp) FROM tworkunit, tworkunit_task WHERE tworkunit_task.id_workunit = tworkunit.id AND timestamp <> \'0000-00-00 00:00:00\' AND id_task = ' . $row['id']), $task['start']);
$task['real_end'] = fix_date(get_db_sql('SELECT MAX(timestamp) FROM tworkunit, tworkunit_task WHERE tworkunit_task.id_workunit = tworkunit.id AND timestamp <> \'0000-00-00 00:00:00\' AND id_task = ' . $row['id']), $task['start']);
$task['completion'] = $row['completion'];
$task["actual_data"] = 0;
$task["worked_hours"] = get_task_workunit_hours($row["id"]);
$task["hours"] = $row["hours"];
array_push($tasks, $task);
//Add another task to represent real effort for the task
if ($show_actual) {
$task_aux = array();
$task_aux["id"] = $task["id"] . "act";
$task_aux["actual_data"] = 1;
$task_aux["parent"] = $task["parent"];
if ($task['real_start']) {
$task_aux["start"] = $task['real_start'];
} else {
$task_aux["start"] = $task['start'];
}
if ($task['real_end']) {
$task_aux["end"] = $task['real_end'];
} else {
$task_aux["end"] = $task['start'];
}
$task_aux["completion"] = 0;
$task_aux["name"] = $row["name"] . " (" . __("Actual") . ")";
array_push($tasks, $task_aux);
}
get_tasks_gantt(&$tasks, $project_id, $project_start, $project_end, $task['id'], $depth + 1, $show_actual);
}
}
}
示例2: create_workunit
function create_workunit($incident_id, $wu_text, $user, $timeused = 0, $have_cost = 0, $profile = "", $public = 1, $send_email = 1, $work_home = 0, $workflow = false)
{
global $config;
$fecha = print_mysql_timestamp();
$sql = sprintf('UPDATE tincidencia
SET affected_sla_id = 0, actualizacion = "%s"
WHERE id_incidencia = %d', $fecha, $incident_id);
process_sql($sql);
$task_id = get_db_value('id_task', 'tincidencia', 'id_incidencia', $incident_id);
if (!$workflow) {
incident_tracking($incident_id, INCIDENT_WORKUNIT_ADDED);
}
// Add work unit if enabled
$sql = sprintf('INSERT INTO tworkunit (timestamp, duration, id_user, description, public, work_home)
VALUES ("%s", %.2f, "%s", "%s", %d, %d)', $fecha, $timeused, $user, $wu_text, $public, $work_home);
$id_workunit = process_sql($sql, "insert_id");
$sql = sprintf('INSERT INTO tworkunit_incident (id_incident, id_workunit)
VALUES (%d, %d)', $incident_id, $id_workunit);
$res = process_sql($sql);
if ($task_id) {
$sql = sprintf('INSERT INTO tworkunit_task (id_task, id_workunit)
VALUES (%d, %d)', $task_id, $id_workunit);
$res = process_sql($sql);
}
if ($res !== false) {
$email_copy_sql = 'select email_copy from tincidencia where id_incidencia =' . $incident_id . ';';
$email_copy = get_db_sql($email_copy_sql);
if ($send_email == 1) {
if ($email_copy != "") {
mail_incident($incident_id, $user, $wu_text, $timeused, 10, 7);
}
if ($config["email_on_incident_update"] != 2 && $config["email_on_incident_update"] != 4) {
mail_incident($incident_id, $user, $wu_text, $timeused, 10);
}
}
} else {
//Delete workunit
$sql = sprintf('DELETE FROM tworkunit WHERE id = %d', $id_workunit);
return false;
}
return $id_workunit;
}
示例3: md5
echo "<input type=hidden name='validation1' value='" . md5($config["dbpass"] . $bool) . "'>";
echo "<input type=hidden name='validation2' value='{$bool}'>";
echo "<input type=hidden name='operation' value='desubscribe_data'>";
echo "<input type=hidden name='newsletter' value='{$id}'>";
echo "</table></form>";
return;
}
if ($operation == "desubscribe_data") {
$validation1 = get_parameter("validation1");
$validation2 = get_parameter("validation2");
$newsletter = get_parameter("newsletter");
$email = get_parameter("email");
$now = date("Y-m-d H:i:s");
if ($validation1 == md5($config["dbpass"] . $validation2)) {
// check if already subscribed
$count = get_db_sql("SELECT COUNT(id) FROM tnewsletter_address WHERE status = 0 AND email = '" . $email . "' AND id_newsletter = {$newsletter}");
if ($count > 0) {
$sql = "UPDATE tnewsletter_address SET status=1 WHERE id_newsletter = {$newsletter} AND email = '" . $email . "'";
$result = mysql_query($sql);
if ($result) {
sleep(5);
// Robot protection
echo "<h3>" . __("You has been desubscribed. Thanks!") . "</h3>";
}
} else {
sleep(5);
// Robot protection
echo "<h3>" . __("There is nobody registered with that address") . "</h3>";
}
}
return;
示例4: IN
$sql_search .= " AND i.id IN (SELECT id_inventory FROM tinventory_acl WHERE `type`='user' AND id_reference='$associated_user')";
$sql_search_pagination .= " AND i.id IN (SELECT id_inventory FROM tinventory_acl WHERE `type`='user' AND id_reference='$associated_user')";
$sql_search_count .= " AND i.id IN (SELECT id_inventory FROM tinventory_acl WHERE `type`='user' AND id_reference='$associated_user')";
$params['associated_user'] = $associated_user;
}
//Parent name
if(isset($params_array['parent_name']) && $params_array['parent_name'] != ''){
$parent_name = $params_array['parent_name'];
} else {
$parent_name = get_parameter ('parent_name', 'None');
}
if ($parent_name != 'None') {
$sql_parent_name = "select id from tinventory where name ='". $parent_name."';";
$id_parent_name = get_db_sql($sql_parent_name);
$sql_search .= " AND i.id_parent =" . $id_parent_name;
$sql_search_pagination .= " AND i.id_parent =" . $id_parent_name;
$sql_search_count .= " AND i.id_parent =" . $id_parent_name;
$params['parent_name'] = $parent_name;
}
//sort table
if(isset($params_array['sort_mode']) && $params_array['sort_mode'] != ''){
$sort_mode = $params_array['sort_mode'];
} else {
$sort_mode = (string)get_parameter('sort_mode', 'asc');
}
示例5: date
$index = 0;
for ($ax = 1; $ax < 13; $ax++){
if (fmod($ax-1,4) == 0)
echo "<tr>";
echo "<td valign=top style='font-size: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 10px; text-align: center;'>";
$this_month = date('Y-m-d H:i:s',strtotime("$year-$ax-01"));
$this_month_limit = date('Y-m-d H:i:s',strtotime("$year-$ax-31"));
$work_hours = get_db_sql ("SELECT SUM(duration) FROM tworkunit WHERE id_user='$id_user_show' AND locked = '' AND timestamp >= '$this_month' AND timestamp < '$this_month_limit'");
if ($work_hours == "")
$work_hours = 0;
$locked_hours = get_db_sql ("SELECT SUM(duration) FROM tworkunit WHERE id_user='$id_user_show' AND locked != '' AND timestamp >= '$this_month' AND timestamp < '$this_month_limit'");
if ($locked_hours == "")
$locked_hours = 0;
echo __("Total") . " : " . $work_hours;
echo " - ";
echo __("Locked"). " : " . $locked_hours;
echo $calendars[$index];
$index++;
}
echo "</table>";
?>
示例6: get_db_sql
$email_copy = "";
$editor = $config["id_user"];
$id_group_creator = 0;
$closed_by = "";
$blocked = 0;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Show the form
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$default_responsable = "";
if (!$id) {
if ($config["enteprise"] == 1) {
// How many groups has this user ?
$number_group = get_db_sql("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario = '{$usuario}'");
// Take first group defined for this user
$default_id_group = get_db_sql("SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '{$usuario}' LIMIT 1");
} else {
$default_id_group = 1;
$number_group = 1;
}
}
//The user with IW flag or the incident owner can modify all data from the incident.
$has_permission = give_acl($config['id_user'], $id_grupo, "IW") || $usuario == $config['id_user'];
$has_im = give_acl($config['id_user'], $id_grupo, "IM");
$has_iw = give_acl($config['id_user'], $id_grupo, "IW");
if ($id) {
echo "<h1>";
if ($affected_sla_id != 0) {
echo '<img src="images/exclamation.png" border=0 valign=top title="' . __('SLA Fired') . '"> ';
}
echo __('Ticket') . ' #' . $id . ' - ' . ui_print_truncate_text($incident['titulo'], 50) . " " . '<a href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $id . '">' . print_image("images/world.png", true, array("title" => __("Link to ticket"))) . '</a>';
示例7: __
echo "<th>" . __('User') . "</th>";
echo "<th>" . __('Delete') . "</th>";
$kb = print_array_pagination($kb, "index.php?sec=kb&sec2=operation/kb/manage_data");
foreach ($kb as $row) {
echo "<tr>";
// Name
echo "<td valign='top'><b><a href='index.php?sec=kb&sec2=operation/kb/manage_data&update=" . $row["id"] . "'>" . $row["title"] . "</a></b></td>";
// Timestamp
echo "<td class='f9' valign='top'>";
echo $row["timestamp"];
// Category
echo "<td class='f9'>";
echo get_db_sql("SELECT name FROM tkb_category WHERE id = " . $row["id_category"]);
// Product
echo "<td class='f9'>";
echo get_db_sql("SELECT name FROM tkb_product WHERE id = " . $row["id_product"]);
// User
echo "<td class='f9' align='center'>";
echo $row["id_user"];
// Delete
echo "<td class='f9' align='center' >";
echo "<a href='index.php?sec=kb&\n\t\t\t\t\t\tsec2=operation/kb/manage_data&\n\t\t\t\t\t\tdelete_data=" . $row["id"] . "' \n\t\t\t\t\t\tonClick='if (!confirm(\\' " . __('Are you sure?') . "\\')) \n\t\t\t\t\t\treturn false;'>\n\t\t\t\t\t\t<img border='0' src='images/cross.png'></a>";
}
echo "</table>";
}
echo "</form>";
}
// end of list
?>
<script type="text/javascript" src="include/js/jquery.validate.js"></script>
示例8: get_db_sql
$data[3] = "<a title='({$sum_contratos})' href='index.php?sec=customers&sec2=operation/companies/company_detail&op=contracts&id=" . $company['id'] . "'><img src='images/invoice.png'></a>";
} else {
$data[3] = "";
}
$sum_leads = get_db_sql("SELECT COUNT(id) FROM tlead WHERE progress < 100 AND id_company = " . $company["id"]);
if ($sum_leads > 0) {
$leads_data = " ({$sum_leads}) ";
$leads_data .= get_db_sql("SELECT SUM(estimated_sale) FROM tlead WHERE progress < 100 AND id_company = " . $company["id"]);
$data[4] = "<a title='{$leads_data}' href='index.php?sec=customers&sec2=operation/companies/company_detail&op=leads&id=" . $company["id"] . "'><img src='images/icon_lead.png'></a>";
} else {
$data[4] = "";
}
$data[5] = $company["manager"];
$data[6] = $company["country"];
// get last activity date for this company record
$last_activity = get_db_sql("SELECT MAX(date) FROM tcompany_activity WHERE id_company = " . $company["id"]);
$data[7] = human_time_comparation($last_activity);
if (!$company["billing"]) {
$company["billing"] = '0.00';
}
$data[8] = $company["billing"];
// . " " . $config["currency"];
$manage_permission = check_crm_acl('company', 'cm', $config['id_user'], $company['id']);
if ($manage_permission) {
$data[9] = "<a href='#' onClick='javascript: show_validation_delete(\"delete_company\"," . $company['id'] . ",0," . $offset . ",\"" . $search_params . "\");'><img src='images/cross.png'></a>";
} else {
$data[9] = '';
}
array_push($table->data, $data);
}
print_table($table);
示例9: get_parameter
$id = get_parameter("id", 1);
$email = get_db_sql("SELECT email FROM tnewsletter_address WHERE id = {$id}");
$sql = "DELETE FROM tnewsletter_address WHERE id = {$id}";
$result = mysql_query($sql);
if ($result === false) {
echo "<h3 class='error'>" . __('Could not be deleted') . "</h3>";
} else {
echo "<h3 class='suc'>" . __('Successfully deleted') . "</h3>";
audit_db($config["id_user"], $config["REMOTE_ADDR"], "NEWSLETTER ADDRESESS DELETED", "Deleted {$email}");
}
$id = 0;
}
if ($multiple_delete) {
$ids = (array) get_parameter('delete_multiple', array());
foreach ($ids as $id) {
$email = get_db_sql("SELECT email FROM tnewsletter_address WHERE id = {$id}");
$sql = "DELETE FROM tnewsletter_address WHERE id = {$id}";
$result = mysql_query($sql);
if ($result === false) {
break;
} else {
audit_db($config["id_user"], $config["REMOTE_ADDR"], "NEWSLETTER ADDRESESS DELETED", "Deleted {$email}");
}
}
echo "<h3 class='suc'>" . __('Successfully multiple deleted') . "</h3>";
$id = 0;
}
// General issue listing
echo "<h2>" . __('Newsletter addresses management') . "</h2>";
echo "<br>";
$search_text = (string) get_parameter('search_text');
示例10: get_project_access
// -----------
if ($operation == "delete") {
// ACL
$task_access = get_project_access ($config["id_user"], $id_project, $id_task, false, true);
if (!$task_access["write"]) {
// Doesn't have access to this page
audit_db($id_user, $config["REMOTE_ADDR"], "ACL Violation", "Trying to delete a file ofy a task without permission");
no_permission();
}
$file_id = get_parameter ("file", "");
$file_row = get_db_row ("tattachment", "id_attachment", $file_id);
$nombre_archivo = $config["homedir"]."/attachment/".$file_id."_".$file_row["filename"];
unlink ($nombre_archivo);
get_db_sql ("DELETE FROM tattachment WHERE id_attachment = $file_id");
$result_output = ui_print_success_message (__('File deleted'), '', true, 'h3', true);
}
// Specific task
if ($id_task != -1) {
$sql = "SELECT * FROM tattachment WHERE id_task = $id_task";
$section_title = __('Attached files');
$section_subtitle = __('Task')." - ".$task_name;
$t_menu = print_task_tabs();
print_title_with_menu ($section_title, $section_subtitle, "task_files", 'projects', $t_menu, 'files');
echo "<div class='divform'>";
echo "<form method='POST' action='index.php?sec=projects&sec2=operation/projects/task_files&id_task=$id_task&id_project=$id_project&operation=attachfile' enctype='multipart/form-data' >";
echo "<table cellpadding=4 cellspacing=4 border=0 width='20%' class='search-table'>";
echo "<tr>";
示例11: getCountWorkUnits
public function getCountWorkUnits()
{
$sql = $this->getWorkUnitsQuery("COUNT(id)", "", false);
$count = get_db_sql($sql);
return $count;
}
示例12: users_get_allowed_users_query
function users_get_allowed_users_query($id_user, $filter = false)
{
global $config;
if ($id_user === 0) {
$id_user = $config['id_user'];
}
if ($filter != 0) {
$offset = $filter['offset'];
$search_text = $filter['search_text'];
$disabled_user = $filter['disabled_user'];
$level = $filter['level'];
$group = $filter['group'];
}
$search = "";
if ($search_text != "") {
$search .= " AND (t1.id_usuario LIKE '%{$search_text}%' OR comentarios LIKE '%{$search_text}%' OR nombre_real LIKE '%{$search_text}%' OR direccion LIKE '%{$search_text}%')";
}
if ($disabled_user > -1) {
$search .= " AND disabled = {$disabled_user}";
}
if ($level > -10) {
$search .= " AND nivel = {$level}";
}
if ($group == -1) {
$search .= " AND t1.id_usuario NOT IN (select tusuario_perfil.id_usuario from tusuario_perfil)";
} else {
if ($group > 0) {
$search .= " AND t1.id_usuario = ANY (SELECT tusuario_perfil.id_usuario FROM tusuario_perfil WHERE id_grupo = {$group})";
}
}
$level = get_db_sql("SELECT nivel FROM tusuario WHERE id_usuario = '{$id_user}'");
if ($level == 1) {
//admin
$final_query = "SELECT * FROM tusuario t1";
//~ $query = "SELECT * FROM tusuario t1 WHERE 1=1 OR nivel = 1";
} else {
$query = "SELECT * FROM tusuario t1\n\t\t\t\t\tINNER JOIN tusuario_perfil t2 ON t1.id_usuario = t2.id_usuario \n\t\t\t\t\t\tAND t2.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '" . $id_user . "')";
//~ WHERE id_usuario IN (SELECT id_usuario FROM tusuario_perfil WHERE id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '".$id_user."')) ";
//~ $query = "SELECT * FROM tusuario WHERE (id_usuario IN (SELECT id_usuario FROM tusuario_perfil WHERE (id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '".$id_user."'))) OR nivel = 1) ";
$groups = get_db_all_rows_sql("SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '" . $id_user . "'");
if ($groups === false) {
$groups = array();
}
foreach ($groups as $group) {
if ($group['id_grupo'] == 1) {
//all
$query = "SELECT * FROM tusuario t1 WHERE 1=1";
}
}
$final_query = $query . $search . " GROUP BY t1.id_usuario";
}
return $final_query;
}
示例13: __
$params['input_id'] = 'id';
$params['input_name'] = 'id';
$params['title'] = __('Company');
$params['return'] = true;
$params['input_value'] = get_parameter('company_id');
$table->data[0][0] = print_company_autocomplete_input($params);
}
$invoice_types = array('Submitted'=>'Submitted', 'Received'=>'Received');
$table->data[0][1] = print_select ($invoice_types, 'invoice_type', $invoice_type, '','', 0, true, false, false, __('Type'));
$table->data[1][0] = print_input_text ('reference', $reference, '', 25, 100, true, __('Reference'));
$table->data[1][1] = print_input_text ('bill_id', $bill_id, '', 25, 100, true, __('Bill ID'));
if ($bill_id == ""){ // let's show the latest Invoice ID generated in the system
$last_invoice_generated = get_db_sql ("SELECT bill_id FROM tinvoice ORDER by invoice_create_date DESC LIMIT 1");
$table->data[1][1] .= "<div id='last_id'><span style='font-size: 9px'> ". __("Last generated ID: "). $last_invoice_generated . "</span></div>";
}
$invoice_status_ar = array();
$invoice_status_ar['pending']= __("Pending");
$invoice_status_ar['paid']= __("Paid");
$invoice_status_ar['canceled']= __("Canceled");
$table->data[2][0] = print_select ($invoice_status_ar, 'invoice_status',
$invoice_status, '','', 0, true, false, false, __('Invoice status'));
$table->data[2][1] = print_input_text ('invoice_create_date', $invoice_create_date, '', 15, 50, true, __('Invoice creation date'));
$table->data[3][0] = print_input_text ('invoice_payment_date', $invoice_payment_date, '', 15, 50, true,__('Invoice effective payment date'));
if ($id_invoice != -1) {
$disabled = true;
示例14: array
$table->width = '100%';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Description');
$table->head[1] = __('Amount');
$table->head[2] = __('Filename');
$table->head[3] = __('Delete');
foreach ($costs as $cost) {
$data = array ();
$data[0] = $cost["description"];
$data[1] = get_invoice_amount($cost["id"]);// Check
$id_invoice = $cost["id"];
$filename = get_db_sql ("SELECT filename FROM tattachment WHERE id_attachment = ". $cost["id_attachment"]);
$data[2] = "<a href='".$config["base_url"]."/attachment/".$cost["id_attachment"]."_".$filename."'>$filename</a>";
if (($config["id_user"] = $cost["id_user"]) OR (project_manager_check ($id_project))){
$data[3] = "<a href='index.php?sec=projects&sec2=operation/projects/task_cost&id_task=$id_task&id_project=$id_project&operation=delete&id_invoice=$id_invoice '><img src='images/cross.png'></a>";
}
array_push ($table->data, $data);
}
print_table ($table);
} else {
echo ui_print_error_message(__('No data found'), '', true, 'h3', true);
}
echo "</div>";
echo "</div>";
示例15: get_user_work_home
function get_user_work_home($id_user, $year)
{
global $config;
$hours = get_db_sql("SELECT SUM(tworkunit.duration) FROM tworkunit, tworkunit_task WHERE tworkunit_task.id_workunit = tworkunit.id AND tworkunit_task.id_task > 0 AND id_user = '{$id_user}' AND timestamp >= '{$year}-01-00 00:00:00' AND timestamp <= '{$year}-12-31 23:59:59' AND tworkunit.work_home=1");
return format_numeric($hours / $config["hours_perday"]);
}