Exemplo n.º 1
0
 function web_AvailableDBBackupsList()
 {
     $backupsPath = DATA_PATH . 'backups/sql/';
     $availbacks = rcms_scandir($backupsPath);
     $result = __('No existing DB backups here');
     if (!empty($availbacks)) {
         $cells = wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('Size'));
         $cells .= wf_TableCell(__('Filename'));
         $cells .= wf_TableCell(__('Actions'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($availbacks as $eachDump) {
             $fileDate = filectime($backupsPath . $eachDump);
             $fileDate = date("Y-m-d H:i:s", $fileDate);
             $fileSize = filesize($backupsPath . $eachDump);
             $fileSize = stg_convert_size($fileSize);
             $encodedDumpPath = base64_encode($backupsPath . $eachDump);
             $downloadLink = wf_Link('?module=backups&download=' . $encodedDumpPath, $eachDump, false, '');
             $actLinks = wf_JSAlert('?module=backups&deletedump=' . $encodedDumpPath, web_delete_icon(), __('Removing this may lead to irreparable results')) . ' ';
             $actLinks .= wf_Link('?module=backups&download=' . $encodedDumpPath, wf_img('skins/icon_download.png', __('Download')), false, '');
             $actLinks .= wf_JSAlert('?module=backups&restore=true&restoredump=' . $encodedDumpPath, wf_img('skins/icon_restoredb.png', __('Restore DB')), __('Are you serious'));
             $cells = wf_TableCell($fileDate);
             $cells .= wf_TableCell($fileSize);
             $cells .= wf_TableCell($downloadLink);
             $cells .= wf_TableCell($actLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result = wf_TableBody($rows, '100%', '0', 'sortable');
     }
     return $result;
 }
Exemplo n.º 2
0
function show_small_image($id)
{
    global $system;
    $images = rcms_scandir(GALLERY_PATH);
    $gal = '';
    for ($i = 0; $i < count($images); $i++) {
        if (is_pict($images[$i])) {
            if ($id == $i) {
                $stat = getimagesize(GALLERY_PATH . $images[$id]);
                $w = $stat[0];
                $h = $stat[1];
                if ($w > 150) {
                    $x = $w / 150;
                    $h = $h / $x;
                    $w = 150;
                } elseif ($h > 150) {
                    $x = $h / 150;
                    $w = $w / $x;
                    $h = 150;
                }
                $gal .= '<a href="?module=gallery"><img src="' . GALLERY_PATH . $images[$id] . '" width="' . $w . '" height="' . $h . '" border=0></a>';
                $system->showMenuWindow('', $gal, 'center');
            }
        }
    }
}
Exemplo n.º 3
0
function ucm_get($id, $dir = MENU_MODULES_PATH)
{
    $dirs = rcms_scandir($dir, 'ucm.*');
    $workdir = $dir . 'ucm.' . $id;
    $return = array();
    if (is_dir($workdir)) {
        preg_match_all("/\\<\\?php show_window\\('(.*?)', (.*), '(.*?)'\\); \\?\\>/ims", file_get_contents($workdir . '/index.php'), $matches, PREG_SET_ORDER);
        $return = array($matches[0][1], file_get_contents($workdir . '/data.txt'), $matches[0][3]);
    }
    return $return;
}
Exemplo n.º 4
0
 /**
  * Returns selector of administrator logins
  * 
  * @param string $name
  * @param string $label
  * @return string
  */
 function web_EventsAdminSelector($name, $label = '')
 {
     $all = rcms_scandir(USERS_PATH);
     $alllogins = array('' => '-');
     if (!empty($all)) {
         foreach ($all as $each) {
             $alllogins[$each] = $each;
         }
     }
     $result = wf_Selector($name, $alllogins, $label, '', false);
     return $result;
 }
Exemplo n.º 5
0
function fupload_get_list($dir = FILES_PATH)
{
    $sd = rcms_scandir($dir);
    $i = 0;
    $return = array();
    foreach ($sd as $file) {
        $return[$i]['name'] = $file;
        $return[$i]['size'] = filesize($dir . $file);
        $return[$i]['mtime'] = filemtime($dir . $file);
        $i++;
    }
    return $return;
}
Exemplo n.º 6
0
function user_skin_select($dir, $select_name, $default = '', $style = '', $script = '')
{
    $skins = rcms_scandir($dir);
    $frm = '<select name="' . $select_name . '" style="' . $style . '" ' . $script . '>';
    foreach ($skins as $skin) {
        if (is_dir($dir . $skin) && is_file($dir . $skin . '/skin_name.txt')) {
            $name = file_get_contents($dir . $skin . '/skin_name.txt');
            $frm .= '<option value="' . $skin . '"' . ($default == $skin ? ' selected="selected">' : '>') . $name . '</option>';
        }
    }
    $frm .= '</select>';
    return $frm;
}
Exemplo n.º 7
0
function gallery_delete_comment($id, $cid)
{
    $images = rcms_scandir(GALLERY_PATH);
    if ($data = @file_get_contents(GALLERY_PATH . $images[$id] . '.cm')) {
        $data = unserialize($data);
    } else {
        return false;
    }
    if (isset($data[$cid])) {
        unset($data[$cid]);
        file_write_contents(GALLERY_PATH . $images[$id] . '.cm', serialize($data));
    }
    return true;
}
Exemplo n.º 8
0
function ucm_list()
{
    $files = rcms_scandir(DF_PATH, '*.ucm');
    $return = array();
    foreach ($files as $filename) {
        $file = file(DF_PATH . $filename);
        $title = preg_replace("/[\n\r]+/", '', $file[0]);
        $align = preg_replace("/[\n\r]+/", '', $file[1]);
        unset($file[0]);
        unset($file[1]);
        $return[substr($filename, 0, -4)] = array($title, implode('', $file), $align);
        $file = '';
    }
    return $return;
}
Exemplo n.º 9
0
 function dhcp_show_templates()
 {
     $allTemplates = rcms_scandir(CONFIG_PATH . 'dhcp/');
     $result = '';
     if (!empty($allTemplates)) {
         foreach ($allTemplates as $each) {
             $templateData = file_get_contents(CONFIG_PATH . 'dhcp/' . $each);
             $templateData = nl2br($templateData);
             $result .= wf_modal($each, $each, $templateData, 'ubButton', 800, 600);
         }
     } else {
         $result = __('Nothing found');
     }
     show_window(__('Global templates'), $result);
 }
Exemplo n.º 10
0
 /**
  * Returns array containing all SMS queue data as index=>data
  * 
  * @return array
  */
 public function getQueueData()
 {
     $result = array();
     $smsQueue = rcms_scandir(self::QUEUE_PATH);
     if (!empty($smsQueue)) {
         foreach ($smsQueue as $io => $eachsmsfile) {
             $smsDate = date("Y-m-d H:i:s", filectime(self::QUEUE_PATH . $eachsmsfile));
             $smsData = rcms_parse_ini_file(self::QUEUE_PATH . $eachsmsfile);
             $result[$io]['filename'] = $eachsmsfile;
             $result[$io]['date'] = $smsDate;
             $result[$io]['number'] = $smsData['NUMBER'];
             $result[$io]['message'] = $smsData['MESSAGE'];
         }
     }
     return $result;
 }
Exemplo n.º 11
0
function show_smiles($data)
{
    $form = '';
    if (!smiles_disabled()) {
        $smile = parse_ini_file(CONFIG_PATH . 'smiles.ini');
        $res = rcms_scandir(SMILES_PATH);
        sort($res);
        foreach ($res as $key) {
            if (isset($smile[$key])) {
                $form .= '<img src="' . SMILES_PATH . $key . '" value="' . basename($key, ".gif") . '" alt = "' . basename($key, ".gif") . '" onclick="document.forms[\'' . $data[0] . '\'].elements[\'' . $data[1] . '\'].value += \'[' . basename($key, ".gif") . ']\'">' . "\n";
            }
        }
        if ($form !== '') {
            $form = '<hr>' . $form . '<hr>';
        }
    }
    echo $form;
}
Exemplo n.º 12
0
 /**
  * Returns array containing all emails queue data as index=>data
  * 
  * @return array
  */
 public function getQueueData()
 {
     $result = array();
     $messagesQueue = rcms_scandir(self::QUEUE_PATH);
     if (!empty($messagesQueue)) {
         foreach ($messagesQueue as $io => $eachmessage) {
             $messageDate = date("Y-m-d H:i:s", filectime(self::QUEUE_PATH . $eachmessage));
             $messageData = file_get_contents(self::QUEUE_PATH . $eachmessage);
             $messageData = json_decode($messageData, true);
             $result[$io]['filename'] = $eachmessage;
             $result[$io]['date'] = $messageDate;
             $result[$io]['email'] = $messageData['email'];
             $result[$io]['subj'] = $messageData['subj'];
             $result[$io]['message'] = $messageData['message'];
         }
     }
     return $result;
 }
Exemplo n.º 13
0
 /**
  * Returns available administrators list
  * 
  * @return string
  */
 function web_list_admins()
 {
     $alladmins = rcms_scandir(USERS_PATH);
     $cells = wf_TableCell(__('Admin'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($alladmins)) {
         foreach ($alladmins as $eachadmin) {
             $actions = wf_JSAlert('?module=permissions&delete=' . $eachadmin, web_delete_icon(), 'Removing this may lead to irreparable results');
             $actions .= wf_Link('?module=permissions&passwd=' . $eachadmin, web_key_icon());
             $actions .= wf_Link('?module=permissions&edit=' . $eachadmin, web_edit_icon('Rights'));
             $cells = wf_TableCell($eachadmin);
             $cells .= wf_TableCell($actions);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $form = wf_TableBody($rows, '100%', '0', 'sortable');
     return $form;
 }
Exemplo n.º 14
0
function checkrights($el, $rec = false)
{
    $perms = show_perms($el);
    if (is_readable($el) && is_writeable($el)) {
        $color = 'green';
    } else {
        $color = 'red';
    }
    echo '
<tr>
    <td width="100%" class="row1" style="color: ' . $color . '">' . $el . '</td>
    <td class="row2" nowrap>' . show_perms($el) . '</td>
</tr>';
    if (is_dir($el) && $rec) {
        $dir = rcms_scandir($el);
        foreach ($dir as $del) {
            checkrights($el . '/' . $del, true);
        }
    }
}
Exemplo n.º 15
0
function rcms_parse_menu($format)
{
    global $lang;
    $modules_dir = rcms_scandir(MODULES_PATH);
    $enabled = parse_ini_file(CONFIG_PATH . 'modules.ini');
    $additional = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
    $result = '';
    $MODULES = array();
    foreach ($enabled as $module) {
        if (file_exists(MODULES_PATH . $module . '/module.php')) {
            include MODULES_PATH . $module . '/module.php';
        }
    }
    foreach ($MODULES as $module) {
        $result .= str_replace('{link}', '?module=' . $module['id'], str_replace('{title}', $module['name'], $format));
    }
    foreach ($additional as $link) {
        $result .= str_replace('{link}', @$link['url'], str_replace('{title}', @$link['name'], $format));
    }
    return $result;
}
Exemplo n.º 16
0
/**
 * Returns list of all available SNMP device templates
 * 
 * @return array
 */
function sp_SnmpGetAllModelTemplates()
{
    $path = CONFIG_PATH . "snmptemplates/";
    $alltemplates = rcms_scandir($path);
    $result = array();
    if (!empty($alltemplates)) {
        foreach ($alltemplates as $each) {
            $result[$each] = rcms_parse_ini_file($path . $each, true);
        }
    }
    return $result;
}
Exemplo n.º 17
0
</tr>
<tr>
    <td class="row1" colspan="2">
        <input type="checkbox" name="remember" id="remember" value="1" />
        <label for="remember">' . __('Remember me') . '</label>
    </td>
</tr>
<tr>
    <td class="row2" colspan="2"><input type="submit" value="' . __('Log in') . '" /></td>
</tr>
</table>
</form>';
    include ADMIN_PATH . 'error.php';
} elseif (empty($rights) && !$root) {
    $message = __('You are not administrator of this site');
    include ADMIN_PATH . 'error.php';
} else {
    $categories = rcms_scandir(ADMIN_PATH . 'modules', '', 'dir');
    $MODULES = array();
    foreach ($categories as $category) {
        if (file_exists(ADMIN_PATH . 'modules/' . $category . '/module.php')) {
            include_once ADMIN_PATH . 'modules/' . $category . '/module.php';
        }
    }
    $title = __('Administration');
    if (!empty($_GET['id'])) {
        $arr = explode('.', $_GET['id']);
        $title .= ' - ' . $MODULES[$arr[0]][0];
    }
    require_once ADMIN_SKIN . 'skin.general.php';
}
Exemplo n.º 18
0
 /**
  * Flushes all users alert cache
  * 
  * @return void
  */
 public function flushCache()
 {
     $allCache = rcms_scandir(self::CACHE_PATH, self::CACHE_PREFIX . '*', 'file');
     if (!empty($allCache)) {
         foreach ($allCache as $io => $each) {
             @unlink(self::CACHE_PATH . $each);
         }
     }
 }
Exemplo n.º 19
0
    $frm->hidden('save', '1');
    $frm->hidden('c', $c);
    $frm->hidden('a', $a);
    $frm->hidden('b', $b);
    if ($c !== '#root' && $c !== '#hidden') {
        $frm->addrow(__('Select category'), $frm->select_tag('nb', $categories_list, $article['catid']), 'top');
    }
    $frm->addrow(__('Title'), $frm->text_box('title', $article['title']), 'top');
    $frm->addrow(__('Author/source'), $frm->text_box('source', $article['src']), 'top');
    $frm->addrow(__('Keywords'), $frm->text_box('keywords', @$article['keywords']), 'top');
    $frm->addrow(__('Description for search engines'), $frm->text_box('sef_desc', @$article['sef_desc']), 'top');
    $frm->addrow('', rcms_show_bbcode_panel('arted.description'));
    $frm->addrow(__('Short description') . '<br />' . tinymce_selector('description', false), $frm->textarea('description', $article['desc'], 70, 5), 'top');
    $frm->addrow('', rcms_show_bbcode_panel('arted.text'));
    $frm->addrow(__('Text') . '<br />' . tinymce_selector('text', false), $frm->textarea('text', $article['text'], 70, 25), 'top');
    $files = rcms_scandir(FILES_PATH);
    //Start Insert list uploaded files
    $key_thumb = array_search('_thumb', $files);
    if ($key_thumb !== FALSE) {
        unset($files[$key_thumb]);
    }
    if (!empty($files)) {
        $frm->addrow(__('Add link to file'), $frm->select_tag('files', $files, -1, 'onChange="selChange(this.form)">\\n
	<option value="-1">' . __('Select file') . '</option') . '&nbsp;&nbsp;&nbsp;' . __('You entered filename of file uploaded through upload interface'), 'top');
    }
    //End Insert list uploaded files
    if ($system->checkForRight('GENERAL')) {
        $arr_modes = array('html' => __('HTML'), 'text' => __('Text'), 'htmlbb' => __('bbCodes') . '+' . __('HTML'), 'php' => __('PHP'));
    } else {
        $arr_modes = array('html' => __('HTML'), 'text' => __('Text'), 'htmlbb' => __('bbCodes') . '+' . __('HTML'));
    }
Exemplo n.º 20
0
 /**
  * Renders PON signal from cache
  * 
  * @return string
  */
 protected function getPonSignalControl()
 {
     $result = '';
     $searched = __('No');
     $sigColor = '#000000';
     if ($this->alterCfg['SIGNAL_IN_PROFILE']) {
         $query = "SELECT `mac`,`oltid` FROM `pononu` WHERE `login`='" . $this->login . "'";
         $onu_data = simple_query($query);
         if (!empty($onu_data)) {
             $availCacheData = rcms_scandir(PONizer::SIGCACHE_PATH, $onu_data['oltid'] . "_" . PONizer::SIGCACHE_EXT);
             if (!empty($availCacheData)) {
                 foreach ($availCacheData as $io => $each) {
                     $raw = file_get_contents(PONizer::SIGCACHE_PATH . $each);
                     $raw = unserialize($raw);
                     foreach ($raw as $mac => $signal) {
                         if ($mac == $onu_data['mac']) {
                             if ($signal > 0 or $signal < -25) {
                                 $sigColor = '#ab0000';
                             } else {
                                 $sigColor = '#005502';
                             }
                             $searched = $signal;
                         }
                     }
                 }
             }
             $cells = wf_TableCell(__("ONU Signal"), '30%', 'row2');
             $cells .= wf_TableCell(wf_tag('strong') . wf_tag('font color=' . $sigColor, false) . $searched . wf_tag('font', true) . wf_tag('strong', true));
             $rows = wf_TableRow($cells, 'row3');
             $result = wf_TableBody($rows, '100%', '0');
         }
     }
     return $result;
 }
Exemplo n.º 21
0
 /**
  * Renders available reports list
  * 
  * @return string
  */
 function web_ReportMasterShowReportsList()
 {
     $messages = new UbillingMessageHelper();
     $reports_path = DATA_PATH . "reports/";
     $allreports = rcms_scandir($reports_path);
     $cells = wf_TableCell(__('Report name'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allreports)) {
         foreach ($allreports as $eachreport) {
             $report_template = rcms_parse_ini_file($reports_path . $eachreport);
             $cells = wf_TableCell(wf_Link('?module=reportmaster&view=' . $eachreport, __($report_template['REPORT_NAME'])));
             $actControls = wf_JSAlert('?module=reportmaster&delete=' . $eachreport, web_delete_icon(), $messages->getDeleteAlert());
             $actControls .= wf_JSAlert('?module=reportmaster&edit=' . $eachreport, web_edit_icon(), $messages->getEditAlert());
             $cells .= wf_TableCell($actControls);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', 0, 'sortable');
     return $result;
 }
Exemplo n.º 22
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!defined('SKINS_MANAGE_DIR')) {
    define('SKINS_MANAGE_DIR', dirname(__FILE__) . '/skins/');
}
// Interface generation
if (isset($_POST['edit'])) {
    include SKINS_MANAGE_DIR . $_POST['edit'];
} else {
    $frm = new InputForm('', 'post', __('Submit'), __('Reset'));
    $frm->addbreak(__('Skins configuration'));
    $menus = rcms_scandir(SKINS_MANAGE_DIR);
    foreach ($menus as $id => $menu) {
        $frm->addrow(__('Skin') . ':  ' . str_replace('.php', '', $menu), $frm->radio_button('edit', array($menu => __('Edit'))));
    }
    $frm->show();
}
Exemplo n.º 23
0
} else {
    $frm = new InputForm('', 'post', __('Submit'), '', '', '', 'mainfrm');
    $frm->addbreak(__('Information') . ' sitemap');
    if (is_file(RCMS_ROOT_PATH . 'sitemap.xml')) {
        $frm->addrow(__('Look at') . '&nbsp;<a href="sitemap.xml" target="_blank"> sitemap.xml  </a> ');
    }
    $frm->addrow(__('Sitemap will be created for all news (except hidden).') . '<br/><a href="http://www.google.com/support/webmasters/bin/answer.py?answer=40318&topic=13450">' . __('Read more about Google Sitemap') . '</a>.<br/><a href="http://www.google.com/webmasters/">' . __('Register here') . '</a>.<br/>');
    $frm->addbreak(__('Configuration') . ' robots.txt');
    $frm->hidden('create', '1');
    $frm->addrow(__('Content of') . ' robots.txt', $frm->textarea('robots_txt', @file_get_contents(RCMS_ROOT_PATH . 'robots.txt'), 80, 10), 'top');
    $frm->addrow(__('Build new') . ' robots.txt. ', $frm->checkbox('robots', 'true', __('Check if you build robots.txt first time'), false));
    $frm->addbreak(__('Configuration') . ' sitemap');
    $frm->addrow(__('Content of') . ' sitemap.dat<br/><br/>' . __('Add new urls to') . ' sitemap.xml:<br/><br/>(' . __('Example') . ')<br/> index.htm <br/> default.htm<br/> uploads/price.zip<br/>', $frm->textarea('sitemap_dat', @file_get_contents(DF_PATH . 'sitemap.dat'), 80, 10), 'top');
    $sitemap = new SitemapGenerator($directory);
    //Include all sitemap modules in current directory, except 'module.php'&'sitemap.php'
    $modules = rcms_scandir(dirname(__FILE__) . '/sitemap/');
    foreach ($modules as $file) {
        if (basename($file) != 'module.php' and basename($file) != 'sitemap.php') {
            $module = str_replace('.php', '', $file);
            if (isset($config[$module])) {
                $prio = $config[$module]['priority'];
                $chfr = $config[$module]['changefreq'];
            } else {
                $prio = '0.5';
                $chfr = 'weekly';
            }
            include_once 'sitemap/' . $file;
            $frm->addrow($name_module, $frm->checkbox('names[]', $module, __('Add'), @$config[$module]) . '&nbsp;&nbsp;&nbsp;' . $frm->select_tag('priority[' . $module . ']', $priority, $prio) . __('Priority') . '&nbsp;&nbsp;&nbsp;' . $frm->select_tag('changefreq[' . $module . ']', $changefreq, $chfr) . __('Changefreq'));
        }
    }
    $frm->addrow(__('Pack file to') . '&nbsp;sitemap.xml.gz', $frm->checkbox('gz', '1', __('Build new'), true));
Exemplo n.º 24
0
 function getImages($directory)
 {
     $directory = rcms_scandir($directory);
     $images = array();
     foreach ($directory as $file) {
         if (preg_match($this->img_preg, $file)) {
             $images[] = $file;
         }
     }
     return $images;
 }
Exemplo n.º 25
0
 function logMergeByMonth()
 {
     $logs = rcms_scandir($this->logging);
     $d = date('d');
     $m = date('m');
     $Y = date('Y');
     $merged = array();
     foreach ($logs as $log_entry) {
         if (preg_match("/^(.*?)-(.*?)-(.*?)\\.log(|.gz)\$/i", $log_entry, $matches)) {
             $t = date('t', mktime(0, 0, 0, $matches[2], $matches[3], $matches[1]));
             if (!in_array($matches[1] . '-' . $matches[2], $merged) && ($matches[2] != $m || $matches[1] != $Y)) {
                 $this->logMerge($matches[1] . '-' . $matches[2], $t, $matches[2], $matches[1], 1, $matches[2], $matches[1]);
                 $merged[] = $matches[1] . '-' . $matches[2];
             }
         }
     }
     return true;
 }
Exemplo n.º 26
0
 function web_PayFindCashierSelector()
 {
     $alladmins = rcms_scandir(USERS_PATH);
     $adminlist = array();
     $result = '';
     if (!empty($alladmins)) {
         foreach ($alladmins as $nu => $login) {
             $adminlist[$login] = $login;
         }
         $result = wf_Selector('cashier', $adminlist, __('Cashier'), '', true);
     }
     return $result;
 }
Exemplo n.º 27
0
/**
 * Returns custom style background code
 * 
 * @return string
 */
function zbs_CustomBackground()
{
    $usConf = zbs_LoadConfig();
    $tilesPath = 'tiles/';
    $result = '';
    if (isset($usConf['BACKGROUND'])) {
        if ($usConf['BACKGROUND'] != 'DEFAULT' and !empty($usConf['BACKGROUND'])) {
            $customBackground = $usConf['BACKGROUND'];
            $availTiles = rcms_scandir($tilesPath);
            $availTiles = array_flip($availTiles);
            if ($customBackground == 'RANDOM') {
                $customBackground = array_rand($availTiles);
            }
            if (isset($availTiles[$customBackground])) {
                $result = '<style> body { background: #080808 url(' . $tilesPath . '/' . $customBackground . ') repeat; } </style> ';
            } else {
                $result = '<!-- Custom background tile file not found -->';
            }
        }
    }
    return $result;
}
Exemplo n.º 28
0
function zb_NewMacShow()
{
    global $ubillingConfig;
    $billing_config = $ubillingConfig->getBilling();
    $alter_config = $ubillingConfig->getAlter();
    $allarp = array();
    $sudo = $billing_config['SUDO'];
    $cat = $billing_config['CAT'];
    $grep = $billing_config['GREP'];
    $tail = $billing_config['TAIL'];
    $alter_conf = parse_ini_file(CONFIG_PATH . 'alter.ini');
    $leases = $alter_conf['NMLEASES'];
    $leasemark = $alter_conf['NMLEASEMARK'];
    $command = $sudo . ' ' . $cat . ' ' . $leases . ' | ' . $grep . ' "' . $leasemark . '" | ' . $tail . ' -n 200';
    $rawdata = shell_exec($command);
    $allusedMacs = zb_getAllUsedMac();
    $result = '';
    //fdb cache preprocessing
    $fdbData_raw = rcms_scandir('./exports/', '*_fdb');
    if (!empty($fdbData_raw)) {
        $fdbArr = sn_SnmpParseFdbCacheArray($fdbData_raw);
        $fdbColumn = true;
    } else {
        $fdbArr = array();
        $fdbColumn = false;
    }
    $cells = wf_TableCell(__('MAC'));
    if (!empty($fdbColumn)) {
        $cells .= wf_TableCell(__('Switch'));
    }
    if ($alter_config['MACVEN_ENABLED']) {
        $cells .= wf_TableCell(__('Manufacturer'));
    }
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($rawdata)) {
        $cleardata = exploderows($rawdata);
        foreach ($cleardata as $eachline) {
            preg_match('/[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}/i', $eachline, $matches);
            if (!empty($matches)) {
                $allarp[] = $matches[0];
            }
        }
        $un_arr = array_unique($allarp);
        if (!empty($un_arr)) {
            if ($alter_config['MACVEN_ENABLED']) {
                //adding ajax loader
                $result .= wf_AjaxLoader();
            }
            foreach ($un_arr as $io => $eachmac) {
                if (zb_checkMacFree($eachmac, $allusedMacs)) {
                    $cells = wf_TableCell(@$eachmac);
                    if (!empty($fdbColumn)) {
                        $cells .= wf_TableCell(sn_SnmpParseFdbExtract(@$fdbArr[$eachmac]));
                    }
                    if ($alter_config['MACVEN_ENABLED']) {
                        $containerName = 'NMRSMCNT_' . zb_rand_string(8);
                        $lookupVendorLink = wf_AjaxLink('?module=macvendor&mac=' . @$eachmac . '&raw=true', wf_img('skins/macven.gif', __('Device vendor')), $containerName, false, '');
                        $lookupVendorLink .= wf_tag('span', false, '', 'id="' . $containerName . '"') . '' . wf_tag('span', true);
                        $cells .= wf_TableCell($lookupVendorLink, '350');
                    }
                    $rows .= wf_TableRow($cells, 'row3');
                }
            }
        }
    }
    $result .= wf_TableBody($rows, '100%', '0', 'sortable');
    return $result;
}
Exemplo n.º 29
0
 </th>
    <th style="white-space:pre"> <?php 
echo __('Size of file');
?>
 </th>
    <th style="white-space:pre"> <?php 
echo __('Date');
?>
 </th>
    <th style="white-space:pre" colspan="2"> <?php 
echo __('Manage');
?>
 </th>
</tr>
<?php 
$elements = rcms_scandir($user_path, '', 'all', true);
$dirs = array();
$files = array();
foreach ($elements as $file) {
    if (@is_dir($user_path . $file)) {
        $dirs[] = $file;
    } else {
        $files[] = $file;
    }
}
natsort($dirs);
natsort($files);
$elements = array_merge($dirs, $files);
foreach ($elements as $file) {
    $filename = $user_path . $file;
    $filedata = @stat($filename);
Exemplo n.º 30
0
/**
 * Return contact list 
 * 
 * @return string
 */
function im_ContactList()
{
    $me = whoami();
    @($employeeNames = unserialize(ts_GetAllEmployeeLoginsCached()));
    $alladmins = rcms_scandir(DATA_PATH . "users/");
    $activeAdmins = im_GetActiveAdmins();
    $result = '';
    $rows = '';
    if (!empty($alladmins)) {
        foreach ($alladmins as $eachadmin) {
            if ($eachadmin != $me) {
                //need checks for unread messages for each user
                if (wf_CheckGet(array('checknew'))) {
                    $unreadCounter = im_CheckForUnreadMessagesByUser($eachadmin);
                    if ($unreadCounter != 0) {
                        $blinker = wf_img('skins/icon_mail.gif');
                    } else {
                        $blinker = '';
                    }
                } else {
                    $blinker = '';
                }
                if (isset($activeAdmins[$eachadmin])) {
                    $aliveFlag = web_bool_led(true);
                } else {
                    $aliveFlag = web_bool_led(false);
                }
                $conatactAvatar = gravatar_ShowAdminAvatar($eachadmin, '32') . ' ';
                $adminName = isset($employeeNames[$eachadmin]) ? $employeeNames[$eachadmin] : $eachadmin;
                $threadLink = wf_AjaxLink("?module=ubim&showthread=" . $eachadmin, $adminName . ' ' . $blinker, 'threadContainer', false, 'ubimcontact');
                //$threadLink.=$blinker;
                $cells = wf_TableCell($aliveFlag, '', '', 'valign="center" align="center"');
                $cells .= wf_TableCell($conatactAvatar, '35', '', 'valign="center" align="left"');
                $cells .= wf_TableCell($threadLink, '', '', 'valign="center" align="left"');
                $rows .= wf_TableRow($cells, '');
            }
        }
        $result = wf_TableBody($rows, '100%', '0', 'glamour');
        $result .= wf_delimiter() . wf_Link("?module=ubim&avatarcontrol=true", __('Avatar control'), false, 'ubButton');
    }
    return $result;
}