Esempio n. 1
0
 public function validateLoginCredentails()
 {
     // send form data to the model
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         // clean user input
         array_htmlspecialchars($_POST);
         // store username and password in object
         $this->username = $_POST['username'];
         $this->password = $_POST['password'];
         // invoke login form validator
         $LoginModel = new LoginModel();
         $LoginModel->validateFormData($_POST);
         var_dump($LoginModel->validateFormData($_POST));
         // get errors array
         $errorsArray = $LoginModel->getErrorsArray();
         if (filter_by_value($errorsArray, 'error', '1')) {
             // render errors to client
             require APP_PATH . 'views/login/login.php';
         } else {
         }
         echo "<br><br>ERRORS START: <br>";
         print_var($errorsArray);
         // render errors to client
         // require(APP_PATH . 'views/login/login.php');
         echo "HELLLLLO";
         echo URL_WITH_INDEX_FILE;
     }
 }
Esempio n. 2
0
function load_market(mysqli $conn)
{
    clear_market($conn);
    //calculate elementary price of each goods
    //for each places
    $places = PLACES_COUNT;
    for ($i = 1; $i <= $places; $i++) {
        //        INSERT INTO `market`(`id`, `name`, `price`, `place_id`) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5])
        $res_goods_here = mysqli_query($conn, "SELECT * FROM " . GOODS_TABLE . " WHERE place_id = {$i}");
        //print_sql("SELECT * FROM ".GOODS_TABLE." WHERE place_id = $i");
        //print_query_result("place(id = $i) goods list",   $res_goods_here);
        $goods_here_count = mysqli_num_rows($res_goods_here);
        for ($j = 0; $j < $goods_here_count; $j++) {
            $goods_here = mysqli_fetch_array($res_goods_here);
            $price = round($goods_here['price']);
            $name = $goods_here['name'];
            $id = $goods_here['goods_id'];
            $min_price = $price * $goods_here['fluctu_min'];
            $max_price = $price * $goods_here['fluctu_max'];
            $price = mt_rand($min_price, $max_price);
            mysqli_query($conn, "INSERT INTO `market`(`id`, `name`, `price`, `place_id`, `goods_id`) VALUES ({$j} + {$i}, '{$name}', {$price}, {$i}, {$id} )");
            print_var("name", $name);
            print_sql("INSERT INTO `market`(`id`, `name`, `price`, `place_id`) VALUES ({$j} + {$i}, '{$name}', {$price}, {$i} )");
        }
    }
}
Esempio n. 3
0
function print_var($var, $internal_call = false)
{
    $is_obj = false;
    if (is_object($var)) {
        $var = (array) $var;
        $is_obj = true;
    }
    if (!$internal_call) {
        echo '<div style="position: absolute; top: 0px; left 0px; z-index: 10000000000000; padding: 20px; background-color: white; border: 2px solid black;">';
    }
    if (is_array($var)) {
        echo $is_obj ? 'object' : 'array';
        if (count($var) > 0) {
            echo '<br/>(<ul style="list-style-type: none; display: block;">';
            foreach ($var as $key => $value) {
                echo '<li style="margin: 5px 0 5px 20px;"><span style=" font-style: italic;">' . $key . '</span>' . ($is_obj ? ' = ' : ' => ');
                print_var($value, true);
                echo '</li>';
            }
            echo '</ul>)';
        } else {
            echo '()';
        }
    } else {
        if (is_null($var)) {
            echo 'null';
        } else {
            if ($var) {
                echo $var;
            } else {
                if (is_bool($var)) {
                    echo 'false';
                } else {
                    if (is_float($var)) {
                        echo '0.00';
                    } else {
                        if (is_int($var)) {
                            echo '0';
                        } else {
                            if (is_string($var)) {
                                echo '""';
                            }
                        }
                    }
                }
            }
        }
    }
    if (!$internal_call) {
        echo '</div>';
    }
}
 public function signage($parameter)
 {
     print_var($parameter);
     // header and navigation
     require APP_PATH . 'views/templates/header_alt.php';
     require APP_PATH . 'views/templates/navbar_alt.php';
     // load recipe information
     $SignageGeneratorModel = new SignageGeneratorModel();
     $recipe_information = $SignageGeneratorModel->retrieveRecipes();
     // print_var($recipe_information);
     // print_var(Session::get('recipe_generate_signage'));
     // content
     require APP_PATH . 'views/signagegenerator/signage/8.5_by_11.php';
     // footer
     require APP_PATH . 'views/templates/footer.php';
 }
Esempio n. 5
0
<?php

// http://vk.com/dev/wall.post
ini_set('display_errors', true);
include '../vk.api.php';
include 'print_var.php';
include 'lime.php';
include 'config.php';
$v = new Vk($config);
// test case
$t = new lime_test(2);
$response = $v->api('wall.post', array('message' => 'I testing API form https://github.com/fdcore/vk.api'));
print_var($response);
$t->isa_ok($response, 'array', 'json array response');
$t->isa_ok($response['post_id'], 'integer', 'return post_id');
				<div class="box match4 color-bg">
					<h1><?php 
print_var('lineamientos_titulo', $page_vars);
?>
</h1>
					<p><?php 
print_var('lineamientos_contenido', $page_vars);
?>
</p>
				</div>
			</div>
			<!-- img -->
			<div class="col-sm-6">
				<div class="box match4 color-bg">
					<h1><?php 
print_var('requisitos_titulo', $page_vars);
?>
</h1>
					<ul>
						<?php 
$items = explode('<br />', nl3br($page_vars['requisitos_contenido'][0]));
foreach ($items as $item) {
    ?>
						<li><?php 
    echo $item;
    ?>
</li>
						<?php 
}
?>
						<!--li>Celebrar contrato de Servicios</li>
Esempio n. 7
0
 function on_bp_gtm_admin_debug($bp_gtm)
 {
     echo '<p><strong>Main:</strong>';
     print_var($bp_gtm);
     echo '</p>';
     echo '<p><strong>Actions:</strong>';
     $bp_gtm_actions = get_option('bp_gtm_actions');
     print_var($bp_gtm_actions);
     echo '</p>';
     echo '<p><strong>Groups own roles:</strong>';
     $bp_gtm_groups_own_roles = get_option('bp_gtm_groups_own_roles');
     print_var($bp_gtm_groups_own_roles);
     echo '</p>';
 }
Esempio n. 8
0
<?php

/**
 * General test file which is used for every db layer to test it
 *
 * @package Yadal
 */
//
if (is_object($db) && method_exists($db, 'getTables')) {
    echo "Tables:\n";
    print_var($db->getTables());
}
echo "Fetch fieldnames:\n";
print_r($db->getFieldNames($table));
echo "Field types in table " . $table . ":\n";
print_var($db->getFieldTypes($table));
echo "\nGet primary key(s):\n";
print_r($db->getPrKeys($table));
echo "\nGet not null fields:\n";
print_r($db->getNotNullFields($table));
echo "\nGet fields which should be unique:\n";
print_r($db->getUniqueFields($table));
echo "\nRun a query:\n";
$sql = $db->query("SELECT * FROM " . $db->quote($table));
print_r($sql);
echo "\n\nRecords count:\n";
echo $db->recordCount($sql);
echo "\n\nGet record:\n<table border='1' cellspacing='0' cellpadding='2'>\n";
$first = true;
while ($row = $db->getRecord($sql)) {
    echo "<tr>\n";
    $r = $userManager->changeUserPassword($user_name, $userpassword, "newPassword42");
    if (is_a($r, "Exception")) {
        echo "Error : cannot change password for user {$user_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Change User Password");
        echo "OK : password changed for user {$user_name} :-)\n";
    }
}
// Modify Prefs
if ($action == "mup") {
    if (!$nam_opt) {
        $nam_opt = "zimbraPrefMailItemsPerPage";
    }
    if (!$val_opt) {
        $val_opt = "42";
    }
    $new_prefs = array($nam_opt => $val_opt);
    print_var($new_prefs, "Modify Prefs");
    $r = $userManager->modifyUserPrefs($user_name, $new_prefs);
    if (is_a($r, "Exception")) {
        echo "Error : cannot modify prefs for {$user_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Modify Prefs : Response");
        echo "OK : modify user prefs for {$user_name} :-)\n";
    }
}
if (!$r) {
    echo "Invalid action!\n";
}
 /**
  * Starts application by disassembling the URL request and loading the appropriate controller, 
  * invoking the appropriate method and its parameters (if requested)
  * 
  */
 public function __construct()
 {
     // disassembles the inbound URL request into its controller, method, and parameter parts
     $this->getUrlRequest();
     /**
      * Debugging
      */
     // print_var(URL_WITH_INDEX_FILE);
     $debug = 0;
     if ($debug == 1) {
         echobr('Controller');
         print_var($this->urlController);
         echobr('Method');
         print_var($this->urlMethod);
         echobr('Basename');
         var_dump(basename($_SERVER['PHP_SELF']));
     }
     /**
      * Load default controller otherwise load the controller corresponding to the client URL request
      * 
      */
     if (!$this->urlController) {
         require APP_PATH . 'controllers/IndexController.php';
         $webpage = new IndexController();
         $webpage->index();
     } elseif (file_exists(APP_PATH . 'controllers/' . $this->urlController . '.php')) {
         // load the controller corresponding to the client URL request
         require APP_PATH . 'controllers/' . $this->urlController . '.php';
         // instantiate the corresponding controller as an object
         $this->urlController = new $this->urlController();
         /**
          * Invoke the method requested in the url for previously instantiated object, otherwise invoke
          * default index() method in the controller
          * 
          */
         if (method_exists($this->urlController, $this->urlMethod)) {
             // debug
             // var_dump($this->urlController);
             // var_dump($this->urlMethod);
             /**
              * Pass the parameters to the method if they exist otherwise invoke the method without parameters
              * 
              */
             if (!empty($this->urlParameter)) {
                 // invoke the method and pass the parameters
                 $this->urlController->{$this->urlMethod}($this->urlParameter);
                 //debug
                 // echo('<br>' . 'Requested Parameters: ' . $this->urlParameter . '<br>');
             } else {
                 $this->urlController->{$this->urlMethod}();
             }
         } else {
             /**
              * Invoke the default index() method for the corresponding controller if no method was requested 
              * otherwise redirect client to error page for tampering with the URL request
              * 
              */
             if ($this->urlMethod == null) {
                 // invoke default index() method
                 $this->urlController->index();
             } else {
                 // redirect to error page
                 // echo "REQUESTED METHOD DOES NOT EXIST";
             }
         }
     } else {
         // echo "TEST: " . $this->urlController;
         // redirect to error page
         // echo "CATASTROPHIC ERROR";
     }
 }
Esempio n. 11
0
function phorum_get_language($lang)
{
    $path = "./include/lang/$lang.php";
    $PHORUM = array();
    $DEPRECATED = array();
    $keep_comment = '';
    if (! file_exists($path)) {
        die("Cannot locate language module in $path");
    }
  
    // Read the language file. Keep track of comments that
    // we want to keep (those starting with '##').
    $file = '';
    $fp = fopen($path, "r");
    if (! $fp) die("Cannot read language file $path");
    while (($line = fgets($fp))) {
        $file .= $line;
        if (substr($line, 0, 2) == '##') {
            $keep_comment .= $line;
        }
    }
    fclose($fp);
    
    // Split the contents of the language file into PHP tokens.
    $tokens = token_get_all($file);
    
    // Parse the PHP tokens.
    while (count($tokens))
    {
        // Extract all variables. The rest is ignored.
        $token = token_shift($tokens);
        if (is_array($token))
        {
            if ($token[0] == T_VARIABLE) {
                list($varname,$endedby) = token_get_string($tokens, $token[1]);
                if ($endedby != '=') break; // We want only the assignments.
                
                // Peek at the following code, to see what type of variable we're
                // handling. Scalar or array.
                token_skip_whitespace($tokens);
                if ($tokens[0][0] == T_ARRAY) 
                {
                    global $in_deprecated;
                    $in_deprecated = false;
                    
                    // Handle opening bracket for the array.
                    token_shift($tokens);
                    token_skip_whitespace($tokens);
                    $token = token_shift($tokens);
                    if ($token != '(') {
                        die("$path: Expected array opening bracket for array " .
                            htmlspecialchars($varname));
                    }

                    while (count($tokens))
                    {   
                        // Get key
                        list($key, $endedby) = token_get_string($tokens);
                        if ($endedby != '=>') {
                            die("$path: Expected double arrow (=>) for key " .
                                htmlspecialchars($key) . " in array " . 
                                htmlspecialchars($varname) . ", but got $endedby");
                        }

                        // Get value
                        list($val, $endedby) = token_get_string($tokens);
                        
                        if ($endedby != ',' && $endedby != ')') {
                            die("$path: Expected ending comma or bracket for key " .
                                htmlspecialchars($key) . " in array " . 
                                htmlspecialchars($varname) . ", but got $endedby");
                        }     
                        
                        // Put the data in the environment.
                        $fullvar = $varname . '[' . $key . ']';
                        eval("$fullvar = '" . urlencode($val) . "';");

                        // Keep track of data flagged deprecated.
                        if ($in_deprecated) {
                            eval("\$DEPRECATED[$key] = true;");
                        }
                        
                        // Last key/value pair?
                        if ($endedby == ')') break;                           
                        token_skip_whitespace($tokens);
                        if ($tokens[0] == ')') {
                            array_shift($tokens);
                            break;
                        }
                    }
                } else {
                    list($varvalue,$endedby) = token_get_string($tokens);
                    eval("$varname = '" . urlencode($varvalue) . "';");
                }
            }
        }
    }
   
    if ($keep_comment == '') {
        $keep_comment = <<<HELP
## For adding information to the start of this language file,
## you can use comments starting with "##". Those comments will
## be kept intact when a new language file is generated by the 
## language file maintenance software.
HELP;
    }
    
    // These aren't inside $PHORUM, but we put them there so we have
    // access to them later on.
    $PHORUM['STORE']['language_hide'] = $language_hide;
    $PHORUM['STORE']['language'] = $language;
    $PHORUM['STORE']['keep_comment'] = $keep_comment;
    $PHORUM['STORE']['DEPRECATED'] = $DEPRECATED;

    if (TOKEN_DEBUGGER){
        print_var($PHORUM);
    }
    return $PHORUM;
}
Esempio n. 12
0
                if ($count == 50) {
                    $total += $count;
                    echo " {$total} from \"{$forumdata['name']}\"";
                    if ($CONVERT['lbr'] == "\n") {
                        // lets just go back on this line if we are on the console
                        echo "\r";
                    } else {
                        echo $CONVERT['lbr'];
                    }
                    flush();
                    $count = 0;
                }
                $count++;
            } else {
                print "Error in message: " . $CONVERT['lbr'];
                print_var($newmessage);
                print $CONVERT['lbr'];
            }
        }
        echo "{$CONVERT['lbr']}Updating forum-statistics: {$CONVERT['lbr']}";
        flush();
        phorum_db_update_forum_stats(true);
        echo $CONVERT['lbr'];
        flush();
    }
}
unset($forums);
// storing the offsets of the forums
phorum_db_update_settings(array("conversion_offsets" => $offsets));
if ($CONVERT['do_groups'] && count($CONVERT['groups'])) {
    // here we set the group-permissions
Esempio n. 13
0
<?php

$sidebar_links = array('index.php' => array('page_name' => 'SMG Online'), 'menumanager.php' => array('page_name' => 'Menu Manager'), 'recipes.php' => array('page_name' => 'Recipes'), 'signagegenerator.php' => array('page_name' => 'Signage Generator'));
$current_page = basename($_SERVER['PHP_SELF']);
$mainController = $_SERVER['PHP_SELF'];
print_var($current_page);
// print_var($mainController);
?>

<body>

<!-- Container ::: Start -->
<div class="container">

     <!-- Navigation ::: Navbar ::: Start -->
     <div class="navbar navbar-inverse">

     	<div class="navbar-header">
     		<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
     			<span class="icon-bar"></span>
     			<span class="icon-bar"></span>
     			<span class="icon-bar"></span>
     		</button>
     		<!-- <a class="navbar-brand" href="<?php 
echo URL_WITH_INDEX_FILE;
?>
">SMG Online</a> -->

     	</div>

     	<div class="navbar-collapse collapse">
Esempio n. 14
0
<?php

ini_set('display_errors', true);
include '../vk.api.php';
include 'print_var.php';
include 'lime.php';
include 'config.php';
$v = new Vk($config);
$links = array();
$links['code'] = $v->get_code_token('code');
$links['token'] = $v->get_code_token('token');
if (is_array($links) && count($links) > 0) {
    foreach ($links as $l) {
        echo printf('<p><a href="%s" target="_blank">%s</a></p>', $l, $l);
    }
}
print_var($links);
// test case
$t = new lime_test(2);
$t->isa_ok($links['code'], 'string', 'get_code_token(\'code\') returns a string');
$t->isa_ok($links['token'], 'string', 'get_code_token(\'token\') returns a string');
Esempio n. 15
0
function bp_gtm_globals()
{
    global $bp;
    //print_r(bp_gtm_get_user_roles());
    print_var($bp->loggedin_user);
}
    if (!$nam_opt) {
        $nam_opt = "zimbraHttpSSLNumThreads";
    }
    if (!$val_opt) {
        $val_opt = 333;
    }
    $new_attrs = array($nam_opt => $val_opt);
    print_var($new_attrs, "Modify Server : setting");
    $r = $serverManager->modifyServer($server_name, $new_attrs);
    if (is_a($r, "Exception")) {
        echo "Error : modifying server {$server_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Modify Server : Response");
        echo "OK : server {$server_name} modified :-)\n";
    }
}
// Delete Server
if ($action == "ds") {
    $r = $serverManager->deleteServer($server_name);
    if (is_a($r, "Exception")) {
        echo "Error : deleting server {$server_name} :-(\n";
        print_exception($r);
    } else {
        print_var($r, "Delete Server : Response");
        echo "OK : server {$server_name} deleted :-)\n";
    }
}
if (!$r) {
    echo "Invalid action!\n";
}
Esempio n. 17
0
function describe_var($var, $desc)
{
    print_var($var);
    print "<tr><td>&nbsp;</td><td><p><i>{$desc}<p><br/></i></td></tr>";
}
Esempio n. 18
0
function tep_get_all_get_params($exclude_array = '')
{
    global $HTTP_GET_VARS;
    if (!is_array($exclude_array)) {
        if (!empty($exclude_array)) {
            $exclude_array = array($exclude_array);
        } else {
            $exclude_array = array();
        }
    }
    $get_url = '';
    if (is_array($HTTP_GET_VARS) && sizeof($HTTP_GET_VARS) > 0) {
        reset($HTTP_GET_VARS);
        while (list($key, $value) = each($HTTP_GET_VARS)) {
            if (strlen($value) > 0 && $key != tep_session_name() && $key != 'error' && !in_array($key, $exclude_array) && $key != 'x' && $key != 'y') {
                $get_url .= print_var($key, $value);
            }
        }
    }
    return $get_url;
}
Esempio n. 19
0
    echo $item;
    ?>
</li>
						<?php 
}
?>
						<!--li>Servicios de laboratorio a precios especiales.</li>
						<li>Servicio de ambulancia para apoyo interurbano desde su casa o donde se presente la emergencia hasta cualquier centro de salud previamente establecido.</li-->
					</ul>
				</div>
			</div>
			<!-- otros servicios de salud -->
			<div class="col-sm-5">
				<div class="box match6 color-bg">
					<h1><?php 
print_var('otros_servicios_salud_titulo', $page_vars);
?>
</h1>
					<ul class="columnized">
						<?php 
$items = explode('<br />', nl3br($page_vars['otros_servicios_salud_contenido'][0]));
foreach ($items as $item) {
    ?>
						<li><?php 
    echo $item;
    ?>
</li>
						<?php 
}
?>
						<!--li>Nutricionista</li>
Esempio n. 20
0
<?php

/**
 *
 * Test file for the access "layer"
 *
 * THIS DOES NOT WORK
 *
 * We need to specify the database type which should be
 * used with odbc, like odbc_mssql, odbc_db2, etc.
 * The ways for fetching field names, getting the insert id, etc
 * is to different for each type.
 *
 * @package Yadal
 */
include '../class.Yadal.php';
// the test table (can be any table)
$table = "Customers";
echo "<pre>";
// create a new connection
$db = newYadal("Northwind", "odbc");
$db->connect('ODBCTEST', '', '');
print_var($db->getFieldNames($table));
// start the test secuence
//include( 'test.php' );
Esempio n. 21
0
					</ul>					
				</div>
			</div> -->
		</div>

		<!--<div class="line-separator"></div>-->
		<div class="separator"></div>
		<div class="separator"></div>

		<!-- fifth row -->
		<!--<div class="row">
			<div class="col-sm-12">
				<div class="color-bg cropped-arrow-box">
					
					<h1><?php 
print_var('asesores_titulo', $page_vars);
?>
</h1>
						
						<h4> Iliana Hackshaw</h4>
						<h4> Niurka Gómez</h4>
						<h4> Rhona Rondón</h4>
						<h4> Franchesca Muratti</h4>
						<h4> Esleiver Macabi</h4>
						<h4> Josue Calderón</h4>
						<li class="mail-icon">&nbsp;&nbsp;&nbsp;&nbsp;josueraulcamejo@hotmail.com</li>
				</div>
			</div>
		</div>	-->	
	</div>