function client($shop, $shops_token, $api_key, $shared_secret, $private_app = false) { $password = $shops_token; $baseurl = "https://{$shop}/"; return function ($method, $path, $params = array(), &$response_headers = array()) use($baseurl, $shops_token) { $url = $baseurl . ltrim($path, '/'); $query = in_array($method, array('GET', 'DELETE')) ? $params : array(); $payload = in_array($method, array('POST', 'PUT')) ? stripslashes(json_encode($params)) : array(); $request_headers = array(); array_push($request_headers, "X-Shopify-Access-Token: {$shops_token}"); if (in_array($method, array('POST', 'PUT'))) { array_push($request_headers, "Content-Type: application/json; charset=utf-8"); } return _api($method, $url, $query, $payload, $request_headers, $response_headers); }; }
function apps_installations_theme() { global $user, $globals, $l, $theme, $softpanel, $error, $apps; if (!empty($user['apps_ins']) && optGET('api')) { _api($user['apps_ins'], optGET('api')); return; } softheader($l['<title>']); error_handle($error, '100%'); if (optGET('showupdates')) { echo '<center class="sai_anotice"> <a href="' . $globals['ind'] . 'act=apps_installations">' . $l['showing_only'] . ' ' . $l['see_all'] . '</a> </center> <br />'; } // For APPS INSTALLATION LIST ksort($user['apps_ins']); echo '<br /><br /><center> <span class="sai_newhead">' . $l['apps_ins'] . '</span> </center><br /><br />'; echo '<table border="0" cellpadding="2" cellspacing="0" width="100%" > <tr> <td><b>' . $l['path'] . '</b></td> <td width="180"><b>' . $l['ins_time'] . '</b></td> <td width="80"><b>' . $l['version'] . '</b></td> <td width="120"><b>' . $l['options'] . '</b></td> </tr> </table> '; $i = 1; $th = 0; if (count($user['apps_ins']) > 0) { //r_print($user['apps_ins']); echo '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="sai_altrowstable">'; foreach ($user['apps_ins'] as $k => $v) { foreach ($v as $ik => $iv) { if ($th == 0) { echo '<tr> <th colspan="5">' . $apps[$iv['aid']]['name'] . '</th> </tr>'; } echo '<tr id="trid' . $ik . '" class="' . ($i % 2 == 0 ? "sai_evenrowcolor" : "sai_oddrowcolor") . '"> <td>' . (empty($iv['path']['base']) ? $l['default_apps_base'] : $iv['path']['base']) . '</td> <td width="180">' . datify($iv['itime']) . '</td> <td width="80">' . $iv['version'] . '</td> <td width="120"><a href="' . $globals['ind'] . 'act=apps&app=' . $iv['aid'] . '" title="' . $l['remove'] . '"><img src="' . $theme['images'] . 'remove.gif" /></a> <input type="checkbox" name="ainsids[]" value="' . $iv['aid'] . '"> </td> </tr>'; $i++; $th = 1; } $th = 0; } echo '</table><br /><br /> <p align="right"> ' . $l['with_selected'] . ': <select name="multi_options_apps" id="multi_options_apps"> <option name="todo_apps" id="todo_apps" value="0">---</option> <option name="todo_apps" id="todo_apps" value="mult_rem">' . $l['remove_apps'] . '</option> </select> <input type="button" value="' . $l['go'] . '" onclick="show_confirm_apps()"> <br /> </p> <div id="rem_div_apps"></div> <script language="javascript" type="text/javascript"><!-- // --><![CDATA[ ainsids = new Array(); removed = new Object(); function show_confirm_apps(){ ainsids = new Array(); removed = new Object(); if($_("multi_options_apps").value != "mult_rem"){ return false; } // Build the list of Installations to remove var field = document.getElementsByName(\'ainsids[]\'); ainsids = new Array(); var c = 0; for(i = 0; i < field.length; i++){ if(field[i].checked == true){ ainsids[c] = field[i].value; c++; } } //alert(ainsids); if(c == 0){ alert("' . $l['no_sel_inst'] . '"); return false; } var r = confirm("' . $l['del_insid'] . '"); if(r != true){ return false; } remove_by_id_apps(ainsids[0], "", 0); } function remove_by_id_apps(ainsid, re, oldainsid){ removed[ainsid] = false; if(re.length > 0 && oldainsid > 0){ if(re == "removed"){ removed[ainsid] = true; } } nextainsid = 0; // Find the next INSTALLATION to remove for(i = 0; i < ainsids.length; i++){ if(typeof(removed[ainsids[i]]) != "undefined"){ continue; } nextainsid = ainsids[i]; break; } // If there is something left to be removed if(ainsid != 0){ try{ AJAX("' . $globals['index'] . 'act=apps&app="+ainsid+"&remove=1&ajax=1&random="+Math.random(), "remove_by_id_apps(\'"+nextainsid+"\', re, \'"+ainsid+"\')"); $_("rem_div_apps").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +ainsid+ "<br /></p>"; return true; }catch(e){ alert(e.description); return false; } } $_("rem_div_apps").innerHTML = ""; alert("' . $l['inst_remvd'] . '"); location.reload(true); return true; } // ]]></script>'; } else { echo '<center>' . $l['no_ins'] . '</center>'; } softfooter(); }
function _api($method, $url, $query = '', $payload = '', $request_headers = array(), &$response_headers = array(), $loop = 0) { try { $response = wcurl($method, $url, $query, $payload, $request_headers, $response_headers); } catch (WcurlException $e) { throw new CurlException($e->getMessage(), $e->getCode()); } $response = json_decode($response, true); if (isset($response['errors']) or $response_headers['http_status_code'] >= 400) { if ($loop < 3 && ($response_headers['http_status_code'] == 429 || calls_left($response_headers) == 0)) { usleep(500000); // sleep 0.5 second and try again (max 3 times) $loop++; return _api($method, $url, $query, $payload, $request_headers, $response_headers, $loop); } throw new ApiException(compact('method', 'path', 'params', 'response_headers', 'response', 'shops_myshopify_domain', 'shops_token')); } if (calls_left($response_headers) > 0 && calls_left($response_headers) <= 3) { usleep(100000); } return (is_array($response) and !empty($response)) ? array_shift($response) : $response; }
function installations_theme() { global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $scripts, $no_autoupgrade; global $installations, $sortby, $disabled_scripts; if (!empty($installations) && optGET('api')) { _api($installations, optGET('api')); return; } softheader($l['<title>']); error_handle($error, '100%'); echo '<div class="bg"><br /> <div class="row sai_main_head" style="width:100%;" align="center"> <div class="col-sm-5 col-xs-5" style="padding:0px 10px 0 0; text-align:right;"> <i class="fa sai-installations fa-1x" style="color:#00A0D2;"></i> </div> <div class="col-sm-7 col-xs-7" style="padding-top:0px; padding-left:0; text-align:left;">' . $l['scripts_ins'] . '</div> </div><hr>'; if (optGET('showupdates')) { echo '<center class="alert alert-warning"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <a href="' . $globals['ind'] . 'act=installations" style="text-decoration:none;">' . $l['showing_only'] . ' ' . $l['see_all'] . '</a> </center>'; } echo '<span class="sortby" style="float:right;display:inline; margin:0 10px;"> <table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr> <td><div style="display:none;" id="sortby_wait"><img src="' . $theme['images'] . 'progress.gif" alt="please wait.."></div></td> <td>' . $l['sort_by'] . ' : </td> <td> <select name="sortby" onchange="sortby(this.value);"> <option selected="selected" value="default">' . $l['sort_script'] . '</option> <option value="domains">' . $l['sort_domain'] . '</option> <option value="time">' . $l['sort_ins_time'] . '</option> </select> </td> </tr> </table> </span><br /><br /><br />'; echo ' <div id="installations_table"> <table border="0" cellpadding="5" cellspacing="0" width="100%" class="table table-hover"> <tr> <thead class="sai_head2" style="background:#333; color:#fff;"> <th><b>' . $l['link'] . '</b></th> <th width="150"><b>' . $l['admin'] . '</b></th> <th width="190"><b>' . $l['ins_time'] . '</b></th> <th width="150"><b>' . $l['version'] . '</b></th> <th width="130"><b>' . $l['options'] . '</b></th> <th width="50"><input type="checkbox" id="check_all_ins" onchange="multiple_check()"></th> <thead> </tr> </table> '; if (count($installations) > 0) { foreach ($installations as $sid => $installs) { echo '<link href="' . $globals['mirror_images'] . 'sprites/20.css" rel="stylesheet" type="text/css" /> <table border="0" cellpadding="5" cellspacing="0" width="100%" class="table table-hover"> <tr> <th colspan="10" style="background:#EFEFEF;"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="no"> <td ' . ($sortby != 'domains' ? 'class="sp20_' . $iscripts[$sid]['softname'] . '"' : '') . '></td> <th> ' . ($sortby != 'domains' ? empty($iscripts[$sid]) ? $l['no_info'] : '<a href="' . script_link($sid, 1) . '" style="text-decoration:none;">' . $iscripts[$sid]['name'] . '</a>' : $sid) . '</th> </tr> </table> </th> </tr>'; foreach ($installs as $ik => $iv) { $tmp_sid = is_upgradable($ik); $tmp_upgradeto = implode(' or ', $tmp_sid); $is_cloneable = is_cloneable($iv['sid']); if (!empty($tmp_sid)) { $tmp_sid = array_keys($tmp_sid); } echo '<tr id="trid' . $ik . '"> <td class="endurl"><a href="' . $iv['softurl'] . '" target="_blank" id="insurl' . $ik . '">' . $iv['softurl'] . '</a></td> <td width="140"><a href="' . $iv['softurl'] . '/' . (!empty($iv['admin_folder']) ? $iv['admin_folder'] : admin_folder($iv['sid'])) . '" target="_blank"><img src="' . $theme['images'] . '/admin.gif" /></a></td> <td width="190">' . datify($iv['itime']) . '</td> <td width="90">' . $iv['ver'] . (!empty($tmp_sid) ? ' <a href="' . $globals['ind'] . 'act=upgrade&insid=' . $ik . '"><img src="' . $theme['images'] . 'updates.gif" alt="' . $l['upd_to'] . ' ' . $tmp_upgradeto . '" title="' . $l['upd_to'] . ' ' . $tmp_upgradeto . '" /></a>' : '') . (!empty($iv['eu_auto_upgrade']) && empty($no_autoupgrade['disable_autoupgrade']) && empty($no_autoupgrade['scripts'][$iv['sid']]) ? '<img src="' . $theme['images'] . 'auto_upgrade.png" title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/>' : '') . '</td> <td width="190" align="right">' . (!empty($is_cloneable) ? '<a href="' . $globals['ind'] . 'act=sclone&insid=' . $ik . '" title="' . $l['clone'] . '"><img src="' . $theme['images'] . 'clone.gif" /></a> ' : '') . (empty($globals['disable_backup_restore']) ? '<a href="' . $globals['ind'] . 'act=backup&insid=' . $ik . '" title="' . $l['backup'] . '"><img src="' . $theme['images'] . 'backup.gif" /></a>' : '') . ' <a href="' . $globals['ind'] . 'act=remove&insid=' . $ik . '" title="' . $l['remove'] . '"><img src="' . $theme['images'] . 'remove.gif" /></a> <a href="' . $globals['ind'] . 'act=editdetail&insid=' . $ik . '" title="' . $l['editdetail'] . '"><img src="' . $theme['images'] . 'editdetail.gif" /></a></td> <td width="50"><input type="checkbox" class="check_all_ins" name="insids[]" id="' . $iv['softurl'] . '" value="' . $ik . '"> </td> </tr>'; } echo '</table><br /><br />'; } } else { echo '<br /><center>' . $l['no_ins'] . '</center><br />'; } echo '</div><br />'; // List the installations of scripts which have been disabled by Softaculous or Admin // In this user can delete, backup, and restore the installations. // Clone and Upgrade are not possible as the packages wont be there. if (count($disabled_scripts) > 0) { echo '<br /><center> <span class="sai_main_head">' . $l['disabled_scripts'] . '</span> <hr> </center> <table border="0" cellpadding="5" cellspacing="0" width="100%" class="table table-hover"> <tr> <thead class="sai_head2" style="background:#333; color:#fff;"> <th><b>' . $l['link'] . '</b></th> <th width="150"><b>' . $l['admin'] . '</b></th> <th width="190"><b>' . $l['ins_time'] . '</b></th> <th width="120"><b>' . $l['version'] . '</b></th> <th width="150"><b>' . $l['options'] . '</b></th> <th width="50"><input type="checkbox" id="check_all_disabled" onchange="multiple_check()"></th> <thead> </tr> </table>'; foreach ($disabled_scripts as $sid => $installs) { echo '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="table table-hover"> <tr> <th colspan="10" style="background:#EFEFEF;"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="no"> <th> ' . $l['no_info'] . '</th> </tr> </table> </th> </tr>'; foreach ($installs as $ik => $iv) { echo '<tr id="trid' . $ik . '"> <td class="endurl"><a href="' . $iv['softurl'] . '" target="_blank" id="insurl' . $ik . '">' . $iv['softurl'] . '</a></td> <td width="140"><a href="' . $iv['softurl'] . '/' . (!empty($iv['admin_folder']) ? $iv['admin_folder'] : admin_folder($iv['sid'])) . '" target="_blank"><img src="' . $theme['images'] . '/admin.gif" /></a></td> <td width="190">' . datify($iv['itime']) . '</td> <td width="70">' . $iv['ver'] . '</td> <td width="200" align="center"><a href="' . $globals['ind'] . 'act=remove&insid=' . $ik . '" title="' . $l['remove'] . '"><img src="' . $theme['images'] . 'remove.gif" /></a> <td width="50"><input type="checkbox" class="check_all_disabled" name="insids[]" id="' . $iv['softurl'] . '" value="' . $ik . '"> </td> </tr>'; } echo '</table><br /><br />'; } } echo '<p align="right"> ' . $l['with_selected'] . ': <select name="multi_options" id="multi_options"> <option name="todo" id="todo" value="0">---</option> <option name="todo" id="todo" value="mult_rem">' . $l['remove'] . '</option> </select> <input type="button" value="' . $l['go'] . '" onclick="show_confirm()" class="sai_graybluebut"> </p> <div id="rem_div"></div> <script language="javascript" type="text/javascript"><!-- // --><![CDATA[ insids = new Array(); removed = new Object(); function show_confirm(){ insids = new Array(); removed = new Object(); if($_("multi_options").value != "mult_rem"){ return false; } // Build the list of Installations to remove var field = document.getElementsByName(\'insids[]\'); insids = new Array(); var c = 0; for(i = 0; i < field.length; i++){ if(field[i].checked == true){ insids[c] = field[i].value; c++; } } //alert(insids); if(c == 0){ alert("' . $l['no_sel_inst'] . '"); return false; } var r = confirm("' . $l['del_insid'] . '"); if(r != true){ return false; } remove_by_id(insids[0], "", 0); } function remove_by_id(insid, re, oldinsid){ removed[insid] = false; if(re.length > 0 && oldinsid > 0){ if(re == "removed"){ removed[insid] = true; } } nextinsid = 0; // Find the next INSTALLATION to remove for(i = 0; i < insids.length; i++){ if(typeof(removed[insids[i]]) != "undefined"){ continue; } nextinsid = insids[i]; break; } // If there is something left to be removed if(insid != 0){ try{ AJAX("' . $globals['index'] . 'act=remove&insid="+insid+"&ajax=1&ssk="+randomstring(32)+"&random="+Math.random(), "remove_by_id(\'"+nextinsid+"\', re, \'"+insid+"\')"); $_("rem_div").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +insid+ ", URL: " + $_("insurl"+insid)+"<br /></p>"; return true; }catch(e){ return false; } } $_("rem_div").innerHTML = ""; alert("' . $l['inst_remvd'] . '"); location.reload(true); return true; } function sortby(sb){ $("#sortby_wait").css("display", "inline"); $.ajax({ type: "GET", url: "' . $globals['index'] . 'act=installations&sortby="+sb+"&jsnohf=1", // Checking for error success: function(data){ $("#sortby_wait").css("display", "none"); var $response=$(data); //query the jq object for the values var output = $response.find("#installations_table").html(); $("#installations_table").html(output); new_theme_funcs_init(); multiple_check(); }, error: function(data) { //alert(data.description); return false; } }); } function multiple_check(){ $("#check_all_ins").on("click", function(event){ if(this.checked == true){ $(".check_all_ins").prop("checked", true); }else{ $(".check_all_ins").prop("checked", false); } }); $("#check_all_disabled").on("click", function(event){ if(this.checked == true){ $(".check_all_disabled").prop("checked", true); }else{ $(".check_all_disabled").prop("checked", false); } }); $("#check_all_classes").on("click", function(event){ if(this.checked == true){ $(".check_all_classes").prop("checked", true); }else{ $(".check_all_classes").prop("checked", false); } }); } $(document).ready(function(){ multiple_check(); $(".sai_altrowstable tr").mouseover(function(){ if($(this).attr("class") == "no"){ return; } var old_class = $(this).attr("class"); //alert(old_class); $(this).attr("class", "sai_tr_bgcolor"); $(this).mouseout(function(){ $(this).attr("class", old_class); }); }); }); // ]]></script>'; // For CLASSES INSTALLATION LIST ksort($user['classes_ins']); if (count($user['classes_ins']) > 0) { echo '<br /><center> <span class="sai_main_head">' . $l['classes_ins'] . '</span> <hr> </center> <table border="0" cellpadding="2" cellspacing="0" width="100%" class="table table-hover"> <tr> <thead class="sai_head2" style="background:#333; color:#fff;"> <th><b>' . $l['link'] . '</b></th> <th width="180"><b>' . $l['ins_time'] . '</b></th> <th width="80"><b>' . $l['version'] . '</b></th> <th width="120"><b>' . $l['options'] . '</b></th> <th width="50"><input type="checkbox" id="check_all_classes" onchange="multiple_check()"></th> <thead> </tr> </table> '; $th = 0; //r_print($user['classes_ins']); echo '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="table table-hover">'; foreach ($user['classes_ins'] as $k => $v) { foreach ($v as $ik => $iv) { if ($th == 0) { echo '<tr> <th colspan="10" style="background:#EFEFEF;">' . $iv['name'] . $iv['cid'] . '</th> </tr>'; } echo '<tr id="trid' . $ik . '"> <td>' . $iv['softpath'] . '</td> <td width="180">' . datify($iv['itime']) . '</td> <td width="80">' . $iv['ver'] . '</td> <td width="120"><a href="' . $globals['ind'] . 'act=classes_remove&cinsid=' . $ik . '" title="' . $l['remove'] . '"><img src="' . $theme['images'] . 'remove.gif" /></a></td> <td width="50"><input type="checkbox" class="check_all_classes" name="cinsids[]" value="' . $ik . '"> </td> </tr>'; $th = 1; } $th = 0; } echo '</table><br /><br /> <p align="right" style="width:100%"> ' . $l['with_selected'] . ': <select name="multi_options_classes" id="multi_options_classes"> <option name="todo_classes" id="todo_classes" value="0">---</option> <option name="todo_classes" id="todo_classes" value="mult_rem">' . $l['remove_classes'] . '</option> </select> <input type="button" value="' . $l['go'] . '" onclick="show_confirm_classes()" class="sai_graybluebut"> <br /> </p> <div id="rem_div_classes"></div> <script language="javascript" type="text/javascript"><!-- // --><![CDATA[ cinsids = new Array(); removed = new Object(); function show_confirm_classes(){ cinsids = new Array(); removed = new Object(); if($_("multi_options_classes").value != "mult_rem"){ return false; } // Build the list of Installations to remove var field = document.getElementsByName(\'cinsids[]\'); cinsids = new Array(); var c = 0; for(i = 0; i < field.length; i++){ if(field[i].checked == true){ cinsids[c] = field[i].value; c++; } } //alert(cinsids); if(c == 0){ alert("' . $l['no_sel_inst'] . '"); return false; } var r = confirm("' . $l['del_insid'] . '"); if(r != true){ return false; } remove_by_id_classes(cinsids[0], "", 0); } function remove_by_id_classes(cinsid, re, oldcinsid){ removed[cinsid] = false; if(re.length > 0 && oldcinsid > 0){ if(re == "removed"){ removed[cinsid] = true; } } nextcinsid = 0; // Find the next INSTALLATION to remove for(i = 0; i < cinsids.length; i++){ if(typeof(removed[cinsids[i]]) != "undefined"){ continue; } nextcinsid = cinsids[i]; break; } // If there is something left to be removed if(cinsid != 0){ try{ AJAX("' . $globals['index'] . 'act=classes_remove&cinsid="+cinsid+"&ajax=1&random="+Math.random(), "remove_by_id_classes(\'"+nextcinsid+"\', re, \'"+cinsid+"\')"); $_("rem_div_classes").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +cinsid+ "<br /></p>"; return true; }catch(e){ alert(e.description); return false; } } $_("rem_div_classes").innerHTML = ""; alert("' . $l['inst_remvd'] . '"); location.reload(true); return true; } // ]]></script>'; } echo '</div>'; softfooter(); }
function apps_updates_theme() { global $user, $globals, $l, $theme, $softpanel, $error, $apps, $update, $result, $done; // For updating entir file if (optGET('ajax')) { $soft = (int) optGET('app'); if (!empty($error)) { echo '0' . $l['error'] . $user['apps_update'][$soft]['name'] . ' : ' . current($error); return false; } } // For updating entir file if (optGET('ajax_remove')) { $soft = (int) optGET('app'); if (!empty($error)) { echo '0' . current($error); return false; } } if (!empty($user['apps_update']) && optGET('api')) { _api($user['apps_update'], optGET('api')); return; } softheader($l['<title>']); error_handle($error, '100%'); echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[ ainsids = new Array(); updated = new Object(); $(document).ready(function(){ $(".sai_altrowstable tr").mouseover(function(){ var old_class = $(this).attr("class"); $(this).attr("class", "sai_tr_bgcolor"); $(this).mouseout(function(){ $(this).attr("class", old_class); }); }); }); function show_confirm_apps(){ ainsids = new Array(); updated = new Object(); // Build the list of Installations to update var field = document.getElementsByName(\'ainsids[]\'); ainsids = new Array(); var c = 0; for(i = 0; i < field.length; i++){ if(field[i].checked == true){ ainsids[c] = field[i].value; c++; } } if(c == 0){ alert("' . $l['no_sel_inst'] . '"); return false; } var r = confirm("' . $l['del_insid'] . '"); if(r != true){ return false; } update_by_id_apps(ainsids[0], "", 0); } function update_by_id_apps(ainsid, re, oldainsid){ updated[ainsid] = false; if(re.length > 0 && oldainsid > 0){ var result = re.substring(0,1); var msg = re.substring(1); if(result == "0"){ alert(msg); updated[ainsid] = false; $_("rem_div_apps").innerHTML = ""; return false; } if(result == "1"){ updated[ainsid] = true; } } nextainsid = 0; // Find the next INSTALLATION to update for(i = 0; i < ainsids.length; i++){ if(typeof(updated[ainsids[i]]) != "undefined"){ continue; } nextainsid = ainsids[i]; break; } // If there is something left to be updated if(ainsid != 0){ try{ AJAX(window.location+"&app="+ainsid+"&update=1&ajax=1&random="+Math.random(), "update_by_id_apps(\'"+nextainsid+"\', re, \'"+ainsid+"\')"); $_("rem_div_apps").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['rem_inst_id'] . ' ID: " +ainsid+ "<br /></p>"; return true; }catch(e){ alert(e.description); return false; } } alert("' . $l['inst_remvd'] . '"); location.reload(true); return true; } binsids = new Array(); backuped = new Object(); function show_confirm_backup(){ binsids = new Array(); backuped = new Object(); // Build the list of Installations to update var field = document.getElementsByName(\'binsids[]\'); binsids = new Array(); var c = 0; for(i = 0; i < field.length; i++){ if(field[i].checked == true){ binsids[c] = field[i].value; c++; } } if(c == 0){ alert("' . $l['no_sel_backup'] . '"); return false; } var r = confirm("' . $l['del_backup'] . '"); if(r != true){ return false; } backup_remove_by_id_apps(binsids[0], "", 0); } function backup_remove_by_id_apps(binsid, re, oldbinsid){ backuped[binsid] = false; if(re.length > 0 && oldbinsid > 0){ var result = re.substring(0,1); var msg = re.substring(1); if(result == "0"){ alert(msg); backuped[binsid] = false; $_("rem_div_back").innerHTML = ""; return false; } if(result == "1"){ backuped[binsid] = true; } } nextbinsid = 0; // Find the next Backup to remove for(i = 0; i < binsids.length; i++){ if(typeof(backuped[binsids[i]]) != "undefined"){ continue; } nextbinsid = binsids[i]; break; } // If there is something left to be backuped if(binsid != 0){ try{ AJAX(window.location+"&backup_file="+binsid+"&backup_remove=1&ajax_remove=1&random="+Math.random(), "backup_remove_by_id_apps(\'"+nextbinsid+"\', re, \'"+binsid+"\')"); $_("rem_div_back").innerHTML = "<br /><br /><p align=\\"center\\"><img src=\\"' . $theme['images'] . 'ajax_remove.gif\\"> <br />' . $l['removing'] . ' ID: " +binsid+ "<br /></p>"; return true; }catch(e){ alert(e.description); return false; } } alert("' . $l['back_remvd'] . '"); location.reload(true); return true; } // ]]></script>'; // For APPS INSTALLATION LIST ksort($user['apps_update']); echo '<link rel="stylesheet" type="text/css" href="https://images.softaculous.com/webuzo/sprites/20.css" /> <br /><br /><center> <span class="sai_newhead">' . $l['apps_ins'] . '</span> </center><br />'; if (count($user['apps_update']) > 0) { echo '<div class="sai_notice">' . $l['note'] . '</div>'; $show_head = '<table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr> <td width="50%"><b>' . $l['path'] . '</b></td> <td width="20%"><b>' . $l['ins_time'] . '</b></td> <td width="10%"><b>' . $l['install_version'] . '</b></td> <td width="10%"><b>' . $l['latest_version'] . '</b></td> <td width="10%"><b>' . $l['options'] . '</b></td> </tr> </table> '; foreach ($user['apps_update'] as $ik => $iv) { if ($iv['type'] == 'library') { continue; } // check for update $n_info[$ik] = $softpanel->appinfo($ik); $app_update .= '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="sai_altrowstable"> <tr> <th colspan="5"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="no"> <td class="sp20_' . $apps[$ik]['softname'] . '" style="border:none"></td> <td style="border:none"> ' . $apps[$ik]['name'] . '</td> </tr> </table> </th> </tr> <tr class="sai_evenrowcolor"> <td width="50%" align="left">' . (empty($iv['path']['base']) ? $l['default_apps_base'] : $iv['path']['base']) . '</td> <td width="20%">' . datify($iv['itime']) . '</td> <td width="10%">' . $iv['version'] . '</td> <td width="10%">' . $n_info[$iv['aid']]['version'] . '</td> <td width="10%"><input type="checkbox" name="ainsids[]" value="' . $ik . '"></td> </tr> </table><br />'; } if (!empty($app_update)) { echo '<center> <span class="sai_newhead">' . $l['application'] . '</span> </center><br /> '; echo $show_head; $set_head = 1; echo $app_update; } foreach ($user['apps_update'] as $ik => $iv) { if ($iv['type'] != 'library') { continue; } // check for update $n_info[$ik] = $softpanel->appinfo($ik); $lib_update .= '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="sai_altrowstable"> <tr> <th colspan="5"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="no"> <td class="sp20_' . $apps[$ik]['softname'] . '" style="border:none"></td> <td style="border:none"> ' . $apps[$ik]['name'] . '</td> </tr> </table> </th> </tr> <tr class="sai_evenrowcolor"> <td width="50%" align="left">' . (empty($iv['path']['base']) ? $l['default_apps_base'] : $iv['path']['base']) . '</td> <td width="20%">' . datify($iv['itime']) . '</td> <td width="10%">' . $iv['version'] . '</td> <td width="10%">' . $n_info[$iv['aid']]['version'] . '</td> <td width="10%"><input type="checkbox" name="ainsids[]" value="' . $ik . '"></td> </tr> </table><br />'; } if (!empty($lib_update)) { echo '<center> <span class="sai_newhead">' . $l['library'] . '</span> </center><br /> '; if (empty($set_head)) { echo $show_head; } echo $lib_update; } echo '<div id="rem_div_apps"></div> <p align="center"> <input class="sai_graybluebut" type="button" value="' . $l['update_apps'] . '" onclick="show_confirm_apps()"> </p>'; } else { echo '<center class="sai_notice">' . $l['no_ins'] . '</center>'; } echo '<br /><center> <span class="sai_newhead">' . $l['apps_backup'] . '</span> </center><br />'; //r_print($user); if (count($user['apps_backup']) > 0) { echo '<table border="0" cellpadding="5" cellspacing="0" width="100%" class="sai_altrowstable"> <tr> <th colspan="2"> <table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr> <td width="70%" style="border:none"><b>' . $l['path'] . '</b></td> <td width="30%" style="border:none"><b>' . $l['options'] . '</b></td> </tr> </table> </th> </tr>'; $i = 1; foreach ($user['apps_backup'] as $ik => $iv) { echo '<tr class="' . ($i % 2 == 0 ? "sai_evenrowcolor" : "sai_oddrowcolor") . '" > <td width="70%" align="left">' . $iv['name'] . '</td> <td width="30%"><input type="checkbox" name="binsids[]" value="' . $iv['name'] . '"></td> </tr>'; $i++; } echo '</table><br /> <div id="rem_div_back"></div> <p align="center"> <input class="sai_graybluebut" type="button" value="' . $l['remove'] . '" onclick="show_confirm_backup()"> </p>'; } else { echo '<center class="sai_notice">' . $l['no_backup'] . '</center>'; } softfooter(); }
function installations_theme() { global $theme, $globals, $user, $l, $langs, $skins, $error, $list, $scripts, $_scriptwise, $emailed, $iscripts, $autoupgrade, $ins_to_be_upgrade, $records_updated, $real_version, $_domainwise; if (optGET('api')) { _api($list, optGET('api')); return; } softheader($l['<title>']); echo '<div class="sai_heading" align="center">' . $l['searchinstallations'] . '</div> <img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" /><br /><br /><br />'; error_handle($error); //The necessary JavaScripts echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[ var ids = []; function show_image(){ goto_top(); $("#prog_img").fadeIn(500); $("#list_ins").hide(); $("#autoupgrade_process").css("display",""); $("#prog_img").show(); $("#list_ins").find( "input[type=checkbox][checked]" ).each( function(){ ids.push(this.value); }); //alert(aArray);return; updatedids = new Object(); for(x in ids){ if(ids[x] != "on"){ //alert(ids[x]); updatedids[ids[x]] = false; } } $("#upgrade_ins_div1").css("display","none"); $("#upgrade_ins_div2").css("display","none"); autoupgradeins(0, \'\'); return false; }; function autoupgradeins(id, resp){ //alert(resp); //alert(id); //Update the Status with Response if(id != 0){ $("<div>"+resp+"</div>").appendTo("#autoupgrade_process"); updatedids[id] = true; } for(x in ids){ //alert(ids[x]); if(updatedids[ids[x]] == false){ var tmp_id = ids[x].split("-"); AJAX("' . $globals['index'] . 'act=installations&show=upgrade&sact=autoupgradeins&user="******"&insid="+tmp_id[1], "autoupgradeins(\'"+ids[x]+"\', re)"); return true; } } $("#prog_img").fadeOut(50); $("#succ_upgrad_msg").fadeIn(100); $("#goto_list_link").fadeIn(100); }; // ]]></script>'; echo '<script language="JavaScript" src="' . $theme['url'] . '/js/osuggest.js" type="text/javascript"></script> <div style="width:710px; margin:0px auto;"> <form accept-charset="' . $globals['charset'] . '" name="serchinstallations" method="post" action=""> <table width="100%" cellpadding="5" cellspacing="1" border="0" class="sai_reviewform" style="margin:0px auto; padding:"20px;"> <tr> <td><br /> <span class="sai_head">' . $l['search_scripts'] . '</span><br /> <span class="sai_exp2">' . $l['search_scripts_exp'] . '</span> </td> <td><br /> <input type="text" name="scripts" id="scripts" size="30" value="' . POSTval('scripts') . '" onkeyup="handlesuggest(event, \'scripts\')" onkeydown="handlekeys(event)" autocomplete=off onblur="setTimeout(hidesuggest, 1000);" suggesturl="' . $globals['ind'] . 'act=suggest&sact=scripts" /> </td> <td width="250"> <span class="sai_head">' . $l['group_by_scripts'] . '</span><br /> <span class="sai_exp2">' . $l['group_by_scripts_exp'] . '</span> </td> <td width="50"> <input type="checkbox" name="group_by_scripts" ' . POSTchecked('group_by_scripts') . ' /> </td> </tr> <tr>'; if (!webuzo()) { echo ' <td> <span class="sai_head">' . $l['search_users'] . '</span><br /> <span class="sai_exp2">' . $l['search_users_exp'] . '</span> </td> <td> <input type="text" name="users" id="users" size="30" value="' . POSTval('users') . '" onkeyup="handlesuggest(event, \'users\')" onkeydown="handlekeys(event)" autocomplete=off onblur="setTimeout(hidesuggest, 1000);" suggesturl="' . $globals['ind'] . 'act=suggest&sact=users" /> </td>'; } else { echo '<td colspan="2"> </td>'; } echo '<td width="250"> <span class="sai_head">' . $l['only_outdated'] . '</span><br /> <span class="sai_exp2">' . $l['only_outdated_exp'] . '</span> </td> <td width="50"> <input type="checkbox" name="only_outdated" ' . POSTchecked('only_outdated') . ' /> </td> </tr> <tr> <td> <span class="sai_head">' . $l['search_domains'] . '</span><br /> <span class="sai_exp2">' . $l['search_domains_exp'] . '</span> </td> <td> <input type="text" name="domains" id="domains" size="30" value="' . POSTval('domains') . '" /> </td> <td> <span class="sai_head">' . $l['only_realversion'] . '</span><br /> <span class="sai_exp2">' . $l['only_realversion_exp'] . '</span> </td> <td width="50"> <input type="checkbox" name="only_realversion" ' . POSTchecked('only_realversion') . ' /> </td> </tr> <tr> <td colspan="4"> <p align="center"><input type="submit" name="listinstallations" value="' . $l['search_ins'] . '" class="sai_graybluebut" /></p> </td> </tr> </table> <br /><br /> </form> </div>'; if (isset($_REQUEST['listinstallations'])) { $upgrade_ins_button = '<table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td width="80%"> <p align="right" class="bboxtxt">' . $l['with_selected'] . ' </td> <td>: </td> <td valign="middle"><input type="submit" name="upgrade_ins" id="upgrade_ins" value="' . $l['sub_upgrade_ins'] . '" class="sai_graybluebut" onclick="return show_image();" /></td> </tr> </table>'; // In case there is any error than just dont show the button if (!empty($error)) { $upgrade_ins_button = ''; } $email_button = '<p align="right" class="bboxtxt"><table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td width="60%" align="right" valign="middle">' . $l['with_selected'] . ' : </td>'; if (!empty($real_version)) { $email_button .= '<td valign="middle"><br /><input type="submit" name="update_records" id="update_records" value="' . $l['update_records'] . '" class="sai_graybluebut"/></td></tr></table></p>'; } else { $email_button .= '<td valign="middle"><br /><input type="submit" name="send_email" id="send_email" value="' . $l['sub_email_users'] . '" class="sai_graybluebut"/></td></tr></table></p>'; } if (!empty($records_updated)) { echo '<br /><div class="sai_success"><img src="' . $theme['images'] . 'success.gif" /> ' . $l['succ_update_record'] . '</div><br />'; } if (empty($list)) { echo '<h2 align="center">' . $l['no_results'] . '</h2>'; } else { if (!empty($emailed)) { echo '<br /><div class="sai_success"><img src="' . $theme['images'] . 'success.gif" /> ' . $l['emailed_users'] . '</div><br />'; } echo '<br /><div class="sai_notice" id="succ_upgrad_msg" style="display:none">' . $l['upgraded_ins'] . '</div><br />'; echo '<div style="width:710px; margin:0px auto;"> <form accept-charset="' . $globals['charset'] . '" name="email_users" method="post" action="" id="email_users"> <link href="' . $globals['mirror_images'] . 'sprites/20.css" rel="stylesheet" type="text/css" /> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td width="50%"> <div style="display:none;float:left" id="prog_img"><img src="' . $theme['images'] . 'admin_progress.gif" /> ' . $l['upgrading_ins'] . '</div> </td> </tr> <tr> <td align="right">'; if (!isset($_REQUEST['upgrade_installation']) || !empty($real_version)) { echo $email_button; } else { // We are ending the table because we are not ending this in the variable. echo '<div id="upgrade_ins_div1">' . $upgrade_ins_button . '</div>'; } echo '</td></tr> </table><br /><br />'; if (!empty($real_version)) { echo '<div class="notebox" style="width:95%;" id="beta_notice1"> <table width="100%" cellpadding="5" cellspacing="1" border="0"> <tr> <td width="25px"> <div class="lirealver" style="height:16px;width:16px"></div> </td> <td><font class="bboxtxt">' . $l['real_ver_notice'] . '</font></td> </tr> <tr> <td width="25px"> <div class="lioutdated" style="height:16px;width:16px"></div> </td> <td><font class="bboxtxt">' . $l['latest_ver_notice'] . '</font></td> </tr> </table> </div>'; } echo '<div class="sai_divroundshad" id="list_ins" style="display:block"> <table width="100%" cellpadding="5" cellspacing="1" border="0"> <tr> <td class="lihead" width="100">' . (empty($_scriptwise) ? empty($_domainwise) ? $l['li_user'] : $l['li_domains'] : $l['li_scripts']) . '</td> <td class="lihead">' . (empty($_scriptwise) ? $l['li_scripts'] : $l['li_user']) . '</td>' . (!empty($_domainwise) ? '<td class="lihead" width="5%">' . $l['li_user'] . '</td>' : '') . ' <td class="lihead">' . $l['li_url'] . '</td> <td class="lihead" width="15%">' . $l['li_insver'] . '</td>' . (!empty($real_version) ? '<td class="lihead" width="15%">' . $l['li_realver'] . '</td>' : '') . '<td class="lihead" width="2%">' . $l['li_ver'] . '</td> <td class="lihead"><img src="' . $theme['images'] . 'auto_upgrade.png" title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/> <td class="lihead"><input type="checkbox" onclick="check(document.getElementsByName(\'list[]\'), this);" ' . (!empty($error) ? 'disabled=true' : '') . '/></td> </tr>'; $class = ''; foreach ($list as $lk => $lv) { $i = 1; $class = $class == 'lione' ? 'litwo' : 'lione'; foreach ($lv as $llk => $llv) { foreach ($llv as $ik => $iv) { $_class = $class; echo '<tr> <td class="' . ($i == 1 ? $class : '') . '">'; $isCustom = is_customscript($iv['sid']) ? 1 : 0; if ($i == 1) { echo '<font class="bboxtxt">' . (empty($_scriptwise) ? $lk : (!empty($scripts[$iv['sid']]) && !empty($iscripts[$iv['sid']]) ? $scripts[$iv['sid']]['name'] : (!empty($isCustom) ? $iscripts[$iv['sid']]['name'] : $l['no_info']))) . '</font>'; } else { echo ' '; } if (!empty($isCustom)) { if ($iscripts[$iv['sid']]['ver'] != $iv['ver']) { $_class = 'lioutdated'; } } else { if ($iscripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $iscripts[$iv['sid']]['softname'] . '/upgrade.xml')) { $_class = 'lioutdated'; } } $real_class = 'lirealver'; $__user = empty($_scriptwise) ? $lk : $llk; if (!empty($_domainwise)) { $__user = $iv['user']; } echo '</td> <td class="' . $class . '">' . (empty($_scriptwise) ? !empty($scripts[$iv['sid']]) && !empty($iscripts[$iv['sid']]) ? $scripts[$iv['sid']]['name'] : (!empty($isCustom) ? $iscripts[$iv['sid']]['name'] : $l['no_info']) : $llk) . '</td>' . (!empty($_domainwise) ? '<td class="' . $class . '">' . $__user . '</td>' : '') . ' <td class="' . $class . '"><a href="' . $iv['softurl'] . '" target="_blank">' . $iv['softurl'] . '</a></td> <td class="' . $class . '">' . $iv['ver'] . '</td>' . (!empty($iv['real_ver']) && !empty($real_version) ? '<td class="' . $real_class . '">' . $iv['real_ver'] . '</td>' : '') . '<td class="' . $_class . '">' . (empty($isCustom) ? $scripts[$iv['sid']]['ver'] : $iscripts[$iv['sid']]['ver']) . '</td> <td class="' . $class . '" align="center">' . (!empty($iv['eu_auto_upgrade']) ? '<img src="' . $theme['images'] . 'success.gif" hight="20px" width="20px" title="' . $l['auto_upgrade_enabled'] . '" style="cursor:pointer"/>' : '') . ' <td class="' . $class . '">' . (empty($isCustom) ? $scripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $scripts[$iv['sid']]['softname'] . '/upgrade.xml') : $iscripts[$iv['sid']]['ver'] != $iv['ver'] && file_exists($globals['softscripts'] . '/' . $iscripts[$iv['sid']]['softname'] . '/upgrade.xml') ? '<input type="checkbox" name="list[]" value="' . $__user . '-' . $ik . '" ' . (!empty($error) ? 'disabled=true' : '') . '/>' : '') . '</td> </tr>'; $i++; } } } echo ' </table> </div> <div id="autoupgrade_process" style="display:none"></div> <div id="goto_list_link" style="display:none" class="sai_heading"><center>' . $l['upgrading_completed'] . ' <a href="' . $globals['ind'] . 'act=installations&show=upgrade' . '">' . $l['go_to_autoupgrade'] . '</a><center></div> <br /><br /> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td width="50%"> </td> </tr> <tr> <td align="right">'; if (!isset($_REQUEST['upgrade_installation']) || !empty($real_version)) { echo $email_button; } else { echo '<div id="upgrade_ins_div2">' . $upgrade_ins_button . '</div>'; } echo '</td> </tr> </table>'; if (!empty($real_version)) { echo '<div class="notebox" style="width:95%;" id="beta_notice1"> <table width="100%" cellpadding="5" cellspacing="1" border="0"> <tr> <td width="25px"> <div class="lirealver" style="height:16px;width:16px"></div> </td> <td><font class="bboxtxt">' . $l['real_ver_notice'] . '</font></td> </tr> <tr> <td width="25px"> <div class="lioutdated" style="height:16px;width:16px"></div> </td> <td><font class="bboxtxt">' . $l['latest_ver_notice'] . '</font></td> </tr> </table> </div>'; } echo '</form>'; } } softfooter(); }