예제 #1
0
 public function upload_file()
 {
     $data['files_list'] = scandir($this->xls_path);
     unset($data['files_list'][0]);
     unset($data['files_list'][1]);
     $this->load->helper('catalogue/products_excel_import_helper');
     upload_form($data);
     return true;
 }
예제 #2
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    global $txpcfg, $img_dir;
    pagetop('image', $message);
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id='{$id}'");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf(gTxt('image_name') . br . fInput('text', 'name', $name, 'edit')) . graf(gTxt('image_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('alt_text') . br . fInput('text', 'alt', $alt, 'edit', '', '', 50)) . graf(gTxt('caption') . br . text_area('caption', '100', '400', $caption)) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save')))), endTable();
    }
}
예제 #3
0
function upload_file($tabla, $type, $archivo, $archivo_name)
{
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $pext = getFileExtension($archivo_name);
    $nombre = date("YmdHis") . "." . $pext;
    $nom_final = $r_server . $nombre;
    if (is_uploaded_file($archivo)) {
        if (!copy($archivo, "{$nom_final}")) {
            echo "<script>alert('Error al subir el archivo: {$nom_final}');</script>";
            upload_form($tabla);
            exit;
        } else {
            insert_csv($tabla, $type, $nombre);
        }
    }
}
/**
 * Check uploaded file for obvious problems
 * This function checks the uploaded file's
 * size, type, length, etc to make sure it's
 * worth continuing with processing
 * @return bool
 */
function check_uploaded_file($file_array)
{
    if (!is_uploaded_file($file_array['tmp_name'])) {
        echo "File NOT uploaded OK<br>";
        die(upload_form());
    } elseif ($file_array['size'] < 1) {
        echo "File was empty";
        die(upload_form());
    } elseif ($file_array['error'] > 0) {
        echo "Uploading file encountered error #" . $file_array['error'];
        die(upload_form());
    } elseif ($file_array['type'] != 'text/xml') {
        echo "Expected file of type 'text/xml', but got " . $file_array['type'];
        die(upload_form());
    } else {
        //echo "File seems uploaded OK<br>";
        return true;
    }
}
예제 #5
0
function products_list($event = '', $step = '', $message = '')
{
    global $statuses, $comments_disabled_after, $step, $txp_user;
    $message = '';
    pagetop(gTxt('tab_list'), $message);
    echo poweredit_products();
    //echo the poweredit js
    extract(get_prefs());
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $sesutats = array_flip($statuses);
    $dir = $dir == 'desc' ? 'desc' : 'asc';
    echo '<script type="text/javascript" src="http://' . $siteurl . '/js/prototype.js"></script>';
    echo '<script type="text/javascript" src="http://' . $siteurl . '/js/scriptaculous.js"></script>';
    switch ($sort) {
        case 'id':
            $sort_sql = 'ID ' . $dir;
            break;
        case 'posted':
            $sort_sql = 'Posted ' . $dir;
            break;
        case 'title':
            $sort_sql = 'Title ' . $dir . ', Posted desc';
            break;
        case 'section':
            $sort_sql = 'Section ' . $dir . ', Posted desc';
            break;
        case 'category1':
            $sort_sql = 'Category1 ' . $dir . ', Posted desc';
            break;
        case 'category2':
            $sort_sql = 'Category2 ' . $dir . ', Posted desc';
            break;
        case 'status':
            $sort_sql = 'Status ' . $dir . ', Posted desc';
            break;
        case 'author':
            $sort_sql = 'AuthorID ' . $dir . ', Posted desc';
            break;
        case 'comments':
            $sort_sql = 'comments_count ' . $dir . ', Posted desc';
            break;
        default:
            $dir = 'desc';
            $sort_sql = 'Posted ' . $dir;
            break;
    }
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = "section = 'store'";
    if ($search_method and $crit) {
        $crit_escaped = doSlash($crit);
        $critsql = array('id' => "ID = '{$crit_escaped}'", 'title_body' => "Title rlike '{$crit_escaped}' or Body rlike '{$crit_escaped}'", 'section' => "Section rlike '{$crit_escaped}'", 'categories' => "Category1 rlike '{$crit_escaped}' or Category2 rlike '{$crit_escaped}'", 'status' => "Status = '" . @$sesutats[gTxt($crit_escaped)] . "'", 'author' => "AuthorID rlike '{$crit_escaped}'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
            $limit = 500;
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $total = safe_count('textpattern', "{$criteria}");
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . list_search_form_products($crit, $search_method) . n . graf("No products found", ' style="text-align: center;"');
        } else {
            echo graf("No products found", ' style="text-align: center;"');
        }
        return;
    }
    $limit = max(@$article_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo n . list_search_form_products($crit, $search_method);
    $rs = safe_rows_start('*, unix_timestamp(Posted) as posted', 'textpattern', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
    if ($rs) {
        $total_comments = array();
        // fetch true comment count, not the public comment count
        // maybe we should have another row in the db?
        $rs2 = safe_rows_start('parentid, count(*) as num', 'txp_discuss', "1 group by parentid order by parentid");
        if ($rs2) {
            while ($a = nextRow($rs2)) {
                $pid = $a['parentid'];
                $num = $a['num'];
                $total_comments[$pid] = $num;
            }
        }
        echo n . n . '<form name="longform" method="post" action="index.php" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . n . startTable('list', '', '', '', '700') . n . tr(hCell() . n . column_head('ID', 'id', 'products', true, $switch_dir, $crit, $search_method) . column_head('title', 'title', 'products', true, $switch_dir, $crit, $search_method) . column_head('category1', 'category1', 'products', true, $switch_dir, $crit, $search_method) . column_head('category2', 'category2', 'products', true, $switch_dir, $crit, $search_method) . column_head('status', 'status', 'products', true, $switch_dir, $crit, $search_method) . hCell());
        include_once txpath . '/publish/taghandlers.php';
        while ($a = nextRow($rs)) {
            extract($a);
            if (empty($Title)) {
                $Title = '<em>' . eLink('product', 'edit', 'ID', $ID, gTxt('untitled')) . '</em>';
            } else {
                $Title = eLink('product', 'edit', 'ID', $ID, $Title);
            }
            if (!empty($Image)) {
                $Image = "<img src='{$Image}' alt='Product Image' width='15' height='15'/>";
            }
            $Category1 = '<span title="' . htmlspecialchars(fetch_category_title($Category1)) . '">' . $Category1 . '&nbsp;</span>';
            $Category2 = '<span title="' . htmlspecialchars(fetch_category_title($Category2)) . '">' . $Category2 . '&nbsp;</span>';
            $manage = n . '<ul class="articles_detail">' . n . t . '<li>' . eLink('product', 'edit', 'ID', $ID, gTxt('edit')) . '</li>' . (($Status == 4 or $Status == 5) ? n . t . '<li><a href="' . permlinkurl($a) . '">' . gTxt('view') . '</a></li>' : '') . n . '</ul>';
            $Status = !empty($Status) ? $statuses[$Status] : '';
            $comments = gTxt('none');
            if (isset($total_comments[$ID]) and $total_comments[$ID] > 0) {
                $comments = href(gTxt('manage'), 'index.php?event=discuss' . a . 'step=list' . a . 'search_method=parent' . a . 'crit=' . $ID) . ' (' . $total_comments[$ID] . ')';
            }
            $comment_status = $Annotate ? gTxt('on') : gTxt('off');
            if ($comments_disabled_after) {
                $lifespan = $comments_disabled_after * 86400;
                $time_since = time() - $posted;
                if ($time_since > $lifespan) {
                    $comment_status = gTxt('expired');
                }
            }
            $comments = n . '<ul>' . n . t . '<li>' . $comment_status . '</li>' . n . t . '<li>' . $comments . '</li>' . n . '</ul>';
            echo n . n . tr(n . td($Image, 15) . td(eLink('product', 'edit', 'ID', $ID, $ID) . $manage) . td($Title) . td($Category1, 100) . td($Category2, 100) . td($a['Status'] < 4 ? $Status : '<a href="' . permlinkurl($a) . '">' . $Status . '</a>', 50) . td(($a['Status'] >= 4 and has_privs('article.edit.published') or $a['Status'] >= 4 and $AuthorID == $txp_user and has_privs('article.edit.own.published') or $a['Status'] < 4 and has_privs('article.edit') or $a['Status'] < 4 and $AuthorID == $txp_user and has_privs('article.edit.own')) ? fInput('checkbox', 'selected[]', $ID) : '&nbsp;'));
        }
        echo n . n . tr(tda(toggle_box('articles_detail'), ' colspan="2" style="text-align: left; border: none;"') . tda(select_buttons() . product_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="5" style="text-align: right; border: none;"')) . n . endTable() . n . '</form>' . n . '<h4 style="font-weight:normal; text-align:center; width:100%;"><a href="#" class="navlink" onclick="if($(\'uploadCSV\').style.display == \'none\'){$(\'uploadCSV\').style.display = \'block\';}else{$(\'uploadCSV\').style.display = \'none\';}">Import Products</a>';
        //n.
        $instructions = tag(tag('<li>Using FTP, upload your product images to <pre>/txp_site_root/images/_import/</pre></li><li>Upload a correctly formatted CSV file using the form below. (CSV must be in UTF-8 character encoding with DOS or UNIX line breaks.)</li><li>Sit back and watch the magic</li>', "ol"), "div", ' id="instructions" style="display:none; width: 380px; text-align:left; margin:0 auto;"');
        echo tag('<h4 style="font-weight:normal; text-align:center; width:100%;"><small><a href="http://homeplatewp.com/TextCommerce/file_download/3">Download Example CSV</a> | <a href="javascript:void(0)" onclick="if($(\'instructions\').style.display == \'none\'){$(\'instructions\').style.display = \'block\';}else{$(\'instructions\').style.display = \'none\';}">Import Instructions</a></small></h4>' . $instructions . upload_form("Browse for CSV:", '', 'product_import', 'product'), 'div', ' id="uploadCSV" style="display:none;"');
        echo n . nav_form('list', $page, $numPages, $sort, $dir, $crit, $search_method) . n . pageby_form('list', $article_list_pageby);
    }
}
예제 #6
0
    echo addslashes(gettext('This upload has to have a folder. Type a title or folder name to continue...'));
    ?>
'));" />
								<input type="checkbox" name="autogenfolder" id="autogen" checked="checked"
											 onclick="buttonstate(toggleAutogen('folderdisplay', 'albumtitle', this));" />
								<label for="autogen"><?php 
    echo gettext("Auto-generate");
    ?>
</label>
								<br />
								<br />
							</div>
						</div>
						<hr />
						<?php 
    upload_form($uploadlimit, $passedalbum);
    ?>
					</form>
					<div id="upload_action">
						<?php 
    //	load the uploader specific form stuff
    upload_extra($uploadlimit, $passedalbum);
    ?>
					</div><!-- upload action -->

					<script type="text/javascript">
						//<!-- <![CDATA[
	<?php 
    echo zp_apply_filter('upload_helper_js', '') . "\n";
    if ($passedalbum) {
        ?>
예제 #7
0
파일: txp_image.php 프로젝트: psic/websites
function image_edit($message = '', $id = '')
{
    global $txpcfg, $img_dir, $file_max_upload_size, $txp_user, $event;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author == $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        $categories = getTree("root", "image");
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img = '<img class="image fullsize" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" id="image-fullsize" />';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img class="image thumbnail" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="" ' . ($thumb_w ? "width='{$thumb_w}' height='{$thumb_h}'" : '') . ' />';
        } else {
            $thumb = '';
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(pluggable_ui('image_ui', 'image_edit', $img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', 'image-replace'), $rs)), ' class="image-edit' . $aspect . '"'), tr(td(pluggable_ui('image_ui', 'thumbnail_edit', join('', array($thumbnail ? startTable('image-thumbnail', '', 'image-thumbnail') . tr(td($thumb, '', 'thumbwrapper') . td(dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', 'thumbnail-upload'))), $rs)), ' class="thumbnail-edit"'), check_gd($ext) ? thumb_ui($id, $rs) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name'), ' class="name"') . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category'), ' class="category"') . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text'), ' class="alt text"') . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . '<textarea id="caption" name="caption">' . $caption . '</textarea>', ' class="caption description text"') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form')), ' class="image-detail"'), endTable() . n . '</div>';
    }
}
예제 #8
0
function insert_csv($division, $segmento, $prce, $proyecto, $alias)
{
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $fecha = date("Y-m-d");
    $j = 0;
    $fd = fopen($r_server . "{$alias}", "r");
    while (!feof($fd)) {
        $buffer = fgets($fd);
        $campos = split(",", $buffer);
        $campos['0'] = trim($campos['0']);
        if ($campos['0'] != '' && $campos['0'] != 'referencia') {
            $s_ = "select * from proy_ubicacion where id_proyecto='{$proyecto}' and ubicacion='{$campos['0']}'";
            $r_ = mysql_query($s_);
            if (mysql_num_rows($r_) <= 0) {
                //SÓLO SI NO EXISTE LO INSERTO
                $query = "INSERT into proy_ubicacion values('', '{$proyecto}', '{$campos['0']}')";
                mysql_query($query);
                $j++;
            }
        }
    }
    echo "<script>alert('{$j} registros insertados');</script>";
    fclose($fd);
    unlink($r_server . $alias);
    upload_form($division, $segmento, $prce);
}
예제 #9
0
/**
 * Renders a specific file upload form.
 *
 * @param  string       $label       File name label. May be empty
 * @param  string       $pophelp     Help item
 * @param  string       $step        Step
 * @param  string       $id          File id
 * @param  string       $label_id    HTML id attribute for the filename input element
 * @param  string       $class       HTML class attribute for the form element
 * @param  string|array $wraptag_val Tag to wrap the value / label in, or empty to omit
 * @return string HTML
 */
function file_upload_form($label, $pophelp, $step, $id = '', $label_id = '', $class = '', $wraptag_val = array('div', 'div'))
{
    global $file_max_upload_size;
    if (!$file_max_upload_size || intval($file_max_upload_size) == 0) {
        $file_max_upload_size = 2 * (1024 * 1024);
    }
    $max_file_size = intval($file_max_upload_size) == 0 ? '' : intval($file_max_upload_size);
    return upload_form($label, $pophelp, $step, 'file', $id, $max_file_size, $label_id, $class, $wraptag_val);
}
예제 #10
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    global $txpcfg, $img_dir, $file_max_upload_size;
    pagetop(gTxt('edit_image'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', ''))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', ''))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))), endTable();
    }
}
예제 #11
0
    switch ($frame){
        case 1: break; // Empty Frame
        case 2: frame2(); break;
        case 3: frame3(); break;
        default:
            switch($action){
                case 1: logout(); break;
                case 2: config_form(); break;
                case 3: download(); break;
                case 4: view(); break;
                case 5: server_info(); break;
//                case 6: execute(); break;
                case 7: edit_file_form(); break;
                case 8: chmod_form(); break;
//                case 9: shell_form(); break;
                case 10: upload_form(); break;
                default: frameset();
            }
    }
} else {
    if (isset($senha)) login();
    else form_login();
}
// +--------------------------------------------------
// | Config Class
// +--------------------------------------------------
class config {
    var $data;
    var $filename;
    function config(){
        global $script_filename;
예제 #12
0
 function edit_view($id = '')
 {
     global $txpcfg, $img_dir, $file_max_upload_size;
     $out = array();
     if (!$id) {
         $id = assert_int(gps('id'));
     }
     extract($this->context);
     $categories = tree_get('txp_category', NULL, "type='image'");
     $rs = safe_row("*", "txp_image", "id = {$id}");
     if ($rs) {
         extract($rs);
         if ($ext != '.swf') {
             $img = '<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" "title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" />';
         } else {
             $img = '';
         }
         if ($thumbnail and $ext != '.swf') {
             $thumb = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />';
         } else {
             $thumb = '';
         }
         $out[] = startTable('edit') . tr(td($img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'replace', $this->event, $id, $file_max_upload_size, 'image-replace', ''))) . tr(td(join('', array($thumbnail ? $thumb . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', $this->event, $id, $file_max_upload_size, 'upload-thumbnail', '')))));
         $out[] = check_gd($ext) ? $this->thumb_ui($id, $thumbnail) : '';
         $out[] = tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . categorySelectInput('image', 'category', $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput($this->event) . n . sInput('save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))) . endTable();
     }
     return join('', $out);
 }
예제 #13
0
function image_edit($message = '', $id = '')
{
    global $prefs, $file_max_upload_size, $txp_user, $event, $all_image_cats;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author === $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img_info = $id . $ext . ' (' . $w . ' &#215; ' . $h . ')';
            $img = '<div class="fullsize-image"><img class="content-image" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" alt="' . $img_info . '" title="' . $img_info . '" /></div>';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb_info = $id . 't' . $ext . ' (' . $thumb_w . ' &#215; ' . $thumb_h . ')';
            $thumb = '<img class="content-image" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="' . $thumb_info . '" ' . ($thumb_w ? 'width="' . $thumb_w . '" height="' . $thumb_h . '" title="' . $thumb_info . '"' : '') . ' />';
        } else {
            $thumb = '';
            if ($thumb_w == 0) {
                $thumb_w = get_pref('thumb_w', 0);
            }
            if ($thumb_h == 0) {
                $thumb_h = get_pref('thumb_h', 0);
            }
        }
        echo n . '<div id="' . $event . '_container" class="txp-container">';
        echo pluggable_ui('image_ui', 'fullsize_image', $img, $rs), '<section class="txp-edit">', hed(gTxt('edit_image'), 2), pluggable_ui('image_ui', 'image_edit', wrapGroup('image_edit_group', upload_form('', '', 'image_replace', 'image', $id, $file_max_upload_size, 'image_replace', 'image-replace'), 'replace_image', 'replace-image', 'replace_image_form'), $rs), pluggable_ui('image_ui', 'thumbnail_image', '<div class="thumbnail-edit">' . ($thumbnail ? $thumb . n . dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)) : '') . '</div>', $rs), pluggable_ui('image_ui', 'thumbnail_edit', wrapGroup('thumbnail_edit_group', upload_form('', '', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload_thumbnail', 'thumbnail-upload'), 'upload_thumbnail', 'thumbnail-upload', 'upload_thumbnail'), $rs), check_gd($ext) ? pluggable_ui('image_ui', 'thumbnail_create', wrapGroup('thumbnail_create_group', form(graf(n . '<label for="width">' . gTxt('thumb_width') . '</label>' . fInput('text', 'width', @$thumb_w, 'input-xsmall', '', '', INPUT_XSMALL, '', 'width') . n . '<label for="height">' . gTxt('thumb_height') . '</label>' . fInput('text', 'height', @$thumb_h, 'input-xsmall', '', '', INPUT_XSMALL, '', 'height') . n . '<label for="crop">' . gTxt('keep_square_pixels') . '</label>' . checkbox('crop', 1, @$prefs['thumb_crop'], '', 'crop') . fInput('submit', '', gTxt('Create')), ' class="edit-alter-thumbnail"') . hInput('id', $id) . eInput('image') . sInput('thumbnail_create') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'thumbnail_alter_form'), 'create_thumbnail', 'thumbnail-alter', 'create_thumbnail'), $rs) : '', '<div class="image-detail">', form(inputLabel('image_name', fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'image_name'), 'image_name') . inputLabel('image_category', treeSelectInput('category', $all_image_cats, $category, 'image_category'), 'image_category') . inputLabel('image_alt_text', fInput('text', 'alt', $alt, '', '', '', INPUT_REGULAR, '', 'image_alt_text'), 'alt_text') . inputLabel('image_caption', text_area('caption', 0, 0, $caption, 'image_caption', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE), 'caption', '', '', '') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form'), '</div>', '</section>' . n . '</div>';
    }
}
예제 #14
0
<?php

require_once "upload_helper.php";
?>
<html>
<head>
	<title>File Upload</title>
	<script language="javascript" type="text/javascript" src="prototype.js"></script>
	<script language="javascript" type="text/javascript" src="upload.js">></script>
	<link rel="stylesheet" href="upload.css" type="text/css" media="screen" title="Upload" charset="utf-8" />
</head>
<body>
	<h1>Asynchronous File Upload Demo</h1>
	<form name="postform" action="receive.php" method="post">
		<div class="inputhead">Title</div>
		<input class="input" type="text" name="title" /><br/>
		<div class="inputhead">Body</div>
		<textarea class="input" name="body"></textarea><br/>
		<?php 
echo upload_value('file_1');
?>
	</form>
	<?php 
echo upload_form('file_1', 'File 1');
?>
	<input type="button" onclick="submitUpload(document.postform);" value="Submit">
</body>
</html>
예제 #15
0
/**
 * Renders and outputs the image editor panel.
 *
 * @param string|array $message The activity message
 * @param int          $id      The image ID
 */
function image_edit($message = '', $id = '')
{
    global $prefs, $file_max_upload_size, $txp_user, $event, $all_image_cats;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, UNIX_TIMESTAMP(date) AS uDate", 'txp_image', "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author === $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img_info = $id . $ext . ' (' . $w . ' &#215; ' . $h . ')';
            $img = '<div class="fullsize-image"><img class="content-image" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" alt="' . $img_info . '" title="' . $img_info . '" /></div>';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb_info = $id . 't' . $ext . ' (' . $thumb_w . ' &#215; ' . $thumb_h . ')';
            $thumb = '<img class="content-image" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="' . $thumb_info . '" title="' . $thumb_info . '" />';
        } else {
            $thumb = '';
            if ($thumb_w == 0) {
                $thumb_w = get_pref('thumb_w', 0);
            }
            if ($thumb_h == 0) {
                $thumb_h = get_pref('thumb_h', 0);
            }
        }
        $imageBlock = array();
        $thumbBlock = array();
        $imageBlock[] = pluggable_ui('image_ui', 'fullsize_image', $img, $rs);
        $imageBlock[] = pluggable_ui('image_ui', 'image_edit', upload_form('replace_image', 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-upload', ' image-replace'), $rs);
        $thumbBlock[] = hed(gTxt('create_thumbnail') . popHelp('create_thumbnail'), 3);
        $thumbBlock[] = check_gd($ext) ? pluggable_ui('image_ui', 'thumbnail_create', form(graf(n . '<label for="width">' . gTxt('thumb_width') . '</label>' . fInput('text', 'width', @$thumb_w, 'input-xsmall', '', '', INPUT_XSMALL, '', 'width') . n . '<label for="height">' . gTxt('thumb_height') . '</label>' . fInput('text', 'height', @$thumb_h, 'input-xsmall', '', '', INPUT_XSMALL, '', 'height') . n . '<label for="crop">' . gTxt('keep_square_pixels') . '</label>' . checkbox('crop', 1, @$prefs['thumb_crop'], '', 'crop') . fInput('submit', '', gTxt('create')), ' class="edit-alter-thumbnail"') . hInput('id', $id) . eInput('image') . sInput('thumbnail_create') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', '', '', 'thumbnail_alter_form'), $rs) : '';
        $thumbBlock[] = pluggable_ui('image_ui', 'thumbnail_image', '<div class="thumbnail-image">' . ($thumbnail ? $thumb . n . dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)) : '') . '</div>', $rs);
        $thumbBlock[] = pluggable_ui('image_ui', 'thumbnail_edit', upload_form('upload_thumbnail', 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'thumbnail-upload', ' thumbnail-upload'), $rs);
        echo n . tag(hed(gTxt('edit_image'), 1, array('class' => 'txp-heading')) . n . implode(n, $imageBlock) . '<hr />' . tag(implode(n, $thumbBlock), 'section', array('class' => 'thumbnail-alter')), 'div', array('class' => 'txp-layout-4col-cell-1-2-3')) . '<div class="txp-layout-4col-cell-4alt">', form(graf(fInput('submit', '', gTxt('save'), 'publish'), array('class' => 'txp-save')) . wrapGroup('image-details', inputLabel('image_name', fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'image_name'), 'image_name', '', array('class' => 'txp-form-field edit-image-name')) . inputLabel('image_category', event_category_popup('image', $category, 'image_category') . n . eLink('category', 'list', '', '', gTxt('edit'), '', '', '', 'txp-option-link'), 'image_category', '', array('class' => 'txp-form-field edit-image-category')) . inputLabel('image_alt_text', fInput('text', 'alt', $alt, '', '', '', INPUT_REGULAR, '', 'image_alt_text'), 'alt_text', '', array('class' => 'txp-form-field edit-image-alt-text')) . inputLabel('image_caption', '<textarea id="image_caption" name="caption" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_SMALL . '">' . $caption . '</textarea>', 'caption', '', array('class' => 'txp-form-field txp-form-field-textarea edit-image-caption')) . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . hInput('id', $id) . eInput('image') . sInput('image_save') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), 'image_details'), '', '', 'post', '', '', 'image_details_form'), '</div>';
    }
}
예제 #16
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $path_from_root;
    extract(doSlash(gpsa(array('name', 'category', 'permissions', 'description'))));
    if (!$id) {
        $id = gps('id');
    }
    pagetop('file', $message);
    $categories = getTree("root", "file");
    $rs = safe_row("*", "txp_file", "id='{$id}'");
    if ($rs) {
        extract($rs);
        if ($permissions == '') {
            $permissions = '-1';
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $existing_files = get_filenames();
        $status = '<span style="color:';
        $status .= $file_exists ? 'green' : 'red';
        $status .= '">';
        $status .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $status .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, $filename, $filename) : $filename;
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf(gTxt('file_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . graf(fInput('submit', '', gTxt('save'))) . hInput('filename', $filename) . hInput('id', $id) . eInput('file') . sInput('file_save'))));
        } else {
            $form = tr(tda(hed(gTxt('file_relink'), 3) . upload_form(gTxt('upload_file'), 'upload', 'file_replace', $id) . form(graf(gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . sInput('file_save'))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $status) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . (isset($downloads) ? $downloads : 0)))), $form, endTable();
    }
}
예제 #17
0
  </tr>
</table>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
	<td width="5" valign="top"></td><td></td><td width="5"></td>
</tr>
<tr height="600" valign="top">
    <td background="../imagenes/borde_izq_tabla.png">&nbsp;</td>
    <td>&nbsp;
	<!--Todo el contenido de cada página--->
	<?php 
menu_interno($type, $tabla);
switch ($op) {
    case "upload_form":
        upload_form($tabla);
        break;
    case "upload_file":
        upload_file($tabla, $type, $archivo, $archivo_name);
        break;
    case "guardar_temp":
        guardar_temp($type, $tabla, $orden, $tipo);
        listado($type, $tabla, $orden, $tipo, $buscar, $inicio);
        break;
    case "nuevo":
        nuevo($type, $tabla);
        break;
    case "guardar":
        guardar($tabla, $tipo, $nombre, $costo, $unidad, $descripcion);
        nuevo($type, $tabla);
        break;
예제 #18
0
}
xoops_cp_header();
include "mymenu.php";
echo "<h2>" . _AM_UPLOAD_TITLE . "</h2>";
// special files
$sysfile = array('/blank.gif', '/index.html');
if (isset($_GET['ren'])) {
    $file = filename_filter($myts->stripSlashesGPC($_GET['ren']));
    rename_form($file);
} else {
    $dir = isset($_GET['dir']) ? filename_filter($myts->stripSlashesGPC($_GET['dir'])) : '';
    if (!is_dir(UPLOAD_BASE)) {
        mkdir(UPLOAD_BASE);
    }
    folder_list($dir);
    upload_form($dir);
    mkdir_form($dir);
}
xoops_cp_footer();
function unit_kiro($v)
{
    if ($v > 10240 * 1024) {
        return round($v / 1024 / 1024) . "G";
    }
    if ($v > 10240) {
        return round($v / 1024) . "M";
    }
    return $v . "K";
}
function folder_list($dir)
{
예제 #19
0
function upload_file($tipo, $archivo, $archivo_name)
{
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $pext = getFileExtension($archivo_name);
    $nombre = "temporal_." . $pext;
    $nom_final = $r_server . $nombre;
    if (is_uploaded_file($archivo)) {
        if (!copy($archivo, "{$nom_final}")) {
            echo "<script>alert('Error al subir el archivo: {$nom_final}');</script>";
            upload_form();
            exit;
        } else {
            $ruta = "&alias={$nombre}&tipo={$tipo}";
            ?>
	<div align='center'><img src='../imagenes/loading.gif'><br><span class="aviso">Cargando registros, por favor espere...</span></div>
	<iframe src="fun_partes.php?op=insert_txt<?php 
            echo $ruta;
            ?>
" width="400" height="400" frameborder="0" scrolling="no"></iframe></div>
	<?php 
        }
    }
}
예제 #20
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    global $txpcfg, $img_dir, $file_max_upload_size;
    pagetop(gTxt('edit_image'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $categories = getTree("root", "image");
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($ext != '.swf') {
            $img = '<img src="' . hu . $img_dir . '/' . $id . $ext . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" />';
        } else {
            $img = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . "?{$uDate}" . '" alt="" />';
        } else {
            $thumb = '';
        }
        echo startTable('list'), tr(td($img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', ''))), tr(td(join('', array($thumbnail ? startTable('image-thumbnail') . tr(td($thumb) . td(dLink('image', 'thumbnail_delete', 'id', $id))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', ''))))), check_gd($ext) ? thumb_ui($id) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))), endTable();
    }
}
예제 #21
0
function file_upload_form($label, $pophelp, $step, $id = '')
{
    global $file_max_upload_size;
    if (!$file_max_upload_size || intval($file_max_upload_size) == 0) {
        $file_max_upload_size = 2 * (1024 * 1024);
    }
    $max_file_size = intval($file_max_upload_size) == 0 ? '' : intval($file_max_upload_size);
    return upload_form($label, $pophelp, $step, 'file', $id, $max_file_size);
}
예제 #22
0
 private static function show($msg = '')
 {
     pagetop(self::TAB, $msg);
     echo '<h1>SED Patterns</h1>';
     echo upload_form('Install Pattern Pack', '', 'upload', self::EVENT, '');
 }
예제 #23
0
                    server_info();
                    break;
                case 6:
                    execute_cmd();
                    break;
                case 7:
                    edit_file_form();
                    break;
                case 8:
                    chmod_form();
                    break;
                case 9:
                    shell_form();
                    break;
                case 10:
                    upload_form();
                    break;
                case 11:
                    execute_file();
                    break;
                default:
                    frameset();
            }
    }
} else {
    if (isset($pass)) {
        login();
    } else {
        login_form();
    }
}
예제 #24
0
						<br />
						<br />
					</div>
					<input type="hidden" name="folder" id="folderslot" value="<?php 
    echo html_encode($passedalbum);
    ?>
" />
				</div>
				<hr />

		</form>

		<div id="upload_action">
		<?php 
    //	load the uploader specific form stuff
    upload_form($uploadlimit);
    ?>
		</div><!-- upload aaction -->
		<script type="text/javascript">
			//<!-- <![CDATA[
			<?php 
    echo zp_apply_filter('upload_helper_js', '') . "\n";
    if ($passedalbum) {
        ?>
				$('#folderdisplay').val('<?php 
        echo $passedalbum;
        ?>
');
				buttonstate(true);
				<?php 
    }