public function doConfigPageInit($page)
 {
     $request = $_REQUEST;
     $error_displays = array();
     $action = isset($request['action']) ? $request['action'] : '';
     $post_codec = isset($request['codec']) ? $request['codec'] : array();
     $post_vcodec = isset($request['vcodec']) ? $request['vcodec'] : array();
     $iax_settings['codecpriority'] = isset($request['codecpriority']) ? $request['codecpriority'] : 'host';
     $iax_settings['bandwidth'] = isset($request['bandwidth']) ? $request['bandwidth'] : 'unset';
     $iax_settings['videosupport'] = isset($request['videosupport']) ? $request['videosupport'] : 'no';
     $iax_settings['maxregexpire'] = isset($request['maxregexpire']) ? htmlspecialchars($request['maxregexpire']) : '3600';
     $iax_settings['minregexpire'] = isset($request['minregexpire']) ? htmlspecialchars($request['minregexpire']) : '60';
     $iax_settings['jitterbuffer'] = isset($request['jitterbuffer']) ? $request['jitterbuffer'] : 'no';
     $iax_settings['forcejitterbuffer'] = isset($request['forcejitterbuffer']) ? $request['forcejitterbuffer'] : 'no';
     $iax_settings['maxjitterbuffer'] = isset($request['maxjitterbuffer']) ? htmlspecialchars($request['maxjitterbuffer']) : '200';
     $iax_settings['resyncthreshold'] = isset($request['resyncthreshold']) ? htmlspecialchars($request['resyncthreshold']) : '1000';
     $iax_settings['maxjitterinterps'] = isset($request['maxjitterinterps']) ? htmlspecialchars($request['maxjitterinterps']) : '10';
     $iax_settings['bindaddr'] = isset($request['bindaddr']) ? htmlspecialchars($request['bindaddr']) : '';
     $iax_settings['bindport'] = isset($request['bindport']) ? htmlspecialchars($request['bindport']) : '';
     $iax_settings['delayreject'] = isset($request['delayreject']) ? htmlspecialchars($request['delayreject']) : 'yes';
     $codecs = array('ulaw' => '', 'alaw' => '', 'slin' => '', 'g726' => '', 'gsm' => '', 'g729' => '', 'ilbc' => '', 'g723' => '', 'g726aal2' => '', 'adpcm' => '', 'lpc10' => '', 'speex' => '', 'g722' => '', 'siren7' => '', 'siren14' => '');
     // With the new sorting, the vars should come to us in the sorted order so just use that
     //
     $pri = 1;
     foreach (array_keys($post_codec) as $codec) {
         $codecs[$codec] = $pri++;
     }
     $iax_settings['codecs'] = $codecs;
     $video_codecs = array('h261' => '', 'h263' => '', 'h263p' => '', 'h264' => '');
     $pri = 1;
     foreach (array_keys($post_vcodec) as $vcodec) {
         $video_codecs[$vcodec] = $pri++;
     }
     $iax_settings['video_codecs'] = $video_codecs;
     $p_idx = $n_idx = 0;
     while (isset($request["iax_custom_key_{$p_idx}"])) {
         if ($request["iax_custom_key_{$p_idx}"] != '') {
             $iax_settings["iax_custom_key_{$n_idx}"] = htmlspecialchars($request["iax_custom_key_{$p_idx}"]);
             $iax_settings["iax_custom_val_{$n_idx}"] = htmlspecialchars($request["iax_custom_val_{$p_idx}"]);
             $n_idx++;
         }
         $p_idx++;
     }
     switch ($action) {
         case "edit":
             //just delete and re-add
             if (($errors = iaxsettings_edit($iax_settings)) !== true) {
                 $error_displays = process_errors($errors);
             } else {
                 needreload();
                 //redirect_standard();
             }
             break;
         default:
             /* only get them if first time load, if they pressed submit, use values from POST */
             $iax_settings = iaxsettings_get();
     }
     $error_displays = array_merge($error_displays, iaxsettings_check_custom_files());
 }
Example #2
0
$sip_settings['srvlookup'] = isset($_POST['srvlookup']) ? $_POST['srvlookup'] : 'no';
$p_idx = 0;
$n_idx = 0;
while (isset($_POST["sip_custom_key_{$p_idx}"])) {
    if ($_POST["sip_custom_key_{$p_idx}"] != '') {
        $sip_settings["sip_custom_key_{$n_idx}"] = htmlspecialchars($_POST["sip_custom_key_{$p_idx}"]);
        $sip_settings["sip_custom_val_{$n_idx}"] = htmlspecialchars($_POST["sip_custom_val_{$p_idx}"]);
        $n_idx++;
    }
    $p_idx++;
}
switch ($action) {
    case "edit":
        //just delete and re-add
        if (($errors = sipsettings_edit($sip_settings)) !== true) {
            $error_displays = process_errors($errors);
        } else {
            needreload();
            //redirect_standard();
        }
        break;
    default:
        /* only get them if first time load, if they pressed submit, use values from POST */
        $sip_settings = sipsettings_get();
}
$error_displays = array_merge($error_displays, sipsettings_check_custom_files());
?>

</div>
<div class="content">
  <h2><?php 
Example #3
0
} else {
    process_errors('WordPress siteurl not found.', true);
}
$siteurl = $db_data[0][0];
$https_siteurl = preg_replace("/^http:/i", "https:", $siteurl);
if (($pos = strpos($siteurl, 'wp.easypress.ca')) != false) {
    $dev_mode = 'yes';
} else {
    $dev_mode = 'no';
}
$user_table = $table_prefix . 'users';
$get_user_query = "SELECT user_login, user_email FROM {$user_table} WHERE ID=1";
if ($db_user_results = $dbh->query($get_user_query)) {
    $user_data = $db_user_results->fetch_all();
} else {
    process_errors('WordPress user with ID 1 does not exist.', true);
}
error_log(var_export($user_data, true));
$wp_user = $user_data[0][0];
$wp_user_email = $user_data[0][1];
header('Content-Type: application/json');
echo json_encode(array('siteurl' => $siteurl, 'dev_mode' => $dev_mode, 'wp_user' => $wp_user, 'wp_user_email' => $wp_user_email, 'mysql_admin_url' => $https_siteurl . '/adminer/?db=' . DB_NAME, 'mysql_admin_user' => DB_USER, 'sftp_user' => DB_USER, 'sftp_host' => $_SERVER['SERVER_ADDR'], 'sftp_port' => '22'));
$dbh->close();
/**
 * Process errors
 *
 * @param string $message is the error message to write to the log and/or screen.
 * @param boolean $exit_now will determine whether or not to terminate the process.
 * 
 */
function process_errors($message, $exit_now = false)
Example #4
0
                $month_visits += $stats[2];
                $month_uniques += $stats[3];
                $month_bytes += $stats[4];
            }
        }
        $st['monthly'][$this_month] = array('hits' => $month_hits, 'visits' => $month_visits, 'bytes' => $month_bytes);
        $st['total_bytes'] = $total_bytes;
        $st['busiest_day'] = array('date' => $busiest_day[0], 'hits' => $busiest_day[1], 'visits' => $busiest_day[2], 'bytes' => $busiest_day[4]);
        foreach ($daily_stats as $ds) {
            $st['recent'][$ds[0]] = array('hits' => $ds[1], 'visits' => $ds[2], 'bytes' => $ds[4]);
        }
    } else {
        echo "No stats yet.";
    }
} else {
    process_errors('Results for query not found', true);
}
$dbh->close();
echo json_encode($st);
/**
 * Process errors
 *
 * @param string $message is the error message to write to the log and/or screen.
 * @param boolean $exit_now will determine whether or not to terminate the process.
 * 
 */
function process_errors($message, $exit_now = false)
{
    global $all_errors;
    $all_errors[] = $message;
    error_log($message);
<?php

$domain = $_GET['domain'];
$nginx_config = "/etc/nginx/sites-enabled/{$domain}";
if (!file_exists($nginx_config)) {
    header('Content-Type: application/json');
    echo json_encode(array('error' => "{$domain} does not exist on this node"));
    process_errors('WordPress siteurl not found.', true);
}
header('Content-Type: application/json');
echo json_encode(array('siteurl' => $siteurl, 'dev_mode' => $dev_mode, 'wp_user' => $wp_user, 'wp_user_email' => $wp_user_email, 'mysql_admin_url' => $https_siteurl . '/adminer/?db=' . DB_NAME, 'mysql_admin_user' => DB_USER, 'sftp_user' => DB_USER, 'sftp_host' => $_SERVER['SERVER_ADDR'], 'sftp_port' => '22'));
/**
 * Process errors
 *
 * @param string $message is the error message to write to the log and/or screen.
 * @param boolean $exit_now will determine whether or not to terminate the process.
 * 
 */
function process_errors($message, $exit_now = false)
{
    global $all_errors;
    $all_errors[] = $message;
    error_log($message);
    if ($exit_now) {
        var_dump($all_errors);
        error_log(var_export($all_errors, true));
        exit;
    }
}
/**
 * Write to a file
 *
 * @param string $the_file is the absolute path to the file to create.
 * @param string $the_text is the content being written to the file.
 *
 */
function write_to_file($the_file, $the_text, $domain)
{
    $fh = fopen($the_file, 'wb') or process_errors("Failed to open {$the_file} for: " . $domain, true);
    fwrite($fh, $the_text) or process_errors("Failed to write to {$the_file} for: " . $domain, true);
    fclose($fh) or process_errors("Failed to close {$the_file} for: " . $domain, true);
}