Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: apiservices.php
<div class="page-header border-bottom-0"> <div class="page-header-content header-elements-md-inline"> <div class="page-title d-flex"> <h4> <a href="javascript:void(0)" class="BackButton-Link" onclick="goBack()"><i class="icon-arrow-left52 mr-2"></i></a> <? echo $heading.' linked to API - '.$apiName; ?> </h4> </div> </div> </div> <div class="content pt-0"> <div class="card"> <div class="row"> <div class="col-12 col-sm-12 col-lg-12 col-lg-12 col-xl-12"> <div class="card-body"> <? if($message != '') echo '<div class="alert alert-success">'.$message.'</div>'; ?> <? if(($this->input->post_get('msg')) != '') echo '<div class="alert alert-success">Prices have been updated successfully!</div>'; ?> <div class=""> <?php echo form_open(base_url($this->config->item('apanel_name').'/settings/apiservices').get_query_string(),'method="post" id="frm" name="frm"'); ?> <div class="row"> <div class="col-md-12"> <div class="form-group" align="right"> <div class="table-responsive"> <table width="60%" align="right"> <tr> <td width="10%"><img style="display:none;" id="imgCPLdr" src="<?php base_url('assets') ?>/images/loading.gif" border="0" alt="Please wait..." /></td> <td width="5%"><input type="checkbox" id="chkSync" name="chkSync" /></td> <td width="20%">Pick price from API</td> <td width="49%"><a href="JavaScript:void(0);" id="btnSyncPrice" class="btn btn-primary"><span class="fa fa-refresh"></span> Sync Prices</a></td> <td width="16%"><input type="submit" <?php if($IS_DEMO) echo 'disabled="disabled"';?> value="<? echo $this->lang->line('BE_LBL_72'); ?>" class="btn btn-primary ThemeColorButton" name="btnSubmit" onclick="setValue('0');" /></td> </tr> </table> </div> </div> </div> </div> <br> <br> <div class="row"> <div class="col-md-12"> <div class="table-responsive"> <table class="table table-striped table-bordered table-advance table-hover"> <thead> <tr> <th nowrap="nowrap" width="5%">Sr. #</th> <th width="40%" style="word-wrap: break-spaces"><? echo $this->lang->line('BE_PCK_HD_4'); ?></th> <th width="10%">Type</th> <th width="10%"><? echo $this->lang->line('BE_LBL_651'); ?></th> <th width="10%"><? echo $this->lang->line('BE_PCK_14'); ?></th> <? if($totalGroups > 0) { foreach($rsGroups as $row) { echo '<th width="10%">'.stripslashes($row->PricePlan).'</th>'; $PLANS[$row->PricePlanId] = stripslashes($row->PricePlan); } } ?> <th><input type="checkbox" id="chkSelect" name="chkSelect" onClick="selectAllChxBxs('chkSelect', 'chkPacks', <? echo $count; ?>);" value="true"> </th> </tr> </thead> <tbody> <? $strCurrPacks = 0; if($count != 0) { $i = 0; foreach($rsPacks as $row) { $priceColStyle = ''; $strCurrPacks .= ', '.$row->$colId; $packStatus = $row->$disableCol == '0' ? 'Active' : 'In Active'; if($row->$colPrice < $row->CostPrice) $priceColStyle = ' style="color:red; font-weight:bold;"'; if($reqIds == '') $reqIds = $row->$colId.'|'.$row->ExternalNetworkId.'|'.$row->CostPriceFromAPI; else $reqIds .= ','.$row->$colId.'|'.$row->ExternalNetworkId.'|'.$row->CostPriceFromAPI; if($sc == '2') $editLnk = base_url($this->config->item('apanel_name').'/services')."serverservice?id=".$row->$colId; else $editLnk = base_url($this->config->item('apanel_name').'/services')."/package?fs=$sc&id=".$row->$colId; ?> <? $ServiceCount = 0; $changesInPrices = array(); foreach ($PLANS as $key => $value) { if(isset($DEFAULT_PLAN_PRICES[$key][$row->$colId])) { $planPrice = roundMe($DEFAULT_PLAN_PRICES[$key][$row->$colId]); } else { $planPrice = roundMe($row->$colPrice); } if($planPrice < $row->CostPrice){ $changesInPrices[$ServiceCount]=$row->$colId; } $ServiceCount++; } if(in_array($row->$colId,$changesInPrices)){ $strServiceStyle = 'style="color:red; font-weight:bold;"'; }else{ $strServiceStyle = ''; } ?> <tr> <td nowrap="nowrap"> <? echo $i+1; ?>.</td> <td> <a title="Edit Service" href="<? echo $editLnk; ?>"><i class="fa fa-pencil-square-o"></i></a> <span <?php echo $strServiceStyle;?>><? echo stripslashes($row->$colTitle);?></span> <? if($row->CostPriceFromAPI == '1') { $defaultPrice = '0'; $defaultMarginType = ''; if(isset($PRICES[$row->$colId][0]) && $PRICES[$row->$colId][0] != '') { $val = $PRICES[$row->$colId][0]; $arr = explode('|', $val); if(isset($arr[0]) && is_numeric($arr[0])) $defaultPrice = roundMe($arr[0]); if(isset($arr[1]) && is_numeric($arr[1])) { $defaultMarginType = $arr[1] == '0' ? '' : '%'; } } $strPriceMargins = ''; $icon = 'upload'; foreach ($PLANS as $key => $value) { $priceVal = '0'; $marginTypeVal = ''; if(isset($PRICES[$row->$colId][$key]) && $PRICES[$row->$colId][$key] != '') { $val = $PRICES[$row->$colId][$key]; $arr = explode('|', $val); if(isset($arr[0]) && is_numeric($arr[0])) $priceVal = roundMe($arr[0]); if(isset($arr[1]) && is_numeric($arr[1])) $marginTypeVal = $arr[1] == '0' ? '' : '%'; } $symbol = $priceVal >= 0 ? "+" : "-"; $strPriceMargins .= '<strong>'.$value.'</strong> '.$symbol.' '.$priceVal.$marginTypeVal.' '.$DEFAULT_CURRENCY.'<br />'; if($priceVal > 0 || $defaultPrice > 0) $icon = 'chevron-down'; } ?> <a data-target="#collapseList_<? echo $row->$colId;?>" class=" btn btn-xs pull-right" data-toggle="collapse" id="list_auto_update"> <i class="fa fa-<? echo $icon;?>"></i> </a> <div class="collapse" id="collapseList_<? echo $row->$colId;?>"> <div class="well"> <strong>Default</strong> <? echo $defaultPrice >= 0 ? '+' : '-' ?> <? echo $defaultPrice.$defaultMarginType.' '.$DEFAULT_CURRENCY; ?> <br /> <? echo $strPriceMargins; ?> <a href="<?php echo base_url($this->config->item('apanel_name').'/settings') ?>/apiservices?id=<? echo $apiId?>&an=<? echo $apiName;?>&serviceId=<? echo $row->$colId;?>&del=1" class="btn btn-danger btn-xs pull-right" title= "Delete Prices" onclick="return confirm('Are you sure you want to delete these price margins?')"> <i class="fa fa-trash-o"></i></a> <a href="setpriceswithapi.php?srvcAPIId=<? echo $apiId;?>&serviceId=<? echo $row->$colId;?>&sType=<? echo $sc;?>" class="fancybox fancybox.ajax btn btn-info btn-xs pull-right" title="Set Services Price Margins"><i class="fa fa-pencil"></i></a> <br /> </a> </div> </div> <? } ?> </td> <td> <? if(isset($ALTAPIS[$row->$colId]) && $ALTAPIS[$row->$colId] != '') { echo "Alternate $apiType"; } else { echo $apiType; } ?> </td> <td><input type="text" maxlength="10" class="form-control" name="txtCostPrice<? echo $i; ?>" value="<? echo roundMe($row->CostPrice);?>"></td> <td><input type="text" <? echo $priceColStyle; ?> maxlength="10" class="form-control" name="txtPrice<? echo $i; ?>" value="<? echo roundMe($row->$colPrice);?>" size="5"></td> <? $pCount = 0; foreach ($PLANS as $key => $value) { $strStyle = ''; if(isset($DEFAULT_PLAN_PRICES[$key][$row->$colId])) { $planPrice = roundMe($DEFAULT_PLAN_PRICES[$key][$row->$colId]); } else { $planPrice = roundMe($row->$colPrice); } if($planPrice < $row->CostPrice) $strStyle = ' style="color:red; font-weight:bold;"'; ?> <td> <input type="text" <? echo $strStyle;?> maxlength="10" class="form-control" name="txtPlanPrice<? echo $pCount;?>_<? echo $i; ?>" value="<? echo roundMe($planPrice);?>" size="5"> <input type="hidden" value="<? echo $key?>" name="hdPlanId<? echo $pCount;?>_<? echo $i; ?>" /> </td> <? $pCount++; } ?> <td align="center"><input type="checkbox" id="chkPacks<? echo $i; ?>" name="chkPacks[]" value="<? echo $row->$colId.'|'.$i; ?>" /></td> </tr> <? $i++; } } else{?> <tr><td colspan='7'></td><?php echo $this->lang->line('BE_GNRL_9');?></tr>"; <?php }?> <input type="hidden" value="0" name="cldFrm" id="cldFrm" /> <input type="hidden" value="<? echo $sc?>" id="sc" name="sc" /> <input type="hidden" value="<? echo $apiId?>" name="id" id="id" /> <input type="hidden" value="<? echo $reqIds?>" name="reqIds" id="reqIds" /> <input type="hidden" value="<? echo $apiName?>" name="an" id="an" /> <input type="hidden" value="<? echo $totalGroups?>" name="totalPlans" /> </tbody> </table> </div> </div> </div> <br> <br> <div class="row"> <div class="col-md-12"> <div class="form-group" align="right"> <input type="submit" <?php if($IS_DEMO) echo 'disabled="disabled"';?> value="Disconnect Selected Services" class="btn btn-primary" name="btnDisconnect" onclick="setValue('1');" /> </div> </div> </div> <?php echo form_close() ?> </div> </div> </div> </div> </div> </div> <script> var baseurl = <?php echo base_url();?> var csrf_token_hash = <?php echo $this->security->get_csrf_hash();?> </script> <script language="JavaScript" src="<?php echo base_url('assets/js/functions.js?v='.$this->config->item('assets_version')); ?>" type="text/javascript"></script> <script language="javascript" src="<?php echo base_url('assets') ?>/js/apiservices.js?v=<?php echo $this->config->item('assets_version'); ?>"></script> <script> function setValue(i) { document.getElementById('cldFrm').value = i; } function getServiceIds() { var totalSrvcs = <? echo $count; ?>; var strIds = '0'; for(var i=0; i<totalSrvcs; i++) { if(document.getElementById('chkPacks'+i).checked) { strIds += ',' + document.getElementById('chkPacks'+i).value; } } return strIds; } </script>