Ejemplo n.º 1
0
function show_nav()
{
    $config = get_config();
    $master_url = parse_config($config, "<master_url>");
    $no_computing = parse_config($config, "<no_computing>");
    $no_web_account_creation = parse_bool($config, "no_web_account_creation");
    echo "<div class=\"mainnav\">\n\n        <h2 class=headline>Returning participants</h2>\n        <ul>\n    ";
    if ($no_computing) {
        echo "\n            <li><a href=\"bossa_apps.php\">Do work</a>\n            <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n        ";
    } else {
        echo "\n            <li><h3 class=headline > <a href=\"home.php\">Your account</a> - Create/List Tasks , stats, preferences </h3>\n            <li><a href=server_status.php>Server status</a>\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n            <li><a href=\"cert1.php\">Certificate</a>\n            <li><a href=\"apps.php\">" . tra("Applications") . "</a>\n        ";
    }
    echo "\n        </ul>";
    echo "<div class=\"mainnav\">\n        <h2 class=headline>About " . PROJECT . "</h2>\n    ";
    if ($no_computing) {
        echo "\n            " . SHORT_NAME . " is a research project that uses volunteers\n            to do research in Electromechanical Activity in the Human Heart.\n        ";
    } else {
        echo "\n            " . SHORT_NAME . " is a research project that uses Internet-connected\n            computers to do research in Electromechanical Activity in the Human Heart.\n            You can participate by downloading and running a free program\n            on your computer.\n        ";
    }
    echo "\n        <p>\n        " . SHORT_NAME . " is based at \n        USJ, Universidad San Jorge <a href=\"http://www.usj.es\">www.usj.es</a>\n        <ul>\n        <li> Code (and request modificacions) is available for web interface at <a href=\"https://github.com/rampxxxx/em\">https://github.com/rampxxxx/em</a>\n        <li> Code  (and request modificacions) is available for boinc daemons at <a href=\"https://github.com/rampxxxx/boinc\">https://github.com/rampxxxx/boinc</a>\n        <li> Code  (and request modificacions) is available for EM models at <a href=\"https://github.com/rampxxxx/TestEM\">https://github.com/rampxxxx/TestEM</a>\n        </ul>\n        <h2 class=headline>Join " . PROJECT . "</h2>\n        <ul>\n    ";
    if ($no_computing) {
        echo "\n            <li> <a href=\"create_account_form.php\">Create an account</a>\n        ";
    } else {
        echo "\n            <li><a href=\"info.php\">" . tra("Read our rules and policies") . "</a>\n            <li> This project uses BOINC.\n                If you're already running BOINC, select Add Project.\n                If not, <a target=\"_new\" href=\"http://boinc.berkeley.edu/download.php\">download BOINC</a>.\n            <li> When prompted, enter <br><b>" . $master_url . "</b>\n        ";
        if (!$no_web_account_creation) {
            echo "\n                <li> If you're running a command-line version of BOINC,\n                    <a href=\"create_account_form.php\">create an account</a> first.\n            ";
        }
        echo "\n            <li> If you have any problems,\n                <a target=\"_new\" href=\"http://boinc.berkeley.edu/wiki/BOINC_Help\">get help here</a>.\n        ";
    }
    echo "\n        </ul>";
    echo "\n        <h2 class=headline>" . tra("Community") . "</h2>\n        <ul>\n        <li><a href=\"profile_menu.php\">" . tra("Profiles") . "</a>\n        <li><a href=\"user_search.php\">User search</a>\n        <li><a href=\"forum_index.php\">" . tra("Message boards") . "</a>\n        <li><a href=\"forum_help_desk.php\">" . tra("Questions and Answers") . "</a>\n        <li><a href=\"stats.php\">Statistics</a>\n        <li><a href=language_select.php>Languages</a>\n        </ul>\n        </div>\n    ";
}
Ejemplo n.º 2
0
function show_nav()
{
    $config = get_config();
    $master_url = parse_config($config, "<master_url>");
    $no_computing = parse_config($config, "<no_computing>");
    $no_web_account_creation = parse_bool($config, "no_web_account_creation");
    echo "<div class=\"mainnav\">\n        <h2 class=headline>About " . PROJECT . "</h2>\n    ";
    if ($no_computing) {
        echo "\n            XXX is a research project that uses volunteers\n            to do research in XXX.\n        ";
    } else {
        echo "\n            XXX is a research project that uses Internet-connected\n            computers to do research in XXX.\n            You can participate by downloading and running a free program\n            on your computer.\n        ";
    }
    echo "\n        <p>\n        XXX is based at \n        [describe your institution, with link to web page]\n        <ul>\n        <li> [Link to page describing your research in detail]\n        <li> [Link to page listing project personnel, and an email address]\n        </ul>\n        <h2 class=headline>Join " . PROJECT . "</h2>\n        <ul>\n    ";
    if ($no_computing) {
        echo "\n            <li> <a href=\"create_account_form.php\">Create an account</a>\n        ";
    } else {
        echo "\n            <li><a href=\"info.php\">" . tra("Read our rules and policies") . "</a>\n            <li> This project uses BOINC.\n                If you're already running BOINC, select Add Project.\n                If not, <a target=\"_new\" href=\"http://boinc.berkeley.edu/download.php\">download BOINC</a>.\n            <li> When prompted, enter <br><b>" . $master_url . "</b>\n        ";
        if (!$no_web_account_creation) {
            echo "\n                <li> If you're running a command-line version of BOINC,\n                    <a href=\"create_account_form.php\">create an account</a> first.\n            ";
        }
        echo "\n            <li> If you have any problems,\n                <a target=\"_new\" href=\"http://boinc.berkeley.edu/wiki/BOINC_Help\">get help here</a>.\n        ";
    }
    echo "\n        </ul>\n\n        <h2 class=headline>Returning participants</h2>\n        <ul>\n    ";
    if ($no_computing) {
        echo "\n            <li><a href=\"bossa_apps.php\">Do work</a>\n            <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n        ";
    } else {
        echo "\n            <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n            <li><a href=server_status.php>Server status</a>\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n            <li><a href=\"cert1.php\">Certificate</a>\n            <li><a href=\"apps.php\">" . tra("Applications") . "</a>\n        ";
    }
    echo "\n        </ul>\n        <h2 class=headline>" . tra("Community") . "</h2>\n        <ul>\n        <li><a href=\"profile_menu.php\">" . tra("Profiles") . "</a>\n        <li><a href=\"user_search.php\">User search</a>\n        <li><a href=\"forum_index.php\">" . tra("Message boards") . "</a>\n        <li><a href=\"forum_help_desk.php\">" . tra("Questions and Answers") . "</a>\n        <li><a href=\"stats.php\">Statistics</a>\n        <li><a href=language_select.php>Languages</a>\n        </ul>\n        </div>\n    ";
}
Ejemplo n.º 3
0
function add_base_packages_menu_items()
{
    global $g, $config;
    $base_packages = split($g['base_packages'], ",");
    $modified_config = false;
    foreach ($base_packages as $bp) {
        $basepkg_path = "/usr/local/pkg/";
        if (file_exists($basepkg_path . $configfile)) {
            $pkg_config = parse_xml_config_pkg($basepkg_path . $bp, "packagegui");
            if ($pkg_config['menu'] != "") {
                if (is_array($pkg_config['menu'])) {
                    foreach ($pkg_config['menu'] as $menu) {
                        if (is_array($config['installedpackages']['menu'])) {
                            foreach ($config['installedpackages']['menu'] as $amenu) {
                                if ($amenu['name'] == $menu['name']) {
                                    continue;
                                }
                            }
                        }
                        $config['installedpackages']['menu'][] = $menu;
                        $modified_config = true;
                    }
                }
                $static_output .= "done.\n";
                update_output_window($static_output);
            }
        }
    }
    if ($modified_config) {
        write_confg("Restored base_package menus after configuration restore.");
        $config = parse_config(true);
    }
}
Ejemplo n.º 4
0
 public function setInfo($type, $detail, $originalxml, $denytag, $otherparam)
 {
     $detail = unserialize($detail);
     switch (strtolower($detail['type'])) {
         case 'cloud':
             $apiinfo = M('Webuntil')->where(array('id' => $detail['neiron']))->field('id,webuntil_param,webuntil_type,webuntil_backtype,webuntil_sigtype,webuntil_cache,webuntil_tag,webuntil_url,webuntil_token')->find();
             $oldparam = parse_config($apiinfo['webuntil_param']);
             $newparam = $detail['replace'];
             //为了更好的合并参数提交
             $apiinfo['webuntil_param'] = array_merge($oldparam, $newparam);
             //判断是否存在缓存
             $oldinfo = excute_cache($apiinfo['id'], '', $apiinfo['webuntil_cache'], $is_echo = false);
             $newcontent = empty($oldinfo) ? self::setCloud($apiinfo) : $oldinfo;
             return $newcontent;
             break;
         case 'local':
             $apiinfo = M('Addons')->where(array('id' => $detail['neiron'], 'status' => 1, 'weixin' => 1))->field('name,title,config')->find();
             if (empty($apiinfo)) {
                 wx_error('Sorry!该插件暂未启用或者未安装');
             } else {
                 defined('AMANGO_ADDON_NAME') or define('AMANGO_ADDON_NAME', ucfirst($apiinfo['name']));
             }
             $publicpath = str_replace('./', 'http://' . $_SERVER['HTTP_HOST'] . '/', ONETHINK_ADDON_PATH . AMANGO_ADDON_NAME . '/Public/');
             defined('ADDON_PUBLIC') or define('ADDON_PUBLIC', $publicpath);
             defined('ADDON_ROOT') or define('ADDON_ROOT', ONETHINK_ADDON_PATH . AMANGO_ADDON_NAME . '/');
             Amango_Addons($apiinfo['name'], '', '', $detail['replace'], true);
             break;
         case 'behavior':
             wx_error('Sorry!暂不支持行为动作,下个版本即将推出');
             break;
         default:
             wx_error('未定义的第三方接口');
             break;
     }
 }
Ejemplo n.º 5
0
/**
 * 循环标签匹配
 * $matches  为匹配到的内容[数组]
 * 统一隐式传参 session('from')  session('to')
 * @return string 
 */
function xml_parse_tags($matches)
{
    $taglist = array();
    $taglist = session('AMANGO_PARSETAGS');
    preg_match('/(?<=<amango:)[^>]+(?=>)/', $matches[1], $tag_name);
    $tagname = str_replace('tag', '', $tag_name[0]);
    $tagitem = $taglist[$tagname];
    if (empty($tagitem)) {
        return "";
    } else {
        //wx_error(json_encode($tagitem));
        foreach ($tagitem as $key => $value) {
            switch (strtolower($value['type'])) {
                case 'func':
                    $funcname = $value['action'];
                    $str[$key] = $funcname($value['param']);
                    break;
                case 'action':
                    $actionname = $value['action'];
                    $param = array();
                    $param = parse_config($value['param']);
                    $str[$key] = R($actionname, $param);
                    break;
                case 'static':
                    $str[$key] = $value['param'];
                    break;
                default:
                    wx_error('标签解析不存在');
                    break;
            }
        }
        $newstr = implode("\n", $str);
        return $newstr . "\n";
    }
}
Ejemplo n.º 6
0
function get_lists()
{
    $config = get_config();
    $db_name = parse_config($config, "<db_name>");
    $db_host = parse_config($config, "<db_host>");
    system("mysql {$db_name} -h {$db_host} -e \"select workunitid, id from result \" | tail +2 | sort -n > dbc_res.dat");
    system("mysql {$db_name} -h {$db_host} -e \"select id from workunit\" | tail +2 | sort -n > dbc_wu.dat");
}
Ejemplo n.º 7
0
 public function check_score()
 {
     $allscore = I('post.score');
     $param = parse_config(I('post.score_param'));
     foreach ($param as $key => $value) {
         if (!is_numeric($key) || $key > $allscore) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 8
0
function boinc_recaptcha_get_head_extra()
{
    // are we using recaptcha?
    $publickey = parse_config(get_config(), "<recaptcha_public_key>");
    if ($publickey) {
        // the meta tag must be included
        // for Recaptcha to work with some IE browsers
        return '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
        <script src="https://www.google.com/recaptcha/api.js" async defer></script>';
    } else {
        return null;
    }
}
Ejemplo n.º 9
0
 /**
  * Function get
  * @param string $_scope
  * @param string $_interface
  * @return Ambigous <Array api_struct, boolean false>
  */
 public static function get($_service = NULL, $_method = NULL, $_http_method = 'GET')
 {
     $_result = FALSE;
     if ($_service != NULL && $_method != NULL) {
         $_result = parse_config(API_CONF_FILE_PATH);
     }
     if ($_result != NULL && isset($_result[$_service . '/' . $_method . '?' . $_http_method])) {
         $_result = $_result[$_service . '/' . $_method . '?' . $_http_method];
     } else {
         $_result = FALSE;
     }
     return $_result;
 }
Ejemplo n.º 10
0
 function &getConfig($reload = false)
 {
     if (!isset($this->config) || $reload) {
         if (isset($_SESSION['load_count'])) {
             $_SESSION['load_count'] += 1;
         } else {
             $_SESSION['load_count'] = 1;
         }
         $configinstance = config_load();
         $this->config =& parse_config($configinstance);
     }
     return $this->config;
 }
Ejemplo n.º 11
0
function set_jstpl($link_url, $info, $list, $common, $id)
{
    //判断是否存在缓存  5小时
    $cachetpl = S('Addonsexamcache' . $id);
    if (!empty($cachetpl)) {
        return $cachetpl;
    }
    //不存在  重新定义
    //分享图片
    $img_url = get_cover_pic($info['logo']);
    //分数段
    $scoreparam = '';
    $score_param = array();
    $score_param = parse_config($info['score_param']);
    foreach ($score_param as $key => $value) {
        $scoreparam .= '{score: ' . $key . ',comment: "' . $value . '"},';
    }
    //题目列表
    $queData = set_queData($list);
    $tpl = <<<str
(function() {
  window.amangoshare = {
    "img_url": "{$img_url}",
    "img_width": "120",
    "img_height": "120",
    "link": "{$link_url}",
    "desc": "我正在参加【{$info['title']}】!你也来试试!",
    "title": "{$info['title']}"
  };
  window.buttonurl   = [
      '{$common[0]}',
      '{$common[1]}',
      '{$common[2]}',
      '{$common[3]}',
  ];
  window.nowdatajson = {
    queData: [
      {$queData}
    ],
    fullScore: {$info['score']},
    scoreArray: [
      {$scoreparam}
    ]
  };

}).call(this);
str;
    S('Addonsexamcache' . $id, $tpl, 60 * 60);
    return $tpl;
}
Ejemplo n.º 12
0
function show_nav()
{
    $config = get_config();
    $master_url = parse_config($config, "<master_url>");
    $no_computing = parse_config($config, "<no_computing>");
    $no_web_account_creation = parse_bool($config, "no_web_account_creation");
    $disable_acct = parse_bool($config, "disable_account_creation");
    echo "<div class=\"mainnav\">\n        <h2 class=headline>About " . PROJECT . "</h2>\n    ";
    if ($no_computing) {
        echo "\n            XXX is a research project that uses volunteers\n            to do research in XXX.\n        ";
    } else {
        echo "\n            XXX is a research project that uses Internet-connected\n            computers to do research in XXX.\n            You can participate by downloading and running a free program\n            on your computer.\n        ";
    }
    echo "\n        <p>\n        XXX is based at \n        [describe your institution, with link to web page]\n        <ul>\n        <li> [Link to page describing your research in detail]\n        <li> [Link to page listing project personnel, and an email address]\n        </ul>\n        <h2 class=headline>Participate</h2>\n        <ul>\n    ";
    if ($no_computing) {
        if (!$no_web_account_creation && !$disable_acct) {
            echo "\n                <li> <a href=\"create_account_form.php\">Create an account</a>\n            ";
        } else {
            echo "<li> This project is not currently accepting new accounts.";
        }
    } else {
        echo "\n            <li><a href=\"info.php\">" . tra("Read our rules and policies") . "</a>\n        ";
        if (0) {
            echo "<li>";
            show_button("register.php", "Join", null, "btn btn-green");
        } else {
            echo "<li> <a href=http://boinc.berkeley.edu/download.php>Download</a> and run BOINC.\n                <li> Choose Add Project\n            ";
        }
        echo "\n            <li> If you have any problems,\n                <a target=\"_new\" href=\"http://boinc.berkeley.edu/wiki/BOINC_Help\">get help here</a>.\n        ";
    }
    echo "\n        </ul>\n\n        <h2 class=headline>Returning participants</h2>\n        <ul>\n        <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n    ";
    if (!$no_computing) {
        echo "\n            <li><a href=server_status.php>Server status</a>\n            <li><a href=\"cert1.php\">Certificate</a>\n            <li><a href=\"apps.php\">" . tra("Applications") . "</a>\n        ";
    }
    if (!DISABLE_TEAMS) {
        echo "\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n        ";
    }
    echo "\n        </ul>\n        <h2 class=headline>" . tra("Community") . "</h2>\n        <ul>\n    ";
    if (!DISABLE_PROFILES) {
        echo "\n            <li><a href=\"profile_menu.php\">" . tra("Profiles") . "</a>\n        ";
    }
    echo "\n        <li><a href=\"user_search.php\">User search</a>\n        <li><a href=ffmail_form.php>Share</a>\n    ";
    if (!DISABLE_FORUMS) {
        echo "\n            <li><a href=\"forum_index.php\">" . tra("Message boards") . "</a>\n            <li><a href=\"forum_help_desk.php\">" . tra("Questions and Answers") . "</a>\n        ";
    }
    echo "\n        <li><a href=\"stats.php\">Statistics</a>\n        <li><a href=language_select.php>Languages</a>\n        </ul>\n        </div>\n    ";
}
Ejemplo n.º 13
0
function show_auth_form()
{
    $master_url = parse_config(get_config(), "<master_url>");
    $x = strstr($master_url, "//");
    $x = substr($x, 2);
    $x = rtrim($x, "/");
    $x = str_replace("/", "_", $x);
    $account_file = "account_{$x}.xml";
    echo "<p><h3>" . tra("2) If you forgot your account's email address, or you can't receive email there:") . "</h3>" . tra("If you have run BOINC under this account, you can still access it. Here's how:") . "\n\n    <ul>\n    <li> " . tra("Go to the BOINC data directory on your computer (its location is written to the Event Log at startup).") . "\n    <li> " . tra("Find your account file for this project; it will be named <b>%1</b>.", $account_file) . "\n    <li> " . tra("Open the file in a text editor like Notepad. You'll see something like") . "\n    <pre>\n    &lt;account>\n        &lt;master_url>{$master_url}&lt;/master_url>\n        &lt;authenticator>8b8496fdd26df7dc0423ecd43c09a56b&lt;/authenticator>\n        &lt;project_name>" . PROJECT . "&lt;/project_name>\n        ...\n    &lt;/account>\n    </pre>\n\n    <li> " . tra("Select and Copy the string between %1 and %2 (%3 in the above example).", "&lt;authenticator>", "&lt;/authenticator>", "<b>8b8496fdd26df7dc0423ecd43c09a56b</b>") . "\n\n    <li> " . tra("Paste the string into the field below, and click OK.") . "\n    <li> " . tra("You will now be logged in to your account; update the email and password of your account.") . "\n    </ul>\n    ";
    start_table();
    echo "<form action=login_action.php method=post>\n";
    row2(tra("Log in with authenticator"), "<input type=\"text\" name=authenticator size=40>");
    row2(tra("Stay logged in on this computer"), "<input type=checkbox name=send_cookie checked>");
    row2("", "<input class=\"btn btn-default\" type=submit value=\"" . tra("OK") . "\">");
    echo "</form>";
    end_table();
}
Ejemplo n.º 14
0
Archivo: index.php Proyecto: happyj/qcn
function show_nav()
{
    $config = get_config();
    $master_url = parse_config($config, "<master_url>");
    $no_computing = parse_config($config, "<no_computing>");
    $no_web_account_creation = parse_bool($config, "no_web_account_creation");
    $user = get_logged_in_user(false);
    echo "<div class=\"mainnav\">\n        <h2 class=headline>About " . PROJECT . "</h2>\n    ";
    echo "\n        The Quake Catcher Network (QCN) is a research project that uses Internet-connected\n        computers to do research, education, and outreach in seismology.\n        You can participate by downloading and running a free program\n        on your computer.  Currently only certain Mac (OS X) PPC and Intel laptops are supported --\n        recent ones which have a built-in accelerometer.  You can also buy an external USB accelerometer.\n        <p>\n        QCN is based at the Stanford University School of Earth Sciences.\n        <ul>\n        <li> <A HREF=\"" . BASEURL . "/index.php\">Quake Catcher Network Home Page</A>\n        <li> <A HREF=\"" . BASEURL . "/about-qcn/contact-us\">Project Personnel</A>\n        </ul>\n       ";
    if ($no_computing) {
        echo "\n            <li> <a href=\"create_account_form.php\">Create an account</a>\n        ";
    } else {
        echo "\n            <li><a href=\"info.php\">" . tra("Read our rules and policies") . "</a>\n            <li> This project uses BOINC.\n                If you're already running BOINC, select Add Project.\n                If not, <a target=\"_new\" href=\"http://boinc.berkeley.edu/download.php\">download BOINC</a>.\n            <li> When prompted, enter <br><b>" . $master_url . "</b>\n        ";
        if (!$no_web_account_creation) {
            echo "\n                <li> If you're running a command-line version of BOINC,\n                    <a href=\"create_account_form.php\">create an account</a> first.\n            ";
        }
        echo "\n            <li> If you have any problems,\n                <a target=\"_new\" href=\"http://boinc.berkeley.edu/wiki/BOINC_Help\">get help here</a>.\n        ";
    }
    echo "\n        </ul><BR><p>\n\n        <h2 class=headline>Returning participants</h2>\n        <ul>\n    ";
    if ($no_computing) {
        echo "\n            <li><a href=\"bossa_apps.php\">Do work</a>\n            <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n        ";
    } else {
        echo "\n            <li><a href=\"home.php\">Your account</a> - view stats, modify preferences\n            <li><a href=server_status.php>Server status</a>\n            <li><a href=\"team.php\">Teams</a> - create or join a team\n            <li><a href=\"cert1.php\">Certificate</a>\n            <li><a href=\"apps.php\">" . tra("Applications") . "</a>\n        ";
    }
    echo "\n        </ul>\n        <h2 class=headline>" . tra("Community") . "</h2>\n        <ul>\n        <li><a href=\"user_search.php\">User search</a>\n        <li><a href=\"forum_index.php\">" . tra("Message boards") . "</a>\n        <li><a href=\"stats.php\">Statistics</a>\n        <li><a href=language_select.php>Languages</a>\n        </ul>\n    ";
    // CMC changed to forum prefs 4th bit
    if (qcn_admin_user_auth($user)) {
        // defined in project/project.inc
        echo "\n        <h2>" . tra("Extra Links") . "</h2>\n        <ul>\n        <li><a href=\"trdl.php\">" . tra("Trigger Search/Upload/Download Page") . "</a>\n        <li><a href=\"ramp.php\">" . tra("View RAMP Signups") . "</a>\n        <li><a href=\"" . BASEURL . "/sensor/todo\">" . tra("To-Do List") . "</a></ul>";
        //if ($user->id == 15) {
        // check for db replication timestamp
        #$kewfile = BASEPATH . "/boinc/sensor/html/user/max.txt";
        #if (file_exists($kewfile) && ($handle = fopen($kewfile, 'r'))) {
        #      $output = fgets($handle); // skip first line
        #      $output = fgets($handle);              fclose($handle);
        #      echo "        <li>Kew Sync Diff (seconds): " . $output . "<BR>(should be a small number else server is down) <BR>";
        #   }        else {
        #         echo "        <li>No Replication Sync File on Kew - Better Check!";
        # }
    }
    qcn_show_map();
    echo "     </div>";
}
Ejemplo n.º 15
0
 public function create_response($resdata)
 {
     if (!is_numeric($resdata['apiid']) || empty($resdata['response_name'])) {
         return false;
     }
     $data = array();
     $param = parse_config($resdata['param']);
     //回复类型判断
     $data['response_reply'] = 'Api';
     //回复体标识
     $data['response_name'] = empty($resdata['response_name']) ? '本地接口,ID' . $resdata['apiid'] : $resdata['response_name'];
     //结构组合体
     $neiron = array('type' => 'local', 'num' => 1, 'neiron' => $resdata['apiid'], 'replace' => $param);
     $data['response_compos'] = serialize($neiron);
     //生成XML
     $data['response_xml'] = '';
     //数据静态化
     $data['response_static'] = 0;
     $data['status'] = 1;
     return $data;
 }
Ejemplo n.º 16
0
function show_download_page()
{
    page_head("Download required software");
    $config = get_config();
    $need_vbox = parse_bool($config, "need_vbox");
    $mcv = parse_config($config, "<min_core_client_version>");
    $dlv = "BOINC";
    $dl = "BOINC";
    if ($mcv) {
        $dlv .= " version " . version_string_maj_min_rel($mcv) . " or later";
    }
    $verb = "this is";
    if ($need_vbox) {
        $dl .= " and VirtualBox";
        $dlv .= " and VirtualBox";
        $verb = "these are";
    }
    echo "To participate in " . PROJECT . ", {$dlv} must be installed.\n        <p>\n        If {$verb} already installed, <a href=download.php?action=installed>click here</a>.  Otherwise\n        <p>\n    ";
    show_button("download.php?action=download", "Download {$dl}");
    echo "<p>\n        When the download is finished,\n        open the downloaded file to install BOINC.\n    ";
    page_tail();
}
Ejemplo n.º 17
0
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/db_ops.inc";
require_once "../inc/util_ops.inc";
require_once "../inc/uotd.inc";
require_once "../project/project.inc";
$config = get_config();
$cgi_url = parse_config($config, "<cgi_url>");
$stripchart_cgi_url = parse_config($config, "<stripchart_cgi_url>");
db_init();
$title = "Project Management";
admin_page_head($title);
// Notification area
echo "<ul>\n";
echo "<li>";
if (file_exists("../../local.revision")) {
    $local_rev = file_get_contents("../../local.revision");
}
if ($local_rev) {
    echo "Currently used SVN revision: " . $local_rev . "; ";
}
if (file_exists("../cache/remote.revision") && time() < filemtime("../cache/remote.revision") + 24 * 60 * 60) {
    $remote_rev = file_get_contents("../cache/remote.revision");
} else {
         $jobstderr = parse_element($resultunit->stderr_out, "<stderr_txt>");
         if ($jobstderr) {
             row1("Error output of this job");
             row2("", $jobstderr);
         }
     }
 } else {
     $resultunit = mysql_fetch_object(mysql_query("SELECT * FROM result WHERE id=" . $workunit->canonical_resultid));
     $xmldoc = $resultunit->xml_doc_out;
     $nroffiles = 0;
     $cursor = 0;
     while ($tempfileinfo = parse_next_element($xmldoc, "<file_info>", &$cursor)) {
         $outputfiles[$nroffiles++] = parse_element($tempfileinfo, "<name>");
     }
     if ($nroffiles >= 1) {
         $fanoutnr = parse_config($config, "<uldl_dir_fanout>");
         row1("Output of this job");
         row2("Number of output files of job: ", $nroffiles);
         for ($index = 0; $index < $nroffiles; ++$index) {
             $filename = $outputfiles[$index];
             $url = "upload/" . fan_out_dir($filename, $fanoutnr) . "/" . $filename;
             $outputfilelink = '<a href="' . $url . '">' . $filename . '</a>';
             row2("Output file " . ($index + 1) . ": ", $outputfilelink);
         }
     }
     $jobstderr = parse_element($resultunit->stderr_out, "<stderr_txt>");
     if ($jobstderr) {
         row1("Error output of this job");
         row2("", $jobstderr);
     }
 }
 /**
  * 编辑配置
  * @author yangweijie <*****@*****.**>
  */
 public function edit_posts($id = 0)
 {
     if (IS_POST) {
         $res['status'] = 0;
         //关键词头部信息初始化
         if (!empty($_POST['keyword_post']) && !empty($_POST['id'])) {
             //请求类型判断
             $date['keyword_post'] = $_POST['keyword_post'];
             //下文关键词是否开启
             $date['keyword_down'] = !empty($_POST['keyword_down']) ? $_POST['keyword_down'] : '';
             //上文继承关键词
             $date['keyword_top'] = is_numeric($_POST['keyword_top']) ? $_POST['keyword_top'] : 0;
             //关键词所属分组
             $date['keyword_group'] = empty($_POST['keyword_group']) ? 1 : $_POST['keyword_group'];
             //关键词缓存
             $date['keyword_cache'] = is_numeric($_POST['keyword_cache']) ? $_POST['keyword_cache'] : 0;
             //关键词有效期判断
             $date['keyword_start'] = strtotime($_POST['keyword_start']);
             $date['keyword_end'] = strtotime($_POST['keyword_end']);
             if (!empty($date['keyword_end']) && !empty($date['keyword_start'])) {
                 if ($date['keyword_end'] < $date['keyword_start']) {
                     $date['keyword_end'] = $date['keyword_start'] + 31536000;
                 }
             }
             //关键词后置行为初始化
             //标签隐藏 显示 关闭
             $date['denytag_keyword'] = serialize(parse_config($_POST['denytag_keyword'], $type = 3));
             //后续行为初始化
             $date['after_keyword'] = serialize(parse_config($_POST['after_keyword'], $type = 3));
             //菜单模式初始化
             $date['click_model'] = is_numeric($_POST['click_model']) ? $_POST['click_model'] : '';
             //模式锁定初始化
             if (empty($_POST['lock_model1'])) {
                 //直接  第一个 选择模块
                 if (is_numeric($_POST['lock_model'])) {
                     $modelinfo = M('Addons')->where(array('status' => 1, 'weixin' => 1, 'id' => $_POST['lock_model']))->field('id,name')->find();
                     $date['lock_model'] = ucfirst($modelinfo['name']) . '/index';
                 } else {
                     $date['lock_model'] = '';
                 }
             } else {
                 $date['lock_model'] = empty($_POST['lock_model']) ? '' : $_POST['lock_model1'];
             }
             $date['status'] = 1;
             $date['keyword_reply'] = $_POST['keyword_reply'];
             //关键词正则替代
             //正则标识
             if (empty($_POST['keyword_reply'])) {
                 $this->error('匹配规则不能为空');
             }
             $rule = M('Rules')->where(array('rules_title' => $_POST['keyword_reply'], 'status' => 1))->getField('rules_content');
             //判断匹配正则是否可用
             if (empty($rule)) {
                 $this->error('该匹配规则为空');
             }
             $date['keyword_content'] = keyword_replace_text($_POST['keyword']);
             $date['keyword_content'] = str_replace('/', '\\/', $date['keyword_content']);
             //强制性  1文本请求  关键词必填   2菜单请求  关键词必填
             if (strtolower($date['keyword_post']) == 'text' && empty($date['keyword_content'])) {
                 $this->error('文本请求中,关键词不能为空');
             }
             if (!empty($date['keyword_content']) && !empty($rule)) {
                 //判断是否携带【参数1】【参数2】【参数3】【参数4】
                 if (strstr($rule, "参数")) {
                     $newkey = $rule;
                     $replacekey = explode(';', $date['keyword_content']);
                     foreach ($replacekey as $key => $value) {
                         $newkey = str_ireplace("参数" . $key, $value, $newkey);
                     }
                     $newrule = "/" . $newkey . "/";
                     //循环替代参数
                 }
                 //判断是否携带单规则替代
                 if (strstr($rule, "芒果")) {
                     $newrule = str_ireplace("芒果", $date['keyword_content'], $rule);
                     //芒果基本关键词
                 }
                 //全无则原规则
                 if (!strstr($rule, "参数") && !strstr($rule, "芒果")) {
                     $newrule = $rule;
                 }
                 $date['keyword_rules'] = $newrule;
             }
             $datanum = M('Keyword')->where(array('id' => $_POST['id']))->save($date);
             $this->success('编辑用户请求成功', U('Keywordview/lists'));
         } else {
             $this->error('用户请求标识非法');
         }
     } else {
         $info = array();
         /* 获取数据 */
         $info = D('KeywordView')->where(array('id' => intval($_REQUEST['id'])))->find();
         $info['response_reply'] = strtolower($info['response_reply']);
         $string = '';
         foreach (unserialize($info['after_keyword']) as $key => $value) {
             if (!empty($value)) {
                 $string .= $value . "\n";
             }
         }
         $info['after_keyword'] = $string;
         $clickmenu = M('Clickmenu')->field('id,title')->select();
         $this->assign('clickmenu', $clickmenu);
         $locallist = M('Addons')->where(array('status' => 1, 'weixin' => 1))->field('id,title,name')->select();
         $info['lock_model1'] = is_numeric($info['lock_model']) ? '' : $info['lock_model'];
         $this->assign('localapi', $locallist);
         $info['click_model'] = str_replace(' ', '', $info['click_model']);
         $this->assign('meta_title', '关键词管理');
         $this->assign('info', $info);
         $this->display();
     }
 }
Ejemplo n.º 20
0
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/user.inc";
check_get_args(array());
$auth = post_str("auth", true);
$email_addr = strtolower(post_str("email_addr", true));
$old_passwd = post_str("old_passwd", true);
$passwd = post_str("passwd");
$passwd2 = post_str("passwd2");
if ($passwd != $passwd2) {
    error_page(tra("New passwords are different"));
}
$config = get_config();
$min_passwd_length = parse_config($config, "<min_passwd_length>");
if (!$min_passwd_length) {
    $min_passwd_length = 6;
}
if (!is_ascii($passwd)) {
    error_page(tra("Passwords may only include ASCII characters."));
}
if (strlen($passwd) < $min_passwd_length) {
    error_page(tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length));
}
if ($auth) {
    $user = lookup_user_auth($auth);
    if (!$user) {
        error_page(tra("Invalid account key"));
    }
} else {
Ejemplo n.º 21
0
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/user.inc";
require_once "../inc/boinc_db.inc";
check_get_args(array("sort_by", "offset"));
$config = get_config();
$users_per_page = parse_config($config, "<users_per_page>");
if (!$users_per_page) {
    $users_per_page = 20;
}
define('ITEM_LIMIT', 10000);
function get_top_participants($offset, $sort_by)
{
    global $users_per_page;
    $db = BoincDb::get(true);
    if ($sort_by == "total_credit") {
        $sort_order = "total_credit desc";
    } else {
        $sort_order = "expavg_credit desc";
    }
    return BoincUser::enum(null, "order by {$sort_order} limit {$offset},{$users_per_page}");
}
Ejemplo n.º 22
0
    }
}
start_table();
// Using invitation codes to restrict access?
//
if (defined('INVITE_CODES')) {
    row2(tra("Invitation Code") . "<br><span class=\"description\">" . tra("A valid invitation code is required to create an account.") . "</span>", "<input type=\"text\" name=\"invite_code\" size=\"30\" >");
}
row2(tra("Name") . "<br><span class=\"description\">" . tra("Identifies you on our web site. Use your real name or a nickname.") . "</span>", "<input type=\"text\" name=\"new_name\" size=\"30\">");
row2(tra("Email Address") . "<br><span class=\"description\">" . tra("Must be a valid address of the form 'name@domain'.") . "</span>", "<input type=\"text\" name=\"new_email_addr\" size=\"50\">");
$min_passwd_length = parse_element($config, "<min_passwd_length>");
if (!$min_passwd_length) {
    $min_passwd_length = 6;
}
row2(tra("Password") . "<br><span class=\"description\">" . tra("Must be at least %1 characters", $min_passwd_length) . "</span>", "<input type=\"password\" name=\"passwd\">");
row2(tra("Confirm password"), "<input type=\"password\" name=\"passwd2\">");
row2_init(tra("Country") . "<br><span class=\"description\">" . tra("Select the country you want to represent, if any.") . "</span>", "<select name=\"country\">");
print_country_select();
echo "</select></td></tr>\n";
row2(tra("Postal or ZIP Code") . "<br><span class=\"description\">" . tra("Optional") . "</span>", "<input type=\"text\" name=\"postal_code\" size=\"20\">");
// Check if we need reCaptcha for making more safe the creation of accounts
$publickey = parse_config($config, "<recaptcha_public_key>");
if ($publickey) {
    row2(tra("Please enter the words shown in the image"), recaptcha_get_html($publickey));
}
row2("", "<input type=\"submit\" value=\"" . tra("Create account") . "\">");
end_table();
echo "\n    </form>\n";
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
page_tail();
Ejemplo n.º 23
0
Archivo: trdl.php Proyecto: happyj/qcn
$pass = parse_config($config, "<db_passwd>");
$host = null;
if ($try_replica == true) {
    $host = parse_config($config, "<replica_db_host>");
}
if ($host == null) {
    $host = parse_config($config, "<db_host>");
}
if ($host == null) {
    $host = "localhost";
}
$link = mysql_pconnect($host, $user, $pass);
if (!$link) {
    return 1;
}
$db_name = parse_config($config, "<db_name>");
$db_archive = "";
if ($db_name == "sensor") {
    $db_archive = "sensor_archive";
} else {
    if ($db_name == "continual") {
        $db_archive = "continual_archive";
    }
}
$queryBase = "select q.id as quakeid, q.time_utc as quake_time, q.magnitude as quake_magnitude, \nq.depth_km as quake_depth, q.latitude as quake_lat, \nq.longitude as quake_lon, q.description, q.url, q.guid,\nround(lat_lon_distance_m(q.latitude, q.longitude, t.latitude, t.longitude) / 1000.0, 3) as quake_distance_km,\nt.id as triggerid, t.hostid, t.ipaddr, h.domain_name hostname, t.result_name, t.time_trigger as trigger_time, \n(t.time_received-t.time_trigger) as delay_time, t.time_sync as trigger_sync,\nt.sync_offset, t.significance, t.magnitude as trigger_mag, \nt.latitude as trigger_lat, t.longitude as trigger_lon, t.file as trigger_file, t.dt as delta_t,\nt.numreset, s.description as sensor_description, t.sw_version, t.qcn_quakeid, t.time_filereq as trigger_timereq, \nt.received_file, REPLACE_ARCHIVE is_archive, t.varietyid, q.url quake_url, if(t.geoipaddrid=0, 'N', 'Y') is_geoip \nFROM REPLACE_DB.qcn_trigger t LEFT OUTER JOIN sensor.qcn_quake q ON t.qcn_quakeid = q.id\n   LEFT JOIN sensor.qcn_sensor s ON t.qcn_sensorid = s.id \n   LEFT JOIN REPLACE_HOSTDB.host h ON t.hostid=h.id\n";
// full querystring
// /continual_dl/trdl.php?cbCSV=1&cbUseLat=1&LatMin=-39&LatMax=-30&LonMin=-76&LonMax=-69&cbUseSensor=1&qcn_sensorid=100&cbUseTime=1&date_start=2010-03-24&time_hour_start=0&time_minute_start=0&date_end=2010-03-25&time_hour_end=0&time_minute_end=0&rb_sort=ttd
// sort order options: tta/d  hosta/d  maga/d lata/d lona/d
// get the archive time
$queryTime = "SELECT value_int+1 as archive_time FROM sensor.qcn_constant WHERE description='ArchiveTime'";
$result = mysql_query($queryTime);
Ejemplo n.º 24
0
function add_base_packages_menu_items()
{
    global $g, $config;
    $base_packages = explode(",", $g['base_packages']);
    $modified_config = false;
    foreach ($base_packages as $bp) {
        $basepkg_path = "/usr/local/pkg/{$bp}";
        $tmpinfo = pathinfo($basepkg_path, PATHINFO_EXTENSION);
        if ($tmpinfo['extension'] == "xml" && file_exists($basepkg_path)) {
            $pkg_config = parse_xml_config_pkg($basepkg_path, "packagegui");
            if ($pkg_config['menu'] != "") {
                if (is_array($pkg_config['menu'])) {
                    foreach ($pkg_config['menu'] as $menu) {
                        if (is_array($config['installedpackages']['menu'])) {
                            foreach ($config['installedpackages']['menu'] as $amenu) {
                                if ($amenu['name'] == $menu['name']) {
                                    continue;
                                }
                            }
                        }
                        $config['installedpackages']['menu'][] = $menu;
                        $modified_config = true;
                    }
                }
                $static_output .= "done.\n";
                update_output_window($static_output);
            }
        }
    }
    if ($modified_config) {
        write_config(gettext("Restored base_package menus after configuration restore."));
        $config = parse_config(true);
    }
}
Ejemplo n.º 25
0
function stage_file($file)
{
    global $fanout;
    $download_dir = parse_config(get_config(), "<download_dir>");
    switch ($file->mode) {
        case "semilocal":
        case "local":
            // read the file (from disk or network) to get MD5.
            // Copy to download hier, using a physical name based on MD5
            //
            $md5 = md5_file($file->source);
            if (!$md5) {
                xml_error(-1, "BOINC server: Can't get MD5 of file {$file->source}");
            }
            $name = "jf_{$md5}";
            $path = dir_hier_path($name, $download_dir, $fanout);
            if (file_exists($path)) {
                return $name;
            }
            if (!copy($file->source, $path)) {
                xml_error(-1, "BOINC server: can't copy file from {$file->source} to {$path}");
            }
            return $name;
        case "local_staged":
            return $file->source;
        case "inline":
            $md5 = md5($file->source);
            if (!$md5) {
                xml_error(-1, "BOINC server: Can't get MD5 of inline data");
            }
            $name = "jf_{$md5}";
            $path = dir_hier_path($name, $download_dir, $fanout);
            if (file_exists($path)) {
                return $name;
            }
            if (!file_put_contents($path, $file->source)) {
                xml_error(-1, "BOINC server: can't write to file {$path}");
            }
            return $name;
    }
    xml_error(-1, "BOINC server: unsupported file mode: {$file->mode}");
}
 public function diyconfig()
 {
     if (IS_POST) {
         foreach ($_POST['config'] as $key => $value) {
             if (!isset($value)) {
                 $this->error($key . '任意一项配置都不能为空');
             }
         }
         $model = M('addonsdiychaxun');
         if (empty($_POST['id'])) {
             $old = $model->where(array('title' => $_POST['config']['title']))->find();
             if (!empty($old)) {
                 $this->error('该标识已被使用,请换个英文标识');
             }
         }
         //解析读取配置
         $rulesparam = parse_config($_POST['config']['rules']);
         $rules = self::parsrules($rulesparam);
         $data['title'] = $_POST['config']['title'];
         $data['rules'] = $rules;
         $data['replytype'] = $_POST['config']['replytype'];
         $data['tpl'] = $_POST['config']['tpl'];
         $data['tableid'] = is_numeric($_POST['config']['tableid']) ? $_POST['config']['tableid'] : $this->error('数据源ID错误');
         $data['cache'] = is_numeric($_POST['config']['cache']) ? $_POST['config']['cache'] : 0;
         if (!empty($_POST['id'])) {
             $model->where(array('title' => $_POST['id']))->save($data);
         } else {
             $model->add($data);
         }
         $type = !empty($_POST['id']) ? '编辑' : '新增';
         $this->success($type . '自定义查询规则成功');
     } else {
         $tablelist = M('addonsexcel')->field('id,tablename')->select();
         $this->assign('list', $tablelist);
         $this->display();
     }
 }
Ejemplo n.º 27
0
}
if (web_stopped()) {
    echo "\n        <error_num>-183</error_num>\n        <web_stopped>1</web_stopped>\n    ";
} else {
    echo "<web_stopped>0</web_stopped>\n";
}
if ($disable_account_creation || defined('INVITE_CODES')) {
    echo "    <account_creation_disabled/>\n";
}
if (defined('INVITE_CODES')) {
    echo "    <invite_code_required/>\n";
}
echo "\n    <min_passwd_length>{$min_passwd_length}</min_passwd_length>\n";
if (sched_stopped()) {
    echo "<sched_stopped>1</sched_stopped>\n";
} else {
    echo "<sched_stopped>0</sched_stopped>\n";
}
$min_core_client_version = parse_config($config, "<min_core_client_version>");
if ($min_core_client_version) {
    echo "<min_client_version>{$min_core_client_version}</min_client_version>\n";
}
show_platforms();
$tou_file = "../../terms_of_use.txt";
if (file_exists($tou_file)) {
    $terms_of_use = trim(file_get_contents($tou_file));
    if ($terms_of_use) {
        echo "<terms_of_use>\n{$terms_of_use}\n</terms_of_use>\n";
    }
}
echo "\n</project_config>\n";
// Set hostname
$hostname = $config['system']['hostname'] . "." . $config['system']['domain'];
if (!$username) {
    Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0&savemsg=Please+setup+Auto+Config+Backup");
    exit;
}
if ($_POST) {
    if ($_REQUEST['nooverwrite']) {
        touch("/tmp/acb_nooverwrite");
    }
    if ($_REQUEST['reason']) {
        write_config($_REQUEST['reason']);
    } else {
        write_config("Backup invoked via Auto Config Backup.");
    }
    $config = parse_config(true);
    exec("echo > /cf/conf/lastpfSbackup.txt");
    upload_config($_REQUEST['reason']);
    $savemsg = "Backup completed successfully.";
    $donotshowheader = true;
}
$pgtitle = "Diagnostics: Auto Configuration Backup Now";
include "head.inc";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<div id='maincontent'>
<?php 
include "fbegin.inc";
if (strstr($pfSversion, "1.2")) {
    echo "<p class=\"pgtitle\">{$pgtitle}</p>";
}
Ejemplo n.º 29
0
function get_wu_output_files($wu_id, $auth_str)
{
    $wu = BoincWorkunit::lookup_id($wu_id);
    if (!$wu) {
        die("no workunit {$wu_id}");
    }
    $batch = BoincBatch::lookup_id($wu->batch);
    if (!$batch) {
        die("no batch {$wu->batch}");
    }
    $user = BoincUser::lookup_id($batch->user_id);
    if (!$user) {
        die("no user {$batch->user_id}");
    }
    $x = md5($user->authenticator . $wu_id);
    echo "user authenticator= {$user->authenticator}, wu_id={$wu_id}<br/>";
    if ($x != $auth_str) {
        die("bad auth str: x={$x}, auth_str={$auth_str}");
    }
    $zip_basename = tempnam("/tmp", "boinc_wu_" . $wu->name . "_");
    $zip_filename = $zip_basename . ".zip";
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    $upload_dir = parse_config(get_config(), "<upload_dir>");
    if (!$wu->canonical_resultid) {
        die("no canonical result for wu {$wu->name}");
    }
    $result = BoincResult::lookup_id($wu->canonical_resultid);
    $names = get_outfile_names($result);
    foreach ($names as $name) {
        $path = dir_hier_path($name, $upload_dir, $fanout);
        if (is_file($path)) {
            system("nice -9 zip -jq {$zip_basename} {$path}");
        }
    }
    do_download($zip_filename);
    unlink($zip_filename);
    unlink($zip_basename);
}
Ejemplo n.º 30
0
             unset($config['rrddata']);
             write_config();
             convert_config();
         }
         filter_configure();
         $savemsg = gettext("The configuration area has been restored.  You may need to reboot the firewall.");
     }
 } else {
     /* restore the entire configuration */
     $filename = $_FILES['conffile']['tmp_name'];
     file_put_contents($filename, $data);
     $cnf = OPNsense\Core\Config::getInstance();
     if ($cnf->restoreBackup($filename)) {
         /* this will be picked up by /index.php */
         mark_subsystem_dirty("restore");
         $config = parse_config();
         /* extract out rrd items, unset from $config when done */
         if ($config['rrddata']) {
             restore_rrddata();
             unset($config['rrddata']);
             write_config();
             convert_config();
         }
         if ($m0n0wall_upgrade) {
             if (!empty($config['system']['gateway'])) {
                 $config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
             }
             /* optional if list */
             $ifdescrs = get_configured_interface_list(true, true);
             /* remove special characters from interface descriptions */
             if (is_array($ifdescrs)) {