File indexing completed on 2025-05-04 05:29:23
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 $filesTable = new Default_Model_DbTable_PploadFiles(); 0036 $mediaViewsTable = new Default_Model_DbTable_MediaViews(); 0037 0038 $countDownloadsToday = 0; 0039 $countMediaViewsAlltime = 0; 0040 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { 0041 $countDownloadsToday = $filesTable->fetchCountDownloadsTodayForProject($this->product->ppload_collection_id); 0042 $countMediaViewsAlltime = $mediaViewsTable->fetchCountViewsForProjectAllTime($this->product->project_id); 0043 } 0044 $countDownloadsTodayUk = $filesTable->fetchCountDownloadsTodayForProjectNew($this->product->ppload_collection_id); 0045 $countMediaViewsToday = $mediaViewsTable->fetchCountViewsTodayForProject($this->product->project_id); 0046 0047 $countPageviews = $this->projectDetailCounts($this->product->project_id); 0048 $countPageviewsTotal = 0; 0049 $countPageviewsToday = $countPageviews[0]['count_views']; 0050 if(sizeof($countPageviews)==2) $countPageviewsTotal = $countPageviews[1]['count_views']; 0051 0052 0053 0054 // $heute = date("Y-m-d H:i:s"); 0055 $today = (new DateTime())->modify('-1 day'); 0056 $filterDownloadToday = $today->format("Y-m-d H:i:s"); 0057 ?> 0058 <style> 0059 .font-italic{ 0060 font-style: italic; 0061 } 0062 .font-italic span{ 0063 font-style: italic; 0064 } 0065 </style> 0066 <div class="prod-widget-box right details"> 0067 <span class="title"> Details </span> 0068 0069 <div class="row"> 0070 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">license</span> 0071 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> 0072 <span class="value"> 0073 <?= $this->product->project_license_title; ?> </span> 0074 </div> 0075 </div> 0076 0077 <div class="row"> 0078 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">version</span> 0079 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> 0080 <span class="value"> 0081 <?= Default_Model_HtmlPurify::purify($this->product->project_version); ?> </span> 0082 </div> 0083 </div> 0084 0085 <?php if ($this->product->project_changed_at) { ?> 0086 <div class="row"> 0087 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">updated</span> 0088 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_changed_at) ?></span> 0089 </div> 0090 <?php } ?> 0091 0092 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0093 <div class="row font-italic"> 0094 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">major updated</span> 0095 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_major_updated_at) ?></span> 0096 </div> 0097 <?php endif; ?> 0098 0099 <div class="row"> 0100 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">added</span> 0101 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->printDate($this->product->project_created_at) ?></span> 0102 </div> 0103 0104 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0105 <div class="row font-italic"> 0106 <span class=" col-lg-6 col-md-6 col-sm-6 col-xs-6">downloads 24h old</span> 0107 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <div id="downloadscntdb"><?= $countDownloadsToday ?></div></span> 0108 </div> 0109 <?php endif; ?> 0110 0111 <div class="row"> 0112 <span class=" col-lg-6 col-md-6 col-sm-6 col-xs-6">downloads 24h</span> 0113 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <div id="downloadscntdb2"><?= $countDownloadsTodayUk ?></div></span> 0114 </div> 0115 0116 <div class="row"> 0117 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">mediaviews 24h </span> 0118 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $countMediaViewsToday ?></span> 0119 </div> 0120 0121 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0122 0123 <div class="row font-italic"> 0124 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">mediaviews total </span> 0125 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $countMediaViewsAlltime ?></span> 0126 </div> 0127 0128 <?php endif; ?> 0129 0130 <div class="row"> 0131 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">pageviews 24h </span> 0132 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $countPageviewsToday ?></span> 0133 </div> 0134 0135 0136 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0137 0138 <div class="row font-italic"> 0139 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">pageviews total </span> 0140 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $countPageviewsTotal ?></span> 0141 </div> 0142 0143 <div class="row font-italic"> 0144 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">spam reports</span> 0145 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->fetchReportsSpamCnt($this->product->project_id) ?></span> 0146 </div> 0147 0148 <div class="row font-italic"> 0149 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6">misuse reports</span> 0150 <span class="col-lg-6 col-md-6 col-sm-6 col-xs-6 value"> <?= $this->fetchReportsMisuseCnt($this->product->project_id)?></span> 0151 </div> 0152 <?php endif; ?> 0153 <div class="row" style="padding-top: 5px"> 0154 <div class="col-lg-12"> 0155 <div class="small " id="product-actions"> 0156 0157 <span style="padding-right: 20px;"> 0158 <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?> 0159 <a data-toggle="modal" data-target="#report-product-fraud-<?= $this->product->project_id ?>" role="button" 0160 href="#report-product-fraud-<?= $this->product->project_id ?>"> 0161 <span class="glyphicon glyphicon-alert"></span> Report Misuse 0162 </a> 0163 <?php }else{ ?> 0164 <a data-toggle="modal" data-target="#like-product-modal" role="button"> 0165 <span class="glyphicon glyphicon-alert"></span> Report Misuse 0166 </a> 0167 <?php } ?> 0168 </span> 0169 0170 0171 0172 <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?> 0173 <a data-toggle="modal" data-target="#report-product-<?= $this->product->project_id ?>" role="button" 0174 href="#report-product-<?= $this->product->project_id ?>"> 0175 <span class="glyphicon glyphicon-alert"></span> Report SPAM 0176 </a> 0177 <?php }else{ ?> 0178 <a data-toggle="modal" data-target="#like-product-modal" role="button"> 0179 <span class="glyphicon glyphicon-alert"></span> Report SPAM 0180 </a> 0181 <?php } ?> 0182 0183 0184 0185 </div> 0186 </div> 0187 </div> 0188 0189 0190 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0191 <span class="page-views font-italic"> 0192 <a target="_NEW" href="http://cp1.hive01.com/content/show.php?content=<?= $this->product->project_source_pk ?>">link to hive</a> 0193 </span> 0194 <span class="page-views font-italic"> 0195 <a id="delete-this" href="/backend/project/delete?project_id=<?= $this->product->project_id ?>">delete product</a> 0196 </span> 0197 0198 <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> 0199 <span class="page-views font-italic"> 0200 <input type="checkbox" id="spam-checked-checkbox" autocomplete="off" <?php echo $this->product->spam_checked == 1 ? ' checked=\'checked\' ' : ''; ?> /> spam checked (<?php echo $this->product->spam_checked == 1 ? '1' : '0'; ?>) 0201 </span> 0202 <span class="page-views font-italic"> 0203 <input type="checkbox" id="feature-this-checkbox" autocomplete="off" <?php echo $this->product->featured == 1 ? ' checked=\'checked\' ' : ''; ?> /> featured (<?php echo $this->product->featured == 1 ? '1':'0'; ?>) 0204 </span> 0205 <span class="page-views font-italic" style="color: red;"> 0206 <input type="checkbox" id="ghns_excluded-this-checkbox" autocomplete="off" <?php echo $isGhnsExcluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> ghns-excluded (<?php echo $isGhnsExcluded == 1 ? '1' : '0'; ?>) 0207 </span> 0208 <span class="page-views font-italic" style="color: red;"> 0209 <input type="checkbox" id="pling-excluded-checkbox" autocomplete="off" <?php echo $this->product->pling_excluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> pling-excluded (<?php echo $this->product->pling_excluded == 1 ? '1' : '0'; ?>) 0210 </span> 0211 0212 0213 <script> 0214 $('#delete-this').on('click', function (event) { 0215 event.stopPropagation(); 0216 var result = confirm("Delete Product?"); 0217 if (result) { 0218 var target = $(this).attr('href'); 0219 $.ajax({ 0220 url: target, 0221 success: function (results) { 0222 alert('Product deleted successfully'); 0223 }, 0224 error: function () { 0225 alert('Service is temporarily unavailable.'); 0226 } 0227 }); 0228 } 0229 0230 return false; 0231 }); 0232 0233 $('#spam-checked-checkbox').on('click', function (event) { 0234 event.stopPropagation(); 0235 var feature = 0; 0236 if (this.checked) { 0237 feature = 1; 0238 } else { 0239 feature = 0; 0240 } 0241 0242 var target = "/backend/project/dospamchecked?project_id=<?= $this->product->project_id ?>&checked=" + feature; 0243 $.ajax({ 0244 url: target, 0245 success: function (results) { 0246 if (0 == results.spam_checked) { 0247 $('#spam-checked-checkbox').prop("checked", false); 0248 } else { 0249 $('#spam-checked-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 $('#feature-this-checkbox').on('click', function (event) { 0264 event.stopPropagation(); 0265 var feature = 1; 0266 if (this.checked) { 0267 feature = 1; 0268 } else { 0269 feature = 0; 0270 } 0271 0272 var target = "/backend/project/dofeature?project_id=<?= $this->product->project_id ?>&featured=" + feature; 0273 $.ajax({ 0274 url: target, 0275 success: function (results) { 0276 if (feature == 0) { 0277 alert('Project remove featured successfully'); 0278 $('#feature-this-checkbox').prop("checked", false); 0279 0280 } else { 0281 alert('Project set featured successfully'); 0282 $('#feature-this-checkbox').prop("checked", true); 0283 0284 } 0285 0286 }, 0287 error: function () { 0288 alert('Service is temporarily unavailable.'); 0289 } 0290 }); 0291 0292 return false; 0293 0294 }); 0295 0296 0297 0298 0299 $('#pling-excluded-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/doexclude?project_id=<?= $this->product->project_id ?>&pling_excluded=" + status; 0309 $.ajax({ 0310 url: target, 0311 success: function (results) { 0312 if (status == 0) { 0313 alert('Project was successfully included for plinging'); 0314 $('#pling-excluded-checkbox').prop("checked", false); 0315 0316 } else { 0317 alert('Project was successfully excluded for plinging'); 0318 $('#pling-excluded-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 0331 0332 $(window).bind("load", function() { 0333 // Featured. 0334 var php_status = <?php echo $this->product->featured == 1 ? '1':'0'; ?>; 0335 var ischecked = document.getElementById("feature-this-checkbox").checked; 0336 if(ischecked != php_status) { 0337 console.log("feature-this-checkbox is Checked but should not! PHP-Staus: " + php_status + " - HTML-Status: " + ischecked); 0338 if(php_status == 0) { 0339 document.getElementById("feature-this-checkbox").checked = false; 0340 } else { 0341 document.getElementById("feature-this-checkbox").checked = true; 0342 } 0343 } 0344 // spam_checked. 0345 php_status = <?php echo $this->product->spam_checked == 1 ? '1':'0'; ?>; 0346 ischecked = document.getElementById("spam-checked-checkbox").checked; 0347 if(ischecked != php_status) { 0348 console.log("spam-checked-checkbox is Checked but should not! PHP-Staus: " + php_status + " - HTML-Status: " + ischecked); 0349 if(php_status == 0) { 0350 document.getElementById("spam-checked-checkbox").checked = false; 0351 } else { 0352 document.getElementById("spam-checked-checkbox").checked = true; 0353 } 0354 } 0355 // ghns_excluded 0356 php_status = <?php echo $isGhnsExcluded == 1 ? '1':'0'; ?>; 0357 ischecked = document.getElementById("ghns_excluded-this-checkbox").checked; 0358 if(ischecked != php_status) { 0359 console.log("ghns_excluded-this-checkbox is Checked but should not! PHP-Staus: " + php_status + " - HTML-Status: " + ischecked); 0360 if(php_status == 0) { 0361 document.getElementById("ghns_excluded-this-checkbox").checked = false; 0362 } else { 0363 document.getElementById("ghns_excluded-this-checkbox").checked = true; 0364 } 0365 } 0366 // pling-excluded. 0367 php_status = <?php echo $this->product->pling_excluded == 1 ? '1':'0'; ?>; 0368 ischecked = document.getElementById("pling-excluded-checkbox").checked; 0369 if(ischecked != php_status) { 0370 console.log("pling-excluded-checkbox is Checked but should not! PHP-Staus: " + php_status + " - HTML-Status: " + ischecked); 0371 if(php_status == 0) { 0372 document.getElementById("pling-excluded-checkbox").checked = false; 0373 } else { 0374 document.getElementById("pling-excluded-checkbox").checked = true; 0375 } 0376 } 0377 }); 0378 0379 </script> 0380 0381 <span class="page-views"><input style="width: 40px;" type="text" id="project_category_id" 0382 value="<?php echo $this->product->project_category_id; ?>"> <button id="change_cat" 0383 data-href="/backend/project/changecat?project_id=<?= $this->product->project_id ?>&project_category_id=">change category</button></span> 0384 <script> 0385 $('#change_cat').on('click', function (event) { 0386 0387 event.stopPropagation(); 0388 var target = $(this).attr('data-href'); 0389 var newCat = $('#project_category_id').val(); 0390 0391 $.ajax({ 0392 url: target + newCat, 0393 success: function (results) { 0394 alert('Project updated successfully'); 0395 location.reload(); 0396 }, 0397 error: function () { 0398 alert('Service is temporarily unavailable.'); 0399 } 0400 }); 0401 0402 return false; 0403 }); 0404 </script> 0405 0406 <?php elseif (Default_Model_DbTable_MemberRole::ROLE_NAME_MODERATOR == $userRoleName) : ?> 0407 0408 <span class="page-views " style="color: red;"> 0409 0410 <input type="checkbox" id="ghns_excluded-this-checkbox" <?php echo $isGhnsExcluded == 1 ? ' checked=\'checked\' ' : ''; ?> /> ghns-excluded 0411 </span> 0412 0413 0414 <?php endif; ?> 0415 0416 </div> 0417 0418 <?php 0419 if(Default_Model_DbTable_MemberRole::ROLE_NAME_MODERATOR == $userRoleName || 0420 Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName 0421 ){ 0422 $this->inlineScript()->appendScript( 0423 ' $(document).ready(function(){ 0424 GhnsExcludedClick.setup('.$this->product->project_id.'); 0425 }); 0426 '); 0427 }