Beispiel #1
0
 public function testWithKey()
 {
     $arr = arr(["name" => "Topher"]);
     foreach ($arr as $key => $value) {
         $this->assertEquals("name", $key);
         $this->assertEquals("Topher", $value);
     }
 }
Beispiel #2
0
function api()
{
    if (arr('SCRIPT_NAME', $_SERVER) != '/backend.php' || strpos(arr('CONTENT_TYPE', $_SERVER, ''), 'application/json') === false) {
        return false;
    }
    $api = array_intersect_key(json_decode(file_get_contents('php://input'), true), array_flip(array('jsonrpc', 'method', 'id', 'params')));
    return $api;
}
Beispiel #3
0
 public function __toString()
 {
     $map = function ($value, $name) {
         return $name . '="' . addcslashes($value, '"\\') . '"';
     };
     $attributes = $this->attributes ? ' ' . arr($this->attributes)->map($map)->join(' ') : '';
     if ($this->content != null) {
         return "<{$this->name}{$attributes}>{$this->content}</{$this->name}>";
     } else {
         return "<{$this->name}{$attributes}/>";
     }
 }
Beispiel #4
0
 function x6main()
 {
     ?>
     <h1>Skin Details</h1>
     
     <p><b>Current Skin:</b><?php 
     echo arr($_COOKIE, 'x6skin', 'win2k.gray.1024');
     ?>
     </p>
     <?php 
     if (isset($GLOBALS['AG']['x6skin'])) {
         hprint_r($GLOBALS['AG']['x6skin']);
     } else {
         echo "The skin was not loaded.";
     }
 }
Beispiel #5
0
 function mainLayout(&$div)
 {
     # Add the top level item as an x4Pane so it will fade in
     $x4Window = html('div', $div);
     $x4Window->addClass('x4Window');
     $x4Window->addClass('x4Pane');
     $x4Window->hp['id'] = 'x4Window';
     $x4Window->setAsParent();
     # The first two are simple, a description
     # and the menu bar.  These are permanent and will
     # be displayed for the entire time.
     $h1 = html('h1', $x4Window, $this->dd['description']);
     $h1->hp['id'] = 'x4H1Top';
     # Add the menu bar
     $x4Window->addChild($this->menuBar($this->dd));
     # Temp
     #ob_start();
     #hprint_r($_SESSION);
     #$x4Window->h('div',ob_get_clean());
     #  This is the top level display item
     #
     $x4Display = html('div', $x4Window);
     $x4Display->addClass('x4Pane');
     $x4Display->addClass('x4TableTop');
     $x4Display->ap['xTableId'] = $this->table_id;
     $x4Display->hp['id'] = 'x4TableTop_' . $this->table_id;
     $x4Display->setAsParent();
     # Create a grid for the default display
     $grid = $this->grid($this->dd);
     $grid->addClass('x4VerticalScroll1');
     $x4Display->addChild($grid);
     # Create a container and tab bar,
     #
     $tabC = html('div', $x4Display);
     $tabC->addClass('x4Pane');
     $tabC->addClass('x4TabContainer');
     $tabCId = 'x4TabContainer_' . $this->table_id;
     $tabC->hp['id'] = $tabCId;
     $tabC->ap['xTableId'] = $this->table_id;
     $tabC->setAsParent();
     $tabB = html('div', $tabC);
     $tabB->addClass('x4TabBar');
     $tabB->addClass('x4Div');
     $tabBId = 'x4TabBar';
     $tabB->hp['id'] = $tabBId;
     # For now we create only one detail pane,
     # later on we want more
     #
     $tabid = 'tab_' . $this->dd['table_id'];
     $tabx = html('div', $tabC);
     $detail = $this->detailPane('');
     $detailId = $detail->hp['id'];
     $detail->addClass('x4VerticalScroll2');
     $tabC->addChild($detail);
     $span = html('a-void', $tabB, '1: Detail');
     $span->hp['xAction'] = 'Ctrl1';
     $span->hp['id'] = 'tabFor_' . $detailId;
     $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$detailId}')";
     # Child table panes are added in a loop because there
     # may be more than one
     #
     $tabNumber = 2;
     foreach ($this->dd['fk_children'] as $table_id => $info) {
         #  First break: uidisplay set to none
         if (trim(strtolower(arr($info, 'uidisplay', ''))) == 'none') {
             continue;
         }
         # Second break: user not allowed to see
         $perms = SessionGet('TABLEPERMSSEL');
         if (!in_array($table_id, $perms)) {
             continue;
         }
         # Second skip: user not allowed
         $ddChild = ddTable($table_id, true);
         if ($ddChild['perms']['sel'] === 0) {
             continue;
         }
         $tabid = 'x4TableTop_' . $table_id;
         x4Data('dd.' . $table_id, $ddChild);
         # Make a tableTop container
         $tabx = html('div', $tabC);
         $tabx->addClass('x4Pane');
         $tabx->addClass('x4TableTop');
         $tabx->hp['id'] = $tabid;
         $tabx->ap['xTableId'] = $table_id;
         $tabx->setAsParent();
         # Create an x4 object
         $chdobj = x4Object($table_id);
         # KFD 7/8/08, look for a "mover" box, and do an
         #             alternate setup
         $table_id = $this->dd['table_id'];
         $uidisplay = $ddChild['fk_parents'][$table_id]['uidisplay'];
         if (trim($uidisplay) == 'mover') {
             $tabx->addChild($this->mover($ddChild, $table_id));
         } else {
             # Add into it the grid and the detail
             $tabx->addChild($chdobj->grid($this->table_id));
             $tabx->addChild($chdobj->detailPane($this->table_id));
         }
         # Make the tab entry
         $span = html('a-void', $tabB, $tabNumber . ': ' . $ddChild['description']);
         $span->hp['xAction'] = 'Ctrl' . $tabNumber;
         $span->hp['id'] = 'tabFor_' . $tabid;
         $tabNumber++;
         $span->hp['onclick'] = "\$a.byId('{$tabCId}').dispatch('{$tabid}')";
     }
 }
Beispiel #6
0
 function androHTMLxrefs($table_id, $height = 300)
 {
     # Extreme basics for child tables.
     $this->htype = 'div';
     $this->hp['x6table'] = $table_id;
     $this->hp['xCount'] = 0;
     # First bit of business is to run through and find
     # out if we actually have any kids.
     $dd = ddTable($table_id);
     $kids = array();
     $atts = array();
     foreach ($dd['fk_children'] as $table_kid => $info) {
         if (arr($info, 'x6xref', '') != '') {
             $kids[$table_kid] = $info['x6xref'];
             $atts[] = "{$table_kid}:{$info['x6xref']}";
         }
     }
     # If no kids, set ourselves to be invisible
     if (count($kids) == 0) {
         $this->hp['style'] = 'display: none;';
         return;
     }
     $this->hp['xCount'] = count($kids);
     $options = array('x6profile' => 'x6xrefs', 'x6table' => $table_id, 'styles' => array('overflow-y' => 'scroll'));
     $tabs = $this->addTabs($table_id . '_xrefs', $height, $options);
     $tabs->ul->hp['kids'] = implode("|", $atts);
     # If we are still here, we have at least one kid.  Let's
     # put in a tab bar and start adding the kids.
     foreach ($kids as $kid => $x) {
         $pane = $tabs->addTab($dd['fk_children'][$kid]['description']);
     }
 }
Beispiel #7
0
function go()
{
    $x = arr();
    $x['something']->hahaha = "yeah";
    return $x;
}
    function x6main()
    {
        $top = html('div');
        $top->addClass('fadein');
        $top->h('h1', 'User Options');
        $height = x6cssdefine('insideheight') - x6cssHeight('h1') * 2;
        $pad1 = x6cssDefine('pad1');
        $tabs = $top->addTabs('useroptions', $height);
        # --------------------------------------------------------------
        # This is skin stuff
        # --------------------------------------------------------------
        $tab1 = $tabs->addTab('Appearance');
        $tab1->hp['style'] = "padding: {$pad1}px";
        $file = fsDirTop() . 'templates/x6/skinsphp/x6skins.ser.txt';
        $skins = unserialize(file_get_contents($file));
        $select = html('select');
        $cookie = arr($_COOKIE, 'x6skin', 'Default.Gray.1024');
        foreach ($skins as $name => $stats) {
            $option = $select->h('option', $name);
            $option->hp['value'] = $stats;
            # Note that $cookie was defined above
            if ($cookie == $stats) {
                $option->hp['selected'] = 'selected';
            }
        }
        $select->hp['onchange'] = 'x6ChangeSkin(this)';
        ob_start();
        ?>
        
        <script>
        window.x6ChangeSkin = function(select) {
            // Sourceforge 2753325 use quirksmode-supplied set cookie
            createCookie('x6skin',select.value,3650);
            //document.cookie 
            //    = "x6skin="+select.value+"; expires=12/31/2049 00:00:00;";
            window.location.reload(true);
        }
        </script>
        <h2>Skin Selection</h2>
        Skin: <?php 
        echo $select->render();
        ?>
        <?php 
        $tab1->setHtml(ob_get_clean());
        # <------- EARLY RETURN
        #
        if (!inGroup('debugging')) {
            $top->render();
            return;
        }
        # --------------------------------------------------------------
        # Now for javascript and logging
        # --------------------------------------------------------------
        $tab2 = $tabs->addTab('Javascript Development');
        $tab2->hp['style'] = "padding: {$pad1}px";
        $tab2->h('h2', 'Alternate Javascript Files');
        $tab2->h('p', 'You can use this feature to debug and enhance the
            Andromeda Javascript files without having a complete installation.
            Here is how it works:');
        $ul = $tab2->h('ul');
        $ul->h('li', 'Use Firebug to make local copies of x6.js and androLib.js');
        $ul->h('li', 'Put these files somewhere you can edit them which is also
              on a <i>publicly visible website</i>.');
        $ul->h('li', 'Put the address of the public website here, including a
              trailing slash.');
        $ul->h('li', '<span style="color:red">If you make a mistake and the files
              are not visible, this demo will stop working.  Close your
              browser and try again.</span>');
        $tab2->h('span', 'Alternate Location:&nbsp;&nbsp;');
        $input = html('input');
        $input->hp['size'] = 70;
        $input->hp['id'] = 'altjs';
        $input->hp['value'] = arr($_COOKIE, 'altjs', '');
        $input->code['change'] = <<<JS
        function(input) {
            createCookie('altjs',input.value);
        }
JS;
        $tab2->addChild($input);
        $tab2->h('h2', 'Logging');
        $tab2->h('p', 'Logging is by default turned off.  Use the checkboxes
            below to turn on the various logging features.');
        $a = $tab2->h('a-void', 'Detect console devices');
        $a->code['click'] = <<<JS
        function(input) {
            var msg = x6consoleActivate();
            if(msg==false) {
                alert("No console devices found, logging is disabled");
            }
            else {
                alert(msg);
            }
        }
JS;
        $tab2->br(2);
        $loptions = array('Server' => 'Server-Side Query Log', 'FBLite' => 'I am on IE, load Firebug Lite for me', 'Group' => 'Javascript Log Outline', 'Log' => 'Javascript Log Detail', 'Warn' => 'Warnings', 'Info' => 'Informational', 'Error' => 'Errors', 'Time' => 'Time start/end (requires firebug)');
        foreach ($loptions as $loption => $description) {
            $input = html('input');
            $input->hp['type'] = 'checkbox';
            $input->hp['command'] = $loption;
            $input->code['click'] = <<<JS
            function(input) {
                var command = x6.p(input,'command');
                var checked = input.checked;
                if(checked) {
                    x6.console['enable'+command] = true;
                    createCookie('log_'+command,1);
                }
                else {
                    x6.console['enable'+command] = false;
                    eraseCookie('log_'+command);
                }
            }
JS;
            if (arr($_COOKIE, 'log_' . $loption, 0) == 1) {
                $input->hp['checked'] = 'checked';
            }
            $tab2->addChild($input);
            $tab2->h('span', $description);
            $tab2->br();
            if ($loption == 'Server') {
                $tab2->br();
            }
        }
        # --------------------------------------------------------------
        # End of the line
        # --------------------------------------------------------------
        $top->render();
    }
 public function testVariadic()
 {
     $input = arr([1, 2, 3, 4, 5]);
     $output = $input->toArray();
     $this->assertEquals($output, array_merge(...arr($input)->chunk(1)->toArray()));
 }
Beispiel #10
0
 public function testArrghOfArrgs()
 {
     $arr = arr([arr([5, 4]), arr(["a", "b"])]);
     $this->assertEquals([[5, 4], ["a", "b"]], $arr->toArray());
 }
Beispiel #11
0
 public function testPartition()
 {
     $input = [1, 2, 3, 4];
     $this->assertEquals([[2, 4], [1, 3]], arr_partition($input, function ($item, $key) {
         return $item % 2 === 0;
     }));
     $result = arr($input)->partition(function ($item) {
         return $item % 4 === 0;
     })->first()->toArray();
     $this->assertEquals([4], $result);
 }
Beispiel #12
0
#
# =====================================================================
echo "\n<title>" . vgfGet('pageTitle') . "</title>\n";
# =====================================================================
#
# The jQuery libraries always come first
#
#  NOTICE!  Andromeda has its own mini-fication system,
#           so do not fear all of these individual files!
#
# =====================================================================
# The jQuery library always comes first
jsInclude('clib/jquery-1.8.3.min.js', 'JQuery is distributed under the GPL
          license, written by a team of programmers led by John Resig,
          more info at http://www.jquery.com', 'Y');
$xpath = arr($_COOKIE, 'altjs', 'clib/');
$configJS = trim(configGet('js_css_debug', 'N'));
if ($deprecated == 'Y') {
    $styles = ElementImplode('styles');
    if ($styles != '') {
        ?>
        <style type="text/css">
        <?php 
        echo $styles;
        ?>
        </style>
        <?php 
    }
    ob_start();
    ElementOut('script');
    $script = ob_get_clean();
Beispiel #13
0
 function gridGeneric(&$grid, $dd, $tabPar = '', $vals2 = array())
 {
     $table_id = $dd['table_id'];
     # KFD 12/18/08.  If we have a tablePar and $vals2, we will
     #                put a set of options onto the grid that
     #                it will respect when building the inputs
     if ($tabPar != '') {
         $options = array();
         foreach ($vals2 as $colname => $colvalue) {
             $options[$colname] = array('parentTable' => $tabPar, 'attributes' => array('xDefault' => $colvalue));
         }
         x6debug($options);
         $grid->setColumnOptions($options);
     }
     # KFD 1/29/09 tell us the x6childwrites setting
     $grid->hp['x6childwrites'] = trim($this->dd['x6childwrites']);
     if (trim($this->dd['x6childwrites']) == 'Y') {
         $grid->hp['x6childwrites'] = 'grid';
     }
     # KFD 11/15/08
     # Nifty trick to allow different columns when viewed as
     # child table.  If tabPar is passed in, we will pick
     # the projection named "child_{tabPar}" if it exists.
     # The first line will pull an empty result if this feature
     # has not been used by the programmer, which causes a fallback
     # to the normal uisearch approach.
     $uisearch = arr($dd['projections'], 'child_' . $tabPar, '');
     if ($uisearch == '') {
         $uisearch = $dd['projections']['_uisearch'];
     }
     $aColumns = explode(',', $uisearch);
     foreach ($aColumns as $column) {
         $type_id = $dd['flat'][$column]['type_id'];
         $x6view = arr($dd['flat'][$column], 'x6view', '');
         if ($type_id == 'text' && $x6view == '') {
             $dd['flat'][$column]['dispsize'] = 20;
         }
         $grid->addColumn($dd['flat'][$column]);
     }
     $gridWidth = $grid->lastColumn();
     return $gridWidth;
 }
Beispiel #14
0
 function x6main()
 {
     $top = html('div');
     $top->hp['style'] = 'text-align: center;';
     $top->addClass('fadein');
     $top->h('h1', configGet('x4menutitle'));
     # Get some basic dimensions we will use to build the
     # menu system.  Our basic metric is 10% of the
     # screen width, and then 10% of that.
     $pad0 = x6CssDefine('pad0');
     $insidewidth = x6CssDefine('insidewidth');
     $width1 = intval($insidewidth / 10);
     $widthl = $width1 * 3;
     $widthr = $width1 * 3;
     $width1b = intval($width1 / 2);
     $width2 = intval($width1 / 10);
     $outer = $top->h('div');
     $outer->hp['id'] = 'x6menu_outer';
     $outer->hp['xWidth1'] = $width1;
     $outer->hp['xWidth1b'] = $width1b;
     $outer->hp['xWidth2'] = $width2;
     $outer->hp['style'] = "padding: {$width1b}px {$width1}px;\n               text-align: left;";
     # Calculate height of inner, this forces height of outer
     $iHeight = x6cssDefine('insideheight');
     $iHeight -= x6cssHeight('h1');
     $iHeight -= $width1b * 2;
     $inner = $outer->h('div');
     $inner->hp['id'] = 'x6menu_inner';
     $inner->hp['style'] = " border: 1px solid " . x6cssDefine('bgcdark') . ";\n               height: {$iHeight}px;\n               padding:{$width2}px";
     # calculate height of left;
     $lHeight = $iHeight - $width2;
     $leftDiv = $inner->h('div');
     $leftDiv->hp['id'] = 'x6menu_left';
     $leftDiv->hp['style'] = "background-color: " . x6cssDefine('bgcdark') . ";\n             float: left;\n             height: {$lHeight}px;\n             width: {$widthl}px";
     $rightDiv = $inner->h('div');
     $rightDiv->hp['id'] = 'x6menu_right';
     $rightDiv->hp['style'] = "position: relative; float: left; width: {$widthr}px;";
     $AGMENU = SessionGet('AGMENU');
     $countLeft = 1;
     foreach ($AGMENU as $menuid => $menuinfo) {
         if (count(arr($menuinfo, 'items', array())) == 0) {
             continue;
         }
         $h2 = $leftDiv->h('div', $countLeft . ": " . $menuinfo['description']);
         $h2->hp['xKey'] = $countLeft;
         $countLeft++;
         $h2->hp['id'] = 'module_' . $menuid;
         $h2->hp['xMenuId'] = $menuid;
         $h2->hp['style'] = "padding: {$width2}px";
         $h2->hp['onclick'] = "x6.byId('x6menu_outer').clicked('module_{$menuid}');";
         $h2->hp['onmouseover'] = "this.style.textDecoration='underline'";
         $h2->hp['onmouseout'] = "this.style.textDecoration=''";
         $idLeft = $width2 * 2;
         $itemsDiv = $rightDiv->h('div');
         $itemsDiv->hp['id'] = 'items_' . $menuid;
         $itemsDiv->hp['style'] = "position: absolute; top: 0; left: {$idLeft}px; display: none";
         $countRight = 65;
         foreach ($menuinfo['items'] as $page => $pageinfo) {
             # Special hardcoded hack for x6 to remove some items
             if ($page == 'apppub') {
                 continue;
             }
             if ($page == 'userssimple') {
                 continue;
             }
             $pd = strtolower(chr($countRight)) . ': ' . $pageinfo['description'];
             $a = $itemsDiv->h('div', $pd);
             $a->hp['xKey'] = strtolower(chr($countRight));
             $a->hp['xactive'] = 'N';
             $countRight++;
             $a->hp['onmouseover'] = "\$('#x6menu_right .hilight').removeClass('hilight');\n                     \$(this).addClass('hilight')";
             # DUPLICATE CODE ALERT.  THIS CODE IS ALSO IN
             #   TEMPLATES/X6/X6MENUTOP.PHP
             # KFD 2/20/09 Sourceforge 2616802
             if ($pageinfo['uix2'] == 'Y') {
                 $href = "?gp_page={$page}&amp;x2=1";
             } else {
                 $href = "?x6page={$page}&amp;x6module={$menuid}";
             }
             $a->hp['onclick'] = "window.location='{$href}'";
             $a->hp['id'] = 'page_' . $page;
             if (arr($pageinfo, 'spaceafter', 'N') == 'Y') {
                 $itemsDiv->h('hr');
             }
         }
     }
     $top->render();
 }
Beispiel #15
0
function index_hidden_x6Dispatch($x6page, $x6file, $x6yaml, $x6profile, $x6plugin, $x6action)
{
    # This is everything that *might* go back, make a place
    # for all of it
    $GLOBALS['AG']['x4'] = array('error' => array(), 'debug' => array(), 'notice' => array(), 'html' => array(), 'script' => array());
    vgfSet('x6', true);
    # KFD 12/10/08, allow dynamic lookups.
    #
    if (gp('x6select', false)) {
        $table_id = gp('x6page');
        $gpletters = gp('gpletters');
        # KFD 4/11/09 Sourceforge 2753358 do real matches
        $matches = aFromGp('mtch_');
        $rows = RowsForSelect($table_id, $gpletters, $matches, '', true);
        foreach ($rows as $idx => $row) {
            unset($rows[$idx]['skey']);
            foreach ($row as $col => $val) {
                if ($col != 'skey') {
                    $rows[$idx][$col] = trim($val);
                }
            }
        }
        x6Data('x6select', $rows);
        echo json_encode_safe($GLOBALS['AG']['x4']);
        return;
    }
    # Make hidden variables for x6page and module
    hidden('x6page', $x6page);
    hidden('x6module', gp('x6module', 'X'));
    # This little bit of magic loads up the CSS information
    # for the current template and skin, allowing downstream
    # code to determine how much space they have to work with
    #
    $x6skin = arr($_COOKIE, 'x6skin', 'Default.Gray.1024');
    setCookie('x6skin', $x6skin);
    if ($x6skin != '') {
        $filename = fsDirTop() . "templates/x6/skinsphp/x6skin.{$x6skin}.ser.txt";
        if (file_exists($filename)) {
            $serialized = file_get_contents($filename);
            $GLOBALS['AG']['x6skin'] = unserialize($serialized);
        }
    }
    # If they have already defined MPPages in applib, we will
    # pick it up here with this global declaration.
    #
    # MPPages lists pages that may be accessed w/o login
    global $MPPages;
    if (!is_array($MPPages)) {
        $MPPages = array();
    }
    $MPPages['x_home'] = 'Home Page';
    $MPPages['x_login'] = '******';
    $MPPages['x_noauth'] = 'Authorization Required';
    $MPPages['x_password'] = "******";
    $MPPages['x_mpassword'] = "******";
    $MPPages['x_paypalipn'] = 'Paypal IPN';
    # Session timeouts.  Need to code for basic page access
    # and code for ajax timeouts.
    if (!LoggedIn() && !in_array($x6page, array_keys($MPPages))) {
        if (gpExists('json')) {
            x4Script("window.location='index.php?gp_page=x_login'");
            echo json_encode($GLOBALS['AG']['x4']);
        } else {
            echo "<script>window.location='index.php?gp_page=x_login&x2=1'</script>";
        }
        return;
    }
    # Include the basic x6 class, and set a default for
    # the class and the method call
    include 'androX6.php';
    $x6class = 'androX6';
    $x6method = 'x6main';
    # This is the core resolution where we figure out what class
    # to use and what method to call.  It is a little complicated
    # because we support 3 different kinds of pages (yaml, profile
    # and custom) plus calls from plugins to refresh, plus JSON
    # calls to do database stuff.
    if ($x6plugin != '') {
        # DEFUNCT.  We don't use plugins, they were an early
        #           idea, but profiles and androHTML classes
        #           made them unecessary.
        # A plugin always wins.  A call to a plugin assumes that
        # x6action is also specified.  We are going to instantiate
        # the plugin and call the method named by x6action.
        #$x6file  = '';
        #$x6class = 'x6plugin'.$x6plugin;
        #$x6method= $x6action;
        #include($x6class.'.php');
    } else {
        # No plugin means we are either using the base andromeda
        # class androX6, or using a custom class.  We only use
        # a custom class if the programmer has supplied a file.
        # So if that file exists we load that and use it.
        if ($x6file != '') {
            $x6class = 'x6' . $x6page;
            include $x6class . '.php';
        }
        # The next major decision is whether we are calling some
        # specific action, or loading a page.  If an action was
        # specified that wins.
        if ($x6action != '') {
            $x6method = $x6action;
        } else {
            # KFD 12/22/08.  Support for androPage! Extremely important!
            if (file_exists("application/{$x6page}.page.yaml")) {
                $x6class = 'androPage';
                $x6method = 'x6main';
                include 'androPage.php';
            } else {
                # Now we must be loading a page, because no plugin was
                # specified and no action.  At this point all that is
                # left to figure out is whether we load a profile or
                # go for the default "x6main" routine.
                if ($x6profile != '') {
                    $x6method = 'profile_' . $x6profile;
                } else {
                    $x6method = 'x6main';
                }
            }
            # If we are loading a page, we need the x6 javascript
            # and the first command in jqDocReady should be to
            # initialize the objects so downstrem code can make
            # them visible.
            # KFD 12/23/08, see if they set a cookie for an
            #               alternate location.
            # KFD 1/22/09 , Yikes! Don't do this if JSON was passed
            if (gp('json', '') != '1') {
                $xpath = arr($_COOKIE, 'altjs', 'clib/');
                jsInclude($xpath . 'x6.js');
                #jsInclude('clib/jquery.maskedinput-1.1.4.js');
                jqDocReady('x6.init()');
            }
        }
    }
    # Final trap.  If the class is androX6 and the method
    # is x6main, this means an unprogrammed page: there is
    # no custom program file and no profile in the yaml.
    # So we default to the conventional profile.
    #
    # KFD 2/17/09 Sourceforge 2546056
    #             This means that bad page requests go to
    #             profile_conventional(), so that is where
    #             we trap for them.  See androX6::profile_conventional()
    if ($x6method == 'x6main' && $x6class == 'androX6') {
        $x6method = 'profile_conventional';
        # KFD 2/2/09.  Allow fallback to x2 processing.  If the
        #              app is set for it, and a file exists, call
        #              that instead
        if (configGet('x6_x2', 'N') == 'Y') {
            if (file_exists(fsDirTop() . 'application/' . $x6page . '.php')) {
                include_once 'x_table2.php';
                include_once $x6page . '.php';
                $x6class = $x6page;
                $x6method = "main";
            }
        }
    }
    # Now everything is resolved.  We know what class to instantiate
    # and what method to call, so go for it.
    ob_start();
    $obj = new $x6class();
    # KFD 3/30/09 Sourceforge 2697962 Do this here, so it
    #             does not matter if androX6 or androPage
    $obj->hld = aFromGp('hld_');
    $obj->dd = ddTable($x6page);
    $obj->x6page = $x6page;
    $obj->view = arr($obj->dd, 'viewname', '');
    $obj->{$x6method}();
    $HTML = ob_get_clean();
    # KFD 3/20/09 Sourceforge 2697962
    #             Make sure programmer never has to send out
    #             hold variables, they should go automatically
    if (gp('json') != 1) {
        if (isset($obj->hld)) {
            foreach ($obj->hld as $name => $value) {
                # KFD 3/20/09 Sourceforge 2697962
                #             Put out as hidden instead
                hidden('hld_' . $name, $value);
                #$inp = $top->h('input');
                #$inp->hp['type'] = 'hidden';
                #$inp->hp['name'] = $inp->hp['id'] = 'hld_'.$name;
                #$inp->hp['value'] = $value;
            }
        }
    }
    # Now if they made a "main" call, see if they want us to
    # send back some script as well
    if ($x6method == 'x6main') {
        if (method_exists($obj, 'x6script')) {
            ob_start();
            $obj->x6script();
            x6script(ob_get_clean());
        }
    }
    # And again see if they are sending out any popups
    if ($x6method == 'x6main') {
        if (method_exists($obj, 'x6modals')) {
            ob_start();
            $obj->x6modals();
            $HTML .= ob_get_clean();
        }
    }
    x6HTML('*MAIN*', $HTML);
    # Put errors in that were reported by database operations
    if (Errors()) {
        $errs = errorsGet();
        foreach ($errs as $err) {
            x4Error($err);
        }
    }
    # CODE BELOW HERE WAS TAKEN FROM X4 UNCHANGED.
    # if the "json" flag is set, we return all output as JSON,
    # otherwise we package it up with the normal template and
    # return it as main content
    if (gp('json') == 1) {
        echo json_encode_safe($GLOBALS['AG']['x4']);
    } else {
        # Don't need a form in x6 mode
        vgaSet('NOFORM', true);
        #  Put things where the template expects to find them
        vgfSet('HTML', $GLOBALS['AG']['x4']['html']['*MAIN*']);
        #  If there was some script, add that in
        foreach ($GLOBALS['AG']['x4']['script'] as $script) {
            jqDocReady($script);
        }
        # Just before the absolute very last command is the
        # firing of our (currently) one and only queue
        jqDocReady('x6events.fireQueue("afterInit")');
        # The absolute very last command is the fade in
        $fadeIn = "\$('.fadein').fadeIn('slow',function() { x6.initFocus(); });";
        jqDocReady($fadeIn);
        # DUPLICATE ALERT: This code copied from
        #                  index_hidden_page() below
        index_hidden_template('x4');
        global $J;
        $mainframe = $J['mainframe'];
        $my = $J['my'];
        $mosConfig_absolute_path = $J['mC_absolute_path'];
        $mosConfig_live_site = $J['mC_live_site'];
        $template_color = $J['template_color'];
        $template_color = 'red';
        $file = $GLOBALS['AG']['dirs']['root'] . '/templates/' . $mainframe->GetTemplate() . "/index.php";
        include $file;
    }
    return;
}
Beispiel #16
0
 public function findTest($iduser)
 {
     $this->set("data", $this->Tests->find("all", array('conditions' => arr('Tests.'))));
 }
Beispiel #17
0
# If none, pick win2k.gray.1024
$cookie = arr($_COOKIE, 'x6skin', 'Default.Gray.1024');
?>
<link    rel="stylesheet"
       x6skin="Y"
        href="templates/x6/skins/x6skin.<?php 
echo $cookie;
?>
.css" />
<?php 
include 'androHTMLHead.php';
?>

<?php 
# KFD 12/30/08, A cookie-controlled script to load firebug lite
$loadFBLite = arr($_COOKIE, 'log_FBLite', 0);
if ($loadFBLite == 1) {
    ?>
    <script type='text/javascript' 
        src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'
           ></script>        
    <?php 
}
?>
</head>
<body>
<div class="x6menu">
    <?php 
include 'x6menuTop.php';
?>
</div>
Beispiel #18
0
		$displayName = $xpath->query("/rsp/profile/displayName")->item(0)->textContent;
		$identifier = $xpath->query('/rsp/profile/identifier')->item(0)->textContent;
		$email = $xpath->query('/rsp/profile/email')->item(0)->textContent;

		$profile = $xpath->query("/rsp/profile/*");

		foreach($profile as $item) {
			arr($item->nodeName);
			arr($item->textContent);
		}
		break;
	case "manage_waitinglist":
		$smarty_q->assign("h1", "");
		$smarty_q->assign("fake_h1", _("Quotation waitinglist"));
		$smarty_q->assign ("quotes", quote::get_from_waitinglist());
		arr(quote::get_from_waitinglist());
	break;
	// A temporary solution to activate quotations
	case "manage_not_active_quotations":
		acl();
		if (isset($_POST["manage_not_active_quotations"]))
		{
			quote::set_random_quote($_POST);
		}
		$smarty_q->assign("h1", "");
		$smarty_q->assign("fake_h1", _("Activate random quote"));
		$smarty_q->assign("categories", category::get_categories());
		$smarty_q->assign("manage_not_active_quotations", true);
		$quotes_temp = quote::get_random_quote();
		//arr($quotes_temp);
		$smarty_q->assign("id", $quotes_temp[0]["id"]);
Beispiel #19
0
 function get_tags($arr)
 {
     arr($arr);
 }
Beispiel #20
0
     class = "x6modalblock"
   onclick = "return false">&nbsp;</div>
<div id="x6modal"       style="display:none;" class="x6modal">
<?php 
$modals = arr($GLOBALS['AG'], 'modals', array());
foreach ($modals as $modal) {
    $modal->render();
}
?>
    
</div>
<?php 
# KFD 12/31/08.  Restrict the query log to people who have
#                set the cookie and are in the 'debuggers' group
$debugging = inGroup('debugging');
$cookie = arr($_COOKIE, 'log_Server', 0);
if ($debugging && $cookie) {
    echo '<br /><div class="androQueryLog">';
    echo '<div class="androQueryLogTitle">
        <div style="float:left;height:20px;">Query Log</div><div style="float:right;height:20px;cursor:pointer;" onclick="showHide(\'androQueryLogItems\');">Show/Hide</div></div>';
    echo '<div class="androQueryLogItems" id="androQueryLogItems">';
    foreach ($GLOBALS['AG']['dbg']['sql'] as $key => $line) {
        echo '<div class="androQueryLogItem" style="width:auto;"><strong>Query:</strong> ' . '<div><pre style="max-width:100%;">' . $line['sql'] . '</pre></div>
            <div><strong>Execution time:</strong>' . number_format($line['time'], 4) . '</div>
            <div onclick="showHide(\'stack-' . $key . '\');" style="cursor:pointer;">More Details</div>';
        echo '<div style="display:none;" id="stack-' . $key . '">';
        echo "<strong>Execution Stack:</strong><pre>" . $line['stack'] . "</pre></div>";
        echo "</div>";
    }
    echo '</div></div>';
}
Beispiel #21
0
 public function testKeepChainOnce()
 {
     $input = [1, 2, 3, 4, 5];
     $this->assertEquals(10, arr($input)->keepOnce()->pop()->sum());
 }
Beispiel #22
0
 function format($string, $type)
 {
     return json_encode(arr(hashify(array("s" => $string, "type" => $type)))) . "\n";
 }
Beispiel #23
0
<?php

require_once dirname(__FILE__) . "/common.inc.php";
// C# code:
//var ary = { 1, 2, 3 };
// var x = 2;
// ary.Select(elem => elem * x;);
// PHP code:
$arr = arr(1, 2, 3);
$x = 2;
$arr->select(eval(${new closure('$el')}->{'$el*=$x'}));
class __Base__
{
    private function name_space($ns_parts)
    {
        $nsp = '';
        foreach ($ns_parts as $part) {
            $nsp .= (empty($nsp) ? '' : '::') . $part;
        }
        return $nsp;
    }
    public function __construct()
    {
        $ns_parts = explode('__', get_class($this));
        echo $this->name_space($ns_parts);
    }
}
class A extends __Base__
{
}
class A__B__C extends __Base__
Beispiel #24
0
        }
        $pd = $pageinfo['description'];
        $li = $ul->h('li');
        $a = $li->h('a', $pd);
        #$li->hp['onmouseover']="$(this).addClass('selected')";
        #$li->hp['onmouseout'] ="$(this).removeClass('selected')";
        if ($pageinfo['uix2'] == 'Y') {
            #$a->hp['href'] = "?gp_page=$page&x2=1";
            $href = "?gp_page={$page}&amp;x2=1";
        } else {
            #$a->hp['href'] = "?x6page=$page";
            $href = "?x6page={$page}&x6module={$menuid}";
        }
        #$li->hp['onclick'] = "window.location='$href'";
        $a->hp['href'] = "{$href}";
        if (arr($pageinfo, 'spaceafter', 'N') == 'Y') {
            if ($count != count($menuinfo['items'])) {
                $li = $ul->h('li');
                $li->addClass('dropdown');
                $li->hp['style'] = 'cursor: auto';
                $li->hr();
            }
        }
    }
}
$ulpads->render();
if (LoggedIn()) {
    ?>
    <div style="float: right">
      <a href="?x6page=menu">Menu</a>
      &nbsp;&nbsp;
Beispiel #25
0
 public function get_menu($appid, $appsecret)
 {
     $arr = $this->get_access_token($appid, $appsecret);
     if ($arr['access_token']) {
         $ACCESS_TOKEN = $arr['access_token'];
         $url = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" . $ACCESS_TOKEN;
         arr($url);
         $arr = json_decode(file_get_contents($url), 1);
         return $arr;
     } else {
         return $arr;
     }
 }
Beispiel #26
0
function delItem2Bucket($delId)
{
    global $bucket;
    arr($bucket);
    unset($bucket[$delId]);
    arr($bucket);
    saveBucket();
}
Beispiel #27
0
 public static function get_new_quotes_from_zitate_de()
 {
     while (quote::zitate_de__check_if_can_fetch_quotes()) {
         $quote = quote::zitate_de__get_1_new_quote_from_zitate_de();
         arr($quote);
         quote::zitate_de__insert_quote_to_database($quote);
         flush2();
         //$i++;
     }
 }