Kagera Web Interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.sh 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/usr/bin/cbsi
  2. <%
  3. THEME=$(uci get kagera.webui.theme)
  4. TIMEOUT=$(uci get kagera.webui.timeout)
  5. if [ "${GET_option}" == "logout" ]; then
  6. eval $(sessmgr -l -r "index.sh?option=overview")
  7. elif [ "${POST_sessopen}" == "1" ] && [ -n "${POST_sesspass}" ]; then
  8. sleep 3
  9. eval $(sessmgr -u "${POST_sessuser}" -p "${POST_sesspass}" -b "${COOKIE_browser_time}" -a "${HTTP_USER_AGENT}" -i "${REMOTE_ADDR}" -t "${TIMEOUT}" -r "index.sh?option=${GET_option}")
  10. fi
  11. eval $(sessmgr -c "${COOKIE_kagera_sid}" -u "${COOKIE_kagera_usr}" -e "${COOKIE_kagera_exp}" -b "${COOKIE_browser_time}" -a "${HTTP_USER_AGENT}" -i "${REMOTE_ADDR}" -t "${TIMEOUT}")
  12. [ -f /usr/lib/kagera/config/${GET_option}.cbsi ] || GET_option="overview"
  13. if [ -n "${GET_refresh}" ]; then
  14. echo "Content-type: text/plain; charset=utf-8"
  15. if [ -n "${VALIDSESS}" ]; then
  16. if [ "${GET_runcommand}" == "1" ]; then
  17. if [ -n "${POST_commands}" ]; then
  18. echo ""
  19. echo "${POST_commands}" | tr -d "\r" > /tmp/run.sh
  20. sh /tmp/run.sh
  21. rm -f /tmp/run.sh
  22. fi
  23. else
  24. /usr/bin/cbsi /usr/lib/kagera/config/${GET_option}.cbsi
  25. fi
  26. fi
  27. exit
  28. fi
  29. echo "Content-type: text/html; charset=utf-8"
  30. . /etc/version
  31. %>
  32. <!DOCTYPE html>
  33. <html>
  34. <head>
  35. <title>Kagera Router Management Utility</title>
  36. <meta name="robots" content="noindex,nofollow" />
  37. <link rel="shortcut icon" href="/themes/kagera/images/favicon.ico"/>
  38. <link rel="stylesheet" href="<%: themes/${THEME}/style.css %>" />
  39. <script src="scripts/kagera.js" type="text/javascript"></script>
  40. <script src="<%: scripts/${GET_option}.js %>" type="text/javascript"></script>
  41. <script>
  42. var sysmsg = ["<%@ Executing commands... %>", "<%@ Applying system changes... %>", "<%@ Restarting services... %>", "<%@ Downloading firmware image... %>", "<%@ Flashing image... %>", "<%@ Rebooting device... %>", "<%@ Do you really want to reboot? %>"];
  43. var multimenu = <% uci get kagera.webui.multimenu %>;
  44. </script>
  45. </head>
  46. <body>
  47. <% if [ "${VALIDSESS}" == "1" ]; then %>
  48. <div class="webui">
  49. <div class="header">
  50. <div class="logo">
  51. <span id="title"><%: ${SYSTEM_DESCRIPTION} %></span>
  52. <span id="version"><%: ${SYSTEM_VERSION} %></span>
  53. </div>
  54. <div class="controls">
  55. <input type="button" class="creboot" value="<%@ Reboot %>" onclick="reboot(true);" />
  56. <input type="button" class="clogout" value="<%@ Logout %>" onclick="logout();" />
  57. </div>
  58. </div>
  59. <div class="body">
  60. <div id="mainmenu">
  61. <div class="navbox">
  62. <span class="navheader"><%@ Status %></span>
  63. <ul class="navbody">
  64. <li><a href="index.sh?option=overview"><%@ Overview %></a></li>
  65. <li><a href="index.sh?option=command"><%@ Run Command %></a></li>
  66. <li><a href="index.sh?option=syslogs"><%@ System Logs %></a></li>
  67. </ul>
  68. <span class="navfooter"></span>
  69. </div>
  70. <div class="navbox">
  71. <span class="navheader"><%@ System %></span>
  72. <ul class="navbody">
  73. <li><a href="index.sh?option=about"><%@ About Kagera %></a></li>
  74. </ul>
  75. <span class="navfooter"></span>
  76. </div>
  77. </div>
  78. <div id="content">
  79. <% /usr/bin/cbsi -t ${GET_option} /usr/lib/kagera/config/${GET_option}.cbsi %>
  80. </div>
  81. </div>
  82. <div class="footer">
  83. Copyright&copy; 2010-2013, <a href="http://www.asiotec.eu.org" target="_blank">Asio Software Technologies</a>
  84. </div>
  85. <% else %>
  86. <div class="loginbox">
  87. <div class="body">
  88. <form action="<%: index.sh?option=${GET_option} %>" method="POST">
  89. <h1><%@ Authorization Required %></h1>
  90. <label><%@ User Name: %></label><input type="text" name="sessuser" autofocus="autofocus" />
  91. <label><%@ Password: %></label><input type="password" name="sesspass" />
  92. <hr />
  93. <div class="formctrl">
  94. <input type="hidden" name="sessopen" value="1" />
  95. <input type="reset" value="<%@ Reset %>" />
  96. <input type="submit" value="<%@ Login %>" />
  97. </div>
  98. </form>
  99. </div>
  100. <% fi %>
  101. </div>
  102. <div id="dim"></div><div id="msg"><img src="<%: themes/${THEME}/images/loader.gif %>" alt="L" /></div>
  103. </body>
  104. </html>