コード例 #1
0
ファイル: upload_img.php プロジェクト: laiello/mystep-cms
<?php

require "inc.php";
$para = explode("|", $_SERVER['QUERY_STRING']);
$parent_element = $para[0];
$width = $para[1];
$height = $para[2];
if (empty($parent_element)) {
    $parent_element = "image";
}
set_time_limit(0);
$script = "";
if (count($_POST) > 0) {
    $path_upload = $setting['path']['upload'] . "/pic/" . date("Ym") . "/";
    $upload = new MyUploader();
    $upload->init("../" . $path_upload, true);
    $upload->DoIt();
    if ($upload->upload_result[0]['error'] == 0) {
        $the_file = $path_upload . "/" . $upload->upload_result[0]['new_name'];
        if (!empty($width) && !empty($height)) {
            img_thumb(ROOT_PATH . "/" . $the_file, $width, $height, ROOT_PATH . "/" . $the_file . ".thumb");
            unlink(ROOT_PATH . "/" . $the_file);
            rename(ROOT_PATH . "/" . $the_file . ".thumb", ROOT_PATH . "/" . $the_file);
        }
        $script = "\r\n\t\t\tvar theOLE = null;\r\n\t\t\ttheOLE = parent.parent || parent.dialogArguments || parent.opener;\r\n\t\t\ttheOLE.document.forms[0].{$parent_element}.value = '" . $web_url . "/" . $the_file . "';\r\n\t\t\talert('" . $setting['language']['admin_upload_img_ok'] . "');\r\n\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\treturn;\r\n\t\t";
    } else {
        $script = "\r\n\t\t\talert('" . $upload->upload_result[0]['message'] . "');\r\n\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t";
    }
}
$tpl_info['idx'] = "upload_img";
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
コード例 #2
0
ファイル: survey.php プロジェクト: laiello/mystep-cms
     $goto_url = $req->getServer("HTTP_REFERER");
     break;
 case "del_item":
     $log_info = $setting['language']['plugin_survey_delete_item'];
     $idx = $req->getGet('idx');
     $mydb->resetDB("survey_{$id}");
     $record = $mydb->queryDate("idx=" . $idx, true, &$fp_pos, &$row_pos);
     $mydb->deleteDate($row_pos);
     $mydb->closeTBL();
     $goto_url = $req->getServer("HTTP_REFERER");
     break;
 case "import":
     $log_info = $setting['language']['plugin_survey_import'];
     $mydb->resetDB("survey_{$id}");
     $path_upload = $setting['path']['upload'] . "/tmp/" . date("Ym") . "/";
     $upload = new MyUploader();
     $upload->init(ROOT_PATH . "/" . $path_upload, true);
     $upload->DoIt(false);
     if (count($upload->upload_result) > 0) {
         if ($upload->upload_result[0]['error'] == 0) {
             $theFile = ROOT_PATH . "/" . $path_upload . "/" . $upload->upload_result[0]['new_name'];
             $handle = fopen($theFile, "r");
             while ($data = fgets($handle, 1000)) {
                 $mydb->insertDate(explode(",", preg_replace("/[\r\n]/", "", $data)));
             }
             fclose($handle);
             unlink($theFile);
         } else {
             WriteError($upload->upload_result[0]['message']);
         }
     }
コード例 #3
0
ファイル: upload.php プロジェクト: laiello/mystep-cms
<?php

require "../inc.php";
$method = $req->getGet("method");
$log_info = "";
$script = "";
$script = "";
if (count($_POST) > 0) {
    $path_upload = dirname(__FILE__) . "/files/" . date("Y") . "/";
    $path_upload = str_replace("\\", "/", $path_upload);
    $upload = new MyUploader();
    $upload->init($path_upload, true);
    $upload->DoIt();
    if ($upload->upload_result[0]['error'] == 0) {
        $script = "\r\n\t\t\tvar theOLE = null;\r\n\t\t\ttheOLE = parent.parent || parent.dialogArguments || parent.opener;\r\n\t\t\ttheOLE.document.forms[0].ad_file.value = '" . $setting['web']['url'] . "/" . str_replace(ROOT_PATH, "", $path_upload) . "/" . $upload->upload_result[0]['new_name'] . "';\r\n\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\treturn;\r\n\t\t";
    } else {
        $script = "\r\n\t\t\talert('" . $upload->upload_result[0]['message'] . "');\r\n\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t";
    }
}
$tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
$tpl_info['idx'] = "upload";
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
$tpl_tmp->Set_Variable('script', $script);
$tpl_tmp->Set_Variable('parent_element', $parent_element);
$tpl_tmp->Set_Variable('self', $setting['info']['self']);
$Max_size = ini_get('upload_max_filesize');
$tpl_tmp->Set_Variable('Max_size', $Max_size);
$tpl_tmp->Set_Variable('MaxSize', GetFileSize($Max_size));
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
unset($tpl_tmp);