Exemplo n.º 1
0
        echo head();
        error('javascript: self.close();', $lang->phrase('admin_packages_err_specified_package_foo_does_not_exist'));
    }
    $data = $db->fetch_assoc($result);
    $dir = "modules/{$data['id']}/";
    if (file_exists($dir . "plugin.ini")) {
        $ini = $myini->read($dir . "plugin.ini");
    } else {
        $ini = array();
    }
    $designObj = $scache->load('loaddesign');
    $designs = $designObj->get(true);
    $standardDesign = $designs[$config['templatedir']]['template'];
    $tpldir = "templates/{$standardDesign}/modules/{$data['id']}/";
    // ToDo: Prüfen ob .html variabel sein sollte (class.template.php => Endung der Templates ist variabel, nur standardmäßig html)
    $filetitle = convert2adress($data['title']);
    $codefile = "{$filetitle}.html";
    $i = 1;
    while (file_exists($tpldir . $codefile)) {
        $codefile = "{$filetitle}_{$i}.html";
        $i++;
    }
    echo head();
    ?>
	<form method="post" action="admin.php?action=packages&job=plugins_template_edit&id=<?php 
    echo $data['id'];
    ?>
">
	<table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
	 <tr>
	  <td class="obox" colspan="3">
Exemplo n.º 2
0
            } else {
                $input = array();
            }
            include "components/{$id}/{$file}";
        }
    }
} elseif ($job == 'com_export') {
    $id = $gpc->get('id', int);
    $tempdir = 'temp/';
    $result = $db->query("SELECT * FROM {$db->pre}component WHERE id = {$id} LIMIT 1", __LINE__, __FILE__);
    $row = $db->fetch_assoc($result);
    $ini = $myini->read('components/' . $row['id'] . '/components.ini');
    $info = array_merge($row, $ini);
    $result = $db->query("SELECT * FROM {$db->pre}designs WHERE id = '{$config['templatedir']}' LIMIT 1", __LINE__, __FILE__);
    $design = $db->fetch_assoc($result);
    $file = convert2adress($info['config']['name']) . '.zip';
    $dirs = array('template' => "templates/{$design['template']}/components/{$id}/", 'image' => "images/{$design['images']}/", 'style' => "designs/{$design['stylesheet']}/", 'language' => "language/{$config['langdir']}/components/{$id}/", 'php' => "components/{$id}/");
    $error = false;
    $settings = $dirs['php'] . "components.ini";
    require_once 'classes/class.zip.php';
    $archive = new PclZip($tempdir . $file);
    $v_list = $archive->create($settings, PCLZIP_OPT_REMOVE_PATH, $dirs['php']);
    if ($v_list == 0) {
        $error = true;
    } else {
        foreach ($dirs as $key => $dir) {
            $filelist = array();
            if (isset($ini[$key]) && count($ini[$key]) > 0) {
                foreach ($ini[$key] as $cfile) {
                    $filelist[] = $dir . $cfile;
                }
    $db->query("ALTER TABLE {$db->pre}userfields DROP fid{$fid}");
    $db->query("OPTIMIZE TABLE {$db->pre}userfields");
    echo head();
    ok("admin.php?action=profilefield&job=manage", $lang->phrase('admin_profilefield_successfully_deleted'));
} elseif ($job == "edit2") {
    $fid = $gpc->get('fid', int);
    $type = $gpc->get('type', none);
    if ($type != "text" && $type != "textarea") {
        $options = $gpc->get('options', none);
        $options2 = preg_split("~(\r\n|\r|\n)+~", $options);
        $options = array($type);
        $keys = array();
        foreach ($options2 as $key => $row) {
            $row2 = explode("=", $row, 2);
            if (count($row2) == 2) {
                $row2[0] = convert2adress(trim($row2[0]));
                $i = 1;
                $base = empty($row2[0]) ? 'f' : $row2[0];
                while (in_array($row2[0], $keys) || empty($row2[0])) {
                    $row2[0] = $base . $i;
                    $i++;
                }
                $keys[] = $row2[0];
                $options[] = implode('=', $row2);
            }
        }
        $thing = implode("\n", $options);
    } else {
        $thing = $type;
    }
    $update = array("name" => $gpc->get('name', str), "description" => $gpc->get('description', str), "disporder" => $gpc->get('disporder', int), "type" => $gpc->save_str($thing), "length" => $gpc->get('length', int), "maxlength" => $gpc->get('maxlength', int), "required" => $gpc->get('required', int), "editable" => $gpc->get('editable', int), "viewable" => $gpc->get('viewable', int));
Exemplo n.º 4
0
        ok('admin.php?action=language&job=manage', 'Languagepack import successful.');
    } else {
        if ($inserted) {
            $db->query("DELETE FROM {$db->pre}language WHERE id = '{$overwrite}' LIMIT 1");
        }
        unset($archive);
        if ($del == 1) {
            $filesystem->unlink($file);
        }
        error('admin.php?action=language&job=import', $lang->phrase('admin_lang_could_not_import_langpack'));
    }
} elseif ($job == 'export') {
    $id = $gpc->get('id', int);
    $result = $db->query('SELECT language, detail FROM ' . $db->pre . 'language WHERE id = "' . $id . '" LIMIT 1');
    $row = $db->fetch_assoc($result);
    $file = convert2adress($row['language'] . '-v' . str_replace(' ', '', $config['version'])) . '.zip';
    $dir = "language/{$id}/";
    $tempdir = "temp/";
    require_once 'classes/class.zip.php';
    $archive = new PclZip($tempdir . $file);
    $v_list = $archive->create($dir, PCLZIP_OPT_REMOVE_PATH, $dir, PCLZIP_OPT_COMMENT, "{$row['language']}\n\n{$row['detail']}\n\nVersion: {$config['version']}");
    if ($v_list == 0) {
        echo head();
        unset($archive);
        if ($del > 0) {
            $filesystem->unlink($tempdir . $file);
        }
        error('admin.php?action=language&job=manage', $archive->errorInfo(true));
    } else {
        viscacha_header('Content-Type: application/zip');
        viscacha_header('Content-Disposition: attachment; filename="' . $file . '"');
 /**
  * Save uploaded file.
  *
  * Cleans up the filename, copies the file from PHP's temp location to $path,
  * and checks the overwrite_mode
  *
  * @param path		  		string	File path to your upload directory
  * @param overwrite_mode  	int 	0 = rename if filename already exists (file.txt becomes file_1.txt)
  *									1 = overwrite existing file
  * 									2 = do nothing if a file exists
  * @return	boolean
  */
 function save_file($path = null, $overwrite_mode = 0)
 {
     if ($this->error != null) {
         return false;
     }
     if ($path != null && strlen($path) > 0) {
         $this->path = $path;
         if ($path[strlen($path) - 1] != '/' && $path[strlen($path) - 1] != '\\') {
             $this->path .= '/';
         }
     }
     $success = false;
     if ($this->new_filename != null) {
         $this->file['raw_name'] = $this->new_filename;
     } else {
         // Secure file name
         $this->file['raw_name'] = convert2adress($this->file['raw_name'], false, '_');
     }
     $new_path = $this->path . $this->file['raw_name'] . '.' . $this->file['extension'];
     switch (intval($overwrite_mode)) {
         case 1:
             // overwrite mode
             if (call_user_func($this->copy_func, $this->file['tmp_name'], $new_path)) {
                 $success = true;
                 $this->file['tmp_name'] = $new_path;
             } else {
                 $success = false;
                 $this->error = UPLOAD_ERR_COPY;
             }
             break;
         case 2:
             // do nothing
             if (file_exists($this->path . $this->file["name"])) {
                 $this->error = UPLOAD_ERR_FILE_EXISTS;
                 $success = false;
             } else {
                 if (call_user_func($this->copy_func, $this->file['tmp_name'], $new_path)) {
                     $success = true;
                     $this->file['tmp_name'] = $new_path;
                 } else {
                     $success = false;
                     $this->error = UPLOAD_ERR_COPY;
                 }
             }
             break;
         default:
             // create new with incremental extension
             $n = 0;
             while (file_exists($new_path) == true) {
                 $n++;
                 $new_path = $this->path . $this->file['raw_name'] . '_' . $n . '.' . $this->file['extension'];
             }
             if ($n > 0) {
                 $this->file['raw_name'] .= '_' . $n;
             }
             if (call_user_func($this->copy_func, $this->file['tmp_name'], $new_path)) {
                 $success = true;
                 $this->file['tmp_name'] = $new_path;
             } else {
                 $success = false;
                 $this->error = UPLOAD_ERR_COPY;
             }
     }
     $this->file['filename'] = $this->file['raw_name'] . '.' . $this->file['extension'];
     // Clean up text file line breaks
     if (substr($this->file['type'], 0, 4) == 'text') {
         $this->cleanup_text_file();
     }
     if (isset($GLOBALS['filesystem'])) {
         global $filesystem;
         $filesystem->chmod($this->file['tmp_name'], 0666);
     } else {
         @chmod($this->file['tmp_name'], 0666);
     }
     return $success;
 }