├── lang ├── en_gb.lang └── de_de.lang ├── update.php ├── .gitattributes ├── pages ├── index.php ├── info.php ├── setup.php └── settings.php ├── templates ├── thread.create.tpl.php ├── thread_OLD.create.tpl.php ├── post.create.tpl.php ├── post_OLD.create.tpl.php ├── pagination.tpl.php ├── pagination_OLD.tpl.php ├── threads.tpl.php ├── threads_OLD.tpl.php ├── posts.tpl.php └── posts_OLD.tpl.php ├── install.php ├── module ├── module_out.inc └── module_in.inc ├── fragments ├── ycom_board_createform.php ├── ycom_board_pagination.php ├── ycom_board_threads.php └── ycom_board_posts.php ├── uninstall.inc.php ├── package.yml ├── install ├── modules │ ├── board_input.php │ └── board_output.php └── tablesets │ ├── ycom_board_thread_notification.json │ └── ycom_board.json ├── LICENSE ├── lib ├── rex_ycom_board_thread.php ├── ycom_board_message.php ├── rex_ycom_board_post.php └── rex_ycom_board.php ├── assets └── uploadfile │ ├── jquery-file-upload.min.css │ ├── jquery-file-upload.css │ ├── jquery-file-upload.min.js │ ├── ycom-board-file-upload.js │ └── jquery-file-upload.js ├── boot.php └── README.md /lang/en_gb.lang: -------------------------------------------------------------------------------- 1 | 2 | com_board_name = Board 3 | -------------------------------------------------------------------------------- /update.php: -------------------------------------------------------------------------------- 1 | includeFile(__DIR__.'/install.php'); 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /pages/index.php: -------------------------------------------------------------------------------- 1 | getSubPath(); 5 | rex_be_controller::includeCurrentPageSubPath(); 6 | -------------------------------------------------------------------------------- /templates/thread.create.tpl.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | Zur Übersicht 8 | 9 |
10 | Neues Thema 11 |
12 | 13 | 14 | = $this->render('pagination.tpl.php') ?> 15 | 16 || Themen | 20 |Antworten | 21 |Letzter Beitrag | 22 |
|---|---|---|
|
28 | = htmlspecialchars($thread->getTitle()) ?> 29 | von = htmlspecialchars($thread->getUserFullName()) ?> am = $thread->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 30 | |
31 | = $thread->countReplies() ?> | 32 |
33 | countReplies()) : ?>
34 |
35 | von = $thread->getRecentPost()->getUserFullName() ?> 36 | am = $thread->getRecentPost()->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 37 | 38 | 39 | |
40 |
10 | Neues Thema 11 |
12 | 13 | 14 | = $this->render('pagination.tpl.php') ?> 15 | 16 || Themen | 20 |Antworten | 21 |Letzter Beitrag | 22 |
|---|---|---|
|
28 | = htmlspecialchars($thread->getTitle()) ?> 29 | von = htmlspecialchars($thread->getUserFullName()) ?> am = $thread->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 30 | |
31 | = $thread->countReplies() ?> | 32 |
33 | countReplies()) : ?>
34 |
35 | von = $thread->getRecentPost()->getUserFullName() ?> 36 | am = $thread->getRecentPost()->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 37 | 38 | 39 | |
40 |
13 | Neues Thema 14 |
15 | 16 | 17 | setVar('pager',$boardthis->getPager()); 20 | $fragment->setVar('boardthis',$boardthis); 21 | echo $fragment->parse('ycom_board_pagination.php'); 22 | ?> 23 | 24 || Themen | 28 |Antworten | 29 |Letzter Beitrag | 30 |
|---|---|---|
|
36 | = htmlspecialchars($thread->getTitle()) ?> 37 | von = htmlspecialchars($thread->getUserFullName()) ?> am = $thread->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 38 | |
39 | = $thread->countReplies() ?> | 40 |
41 | countReplies()) : ?>
42 |
43 | von = $thread->getRecentPost()->getUserFullName() ?> 44 | am = $thread->getRecentPost()->getCreated('%d.%m.%Y, %H:%M Uhr') ?> 45 | 46 | 47 | |
48 |
'.$this->i18n('ycom_board_modul_description').'
'; 41 | 42 | // dump($module_id); 43 | 44 | if ($module_id > 0) { 45 | $content .= '' . $this->i18n('ycom_board_update_module', htmlspecialchars($board_module_name)) . '
'; 46 | } else { 47 | $content .= '' . $this->i18n('ycom_board_install_module', $board_module_name) . '
'; 48 | } 49 | 50 | $fragment = new rex_fragment(); 51 | $fragment->setVar('title', $this->i18n('ycom_board_install_modul'), false); 52 | $fragment->setVar('body', $content, false); 53 | echo $fragment->parse('core/page/section.php'); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /lib/rex_ycom_board_thread.php: -------------------------------------------------------------------------------- 1 | setQuery('SELECT * FROM rex_ycom_board_post WHERE status = 1 and thread_id = "" and id = ' . (int) $id); 13 | if (!$sql->getRows()) { 14 | return null; 15 | } 16 | return new self($sql->getRow()); 17 | } 18 | 19 | public function countReplies() 20 | { 21 | if (null !== $this->countReplies) { 22 | return $this->countReplies; 23 | } 24 | 25 | $sql = rex_sql::factory(); 26 | $sql->setQuery('SELECT COUNT(*) as count FROM rex_ycom_board_post WHERE status = 1 and thread_id = ' . (int) $this->getId()); 27 | return $this->countReplies = (int) $sql->getValue('count'); 28 | } 29 | 30 | public function getRecentPost() 31 | { 32 | if (null !== $this->recentPost) { 33 | return $this->recentPost; 34 | } 35 | 36 | $sql = rex_sql::factory(); 37 | // $sql->setDebug(); 38 | $sql->setQuery(sprintf('SELECT * FROM rex_ycom_board_post WHERE status = 1 AND (thread_id = %d OR id = %1$d) ORDER BY created DESC LIMIT 1', (int) $this->getId())); 39 | return $this->recentPost = new rex_ycom_board_post($sql->getRow()); 40 | } 41 | 42 | public function getNotificationUsers() 43 | { 44 | if (null !== $this->notificationUsers) { 45 | return $this->notificationUsers; 46 | } 47 | 48 | $sql = rex_sql::factory(); 49 | $data = $sql->getArray(sprintf('SELECT user_id FROM rex_ycom_board_thread_notification WHERE thread_id = %d', $this->getId())); 50 | $this->notificationUsers = array(); 51 | foreach ($data as $row) { 52 | $this->notificationUsers[] = $row['user_id']; 53 | } 54 | return $this->notificationUsers; 55 | } 56 | 57 | public function addNotificationUser(rex_ycom_user $user) 58 | { 59 | if (in_array($user->id, $this->getNotificationUsers())) { 60 | return; 61 | } 62 | 63 | $sql = rex_sql::factory(); 64 | $sql->setTable('rex_ycom_board_thread_notification'); 65 | $sql->setValue('thread_id', $this->getId()); 66 | $sql->setValue('user_id', $user->id); 67 | $sql->insert(); 68 | 69 | $this->notificationUsers[] = $user->id; 70 | } 71 | 72 | public function removeNotificationUser(rex_ycom_user $user) 73 | { 74 | $sql = rex_sql::factory(); 75 | $sql->setTable('rex_ycom_board_thread_notification'); 76 | $sql->setWhere(sprintf('thread_id = %d AND user_id = %d', $this->getId(), $user->id)); 77 | $sql->delete(); 78 | 79 | $this->notificationUsers = null; 80 | } 81 | 82 | public function isNotificationEnabled($user) 83 | { 84 | if (!$user) { 85 | return false; 86 | } 87 | return in_array($user->id, $this->getNotificationUsers()); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /templates/posts.tpl.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | Zur Übersicht 10 | 11 |15 | Antworten 16 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 17 | Benachrichtigungen ausschalten 18 | 19 | Benachrichtigungen einschalten 20 | 21 |
22 | 23 | 24 | = $this->render('pagination.tpl.php') ?> 25 | 26 ||
31 | = $post->getUserFullName() ?> 32 | = $post->getCreated('%d.%m.%Y, %H:%M Uhr')?> 33 | isBoardAdmin()): ?> 34 | 35 | 36 | Thread löschen 37 | 38 | Beitrag löschen 39 | 40 | 41 | |
42 |
43 | = htmlspecialchars($post->getTitle()) ?>44 |= nl2br(htmlspecialchars($post->getMessage())) ?> 45 | hasAttachment()): ?> 46 |47 | Anhang: = $post->getAttachment() ?> 48 | 49 | 50 | |
51 |
60 | Antworten 61 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 62 | Benachrichtigungen ausschalten 63 | 64 | Benachrichtigungen einschalten 65 | 66 |
67 | -------------------------------------------------------------------------------- /lib/ycom_board_message.php: -------------------------------------------------------------------------------- 1 | query() 25 | ->where('status','0','>') 26 | ->whereRaw(implode(' AND ',$where)) 27 | ->find(); 28 | 29 | foreach ($items as $item) { 30 | if (!$item->email) { 31 | continue; 32 | } 33 | $yform = new rex_yform(); 34 | $yform->setObjectparams('csrf_protection',false); 35 | $yform->setValueField('hidden', ['firstname',$item->firstname]); 36 | $yform->setValueField('hidden', ['name',$item->name]); 37 | $yform->setValueField('hidden', ['email',$item->email]); 38 | $yform->setValueField('hidden', ['url',rex_getUrl()]); 39 | $yform->setValueField('hidden', ['title',$thread->getTitle()]); 40 | $yform->setValueField('hidden', ['message',$thread->getMessage()]); 41 | $yform->setActionField('tpl2email', [rex_config::get('ycom_board','email_template_new_thread'),"email",$item->email]); 42 | $yform->getForm(); 43 | $yform->setObjectparams('send',1); 44 | $yform->executeActions(); 45 | } 46 | 47 | 48 | 49 | 50 | /* 51 | "rex_ycom_board_post.id" => "7" 52 | "rex_ycom_board_post.board_key" => "aid-57" 53 | "rex_ycom_board_post.thread_id" => "" 54 | "rex_ycom_board_post.title" => "asdfasdfasdfa" 55 | "rex_ycom_board_post.message" => "safdasfdasfdsafd" 56 | "rex_ycom_board_post.user_id" => "5" 57 | "rex_ycom_board_post.status" => "1" 58 | "rex_ycom_board_post.created" => "2019-12-04 18:00:10" 59 | "rex_ycom_board_post.updated" => "2019-12-04 18:00:10" 60 | "rex_ycom_board_post.notifications" => "" 61 | "rex_ycom_board_post.attachment" => "" 62 | "id" => "7" 63 | "board_key" => "aid-57" 64 | "thread_id" => "" 65 | "title" => "asdfasdfasdfa" 66 | "message" => "safdasfdasfdsafd" 67 | "user_id" => "5" 68 | "status" => "1" 69 | "created" => "2019-12-04 18:00:10" 70 | "updated" => "2019-12-04 18:00:10" 71 | "notifications" => "" 72 | "attachment" => "" 73 | */ 74 | 75 | 76 | 77 | 78 | } 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /templates/posts_OLD.tpl.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | Zur Übersicht 10 | 11 |15 | Antworten 16 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 17 | Benachrichtigungen ausschalten 18 | 19 | Benachrichtigungen einschalten 20 | 21 |
22 | 23 | 24 | = $this->render('pagination.tpl.php') ?> 25 | 26 ||
31 | = $post->getUserFullName() ?> 32 | = $post->getCreated('%d.%m.%Y, %H:%M Uhr')?> 33 | isBoardAdmin()): ?> 34 | 35 | 36 | Thread löschen 37 | 38 | Beitrag löschen 39 | 40 | 41 | |
42 |
43 | = htmlspecialchars($post->getTitle()) ?>44 |= nl2br(htmlspecialchars($post->getMessage())) ?> 45 | hasAttachment()): ?> 46 |Anhang:47 | getRealAttachment(),true) ?> 48 | 49 | |
56 |
65 | Antworten 66 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 67 | Benachrichtigungen ausschalten 68 | 69 | Benachrichtigungen einschalten 70 | 71 |
72 | -------------------------------------------------------------------------------- /lib/rex_ycom_board_post.php: -------------------------------------------------------------------------------- 1 | data = $data; 11 | foreach ($data as $k=>$v) { 12 | if (strpos($k,'.')) { 13 | $_k = explode('.',$k); 14 | $this->data[$_k[1]] = $v; 15 | } 16 | } 17 | } 18 | 19 | public static function get($id) 20 | { 21 | $sql = rex_sql::factory(); 22 | $sql->setQuery('SELECT * FROM rex_ycom_board_post WHERE status = 1 and id = ' . (int) $id); 23 | if (!$sql->getRows()) { 24 | return null; 25 | } 26 | return new self($sql->getRow()); 27 | } 28 | 29 | public function getId() 30 | { 31 | /* 32 | if (isset ($this->data['rex_ycom_board_post.id'])) { 33 | return $this->data['rex_ycom_board_post.id']; 34 | } 35 | * 36 | */ 37 | return $this->data['id']; 38 | } 39 | 40 | public function getThreadId() 41 | { 42 | return $this->data['thread_id'] ?: $this->getId(); 43 | } 44 | 45 | public function getTitle() 46 | { 47 | return $this->data['title']; 48 | } 49 | 50 | public function getMessage() 51 | { 52 | return $this->data['message']; 53 | } 54 | 55 | public function hasAttachment() 56 | { 57 | return (bool) $this->data['attachment']; 58 | } 59 | 60 | public function getAttachment() 61 | { 62 | if (!$this->hasAttachment()) { 63 | return null; 64 | } 65 | 66 | $parts = explode('_', $this->getRealAttachment(), 2); 67 | return isset($parts[1]) ? $parts[1] : null; 68 | } 69 | 70 | public function getRealAttachment() 71 | { 72 | return $this->data['attachment']; 73 | } 74 | 75 | /** 76 | * @return rex_ycom_user 77 | */ 78 | public function getUser() 79 | { 80 | if (!$this->data['user_id']) { 81 | return false; 82 | } 83 | if (!$this->user) { 84 | $this->user = rex_yform_manager_table::get('rex_ycom_user')->query()->where('id',$this->data['user_id'])->findOne(); 85 | } 86 | 87 | return $this->user; 88 | } 89 | 90 | public static function getUserById($id = 0) { 91 | if (!$id) { 92 | return false; 93 | } 94 | return rex_yform_manager_table::get('rex_ycom_user')->query()->where('id',$id)->findOne(); 95 | } 96 | 97 | 98 | public function getUserFullName() { 99 | if (!$this->data['user_id']) { 100 | return ''; 101 | } 102 | if (!$this->user) { 103 | $this->user = rex_yform_manager_table::get('rex_ycom_user')->query()->where('id',$this->data['user_id'])->findOne(); 104 | } 105 | return $this->user->firstname . ' ' . $this->user->name; 106 | 107 | } 108 | 109 | 110 | public function getCreated($format = null) 111 | { 112 | $timestamp = strtotime($this->data['created']); 113 | return $format ? strftime($format, $timestamp) : $timestamp; 114 | } 115 | 116 | public function getUpdated($format = null) 117 | { 118 | $timestamp = strtotime($this->data['updated']); 119 | 120 | return $format ? strftime($format, $timestamp) : $timestamp; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /assets/uploadfile/jquery-file-upload.min.css: -------------------------------------------------------------------------------- 1 | .custom-statusbar{ 2 | border-top: 1px solid #394F61; 3 | padding: 5px 0px 5px 4px; 4 | width: 700px; 5 | } 6 | .odd 7 | { 8 | background-color:#EDEBEB; 9 | } 10 | .even 11 | { 12 | background-color:#FFFFFF; 13 | } 14 | 15 | .custom-filename { 16 | display: inline-block; 17 | width: 230px; 18 | margin: 0 5px 0px 0px; 19 | color: #807579; 20 | vertical-align: middle; 21 | } 22 | .custom-preview 23 | { 24 | display:inline-block; 25 | vertical-align:middle; 26 | border:1px solid #C7CCD1; 27 | } 28 | .custom-progress { 29 | margin: 0 10px 0px 10px; 30 | position: relative; 31 | width: 250px; 32 | border: 1px solid #ddd; 33 | padding: 1px; 34 | border-radius: 3px; 35 | display: inline-block; 36 | vertical-align:middle; 37 | color:#FFFFFF; 38 | } 39 | .custom-bar { 40 | background-color: #337AB7; 41 | width: 0; 42 | height: 20px; 43 | border-radius: 3px; 44 | color:#FFFFFF; 45 | display: inline-block; 46 | vertical-align:middle; 47 | margin:0px; 48 | } 49 | .custom-percent { 50 | position: absolute; 51 | display: inline-block; 52 | top: 3px; 53 | left: 48% 54 | } 55 | .custom-red { 56 | -moz-box-shadow: inset 0 39px 0 -24px #e67a73; 57 | -webkit-box-shadow: inset 0 39px 0 -24px #e67a73; 58 | box-shadow: inset 0 39px 0 -24px #e67a73; 59 | background-color: #e4685d; 60 | -moz-border-radius: 4px; 61 | -webkit-border-radius: 4px; 62 | border-radius: 4px; 63 | display: inline-block; 64 | color: #fff; 65 | font-family: arial; 66 | font-size: 13px; 67 | font-weight: normal; 68 | padding: 4px 15px; 69 | text-decoration: none; 70 | text-shadow: 0 1px 0 #b23e35; 71 | cursor: pointer; 72 | vertical-align: middle; 73 | margin-right:5px; 74 | } 75 | .custom-green { 76 | background-color: #77b55a; 77 | -moz-border-radius: 4px; 78 | -webkit-border-radius: 4px; 79 | border-radius: 4px; 80 | margin: 0; 81 | padding: 0; 82 | display: inline-block; 83 | color: #fff; 84 | font-family: arial; 85 | font-size: 13px; 86 | font-weight: normal; 87 | padding: 4px 15px; 88 | text-decoration: none; 89 | cursor: pointer; 90 | text-shadow: 0 1px 0 #5b8a3c; 91 | vertical-align: middle; 92 | margin-right:5px; 93 | } 94 | .ajax-file-upload { 95 | font-family: Arial, Helvetica, sans-serif; 96 | font-size: 16px; 97 | font-weight: bold; 98 | padding: 15px 20px; 99 | cursor:pointer; 100 | line-height:20px; 101 | height:25px; 102 | margin:0 10px 10px 0; 103 | display: inline-block; 104 | background: #fff; 105 | border: 1px solid #e8e8e8; 106 | color: #888; 107 | text-decoration: none; 108 | border-radius: 3px; 109 | -webkit-border-radius: 3px; 110 | -moz-border-radius: 3px; 111 | -moz-box-shadow: 0 2px 0 0 #e8e8e8; 112 | -webkit-box-shadow: 0 2px 0 0 #e8e8e8; 113 | box-shadow: 0 2px 0 0 #e8e8e8; 114 | padding: 6px 10px 4px 10px; 115 | color: #fff; 116 | background: #2f8ab9; 117 | border: none; 118 | -moz-box-shadow: 0 2px 0 0 #13648d; 119 | -webkit-box-shadow: 0 2px 0 0 #13648d; 120 | box-shadow: 0 2px 0 0 #13648d; 121 | vertical-align:middle; 122 | } 123 | 124 | .ajax-file-upload:hover { 125 | background: #3396c9; 126 | -moz-box-shadow: 0 2px 0 0 #15719f; 127 | -webkit-box-shadow: 0 2px 0 0 #15719f; 128 | box-shadow: 0 2px 0 0 #15719f; 129 | } 130 | 131 | .ajax-upload-dragdrop 132 | { 133 | 134 | border:2px dotted #A5A5C7; 135 | width:600px; 136 | color: #DADCE3; 137 | text-align:left; 138 | vertical-align:middle; 139 | padding:10px 10px 0px 10px; 140 | } 141 | .state-hover 142 | { 143 | border:2px solid #A5A5C7; 144 | } 145 | .custom-container 146 | { 147 | margin:20px 0px 20px 0px; 148 | } 149 | -------------------------------------------------------------------------------- /assets/uploadfile/jquery-file-upload.css: -------------------------------------------------------------------------------- 1 | .ajax-file-upload-statusbar { 2 | border: 1px solid #0ba1b5; 3 | margin-top: 10px; 4 | width: 420px; 5 | margin-right: 10px; 6 | margin: 5px; 7 | -moz-border-radius: 4px; 8 | -webkit-border-radius: 4px; 9 | border-radius: 4px; 10 | padding: 5px 5px 5px 15px 11 | } 12 | 13 | .ajax-file-upload-filename { 14 | width: 300px; 15 | height: auto; 16 | margin: 0 5px 5px 0px; 17 | 18 | } 19 | 20 | .ajax-file-upload-filesize { 21 | width: 50px; 22 | height: auto; 23 | margin: 0 5px 5px 0px; 24 | display: inline-block; 25 | vertical-align:middle; 26 | } 27 | .ajax-file-upload-progress { 28 | margin: 5px 10px 5px 0px; 29 | position: relative; 30 | width: 250px; 31 | border: 1px solid #ddd; 32 | padding: 1px; 33 | border-radius: 3px; 34 | display: inline-block; 35 | color:#FFFFFF; 36 | 37 | } 38 | .ajax-file-upload-bar { 39 | background-color: #0ba1b5; 40 | width: 0; 41 | height: 20px; 42 | border-radius: 3px; 43 | color:#FFFFFF; 44 | 45 | } 46 | .ajax-file-upload-percent { 47 | position: absolute; 48 | display: inline-block; 49 | top: 3px; 50 | left: 48% 51 | } 52 | .ajax-file-upload-red { 53 | -moz-box-shadow: inset 0 39px 0 -24px #e67a73; 54 | -webkit-box-shadow: inset 0 39px 0 -24px #e67a73; 55 | box-shadow: inset 0 39px 0 -24px #e67a73; 56 | background-color: #e4685d; 57 | -moz-border-radius: 4px; 58 | -webkit-border-radius: 4px; 59 | border-radius: 4px; 60 | display: inline-block; 61 | color: #fff; 62 | font-family: arial; 63 | font-size: 13px; 64 | font-weight: normal; 65 | padding: 4px 15px; 66 | text-decoration: none; 67 | text-shadow: 0 1px 0 #b23e35; 68 | cursor: pointer; 69 | vertical-align: top; 70 | margin: 5px 10px 5px 0px; 71 | } 72 | .ajax-file-upload-green { 73 | background-color: #77b55a; 74 | -moz-border-radius: 4px; 75 | -webkit-border-radius: 4px; 76 | border-radius: 4px; 77 | margin: 0; 78 | padding: 0; 79 | display: inline-block; 80 | color: #fff; 81 | font-family: arial; 82 | font-size: 13px; 83 | font-weight: normal; 84 | padding: 4px 15px; 85 | text-decoration: none; 86 | cursor: pointer; 87 | text-shadow: 0 1px 0 #5b8a3c; 88 | vertical-align: top; 89 | margin: 5px 10px 5px 0px; 90 | } 91 | .ajax-file-upload { 92 | font-family: Arial, Helvetica, sans-serif; 93 | font-size: 16px; 94 | font-weight: bold; 95 | padding: 15px 20px; 96 | cursor:pointer; 97 | line-height:20px; 98 | height:25px; 99 | margin:0 10px 10px 0; 100 | display: inline-block; 101 | background: #fff; 102 | border: 1px solid #e8e8e8; 103 | color: #888; 104 | text-decoration: none; 105 | border-radius: 3px; 106 | -webkit-border-radius: 3px; 107 | -moz-border-radius: 3px; 108 | -moz-box-shadow: 0 2px 0 0 #e8e8e8; 109 | -webkit-box-shadow: 0 2px 0 0 #e8e8e8; 110 | box-shadow: 0 2px 0 0 #e8e8e8; 111 | padding: 6px 10px 4px 10px; 112 | color: #fff; 113 | background: #2f8ab9; 114 | border: none; 115 | -moz-box-shadow: 0 2px 0 0 #13648d; 116 | -webkit-box-shadow: 0 2px 0 0 #13648d; 117 | box-shadow: 0 2px 0 0 #13648d; 118 | vertical-align: middle; 119 | } 120 | 121 | .ajax-file-upload:hover { 122 | background: #3396c9; 123 | -moz-box-shadow: 0 2px 0 0 #15719f; 124 | -webkit-box-shadow: 0 2px 0 0 #15719f; 125 | box-shadow: 0 2px 0 0 #15719f; 126 | } 127 | 128 | .ajax-upload-dragdrop 129 | { 130 | 131 | border:2px dotted #A5A5C7; 132 | width:420px; 133 | color: #DADCE3; 134 | text-align:left; 135 | vertical-align:middle; 136 | padding:10px 10px 0px 10px; 137 | } 138 | 139 | .state-hover 140 | { 141 | border:2px solid #A5A5C7; 142 | } 143 | .ajax-file-upload-container 144 | { 145 | margin:20px 0px 20px 0px; 146 | } -------------------------------------------------------------------------------- /fragments/ycom_board_posts.php: -------------------------------------------------------------------------------- 1 | thread; 9 | $posts = $this->posts; 10 | $boardthis = $this->boardthis; 11 | ?> 12 | 13 | Zur Übersicht 14 | 15 |19 | Antworten 20 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 21 | Benachrichtigungen ausschalten 22 | 23 | Benachrichtigungen einschalten 24 | 25 |
26 | 27 | 28 | setVar('pager',$boardthis->getPager()); 31 | echo $fragment->parse('ycom_board_pagination.php'); 32 | ?> 33 | 34 | render('pagination.tpl.php') ?> 35 | 36 ||
41 | = $post->getUserFullName() ?> 42 | = $post->getCreated('%d.%m.%Y, %H:%M Uhr')?> 43 | isBoardAdmin()): ?> 44 | 45 | 46 | Thread löschen 47 | 48 | Beitrag löschen 49 | 50 | 51 | |
52 |
53 | = htmlspecialchars($post->getTitle()) ?>54 |= nl2br(htmlspecialchars($post->getMessage())) ?> 55 | hasAttachment()): ?> 56 |Anhang:57 | getRealAttachment(),true) ?> 58 | 59 | |
66 |
78 | Antworten 79 | isNotificationEnabled(rex_ycom_auth::getUser())): ?> 80 | Benachrichtigungen ausschalten 81 | 82 | Benachrichtigungen einschalten 83 | 84 |
85 | -------------------------------------------------------------------------------- /boot.php: -------------------------------------------------------------------------------- 1 | $file) { 53 | if ($file['origname'] == rex_post('name')) { 54 | $filePath = $output_dir. $file['realname']; 55 | if (file_exists($filePath)) { 56 | unlink($filePath); 57 | $deleted = $file['origname']; 58 | } 59 | unset($files[$k]); 60 | } 61 | } 62 | rex_set_session('ycom_board_file_upload',$files); 63 | echo "Deleted File ".$deleted."rex_config::get("ycom_board","email_template_new_thread")');
21 |
22 | $field = $form->addCheckboxField('send_new_thread_mail');
23 | $field->setLabel('E-Mail Benachrichtigung');
24 | $field->addOption('E-Mails an Teilnehmer senden, wenn neues Hauptthema erstellt wird.', "1");
25 | $field->setNotice('rex_config::get("ycom_board","send_new_thread_mail")');
26 |
27 |
28 | $field = $form->addSelectField('groups_no_messages',null,['class'=>'selectpicker form-control']);
29 | $field->setLabel('Gruppen, an die die keine Benachrichtigungen geschickt werden');
30 | $select = $field->getSelect();
31 | $select->addSqlOptions('SELECT name label, id value FROM '.rex::getTable('ycom_group'));
32 | $select->setMultiple();
33 | $field->setNotice('rex_config::get("ycom_board","groups_no_messages")');
34 |
35 | $content = $form->get();
36 |
37 | $fragment = new rex_fragment();
38 | $fragment->setVar('title', 'Einstellungen');
39 | $fragment->setVar('body', $content, false);
40 | $content = $fragment->parse('core/page/section.php');
41 |
42 | echo $content;
43 |
44 |
45 | /*
46 | $field = $form->addLinkmapField('cart_page');
47 | $field->setLabel('Warenkorbseite');
48 | $field->setNotice('rex_config::get("warehouse","cart_page")');
49 |
50 | $field = $form->addLinkmapField('address_page');
51 | $field->setLabel('Adresseingabe Seite');
52 | $field->setNotice('rex_config::get("warehouse","address_page")');
53 |
54 | $field = $form->addLinkmapField('order_page');
55 | $field->setLabel('Bestellung Seite');
56 | $field->setNotice('rex_config::get("warehouse","order_page")');
57 |
58 | $field = $form->addLinkmapField('thankyou_page');
59 | $field->setLabel('Danke Seite');
60 | $field->setNotice('rex_config::get("warehouse","thankyou_page")');
61 |
62 | $field = $form->addLinkmapField('shippinginfo_page');
63 | $field->setLabel('Versandkosten Info');
64 | $field->setNotice('rex_config::get("warehouse","shippinginfo_page")');
65 |
66 | $field = $form->addLinkmapField('my_orders_page');
67 | $field->setLabel('Meine Bestellungen');
68 | $field->setNotice('rex_config::get("warehouse","my_orders_page")');
69 |
70 | $field = $form->addTextField('currency');
71 | $field->setLabel('Währung (z.B. EUR)');
72 | $field->setNotice('rex_config::get("warehouse","currency")');
73 | // $field->setNotice('Es können mehrere Adressen angegeben werden. Adressen bitte mit Komma trennen.');
74 |
75 | $field = $form->addTextField('currency_symbol');
76 | $field->setLabel('Währungssymbol (z.B. €)');
77 | $field->setNotice('rex_config::get("warehouse","currency_symbol")');
78 |
79 | $field = $form->addTextField('tax_value');
80 | $field->setLabel('Steuersatz [%]');
81 | $field->setNotice('rex_config::get("warehouse","tax_value")');
82 |
83 | $field = $form->addTextField('tax_value_1');
84 | $field->setLabel('Steuersatz 1 [%]');
85 | $field->setNotice('rex_config::get("warehouse","tax_value_1")');
86 |
87 | $field = $form->addTextField('tax_value_2');
88 | $field->setLabel('Steuersatz 2 [%]');
89 | $field->setNotice('rex_config::get("warehouse","tax_value_2")');
90 |
91 | $field = $form->addTextField('tax_value_3');
92 | $field->setLabel('Steuersatz 3 [%]');
93 | $field->setNotice('rex_config::get("warehouse","tax_value_3")');
94 |
95 | $field = $form->addTextField('tax_value_4');
96 | $field->setLabel('Steuersatz 4 [%]');
97 | $field->setNotice('rex_config::get("warehouse","tax_value_4")');
98 |
99 | $field = $form->addTextField('country_codes');
100 | $field->setLabel('Mögliche Länder für die Lieferung');
101 | $field->setNotice('Als JSON in der Form {"Deutschland":"DE","Österreich":"AT","Schweiz":"CH"} angeben.rex_config::get("warehouse","country_codes")');
102 |
103 | $field = $form->addSelectField('cart_mode');
104 | $field->setLabel('Warenkorb Modus');
105 | $select = $field->getSelect();
106 | $select->addOptions([
107 | 'cart'=>'Warenkorb',
108 | 'page'=>'Artikelseite'
109 | ]);
110 | $field->setNotice('Es kann entweder die Warenkorbseite aufgerufen werden oder die vorherige Artikelseite. Wenn die Artikelseite aufgerufen wird, so wird showcart=1 als Get-Parameter angehängt.rex_config::get("warehouse","cart_mode")');
111 |
112 | $res = rex_sql::factory()->getArray('SELECT name FROM '.rex::getTable('yform_email_template'));
113 | $options = array_column($res, 'name');
114 |
115 | $field = $form->addSelectField('email_template_customer');
116 | $field->setLabel('E-Mail Template Kunde');
117 | $select = $field->getSelect();
118 | $select->addOptions($options,true);
119 | $field->setNotice('rex_config::get("warehouse","email_template_customer")');
120 |
121 | $field = $form->addSelectField('email_template_seller');
122 | $field->setLabel('E-Mail Template Bestellung');
123 | $select = $field->getSelect();
124 | $select->addOptions($options,true);
125 | $field->setNotice('rex_config::get("warehouse","email_template_seller")');
126 |
127 | $field = $form->addTextField('order_email');
128 | $field->setLabel('Bestellungen E-Mail Empfänger');
129 | $field->setNotice('Mehrere E-Mail Empfänger können mit Komma getrennt werden.rex_config::get("warehouse","order_email")');
130 |
131 | // ==== Paypal
132 |
133 | $form->addFieldset('Paypal Einstellungen');
134 |
135 | $field = $form->addTextField('paypal_client_id');
136 | $field->setLabel('Paypal Client Id');
137 |
138 | $field = $form->addTextField('paypal_secret');
139 | $field->setLabel('Paypal Secret');
140 |
141 | $field = $form->addCheckboxField('sandboxmode');
142 | $field->setLabel('Paypal Sandbox ein');
143 | $field->addOption('Paypal Sandbox ein', "1");
144 |
145 |
146 | $field = $form->addTextField('paypal_sandbox_client_id');
147 | $field->setLabel('Paypal Sandbox Client Id');
148 |
149 | $field = $form->addTextField('paypal_sandbox_secret');
150 | $field->setLabel('Paypal Sandbox Secret');
151 |
152 | $field = $form->addTextField('paypal_getparams');
153 | $field->setLabel('Paypal Zusätzliche Get-Parameter für Paypal');
154 | $field->setNotice('z.B. um Maintenance bei der Entwicklung zu verwenden. Als JSON in der Form {"key1":"value1","key2":"value2"} angeben.');
155 |
156 | $field = $form->addLinkmapField('paypal_page_start');
157 | $field->setLabel('Paypal Startseite');
158 | $field->setNotice('rex_config::get("warehouse","paypal_page_start")');
159 |
160 | $field = $form->addLinkmapField('paypal_page_success');
161 | $field->setLabel('Paypal Zahlung erfolgt');
162 | $field->setNotice('rex_config::get("warehouse","paypal_page_success")');
163 |
164 | $field = $form->addLinkmapField('paypal_page_error');
165 | $field->setLabel('Paypal Fehler');
166 | $field->setNotice('rex_config::get("warehouse","paypal_page_error")');
167 |
168 |
169 | // ==== Giropay
170 |
171 | $form->addFieldset('Giropay Einstellungen');
172 |
173 | $field = $form->addTextField('giropay_merchand_id');
174 | $field->setLabel('Giropay Merchand Id');
175 |
176 | $field = $form->addTextField('giropay_project_id');
177 | $field->setLabel('Giropay Projekt Id');
178 |
179 | $field = $form->addTextField('giropay_project_pw');
180 | $field->setLabel('Giropay Projekt Passwort');
181 |
182 | $field = $form->addLinkmapField('giropay_page_start');
183 | $field->setLabel('Giropay Startseite');
184 | $field->setNotice('rex_config::get("warehouse","giropay_page_start")');
185 |
186 | $field = $form->addLinkmapField('giropay_page_notify');
187 | $field->setLabel('Giropay Antwortseite');
188 | $field->setNotice('rex_config::get("warehouse","giropay_page_notify")');
189 |
190 | $field = $form->addLinkmapField('giropay_page_error');
191 | $field->setLabel('Giropay Fehler');
192 | $field->setNotice('rex_config::get("warehouse","giropay_page_error")');
193 |
194 |
195 |
196 | // ==== Frachtrechnung
197 |
198 | $form->addFieldset('Frachtrechnung');
199 |
200 | $field = $form->addTextField('shipping');
201 | $field->setLabel('Versandkosten Standard');
202 | $field->setNotice('Kann leer bleiben, wenn Sonderfrachtberechnung definiert ist.');
203 |
204 | $field = $form->addSelectField('shipping_mode');
205 | $field->setLabel('Frachtberechnung');
206 | $select = $field->getSelect();
207 | $select->addOptions([
208 | 0 => 'Standard (Pauschal)',
209 | 'pieces' => 'nach Stück',
210 | 'order_total' => 'Betrag (brutto)',
211 | ]);
212 |
213 | $field = $form->addTextField('shipping_parameters');
214 | $field->setLabel('Fracht Parameter');
215 | $field->setNotice('Paramter für die Frachtberechnung. Als JSON in der Form [[">",4,10.5],[">",2,7.9],[">",0,5.9]] angeben. Jede Bedingung besteht aus drei Elementen. Als Kondition sind die Angaben >, '
216 | . '<, >=, <= oder = möglich. Der zweite Wert steht für die Anzahl, der dritte für den Frachtpreis. Die erste Bedingung die erfüllt ist, wird für die Frachtberechnung verwendet. Wenn keine Bedingung erfüllt ist, wird der Standardfrachtpreis berechnet.');
217 |
218 | // ==== Frachtrechnung
219 |
220 | $form->addFieldset('Alterscheck');
221 |
222 | $field = $form->addCheckboxField('agecheck');
223 | $field->setLabel('Alterscheck aktivieren');
224 | $field->addOption('Alterscheck aktivieren', "1");
225 | $field->setNotice('Wenn der Alterscheck aktiviert ist, kann eine Erstbestellung nur per giropay Alterscheck ausgeführt werden. Wenn der Besucher über die Community eingeloggt ist, wird der Alterscheck in der Community gespeichert. Wenn der Alterscheck in der Community gespeichert ist und der Benutzer eingeloggt ist, kann er auch mit anderen Zahlungsweisen bezahlen.');
226 |
227 |
228 | */
229 |
--------------------------------------------------------------------------------
/install/tablesets/ycom_board.json:
--------------------------------------------------------------------------------
1 | {"rex_ycom_board_post":{"table":{"id":"6","status":"1","table_name":"rex_ycom_board_post","name":"translate:com_board_name","description":"","list_amount":"50","list_sortfield":"created","list_sortorder":"DESC","prio":"3","search":"1","hidden":"0","export":"1","import":"1","mass_deletion":"0","mass_edit":"0","schema_overwrite":"1","history":"0"},"fields":[{"id":"47","table_name":"rex_ycom_board_post","prio":"1","type_id":"value","type_name":"text","db_type":"","list_hidden":"1","search":"1","name":"board_key","label":"translate:com_board_key","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"48","table_name":"rex_ycom_board_post","prio":"2","type_id":"value","type_name":"be_manager_relation","db_type":"","list_hidden":"1","search":"1","name":"thread_id","label":"translate:com_board_thread","not_required":"","options":"","multiple":"","default":"","size":"1","only_empty":"","message":"","table":"rex_ycom_board_post","hashname":"","password_hash":"","no_db":"","password_label":"","field":"title","type":"2","empty_value":"","empty_option":"1","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"49","table_name":"rex_ycom_board_post","prio":"3","type_id":"value","type_name":"text","db_type":"","list_hidden":"0","search":"1","name":"title","label":"translate:com_board_title","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"50","table_name":"rex_ycom_board_post","prio":"4","type_id":"validate","type_name":"empty","db_type":"","list_hidden":"1","search":"0","name":"title","label":"","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"\n\n\ntranslate:com_board_enter_title","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"51","table_name":"rex_ycom_board_post","prio":"5","type_id":"value","type_name":"textarea","db_type":"","list_hidden":"0","search":"1","name":"message","label":"translate:com_board_message","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"52","table_name":"rex_ycom_board_post","prio":"6","type_id":"validate","type_name":"empty","db_type":"","list_hidden":"1","search":"0","name":"message","label":"","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"\n\n\ntranslate:com_board_enter_message","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"53","table_name":"rex_ycom_board_post","prio":"7","type_id":"value","type_name":"be_manager_relation","db_type":"","list_hidden":"0","search":"1","name":"user_id","label":"translate:com_user","not_required":"","options":"","multiple":"","default":"","size":"1","only_empty":"","message":"","table":"rex_ycom_user","hashname":"","password_hash":"","no_db":"","password_label":"","field":"firstname, \" \", name","type":"2","empty_value":"","empty_option":"1","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"54","table_name":"rex_ycom_board_post","prio":"8","type_id":"value","type_name":"checkbox","db_type":"","list_hidden":"0","search":"1","name":"status","label":"translate:status","not_required":"","options":"","multiple":"","default":"1","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"55","table_name":"rex_ycom_board_post","prio":"9","type_id":"value","type_name":"datestamp","db_type":"datetime","list_hidden":"1","search":"1","name":"created","label":"mysql","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"1","message":"","table":"","hashname":"","password_hash":"","no_db":"0","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"0","html":"","notice":"","regex":"","pattern":"","format":"Y-m-d H:i:s","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"56","table_name":"rex_ycom_board_post","prio":"10","type_id":"value","type_name":"datestamp","db_type":"","list_hidden":"1","search":"1","name":"updated","label":"mysql","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"0","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"57","table_name":"rex_ycom_board_post","prio":"11","type_id":"value","type_name":"be_manager_relation","db_type":"","list_hidden":"1","search":"0","name":"notifications","label":"translate:com_board_notifications","not_required":"","options":"","multiple":"","default":"","size":"10","only_empty":"","message":"","table":"rex_ycom_user","hashname":"","password_hash":"","no_db":"","password_label":"","field":"firstname, \" \", name","type":"3","empty_value":"","empty_option":"1","max_size":"","types":"","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"","messages":"","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""},{"id":"60","table_name":"rex_ycom_board_post","prio":"12","type_id":"value","type_name":"upload","db_type":"text","list_hidden":"1","search":"0","name":"attachment","label":"Anhang","not_required":"","options":"","multiple":"","default":"","size":"","only_empty":"","message":"","table":"","hashname":"","password_hash":"","no_db":"","password_label":"","field":"","type":"","empty_value":"","empty_option":"","max_size":"","types":".gif,.png,.jpg","fields":"","position":"","address":"","width":"","height":"","show_value":"","html":"","notice":"","regex":"","pattern":"","format":"","current_date":"","widget":"","attributes":"","query":"","category":"","year_start":"","year_end":"","values":"","rules":"","nonce_key":"","nonce_referer":"","sizes":"0,2000","messages":"Die Datei ist zu klein,Die Datei ist zu gro\u00df - sie darf max. 2 MB gro\u00df sein,Keine Datei hochgeladen,Datei gel\u00f6scht.","rules_message":"","script":"","max":"","infotext_1":"","infotext_2":"","choices":"","expanded":"","scope":"","columns":"","googleapikey":"","unit":"","precision":"","scale":"","preview":""}]}}
--------------------------------------------------------------------------------
/lib/rex_ycom_board.php:
--------------------------------------------------------------------------------
1 | setKey($key);
19 | $this->setName($name);
20 | }
21 |
22 | public function getName()
23 | {
24 | return $this->name;
25 | }
26 |
27 | public function setName($name)
28 | {
29 | $this->name = $name;
30 | }
31 |
32 | public function getKey()
33 | {
34 | return $this->key;
35 | }
36 |
37 | public function setKey($key)
38 | {
39 | $this->key = $key;
40 | }
41 |
42 | public function setUrl($url)
43 | {
44 | $this->url = $url;
45 | }
46 |
47 | public function getPager()
48 | {
49 | return $this->pager;
50 | }
51 |
52 | public function setThreadsPerPage($threadsPerPage)
53 | {
54 | $this->threadsPerPage = $threadsPerPage;
55 | }
56 |
57 | public function setPostsPerPage($postsPerPage)
58 | {
59 | $this->postsPerPage = $postsPerPage;
60 | }
61 |
62 | public function setNotificationTemplate($notificationTemplate)
63 | {
64 | $this->notificationTemplate = $notificationTemplate;
65 | }
66 |
67 | public function setAdminGroup($groupId)
68 | {
69 | $this->adminGroup = $groupId;
70 | }
71 |
72 | public function isBoardAdmin(rex_ycom_user $user = null)
73 | {
74 | $user = $user ?: rex_ycom_auth::getUser();
75 |
76 | if (!$user || !$this->adminGroup) {
77 | return false;
78 | }
79 |
80 | $groups = explode(',', $user->getValue('rex_ycom_group'));
81 | return in_array($this->adminGroup, $groups);
82 | }
83 |
84 | public function getUrl(array $params = array())
85 | {
86 | $url = $this->url;
87 |
88 | if ($params) {
89 | $url .= false === strpos($url, '?') ? '?' : '&';
90 | $url .= http_build_query($params, null, '&');
91 | }
92 |
93 | return $url;
94 | }
95 |
96 | public function getCurrentUrl(array $params = array())
97 | {
98 | $defaultParams = array(
99 | 'function' => rex_get('function', 'string'),
100 | 'thread' => rex_get('thread', 'int'),
101 | 'start' => rex_get('start', 'int'),
102 | );
103 |
104 | $params = array_merge($defaultParams, $params);
105 | $params = array_filter($params);
106 |
107 | return $this->getUrl($params);
108 | }
109 |
110 | public function getPostUrl(rex_ycom_board_post $post)
111 | {
112 | return $this->getUrl(array('thread' => $post->getThreadId(), 'post' => $post->getId())) . '#' . $this->getPostIdAttribute($post);
113 | }
114 |
115 | public function getPostIdAttribute($post)
116 | {
117 | if ($post instanceof rex_ycom_board_post) {
118 | $post = $post->getId();
119 | }
120 |
121 | return sprintf('board-%s-post-%d', $this->getKey(), $post);
122 | }
123 |
124 | public function getPostDeleteUrl(rex_ycom_board_post $post)
125 | {
126 | return $this->getCurrentUrl(array(
127 | 'post' => $post->getId(),
128 | 'function' => 'delete',
129 | ));
130 | }
131 |
132 | public function getAttachmentUrl(rex_ycom_board_post $post)
133 | {
134 | return $this->getUrl(array('thread' => $post->getThreadId(), 'post' => $post->getId(), 'function' => 'attachment_download'));
135 | }
136 |
137 | /**
138 | * @return rex_ycom_board_thread[]
139 | */
140 | public function getThreads()
141 | {
142 | $this->pager = new rex_pager($this->threadsPerPage);
143 |
144 | return $this->getPosts(
145 | 'thread_id = ""',
146 | '(SELECT MAX(created) FROM rex_ycom_board_post p2 WHERE (p2.thread_id = p.id OR p2.id = p.id) AND status = 1) DESC'
147 | );
148 | }
149 |
150 | /**
151 | * @param rex_ycom_board_thread $thread
152 | * @param int $findPost
153 | *
154 | * @return rex_ycom_board_post[]
155 | */
156 | public function getThreadPosts(rex_ycom_board_thread $thread, rex_ycom_board_post $findPost = null)
157 | {
158 | $this->pager = new rex_pager($this->postsPerPage);
159 |
160 | return $this->getPosts(
161 | sprintf('thread_id = %d OR id = %1$d', $thread->getId()),
162 | 'created ASC',
163 | $findPost
164 | );
165 | }
166 |
167 | public function getPosts($where = '', $order = 'created ASC', rex_ycom_board_post $findPost = null)
168 | {
169 | $db = rex_sql::factory();
170 | // $db->setDebug();
171 |
172 | $where = sprintf(' WHERE board_key = "%s" AND status = 1 AND (%s)', $this->getKey(), $where);
173 |
174 | $db->setQuery('SELECT COUNT(*) as count FROM rex_ycom_board_post p '.$where);
175 | $count = $db->getValue('count');
176 |
177 | $this->pager->setRowCount($count);
178 |
179 | $order = 'ORDER BY '.$order;
180 |
181 | if ($findPost) {
182 | $db->setQuery('SELECT COUNT(*) as count FROM rex_ycom_board_post p '.$where.' AND created < (SELECT created FROM rex_ycom_board_post WHERE id = '.((int) $findPost->getId()).')'.$order);
183 | if ($db->getRows()) {
184 | $lessCount = $db->getValue('count');
185 |
186 | $cursor = ((int) ($lessCount / $this->pager->getRowsPerPage())) * $this->pager->getRowsPerPage();
187 | $cursor = $this->pager->validateCursor($cursor);
188 | $_REQUEST[$this->pager->getCursorName()] = $cursor;
189 | }
190 | }
191 |
192 | $limit = ' LIMIT '.$this->pager->getCursor().', '.$this->pager->getRowsPerPage();
193 |
194 | $posts_sql = $db->getArray('select * from rex_ycom_board_post p '.$where.$order.$limit);
195 |
196 | $posts = array();
197 | foreach ($posts_sql as $data) {
198 | if ($data['thread_id']) {
199 | $posts[] = new rex_ycom_board_post($data);
200 | } else {
201 | $posts[] = new rex_ycom_board_thread($data);
202 | }
203 | }
204 | return $posts;
205 | }
206 |
207 | /**
208 | * @param int $id
209 | * @return null|rex_ycom_board_post|rex_ycom_board_thread
210 | */
211 | public function getPost($id)
212 | {
213 | $sql = rex_sql::factory();
214 | $sql->setQuery('SELECT * FROM rex_ycom_board_post WHERE status = 1 and id = ' . (int) $id);
215 |
216 | if (!$sql->getRows()) {
217 | return null;
218 | }
219 |
220 | $data = $sql->getRow();
221 | if ($data['thread_id']) {
222 | return new rex_ycom_board_post($data);
223 | }
224 |
225 | return new rex_ycom_board_thread($data);
226 | }
227 |
228 | public function getView()
229 | {
230 | $thread = rex_get('thread', 'int');
231 | $function = rex_get('function', 'string');
232 |
233 | if ($thread) {
234 | $thread = rex_ycom_board_thread::get($thread);
235 | }
236 |
237 | if (!$thread) {
238 | if ('create_thread' === $function) {
239 | $yform = $this->getForm();
240 | $form = $yform->getForm();
241 |
242 | if ($yform->getObjectparams('actions_executed')) {
243 | $thread = rex_ycom_board_thread::get($yform->getObjectparams('main_id'));
244 |
245 | if (isset($yform->objparams['value_pool']['email']['notifications']) && $yform->objparams['value_pool']['email']['notifications']) {
246 | $thread->addNotificationUser(rex_ycom_auth::getUser());
247 | }
248 |
249 | // Notification Emails an alle schicken
250 | if (rex_config::get('ycom_board','send_new_thread_mail')) {
251 | ycom_board_message::send_messages($thread);
252 | }
253 |
254 | if ($thread && $thread->getId()) {
255 | header('Location: ' . htmlspecialchars_decode($this->getUrl(array('thread' => $thread->getId()))));
256 | exit;
257 | }
258 | }
259 | $fragment = new rex_fragment();
260 | $fragment->setVar('form',$form, false);
261 | $fragment->setVar('thread',$thread);
262 | $fragment->setVar('boardthis',$this);
263 | echo $fragment->parse('ycom_board_createform.php');
264 |
265 | // return $this->render('thread.create.tpl.php', compact('form'));
266 | }
267 |
268 | $threads = $this->getThreads();
269 | // dump($threads);
270 | // return $this->render('threads.tpl.php', compact('threads'));
271 | $fragment = new rex_fragment();
272 | $fragment->setVar('threads',$threads);
273 | $fragment->setVar('boardthis',$this);
274 | echo $fragment->parse('ycom_board_threads.php');
275 | }
276 |
277 | if ('enable_notifications' === $function) {
278 | $thread->addNotificationUser(rex_ycom_auth::getUser());
279 | }
280 | if ('disable_notifications' === $function) {
281 | $thread->removeNotificationUser(rex_ycom_auth::getUser());
282 | }
283 |
284 | if ('create_post' === $function) {
285 | $yform = $this->getForm();
286 | $yform->setValueField('hidden', array('thread_id', 'thread','REQUEST'));
287 | $yform->setValueField('objparams', array('value.title.default', 'Re: ' . $thread->getTitle(), ''));
288 |
289 | $form = $yform->getForm();
290 |
291 | if ($yform->getObjectparams('actions_executed')) {
292 | $post = rex_ycom_board_post::get($yform->getObjectparams('main_id'));
293 |
294 | $this->sendNotifications($thread, $post);
295 |
296 | if (isset($yform->objparams['value_pool']['email']['notifications']) && $yform->objparams['value_pool']['email']['notifications']) {
297 | $thread->addNotificationUser(rex_ycom_auth::getUser());
298 | }
299 |
300 | header('Location: ' . htmlspecialchars_decode($this->getPostUrl($post)));
301 | exit;
302 | }
303 |
304 | $fragment = new rex_fragment();
305 | $fragment->setVar('form',$form, false);
306 | $fragment->setVar('thread',$thread);
307 | $fragment->setVar('boardthis',$this);
308 | echo $fragment->parse('ycom_board_createform.php');
309 |
310 | // return $this->render('post.create.tpl.php', compact('thread', 'form'));
311 | }
312 |
313 | if ('delete' === $function && $this->isBoardAdmin() && ($id = rex_get('post', 'int')) && $post = $this->getPost($id)) {
314 | $this->deletePost($post);
315 |
316 | $params = array();
317 | if (!$post instanceof rex_ycom_board_thread) {
318 | $params = array(
319 | 'thread' => rex_get('thread', 'int'),
320 | 'start' => rex_get('start', 'int'),
321 | );
322 | }
323 | header('Location: ' . htmlspecialchars_decode($this->getUrl($params)));
324 | exit;
325 | }
326 |
327 | $post = null;
328 | if ($postId = rex_get('post', 'int')) {
329 | $post = rex_ycom_board_post::get($postId);
330 | }
331 |
332 | if ($post && 'attachment_download' === $function) {
333 | $this->sendAttachment($post);
334 | exit;
335 | }
336 |
337 | if ($thread) {
338 | $posts = $this->getThreadPosts($thread, $post);
339 |
340 | $fragment = new rex_fragment();
341 | $fragment->setVar('posts',$posts);
342 | $fragment->setVar('boardthis',$this);
343 | $fragment->setVar('thread',$thread);
344 | echo $fragment->parse('ycom_board_posts.php');
345 | }
346 |
347 |
348 | // dump($posts);
349 | // return $this->render('posts.tpl.php', compact('thread', 'posts'));
350 | }
351 |
352 | private function deletePost(rex_ycom_board_post $post)
353 | {
354 | $sql = rex_sql::factory();
355 |
356 | if (!$post instanceof rex_ycom_board_thread) {
357 | if ($post->hasAttachment()) {
358 | $file = rex_path::addonData('ycom_board', 'attachments/'.$post->getRealAttachment());
359 | rex_file::delete($file);
360 | }
361 |
362 | $sql->setQuery('DELETE FROM rex_ycom_board_post WHERE id = '.(int) $post->getId());
363 | return;
364 | }
365 |
366 | $where = 'id = '.(int) $post->getId().' OR thread_id = '.(int) $post->getId();
367 | $attachments = $sql->getArray('SELECT attachment FROM rex_ycom_board_post WHERE attachment != "" AND ('.$where.')');
368 | foreach ($attachments as $attachment) {
369 | $file = rex_path::addonData('ycom_board', 'attachments/'.$attachment['attachment']);
370 | rex_file::delete($file);
371 | }
372 |
373 | $sql->setQuery('DELETE FROM rex_ycom_board_post WHERE '.$where);
374 | }
375 |
376 | private function getForm()
377 | {
378 | $yform = new rex_yform();
379 | $yform->setObjectparams('real_field_names', true);
380 | $yform->setObjectparams('form_action', $this->getCurrentUrl());
381 |
382 | $yform->setValueField('hidden', array('board_key', $this->getKey()));
383 | $yform->setValueField('hidden', array('user_id', rex_ycom_auth::getUser()->id));
384 | $yform->setValueField('hidden', array('status', 1));
385 |
386 | $yform->setValueField('text', array('title', 'translate:com_board_title'));
387 | $yform->setValidateField('empty', array('title', 'translate:com_board_enter_title'));
388 | $yform->setValueField('textarea', array('message', 'translate:com_board_message'));
389 | $yform->setValidateField('empty', array('message', 'translate:com_board_enter_message'));
390 |
391 | $yform->setValueField('html',['','