File indexing completed on 2024-12-29 05:24:38
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 $tableProject = new Default_Model_Project(); 0024 $this->product_views = $tableProject->fetchProjectViews($this->product->project_id); 0025 $helperUserRole = new Backend_View_Helper_UserRole(); 0026 $userRoleName = $helperUserRole->userRole(); 0027 0028 $tableTags = new Default_Model_Tags(); 0029 $tagsArray = $tableTags->getTagsArray($this->product->project_id, $tableTags::TAG_TYPE_PROJECT, $tableTags::TAG_GHNS_EXCLUDED_GROUPID); 0030 $isGhnsExcluded = false; 0031 if(isset($tagsArray) && (count($tagsArray) == 1)) { 0032 $isGhnsExcluded = true; 0033 } 0034 0035 $isProductDangerous = $tableTags->isProductDangerous($this->product->project_id); 0036 0037 $filesTable = new Default_Model_DbTable_PploadFiles(); 0038 $countDownloadsToday = $filesTable->fetchCountDownloadsTodayForProject($this->product->ppload_collection_id); 0039 $countDownloadsTodayUk = $filesTable->fetchCountDownloadsTodayForProjectNew($this->product->ppload_collection_id); 0040 0041 if(empty($countDownloadsToday)) { 0042 $countDownloadsToday = 0; 0043 } 0044 0045 0046 // $heute = date("Y-m-d H:i:s"); 0047 $today = (new DateTime())->modify('-1 day'); 0048 $filterDownloadToday = $today->format("Y-m-d H:i:s"); 0049 ?> 0050 <div class="prod-widget-box right details"> 0051 <span class="title"> Details </span> 0052 0053 <div class="row"> 0054 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">license</span> 0055 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> 0056 <span class="value"> 0057 <?= $this->product->project_license_title; ?> </span> 0058 </div> 0059 </div> 0060 0061 <div class="row"> 0062 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">version</span> 0063 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> 0064 <span class="value"> 0065 <?= Default_Model_HtmlPurify::purify($this->product->project_version); ?> </span> 0066 </div> 0067 </div> 0068 0069 <?php if ($this->product->project_changed_at) { ?> 0070 <div class="row"> 0071 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">updated</span> 0072 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_changed_at) ?></span> 0073 </div> 0074 <?php } ?> 0075 0076 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0077 <div class="row"> 0078 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">major updated</span> 0079 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_major_updated_at) ?></span> 0080 </div> 0081 <?php endif; ?> 0082 0083 <div class="row"> 0084 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">added</span> 0085 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_created_at) ?></span> 0086 </div> 0087 0088 <div class="row"> 0089 <span class=" col-lg-6 col-md-6 col-sm-6 col-xs-6">downloads 24h</span> 0090 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <div id="downloadscntdb"><?= $countDownloadsToday ?></div></span> 0091 </div> 0092 0093 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0094 <div class="row"> 0095 <span class=" col-lg-6 col-md-6 col-sm-6 col-xs-6">downloads 24h</span> 0096 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <div id="downloadscntdb2"><?= $countDownloadsTodayUk ?></div></span> 0097 </div> 0098 <?php endif; ?> 0099 0100 0101 <div class="row"> 0102 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">page views today </span> 0103 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->projectPageviewsToday($this->product->project_id) ?></span> 0104 </div> 0105 0106 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0107 0108 <div class="row"> 0109 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">spam reports</span> 0110 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->fetchReportsSpamCnt($this->product->project_id) ?></span> 0111 </div> 0112 0113 <div class="row"> 0114 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">misuse reports</span> 0115 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->fetchReportsMisuseCnt($this->product->project_id)?></span> 0116 </div> 0117 <?php endif; ?> 0118 <div class="row" style="padding-top: 5px"> 0119 <div class="col-lg-12"> 0120 <div class="small " id="product-actions"> 0121 0122 <span style="padding-right: 20px;"> 0123 <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?> 0124 <a data-toggle="modal" data-target="#report-product-fraud-<?= $this->product->project_id ?>" role="button" 0125 href="#report-product-fraud-<?= $this->product->project_id ?>"> 0126 <span class="glyphicon glyphicon-alert"></span> Report Misuse 0127 </a> 0128 <?php }else{ ?> 0129 <a data-toggle="modal" data-target="#like-product-modal" role="button"> 0130 <span class="glyphicon glyphicon-alert"></span> Report Misuse 0131 </a> 0132 <?php } ?> 0133 </span> 0134 0135 0136 0137 <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?> 0138 <a data-toggle="modal" data-target="#report-product-<?= $this->product->project_id ?>" role="button" 0139 href="#report-product-<?= $this->product->project_id ?>"> 0140 <span class="glyphicon glyphicon-alert"></span> Report SPAM 0141 </a> 0142 <?php }else{ ?> 0143 <a data-toggle="modal" data-target="#like-product-modal" role="button"> 0144 <span class="glyphicon glyphicon-alert"></span> Report SPAM 0145 </a> 0146 <?php } ?> 0147 0148 0149 0150 </div> 0151 </div> 0152 </div> 0153 0154 0155 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0156 <span class="page-views font-italic"> 0157 <a target="_NEW" href="http://cp1.hive01.com/content/show.php?content=<?= $this->product->project_source_pk ?>">link to hive</a> 0158 </span> 0159 <span class="page-views font-italic"> 0160 <a id="delete-this" href="/backend/project/delete?project_id=<?= $this->product->project_id ?>">delete product</a> 0161 </span> 0162 0163 <div style="clear: both" class="small">(remember the cache) after you change some value below and refresh the page you may encounter some differences to your changes</div> 0164 <span class="page-views font-italic"> 0165 <input type="checkbox" id="spam-checked-checkbox" <?php echo $this->product->spam_checked == 1 ? ' checked=\'checked\' ' : ''; ?> /> spam checked 0166 </span> 0167 <span class="page-views font-italic"> 0168 <input type="checkbox" id="feature-this-checkbox" <?php echo $this->product->featured == 1 ? ' checked=\'checked\' ' : ''; ?> /> featured 0169 </span> 0170 <span class="page-views font-italic" style="color: red;"> 0171 <input type="checkbox" id="ghns_excluded-this-checkbox" <?php echo $isGhnsExcluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> ghns-excluded 0172 </span> 0173 <span class="page-views font-italic" style="color: red;"> 0174 <input type="checkbox" id="product_dangerous-checkbox" <?php echo $isProductDangerous == 1 ? ' checked=\'checked\' ' : ''; ?> /> product-dangerous 0175 </span> 0176 <span class="page-views font-italic" style="color: red;"> 0177 <input type="checkbox" id="pling-excluded-checkbox" <?php echo $this->product->pling_excluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> pling-excluded 0178 </span> 0179 0180 <script> 0181 $('#delete-this').on('click', function (event) { 0182 event.stopPropagation(); 0183 var result = confirm("Delete Product?"); 0184 if (result) { 0185 var target = $(this).attr('href'); 0186 $.ajax({ 0187 url: target, 0188 success: function (results) { 0189 alert('Product deleted successfully'); 0190 }, 0191 error: function () { 0192 alert('Service is temporarily unavailable.'); 0193 } 0194 }); 0195 } 0196 0197 return false; 0198 }); 0199 0200 $('#spam-checked-checkbox').on('click', function (event) { 0201 event.stopPropagation(); 0202 var feature = 0; 0203 if (this.checked) { 0204 feature = 1; 0205 } else { 0206 feature = 0; 0207 } 0208 0209 var target = "/backend/project/dospamchecked?project_id=<?= $this->product->project_id ?>&checked=" + feature; 0210 $.ajax({ 0211 url: target, 0212 success: function (results) { 0213 if (0 == results.spam_checked) { 0214 $('#spam-checked-checkbox').prop("checked", false); 0215 } else { 0216 $('#spam-checked-checkbox').prop("checked", true); 0217 0218 } 0219 0220 }, 0221 error: function () { 0222 alert('Service is temporarily unavailable.'); 0223 } 0224 }); 0225 0226 return false; 0227 0228 }); 0229 0230 $('#feature-this-checkbox').on('click', function (event) { 0231 event.stopPropagation(); 0232 var feature = 1; 0233 if (this.checked) { 0234 feature = 1; 0235 } else { 0236 feature = 0; 0237 } 0238 0239 var target = "/backend/project/dofeature?project_id=<?= $this->product->project_id ?>&featured=" + feature; 0240 $.ajax({ 0241 url: target, 0242 success: function (results) { 0243 if (feature == 0) { 0244 alert('Project remove featured successfully'); 0245 $('#feature-this-checkbox').prop("checked", false); 0246 0247 } else { 0248 alert('Project set featured successfully'); 0249 $('#feature-this-checkbox').prop("checked", true); 0250 0251 } 0252 0253 }, 0254 error: function () { 0255 alert('Service is temporarily unavailable.'); 0256 } 0257 }); 0258 0259 return false; 0260 0261 }); 0262 0263 0264 0265 0266 $('#pling-excluded-checkbox').on('click', function (event) { 0267 event.stopPropagation(); 0268 var status = 0; 0269 if (this.checked) { 0270 status = 1; 0271 } else { 0272 status = 0; 0273 } 0274 0275 var target = "/backend/project/doexclude?project_id=<?= $this->product->project_id ?>&pling_excluded=" + status; 0276 $.ajax({ 0277 url: target, 0278 success: function (results) { 0279 if (status == 0) { 0280 alert('Project was successfully included for plinging'); 0281 $('#pling-excluded-checkbox').prop("checked", false); 0282 0283 } else { 0284 alert('Project was successfully excluded for plinging'); 0285 $('#pling-excluded-checkbox').prop("checked", true); 0286 0287 } 0288 0289 }, 0290 error: function () { 0291 alert('Service is temporarily unavailable.'); 0292 } 0293 }); 0294 0295 return false; 0296 }); 0297 0298 0299 $('#product_dangerous-checkbox').on('click', function (event) { 0300 event.stopPropagation(); 0301 var status = 0; 0302 if (this.checked) { 0303 status = 1; 0304 } else { 0305 status = 0; 0306 } 0307 0308 var target = "/backend/project/dodangerous?project_id=<?= $this->product->project_id ?>&product_dangerous=" + status; 0309 $.ajax({ 0310 url: target, 0311 success: function (results) { 0312 if (status == 0) { 0313 alert('Project was successfully marked as not dangerous'); 0314 $('#product_dangerous-checkbox').prop("checked", false); 0315 0316 } else { 0317 alert('Project was successfully marked as dangerous'); 0318 $('#product_dangerous-checkbox').prop("checked", true); 0319 0320 } 0321 0322 }, 0323 error: function () { 0324 alert('Service is temporarily unavailable.'); 0325 } 0326 }); 0327 0328 return false; 0329 }); 0330 </script> 0331 0332 <span class="page-views"><input style="width: 40px;" type="text" id="project_category_id" 0333 value="<?php echo $this->product->project_category_id; ?>"> <button id="change_cat" 0334 data-href="/backend/project/changecat?project_id=<?= $this->product->project_id ?>&project_category_id=">change category</button></span> 0335 <script> 0336 $('#change_cat').on('click', function (event) { 0337 0338 event.stopPropagation(); 0339 var target = $(this).attr('data-href'); 0340 var newCat = $('#project_category_id').val(); 0341 0342 $.ajax({ 0343 url: target + newCat, 0344 success: function (results) { 0345 alert('Project updated successfully'); 0346 location.reload(); 0347 }, 0348 error: function () { 0349 alert('Service is temporarily unavailable.'); 0350 } 0351 }); 0352 0353 return false; 0354 }); 0355 </script> 0356 0357 <?php elseif (Default_Model_DbTable_MemberRole::ROLE_NAME_MODERATOR == $userRoleName) : ?> 0358 0359 <span class="page-views " style="color: red;"> 0360 0361 <input type="checkbox" id="ghns_excluded-this-checkbox" <?php echo $isGhnsExcluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> ghns-excluded 0362 </span> 0363 0364 0365 <?php endif; ?> 0366 0367 </div> 0368 0369 <?php 0370 if(Default_Model_DbTable_MemberRole::ROLE_NAME_MODERATOR == $userRoleName || 0371 Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName 0372 ){ 0373 $this->inlineScript()->appendScript( 0374 ' $(document).ready(function(){ 0375 GhnsExcludedClick.setup('.$this->product->project_id.'); 0376 }); 0377 '); 0378 }