Ejemplo n.º 1
0
function b_wfs_new_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB->prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfs = array();
            $title = $myts->makeTboxData4Show($myrow["title"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if (strlen($myrow['title']) >= $options[2]) {
                    $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
                }
            }
            $wfs['title'] = $title;
            $wfs['id'] = $myrow['articleid'];
            if ($options[0] == "published") {
                $wfs['new'] = formatTimestamp($myrow['published'], "s");
            } elseif ($options[0] == "counter") {
                $wfs['new'] = $myrow['counter'];
            }
            $block['new'][] = $wfs;
        }
    }
    return $block;
}
Ejemplo n.º 2
0
function b_wfs_down_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT fileid, filerealname, filetext ,articleid, fileshowname, date, ext, minetype, downloadname, counter, filedescript, groupid FROM " . $xoopsDB->prefix("wfs_files") . " ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfsd = array();
            $title = $myts->makeTboxData4Show($myrow["fileshowname"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if (strlen($myrow['fileshowname']) >= $options[2]) {
                    $title = $myts->makeTboxData4Show(substr($myrow['fileshowname'], 0, $options[2] - 1)) . "...";
                }
            }
            $wfsd['titledown'] = $title;
            $wfsd['iddown'] = $myrow['articleid'];
            if ($options[0] == "date") {
                $wfsd['date'] = formatTimestamp($myrow['date'], "s");
            } elseif ($options[0] == "counter") {
                $wfsd['date'] = $myrow['counter'];
            }
            $block['download'][] = $wfsd;
        }
    }
    return $block;
}
Ejemplo n.º 3
0
 function __construct()
 {
     parent::__construct();
     checkAccess();
     $this->load->helper('posts_helper');
     $this->load->library('m_security');
     $this->nocat();
     date_default_timezone_set('Asia/Jakarta');
 }
Ejemplo n.º 4
0
function form_newusr_post($raw,$data) {
	checkAccess();
	if ($data['f1']!=$data['f2']) return LocalError(WGSL("perr","Password error"));
	$x = WGCreateUser($data['login'],$data['f1'],$data['group']);
	if ($x) {
	        WGToast(WGSL("nus","User created"));
	        updateUserList();
	        WGSetActivity('main');
		} else LocalError(WGSL("nusc","User not created"));
	}
Ejemplo n.º 5
0
 public function init()
 {
     // Login required
     if (Yii::app()->getController()->id != 'login') {
         $returnUrl = Yii::app()->request->getUrl();
         if (strpos($returnUrl, '/admin') === false) {
             $returnUrl = array('/admin');
         }
         Yii::app()->user->setReturnUrl($returnUrl);
     }
     // Make sure we have access
     if (!Yii::app()->user->id || !checkAccess('admin')) {
         // Do we need to login
         if (!Yii::app()->user->id && Yii::app()->getController()->id != 'login') {
             $this->redirect(array('/admin/login'));
         }
         // Make sure we are not in login page
         if (Yii::app()->getController()->id != 'login') {
             throw new CHttpException(at('Sorry, You are not allowed to enter this section.'));
         }
     }
     // Make sure we have a valid admin user record
     if (Yii::app()->getController()->id != 'login' && Yii::app()->user->id && !AdminUser::model()->exists('userid=:id', array(':id' => Yii::app()->user->id))) {
         Yii::app()->user->logout();
         ferror(at('Your session expired. Please login.'));
         $this->redirect(array('/admin/login'));
     }
     // Check if we haven't clicked more then X amount of time
     $maxIdleTime = 60 * 60 * getParam('admin_logged_in_time', 5);
     // 5 hour default
     // Were we using an old session
     if (Yii::app()->getController()->id != 'login' && time() - $maxIdleTime > Yii::app()->session['admin_clicked']) {
         // Loguser out and redirect to login
         AdminUser::model()->deleteAll('userid=:id', array(':id' => Yii::app()->user->id));
         Yii::app()->user->logout();
         ferror(at('Your session expired. Please login.'));
         $this->redirect(array('/admin/login'));
     }
     // Delete old records
     AdminUser::model()->deleteAll('lastclick_time < :time', array(':time' => time() - $maxIdleTime));
     // Update only if this is not an ajax request
     if (!request()->isAjaxRequest) {
         // Update record info
         Yii::app()->session['admin_clicked'] = time();
         AdminUser::model()->updateAll(array('lastclick_time' => time(), 'location' => Yii::app()->getController()->id), 'userid=:id', array(':id' => Yii::app()->user->id));
     }
     // Add Breadcrumb
     $this->addBreadCrumb(at('Dashboard'), array('index/index'));
     parent::init();
 }
Ejemplo n.º 6
0
function startSession($privileged = false)
{
    if (session_id() === '') {
        $secure = true;
        $httponly = true;
        $path = APP_PATH;
        $domain = APP_DOMAIN;
        session_set_cookie_params(600, $path, $domain, $secure, $httponly);
        session_start();
        checkSessionActivity();
    }
    if ($privileged) {
        checkAccess();
    }
}
Ejemplo n.º 7
0
function validate_form()
{
    require_once 'fonctions.php';
    $_login = htmlspecialchars($_POST['log']);
    //    clean POST data
    $_passwd = htmlspecialchars($_POST['pwd']);
    //    clean POST data
    if (checkAccess($_login, $_passwd) === true) {
        return array('login' => $_login, 'connected' => '1');
    }
    if (basename($_SESSION['parentURL']) == 'admin.php') {
        $message = "Les informations de connexion ne sont pas correctes ou vous n'êtes pas autorisé à gérer les utilisateurs, veuillez réessayer !";
    } else {
        $message = "Les informations de connexion ne sont pas correctes, veuillez réessayer !";
    }
    return $message;
}
Ejemplo n.º 8
0
function delete($bookmarkID)
{
    $result = false;
    if ($bookmarkID != "") {
        include '../access.php';
        $access = checkAccess('n', 't');
        if ($access) {
            $user = new User();
            $username = $user->getUsername();
            include "../includes/bookmarks.php";
            if (b_belongs_to($bookmarkID, $username, "../")) {
                $result = delete_bookmark($bookmarkID, "../");
            }
        }
    }
    return $result;
}
Ejemplo n.º 9
0
function delete($folderID)
{
    $result = false;
    if ($folderID != "") {
        include '../access.php';
        $access = checkAccess('n', 't');
        if ($access) {
            $user = new User();
            $username = $user->getUsername();
            include "../includes/bookmarks.php";
            if (f_belongs_to($folderID, $username, "../")) {
                $resultArr = delete_folder($folderID, $username, "../");
                $result = $resultArr['success'];
            }
        }
    }
    return $result;
}
Ejemplo n.º 10
0
function b_wfs_artmenu($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT articleid, title, groupid FROM " . $xoopsDB->prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND offline = 0 AND noshowart = 1 ORDER BY weight ASC";
    $result = $xoopsDB->query($sql);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfsmenu2 = array();
            $nstitle = $myts->makeTboxData4Show($myrow["title"]);
            $nsid = $myts->makeTboxData4Show($myrow["articleid"]);
            $wfsmenu2['nstitle'] = $nstitle;
            $wfsmenu2['nsid'] = $nsid;
            $block['nsmenu'][] = $wfsmenu2;
        }
    }
    return $block;
}
Ejemplo n.º 11
0
function b_wfs_bigstory_show()
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $tdate = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
    $result = $xoopsDB->query("SELECT articleid, title, summary, groupid FROM " . $xoopsDB->prefix("wfs_article") . " WHERE published > " . $tdate . " AND published < " . time() . " AND (expired > " . time() . " OR expired = 0) AND noshowart = 0 AND offline = 0 ORDER BY counter DESC", 1, 0);
    list($farticleid, $ftitle, $fsummary, $fgroupid) = $xoopsDB->fetchRow($result);
    if (!$farticleid && !$ftitle) {
        $block['message'] = _MB_WFS_NOTYET;
    } else {
        if (checkAccess($fgroupid)) {
            $block['message'] = _MB_WFS_TMRSI;
            $block['story_title'] = $myts->makeTboxData4Show($ftitle);
            $block['story_summary'] = $myts->makeTboxData4Show($fsummary);
            $block['story_id'] = $farticleid;
        }
    }
    return $block;
}
Ejemplo n.º 12
0
function b_wfs_menu($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $result = $xoopsDB->query("SELECT id, title, pid, groupid FROM " . $xoopsDB->prefix("wfs_category") . " ORDER BY title ASC");
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfsmenu = array();
            $ctitle = $myts->makeTboxData4Show($myrow["title"]);
            $pid = $myts->makeTboxData4Show($myrow["pid"]);
            $id = $myts->makeTboxData4Show($myrow["id"]);
            if ($pid == '0') {
                $wfsmenu['ctitle'] = $ctitle;
                $wfsmenu['id'] = $id;
                $block['menus'][] = $wfsmenu;
            }
        }
    }
    return $block;
}
Ejemplo n.º 13
0
function syncResp($params)
{
    debug("incoming SYNC request");
    $lastSync = xmlrpc_decode($params->getParam(0));
    $nodeData = xmlrpc_decode($params->getParam(1));
    $objects = xmlrpc_decode($params->getParam(2));
    $neighbour = sotf_Neighbour::getById($nodeData['node_id']);
    if (!$neighbour) {
        logError("No access: you are not an allowed neighbour node!");
        return new xmlrpcresp(0, XMLRPC_ERR_NO_ACCESS, "No access: you are not an allowed neighbour node!");
    }
    $msg = checkAccess($neighbour);
    if ($msg) {
        logError($msg);
        return new xmlrpcresp(0, XMLRPC_ERR_NO_ACCESS, "No access: {$msg}!");
    }
    $retval = $neighbour->syncResponse($lastSync, $nodeData, $objects);
    // send response
    $retval = xmlrpc_encode($retval);
    return new xmlrpcresp($retval);
}
Ejemplo n.º 14
0
 public function init()
 {
     // Set theme if it's not default
     if (getParam('default_theme')) {
         Yii::app()->theme = getParam('default_theme');
     } else {
         Yii::app()->theme = 'site/default';
     }
     // Are we in maintenance mode
     if (getParam('maintenance_status')) {
         $canAccess = false;
         // Can we override?
         if (getParam('maintenance_roles_override') && count(explode(',', getParam('maintenance_roles_override')))) {
             $roles = explode(',', getParam('maintenance_roles_override'));
             foreach ($roles as $role) {
                 if (checkAccess($role)) {
                     $canAccess = true;
                     break;
                 }
             }
         }
         $theme = Yii::app()->theme->name . '.views.layouts.maintenance_mode';
         if (Yii::app()->theme->name != 'site') {
             $theme = 'themes.' . Yii::app()->theme->name . '.views.site.layouts.maintenance_mode';
         }
         // Do we show the message or not
         if (!$canAccess) {
             $this->layout = false;
             $this->render($theme);
             Yii::app()->end();
         }
         // We can access but show a message
         $this->title[] = t('Maintenance Mode');
     }
     parent::init();
 }
Ejemplo n.º 15
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GetBoo 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with GetBoo; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
***************************************************************************/
$sorting_script = true;
include 'header.php';
include 'access.php';
$access = checkAccess('a');
if ($access) {
    echo "<h2>" . T_("Settings") . " -- " . T_("Online Users") . "</h2>";
    echo "<p>" . sprintf(T_("You can see a list of users who have been active in the past %s minutes"), ONLINE_TIMEOUT / 60) . ".</p>\n";
    include 'conn.php';
    $Query = "select name, LastActivity as formatted_time from " . TABLE_PREFIX . "session where " . DATE_DIFF_SQL . " LastActivity) < " . ONLINE_TIMEOUT . " and status <> 'disabled' order by LastActivity";
    $dbResult = $dblink->query($Query);
    //echo($Query . "<br>");
    $count = 0;
    while ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
        if ($count == 0) {
            echo "<div class=\"content\"><table class='sortable'>\n<thead><tr><th>" . T_("User") . "</th><th>" . T_("Last Activity") . "</th></tr></thead><tbody>\n";
            require_once 'includes/convert_date.php';
        }
        $user_rec = "{$row["name"]}";
        $date1 = "{$row["formatted_time"]}";
Ejemplo n.º 16
0
include_once "./eval_conf.php";
# ATD - function.php must be included before get_context.php.  It defines some needed functions.
include_once "./functions.php";
include_once "./get_context.php";
include_once "./ganglia.php";
include_once "./get_ganglia.php";
include_once "./dwoo/dwooAutoload.php";
$resource = GangliaAcl::ALL_CLUSTERS;
if ($context == "grid") {
    $resource = $grid;
} else {
    if ($context == "cluster" || $context == "host") {
        $resource = $clustername;
    }
}
if (!checkAccess($resource, GangliaAcl::VIEW, $conf)) {
    header("HTTP/1.1 403 Access Denied");
    die("<html><head><title>Access Denied</title><body><h4>Sorry, you do not have access to this resource.</h4></body></html>");
}
try {
    $dwoo = new Dwoo($conf['dwoo_compiled_dir'], $conf['dwoo_cache_dir']);
} catch (Exception $e) {
    print "<H4>There was an error initializing the Dwoo PHP Templating Engine: " . $e->getMessage() . "<br><br>The compile directory should be owned and writable by the apache user.</H4>";
    exit;
}
# Useful for addons.
$GHOME = ".";
if ($context == "meta" or $context == "control") {
    $title = "{$self} {$meta_designator} Report";
    include_once "./header.php";
    include_once "./meta_view.php";
Ejemplo n.º 17
0
/* This program is free software. You can redistribute it and/or		*/
/* modify it under the terms of the GNU General Public License			*/
/* as published by the Free Software Foundation.						*/
/************************************************************************/
// $Id: index.php 7575 2008-06-02 18:17:14Z hwong $
define('AT_INCLUDE_PATH', '../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require 'lib/openmeetings.class.php';
require 'lib/openmeetings.inc.php';
//css
$_custom_css = $_base_path . 'mods/openmeetings/module.css';
// use a custom stylesheet
//local variables
$course_id = $_SESSION['course_id'];
// Check access
checkAccess($course_id);
//Header begins here
require AT_INCLUDE_PATH . 'header.inc.php';
//Initiate Openmeeting
$om_obj = new Openmeetings($course_id, $_SESSION['member_id']);
//Login
$om_obj->om_login();
//Handles form actions
if (isset($_GET['delete']) && isset($_GET['room_id'])) {
    //have to makesure the user really do have permission over the paramater room id
    $_GET['room_id'] = intval($_GET['room_id']);
    if ($om_obj->isMine($_GET['room_id'])) {
        $om_obj->om_deleteRoom($_GET['room_id']);
        $msg->addFeedback('OPENMEETINGS_DELETE_SUCEEDED');
    } else {
        $msg->addError('OPENMEETINGS_DELETE_FAILED');
Ejemplo n.º 18
0
</head>
<body>
  <div id="tabs-views-content">
    <?php
  }

  print "<form id=view_chooser_form>";
  
  if ( ! isset($_GET['just_graphs']) ) {

  ?>
    <table id="views_table">
    <tr><td valign=top>

  <?php
    if(  checkAccess( GangliaAcl::ALL_VIEWS, GangliaAcl::EDIT, $conf ) ) {
       print '<button onclick="return false" id=create_view_button>Create View</button>';
    }
    if ( ! isset($_GET['standalone']) && ! isset($_GET['just_graphs']) ) {
       print '<a href="views.php?standalone=1" id="detach-tab-button">Detach Tab</a>';
    }
  ?>
    <p>  <div id="views_menu">
      Existing views:
      <ul id="navlist">
    <?php

    # List all the available views
    foreach ( $available_views as $view_id => $view ) {
      $v = $view['view_name'];
      print '<li><a href="#" id=\'' . viewId($v) . '\' onClick="selectView(\'' . $v . '\'); return false;">' . $v . '</a></li>';
Ejemplo n.º 19
0
  }
}
*/
if (defined("USE_PDF") && USE_PDF && !defined('FPDF_VERSION')) {
    Warn($GLOBALS['I18N']->get('You are trying to use PDF support without having FPDF loaded'));
}
$this_doc = getenv("REQUEST_URI");
if (preg_match("#(.*?)/admin?\$#i", $this_doc, $regs)) {
    $check_pageroot = $pageroot;
    $check_pageroot = preg_replace('#/$#', '', $check_pageroot);
    if ($check_pageroot != $regs[1] && WARN_ABOUT_PHP_SETTINGS) {
        Warn($GLOBALS['I18N']->get('The pageroot in your config does not match the current locationCheck your config file.'));
    }
}
clearstatcache();
if (checkAccess($page, "") || $page == 'about') {
    if (empty($_GET['pi']) && (is_file($include) || is_link($include))) {
        # check whether there is a language file to include
        if (is_file("lan/" . $_SESSION['adminlanguage']['iso'] . "/" . $include)) {
            include "lan/" . $_SESSION['adminlanguage']['iso'] . "/" . $include;
        }
        if (is_file('ui/' . $GLOBALS['ui'] . '/pages/' . $include)) {
            $include = 'ui/' . $GLOBALS['ui'] . '/pages/' . $include;
        }
        #  print "Including $include<br/>";
        # hmm, pre-parsing and capturing the error would be nice
        #$parses_ok = eval(@file_get_contents($include));
        $parses_ok = 1;
        if (!$parses_ok) {
            print Error("cannot parse {$include}");
            print '<p class="error">Sorry, an error occurred. This is a bug. Please <a href="http://mantis.phplist.com">report the bug to the Bug Tracker</a><br/>Sorry for the inconvenience</a></p>';
Ejemplo n.º 20
0
require_once ".ht-inc/states.php";
require_once '.ht-inc/errors.php';
require_once '.ht-inc/utils.php';
dbConnect();
initGlobals();
$modes = array_keys($actions['mode']);
$args = array_keys($actions['args']);
$hasArg = 0;
if (in_array($mode, $modes)) {
    $actionFunction = $actions['mode'][$mode];
    if (in_array($mode, $args)) {
        $hasArg = 1;
        $arg = $actions['args'][$mode];
    }
} else {
    $actionFunction = "main";
}
checkAccess();
sendHeaders();
printHTMLHeader();
if ($viewmode == ADMIN_DEVELOPER) {
    set_error_handler("errorHandler");
}
if ($hasArg) {
    $actionFunction($arg);
} else {
    $actionFunction();
}
printHTMLFooter();
dbDisconnect();
semUnlock();
Ejemplo n.º 21
0
			fclose($fp);
		}
	}

        echo "<tr><td>".$maintext."<br /><br /><br /><hr /><br />";
        echo "<small><b>"._WFS_DATE."</b>&nbsp;".$datetime."<br /><b>"
        ._WFS_TOPICC."</b>&nbsp;".$story->categoryTitle()."<br /><b>"
        ._WFS_URLFORSTORY."</b>&nbsp;".XOOPS_URL."/modules/".$xoopsModule->dirname()."/article.php?articleid=".$story->articleid()
        ."</small><br /></td></tr>";
        echo "</td></tr></table></td></tr></table>\n
            </td></tr></table>
            </body>
            </html>
            ";
}
// --------------------------------------------------------

// main routine

// bug fix : you can print some articles you should NOT see
// PrintPage($articleid);
include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() .'/include/groupaccess.php';
$article = new WfsArticle($articleid);
if (checkAccess($article->groupid)) 
{	PrintPage($articleid);}
else
{	redirect_header("index.php", 2, _NOPERM);
	exit();
}

?>
Ejemplo n.º 22
0
 function __construct()
 {
     parent::__construct();
     checkAccess();
     $this->load->library(array('m_database', 'm_security'));
 }
Ejemplo n.º 23
0
  the Free Software Foundation, either version 3 of the License.

  This program 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 General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('MOVEDIR');
checkAccess('MOVEDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
verifyPath($newPath);
if (is_dir(fixPath($path))) {
    if (mb_strpos($newPath, $path) === 0) {
        echo getErrorRes(t('E_CannotMoveDirToChild'));
    } elseif (file_exists(fixPath($newPath) . '/' . basename($path))) {
        echo getErrorRes(t('E_DirAlreadyExists'));
    } elseif (rename(fixPath($path), fixPath($newPath) . '/' . basename($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_MoveDir') . ' ' . basename($path));
    }
} else {
Ejemplo n.º 24
0
    if ($col_index != 0) {
        for ($i = 0; $i < $num_cols * $num_cols - $num_hosts; $i++) {
            $heatmap .= ",{host:\"unused\",load:0}";
        }
        $heatmap .= ']';
    }
    $heatmap .= ']';
    $data->assign("heatmap_data", $heatmap);
}
$fn = "cluster_" . ($refresh ? "refresh" : "view") . ".tpl";
$tpl = new Dwoo_Template_File(template($fn));
$data = new Dwoo_Data();
if (!$refresh) {
    $data->assign("php_gd", function_exists('imagegif') or function_exists('imagepng'));
    $data->assign("extra", template("cluster_extra.tpl"));
    $data->assign("user_may_edit", checkAccess($clustername, GangliaAcl::EDIT, $conf));
    $data->assign("graph_engine", $conf['graph_engine']);
}
$data->assign("cluster", $clustername);
$data->assign("localtimestamp", $cluster['LOCALTIME']);
$data->assign("localtime", date("Y-m-d H:i", $cluster['LOCALTIME']));
get_cluster_overview($showhosts, $metrics, $cluster, $range, $clustername, $data);
$user_metricname = $user['metricname'];
if (!$showhosts) {
    if (array_key_exists($user_metricname, $metrics)) {
        $units = $metrics[$user_metricname]['UNITS'];
    }
} else {
    if (array_key_exists($user_metricname, $metrics[key($metrics)])) {
        if (isset($metrics[key($metrics)][$user_metricname]['UNITS'])) {
            $units = $metrics[key($metrics)][$user_metricname]['UNITS'];
Ejemplo n.º 25
0
 function processMenuElements(&$res)
 {
     startMeasure('processMenuElements');
     startMeasure('processMenuElements ' . $_SERVER['REQUEST_URI']);
     if ($this->action != 'admin') {
         $total = count($res);
         $res2 = array();
         for ($i = 0; $i < $total; $i++) {
             if (checkAccess('menu', $res[$i]['ID'])) {
                 $res2[] = $res[$i];
             }
         }
         $res = $res2;
         unset($res2);
     }
     $total = count($res);
     for ($i = 0; $i < $total; $i++) {
         // some action for every record if required
         if ($res[$i + 1]['INLINE']) {
             $res[$i]['INLINE'] = 1;
         }
         $item = $res[$i];
         if ($item['VISIBLE_DELAY']) {
             $out['VISIBLE_DELAYS']++;
         }
         if ($item['EXT_ID'] && $this->action != 'admin') {
             $visible_delay = $item['VISIBLE_DELAY'];
             $tmp = SQLSelectOne("SELECT * FROM commands WHERE ID='" . (int) $item['EXT_ID'] . "'");
             if ($tmp['ID']) {
                 $item = $tmp;
                 $item['VISIBLE_DELAY'] = $visible_delay;
                 $res[$i] = $item;
             }
         } elseif ($item['EXT_ID'] && $this->action == 'admin') {
             $tmp = SQLSelectOne("SELECT * FROM commands WHERE ID='" . (int) $item['EXT_ID'] . "'");
             if ($tmp['ID']) {
                 $item['TITLE'] = $item['TITLE'] . ' (' . $tmp['TITLE'] . ')';
                 $res[$i] = $item;
             }
         }
         if ($item['LINKED_PROPERTY'] != '') {
             $lprop = getGlobal($item['LINKED_OBJECT'] . '.' . $item['LINKED_PROPERTY']);
             if ($item['TYPE'] == 'custom') {
                 $field = 'DATA';
             } else {
                 $field = 'CUR_VALUE';
             }
             if ($lprop != $item[$field]) {
                 $item[$field] = $lprop;
                 SQLUpdate('commands', $item);
                 $res[$i] = $item;
             }
         }
         if ($item['TYPE'] == 'timebox') {
             $tmp = explode(':', $item['CUR_VALUE']);
             $value1 = (int) $tmp[0];
             $value2 = (int) $tmp[1];
             for ($h = 0; $h <= 23; $h++) {
                 $v = $h;
                 if ($v < 10) {
                     $v = '0' . $v;
                 }
                 $selected = 0;
                 if ($h == $value1) {
                     $selected = 1;
                 }
                 $item['OPTIONS1'][] = array('VALUE' => $v, 'SELECTED' => $selected);
             }
             for ($h = 0; $h <= 59; $h++) {
                 $v = $h;
                 if ($v < 10) {
                     $v = '0' . $v;
                 }
                 $selected = 0;
                 if ($h == $value2) {
                     $selected = 1;
                 }
                 $item['OPTIONS2'][] = array('VALUE' => $v, 'SELECTED' => $selected);
             }
             $res[$i] = $item;
         }
         if ($item['TYPE'] == 'switch') {
             if (trim($item['DATA'])) {
                 $data = explode("\n", str_replace("\r", "", $item['DATA']));
                 $item['OFF_VALUE'] = trim($data[0]);
                 $item['ON_VALUE'] = trim($data[1]);
             } else {
                 $item['OFF_VALUE'] = 0;
                 $item['ON_VALUE'] = 1;
             }
             $res[$i] = $item;
         }
         if ($item['TYPE'] == 'selectbox' || $item['TYPE'] == 'radiobox') {
             $data = explode("\n", str_replace("\r", "", $item['DATA']));
             $item['OPTIONS'] = array();
             $num = 1;
             foreach ($data as $line) {
                 $line = trim($line);
                 if ($line != '') {
                     $option = array();
                     if (preg_match('/=/', $line)) {
                         $tmp = explode('=', $line);
                     } else {
                         $tmp = explode('|', $line);
                     }
                     $option['VALUE'] = $tmp[0];
                     if ($tmp[1] != '') {
                         $option['TITLE'] = $tmp[1];
                     } else {
                         $option['TITLE'] = $option['VALUE'];
                     }
                     if ($option['VALUE'] == $item['CUR_VALUE']) {
                         $option['SELECTED'] = 1;
                     }
                     $option['NUM'] = $num;
                     $num++;
                     $item['OPTIONS'][] = $option;
                 }
             }
             $res[$i] = $item;
         }
         if ($this->owner->name != 'panel') {
             $res[$i]['TITLE'] = processTitle($res[$i]['TITLE'], $this);
             if ($res[$i]['TYPE'] == 'custom') {
                 $res[$i]['DATA'] = processTitle($res[$i]['DATA'], $this);
             }
             if (preg_match('/#[\\w\\d]{6}/is', $res[$i]['TITLE'], $m)) {
                 $color = $m[0];
                 $res[$i]['TITLE'] = trim(str_replace($m[0], '<style>#item' . $res[$i]['ID'] . ' .ui-btn-active {background-color:' . $color . ';border-color:' . $color . '}</style>', $res[$i]['TITLE']));
             }
             if ($res[$i]['RENDER_TITLE'] != $res[$i]['TITLE'] || $res[$i]['RENDER_DATA'] != $res[$i]['DATA']) {
                 $tmp = SQLSelectOne("SELECT * FROM commands WHERE ID='" . $res[$i]['ID'] . "'");
                 $tmp['RENDER_TITLE'] = $res[$i]['TITLE'];
                 $tmp['RENDER_DATA'] = $res[$i]['DATA'];
                 $tmp['RENDER_UPDATED'] = date('Y-m-d H:i:s');
                 SQLUpdate('commands', $tmp);
             }
         }
         if (preg_match('/<script/is', $res[$i]['DATA']) && $res[$i]['AUTO_UPDATE']) {
             $res[$i]['AUTO_UPDATE'] = 0;
         }
         $res[$i]['TITLE_SAFE'] = htmlspecialchars($res[$i]['TITLE']);
         /*
         foreach($res[$i] as $k=>$v) {
          if (!is_array($res[$i][$k]) && $k!='DATA') {
           $res[$i][$k]=addslashes($v);
          }
         }
         */
         $tmp = SQLSelectOne("SELECT COUNT(*) as TOTAL FROM commands WHERE PARENT_ID='" . $res[$i]['ID'] . "'");
         if ($tmp['TOTAL']) {
             $res[$i]['RESULT_TOTAL'] = $tmp['TOTAL'];
         }
         if ($res[$i]['SUB_PRELOAD'] && $this->action != 'admin') {
             $children = SQLSelect("SELECT * FROM commands WHERE PARENT_ID='" . $res[$i]['ID'] . "' ORDER BY PRIORITY DESC, TITLE");
             if ($children[0]['ID']) {
                 $this->processMenuElements($children);
                 if ($children[0]['ID']) {
                     $res[$i]['RESULT'] = $children;
                 }
             }
         }
     }
     endMeasure('processMenuElements ' . $_SERVER['REQUEST_URI'], 1);
     endMeasure('processMenuElements', 1);
 }
Ejemplo n.º 26
0
 function countByCategory($categoryid = 0)
 {
     $count = 0;
     $db =& Database::getInstance();
     $sql = "SELECT * FROM " . $db->prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND offline = 0";
     if ($categoryid != 0) {
         $sql .= " and categoryid={$categoryid} ";
     }
     $result = $db->query($sql);
     while ($myrow = $db->fetchArray($result)) {
         $groupid = $myrow['groupid'];
         if (checkAccess($groupid) == '1') {
             $count++;
         }
     }
     return $count;
 }
Ejemplo n.º 27
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GetBoo 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with GetBoo; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
***************************************************************************/
include 'header.php';
//TODO: redo with sorting javascript
include 'access.php';
$access = checkAccess();
if ($access) {
    include 'gheader.php';
    include 'conn.php';
    if (isset($_POST['group_id'])) {
        $group_id = $_POST['group_id'];
    }
    $btnUsername = "******";
    $btnDateJoin = "orderButtonNeutral";
    $btnPriv = "orderButtonNeutral";
    if (isset($_POST['orderby'])) {
        $strOrderBy = $_POST['orderby'];
        if ($strOrderBy == "name") {
            $btnUsername = "******";
        } else {
            if ($strOrderBy == "formatted_time") {
Ejemplo n.º 28
0
        $sql = "SELECT * FROM `access_codes` WHERE code='" . $a . "'";
        $status = mysqli_query($conn, $sql);
        $results = mysqli_fetch_assoc($status);
        if ($results["status"] == "used") {
            return "Access Code has been used.";
        } else {
            return "good";
        }
    } else {
        return "Access Code Does Not Exist";
        if (!mysqli_query($con, $query)) {
            die('Error: ' . mysqli_error($con));
        }
    }
}
$theResult = checkAccess($access);
if ($theResult !== "good") {
    echo $theResult;
} else {
    $sql = "INSERT INTO toscrape (eid, pass, name, email, gradyear, done) VALUES ('" . $eid . "', '" . $password . "', '" . $name . "', '" . $email . "', '" . $gradyear . "', '" . $done . "')";
    if (mysqli_query($conn, $sql)) {
        $update = "UPDATE `access_codes` SET status=\"used\" WHERE code=\"" . $access . "\"";
        if (mysqli_query($conn, $update)) {
            //Had to use curl- guess its reliable-----------------------
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "http://FRONTEND-SITE-HERE/sendingoff.php");
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_exec($ch);
            curl_close($ch);
            //------------------------------------------------------------
            echo "Success! You will recieve an email with your download link momentarily!";
Ejemplo n.º 29
0
//mes fonctions
include "./fonctions_edt.php";
include "./fonctions_calendrier.php";
// Resume session
$resultat_session = $session_gepi->security_check();
if ($resultat_session == 'c') {
    header("Location: ../utilisateurs/mon_compte.php?change_mdp=yes");
    die;
} else {
    if ($resultat_session == '0') {
        header("Location: ../logout.php?auto=1");
        die;
    }
}
// Check access
if (!checkAccess()) {
    header("Location: ../logout.php?auto=1");
    die;
}
// fonction  qui permet de convertir des heures en minutes
function convert_heures_minutes($heures)
{
    // explose les heures pour avoir un tableau heure, minute
    $tab_heure = explode(':', $heures);
    //combien de minute dans une heures ?
    $total_minute = floor($tab_heure[0] * 60);
    //combien de minutes total
    if (isset($tab_heure[1])) {
        $total_minute = $total_minute + $tab_heure[1];
    } else {
        $total_minute = $total_minute;
Ejemplo n.º 30
0
<?php

include_once "./eval_conf.php";
include_once "./functions.php";
include_once "./global.php";
include_once "./dwoo/dwooAutoload.php";
if (!checkAccess(GangliaAcl::ALL_VIEWS, GangliaAcl::VIEW, $conf)) {
    die("You do not have access to view views.");
}
$view_name = NULL;
if (isset($_GET['vn']) && !is_proper_view_name($_GET['vn'])) {
    ?>
<div class="ui-widget">
  <div class="ui-state-default ui-corner-all" styledefault="padding: 0 .7em;"> 
    <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
    View names valid characters are 0-9, a-z, A-Z, -, _ and space. View has not been created.</p>
  </div>
</div>
<?php 
    exit(0);
} else {
    $view_name = $_GET['vn'];
}
$viewList = new ViewList();
$dwoo = new Dwoo($conf['dwoo_compiled_dir'], $conf['dwoo_cache_dir']);
$tpl = new Dwoo_Template_File(template("view_content.tpl"));
$data = new Dwoo_Data();
$size = isset($clustergraphsize) ? $clustergraphsize : 'default';
// set to 'default' to preserve old behavior
if ($size == 'medium') {
    $size = 'default';