'update_pandora_conf_url'));
if (empty($row)) {
//The url of update manager.
$conf_update_pandora = array('url' => 'http://192.168.70.213/pandora.tar.gz',
'last_installed' => '',
'last_contact' => '');
$values = array('token' => 'update_pandora_conf_url',
'value' => $conf_update_pandora['url']);
$return = db_process_sql_insert('tconfig', $values);
$values = array('token' => 'update_pandora_conf_last_installed',
'value' => $conf_update_pandora['last_installed']);
$return = db_process_sql_insert('tconfig', $values);
$values = array('token' => 'update_pandora_conf_last_contact',
'value' => $conf_update_pandora['last_contact']);
$return = db_process_sql_insert('tconfig', $values);
ui_print_result_message($return, __('Succesful store conf data in DB.'),
__('Unsuccesful store conf data in DB.'));
}
else {
ui_print_message(__('Conf data have been in the DB.'));
}
$dir = $config['attachment_store'] . '/update_pandora/';
if (!is_dir($dir)) {
$result = mkdir($dir);
ui_print_result_message($result, __('Succesful create a dir to save package in Pandora Console'),
__('Unsuccesful create a dir to save package in Pandora Console'));
}
else {
ui_print_message(__('The directory for save package have been in Pandora Console.'));
}
}
function update_pandora_update_conf() {
global $config;
global $conf_update_pandora;
$values = array('value' => $conf_update_pandora['last_installed']);
$return = db_process_sql_update('tconfig', $values,
array('token' => 'update_pandora_conf_last_installed'));
$values = array('value' => $conf_update_pandora['last_contact']);
$return = db_process_sql_update('tconfig', $values,
array('token' => 'update_pandora_conf_last_contact'));
return $return;
}
function update_pandora_get_list_downloaded_packages($mode = 'operation') {
global $config;
global $conf_update_pandora;
$dir = dir($conf_update_pandora['dir']);
$packages = array();
while (false !== ($entry = $dir->read())) {
if (is_file($conf_update_pandora['dir'] . $entry)
&& is_readable($conf_update_pandora['dir'] . $entry)) {
if (strstr($entry, '.tar.gz') !== false) {
if ($mode == 'operation') {
$packages[] = $entry;
}
else {
if ($conf_update_pandora['last_installed'] == $entry) {
$packages[] = array('name' => $entry,
'current' => true);
}
else {
$packages[] = array('name' => $entry,
'current' => false);
}
}
}
}
}
if (empty($packages)) {
if ($mode == 'operation') {
$packages[] = array('name' =>
__('There are not downloaded packages in your Pandora Console.'));
}
else {
$packages[] = array('empty' => true, 'name' =>
__('There are not downloaded packages in your Pandora Console.'));
}
}
return $packages;
}
function update_pandora_print_javascript() {
$extension_php_file = 'extensions/update_pandora';
?>