function refresh_extension($id)
{
    global $db;
    $query = array('SELECT' => 'id', 'FROM' => 'extensions', 'WHERE' => 'id="' . $id . '"');
    //hook space
    $install_check = $db->query_build($query) or error(__FILE__, __LINE__);
    $installed = $db->num_rows($install_check) == 1 ? true : false;
    if ($installed === true) {
        uninstall_extension($id);
        install_extension($id);
    }
}
************************************************************************/
define('OPENLD_ROOT', './');
require OPENLD_ROOT . 'admin_header.php';
require OPENLD_ROOT . 'include/xml.php';
function get_ext_title($ext_file)
{
    $ext_data = xml_to_array(@file_get_contents(OPENLD_ROOT . 'extensions/' . $ext_file . '/extension.xml'));
    $manifest_errors = validate_manifest($ext_data, $ext_file);
    return empty($manifest_errors) ? openld_htmlspecialchars($ext_data['extension']['title']) : $ext_file;
}
if (isset($_REQUEST['install'])) {
    install_extension($_REQUEST['install']);
    //reffresh page, in order to avoid $db error when Browser->Back after chmoding
    redirect($settings['domain'] . "/admin_extensions.php");
} elseif (isset($_REQUEST['uninstall'])) {
    uninstall_extension($_REQUEST['uninstall']);
    //reffresh page, in order to avoid $db error when Browser->Back after chmoding
    redirect($settings['domain'] . "/admin_extensions.php");
} elseif (isset($_REQUEST['id_edit'])) {
    $_REQUEST['hooks'] = str_replace('\\n', '\\n\\t\\t', $_REQUEST['hooks']);
    $ext_texta = '<?xml version="1.0" encoding="UTF-8"?>

<extension>
	<id>' . $_REQUEST['id_edit'] . '</id>
	<title>' . $_REQUEST['title'] . '</title>
	<version>' . $_REQUEST['version'] . '</version>
	<author>' . $_REQUEST['author'] . '</author>
	<description>' . $_REQUEST['description'] . '</description>
	<hooks>' . $_REQUEST['hooks'] . '</hooks>
</extension>';
    ($hook = get_hook('admin_extensions_edit_file_simple')) ? eval($hook) : null;