Ejemplo n.º 1
0
function ValidTime($t)
{
    $temptime = split('[:]', $t);
    $hour = $temptime[0];
    $minute = $temptime[1];
    $second = @$temptime[2];
    /* MAY NOT EXIST */
    if (!IS_NULL($hour) && (!IS_NUMERIC($hour) || $hour < 0 || $hour > 60)) {
        return False;
    }
    if (!IS_NULL($minute) && (!IS_NUMERIC($minute) || $minute < 0 || $minute > 60)) {
        return False;
    }
    if (!IS_NULL($second) && (!IS_NUMERIC($second) || $second < 0 || $second > 60)) {
        return False;
    }
    return True;
}
Ejemplo n.º 2
0
 public function Query($sql)
 {
     /* GLOBAL DATABASE OBJECT */
     $db = $GLOBALS['db'];
     /* EXECUTE THE ENTIRE QUERY WITHOUT LIMITING THE RECORDS */
     $full_result = $db->Query($sql);
     /* COUNT THE NUMBER OF ROWS FOUND */
     $this->num_rows_found = $db->NumRows($full_result);
     /* STORE THE COLUMN NAMES */
     $this->get_col_names = $db->GetColumns($full_result);
     /* DO SOME FILTERING - NOT IMPLEMENTED */
     if (isset($_GET['col_sort'])) {
         //$sql.="ORDER BY ".$this->get_col_names[$_GET['col_sort']];
     }
     /* DETERMINE THE OFFSET */
     if (isset($_GET['offset']) && IS_NUMERIC($_GET['offset']) && $_GET['offset'] < $this->num_rows_found) {
         $this->offset = $_GET['offset'];
         $this->start_offset = 0;
         $this->sql_start_offset = $_GET['offset'];
     } else {
         $this->start_offset = 10;
         $this->offset = 10;
         $this->sql_start_offset = 0;
     }
     /* APPEND A LIMIT TO THE QUERY */
     $sql .= " LIMIT " . $this->sql_start_offset . "," . $this->limit;
     //echo $sql;
     $result = $db->Query($sql);
     $this->count_rows = 0;
     $result = $db->Query($sql);
     //$this->cols=pg_fetch_all_columns($result);
     if ($db->NumRows($result) > 0) {
         while ($row = $db->FetchArray($result)) {
             for ($i = 0; $i < count($this->cols); $i++) {
                 $this->temp_col_data[$this->count_rows][$i] = $row[$this->cols[$i]];
             }
             $this->count_rows++;
         }
     } else {
         $this->display_data .= "<tr>\n";
         $this->display_data .= "<td colspan='" . count($this->friendly_cols) . "'><div id='nodata'>No data exists</div></td>\n";
         $this->display_data .= "</tr>\n";
     }
 }
Ejemplo n.º 3
0
 public function Info($module_id)
 {
     $db = $GLOBALS['db'];
     $this->module_id = $module_id;
     if (!IS_NUMERIC($module_id)) {
         $this->Errors("Non numeric module ID");
         return False;
     }
     $sql = "SELECT name,description,available_teamspaces,logo,signup_module,introduction,available_all_workspaces,anonymous_access\n\t\t\t\t\tFROM " . $GLOBALS['database_prefix'] . "core_module_master\n\t\t\t\t\tWHERE module_id = " . $this->module_id . "\n\t\t\t\t\t";
     //echo $sql;
     $result = $db->Query($sql);
     if ($db->NumRows($result) > 0) {
         while ($row = $db->FetchArray($result)) {
             /* HERE WE CALL THE FIELDS AND SET THEM INTO DYNAMIC VARIABLES */
             $arr_cols = $db->GetColumns($result);
             for ($i = 1; $i < count($arr_cols); $i++) {
                 $col_name = $arr_cols[$i];
                 $this->{$col_name} = $row[$col_name];
             }
         }
     }
     return True;
 }
Ejemplo n.º 4
0
 public function Delete($user_id, $workspace_id, $module_id)
 {
     if (IS_NUMERIC($user_id)) {
         $this->Errors("User Invalid");
         return False;
     }
     if (IS_NUMERIC($workspace_id)) {
         $this->Errors("Workspace Invalid");
         return False;
     }
     if (IS_NUMERIC($module_id)) {
         $this->Errors("Module Invalid");
         return False;
     }
     $this->db = $GLOBALS['db'];
     $sql = "DELETE FROM " . $GLOBALS['database_prefix'] . "core_space_user_modules\n\t\t\t\t\tWHERE user_id = {$user_id}\n\t\t\t\t\tAND workspace_id = {$workspace_id}\n\t\t\t\t\tAND module_id = {$module_id}\n\t\t\t\t\t";
     $result = $db->Query($sql);
     if ($db->AffectedRows() > 0) {
         return True;
     } else {
         $this->Errors("Failed to delete user module");
         return False;
     }
 }
Ejemplo n.º 5
0
defined('_VALID_MVH') or die('Direct Access to this location is not allowed.');
/*** CLASS FOR SITE SETUP ***/
require_once $GLOBALS['dr'] . "classes/setup/setup.php";
$setup = new Setup();
require_once $GLOBALS['dr'] . "include/functions/design/curve_boxes.php";
/* SESSION ID */
if (isset($_SESSION['sid'])) {
    $sid = $_SESSION['sid'];
    $user_id = $_SESSION['user_id'];
    require_once $GLOBALS['dr'] . "classes/user/user_info.php";
    require_once $GLOBALS['dr'] . "include/functions/date_time/set_timezone.php";
    $ui = new UserInfo($user_id);
    $workspace_id = $ui->WorkspaceID();
    $teamspace_id = $ui->TeamspaceID();
    //echo $teamspace_id;
    //if (IS_NULL($teamspace_id)) { echo "NULL teamspace"; } else { echo "Not null teamspace"; }
    SetTimezone($ui->Timezone());
    if (IS_NULL($ui->TeamspaceID())) {
        $teamspace_sql = "IS NULL";
        $teamspace_id = "NULL";
    } else {
        $teamspace_sql = "= {$teamspace_id}";
    }
}
/* CREATE AN INSTANCE OF THE WORKSPACE */
if (isset($_SESSION['sid']) && IS_NUMERIC($ui->WorkspaceID())) {
    require_once $GLOBALS['dr'] . "modules/workspace/classes/workspace_user_info.php";
    $wui = new WorkspaceUserInfo($_SESSION['user_id'], $ui->WorkspaceID());
}
/* JPGRAPH SETTINGS */
$jpgraph_font_dir = $dr . "include/jpgraph/fonts/";
Ejemplo n.º 6
0
}
$A['Q2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $Q);
if ($A['Q1'] != '=') {
    $A['Q3'] = 'quantity = quantity ' . $A['Q1'] . ' ?';
} else {
    $A['Q3'] = 'quantity = ?';
}
$A['P1'] = SUBSTR($P, 0, 1);
if (IS_NUMERIC($A['P1'])) {
    $A['P1'] = '=';
}
$A['P2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $P);
if ($A['P1'] != '=') {
    $A['P3'] = 'price = price ' . $A['P1'] . ' ?';
} else {
    $A['P3'] = 'price = ?';
}
$A['M1'] = SUBSTR($M, 0, 1);
if (IS_NUMERIC($A['M1'])) {
    $A['M1'] = '=';
}
$A['M2'] = STR_REPLACE(array('+', '-', '=', ' '), '', $M);
if ($A['M1'] != '=') {
    $A['M3'] = 'minimum = minimum ' . $A['M1'] . ' ?';
} else {
    $A['M3'] = 'minimum = ?';
}
$Q = 'INSERT INTO inventory_stock (store, item, quantity, minimum, price, modified) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE ' . $A['Q3'] . ', ' . $A['P3'] . ', ' . $A['M3'];
MYSQL::QUERY($Q, array($user['store'], $PID, $A['Q2'], $A['M2'], $A['P2'], DATE('Y-m-d H:i:s'), $A['Q2'], $A['P2'], $A['M2']));
$CHECK = MYSQL::QUERY('SELECT quantity,minimum,price FROM inventory_stock WHERE store = ? AND item = ? LIMIT 1', array($user['store'], $PID));
echo $CHECK['quantity'] . '|' . $CHECK['price'] . '|' . $CHECK['minimum'];
Ejemplo n.º 7
0
$P = $_GET['p'];
$V = $_GET['v'];
$T = $_GET['t'];
switch ($T) {
    case 'Q':
        $R = 'quantity';
        break;
    case 'P':
        $R = 'price';
        break;
    case 'M':
        $R = 'minimum';
        break;
}
$CH = SUBSTR($V, 0, 1);
if (IS_NUMERIC($CH)) {
    $CH = '=';
}
$VALUE = STR_REPLACE(array('+', '-', '=', ' '), '', $V);
if ($CH == '+' || $CH == '-' || $CH == '=') {
    if ($CH != '=') {
        $R = $R . " = " . $R;
    }
    if ($CH != '-') {
        $OD = '';
    } else {
        $OD = '-';
    }
    $Q = 'INSERT INTO inventory_stock (store, item, quantity, minimum, price, modified) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE ' . $R . ' ' . $CH . ' ' . $VALUE;
    MYSQL::QUERY($Q, array($user['store'], $P, $OD . $VALUE, 0, 0, DATE('Y-m-d H:i:s')));
    echo $CH . "|" . $VALUE;
Ejemplo n.º 8
0
function Body()
{
    $dr = $GLOBALS['dr'];
    $wb = $GLOBALS['wb'];
    global $mi;
    /* PUT THE MODULE ID IN THE GLOBAL CONTEXT */
    $c = "<table align='center' width='780' cellpadding='0' cellspacing='0' border='0' class='plain'>\n";
    $c .= "<tr>\n";
    $c .= "<td width='20' bgcolor='#3399CC'><img src='" . $wb . "images/curves/top_left.gif' width='20' height='42'></td>\n";
    //$c.="<td width='740' bgcolor='#66CC33'><a href='index.php'></a></td>\n";
    $c .= "<td width='740' bgcolor='#66CC33'><a href='index.php'>" . $GLOBALS['site_logo'] . "</a></td>\n";
    $c .= "<td width='20' bgcolor='#3399CC'><img src='" . $wb . "images/curves/top_right.gif' width='20' height='42'></td>\n";
    $c .= "</tr>\n";
    $c .= "<tr>\n";
    $c .= "<td bgcolor='#99CCFF' colspan='3'>\n";
    if (isset($_SESSION['user_id'])) {
        require_once $dr . "include/functions/design/login_bar.php";
        $c .= LoginBar();
    } else {
        require_once $dr . "include/functions/design/logout_bar.php";
        $c .= LogoutBar();
    }
    $c .= "</td>\n";
    $c .= "</tr>\n";
    /* NOT LOGGED IN AND NO MODULE IN QUERYSTRING */
    if (!isset($_SESSION['user_id']) && !isset($_GET['module'])) {
        require_once $dr . "modules/core/functions/forms/login_form.php";
        $c .= "<tr bgcolor='#ffffff' align='center'>\n";
        $c .= "<td colspan='3'>\n";
        if (isset($_COOKIE['mvh_username'])) {
            $c .= LoginFormCookie();
        } else {
            $c .= LoginForm();
        }
        $c .= "</td>\n";
        $c .= "</tr>\n";
    } elseif (isset($_SESSION['user_id']) && !isset($_GET['module']) && isset($GLOBALS['ui']) && isset($GLOBALS['wui'])) {
        /* PROCESS THE ACTIVATION AND DEACTIVATION OF MODULES IN THE WORKSPACE HERE AS WE NEED UI TO BE SET */
        if (isset($_GET['wtask']) && $_GET['wtask'] == "install_workspace_user_module") {
            require_once $dr . "modules/workspace/classes/add_remove_user_workspace_module.php";
            $aruwm = new AddRemoveUserWorkspaceModule();
            $aruwm->SetParameters($_GET['module_id']);
            $result = $aruwm->AddRemove();
            //if (!$result) { echo Alert("3",$at->ShowErrors()); }
        }
        /* ACTIVATE THE TEAMSPACE MODULES */
        if (isset($_GET['wtask']) && $_GET['wtask'] == "install_teamspace_user_module") {
            require_once $dr . "modules/teamspace/classes/add_remove_user_teamspace_module.php";
            $arutm = new AddRemoveUserTeamspaceModule();
            $arutm->SetParameters($_GET['module_id']);
            $result = $arutm->AddRemove();
            //if (!$result) { echo Alert("3",$at->ShowErrors()); }
        }
        /* INCLUDE THE MAIN FILES FOR THE WORKSPACE */
        require_once $dr . "modules/workspace/functions/browse/non_enterprise_workspace_modules.php";
        require_once $dr . "include/functions/design/teamspace_slider.php";
        require_once $dr . "include/functions/teamspace/user_teamspaces.php";
        /* TODO: CHANGE THIS TO THE WORKSPACE FOLDER */
        //require_once($dr."modules/teamspace/functions/browse/user_available_modules.php");
        require_once $dr . "modules/teamspace/classes/user_available_modules.php";
        //
        $c .= "<tr>\n";
        $c .= "<td colspan='3'>\n";
        $c .= "<table cellspacing='0'>\n";
        $c .= "<tr>\n";
        if (IS_NUMERIC($GLOBALS['teamspace_id'])) {
            $c .= "<td width='150' valign='top'>" . UserAvailableModules() . "</td>\n";
        } else {
            $obj_uam = new UserAvailableModules();
            if ($obj_uam->CountUserAvailableModules() > 0) {
                $c .= "<td width='150' valign='top'>" . TeamspaceSliderItems() . "</td>\n";
            }
        }
        $c .= "<td width='630'>" . CurveBox(NonEnterpriseModules($GLOBALS['ui']->WorkspaceID(), $_SESSION['user_id'], $GLOBALS['wui']->RoleID(), True)) . "</td>\n";
        $c .= "<td width='150' valign='top'>" . UserTeamspaces() . "</td>\n";
        $c .= "</tr>\n";
        $c .= "</table>\n";
        $c .= "</td>\n";
        $c .= "</tr>\n";
    } elseif (isset($_SESSION['user_id']) && !isset($_GET['module']) && empty($workspace_id)) {
        require_once $dr . "modules/workspace/functions/browse/select_workspace.php";
        require_once $dr . "modules/workspace/functions/misc/menu.php";
        $c .= "<tr>\n";
        $c .= "<td colspan='3'>\n";
        $c .= "<table cellspacing='0' class='plain_border'>\n";
        $c .= "<tr>\n";
        $c .= "<td>" . SelectWorkspace() . "</td>\n";
        if ($GLOBALS['ui']->GetInfo("default_role") != "y") {
            $c .= "<td width='150' valign='top'>" . Menu() . "</td>\n";
        }
        $c .= "</tr>\n";
        $c .= "</table>\n";
        $c .= "</td>\n";
        $c .= "</tr>\n";
        //$c.=CurveBox(SelectWorkspace());
    } elseif (isset($_GET['module']) && file_exists($dr . "modules/" . $_GET['module'] . ".php")) {
        $module_id = GetColumnValue("module_id", "core_module_master", "name", $_GET['module']);
        require_once $dr . "modules/" . $_GET['module'] . ".php";
        require_once $dr . "classes/modules/module_id.php";
        $mi = new ModuleID();
        $module_result = $mi->Info($module_id);
        $anonymous_access = $mi->GetInfo("anonymous_access");
        $c .= "<tr>\n";
        $c .= "<td colspan='3'>";
        /* CHECK FOR ERRORS OR ACCESS DENIED */
        if ($module_result && $mi->CheckACL()) {
            $c .= LoadModule($module_id, $anonymous_access);
        } else {
            $c .= CurveBox("Access to module denied");
        }
        $c .= "</td>\n";
        $c .= "</tr>\n";
    }
    $c .= "<tr>\n";
    $c .= "<td width='20' bgcolor='#3399CC'><img src='" . $wb . "images/curves/white_bottom_left.gif' width='20' height='20'></td>\n";
    $c .= "<td width='780' bgcolor='#ffffff' align='center'>" . $GLOBALS['copyright_notice'] . "</td>\n";
    $c .= "<td width='20' bgcolor='#3399CC'><img src='" . $wb . "images/curves/white_bottom_right.gif' width='20' height='20'></td>\n";
    $c .= "</tr>\n";
    $c .= "</table>\n";
    return $c;
}
Ejemplo n.º 9
0
 /**
  * Creates and appends one or more children elements
  *
  * This method is a shortcut to the createElement, appendChild
  * sequence and can also accept associative arrays of any depth
  *
  * There are a few ways to call this method:
  * - Flow::add('name', 'value'); would result in a new child at the root
  * called 'name' with a value of 'value'.
  * - Flow::add(array('name1'=>'value1', 'name2'=>'value2')); would result 2
  * new children at root level (name1 and name2) with respective values
  * - Flow:add('name', array('blue','red')); would result in 2 nodes at root
  * level of name 'name' with values of 'blue' and 'red' respectively.
  * - Flow::add('name', array('sub1'=> 'blue','sub2'=>'red')); results in a
  * new node of name 'name' at rool level, which contains 2 children
  * each with the values of blue and red respectively.
  * 
  * Note that multi level arrays can be used.
  * 
  * @param mixed  $node  a string for a child or associative array of values
  * @param mixed  $value (optional) if a string is passed $node
  * If an array is passed, it represents the multiple children of $node.
  * @param object $root  (optional) reference to a DOMElement child
  * if none is passed, root is assumed
  *
  * @return boolean success. Usual fail reason is non valid XML names
  */
 public static function add($node, $value = null, $root = false)
 {
     $flow = Nexista_Flow::singleton('Nexista_Flow');
     //where do we place this?
     if (!$root) {
         $root = $flow->root;
     }
     if (is_array($node)) {
         foreach ($node as $n => $v) {
             if (IS_NUMERIC) {
                 return false;
             }
             $flow->add($n, $v, $root);
         }
     } else {
         if (is_array($value)) {
             //numeric array? we replicate the node
             if (IS_NUMERIC(key($value))) {
                 foreach ($value as $n => $v) {
                     $flow->add($node, $v, $root);
                 }
             } else {
                 //associative array
                 $e = $root->appendChild($flow->flowDocument->createElement($node));
                 foreach ($value as $n => $v) {
                     if ($n == 'GLOBALS' || $n == '') {
                         continue;
                     }
                     $flow->add($n, $v, $e);
                 }
             }
         } elseif (!is_null($value)) {
             $e = $root->appendChild($flow->flowDocument->createElement($node));
             $e->appendChild($flow->flowDocument->createTextNode($value));
         }
     }
     return true;
 }