Example #1
0
/**
 * Funcion para ajustar los puntos devueltos por la consulta extendiendolos un 10% con
 * respecto a su distancia actual
 * @param int punto: punto para ajustar
 * @param float porcentaje: porcentaje de zoom
 * @param float dimension: dimenciones actuales del panel, dadas por x o y
 * @return punto : punto ajustado
 */
function ajustar($punto, $nivel, $dimension, $m)
{
    $i = $nivel;
    //nivel actual de zoom
    if ($i < 0) {
        $i = $i * -1;
        //pasar a positivo
        while ($i > 0) {
            $dimension = $dimension - $dimension * 0.1;
            $punto = $punto - $punto * 0.1;
            $punto = $punto + $dimension * 0.1;
            //centrar 10%
            $i -= 1;
        }
    } else {
        $dimension = mover($nivel, $dimension);
        while ($i > 0) {
            $punto = $punto + $punto * 0.1;
            $punto = $punto - $dimension * 0.1;
            $i -= 1;
        }
        $punto -= $dimension / 10 * $m;
    }
    return $punto;
}
                if ($imgid > 10000) {
                    error('admin.php?action=designs&job=design_import', $lang->phrase('admin_design_buffer_overflow_images'));
                }
            }
            $imgdir = 'images/' . $imgid;
        } else {
            $tplid = $row['images'];
        }
        if (!empty($ini['template'])) {
            mover($tempdir . 'templates', $tpldir);
        }
        if (!empty($ini['stylesheet'])) {
            mover($tempdir . 'designs', $cssdir);
        }
        if (!empty($ini['images'])) {
            mover($tempdir . 'images', $imgdir);
        }
        $db->query("INSERT INTO `{$db->pre}designs` (`template` , `stylesheet` , `images` , `name`) VALUES ('{$tplid}', '{$cssid}', '{$imgid}', '{$ini['name']}')");
        unset($archive);
        if ($del > 0) {
            $filesystem->unlink($file);
        }
        rmdirr($tempdir);
    }
    $delobj = $scache->load('loaddesign');
    $delobj->delete();
    ok('admin.php?action=designs&job=design', $lang->phrase('admin_design_design_successfully_imported'));
} elseif ($job == 'design_export') {
    $id = $gpc->get('id', int);
    echo head();
    ?>
                    $db->query("\n\t\t\t\t\tINSERT INTO {$db->pre}plugins\n\t\t\t\t\t(`name`,`module`,`ordering`,`required`,`position`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$plug['names'][$hook]}','{$packageid}','{$priority}','{$plug['required'][$hook]}','{$hook}')\n\t\t\t\t\t", __LINE__, __FILE__);
                    $filesystem->unlink('cache/modules/' . $plugins->_group($hook) . '.php');
                }
            }
        }
        // Templates
        $templates = array_merge(isset($plug['template']) ? $plug['template'] : array(), isset($com['template']) ? $com['template'] : array());
        if (count($templates) > 0) {
            $tpldir = "templates/{$design['template']}/modules/{$packageid}/";
            if (is_dir($tpldir)) {
                $filesystem->chmod($tpldir, 0777);
            } else {
                $filesystem->mkdir($tpldir, 0777);
            }
            $temptpldir = "{$tdir}templates/";
            mover($temptpldir, $tpldir);
        }
        // Custom Installer
        $confirm = true;
        ($code = $plugins->install($packageid)) ? eval($code) : null;
        rmdirr($tdir);
        unset($archive);
        if ($del > 0) {
            $filesystem->unlink($sourcefile);
        }
        if ($confirm) {
            echo head();
            ok('admin.php?action=packages&job=package_info&id=' . $packageid, $lang->phrase('admin_packages_ok_package_successfully_imported'));
        }
    }
} elseif ($job == 'package_export') {
 if ($failure < 1) {
     unset($archive);
     if ($del == 1) {
         $filesystem->unlink($file);
     }
     rmdirr($tempdir);
     error('admin.php?action=language&job=import', $lang->phrase('admin_lang_zip_not_readable_or_empty'));
 }
 $inserted = false;
 if ($overwrite == 0) {
     $db->query("INSERT INTO {$db->pre}language (language, detail) VALUES ({$lang->phrase}('admin_lang_new_langpack'), {$lang->phrase}('admin_lang_langpack_import_error'))");
     $inserted = true;
     $overwrite = $db->insert_id();
 }
 $newdir = "language/{$overwrite}/";
 mover($tempdir, $newdir);
 if (is_dir($tempdir)) {
     rmdirr($tempdir);
 }
 $info = return_array('settings', $overwrite);
 if (isset($info['lang_name'])) {
     $db->query("UPDATE {$db->pre}language SET language = '{$info['lang_name']}', detail = '{$info['lang_description']}' WHERE id = '{$overwrite}' LIMIT 1");
     unset($archive);
     if ($del == 1) {
         $filesystem->unlink($file);
     }
     $delobj = $scache->load('loadlanguage');
     $delobj->delete();
     ok('admin.php?action=language&job=manage', 'Languagepack import successful.');
 } else {
     if ($inserted) {