本文整理汇总了PHP中update_application函数的典型用法代码示例。如果您正苦于以下问题:PHP update_application函数的具体用法?PHP update_application怎么用?PHP update_application使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_application函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['zimbra'])) {
$app_id = discover_app($device, 'zimbra');
update_application($app_id, array());
foreach ($agent_data['app']['zimbra'] as $key => $value) {
# key is "vm", "mysql" etc, value is the csv output
$zimbra[$key] = parse_csv($value);
}
if (is_array($zimbra['mtaqueue'])) {
/*
timestamp, KBytes, requests
04/23/2013 18:19:30, 0, 0
*/
rrdtool_update_ng($device, 'zimbra-mtaqueue', array('kBytes' => $zimbra['mtaqueue'][0]['KBytes'], 'requests' => $zimbra['mtaqueue'][0]['requests']));
}
if (is_array($zimbra['fd'])) {
/*
timestamp, fd_count, mailboxd_fd_count
04/23/2013 18:40:53, 5216, 1451
*/
示例2: rrdtool_create
$rrd_queries .= "DS:numQueries:DERIVE:600:0:125000000000 ";
$rrd_queries .= "DS:numQueryUDP:DERIVE:600:0:125000000000 \\\n DS:numQueryUDP6:DERIVE:600:0:125000000000 \\\n DS:numQueryTCP:DERIVE:600:0:125000000000 \\\n DS:numQueryTCP6:DERIVE:600:0:125000000000 \\\n DS:numQueryEDNS:DERIVE:600:0:125000000000 \\\n DS:numQueryEDNSErr:DERIVE:600:0:125000000000 \\\n DS:numQueryRecieveErr:DERIVE:600:0:125000000000 \\\n DS:numQueryTransferErr:DERIVE:600:0:125000000000 \\\n DS:numRequestAXFR:DERIVE:600:0:125000000000 \\\n DS:numQueryTruncated:DERIVE:600:0:125000000000 \\\n DS:numQueryDropped:DERIVE:600:0:125000000000 \\\n DS:numQueriesWoAA:DERIVE:600:0:125000000000 \\\n ";
rrdtool_create($device, $rrd_filename, "" . $rrd_queries);
foreach ($dns_qtype as $qtype) {
$rrd_values[] = $nsd["num.type.{$qtype}"];
}
$rrd_values[] = $nsd["num.class.IN"];
foreach ($dns_rcode as $rcode) {
$rrd_values[] = $nsd["num.rcode.{$rcode}"];
}
$rrd_values[] = $nsd["num.opcode.IN"];
$rrd_values[] = $nsd["num.queries"];
foreach (array('num.udp', 'num.udp6', 'num.tcp', 'num.tcp6', 'num.edns', 'num.ednserr', 'num.rxerr', 'num.txerr', 'num.raxfr', 'num.truncated', 'num.dropped', 'num.answer_wo_aa') as $key) {
$rrd_values[] = $nsd[$key];
}
update_application($app_id, $nsd);
rrdtool_update($device, $rrd_filename, "N:" . implode(':', $rrd_values));
unset($rrd_values);
$serverNum = 0;
while (1) {
if (isset($nsd["server{$serverNum}.queries"])) {
$rrd_filename = "app-nsd-server{$serverNum}.rrd";
rrdtool_create($device, $rrd_filename, "DS:numQueries:DERIVE:600:0:125000000000");
rrdtool_update($device, $rrd_filename, "N:" . $nsd["server{$serverNum}.queries"]);
$serverNum++;
} else {
break;
}
}
unset($serverNum);
}
示例3: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// Correct output of the agent script should look like this:
//<<<exim-mailqueue>>>
//frozen:173
//bounces:1052
//total:2496
//active:2323
if (!empty($agent_data['app']['exim-mailqueue'])) {
$app_id = discover_app($device, 'exim-mailqueue');
foreach (explode("\n", $agent_data['app']['exim-mailqueue']) as $line) {
list($item, $value) = explode(":", $line, 2);
$exim_data[trim($item)] = trim($value);
}
update_application($app_id, $exim_data);
rrdtool_update_ng($device, 'exim-mailqueue', $exim_data, $app_id);
unset($line, $item, $value, $exim_data, $app_id);
}
// EOF
示例4: discover_app
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['mysql'])) {
$app_id = discover_app($device, 'mysql');
$map = array();
foreach (explode("\n", $agent_data['app']['mysql']) as $str) {
list($key, $value) = explode(":", $str);
$map[$key] = trim($value);
}
// General Stats
$mapping = array('IDBLBSe' => 'cr', 'IBLFh' => 'ct', 'IBLWn' => 'cu', 'IBLWn' => 'cu', 'SRows' => 'ck', 'SRange' => 'cj', 'SMPs' => 'ci', 'SScan' => 'cl', 'IBIRd' => 'ai', 'IBIWr' => 'aj', 'IBILg' => 'ak', 'IBIFSc' => 'ah', 'IDBRDd' => 'b2', 'IDBRId' => 'b0', 'IDBRRd' => 'b3', 'IDBRUd' => 'b1', 'IBRd' => 'ae', 'IBCd' => 'af', 'IBWr' => 'ag', 'TLIe' => 'b5', 'TLWd' => 'b4', 'IBPse' => 'aa', 'IBPDBp' => 'ac', 'IBPFe' => 'ab', 'IBPMps' => 'ad', 'TOC' => 'bc', 'OFs' => 'b7', 'OTs' => 'b8', 'OdTs' => 'b9', 'IBSRs' => 'ay', 'IBSWs' => 'ax', 'IBOWs' => 'az', 'QCs' => 'c1', 'QCeFy' => 'bu', 'MaCs' => 'bl', 'MUCs' => 'bf', 'ACs' => 'bd', 'AdCs' => 'be', 'TCd' => 'bi', 'Cs' => 'bn', 'IBTNx' => 'a5', 'KRRs' => 'a0', 'KRs' => 'a1', 'KWR' => 'a2', 'KWs' => 'a3', 'QCQICe' => 'bz', 'QCHs' => 'bv', 'QCIs' => 'bw', 'QCNCd' => 'by', 'QCLMPs' => 'bx', 'CTMPDTs' => 'cn', 'CTMPTs' => 'cm', 'CTMPFs' => 'co', 'IBIIs' => 'au', 'IBIMRd' => 'av', 'IBIMs' => 'aw', 'IBILog' => 'al', 'IBISc' => 'am', 'IBIFLg' => 'an', 'IBFBl' => 'aq', 'IBIIAo' => 'ap', 'IBIAd' => 'as', 'IBIAe' => 'at', 'SFJn' => 'cd', 'SFRJn' => 'ce', 'SRe' => 'cf', 'SRCk' => 'cg', 'SSn' => 'ch', 'SQs' => 'b6', 'BRd' => 'cq', 'BSt' => 'cp', 'CDe' => 'c6', 'CIt' => 'c4', 'CISt' => 'ca', 'CLd' => 'c8', 'CRe' => 'c7', 'CRSt' => 'cc', 'CSt' => 'c5', 'CUe' => 'c3', 'CUMi' => 'c9');
$values = array();
foreach ($mapping as $key => $value) {
$values[$key] = $map[$value];
}
rrdtool_update_ng($device, 'mysql', $values, $app_id);
// Process state statistics
// Derr, not sure what the key part of the array is for, apart from some documentation, as d* is passed from agent into RRD.
$mapping_status = array('State_closing_tables' => 'd2', 'State_copying_to_tmp_table' => 'd3', 'State_end' => 'd4', 'State_freeing_items' => 'd5', 'State_init' => 'd6', 'State_locked' => 'd7', 'State_login' => 'd8', 'State_preparing' => 'd9', 'State_reading_from_net' => 'da', 'State_sending_data' => 'db', 'State_sorting_result' => 'dc', 'State_statistics' => 'dd', 'State_updating' => 'de', 'State_writing_to_net' => 'df', 'State_none' => 'dg', 'State_other' => 'dh');
$valuesb = array();
foreach ($mapping_status as $key => $value) {
$valuesb[$value] = $map[$value];
}
update_application($app_id, array_merge($values, $valuesb));
rrdtool_update_ng($device, 'mysql-status', $valuesb, $app_id);
}
// EOF
示例5: db_save_application
function db_save_application($name, $hostid, $applicationid = null, $templateid = 0)
{
if (!is_string($name)) {
error('Incorrect parameters for "db_save_application"');
return false;
}
$host = get_host_by_hostid($hostid);
$hostids = array();
$db_hosts = get_hosts_by_templateid($host['hostid']);
while ($db_host = DBfetch($db_hosts)) {
$hostids[] = $db_host['hostid'];
}
$sql = 'SELECT applicationid
FROM applications
WHERE name=' . zbx_dbstr($name) . '
AND ' . DBcondition('hostid', $hostids);
$lower_app = DBfetch(DBselect($sql));
if ($lower_app) {
error(S_APPLICATION . SPACE . "'{$name}'" . SPACE . S_ALREADY_EXISTS_IN_LINKED_HOSTS_SMALL);
return false;
}
$sql = 'SELECT applicationid
FROM applications
WHERE name=' . zbx_dbstr($name) . '
AND hostid=' . $hostid;
if (!is_null($applicationid)) {
$sql .= ' AND applicationid<>' . $applicationid;
}
$db_app = DBfetch(DBselect($sql));
if ($db_app && $templateid == 0) {
error(S_APPLICATION . SPACE . "'{$name}'" . SPACE . S_ALREADY_EXISTS_SMALL);
return false;
}
if ($db_app && !is_null($applicationid)) {
// delete old application with same name
delete_application($db_app['applicationid']);
}
if ($db_app && is_null($applicationid)) {
// if found application with same name update them, adding not needed
$applicationid = $db_app['applicationid'];
}
if (is_null($applicationid)) {
$applicationid_new = get_dbid('applications', 'applicationid');
$sql = 'INSERT INTO applications (applicationid, name, hostid, templateid) ' . " VALUES ({$applicationid_new}, " . zbx_dbstr($name) . ", {$hostid}, {$templateid})";
if ($result = DBexecute($sql)) {
info(S_ADDED_NEW_APPLICATION . SPACE . $host['host'] . ':' . $name);
}
} else {
$old_app = get_application_by_applicationid($applicationid);
$result = DBexecute('UPDATE applications SET name=' . zbx_dbstr($name) . ', hostid=' . $hostid . ', templateid=' . $templateid . ' WHERE applicationid=' . $applicationid);
if ($result) {
info(S_UPDATED_APPLICATION . SPACE . $host['host'] . ':' . $old_app['name']);
}
}
if (!$result) {
return $result;
}
if (is_null($applicationid)) {
// create application for childs
$applicationid = $applicationid_new;
$db_childs = get_hosts_by_templateid($hostid);
while ($db_child = DBfetch($db_childs)) {
// recursion
$result = add_application($name, $db_child['hostid'], $applicationid);
if (!$result) {
break;
}
}
} else {
$db_applications = get_applications_by_templateid($applicationid);
while ($db_app = DBfetch($db_applications)) {
// recursion
$result = update_application($db_app['applicationid'], $name, $db_app['hostid'], $applicationid);
if (!$result) {
break;
}
}
}
if ($result) {
return $applicationid;
}
if ($templateid == 0) {
delete_application($applicationid);
}
return false;
}
示例6: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['asterisk'])) {
$app_id = discover_app($device, 'asterisk');
foreach (explode("\n", $agent_data['app']['asterisk']) as $line) {
list($key, $val) = explode(":", $line);
$asterisk_data[trim($key)] = intval(trim($val));
}
update_application($app_id, $asterisk_data);
rrdtool_update_ng($device, 'asterisk', $asterisk_data, $app_id);
unset($key, $line, $val, $asterisk_data, $app_id);
}
// EOF
示例7: db_save_application
function db_save_application($name, $hostid, $applicationid = null, $templateid = 0)
{
if (!is_string($name)) {
error("Incorrect parameters for 'db_save_application'");
return false;
}
if (is_null($applicationid)) {
$result = DBselect('SELECT * FROM applications WHERE name=' . zbx_dbstr($name) . ' AND hostid=' . $hostid);
} else {
$result = DBselect('SELECT * ' . ' FROM applications ' . ' WHERE name=' . zbx_dbstr($name) . ' AND hostid=' . $hostid . ' AND applicationid<>' . $applicationid);
}
$db_app = DBfetch($result);
if ($db_app && $templateid == 0) {
error('Application "' . $name . '" already exists');
return false;
}
if ($db_app && $applicationid != null) {
// delete old application with same name
delete_application($db_app["applicationid"]);
}
if ($db_app && $applicationid == null) {
// if found application with same name update them, adding not needed
$applicationid = $db_app["applicationid"];
}
$host = get_host_by_hostid($hostid);
if (is_null($applicationid)) {
$applicationid_new = get_dbid('applications', 'applicationid');
$sql = 'INSERT INTO applications (applicationid,name,hostid,templateid) ' . " VALUES ({$applicationid_new}," . zbx_dbstr($name) . ",{$hostid},{$templateid})";
if ($result = DBexecute($sql)) {
info("Added new application " . $host["host"] . ":{$name}");
}
} else {
$old_app = get_application_by_applicationid($applicationid);
if ($result = DBexecute('UPDATE applications ' . ' SET name=' . zbx_dbstr($name) . ',hostid=' . $hostid . ',templateid=' . $templateid . ' WHERE applicationid=' . $applicationid)) {
info("Updated application " . $host["host"] . ":" . $old_app["name"]);
}
}
if (!$result) {
return $result;
}
if (is_null($applicationid)) {
// create application for childs
$applicationid = $applicationid_new;
$db_childs = get_hosts_by_templateid($hostid);
while ($db_child = DBfetch($db_childs)) {
// recursion
$result = add_application($name, $db_child["hostid"], $applicationid);
if (!$result) {
break;
}
}
} else {
$db_applications = get_applications_by_templateid($applicationid);
while ($db_app = DBfetch($db_applications)) {
// recursion
$result = update_application($db_app["applicationid"], $name, $db_app["hostid"], $applicationid);
if (!$result) {
break;
}
}
}
if ($result) {
return $applicationid;
}
if ($templateid == 0) {
delete_application($applicationid);
}
return false;
}
示例8: foreach
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (is_array($agent_data['app']['openvpn'])) {
foreach ($agent_data['app']['openvpn'] as $key => $entry) {
if (substr($key, 0, 9) == 'loadstats') {
list(, $instance) = explode('-', $key, 2);
$loadstats[$instance] = array();
# SUCCESS: nclients=1,bytesin=484758,bytesout=180629
foreach (explode(',', str_replace('SUCCESS: ', '', $entry)) as $keyvalue) {
list($key, $value) = explode('=', $keyvalue, 2);
$loadstats[$instance][$key] = $value;
}
}
}
}
foreach ($loadstats as $instance => $data) {
$app_id = discover_app($device, 'openvpn', $instance);
update_application($app_id, $data);
rrdtool_update_ng($device, 'openvpn', $data, $instance);
}
unset($loadstats);
// EOF
示例9: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['postfix_qshape'])) {
$app_id = discover_app($device, 'postfix_qshape');
foreach (explode("\n", $agent_data['app']['postfix_qshape']) as $line) {
list($item, $value) = explode(":", $line, 2);
$queue_data[trim($item)] = trim($value);
}
rrdtool_update_ng($device, 'postfix-qshape', $queue_data);
update_application($app_id, $queue_data);
unset($queue_data, $item, $value);
}
// EOF
示例10: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['ntpd'])) {
$app_id = discover_app($device, 'ntpd');
foreach (explode("\n", $agent_data['app']['ntpd']) as $line) {
list($item, $value) = explode(":", $line, 2);
$ntpd_data[trim($item)] = trim($value);
}
$ntpd_type = isset($ntpd_data['server']) ? "server" : "client";
switch ($ntpd_type) {
case 'server':
rrdtool_update_ng($device, 'ntpd-server', $ntpd_data, $app_id);
break;
case 'client':
rrdtool_update_ng($device, 'ntpd-client', $ntpd_data, $app_id);
break;
}
update_application($app_id, $ntpd_data);
unset($ntpd_type, $app_id, $ntpd_data);
}
// EOF
示例11: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['postgresql'])) {
$app_id = discover_app($device, 'postgresql');
foreach (explode("\n", $agent_data['app']['postgresql']) as $line) {
list($item, $value) = explode(":", $line, 2);
$pgsql_data[trim($item)] = trim($value);
}
// there are differences between stats in postgresql 8.x and 9.x
// if $pgsql_data['version']
rrdtool_update_ng($device, 'postgresql', $pgsql_data, $app_id);
update_application($app_id, $pgsql_data);
unset($app_id, $pgsql_data, $item, $value, $line);
}
// EOF
示例12: update_workflow
function update_workflow(&$application, $approved = true, $data = null)
{
$approver_email = '';
// Update the application record
if ($application->approval_level == 0) {
// Being submitted
/* $application->approval_level = 1;
$approver_email = $application->manager_email;
} else if ($application->approval_level == 1) { // Manager
$application->approval_1_comment = $data->comment;
$application->approval_1_date = time();
if (!$approved) {
$application->approval_state = 1; // Rejected
} else*/
if ($application->self_funding == 0) {
$application->approval_level = 2;
// Funder
$application->funding_id = $data->funding_organisation;
if ($application->funding_id == 0) {
// 'Other Organisation'
$application->funding_organisation = '';
$application->funder_email = $data->funder_email;
// Must have been given
} else {
// A known organisation with a fixed email address
$organisation = read_organisation($application->funding_id);
$application->funding_organisation = $organisation->name;
$application->funder_email = $organisation->email;
}
$approver_email = $application->funder_email;
} else {
$application->approval_level = 3;
// Brookes
$hls = get_complete_user_data('username', 'hls');
$approver_email = $hls->email;
}
} else {
if ($application->approval_level == 2) {
// Funder
$application->approval_2_comment = $data->comment;
$application->approval_2_date = time();
if (!$approved) {
$application->approval_state = 1;
// Rejected
} else {
$application->approval_level = 3;
// Brookes
// Store the funding details
if ($application->funding_organisation != '') {
// NHS trust (previously selected by the manager)
$application->funding_method = $data->funding_method;
$application->funder_name = $data->funder_name;
if ($application->funding_method == 1) {
// Invoice
$application->invoice_ref = $data->invoice_ref;
$application->invoice_address = $data->invoice_address;
$application->invoice_email = $data->invoice_email;
$application->invoice_phone = $data->invoice_phone;
$application->invoice_contact = $data->invoice_contact;
}
} else {
// Must be an invoice to a non-NHS organisation
$application->funding_method = 0;
$application->funding_organisation = $data->organisation;
$application->invoice_ref = $data->invoice_ref;
$application->invoice_address = $data->invoice_address;
$application->invoice_email = $data->invoice_email;
$application->invoice_phone = $data->invoice_phone;
$application->invoice_contact = $data->invoice_contact;
}
$hls = get_complete_user_data('username', 'hls');
$approver_email = $hls->email;
}
} else {
// Brookes
$application->approval_3_comment = $data->comment;
$application->approval_3_date = time();
if (!$approved) {
$application->approval_state = 1;
// Rejected
} else {
$application->approval_state = 2;
// It ends here
}
}
}
update_application($application);
// Update the stored approval requests and send notification emails
update_approver($application, $approver_email);
}
示例13: json_decode
$crashplan_data = json_decode($agent_data['app']['crashplan']['server'], TRUE);
if (is_array($crashplan_data['data']['servers'])) {
# [serverName] => crashplan.luciad.com
# [totalBytes] => 16995951050752
# [usedBytes] => 16322661449728
# [usedPercentage] => 96
# [freeBytes] => 673289601024
# [freePercentage] => 4
# [coldBytes] => 3762904182328
# [coldPercentageOfUsed] => 23
# [coldPercentageOfTotal] => 22
# [archiveBytes] => 11678769817966
# [selectedBytes] => 19313807393642
# [remainingBytes] => 379281681813
# [inboundBandwidth] => 53
# [outboundBandwidth] => 67
# [orgCount] => 1
# [userCount] => 83
# [computerCount] => 97
# [onlineComputerCount] => 27
# [backupSessionCount] => 0
foreach ($crashplan_data['data']['servers'] as $crashplan_server) {
$crashplan_servers[] = $crashplan_server['serverName'];
update_application($app_id, $crashplan_data);
rrdtool_update_ng($device, 'crashplan', array('totalBytes' => $crashplan_server['totalBytes'], 'usedBytes' => $crashplan_server['usedBytes'], 'usedPercentage' => $crashplan_server['usedPercentage'], 'freeBytes' => $crashplan_server['freeBytes'], 'freePercentage' => $crashplan_server['freePercentage'], 'coldBytes' => $crashplan_server['coldBytes'], 'coldPctOfUsed' => $crashplan_server['coldPercentageOfUsed'], 'coldPctOfTotal' => $crashplan_server['coldPercentageOfTotal'], 'archiveBytes' => $crashplan_server['archiveBytes'], 'selectedBytes' => $crashplan_server['selectedBytes'], 'remainingBytes' => $crashplan_server['remainingBytes'], 'inboundBandwidth' => $crashplan_server['inboundBandwidth'], 'outboundBandwidth' => $crashplan_server['outboundBandwidth'], 'orgCount' => $crashplan_server['orgCount'], 'userCount' => $crashplan_server['userCount'], 'computerCount' => $crashplan_server['computerCount'], 'onlineComputerCount' => $crashplan_server['onlineComputerCount'], 'backupSessionCount' => $crashplan_server['backupSessionCount']), $crashplan_server['serverName']);
}
# Set list of servers as device attribute so we can use it in the web interface
set_dev_attrib($device, 'crashplan_servers', json_encode($crashplan_servers));
}
}
// EOF
示例14: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// FIXME - INSTANCES
if (!empty($agent_data['app']['shoutcast'])) {
$app_id = discover_app($device, 'shoutcast');
// Polls shoutcast statistics from agent script
$servers = explode("\n", $agent_data['app']['shoutcast']);
$data = array();
foreach ($servers as $item => $server) {
$server = trim($server);
if (!empty($server)) {
$data = explode(";", $server);
list($host, $port) = explode(":", $data[0], 2);
$stats[$data[0]] = array('bitrate' => $data[1], 'traf_in' => $data[2], 'traf_out' => $data[3], 'current' => $data[4], 'status' => $data[5], 'peak' => $data[6], 'max' => $data[7], 'unique' => $data[8]);
rrdtool_update_ng($device, 'shoutcast', $stats[$data[0]], "{$app_id}-" . $host . "_" . $port);
}
}
update_application($app_id, $stats);
unset($app_id, $host, $port, $data, $servers, $server, $item);
}
// EOF
示例15: get_itunes_info
$API->error($API->LANG->_('There is something wrong with your torrent file'));
}
// do not preform cheks on torrents
//$torrent->announce(false);
//$torrent->announce(array('http://pixi.appaddict.org:2710/announce'));
$magnet = $torrent->magnet();
}
require_once 'itgw.inc.php';
$data = get_itunes_info($trackid, $type, $store);
if (!$appdata && !$data) {
$API->TPL->assign('trackid', $trackid);
$API->TPL->display('no-app-error-itunes.tpl');
die;
} elseif ($data) {
$data['last_parse_itunes'] = $data;
update_application($data, $trackid);
}
if (!$appdata && $data) {
if ($data['price'] == 'Free') {
$paidfreeapps = $API->DB->query_row("SELECT (SELECT COUNT(DISTINCT links.trackid) FROM links LEFT JOIN apps ON links.trackid=apps.trackid WHERE apps.price='Free' AND links.uploader_id={$API->account['id']}) AS free, (SELECT COUNT(DISTINCT links.trackid) FROM links LEFT JOIN apps ON links.trackid=apps.trackid WHERE apps.price!='Free' AND links.uploader_id={$API->account['id']}) AS paid");
$paid_apps = $paidfreeapps['paid'];
$free_apps = $paidfreeapps['free'];
if ($free_apps > $paid_apps) {
$API->error($API->LANG->_('FREE_CONTENT_UPLOAD_ERROR', $paid_apps, $free_apps));
}
}
$success = upload_application($data);
if (!$success) {
$API->error($API->LANG->_('There is an error with your upload.'));
}
} elseif (!$data) {