Esempio n. 1
0
/**
 * Wrapper of Var_Dump
 * @param mixed any kind of eepression
 * @return void
 */
function epVarDump($var)
{
    static $vd;
    if (epIsWebRun()) {
        include_once 'Var_Dump.php';
        Var_Dump::displayInit(array('display_mode' => 'HTML4_Table'));
        Var_Dump::display($var);
    } else {
        var_dump($var);
    }
}
Esempio n. 2
0
function varDump($var)
{
    $available = HTML_Progress2_Generator::isIncludeable('Var_Dump.php');
    if ($available) {
        include_once 'Var_Dump.php';
        Var_Dump::display($var, false, array('display_mode' => 'HTML4_Table'));
    } else {
        echo '<pre style="background-color:#eee; color:#000; padding:1em;">';
        var_dump($var);
        echo '</pre>';
    }
}
Esempio n. 3
0
function dump($var)
{
    $trace = debug_backtrace();
    echo "<div style=\"text-align:left\">dump() in {$trace[0]['file']}:{$trace[0]['line']}</div>";
    //include_once 'Var_Dump.php';
    if (class_exists('Var_Dump')) {
        Var_Dump::displayInit(array('display_mode' => 'HTML4_Table'));
        Var_Dump::display($var);
    } else {
        echo "<pre style=\"text-align:left\">";
        var_dump($var);
        echo "</pre>";
    }
}
Esempio n. 4
0
<?php

include_once 'Var_Dump.php';
echo '<h1>example6.php : Globals</h1>';
/*
 * example6.php : Globals
 *
 */
Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('mode' => 'normal', 'offset' => 4));
Var_Dump::display($GLOBALS);
Esempio n. 5
0
 *
 */
$fileHandler = tmpfile();
$linkedArray = array(TRUE, 123, 123.45);
$array = array('key1' => 'The quick brown' . "\n" . 'fox jumped over' . "\n" . 'the lazy dog', 'key2' => &$linkedArray, 'key3' => NULL, 'key4' => $fileHandler);
echo '<h2>Text</h2>';
Var_Dump::displayInit(array('display_mode' => 'Text'));
echo '<pre>';
Var_Dump::display($array);
echo '</pre>';
echo '<h2>HTML4_Table</h2>';
Var_Dump::displayInit(array('display_mode' => 'HTML4_Table'), array('show_eol' => '&bull;'));
Var_Dump::display($array);
echo '<h2>HTML4_Text</h2>';
Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('show_eol' => '&bull;'));
Var_Dump::display($array);
echo '<h2>XHTML_Table</h2>';
Var_Dump::displayInit(array('display_mode' => 'XHTML_Table'));
Var_Dump::display($array);
echo '<h2>XHTML_Text</h2>';
Var_Dump::displayInit(array('display_mode' => 'XHTML_Text'));
Var_Dump::display($array);
echo '<h2>XML</h2>';
Var_Dump::displayInit(array('display_mode' => 'XML'));
echo '<pre>';
echo htmlspecialchars(Var_Dump::display($array, TRUE));
echo '</pre>';
fclose($fileHandler);
?>
</body>
</html>
Esempio n. 6
0
}
$recursiveObject = new c_parent();
Var_Dump::display($recursiveObject);

/*
 * Displays a classic object
 */

echo '<h2>Object (Classic)</h2>';

class test {
    var $foo = 0;
    var $bar = '';
    function get_foo() {
        return $this->foo;
    }
    function get_bar() {
        return $this->bar;
    }
}
$object = new test();
$object->foo = 753;
$object->bar = '357';
Var_Dump::display($object);

fclose($fileHandler);

?>

</body>
</html>
Esempio n. 7
0
    $updateApp = $admin->perm->updateApplication($data, $filters);
    if ($updateApp === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } else {
        echo '<strong>App2</strong> was updated<br />';
        $params = array('filters' => array('application_id' => $applications[$id]['application_id']));
        $result = $admin->perm->getApplications($params);
        if ($result === false) {
            echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
            print_r($admin->getErrors());
        } elseif (empty($result)) {
            echo 'No applications were found<br />';
        } else {
            Var_Dump::display($result);
        }
    }
    // Get
    $applications = $admin->perm->getApplications();
    if ($applications === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } elseif (empty($applications)) {
        echo 'No applications were found<br />';
    } else {
        echo 'These are our current applications:';
        Var_Dump::display($applications);
        echo '<br />';
    }
}
echo '<hr />';
 function printVar($var, $info = '')
 {
     if (ClubBase::isError(ClubBase::loadClass('var_dump', CLUB_CLASS_PATH))) {
         return false;
     }
     if (!empty($info)) {
         print "<H2>{$info}</H2>";
     }
     Var_Dump::display($var);
     return true;
 }
Esempio n. 9
0
function var_dump2($obj)
{
    Var_Dump::display($obj);
}
Esempio n. 10
0
<?php

/*
TODO:
ImplyRight
*/
require_once 'config.inc.php';
include_once 'Var_Dump.php';
Var_Dump::displayInit(array('display_mode' => 'XHTML_Text'), array('mode' => 'normal', 'offset' => 4));
?>

<html>
<style>
    a {
        color: #006600;
        text-decoration: none;
    }

    a:visisted {
        text-decoration: none;
    }

    a:hover {
        text-decoration: underline;
    }
    /* style for XHTML_Text */
    table.var_dump          { border-collapse:separate; border:1px solid black; border-spacing:0; }
    table.var_dump tr       { color:#006600; background:#F8F8F8; vertical-align:top; }
    table.var_dump tr.alt   { color:#006600; background:#E8E8E8; }
    table.var_dump th       { padding:4px; color:black; background:#CCCCCC; text-align:left; }
    table.var_dump td       { padding:4px; }
Esempio n. 11
0
<html>
<style>
    /* style for XHTML_Text */
    pre.var_dump            { line-height:1.8em; }
    pre.var_dump span.type  { color:#006600; background:transparent; }
    pre.var_dump span.value { padding:2px; color:#339900; background:#F0F0F0; border: 1px dashed #CCCCCC; }
</style>
<body>
<?php 
include_once 'Var_Dump.php';
echo '<h1>example5.php : Text displaying modes</h1>';
/*
 * example5.php : Text displaying modes
 *
 */
$fileHandler = tmpfile();
$linkedArray = array(0 => 'John', 11 => 'Jack', 127 => 'Bill');
$array = array('key-1' => 'The quick brown fox jumped over the lazy dog', 'key-2' => array('long-key' => &$linkedArray, 'file' => $fileHandler), 'long-key-3' => 234);
echo '<h2>Compact mode (offset 4)</h2>';
Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('mode' => 'compact', 'offset' => 4));
Var_Dump::display($array);
echo '<h2>Normal mode (offset 4)</h2>';
Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('mode' => 'normal', 'offset' => 4));
Var_Dump::display($array);
echo '<h2>Wide mode (offset 4)</h2>';
Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('mode' => 'wide', 'offset' => 4));
Var_Dump::display($array);
fclose($fileHandler);
?>
</body>
</html>
PEAR::setErrorHandling(PEAR_ERROR_PRINT);
$id = $_REQUEST['id'];
$type = $_REQUEST['type'];
if (!$id) {
    $id = 1;
}
if (!$type) {
    $type = 'folder';
}
//$node = new node(2, 'article');
$module = new module($id, $type);
echo '<h1>' . $module->getTitle() . '</h1>';
$parents = $module->getParent();
if ($parents) {
    foreach ($parents as $parent) {
        echo '<li>..<a href="module.test.php?id=' . $parent->getId() . '&type=' . $parent->getType() . '">' . $parent->getTitle() . '</a>';
    }
}
$childs = $module->getChild();
if ($childs) {
    foreach ($childs as $child) {
        echo '<li><a href="module.test.php?id=' . $child->getId() . '&type=' . $child->getType() . '">' . $child->getTitle() . '</a> ';
        if ($child->get('locale')) {
            echo '(locale : ' . $child->get('locale') . ')';
        }
    }
}
echo $module->debug();
Var_Dump::display($_REQUEST);
//$test_module = new module(5, 'folder');
//$module->addParent($test_module);
Esempio n. 13
0
        echo '<br />';
    }
    $user = array_rand($users);
    echo 'Test fetching auth_user_id AND perm_user_id with PERM getUsers()<br />';
    echo 'Auth<br />';
    $params = array('filters' => array('auth_user_id' => $users[$user]['auth_user_id']));
    $user = $admin->auth->getUsers($params);
    if ($user === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } elseif (empty($user)) {
        echo 'No user was found.';
    } else {
        Var_Dump::display($user);
        echo '<br />';
    }
    unset($user);
    echo 'Perm<br />';
    $params = array('filters' => array('perm_user_id' => '3'));
    $user = $admin->perm->getUsers($params);
    if ($user === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } elseif (empty($user)) {
        echo 'No user was found.<br />';
    } else {
        Var_Dump::display($user);
        echo '<br />';
    }
}
echo '<hr />';
Esempio n. 14
0
    echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
    print_r($admin->getErrors());
} else {
    echo '<b>' . $users[$user]['name'] . '</b> was removed from group <b>' . $groups[$group]['group_id'] . '</b><br />';
}
// Remove user from all his groups
$user = array_rand($users);
$filters = array('perm_user_id' => $users[$user]['perm_user_id']);
$removed = $admin->perm->removeUserFromGroup($filters);
if ($removed === false) {
    echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
    print_r($admin->getErrors());
} else {
    echo '<b>' . $users[$user]['name'] . '</b> was removed from <b>ALL</b> his groups<br />';
}
// Get users from all groups
foreach ($groups as $group) {
    $params = array('filters' => array('group_id' => $group['group_id']));
    $usersGroup = $admin->perm->getGroups($params);
    if ($usersGroup === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } elseif (empty($usersGroup)) {
        echo 'No users were found for the group id <strong>' . $group['group_id'] . '</strong>';
    } else {
        echo 'Perm ID\'s of the users in group <b>' . $group['group_id'] . '</b><br />';
        Var_Dump::display($usersGroup);
        echo '<br />';
    }
}
echo '<hr />';
function debug_var($var)
{
    @(include_once 'Var_Dump.php');
    if (class_exists('Var_Dump')) {
        Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'), array('mode' => 'normal', 'offset' => 3, 'before_type' => '<font color="#006600">', 'after_type' => '</font>', 'before_value' => '<font color="#000088">', 'after_value' => '</font>'));
        Var_Dump::display($var);
    } else {
        echo "<pre>\n";
        print_r($var);
        echo "</pre>\n";
    }
}
Esempio n. 16
0
 /**
  * Dumps a var with PEAR::Var_Dump.
  *
  * @param mixed $var The variable to dump
  * @param string $title An optional title
  *
  * @return void
  */
 public static function varDump($var, $title = '')
 {
     echo $title ? '<h3><tt>' . $title . '</tt></h3>' : '';
     $debug_type = JComponentHelper::getParams('com_easycreator')->get('ecr_debug_type', 'easy');
     if ($debug_type == 'krumo') {
         ecrLoadHelper('krumo_0_2.krumo');
         krumo::dump($var);
         return;
     }
     include_once 'Var_Dump.php';
     if (class_exists('Var_Dump')) {
         Var_Dump::displayInit(array('display_mode' => 'HTML4_Table'), array('show_caption' => FALSE, 'bordercolor' => '#ccc', 'bordersize' => '2', 'captioncolor' => 'black', 'cellpadding' => '8', 'cellspacing' => '5', 'color1' => '#000', 'color2' => '#000', 'before_num_key' => '<span style="color: #fff; font-weight: bold;">', 'after_num_key' => '</span>', 'before_str_key' => '<span style="color: #5450cc; font-weight: bold;">', 'after_str_key' => '</span>', 'before_value' => '<span style="color: #5450cc;">', 'after_value' => '</span>'));
         Var_Dump::display($var);
     } else {
         echo '<pre>' . print_r($var, true) . '</pre>';
     }
 }
Esempio n. 17
0
if ($opts['example']['display']) {
    Var_Dump::display($example);
}
if ($opts['example']['fetch']) {
    $example->fetchmode = DB_FETCHMODE_ASSOC;
    $result = $example->select('list');
    Var_Dump::display($result);
}
$form =& $example->getForm(null, 'mydata', null);
$form->addElement('submit', 'op', 'Submit');
//Var_dump::display($form);
echo "<html><head><title>bogotest</title></head><body>\n";
// test recasting
$values = $form->exportValues();
$example->recast($values['mydata']);
Var_Dump::display($values);
// test validation and insert
if ($form->validate()) {
    $values = $form->exportValues();
    Var_Dump::display($values['mydata']);
    $result = $example->insert($values['mydata']);
    Var_Dump::display($result);
}
$form->display();
echo "\n<hr />\n";
$example->fetchmode = DB_FETCHMODE_ASSOC;
$list = $example->select('list');
Var_Dump::display($list);
$result = $example->insert(array('xvarchar' => null, 'xchar' => 'a', 'xdecimal' => '', 'xsingle' => null, 'xdouble' => null, 'xint' => 1));
Var_Dump::display($result);
echo "\n</body></html>";
 function execute()
 {
     $return = new stdClass();
     $params = Request::_REQUEST();
     Config::set("HideDebugger", true);
     //comment this out to debug
     if (isset($params["id"])) {
         $user = new Member($params["id"]);
         if (isset($user) && $user->isValid()) {
             // retrieve account balance based on transactions
             $user_balance = 0.0;
             $user_commission = 0.0;
             /* $Referral_Join = DBObject::collection("Referral");
                 $Member_Join = DBObject::collection("Member");
                 $Member_Vendor_Join = DBObject::collection("Member");
                 $Transactions = DBObject::collection("Transaction")
                 ->applyJoin("LEFT OUTER", $Referral_Join, array("ReferralID", "AutoID"))
                 ->applyJoin("LEFT OUTER", $Member_Join, array("UserID", "AutoID"))
                 ->applyJoin("LEFT OUTER", $Member_Vendor_Join, array("VendorID", "AutoID"))
                 ->applyUserIDFilter($user->getID());
                 Debugger::log(Var_Dump::display($Transactions->getTransactions(), true));
                */
             $q = "SELECT\n\t\t\t\tt.`amount`,\n\t\t\t\tr.*,\n\t\t\t\tCONCAT(user.`userFirstname`, CONCAT(' ',user.`userLastname`)) as _from,\n\t\t\t\tCONCAT(vendor.`userFirstname`, CONCAT(' ',vendor.`userLastname`)) as _to\n\t\t\tFROM  `transactions` t\n\n\t\t\tLEFT OUTER JOIN `referrals` r\n\t\t\t\tON (t.`ReferralID` = r.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` user\n\t\t\t\tON (r.`UserID` = user.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` vendor\n\t\t\t\tON (r.`VendorID` = vendor.`AutoID`)\n\n\t\t\tWHERE t.`UserID` ='" . $user->getID() . "'";
             $user_transactions = DatabaseFactory::passinggreen_db()->query($q);
             Debugger::log(Var_Dump::display($user_transactions, true));
             while ($user_transactions_row = $user_transactions->fetch_object()) {
                 if ($user_transactions_row->UserID == $user->getID()) {
                     $user_balance += $user_transactions_row->amount;
                     //$referrals_passed[] = $row;
                 } else {
                     if ($user_transactions_row->VendorID == $user->getID()) {
                         $user_commission += $user_transactions_row->amount;
                         //$referrals_received[] = $row;
                     }
                 }
                 #else
                 #echo "PG.com +".$row->amount."<br>";
                 #echo "<pre>".print_r($row, true)."</pre>";
             }
             // referrals
             $user_referrals_passed = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyUserIDFilter($user->getID())->getReferralCount();
             $user_referrals_received = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyVendorIDFilter($user->getID())->getReferralCount();
             Debugger::log("refs passed: {$user_referrals_passed}");
             Debugger::log("refs recvd: {$user_referrals_received}");
             // decrypt cc field if it is not empty
             $user_crypt_key = CryptKey::findCryptKeyByUserID($user->getID());
             if (isset($user_crypt_key) && $user_crypt_key->isValid()) {
                 Debugger::log("User crypt private key: " . $user_crypt_key->getKey());
                 $decoded_cc_data = unserialize(TwoWayEncryption::decrypt($user->getCC(), $user_crypt_key->getKey()));
             } else {
                 $decoded_cc_data = null;
             }
             $return->id = $user->getID();
             // object id
             $return->user = $user->toArray();
             // set the base return, values can be overridden below.
             $return->user["userCompanyType[]"] = $user->getUserCompanyType();
             $return->user["siteAreas[]"] = $user->getSiteAreas();
             $return->user["passwd"] = null;
             $return->user["balance"] = number_format($user_balance, 2);
             if (!is_null($decoded_cc_data)) {
                 $return->user["ccc"] = $decoded_cc_data["details"];
                 $return->user["ccc_status"] = $decoded_cc_data["status"];
                 $return->user["ccc_tcode"] = $decoded_cc_data["tcode"];
                 $return->user["ccc_name"] = $decoded_cc_data["name"];
                 $return->user["ccc_ccNum"] = $decoded_cc_data["ccNum"];
                 $return->user["ccc_MM"] = $decoded_cc_data["MM"];
                 $return->user["ccc_YY"] = $decoded_cc_data["YY"];
                 $return->user["ccc_ccCode"] = $decoded_cc_data["ccCODE"];
             }
             $return->user["referralsPassed"] = $user_referrals_passed;
             $return->user["referralsReceived"] = $user_referrals_received;
             $return->user["accountBalance"] = number_format($user_balance, 2);
             $return->user["commissionDue"] = number_format($user_commission, 2);
             echo json_encode($return);
             return;
         } else {
             $return->error = "ID is invalid.";
             echo json_encode($return);
             return;
         }
     } else {
         $return->error = "Missing ID!";
         echo json_encode($return);
         return;
     }
 }
 /**
  * Display final results
  *
  * Display final results, when data source parsing is over.
  *
  * @access public
  * @return void
  * @since  version 1.8.0b2 (2008-06-03)
  */
 function display()
 {
     $o = $this->args['output-level'];
     $v = $this->args['verbose'];
     $data = $this->parseData;
     $src = $this->_parser->dataSource;
     if ($data === false) {
         // invalid data source
         if ($this->driver == 'PHP') {
             var_export($data);
         } else {
             Var_Dump::display($data);
         }
         return;
     }
     $options = $this->_parser->options;
     if (isset($this->args['dir'])) {
         $files = $this->_parser->getFilelist($this->args['dir'], $options);
     } elseif (isset($this->args['file'])) {
         $files = array($this->args['file']);
     } elseif ($src['dataType'] == 'directory') {
         $files = $src['dataSource'];
     } elseif ($src['dataType'] == 'file') {
         $files = array($src['dataSource']);
     } else {
         $files = $src['dataSource'];
     }
     if ($options['is_string'] == true) {
         foreach ($files as $k => $str) {
             $files[$k] = 'string_' . ($k + 1);
         }
     }
     if ($o & 16) {
         // display Version
     } else {
         unset($data['version'], $data['max_version']);
     }
     if ($o & 1) {
         // display Conditions
     } else {
         unset($data['cond_code']);
     }
     if ($o & 2) {
         // display Extensions
     } else {
         unset($data['extensions']);
     }
     if ($o & 4) {
         if ($o & 8) {
             // display Constants/Tokens
         } else {
             // display Constants
             unset($data['tokens']);
         }
     } else {
         unset($data['constants']);
         if ($o & 8) {
             // display Tokens
         } else {
             unset($data['tokens']);
         }
     }
     if ($v & 4 || $options['debug'] == true) {
         // display Functions
     } else {
         unset($data['functions']);
     }
     if (count($files) > 1) {
         if ($this->args['summarize'] === true) {
             foreach ($files as $file) {
                 unset($data[$file]);
             }
         } else {
             foreach ($files as $file) {
                 if ($o & 16) {
                     // display Version
                 } else {
                     unset($data[$file]['version'], $data[$file]['max_version']);
                 }
                 if ($o & 1) {
                     // display Conditions
                 } else {
                     unset($data[$file]['cond_code']);
                 }
                 if ($o & 2) {
                     // display Extensions
                 } else {
                     unset($data[$file]['extensions']);
                 }
                 if ($o & 4) {
                     if ($o & 8) {
                         // display Constants/Tokens
                     } else {
                         // display Constants
                         unset($data[$file]['tokens']);
                     }
                 } else {
                     unset($data[$file]['constants']);
                     if ($o & 8) {
                         // display Tokens
                     } else {
                         unset($data[$file]['tokens']);
                     }
                 }
                 if ($v & 4 || $options['debug'] == true) {
                     // display Functions
                 } else {
                     unset($data[$file]['functions']);
                 }
             }
         }
     }
     if ($this->driver == 'PHP') {
         var_export($data);
     } else {
         Var_Dump::display($data);
     }
 }
        $warnings = $manager->getWarnings();
        if (count($warnings) > 0) {
            echo 'Warnings<br>';
            if (class_exists('Var_Dump')) {
                Var_Dump::display($warnings);
            } else {
                var_dump($warnings);
            }
        }
        if ($manager->db->getOption('debug')) {
            echo 'Debug messages<br>';
            echo $manager->db->debugOutput() . '<br>';
        }
        echo 'Database structure<br>';
        if (class_exists('Var_Dump')) {
            Var_Dump::display($manager->database_definition);
        } else {
            var_dump($manager->database_definition);
        }
        $manager->disconnect();
    }
}
if (!isset($_REQUEST['submit']) || isset($error)) {
    if (isset($error) && $error) {
        echo $error . '<br>';
    }
    echo '
            <form action="reverse_engineer_xml_schema.php">
            Database Type:
            <select name="type">
                <option value="mysql"';
$prepared_query = $db->prepare('INSERT INTO numbers VALUES(?,?,?)');
foreach ($alldata as $row) {
    echo 'running execute<br>';
    $db->execute($prepared_query, $row);
}
// lets try an prepare execute combo
$alldata = array(array(5, 'five', 'cinq'), array(6, 'six', 'six'), array(7, 'seven', 'sept'), array(8, 'eight', 'huit'));
$prepared_query = $db->prepare('INSERT INTO numbers VALUES(?,?,?)');
$db->executeMultiple($prepared_query, $alldata);
echo 'running executeMultiple<br>';
$array = array(4);
echo '<br>see getOne in action:<br>';
echo Var_Dump::display($db->getOne('SELECT trans_en FROM numbers WHERE number = ?', $array)) . '<br>';
// You can disconnect from the database with:
echo '<br>see getRow in action:<br>';
echo Var_Dump::display($db->getRow('SELECT * FROM numbers WHERE number = ?', $array)) . '<br>';
echo '<br>see getCol in action:<br>';
echo Var_Dump::display($db->getCol('SELECT * FROM numbers', 1)) . '<br>';
echo '<br>see getAll in action:<br>';
echo Var_Dump::display($db->getAll('SELECT * FROM test')) . '<br>';
echo '<br>see getAssoc in action:<br>';
echo Var_Dump::display($db->getAssoc('SELECT * FROM test', false, null, DB_FETCHMODE_ASSOC)) . '<br>';
echo 'tableInfo on a string:<br>';
echo Var_Dump::display($db->tableInfo('numbers')) . '<br>';
echo '<br>just a simple delete query:<br>';
echo Var_Dump::display($db->query('UPDATE numbers set trans_en = 0')) . '<br>';
echo '<br>affected rows:<br>';
echo $db->affectedRows() . '<br>';
echo '<br>just a simple delete query:<br>';
echo Var_Dump::display($db->query('DELETE FROM numbers')) . '<br>';
$db->disconnect();
Esempio n. 22
0
 /**
  * Outputs or returns a string representation of a variable.
  *
  * @see Var_Dump::singleton(), Var_Dump::displayInit()
  * @param mixed $expression The variable to parse.
  * @param bool $return Whether the variable should be echoed or returned.
  * @param mixed $options String (display mode) or array (Global parameters).
  * @param array $rendererOptions Parameters for the rendering.
  * @return string If returned, the string representation of the variable.
  * @access public
  */
 function display($expression, $return = FALSE, $options = NULL, $rendererOptions = NULL)
 {
     $display =& Var_Dump::singleton();
     if (!is_null($options) or !is_null($rendererOptions)) {
         if (is_null($rendererOptions)) {
             $rendererOptions = array();
         }
         $display->Var_Dump($options, $rendererOptions);
     }
     if ($return === TRUE) {
         return $display->toString($expression);
     } else {
         echo $display->toString($expression);
     }
 }
<?php

require_once 'index.php';
?>
<h3>outputRightsConstants</h3>
<?php 
$rights = $admin->perm->outputRightsConstants('array', array('naming' => LIVEUSER_SECTION_APPLICATION), 'php');
Var_Dump::display($rights);
Esempio n. 24
0
    $updated = $admin->perm->updateGroupRight($data, $filters);
    if ($updated === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } else {
        echo 'Updated the right level of <strong>' . $groups[$group]['group_id'] . '</strong><br />';
        $params = array('fields' => array('right_id'), 'filters' => array('right_id' => $rights_group[$right]['right_id'], 'group_id' => $groups[$group]['group_id']), 'by_group' => true);
        $result = $admin->perm->getRights($params);
        if ($result === false) {
            echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
            print_r($admin->getErrors());
        } elseif (empty($result)) {
            echo 'Nothing was found with the right id <strong>' . $rights_group[$right]['right_id'] . '</strong>
                  and group id <strong>' . $groups[$group]['group_id'] . '</strong><br />';
        } else {
            Var_Dump::display($result);
        }
    }
}
$params = array('fields' => array('right_id', 'group_id'), 'with' => array('group_id' => array('fields' => array('group_id', 'right_level'))), 'by_group' => true);
$allGroups = $admin->perm->getRights($params);
echo 'Here are all the group rights after the changes:<br />';
if ($allGroups === false) {
    echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
    print_r($admin->getErrors());
} elseif (empty($allGroups)) {
    echo 'Found no groups<br />';
} else {
    Var_Dump::display($allGroups);
}
echo '<hr />';
Esempio n. 25
0
 /**
  * Debug output
  *
  * <code>
  * Panda_Debug::p
  * 出力モードを指定して変数を出力します
  * </code>
  *
  * @param mixed  $values    any values
  * @param string $ouputMode 'var' | 'export' | 'syslog' | 'fire' dafult is 'print_a'
  * @param array  $options   options
  *
  * @return void
  */
 public static function p($values = '', $ouputMode = null, array $options = array())
 {
     if (!self::$enable) {
         return;
     }
     if (isset($options['return']) && $options['return'] === true) {
         ob_start();
     }
     // Roならarrayに
     if (class_exists('BEAR_Ro', false) && $values instanceof BEAR_Ro) {
         $values = array('code' => $values->getCode(), 'headers' => $values->header, 'body' => $values->body, 'links' => $values->links);
     }
     if ($ouputMode === null && is_scalar($values)) {
         $ouputMode = 'dump';
     }
     $trace = isset($options['trace']) ? $options['trace'] : debug_backtrace();
     $file = $trace[0]['file'];
     $line = $trace[0]['line'];
     $includePath = explode(":", get_include_path());
     $method = isset($trace[1]['class']) ? " ({$trace[1]['class']}" . '::' . "{$trace[1]['function']})" : '';
     $fileArray = file($file, FILE_USE_INCLUDE_PATH);
     $p = trim($fileArray[$line - 1]);
     unset($fileArray);
     preg_match("/p\\((.+)[\\s,\\)]/is", $p, $matches);
     $varName = isset($matches[1]) ? $matches[1] : '';
     $label = isset($options['label']) ? $options['label'] : "{$varName} in {$file} on line {$line}{$method}";
     if (strlen(serialize($values)) > 1000000) {
         $ouputMode = 'dump';
     }
     $label = is_object($values) ? ucwords(get_class($values)) . " {$label}" : $label;
     // if CLI
     if (PHP_SAPI === 'cli') {
         $colorOpenReverse = "";
         $colorOpenBold = "";
         $colorOpenPlain = "";
         $colorClose = "";
         echo $colorOpenReverse . "{$varName}" . $colorClose . " = ";
         var_dump($values);
         echo $colorOpenPlain . "in {$colorOpenBold}{$file}{$colorClose}{$colorOpenPlain} on line {$line}{$method}" . $colorClose . "\n";
         return;
     }
     if (Panda::isCliOutput()) {
         if (class_exists('FB', false)) {
             $ouputMode = 'fire';
         } else {
             $ouputMode = 'syslog';
         }
     }
     $labelField = '<fieldset style="color:#4F5155; border:1px solid black;padding:2px;width:10px;">';
     $labelField .= '<legend style="color:black;font-size:9pt;font-weight:bold;font-family:Verdana,';
     $labelField .= 'Arial,,SunSans-Regular,sans-serif;">' . $label . '</legend>';
     switch ($ouputMode) {
         case 'v':
         case 'var':
             if (class_exists('Var_Dump', false)) {
                 Var_Dump::displayInit(array('display_mode' => 'HTML4_Text'));
                 print $labelField;
                 Var_Dump::display($values);
             } else {
                 ob_start();
                 var_export($values);
                 $var = ob_get_clean();
                 print $labelField;
                 echo "<pre>" . $var . '</pre>';
             }
             print "</fieldset>";
             break;
         case 'd':
         case 'dump':
             $file = "<a style=\"color:gray; text-decoration:none;\" target=\"_blank\" href=/__panda/edit/?file={$file}&line={$line}>{$file}</a>";
             $dumpLabel = isset($options['label']) ? $options['label'] : "in <span style=\"color:gray\">{$file}</span> on line {$line}{$method}";
             echo self::dump($values, null, array('label' => $dumpLabel, 'var_name' => $varName));
             break;
         case 'e':
         case 'export':
             echo "{$labelField}<pre>" . var_export($values, true);
             echo '</fieldset></pre>';
             break;
         case 'h':
         case 'header':
             header("x-panda-{$label}", print_r($values, true));
             break;
         case 's':
         case 'syslog':
             syslog(LOG_DEBUG, "label:{$label}" . print_r($values, true));
             break;
         case 'f':
         case 'fire':
             if (class_exists('FB', false)) {
                 $label = isset($options['label']) ? $options['label'] : 'p() in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'];
                 FB::group($label);
                 FB::error($values);
                 FB::groupEnd();
             }
             break;
         case null:
         case 'printa':
         case 'print_a':
         default:
             $options = "max_y:100;pickle:1;label:{$label}";
             print_a($values, $options);
     }
     if (isset($options['return']) && $options['return'] === true) {
         return ob_get_clean();
     }
 }
Esempio n. 26
0
function echoQuery(&$db, $scope, $message)
{
    Var_Dump::display($scope . ': ' . $message);
}
Esempio n. 27
0
head("\$ftp->get({$singleTestFile}, {$baseDir}{$singleTestFile}, true)");
Var_Dump::display($ftp->get($singleTestFile, $baseDir . $singleTestFile, true));
head("\$ftp->chmod({$singleTestFile}, 700)");
Var_Dump::display($ftp->chmod($singleTestFile, 700));
head("\$ftp->ls(null, NET_FTP_FILES_ONLY)");
Var_Dump::display($ftp->ls(null, NET_FTP_FILES_ONLY));
head("\$ftp->cd('../')");
Var_Dump::display($ftp->cd('../'));
head("\$ftp->chmodRecursive({$baseDir}, 777)");
Var_Dump::display($ftp->chmodRecursive($baseDir, 777));
head("\$ftp->ls(null, NET_FTP_DIRS_ONLY)");
Var_Dump::display($ftp->ls(null, NET_FTP_DIRS_ONLY));
head("\$ftp->putRecursive({$baseDir}{$testUpDir}, {$baseDir}{$testUpDir})");
Var_Dump::display($ftp->putRecursive($baseDir . $testUpDir, $baseDir . $testUpDir));
head("\$ftp->putRecursive({$baseDir}{$testUpDir}, {$baseDir}{$testUpDir})");
Var_Dump::display($ftp->putRecursive($baseDir . $testUpDir, $baseDir . $testUpDir, true));
head("\$ftp->cd({$baseDir}:{$testUpDir})");
Var_Dump::display($ftp->cd($baseDir . $testUpDir));
head("\$ftp->ls(null, NET_FTP_DIRS_FILES)");
Var_Dump::display($ftp->ls(null, NET_FTP_DIRS_FILES));
head("\$ftp->cd(../../)");
Var_Dump::display($ftp->cd('../../'));
head("\$ftp->getRecursive({$baseDir}{$testUpDir}, {$baseDir}{$testDownDir})");
Var_Dump::display($ftp->getRecursive($baseDir . $testUpDir, $baseDir . $testDownDir, true));
head("\$ftp->rm({$baseDir}, true)");
Var_Dump::display($ftp->rm($baseDir, true));
head("\$ftp->ls(null, NET_FTP_DIRS_ONLY)");
Var_Dump::display($ftp->ls(null, NET_FTP_DIRS_ONLY));
head("\$ftp->disconnect()");
Var_Dump::display($ftp->disconnect());
Esempio n. 28
0
include_once "DB/DataObject/Cast.php";
include_once $ControllerDir . "Controller.class.php";
include_once "HTML/Template/PHPLIB.php";
include_once $ClassDir . "Actions.class.php";
require_once 'Log.php';
require_once 'LiveUser.php';
require_once 'I18N/Messages/File.php';
$i18n = new I18N_Messages_File($lang, $domain, $dir);
include_once $ConfigDir . "common.php";
require_once $ClassDir . "SendEmail.php";
$log_conf = array('mode' => 0777, 'timeFormat' => '%X %x');
$logger =& Log::singleton('file', $LogDir . date("Y_m_d") . '.log', '\\t', $log_conf);
if (defined('APF_DEBUG') && APF_DEBUG == true) {
    include_once 'Benchmark/Timer.php';
    include_once 'Var_Dump.php';
    Var_Dump::displayInit(array('display_mode' => 'HTML4_Table'));
    $timer =& new Benchmark_Timer();
    $timer->start();
}
$UploadDir = $RootDir . "web/" . $Upload_Dir;
$WebUploadDir = dirname(getenv("SCRIPT_NAME")) . "/" . $Upload_Dir;
$dsn = "{$DB_Type}://{$DB_UserName}:{$DB_PassWord}@{$DB_Host}/{$DB_Name}";
$conn =& DB::connect($dsn);
if (DB::isError($conn)) {
    $subject = "Error:cannot connect database";
    $error_msg = "Cannot connect database: " . $conn->getMessage() . "\n";
    errorMailToMaster($Tech_Mail, $subject, $error_msg);
    $logger->log($error_msg);
    die($error_msg);
}
$opts =& PEAR::getStaticProperty('DB_DataObject', 'options');
Esempio n. 29
0
echo '<h3>Translation</h3>';
$groups = $admin->perm->getGroups(array('fields' => array('group_id'), 'select' => 'col'));
if (empty($groups)) {
    echo 'Run the <strong>Group</strong> test first<br />';
    exit;
}
$admin->perm->removeTranslation(array('section_type' => LIVEUSER_SECTION_GROUP));
foreach ($groups as $group_id) {
    $data = array('section_id' => $group_id, 'section_type' => LIVEUSER_SECTION_GROUP, 'language_id' => 'de', 'name' => 'Name of ' . $group_id . 'is ' . md5(uniqid(rand())), 'description' => 'Description of ' . $group_id . 'is ' . md5(uniqid(rand())));
    $translation_id = $admin->perm->addTranslation($data);
    if ($translation_id === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } else {
        echo 'added translation for group <strong>' . $group_id . '</strong> with
              the translation id <strong>' . $translation_id . '</strong><br />';
    }
}
// Get
echo 'All the groups with translation:<br />';
$groups = $admin->perm->getGroups(array('fields' => array('group_id', 'name', 'description')));
if ($groups === false) {
    echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
    print_r($admin->getErrors());
} elseif (empty($groups)) {
    echo 'No groups were found<br />';
} else {
    Var_Dump::display($groups);
    echo '<br />';
}
echo '<hr />';
Esempio n. 30
0
    $upArea = $admin->perm->updateArea($data, $filters);
    if ($upArea === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } else {
        echo '<strong>Area2</strong> was updated<br />';
        $params = array('filters' => array('area_id' => $areas[$id]['area_id']));
        $result = $admin->perm->getAreas($params);
        if ($result === false) {
            echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
            print_r($admin->getErrors());
        } elseif (empty($result)) {
            echo 'No areas were found<br />';
        } else {
            Var_Dump::display($result);
        }
    }
    // Get
    $areas = $admin->perm->getAreas();
    if ($areas === false) {
        echo '<strong>Error on line: ' . __LINE__ . '</strong><br />';
        print_r($admin->getErrors());
    } elseif (empty($areas)) {
        echo 'No areas were found<br />';
    } else {
        echo 'These are our current areas:';
        Var_Dump::display($areas);
        echo '<br />';
    }
}
echo '<hr />';