Where do i declare variable like $plexURL


#1

I want to know where do i declare variable like $plexURL to add another link to the dashboard

Thanks you


#2

Within the following:

/srv/rutorrent/home/inc/panel.menu.php

You will find the menu items. Main Menu items start on line #42. Below is what the default menu looks like.

      <div class="tab-content">
        <!-- ################# MAIN MENU ################### -->
        <div class="tab-pane active" id="mainmenu">
          <h5 class="sidebar-title">Main Menu</h5>
          <ul class="nav nav-pills nav-stacked nav-quirk">
            <li class="active"><a href="index.php"><i class="fa fa-home"></i> <span>Dashboard</span></a></li>
            <li><a href="/rutorrent" target="_blank"><i class="fa fa-share"></i> <span>ruTorrent</span></a></li>
            <?php if (processExists("btsync",btsync) && ($username == "$master")) { echo "<li><a href=\"$btsyncURL\" target=\"_blank\"><i class=\"fa fa-retweet\"></i> <span>BTSync</span></a></li>"; } ?>
            <?php if (file_exists('.plex') && ($username == "$master")) { echo "<li><a href=\"$plexURL\" target=\"_blank\"><i class=\"fa fa-play\"></i> <span>Plex</span></a></li>"; } ?>
            <li class="nav-parent">
              <a href=""><i class="fa fa-download"></i> <span>Downloads</span></a>
              <ul class="children">
                <li><a href="/<?php echo "$username"; ?>.downloads" target="_blank">ruTorrent</a></a></li>
              </ul>
            </li>
            <li><a href="?reload=true"><i class="fa fa-refresh"></i> <span>Reload Services</span></a></li>
            <?php
            if ($username == "$master"){
            echo "<li><a href=\"/$username.console\"><i class=\"fa fa-keyboard-o\"></i> <span>Web Console</span></a></li>";
            echo "<li class=\"nav-parent\"> <a href=\"\"><i class=\"fa fa-cubes\"></i> <span>Packages</span></a>";
              echo "<ul class=\"children\">";
                echo "<li class=\"info-quote\"><p class=\"info-quote\">Easily install and uninstall any software package simply by clicking on the software package name</p></li>";
                echo "<li class=\"warning-quote\"><p class=\"warning-quote\">Please be advised that these options are not the same as enabling and disabling a software package. These options are designed to either install or uninstall.</p></li>";
                echo "<li>";
                if (file_exists('/srv/rutorrent/home/.plex')) {
                  echo "<a href=\"javascript:void()\" data-toggle=\"modal\" data-target=\"#plexRemovalConfirm\">Plex Media Server : <span class=\"pull-right plgin-center-switch\"><img src=\"img/switch-installed.png\"></span></a>";
                } else {
                  echo "<a href=\"?installpackage-plex=true\" id=\"plexInstall\">Plex Media Server : <span class=\"pull-right plgin-center-switch\"><img src=\"img/switch-notinstalled.png\"></span></a>";
                }
                echo "</li>";
                echo "<li>";
                if (file_exists("/run/btsync/btsync.pid")) {
                  echo "<a href=\"javascript:void()\" data-toggle=\"modal\" data-target=\"#btsyncRemovalConfirm\">BTSync : <span class=\"pull-right plgin-center-switch\"><img src=\"img/switch-installed.png\"></span></a>";
                } else {
                  echo "<a href=\"?installpackage-btsync=true\" id=\"btsyncInstall\">BTSync : <span class=\"pull-right plgin-center-switch\"><img src=\"img/switch-notinstalled.png\"></span></a>";
                }
                echo "</li>";
              echo "</ul>";
            echo "</li>";
            } ?>
          </ul>
        </div><!-- tab pane -->

#3

ok thanks but i see that “$plexURL” but where are the info for this variable because i want to add another link with specifc port :8081 i just don’t know how to declare variable like


#4

ok i found i have to add another variable to config.php but when i add i put my new variable on my menu it’s not give me the port i see my variable on link can you help me


#5

You still need to add the link to the menu (which I am sure you did).

I would do something to this effect within the config.php.

$whateverURL = "http://" . $_SERVER['HTTP_HOST'] . ":8081";

Then call it in the menu

<li><a href=\"$whateverURL\"

If you want it showing according to it’s process running or not. It will need to have a pid or a way to read it’s process is active. That can be assigned by:

$whatever = processExists("whatever",whatever);

Where “whatever” is the name of the process and the second whatever is the username/owner of the process.

Then in your menu, you add:

<?php if (processExists("whatever",whatever) && ($username == "$master")) { echo "<li><a href=\"$whateverURL\" target=\"_blank\"><i class=\"fa fa-some_fa_icon\"></i> <span>Whatever</span></a></li>"; } ?>

If the process is running on port :8081 already and you simply want to add it to the menu, you could just hardcode it without trying to create php variables for it.

<?php if ($username == "$master")) { echo "<li><a href=\"http://" . $_SERVER['HTTP_HOST'] . ":8081\" target=\"_blank\"><i class=\"fa fa-some_fa_icon\"></i> <span>Whatever</span></a></li>"; } ?>

:information_source: Additionally,

keep in mind the link you are adding to the menu, whether you are setting these links as varibles or as hard links. Some software requires http:// only connections for their ports unless you do a considerable amount of adjustments, ie; creating port forward in apache, Plex is one such program. In turn, adding a https:// link on most :port values will break as the item is confused… “Do I use this port, or port 443?”


#6

Thanks you it’s working you are the best


#7

Wonderful news! Glad it’s all sorted :smiley: