当前位置: 首页>>代码示例>>PHP>>正文


PHP process_sql_insert函数代码示例

本文整理汇总了PHP中process_sql_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP process_sql_insert函数的具体用法?PHP process_sql_insert怎么用?PHP process_sql_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了process_sql_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mysql_session_write

function mysql_session_write($SessionID, $val)
{
    $SessionID = addslashes($SessionID);
    $val = addslashes($val);
    $sql = "SELECT COUNT(*) FROM tsessions_php\n\t\tWHERE id_session = '{$SessionID}'";
    $SessionExists = process_sql($sql);
    $session_exists = $SessionExists[0]['COUNT(*)'];
    if ($session_exists == 0) {
        $now = time();
        $retval_write = process_sql_insert('tsessions_php', array('id_session' => $SessionID, 'last_active' => $now, 'data' => $val));
    } else {
        $now = time();
        $retval_write = process_sql_update('tsessions_php', array('last_active' => $now, 'data' => $val), array('id_session' => $SessionID));
    }
    return $retval_write;
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:16,代码来源:load_session.php

示例2: profile_create_user_profile

/**
 * Create Profile for User
 *
 * @param string User ID
 * @param int Profile ID (default 1 => AR)
 * @param int Group ID (default 1 => All)
 * @param string Assign User who assign the profile to user.
 *
 * @return mixed Number id if succesful, false if not
 */
function profile_create_user_profile($id_user, $id_profile = 1, $id_group = 0, $assignUser = false)
{
    global $config;
    if (empty($id_profile) || $id_group < 0) {
        return false;
    }
    if (isset($config["id_usuario"])) {
        //Usually this is set unless we call it while logging in (user known by auth scheme but not by pandora)
        $assign = $config["id_usuario"];
    } else {
        $assign = $id_user;
    }
    if ($assignUser !== false) {
        $assign = $assignUser;
    }
    $insert = array("id_usuario" => $id_user, "id_perfil" => $id_profile, "id_grupo" => $id_group, "assigned_by" => $assign);
    return process_sql_insert("tusuario_perfil", $insert);
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:28,代码来源:functions_profile.php

示例3: fill_new_sla_table

function fill_new_sla_table()
{
    echo "Filling the table 'tincident_sla_graph_data'...\n";
    $last_values = array();
    $sql = "SELECT id_incident, utimestamp, value\n\t\t\tFROM tincident_sla_graph\n\t\t\tORDER BY utimestamp ASC";
    $new = true;
    while ($data = get_db_all_row_by_steps_sql($new, $result_sla, $sql)) {
        $new = false;
        $id_incident = $data["id_incident"];
        $value = $data["value"];
        $utimestamp = $data["utimestamp"];
        if (!isset($last_values[$id_incident]) || isset($last_values[$id_incident]) && $last_values[$id_incident] != $value) {
            $last_values[$id_incident] = $value;
            $values = array("id_incident" => $id_incident, "utimestamp" => $utimestamp, "value" => $value);
            process_sql_insert("tincident_sla_graph_data", $values);
        }
    }
    echo "Filling the table 'tincident_sla_graph_data'... DONE\n";
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:19,代码来源:incidents_old_sla_table_importer.php

示例4: array

    $value = array();
    $value["label"] = get_parameter("label");
    $value["type"] = get_parameter("type");
    $value["combo_value"] = get_parameter("combo_value");
    if ($value['type'] == 'combo') {
        if ($value['combo_value'] == '') {
            $error_combo = true;
        }
    }
    if ($value['label'] == '') {
        echo ui_print_error_message(__('Empty field name'), '', true, 'h3', true);
    } else {
        if ($error_combo) {
            echo ui_print_error_message(__('Empty combo value'), '', true, 'h3', true);
        } else {
            $result_field = process_sql_insert('tuser_field', $value);
            if ($result_field === false) {
                echo ui_print_error_message(__('Field could not be created'), '', true, 'h3', true);
            } else {
                echo ui_print_success_message(__('Field created successfully'), '', true, 'h3', true);
                $id_field = $result_field;
            }
        }
    }
}
if ($update_field) {
    //update field to incident type
    $id_field = get_parameter('id_field');
    $value_update['label'] = get_parameter('label');
    $value_update['type'] = get_parameter('type');
    $value_update['combo_value'] = get_parameter('combo_value', '');
开发者ID:articaST,项目名称:integriaims,代码行数:31,代码来源:user_field_list.php

示例5: graph_sla

function graph_sla($incident)
{
    $id_incident = $incident['id_incidencia'];
    $utimestamp = time();
    //Get sla values for this incident
    $sla_affected = get_db_value("affected_sla_id", "tincidencia", "id_incidencia", $id_incident);
    $values['id_incident'] = $id_incident;
    $values['utimestamp'] = $utimestamp;
    //If incident is affected by SLA then the graph value is 0
    if ($sla_affected) {
        $values['value'] = 0;
    } else {
        $values['value'] = 1;
    }
    $sql = sprintf("SELECT value\n\t\t\t\t\tFROM tincident_sla_graph_data\n\t\t\t\t\tWHERE id_incident = %d\n\t\t\t\t\tORDER BY utimestamp DESC", $id_incident);
    $result = get_db_row_sql($sql);
    $last_value = !empty($result) ? $result['value'] : -1;
    if ($values['value'] != $last_value) {
        //Insert SLA value in table
        process_sql_insert('tincident_sla_graph_data', $values);
    }
}
开发者ID:keunes,项目名称:integriaims,代码行数:22,代码来源:integria_cron.php

示例6: __

    } else {
        echo "<h3 class='error'>" . __('There was a problem updating row') . "</h3>";
    }
}
if ($insert_row) {
    $fields = get_db_all_rows_sql("DESC " . $external_table);
    $key = get_parameter('key');
    if ($fields == false) {
        $fields = array();
    }
    foreach ($fields as $field) {
        if ($field['Field'] != $key) {
            $values[$field['Field']] = get_parameter($field['Field']);
        }
    }
    $result_insert = process_sql_insert($external_table, $values);
    if ($result_insert) {
        echo "<h3 class='suc'>" . __('Inserted row') . "</h3>";
    } else {
        echo "<h3 class='error'>" . __('There was a problem inserting row') . "</h3>";
    }
}
echo "<h1>" . __('External table management') . "</h1>";
$table->width = '98%';
$table->class = 'search-table';
$table->id = "external-editor";
$table->data = array();
$ext_tables = inventories_get_external_tables($id_object_type);
$table->data[0][0] = print_select($ext_tables, 'external_table', $external_table, '', __('None'), "", true, false, false, __('Select external table'));
$button = '<div style=" text-align: right;">';
$button .= print_submit_button(__('Add row'), 'search', false, 'class="sub search"', true);
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:manage_external_tables.php

示例7: ui_print_error_message

	if ($value['type'] == 'linked') {
		if ($value['linked_value'] == '')
			$error_linked = true;
	}
	
	if ($value['label'] == '') {
		echo ui_print_error_message (__('Empty field name'), '', true, 'h3', true);
	} else if ($value['type'] == '0') {
		echo ui_print_error_message (__('Empty type field'), '', true, 'h3', true);
	} else if ($error_combo) {
		echo ui_print_error_message (__('Empty combo value'), '', true, 'h3', true);
	} else if ($error_linked) {
		echo ui_print_error_message (__('Empty linked value'), '', true, 'h3', true);
	} else {

		$result_field = process_sql_insert('tcontract_field', $value);
		
		if ($result_field === false) {
			echo ui_print_error_message (__('Field could not be created'), '', true, 'h3', true);
		} else {
			echo ui_print_success_message (__('Field created successfully'), '', true, 'h3', true);
			$id_field = $result_field;
		}
	}
}

if ($update_field) { //update field to incident type
	$id_field = get_parameter ('id_field');
	
	$value_update['label'] = get_parameter('label');
	$value_update['type'] = get_parameter ('type');
开发者ID:articaST,项目名称:integriaims,代码行数:31,代码来源:contract_custom_fields.php

示例8: integria_sendmail

function integria_sendmail($to, $subject = "[INTEGRIA]", $body, $attachments = false, $code = "", $from = "", $remove_header_footer = 0, $cc = "", $extra_headers = "")
{
    global $config;
    if ($to == '') {
        return false;
    }
    $to = trim(safe_output($to));
    $from = trim(safe_output($from));
    $cc = trim(safe_output($cc));
    $config["mail_from"] = trim($config["mail_from"]);
    $current_date = date("Y/m/d H:i:s");
    // We need to convert to pure ASCII here to use carriage returns
    $body = safe_output($body);
    $subject = ascii_output($subject);
    if ($remove_header_footer == 0) {
        // Add global header and footer to mail
        $body = safe_output($config["HEADER_EMAIL"]) . "\r\n" . $body . "\r\n" . safe_output($config["FOOTER_EMAIL"]);
    }
    // Add custom code to the end of message subject (to put there ID's).
    if ($code != "") {
        $subject = "[{$code}] " . $subject;
        // $body = $body."\r\nNOTICE: Please don't alter the SUBJECT when answer to this mail, it contains a special code who makes reference to this issue.";
    }
    // This is a special scenario... we store all the information "ready" in the database,
    // without HTML encoding. THis is because it is not to be rendered on a browser,
    // it will be directly to a SMTP connection.
    $values = array('date' => $current_date, 'attempts' => 0, 'status' => 0, 'recipient' => $to, 'subject' => mysql_real_escape_string($subject), 'body' => mysql_real_escape_string($body), 'attachment_list' => $attachments, 'from' => $from, 'cc' => $cc, 'extra_headers' => $extra_headers);
    process_sql_insert('tpending_mail', $values);
}
开发者ID:keunes,项目名称:integriaims,代码行数:29,代码来源:functions.php

示例9: array

		require ("general/noaccess.php");
		exit;
	}

	$values = array('progress' => 100);
	$where = array('id' => $id);
	$result = process_sql_update('tlead', $values, $where);

	if ($result > 0) {
		$values = array(
				'id_lead' => $id,
				'id_user' => $config["id_user"],
				'timestamp' => date ("Y-m-d H:i:s"),
				'description' => "Lead closed"
			);
		process_sql_insert('tlead_history', $values);

		echo ui_print_success_message (__('Successfully closed'), '', true, 'h3', true);
		$id = 0;

		if ($massive_leads_update && is_ajax()) {
			$total_result['closed'] = true;
		}
	}
}

// Delete
if ($delete) {
	
	if (!$write_permission && !$manage_permission) {
		audit_db ($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation", "Trying to delete a lead");
开发者ID:articaST,项目名称:integriaims,代码行数:31,代码来源:lead_detail.php

示例10: DISTINCT

    }
    //$id = 0;
    $sql_global_ids = "SELECT DISTINCT (global_id)\n\t\t\t\tFROM tincident_type_field\n\t\t\t\tWHERE global_id != 0";
    $global_ids = get_db_all_rows_sql($sql_global_ids);
    if ($global_ids) {
        foreach ($global_ids as $global_id) {
            $sql = "SELECT * FROM tincident_type_field WHERE id=" . $global_id['global_id'];
            $type_field = get_db_row_sql($sql);
            $value['id_incident_type'] = $id;
            $value['label'] = $type_field["label"];
            $value['type'] = $type_field["type"];
            $value['combo_value'] = $type_field["combo_value"];
            $value['linked_value'] = $type_field["linked_value"];
            $value['show_in_list'] = $type_field["show_in_list"];
            $value['global_id'] = $type_field["global_id"];
            $result = process_sql_insert('tincident_type_field', $value);
            if (!$result) {
                echo '<h3 class="error">' . __('There was a problem creating global field for type could not be created for type: ') . " " . $global_id["global_id"] . '</h3>';
            }
        }
    }
}
// UPDATE
if ($update_type) {
    $values['name'] = (string) get_parameter('name');
    $values['description'] = (string) get_parameter('description');
    //$values['id_wizard'] = (int) get_parameter ('wizard');
    //$values['id_group'] = (int) get_parameter ('id_group');
    if ($values['name'] != "") {
        $result = process_sql_update('tincident_type', $values, array('id' => $id));
        if ($result === false) {
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:type_detail.php

示例11: get_parameter

 $description = (string) get_parameter('description');
 $date = (string) get_parameter('date', date('Y-m-d'));
 $time = (string) get_parameter('time', date('H:i'));
 $duration = (int) get_parameter('duration');
 $public = (int) get_parameter('public');
 $alarm = (int) get_parameter('alarm');
 $groups = get_parameter('groups', array());
 // The 0 group is the 'none' option
 if (in_array(0, $groups)) {
     $groups = array();
 }
 $values = array('public' => $public, 'alarm' => $alarm, 'timestamp' => $date . ' ' . $time, 'id_user' => $config['id_user'], 'title' => $title, 'duration' => $duration, 'description' => $description);
 $result = false;
 if (empty($id)) {
     $old_entry = array();
     $result = process_sql_insert('tagenda', $values);
 } else {
     $old_entry = get_db_row('tagenda', 'id', $id);
     $result = process_sql_update('tagenda', $values, array('id' => $id));
 }
 if ($result !== false) {
     if (empty($id)) {
         $groups = agenda_process_privacy_groups($result, $public, $groups);
     } else {
         $groups = agenda_process_privacy_groups($id, $public, $groups);
     }
     $full_path = $config['homedir'] . '/attachment/tmp/';
     $ical_text = create_ical($date . ' ' . $time, $duration, $config['id_user'], $description, "Integria imported event: {$title}");
     $full_filename = $full_path . $config['id_user'] . '-' . microtime(true) . '.ics';
     $full_filename_h = fopen($full_filename, 'a');
     fwrite($full_filename_h, $ical_text);
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:entry.php

示例12: inventories_load_file


//.........这里部分代码省略.........
        if ($id_manufacturer != 0 && $id_manufacturer != '') {
            $exists = get_db_value('id', 'tmanufacturer', 'id', $id_manufacturer);
            if (!$exists) {
                echo "<h3 class='error'>" . __('Manufacturer ') . $id_manufacturer . __(' doesn\'t exist') . "</h3>";
                $create = false;
            }
        }
        if ($id_object_type != 0 && $id_object_type != '') {
            $exists_object_type = get_db_value('id', 'tobject_type', 'id', $id_object_type);
            if (!$exists_object_type) {
                echo "<h3 class='error'>" . __('Object type ') . $id_object_type . __(' doesn\'t exist') . "</h3>";
                $create = false;
            } else {
                //~ $all_fields = inventories_get_all_type_field ($id_object_type);
                $sql = "SELECT * FROM tobject_type_field WHERE id_object_type=" . $id_object_type;
                $all_fields = get_db_all_rows_sql($sql);
                if ($all_fields == false) {
                    $all_fields = array();
                }
                $value_data = array();
                $i = 11;
                $j = 0;
                foreach ($all_fields as $key => $field) {
                    $data = $values[$i];
                    switch ($field['type']) {
                        case 'combo':
                            $combo_val = explode(",", $field['combo_value']);
                            $k = array_search($data, $combo_val);
                            if ($k === false) {
                                echo "<h3 class='error'>" . __('Field ') . $field['label'] . __(' doesn\'t match. Valid values: ') . $field['combo_value'] . "</h3>";
                                $create = false;
                            }
                            break;
                        case 'numeric':
                            $res = is_numeric($data);
                            if (!$res) {
                                echo "<h3 class='error'>" . __('Field ') . $field['label'] . __(' must be numeric') . "</h3>";
                                $create = false;
                            }
                            break;
                        case 'external':
                            $table_ext = $field['external_table_name'];
                            $exists_table = get_db_sql("SHOW TABLES LIKE '{$table_ext}'");
                            if (!$exists_table) {
                                echo "<h3 class='error'>" . __('External table ') . $table_ext . __(' doesn\'t exist') . "</h3>";
                                $create = false;
                            }
                            $id = $field['external_reference_field'];
                            $exists_id = get_db_sql("SELECT {$id} FROM {$table_ext}");
                            if (!$exists_id) {
                                echo "<h3 class='error'>" . __('Id ') . $id . __(' doesn\'t exist') . "</h3>";
                                $create = false;
                            }
                            break;
                    }
                    if ($field['inherit']) {
                        $ok = inventories_check_unique_field($data, $field['type']);
                        if (!$ok) {
                            echo "<h3 class='error'>" . __('Field ') . $field['label'] . __(' must be unique') . "</h3>";
                            $create = false;
                        }
                    }
                    $value_data[$j]['id_object_type_field'] = $field['id'];
                    $value_data[$j]['data'] = safe_input($data);
                    $i++;
                    $j++;
                }
            }
        }
        if ($create) {
            $result_id = process_sql_insert('tinventory', $value);
            if ($result_id) {
                foreach ($value_data as $k => $val_data) {
                    $val_data['id_inventory'] = $result_id;
                    process_sql_insert('tobject_field_data', $val_data);
                }
                if (!empty($id_companies_arr)) {
                    foreach ($id_companies_arr as $id_company) {
                        $values_company['id_inventory'] = $result_id;
                        $values_company['id_reference'] = $id_company;
                        $values_company['type'] = 'company';
                        process_sql_insert('tinventory_acl', $values_company);
                    }
                }
                if (!empty($id_users_arr)) {
                    foreach ($id_users_arr as $id_user) {
                        $values_user['id_inventory'] = $result_id;
                        $values_user['id_reference'] = $id_user;
                        $values_user['type'] = 'user';
                        process_sql_insert('tinventory_acl', $values_user);
                    }
                }
            }
        }
    }
    //end while
    fclose($file_handle);
    echo "<h3 class='info'>" . __('File loaded') . "</h3>";
    return;
}
开发者ID:keunes,项目名称:integriaims,代码行数:101,代码来源:functions_inventories.php

示例13: incidents_update_incident_stats_data

function incidents_update_incident_stats_data($incident)
{
    $start_time = strtotime($incident["inicio"]);
    // Check valid date
    if ($start_time < strtotime('1970-01-01 00:00:00')) {
        return;
    }
    $id_incident = $incident["id_incidencia"];
    $last_incident_update = $incident["last_stat_check"];
    $last_incident_update_time = strtotime($last_incident_update);
    $now = time();
    $metrics = array(INCIDENT_METRIC_USER, INCIDENT_METRIC_STATUS, INCIDENT_METRIC_GROUP);
    foreach ($metrics as $metric) {
        $state = incidents_metric_to_state($metric);
        // Get the last updated item in the last incident update
        $sql = sprintf("SELECT timestamp, id_aditional\n\t\t\t\t\t\tFROM tincident_track\n\t\t\t\t\t\tWHERE id_incident = %d\n\t\t\t\t\t\t\tAND state = %d\n\t\t\t\t\t\t\tAND timestamp < '%s'\n\t\t\t\t\t\tORDER BY timestamp DESC\n\t\t\t\t\t\tLIMIT 1", $id_incident, $state, $last_incident_update);
        $last_updated_value = process_sql($sql);
        if ($last_updated_value === false) {
            $last_updated_value = array();
        }
        // Get the changes of the metric from the incident track table
        // Get only the changes produced before the last incident update
        // in ascending order
        $sql = sprintf("SELECT timestamp, id_aditional\n\t\t\t\t\t\tFROM tincident_track\n\t\t\t\t\t\tWHERE id_incident = %d\n\t\t\t\t\t\t\tAND state = %d\n\t\t\t\t\t\t\tAND timestamp > '%s'\n\t\t\t\t\t\tORDER BY timestamp ASC", $id_incident, $state, $last_incident_update);
        $track_values = process_sql($sql);
        if ($track_values === false) {
            $track_values = array();
        }
        // If there is no changes since the last incident update,
        // the actual value is updated
        if (count($track_values) < 1 && count($last_updated_value) > 0) {
            incidents_update_stats_item($id_incident, $last_updated_value[0]["id_aditional"], $metric, $last_incident_update_time, $now);
        }
        // Go over the changes to create the stat items and set the seconds
        // passed in every state
        for ($i = 0; $i < count($track_values); $i++) {
            $min_time = strtotime($track_values[$i]["timestamp"]);
            if ($track_values[$i + 1]) {
                // There was a change after this change
                $max_time = strtotime($track_values[$i + 1]["timestamp"]);
            } else {
                // The actual value
                $max_time = $now;
            }
            // Final update to the last metric item of the last incident update
            if (!$track_values[$i - 1] && count($last_updated_value) > 0) {
                incidents_update_stats_item($id_incident, $last_updated_value[0]["id_aditional"], $metric, $last_incident_update_time, $min_time);
            }
            incidents_update_stats_item($id_incident, $track_values[$i]["id_aditional"], $metric, $min_time, $max_time);
        }
    }
    // total_time
    $filter = array("metric" => INCIDENT_METRIC_STATUS, "status" => STATUS_CLOSED, "id_incident" => $id_incident);
    $closed_time = get_db_value_filter("seconds", "tincident_stats", $filter);
    if (!$closed_time) {
        $closed_time = 0;
    }
    $start_time = strtotime($incident["inicio"]);
    $holidays_seconds = incidents_get_holidays_seconds_by_timerange($start_time, $now);
    $total_time = $now - $start_time - $closed_time - $holidays_seconds;
    $sql = sprintf("SELECT id\n\t\t\t\t\tFROM tincident_stats\n\t\t\t\t\tWHERE id_incident = %d\n\t\t\t\t\t\tAND metric = '%s'", $id_incident, INCIDENT_METRIC_TOTAL_TIME);
    $row = get_db_row_sql($sql);
    //Check if we have a previous stat metric to update or create it
    if ($row) {
        $val_upd = array("seconds" => $total_time);
        $val_where = array("id" => $row["id"]);
        process_sql_update("tincident_stats", $val_upd, $val_where);
    } else {
        $val_new = array("seconds" => $total_time, "metric" => INCIDENT_METRIC_TOTAL_TIME, "id_incident" => $id_incident);
        process_sql_insert("tincident_stats", $val_new);
    }
    // total_w_third
    $filter = array("metric" => INCIDENT_METRIC_STATUS, "status" => STATUS_PENDING_THIRD_PERSON, "id_incident" => $id_incident);
    $third_time = get_db_value_filter("seconds", "tincident_stats", $filter);
    if (!$third_time || $third_time < 0) {
        $third_time = 0;
    }
    $total_time -= $third_time;
    $sql = sprintf("SELECT id\n\t\t\t\t\tFROM tincident_stats\n\t\t\t\t\tWHERE id_incident = %d\n\t\t\t\t\t\tAND metric = '%s'", $id_incident, INCIDENT_METRIC_TOTAL_TIME_NO_THIRD);
    $row = get_db_row_sql($sql);
    //Check if we have a previous stat metric to update or create it
    if ($row) {
        $val_upd = array("seconds" => $total_time);
        $val_where = array("id" => $row["id"]);
        process_sql_update("tincident_stats", $val_upd, $val_where);
    } else {
        $val_new = array("seconds" => $total_time, "metric" => INCIDENT_METRIC_TOTAL_TIME_NO_THIRD, "id_incident" => $id_incident);
        process_sql_insert("tincident_stats", $val_new);
    }
    //Update last_incident_update field from tincidencia
    $update_values = array("last_stat_check" => date("Y-m-d H:i:s", $now));
    process_sql_update("tincidencia", $update_values, array("id_incidencia" => $id_incident));
}
开发者ID:dsyman2,项目名称:integriaims,代码行数:93,代码来源:functions_incidents.php

示例14: inventory_update_users

/**
 * Update affected users in an inventory.
 *
 * @param int inventory id to update.
 * @param array List of affected users ids.
 * @param update = false to create and update = true to update
 */
function inventory_update_users($id_inventory, $users, $update = false)
{
    error_reporting(0);
    $where_clause = '';
    if (empty($users)) {
        $users = array(0);
    }
    if ($update) {
        $sql = sprintf("DELETE FROM tinventory_acl WHERE id_inventory = %d AND type='user'", $id_inventory);
        $res = process_sql($sql);
        if ($res !== false && $res > 0) {
            $updated = true;
        }
    }
    $type = 'user';
    foreach ($users as $key => $id_user) {
        if ($id_user != '') {
            $value = array();
            $value['id_inventory'] = $id_inventory;
            $value['id_reference'] = $id_user;
            $value['type'] = $type;
            $tmp = process_sql_insert('tinventory_acl', $value);
        }
    }
    if ($update && $updated === true) {
        inventory_tracking($id_inventory, INVENTORY_USERS_UPDATED);
    } else {
        if (!empty($users) && $users != array(0)) {
            inventory_tracking($id_inventory, INVENTORY_USERS_CREATED);
        }
    }
}
开发者ID:articaST,项目名称:integriaims,代码行数:39,代码来源:functions_inventories.php

示例15: move_file_sharing_items

/**
 * Move file sharing items to file releases section (attachment/downloads) and 
 * remove it from file sharing section (attachment/file_sharing)
 */
function move_file_sharing_items()
{
    global $config;
    $file_sharing_path = $config["homedir"] . "attachment/file_sharing/";
    $new_path = $config["homedir"] . "attachment/downloads/";
    if (is_dir($file_sharing_path)) {
        if ($dh = opendir($file_sharing_path)) {
            while (($file = readdir($dh)) !== false) {
                if (is_dir($file_sharing_path . $file) && $file != "." && $file != "..") {
                    $file_path = $file_sharing_path . $file . "/";
                    if ($dh2 = opendir($file_sharing_path . $file)) {
                        while (($file2 = readdir($dh2)) !== false) {
                            if ($file2 != "." && $file2 != "..") {
                                copy($file_path . $file2, $new_path . $file2);
                                $external_id = sha1(random_string(12) . date());
                                $values = array('name' => $file2, 'location' => "attachment/downloads/{$file2}", 'description' => "Migrated from file sharing", 'id_category' => 0, 'id_user' => $config["id_user"], 'date' => date("Y-m-d H:i:s"), 'public' => 1, 'external_id' => $external_id);
                                process_sql_insert("tdownload", $values);
                                unlink($file_path . $file2);
                            }
                        }
                    }
                    closedir($dh2);
                    rmdir($file_path);
                }
            }
        }
        closedir($dh);
        rmdir($file_sharing_path);
    }
    process_sql("INSERT INTO tconfig (`token`,`value`) VALUES ('file_sharing_items_moved', 1)");
}
开发者ID:articaST,项目名称:integriaims,代码行数:35,代码来源:integria_cron.php


注:本文中的process_sql_insert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。