function check_firmware_version() { global $g; $post = "platform=" . rawurlencode($g['fullplatform']) . "&version=" . rawurlencode(get_product_version()); $rfd = @fsockopen("www." . get_product_url(), 80, $errno, $errstr, 3); if ($rfd) { $hdr = "POST /checkversion.php HTTP/1.0\r\n"; $hdr .= "Content-Type: application/x-www-form-urlencoded\r\n"; $hdr .= "User-Agent: " . get_product_name() . "-webGUI/1.0\r\n"; $hdr .= "Host: " . get_product_url() . "\r\n"; $hdr .= "Content-Length: " . strlen($post) . "\r\n\r\n"; fwrite($rfd, $hdr); fwrite($rfd, $post); $inhdr = true; $resp = ""; while (!feof($rfd)) { $line = fgets($rfd); if ($inhdr) { if (trim($line) === "") { $inhdr = false; } } else { $resp .= $line; } } fclose($rfd); return $resp; } return null; }
function say_hello() { output_api_header(); echo "<response>\n"; echo " <status>0</status>\n"; echo " <message>OK</message>\n"; echo " <product>" . get_product_name() . "</product>\n"; echo " <version>" . get_product_version() . "</version>\n"; echo "</response>\n"; exit; }
$hr = ""; //Set horizontal line $bs = ""; //Set bold start $be = ""; //Set bold end $cs = "Error or code:"; //Set code end $ce = ""; //Set code end // Get system and hardware informations $cpuinfo = system_get_cpu_info(); $meminfo = system_get_ram_info(); $hwinfo = trim(exec("/sbin/sysctl -a | /usr/bin/awk -F:\\ '/controller|interface/ &&! /AT|VGA|Key|inet|floppy/{!u[\$2]++}END{for(i in u) a=a OFS i;print a}'")); mwexec2("sysctl -n dev.acpi.0.%desc", $mbinfo); $sys_summary = sprintf("%s %s (revision %s) %s; %s %s %sMiB RAM", get_product_name(), get_product_version(), get_product_revision(), get_platform_type(), $mbinfo[0], $cpuinfo['model'], round($meminfo['real'] / 1024 / 1024)); ?> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?> " method="post" enctype="multipart/form-data" name="iform"> <table> <tr> <td class="label" align="right"><?php echo gettext("Info"); ?> </td> <td class="text" align="left"><?php echo $sys_summary; ?> </td>
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require "auth.inc"; require "guiconfig.inc"; require_once "XML/Serializer.php"; require_once "XML/Unserializer.php"; $pgtitle = array(gettext("Network"), gettext("Firewall")); $pconfig['enable'] = isset($config['system']['firewall']['enable']); if ($_POST['export']) { $options = array(XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_INDENT => "\t", XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_XML_ENCODING => "UTF-8", XML_SERIALIZER_OPTION_ROOT_NAME => get_product_name(), XML_SERIALIZER_OPTION_ROOT_ATTRIBS => array("version" => get_product_version(), "revision" => get_product_revision()), XML_SERIALIZER_OPTION_DEFAULT_TAG => "rule", XML_SERIALIZER_OPTION_MODE => XML_SERIALIZER_MODE_DEFAULT, XML_SERIALIZER_OPTION_IGNORE_FALSE => true, XML_SERIALIZER_OPTION_CONDENSE_BOOLS => true); $serializer =& new XML_Serializer($options); $status = $serializer->serialize($config['system']['firewall']['rule']); if (PEAR::isError($status)) { $errormsg = $status->getMessage(); } else { $ts = date("YmdHis"); $fn = "firewall-{$config['system']['hostname']}.{$config['system']['domain']}-{$ts}.rules"; $data = $serializer->getSerializedData(); $fs = strlen($data); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename={$fn}"); header("Content-Length: {$fs}"); header("Pragma: hack"); echo $data; exit;
function get_latest_file($rss) { global $g; $product = get_product_name(); $platform = $g['fullplatform']; $version = get_product_version(); $revision = get_product_revision(); if (preg_match("/^(.*?)(\\d+)\$/", $revision, $m)) { $revision = $m[2]; } $ext = "img"; $resp = ""; $xml = @simplexml_load_file($rss); if (empty($xml)) { return $resp; } foreach ($xml->channel->item as $item) { $link = $item->link; $title = $item->title; $date = $item->pubDate; $parts = pathinfo($title); if (empty($parts['extension']) || strcasecmp($parts['extension'], $ext) != 0) { continue; } $filename = $parts['filename']; $fullname = $parts['filename'] . "." . $parts['extension']; if (preg_match("/^{$product}-{$platform}-(.*?)-(.*?)-r(\\d+)\$/", $filename, $m)) { $filever = $m[1]; $filerev = $m[3]; if ($version < $filever || $version == $filever && $revision < $filerev) { $resp .= sprintf("<a href=\"%s\" title=\"%s\" target=\"_blank\">%s</a> (%s)", htmlspecialchars($link), htmlspecialchars($title), htmlspecialchars($fullname), htmlspecialchars($date)); } else { $resp .= sprintf("%s (%s)", htmlspecialchars($fullname), htmlspecialchars($date)); } break; } } return $resp; }
html_titleline(gettext("System information")); ?> <?php if (!empty($config['vinterfaces']['carp'])) { ?> <?php html_textinfo("vipstatus", gettext("Virtual IP address"), htmlspecialchars(get_vip_status())); ?> <?php } ?> <?php html_textinfo("hostname", gettext("Hostname"), system_get_hostname()); ?> <?php html_textinfo("version", gettext("Version"), sprintf("<strong>%s %s</strong> (%s %s)", get_product_version(), get_product_versionname(), gettext("revision"), get_product_revision())); ?> <?php html_textinfo("builddate", gettext("Build date"), get_product_buildtime()); ?> <?php exec("/sbin/sysctl -n kern.osrevision", $osrevision); exec("/sbin/sysctl -n kern.version", $osversion); ?> <?php html_textinfo("platform_os", gettext("Platform OS"), sprintf("FreeBSD Revision: %s<br/>%s", $osrevision[0], $osversion[0])); ?> <?php html_textinfo("platform", gettext("Platform"), sprintf(gettext("%s on %s"), $g['fullplatform'], $cpuinfo['model'])); ?> <?php
function get_latest_file($rss) { global $g; $product = get_product_name(); $platform = $g['fullplatform']; $version = get_product_version(); $revision = get_product_revision(); if (preg_match("/^(.*?)(\\d+)\$/", $revision, $m)) { $revision = $m[2]; } $ext = "img"; $ext2 = "xz"; $resp = ""; $xml = @simplexml_load_file($rss); if (empty($xml)) { return $resp; } if (empty($xml->channel)) { return $resp; } foreach ($xml->channel->item as $item) { $link = $item->link; $title = $item->title; $pubdate = $item->pubDate; $parts = pathinfo($title); // convert to local time $date = preg_replace('/UT$/', 'GMT', $pubdate); $time = strtotime($date); if ($time === FALSE) { // convert error $date = $pubdate; } else { $date = date("D, d M Y H:i:s T", $time); } if (empty($parts['extension'])) { continue; } if (strcasecmp($parts['extension'], $ext) != 0 && strcasecmp($parts['extension'], $ext2) != 0) { continue; } $filename = $parts['filename']; $fullname = $parts['filename'] . "." . $parts['extension']; if (preg_match("/^{$product}-{$platform}-(.*?)\\.(\\d+)(\\.img)?\$/", $filename, $m)) { $filever = $m[1]; $filerev = $m[2]; if ($version < $filever || $version == $filever && $revision < $filerev) { $resp .= sprintf("<a href=\"%s\" title=\"%s\" target=\"_blank\">%s</a> (%s)", htmlspecialchars($link), htmlspecialchars($title), htmlspecialchars($fullname), htmlspecialchars($date)); } else { $resp .= sprintf("%s (%s)", htmlspecialchars($fullname), htmlspecialchars($date)); } break; } } return $resp; }
if (is_file("/usr/local/www/bar_left.gif")) { $image_path = ''; } else { $image_path = 'images/'; } require "auth.inc"; require "guiconfig.inc"; if (!isset($config['onebuttoninstaller']['enable'])) { header("Location:onebuttoninstaller-config.php"); } bindtextdomain("nas4free", "/usr/local/share/locale-obi"); $pgtitle = array(gettext("Extensions"), gettext("OneButtonInstaller") . " " . $config['onebuttoninstaller']['version']); $log = 0; $loginfo = array(array("visible" => TRUE, "desc" => gettext("Extensions"), "logfile" => "{$config['onebuttoninstaller']['rootfolder']}extensions.txt", "filename" => "extensions.txt", "type" => "plain", "pattern" => "/^(.*)###(.*)###(.*)###(.*)###(.*)###(.*)###(.*)\$/", "columns" => array(array("title" => gettext("Extension"), "class" => "listlr", "param" => "align=\"left\" valign=\"middle\" style=\"font-weight:bold\" nowrap", "pmid" => 0), array("title" => gettext("Version"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 1), array("title" => gettext("Description"), "class" => "listr", "param" => "align=\"left\" valign=\"middle\"", "pmid" => 5), array("title" => gettext("Install"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 4)))); // create FreeBSD $current_release for min_release check $product_version = explode(".", get_product_version()); $current_release = $product_version[0] . "." . $product_version[1] . $product_version[2] . $product_version[3] . get_product_revision(); function check_min_release($min_release) { global $current_release; if (is_float(floatval($min_release))) { if ($current_release < floatval($min_release)) { return false; } else { return true; } // release supported } else { return true; } // not a float, no release
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the NAS4Free Project. */ require "auth.inc"; require "guiconfig.inc"; $pgtitle = array(gettext("Network"), gettext("Firewall")); $pconfig['enable'] = isset($config['system']['firewall']['enable']); if (isset($_POST['export']) && $_POST['export']) { $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $elm = $doc->createElement(get_product_name()); $elm->setAttribute('version', get_product_version()); $elm->setAttribute('revision', get_product_revision()); $node = $doc->appendChild($elm); // export as XML array_sort_key($config['system']['firewall']['rule'], "ruleno"); foreach ($config['system']['firewall']['rule'] as $k => $v) { $elm = $doc->createElement('rule'); foreach ($v as $k2 => $v2) { $elm2 = $doc->createElement($k2, $v2); $elm->appendChild($elm2); } $node->appendChild($elm); } $xml = $doc->saveXML(); if ($xml === FALSE) { $errormsg = gettext("Invalid file format.");
<td width="25%" class="vncellt"><?php echo gettext("Hostname"); ?> </td> <td width="75%" class="listr"><?php echo system_get_hostname(); ?> </td> </tr> <tr> <td width="25%" valign="top" class="vncellt"><?php echo gettext("Version"); ?> </td> <td width="75%" class="listr"><strong><?php echo get_product_version(); ?> <?php echo get_product_versionname(); ?> </strong> (<?php echo gettext("revision"); ?> <?php echo get_product_revision(); ?> )</td> </tr> <tr> <td width="25%" valign="top" class="vncellt"><?php echo gettext("Built on");