示例#1
0
 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']);
         }
     }
     $mydb->closeTBL();
     unset($upload);
示例#2
0
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);
$tpl_tmp->Set_Variable('script', $script);