Rev 899 | Rev 1086 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 899 | Rev 1050 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | * See the License for the specific language governing permissions and |
16 | * See the License for the specific language governing permissions and |
17 | * limitations under the License. |
17 | * limitations under the License. |
18 | */ |
18 | */ |
19 | 19 | ||
20 | if (!defined('INSIDE_OIDPLUS')) die(); |
20 | namespace ViaThinkSoft\OIDplus; |
21 | 21 | ||
22 | class OIDplusPagePublicAttachments extends OIDplusPagePluginPublic { |
22 | class OIDplusPagePublicAttachments extends OIDplusPagePluginPublic { |
23 | 23 | ||
24 | const DIR_UNLOCK_FILE = 'oidplus_upload.dir'; |
24 | const DIR_UNLOCK_FILE = 'oidplus_upload.dir'; |
25 | 25 | ||
Line 129... | Line 129... | ||
129 | $basepath = $cfg; |
129 | $basepath = $cfg; |
130 | } |
130 | } |
131 | 131 | ||
132 | try { |
132 | try { |
133 | self::checkUploadDir($basepath); |
133 | self::checkUploadDir($basepath); |
134 | } catch (Exception $e) { |
134 | } catch (\Exception $e) { |
135 | $error = _L('This functionality is not available due to a misconfiguration'); |
135 | $error = _L('This functionality is not available due to a misconfiguration'); |
136 | if (OIDplus::authUtils()->isAdminLoggedIn()) { |
136 | if (OIDplus::authUtils()->isAdminLoggedIn()) { |
137 | $error .= ': '.$e->getMessage(); |
137 | $error .= ': '.$e->getMessage(); |
138 | } else { |
138 | } else { |
139 | $error .= '. '._L('Please notify the system administrator. After they log-in, they can see the reason at this place.'); |
139 | $error .= '. '._L('Please notify the system administrator. After they log-in, they can see the reason at this place.'); |
Line 403... | Line 403... | ||
403 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes$'.OIDplus::getCurrentLang().'.local', // not recommended |
403 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes$'.OIDplus::getCurrentLang().'.local', // not recommended |
404 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes.local', // not recommended |
404 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes.local', // not recommended |
405 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes$'.OIDplus::getCurrentLang().'.conf', |
405 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes$'.OIDplus::getCurrentLang().'.conf', |
406 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes.conf' |
406 | OIDplus::localpath().'vendor/danielmarschall/fileformats/filetypes.conf' |
407 | ); |
407 | ); |
408 | $output .= '<td>'.htmlentities(VtsFileTypeDetect::getDescription($file, $lookup_files)).'</td>'; |
408 | $output .= '<td>'.htmlentities(\VtsFileTypeDetect::getDescription($file, $lookup_files)).'</td>'; |
409 | 409 | ||
410 | $output .= ' <td><button type="button" name="download_'.md5($file).'" id="download_'.md5($file).'" class="btn btn-success btn-xs download" onclick="OIDplusPagePublicAttachments.downloadAttachment('.js_escape(OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE)).', current_node,'.js_escape(basename($file)).')">'._L('Download').'</button></td>'; |
410 | $output .= ' <td><button type="button" name="download_'.md5($file).'" id="download_'.md5($file).'" class="btn btn-success btn-xs download" onclick="OIDplusPagePublicAttachments.downloadAttachment('.js_escape(OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE)).', current_node,'.js_escape(basename($file)).')">'._L('Download').'</button></td>'; |
411 | if ($can_delete) { |
411 | if ($can_delete) { |
412 | $output .= ' <td><button type="button" name="delete_'.md5($file).'" id="delete_'.md5($file).'" class="btn btn-danger btn-xs delete" onclick="OIDplusPagePublicAttachments.deleteAttachment(current_node,'.js_escape(basename($file)).')">'._L('Delete').'</button></td>'; |
412 | $output .= ' <td><button type="button" name="delete_'.md5($file).'" id="delete_'.md5($file).'" class="btn btn-danger btn-xs delete" onclick="OIDplusPagePublicAttachments.deleteAttachment(current_node,'.js_escape(basename($file)).')">'._L('Delete').'</button></td>'; |
413 | } |
413 | } |
Line 427... | Line 427... | ||
427 | $output .= '<div>'._L('Add a file attachment').':<input type="file" name="userfile" value="" id="fileAttachment">'; |
427 | $output .= '<div>'._L('Add a file attachment').':<input type="file" name="userfile" value="" id="fileAttachment">'; |
428 | $output .= '<br><input type="submit" value="'._L('Upload').'"></div>'; |
428 | $output .= '<br><input type="submit" value="'._L('Upload').'"></div>'; |
429 | $output .= '</form>'; |
429 | $output .= '</form>'; |
430 | $doshow = true; |
430 | $doshow = true; |
431 | } |
431 | } |
432 | } catch (Exception $e) { |
432 | } catch (\Exception $e) { |
433 | $doshow = true; |
433 | $doshow = true; |
434 | $output = '<p>'.$e->getMessage().'</p>'; |
434 | $output = '<p>'.$e->getMessage().'</p>'; |
435 | } |
435 | } |
436 | 436 | ||
437 | $output = '<h2>'._L('File attachments').'</h2>' . |
437 | $output = '<h2>'._L('File attachments').'</h2>' . |