function attachfile_display_upload($mydirname, $params) { global $xoopsModule, $xoopsDB; // 'isactive'/'module_read' check and include language // If the check failed, this function does nothing (not error). if (!attachfile_process_instead_of_common($mydirname)) { return; } $module_dirname = $xoopsModule->getVar('dirname'); $target_id = $params['target_id']; // if new post if (!isset($target_id)) { echo _MD_ATTACHFILE_NOTSPECIFIEDID; return; } // check upload permission $error_msg = attachfile_check_upload_permission($mydirname, $module_dirname, $target_id); if (isset($error_msg)) { echo $error_msg; return; } // transaction and view $sql = "SELECT COUNT(*) FROM " . $xoopsDB->prefix($mydirname . "_attach") . " WHERE module_dirname='{$module_dirname}' AND target_id={$target_id}"; if (!($result = $xoopsDB->query($sql))) { die("DB ERROR in upload popup"); } $row = $xoopsDB->fetchRow($result); attachfile_display_popup_link($mydirname, $module_dirname, $target_id, 'upop', _MD_ATTACHFILE_UPLOAD_POPUP, $row[0]); }
// permission check // check download permission $error_msg = attachfile_check_upload_permission($mydirname, $module_dirname, $target_id); if (isset($error_msg)) { echo $error_msg; return; } // transaction attachfile_delete_file($mydirname, $attach_id); // view attachfile_display_list($mydirname, $module_dirname, $target_id, 'upop'); } else { if ($mode == 'upload') { // params $module_dirname = attachfile_reqstr('module_dirname'); $target_id = attachfile_reqint('target_id'); // permission check // check download permission $error_msg = attachfile_check_upload_permission($mydirname, $module_dirname, $target_id); if (isset($error_msg)) { echo $error_msg; return; } // transaction attachfile_upload_file($mydirname, $module_dirname, $target_id); // view attachfile_display_list($mydirname, $module_dirname, $target_id, 'upop'); } } } }