public function ImageUpload() { global $CMS, $DB; $CMS->admin['system']->LoadSkinModule('attachment'); //start upload $data = $CMS->files->upload($_FILES['files'], array('limit' => 10, 'maxSize' => $this->WebdataFreeSize(), 'extensions' => null, 'required' => false, 'uploadDir' => 'data/' . WEBSITE_FNAME . '/upload/images/', 'title' => array('auto', 10), 'removeFiles' => true, 'perms' => null, 'onCheck' => null, 'onError' => null, 'onSuccess' => null, 'onUpload' => null, 'onComplete' => null, 'onRemove' => 'onFilesRemoveCallback')); if ($data['isComplete']) { // echo "OK"; // $files = $data['data']; // print_r($files); $this->SaveAttachmentData($data['data']); $total = ceiling($CMS->vars['webdata_size'] / (1024 * 1024), 0.5); $used = ceiling($this->WebdataFreeSize() / (1024 * 1024), 0.5); $percent = ceil($used * 100 / $total); $res = array("status" => "success", "total" => $total, "used" => $used, "percent" => $percent); echo json_encode($res); } if ($data['hasErrors']) { // echo "False"; // $errors = $data['errors']; // print_r($errors); $res = array("status" => "false"); echo json_encode($res); } return; }
public function AttachmentImage() { global $CMS, $DB; $lang = $CMS->admin['system']->LoadLanguage('admin_global'); $output = ""; $total = ceiling($CMS->vars['webdata_size'] / (1024 * 1024), 0.5); $used = ceiling($CMS->main_attachment->SizeCounter() / (1024 * 1024), 0.5); $percent = ceil($used * 100 / $total); $output .= <<<HERE \t\t\t\t<!-- Modal --> \t\t\t\t<div class="modal fade" id="window-attachment-quickaccess" role="dialog"> \t\t\t\t\t<div class="modal-dialog modal-lg"> \t\t\t\t\t\t<!-- Modal content--> \t\t\t\t\t\t<div class="modal-content"> \t\t\t\t\t\t\t<div class="modal-header"> \t\t\t\t\t\t\t\t<button type="button" class="close" data-dismiss="modal">×</button> \t\t\t\t\t\t\t\t<h4 class="modal-title">{$CMS->vars['lang']['acp_attachment_window_quick_access']}</h4> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t<div class="modal-body" style="padding: 0 !important;"> \t\t\t\t\t\t\t \t\t\t\t\t\t\t\t<div class="box" style="margin: 0px !important;"> \t\t\t\t\t\t\t\t\t<div class="box-header with-border"> \t\t\t\t\t\t\t\t\t\t<div class="col-md-6 col-sm-6 col-xs-12"> \t\t\t\t\t\t\t\t\t\t\t<p class="webdata-used"><span class="usedval">{$used}</span> MB (<span class="percentage">{$percent} %</span>) {$CMS->vars['lang']['lang_translate_of']} <span class="totalval">{$total}</span> MB {$CMS->vars['lang']['lang_translate_used']}</p> \t\t\t\t\t\t\t\t\t\t\t<div class="progress webdata-progressbar"> \t\t\t\t\t\t\t\t\t\t\t\t<div class="progress-bar" role="progressbar" aria-valuenow="{$percent}" aria-valuemin="0" aria-valuemax="100" style="width: {$percent}%;min-width: 2em;"> \t\t\t\t\t\t\t\t\t\t\t\t\t{$percent}% \t\t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t\t<script> \t\t\t\t\t\t\t\t\t\t\t\t\$(function(){ \t\t\t\t\t\t\t\t\t\t\t\t\tvar _CheckUsedStatus = \$(".webdata-progressbar").find(".progress-bar").attr("aria-valuenow"); \t\t\t\t\t\t\t\t\t\t\t\t\tif(_CheckUsedStatus < 50){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".webdata-progressbar").find(".progress-bar").css({"background-color": "green"}); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\tif(_CheckUsedStatus >= 50 && _CheckUsedStatus <= 90){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".webdata-progressbar").find(".progress-bar").css({"background-color": "orange"}); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\tif(_CheckUsedStatus > 90){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".webdata-progressbar").find(".progress-bar").css({"background-color": "red"}); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t</script> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t<div class="col-md-6 col-sm-6 col-xs-12 pull-right"> \t\t\t\t\t\t\t\t\t\t\t<div class="btn-group pull-right"> \t\t\t\t\t\t\t\t\t\t\t\t<a class="w-attachment-im-btn-nav active btn btn-default" data-toggle="tab" href="#w-attachment-list"><i class="fa fa-photo"></i> {$CMS->vars['lang']['acp_attachment_window_attm_list']}</a> \t\t\t\t\t\t\t\t\t\t\t\t<a class="w-attachment-im-btn-nav btn btn-default" data-toggle="tab" href="#w-attachment-upload"><i class="fa fa-cloud-upload"></i> {$CMS->vars['lang']['acp_attachment_window_upload_btn']}</a> \t\t\t\t\t\t\t\t\t\t\t\t<script> \t\t\t\t\t\t\t\t\t\t\t\t\t\$(function(){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".w-attachment-im-btn-nav").click(function(e){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".w-attachment-im-btn-nav").removeClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t</script> \t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t<div class="box-body"> \t\t\t\t\t\t\t\t\t\t<div class="tab-content"> \t\t\t\t\t\t\t\t\t\t\t<div id="w-attachment-list" class="tab-pane fade in active multi-select"> \t\t\t\t\t\t\t\t\t\t\t\t{$this->ListAttachment()} \t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t\t<div id="w-attachment-upload" class="tab-pane fade" data="{$CMS->vars['root_domain']}"> \t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12 w-attachment-im-show" style="background: #f7f8fa;padding: 50px;"> \t\t\t\t\t\t\t\t\t\t\t\t\t<!-- filer 3 --> \t\t\t\t\t\t\t\t\t\t\t\t\t<input type="file" multiple="multiple" name="files[]" id="dropdrag-upload" data-jfiler-name="files" data-jfiler-extensions="jpg, jpeg, png, gif"> \t\t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t<input type="hidden" id="x-attachment-list-selected-tmp-data" value="" /> \t\t\t\t\t\t\t\t\t\t<script> \t\t\t\t\t\t\t\t\t\t\t\$(function(){ \t\t\t\t\t\t\t\t\t\t\t\tvar _AttachmentResetSelect = function(){ \t\t\t\t\t\t\t\t\t\t\t\t\t\$("#x-attachment-list-selected-tmp-data").val(""); \t\t\t\t\t\t\t\t\t\t\t\t\t\$(".x-attachment-item").removeClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\tvar _SaveSelectedList = function(action,img){ \t\t\t\t\t\t\t\t\t\t\t\t\tif(action == "add"){ \t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _PicturesSelected = \$("#x-attachment-list-selected-tmp-data").val(); \t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _NewData = _PicturesSelected + "," + img; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#x-attachment-list-selected-tmp-data").val(_NewData); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\tif(action == "remove"){ \t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _PicturesSelected = \$("#x-attachment-list-selected-tmp-data").val(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t_PicturesSelected = _PicturesSelected.split(","); \t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _NewData = ""; \t\t\t\t\t\t\t\t\t\t\t\t\t\t_PicturesSelected.forEach(function(entry){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(entry != img && entry != ""){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t_NewData += "," + entry; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#x-attachment-list-selected-tmp-data").val(_NewData); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\$(document).on("click", ".x-attachment-item", function(e){ \t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault(); \t\t\t\t\t\t\t\t\t\t\t\t\tif(\$("#w-attachment-list").hasClass("multi-select")){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t//check -> add & remove \t\t\t\t\t\t\t\t\t\t\t\t\t\tif(!\$(this).hasClass("x-attachment-item-selected")){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _ImgSrc = \$(this).find("img").attr("src"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t_SaveSelectedList("add",_ImgSrc); \t\t\t\t\t\t\t\t\t\t\t\t\t\t}else{ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).removeClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar _ImgSrc = \$(this).find("img").attr("src"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t_SaveSelectedList("remove",_ImgSrc); \t\t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\t}else{ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(".x-attachment-item").removeClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\$(document).on("click", ".x-attachment-select-multi", function(e){ \t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault(); \t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").addClass("multi-select"); \t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").removeClass("one-select"); \t\t\t\t\t\t\t\t\t\t\t\t\t_AttachmentResetSelect(); \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\$(document).on("click", ".x-attachment-select-one", function(e){ \t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault(); \t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").removeClass("multi-select"); \t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").addClass("one-select"); \t\t\t\t\t\t\t\t\t\t\t\t\t_AttachmentResetSelect(); \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t/* \$("#w-attachment-list").find(".x-attachment-item").each(function(){ \t\t\t\t\t\t\t\t\t\t\t\t\tif(\$(this).find("img").attr("src") == "http://mtbweb.com/data/data__mtbweb_com/upload/images/16.jpg"){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("x-attachment-item-selected"); \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t}) */ \t\t\t\t\t\t\t\t\t\t\t\t//load attachment page \t\t\t\t\t\t\t\t\t\t\t\t\$(document).on("click", ".x-attachment-ajax-load-page", function(e){ \t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault(); \t\t\t\t\t\t\t\t\t\t\t\t\tvar _AjaxLink = \$(this).attr("href"); \t\t\t\t\t\t\t\t\t\t\t\t\tif(_AjaxLink != "#"){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".w-attachment-im-show").find(".ajax-fake-loading").show(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".x-attachment-ajax-load-page").removeClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$.ajax({ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmethod: "POST", \t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl: _AjaxLink, \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: {} \t\t\t\t\t\t\t\t\t\t\t\t\t\t}).done(function(data) { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").html(data); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".w-attachment-im-show").find(".ajax-fake-loading").hide(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\t}else{ \t\t\t\t\t\t\t\t\t\t\t\t\t\t//do nothing \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t//reload after upload success \t\t\t\t\t\t\t\t\t\t\t\t\$(document).on("click", ".upload-success-must-reload", function(){ \t\t\t\t\t\t\t\t\t\t\t\t\tvar _AjaxLink = \$(".w-attachment-im-show").find("#uploadsuccess-reloadlink").val(); \t\t\t\t\t\t\t\t\t\t\t\t\tif(_AjaxLink != "#"){ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".w-attachment-im-show").find(".ajax-fake-loading").show(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".x-attachment-ajax-load-page").removeClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).addClass("active"); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\$.ajax({ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmethod: "POST", \t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl: _AjaxLink, \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: {} \t\t\t\t\t\t\t\t\t\t\t\t\t\t}).done(function(data) { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").html(data); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$("#w-attachment-list").find(".w-attachment-im-show").find(".ajax-fake-loading").hide(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t\t\t}else{ \t\t\t\t\t\t\t\t\t\t\t\t\t\t//do nothing \t\t\t\t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\t\$(this).removeClass("upload-success-must-reload"); \t\t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t\t}) \t\t\t\t\t\t\t\t\t\t</script> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t \t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t<div class="modal-footer"> \t\t\t\t\t\t\t\t<div class="btn-group pull-left"> \t\t\t\t\t\t\t\t\t<a class="btn btn-primary x-custom-action" data-dismiss="modal"> \t\t\t\t\t\t\t\t\t\t<i class="fa fa-check"></i> {$CMS->vars['lang']['acp_attachment_window_apply_btn']} \t\t\t\t\t\t\t\t\t</a> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t<button type="button" class="btn btn-primary" data-dismiss="modal"><i class="fa fa-close"></i> {$CMS->vars['lang']['acp_attachment_window_cancel_btn']}</button> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t</div> \t\t\t\t\t</div> \t\t\t\t</div> HERE; return $output; }
function accesspress_mag_single_post_review_cb() { global $post; $trans_summary = of_get_option('trans_summary'); if (empty($trans_summary)) { $trans_summary = 'Summary'; } $trans_review = of_get_option('trans_review_overview'); if (empty($trans_review)) { $trans_review = 'Review overview'; } $post_review_type = get_post_meta($post->ID, 'product_review_option', true); $product_rating_description = get_post_meta($post->ID, 'product_rate_description', true); if ($post_review_type != 'norate' && $post_review_type == 'rate_stars') { $star_rating = get_post_meta($post->ID, 'star_rating', true); if (!empty($star_rating)) { ?> <div class="post-review-wrapper"> <span class="section-title"><?php echo esc_attr($trans_review); ?> </span> <div class="stars-review-wrapper"> <?php $count = 0; $total_review = 0; foreach ($star_rating as $key => $value) { if (!empty($key['feature_name']) || !empty($value['feature_star'])) { $count++; $featured_name = $value['feature_name']; $star_value = $value['feature_star']; if (empty($star_value)) { $star_value = '0.5'; } $total_review = $total_review + $star_value; ?> <div class="review-featured-wrap clearfix"> <span class="review-featured-name"><?php echo esc_attr($featured_name); ?> </span> <span class="stars-count"><?php display_product_rating($star_value); ?> </span> </div> <?php } } $total_review = $total_review / $count; //$final_value = round( $total_review, 1); $final_value = ceiling($total_review, 0.5); ?> </div> <div class="summary-wrapper clearfix"> <div class="summary-details"> <span class="summery-label"><?php echo esc_attr($trans_summary); ?> </span> <span class="summary-comments"><?php echo esc_textarea($product_rating_description); ?> </span> </div> <div class="total-reivew-wrapper"> <span class="total-value"><?php echo esc_attr($final_value); ?> </span> <span class="stars-count"><?php display_product_rating($final_value); ?> </span> </div> </div> </div> <?php } } elseif ($post_review_type != 'norate' && $post_review_type == 'rate_percent') { $percent_rating = get_post_meta($post->ID, 'percent_rating', true); if (!empty($percent_rating)) { ?> <div class="post-review-wrapper"> <span class="section-title"><?php echo esc_attr($trans_review); ?> </span> <div class="percent-review-wrapper"> <?php $count = count($percent_rating); $total_review = 0; foreach ($percent_rating as $key => $value) { $featured_name = $value['feature_name']; $percent_value = $value['feature_percent']; if (empty($percent_value)) { $percent_value = '1'; } $total_review = $total_review + $percent_value; ?> <div class="percent-wrap clearfix"> <span class="featured-name"><?php echo esc_attr($featured_name); ?> </span> - <span class="percent-value"><?php echo esc_attr($percent_value); ?> % </span> <div class="percent-rating-bar-wrap"><div style="width:<?php echo esc_attr($percent_value); ?> %"></div></div> </div> <?php } $total_review = $total_review / $count; $total_review = round($total_review, 2); ?> </div> <div class="summary-wrapper clearfix"> <div class="summary-details"> <span class="summery-label"><?php echo esc_attr($trans_summary); ?> </span> <span class="summary-comments"><?php echo esc_textarea($product_rating_description); ?> </span> </div> <div class="total-reivew-wrapper"> <span class="total-value"><?php echo esc_attr($total_review); ?> <span class="tt-per"> %</span> </span> </div> </div> </div> <?php } } elseif ($post_review_type != 'norate' && $post_review_type == 'rate_point') { $points_rating = get_post_meta($post->ID, 'points_rating', true); if (!empty($points_rating)) { ?> <div class="post-review-wrapper"> <span class="section-title"><?php echo esc_attr($trans_review); ?> </span> <div class="points-review-wrapper"> <?php $count = count($points_rating); $total_review = 0; foreach ($points_rating as $key => $value) { $featured_name = $value['feature_name']; $points_value = $value['feature_points']; if (empty($points_value)) { $points_value = '0.1'; } $total_review = $total_review + $points_value; $points_bar = $points_value * 10; ?> <div class="percent-wrap clearfix"> <span class="featured-name"><?php echo esc_attr($featured_name); ?> </span> - <span class="percent-value"><?php echo esc_attr($points_value); ?> </span> <div class="percent-rating-bar-wrap"><div style="width:<?php echo esc_attr($points_bar); ?> %"></div></div> </div> <?php } $total_review = $total_review / $count; $total_review = round($total_review, 2); ?> </div> <div class="summary-wrapper clearfix"> <div class="summary-details"> <span class="summery-label"><?php echo esc_attr($trans_summary); ?> </span> <span class="summary-comments"><?php echo esc_textarea($product_rating_description); ?> </span> </div> <div class="total-reivew-wrapper"> <span class="total-value"><?php echo esc_attr($total_review); ?> </span> </div> </div> </div> <?php } } }
function sort_channels($list_all_enabled_channel, $channels_sort_list) { // 20.07.10 global $config; global $config_tv_logo; /* >0 = ID 0 = next empty null = next from xyz */ $counter = 0; $line_count = count($channels_sort_list); for ($i = 0; $i < $line_count; $i++) { // if is defined channel number... if ($channels_sort_list[$i]['id'] > 0 && $list_all_enabled_channel[$channels_sort_list[$i]['name']] === 1) { $final_channels_sorted_list[$counter]['channel_number'] = $channels_sort_list[$i]['id']; $final_channels_sorted_list[$counter]['name'] = $channels_sort_list[$i]['name']; $counter++; unset($list_all_enabled_channel[$channels_sort_list[$i]['name']]); } } $line_count = count($channels_sort_list); for ($i = 0; $i < $line_count; $i++) { // if is channel number defines as 0...use next empty... if ($channels_sort_list[$i]['id'] === 0 && $list_all_enabled_channel[$channels_sort_list[$i]['name']] === 1) { $next_empty_id = return_next_empty_id($final_channels_sorted_list); $final_channels_sorted_list[$counter]['channel_number'] = $next_empty_id; $final_channels_sorted_list[$counter]['name'] = $channels_sort_list[$i]['name']; $counter++; unset($list_all_enabled_channel[$channels_sort_list[$i]['name']]); } } $actual_max_channel_number = 0; // Find Max Channel Number... $line_count = count($final_channels_sorted_list); for ($i = 0; $i < $line_count; $i++) { if (isset($final_channels_sorted_list[$i]['channel_number'])) { if ($final_channels_sorted_list[$i]['channel_number'] > $actual_max_channel_number) { $actual_max_channel_number = $final_channels_sorted_list[$i]['channel_number']; } } } $other_channel_number_begin_from = ceiling($actual_max_channel_number + $config['add_to_rounding'], 100); $line_count = count($channels_sort_list); for ($i = 0; $i < $line_count; $i++) { // if is channel number defines as NULL...use next empty bigger then... if (!isset($channels_sort_list[$i]['id']) && $list_all_enabled_channel[$channels_sort_list[$i]['name']] === 1) { $next_empty_id = return_next_empty_id($final_channels_sorted_list, $other_channel_number_begin_from); $final_channels_sorted_list[$counter]['channel_number'] = $next_empty_id; $final_channels_sorted_list[$counter]['name'] = $channels_sort_list[$i]['name']; $counter++; unset($list_all_enabled_channel[$channels_sort_list[$i]['name']]); } } if ($config['debug'] >= 3) { echo '<pre>'; echo '<b>$list_all_enabled_channel (' . count($list_all_enabled_channel) . ')</b>' . "\n"; print_r($list_all_enabled_channel); echo '</pre>'; } ksort($list_all_enabled_channel, SORT_STRING); if ($config['debug'] >= 3) { echo '<pre>'; echo '<b>SORT -> $list_all_enabled_channel (' . count($list_all_enabled_channel) . ')</b>' . "\n"; print_r($list_all_enabled_channel); echo '</pre>'; } // all other channel... foreach ($list_all_enabled_channel as $k => $v) { $next_empty_id = return_next_empty_id($final_channels_sorted_list, $other_channel_number_begin_from); $final_channels_sorted_list[$counter]['channel_number'] = $next_empty_id; $final_channels_sorted_list[$counter]['name'] = $k; $counter++; unset($list_all_enabled_channel[$k]); } if ($config['debug'] >= 3) { echo '<pre>'; echo '<b>$final_channels_sorted_list (' . count($final_channels_sorted_list) . ')</b>' . "\n"; print_r($final_channels_sorted_list); echo '</pre>'; } // remove old ch. list $temp['tvheadend_channels_dir'] = $config['path_tvheadend_config_dir'] . $config['path_tvheadend_channels']; $dir_list_array = list_files_into_dir($temp['tvheadend_channels_dir']); $line_count = count($dir_list_array); for ($i = 0; $i < $line_count; $i++) { @unlink($config['path_tvheadend_config_dir_output'] . $config['path_tvheadend_channels'] . $dir_list_array[$i]); } $line_count = count($final_channels_sorted_list); for ($i = 0; $i < $line_count; $i++) { // TV Logo if ($config['tv_logo'] === 1) { if (isset($config_tv_logo[$final_channels_sorted_list[$i]['name']])) { $temp_tv_logo = "\n" . ' "icon": "' . $config['path_tv_logo_-_tvheadend'] . $config_tv_logo[$final_channels_sorted_list[$i]['name']] . '",'; } else { $temp_tv_logo = NULL; } } $output = '{ "name": "' . $final_channels_sorted_list[$i]['name'] . '",' . $temp_tv_logo . ' "tags": [ ], "dvr_extra_time_pre": 0, "dvr_extra_time_post": 0, "channel_number": ' . (int) $final_channels_sorted_list[$i]['channel_number'] . ' } '; // write new channels... robin_file_write($config['path_tvheadend_config_dir_output'] . $config['path_tvheadend_channels'] . ($i + 1), $output); } return $final_channels_sorted_list; }