Exemplo n.º 1
0
 public function run()
 {
     $modelsDir = $appConfig['modelsDir'] ?? realpath(__DIR__ . str_repeat(DIRECTORY_SEPARATOR . '..', 3) . DIRECTORY_SEPARATOR . 'models');
     $appConfig = configGet('appConfig');
     $dbConfig = configGet('dbConfig');
     $dsn = $dbConfig['dsn'] . ';dbname=' . $dbConfig['dbName'];
     $this->dbh = new PDO($dsn, $dbConfig['user'], $dbConfig['password']);
     $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     foreach (glob($modelsDir . DIRECTORY_SEPARATOR . '*.php') as $file) {
         $mdFile = $this->_retrieveMetadataFile($file);
         $md = $this->_retrieveMetadata($mdFile, $file);
         if ($md === false) {
             continue;
         }
         $tableName = $md['table'] ?? pathinfo($file, PATHINFO_FILENAME);
         unset($md['table']);
         if ($this->_alterOrCreate($tableName) == self::CREATE) {
             $this->_createTable($tableName, $md);
         } else {
             $this->_alterTable($tableName, $md);
         }
         echo "Successfully updated {$tableName} into database !" . PHP_EOL;
     }
     $this->dbh = null;
 }
Exemplo n.º 2
0
 private function _updateConfig()
 {
     $result = $this->prompter->getResults();
     $dbConfig = configGet('dbConfig');
     $dbConfig['dbName'] = $result['name'];
     $dbConfig['charset'] = $result['charset'];
     configSet('dbConfig', $dbConfig);
 }
Exemplo n.º 3
0
function loadOptions($argv)
{
    $options = getopt('', configGet('options'));
    if (isset($options['help'])) {
        return false;
    }
    if (isset($options['configDir'])) {
        configSet('configDir', $options['configDir']);
    }
}
Exemplo n.º 4
0
 public function run()
 {
     $appConfig = configGet('appConfig');
     $modelsDir = $appConfig['modelsDir'] ?? realpath(__DIR__ . str_repeat(DIRECTORY_SEPARATOR . '..', 3) . DIRECTORY_SEPARATOR . 'models');
     foreach (glob($modelsDir . DIRECTORY_SEPARATOR . '*.php') as $file) {
         $generated = PHP_EOL;
         $contents = file_get_contents($file);
         $attributes = $this->_retrieveAttributes($contents);
         if ($attributes === false) {
             continue;
         }
         foreach ($attributes as $attribute) {
             if ($this->_isGetterPresent($contents, $attribute) === false) {
                 $this->_addGetter($generated, $attribute);
             }
             if ($this->_isSetterPresent($contents, $attribute) === false) {
                 $this->_addSetter($generated, $attribute);
             }
         }
         $this->_addGeneratedToFile($contents, $generated, $file);
         echo "Getters and setters successfully added to {$file} !" . PHP_EOL;
     }
 }
Exemplo n.º 5
0
#
# Old-fashioned pre-x4 pre-jquery way to set focus.
# Don't ever use this!  It will be deprecated
# sooner or later.
#
# =====================================================================
$jqdr = vgfGet('jqDocReady', array());
if (count($jqdr) > 0) {
    ?>
    <script type="text/javascript">
    $(document).ready(function() {
<?php 
    echo implode("\n", $jqdr);
    ?>
 
    });
    </script>
    <?php 
}
if (configGet('deprecated', 'Y') == 'Y') {
    $scriptend = ElementImplode('scriptend');
    if ($scriptend != '') {
        ?>
        <script type="text/javascript">
        <?php 
        echo $scriptend;
        ?>
        </script>
        <?php 
    }
}
Exemplo n.º 6
0
 /**
  *  Takes a list of tables and UNIONs them together
  *  and builds the complete query for them.  Supports
  *  only very limited abilities at this time, basically
  *  assuming the queries are defined correctly and
  *  doing a UNION ALL.
  *
  *  Returns: A SQL SELECT statement
  */
 function genSQLSectionUnion($yamlP2)
 {
     $page = $this->page;
     $uifilter = $this->page['uifilter'];
     $sql = array();
     foreach ($yamlP2 as $table_id => $tabinfo) {
         $SQL_COLSWHA = array();
         $collist = array("'{$table_id}' as _source");
         $collist[] = 'skey';
         foreach ($tabinfo['column'] as $column_id => $colinfo) {
             if (a($colinfo, 'constant', '') != '') {
                 $collist[] = SQLFC($colinfo['constant']) . " as {$column_id}";
             } else {
                 $collist[] = "{$table_id}.{$column_id}";
                 # KFD 6/18/08, reroute to new SQLFilter
                 #$compare = sqlFilter($colinfo,
                 $compare = $this->SQLCompare($table_id, $column_id, $colinfo);
                 if ($compare != '') {
                     $SQL_COLSWHA[] = $compare;
                 }
             }
         }
         $sq = "SELECT " . implode("\n      ,", $collist) . " FROM {$table_id} ";
         if (count($SQL_COLSWHA) > 0) {
             $sq .= "\n WHERE " . implode("\n   AND ", $SQL_COLSWHA);
         }
         $sql[] = $sq;
     }
     # Build the sql
     $sql = implode("\nUNION ALL\n", $sql);
     if (gp('gp_post') == 'onscreen') {
         $sql .= " LIMIT " . configGet('sql_limit');
     }
     return $sql;
 }
Exemplo n.º 7
0
    function main()
    {
        $this->PageSubtitle = "Please Login";
        // KFD 3/6/08, changed login processing to st2login=1,
        //             its not a page anymore.
        hidden('st2login', 1);
        hidden('gp_page', 'x_login');
        hidden('gp_posted', '1');
        // Send these out so they are available after successful login
        $gpz = aFromGp('gpz_');
        foreach ($gpz as $var => $val) {
            hidden('gpz_' . $var, $val);
        }
        $loginUID = gp("loginUID", "", false);
        vgfSet("HTML_focus", "loginUID");
        // EXPERIMENTAL.  DOING THIS FOR ONLY ONE CLIENT RIGHT NOW
        $hForgot = vgaget('hfmode', false) == true ? 'x_password.phtml' : 'index.php?gp_page=x_password';
        /**
        name:Replace Login Form
        
        You can replace the default login form by putting a file named
        "x_login_form.inc.html" into the [[Application Directory]].  
        */
        if (File_exists_incpath('x_login_form.inc.html')) {
            if (vgaGet('html_main') != 'html_skin_tc') {
                include 'x_login_form.inc.html';
                return;
            }
        }
        ?>
	

<!-- LOGIN HTML (BEGIN) -->



	<div class="row">
		<div class="span3"></div>
		<div class="span3">
			<fieldset>
				<legend align="center"><?php 
        echo configGet('loginbefore', $GLOBALS['AG']['app_desc']);
        ?>
</legend>
				<div class="control-group">
					<label class="control-label">Login Name:</label>
					<div class="controls">
						<input type="text" id="loginUID" name="loginUID" maxlength="60" value="<?php 
        echo $loginUID;
        ?>
" />
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">Password:</label>
					<div class="controls">
						<input name="loginPWD" type="password" maxlength="20"/>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<input class="btn btn-primary" type="submit" name="pushSave" value="Login" />
					</div>
				</div>
				<p align="center"><a href="<?php 
        echo $hForgot;
        ?>
">Forgotten Password and Change Password</a></p>
			</fieldset>
		</div>
		<div class="span3"></div>
	</div>
<!-- LOGIN HTML (END) -->		
		<?php 
    }
Exemplo n.º 8
0
 /**
  * Generate search results for an x4browse/search
  *
  * @author: Kenneth Downs
  */
 function browseFetch()
 {
     #  This is the list of columns to return
     $acols = explode(',', $this->dd['projections']['_uisearch']);
     #  By default the search criteria come from the
     #  variables, unless it is a child table search
     $vals = aFromGP('x4w_');
     $awhere = array();
     $tabPar = gp('tableIdPar');
     if ($tabPar != '') {
         $ddpar = ddTable(gp('tableIdPar'));
         $pks = $ddpar['pks'];
         $stab = ddView(gp('tableIdPar'));
         $skey = SQLFN(gp('skeyPar'));
         $vals2 = SQL_OneRow("SELECT {$pks} FROM {$stab} WHERE skey = {$skey}");
         if (!$vals2) {
             $vals2 = array();
         }
         $vals = array_merge($vals, $vals2);
     }
     # Build the where clause
     #
     foreach ($vals as $column_id => $colvalue) {
         if (!isset($this->flat[$column_id])) {
             continue;
         }
         $colinfo = $this->flat[$column_id];
         $exact = isset($vals2[$column_id]);
         //$tcv  = trim($colvalue);
         $tcv = $colvalue;
         $type = $colinfo['type_id'];
         if ($tcv != "") {
             // trap for a % sign in non-string
             $xwhere = sqlFilter($this->flat[$column_id], $tcv);
             if ($xwhere != '') {
                 $awhere[] = "({$xwhere})";
             }
         }
     }
     # <----- RETURN
     if (count($awhere) == 0) {
         x4Debug("returning");
         return;
     }
     # Generate the limit
     # KFD 11/12/08, modified to respect sql_limit, with default of 100
     $SLimit = ' LIMIT ' . configGet('sql_limit', 100);
     if ($tabPar != '') {
         if (a($this->dd['fk_parents'][$tabPar], 'uiallrows', 'N') == 'Y') {
             $SLimit = '';
         }
     }
     #  Build the Order by
     #
     $ascDesc = gp('sortAD') == 'ASC' ? ' ASC' : ' DESC';
     $aorder = array();
     $searchsort = trim(a($this->dd, 'uisearchsort', ''));
     if (gpExists('sortAD')) {
         $aorder[] = gp('sortCol') . ' ' . gp('sortAD');
     }
     if ($searchsort != '') {
         $aocols = explode(",", $searchsort);
         foreach ($aocols as $pmcol) {
             $char1 = substr($pmcol, 0, 1);
             $column_id = substr($pmcol, 1);
             if ($char1 == '+') {
                 $aorder[] = $column_id . ' ASC';
             } else {
                 $aorder[] = $column_id . ' DESC';
             }
         }
         $SQLOrder = " ORDER BY " . implode(',', $aorder);
     } else {
         # KFD 6/18/08, new routine that works out sort
         $aorder = sqlOrderBy($vals);
         if (count($aorder) == 0) {
             $SQLOrder = '';
         } else {
             $SQLOrder = " ORDER BY " . implode(',', $aorder);
         }
     }
     # just before building the query, drop out
     # any columns that have a table_id_fko to the parent
     foreach ($acols as $idx => $column_id) {
         if ($this->flat[$column_id]['table_id_fko'] == $tabPar && $tabPar != '') {
             unset($acols[$idx]);
         }
     }
     // Build the where and limit
     $SWhere = ' WHERE ' . implode(' AND ', $awhere);
     // Retrieve data
     $SQL = "SELECT skey," . implode(',', $acols) . "  FROM " . $this->view_id . $SWhere . $SQLOrder . $SLimit;
     $answer = SQL_AllRows($SQL);
     $this->browseFetchModify($answer);
     x4Data('browseFetch', $answer);
     return;
 }
Exemplo n.º 9
0
} else {
    $paypal['url'] = "https://www.paypal.com/cgi-bin/webscr";
}
# KFD 1/21/09, Another test system, "one dollar mode".  If
#              this flag is set, the trx is switched to
#              one dollar only.  Intended for final run-throughs
#              on live system.
if (configGet('paypal_onedollar', 'N') == 'Y') {
    $paypal['amount'] = 1;
}
// -----------------------------------------------------------------
// MANY SETTINGS BELOW ARE REM'D OUT IN THE STANDARD ARRANGEMENT,
// ADD BACK IN ANYTHING YOU NEED FOR AN APPLICATION
// -----------------------------------------------------------------
//  An icon user sees while on paypal, personalizes it a bit
$paypal['image_url'] = configGet('paypal_image_url', '');
// url to call in background while user is waiting
$paypal['notify_url'] = "?gp_page=x_paypalipn";
$paypal['return_method'] = "1";
//1=GET 2=POST
$paypal['currency_code'] = "USD";
//[USD,GBP,JPY,CAD,EUR]
$paypal['lc'] = "US";
//fso=fsockopen(); curl=curl command line
//libCurl=php compiled with libCurl support
$paypal['post_method'] = "fso";
$paypal['curl_location'] = "/usr/local/bin/curl";
$paypal['bn'] = "toolkit-php";
$paypal['cmd'] = "_xclick";
//Payment Page Settings
$paypal['display_comment'] = "0";
Exemplo n.º 10
0
function tmpLoadModules($module)
{
    if ($module == 'footer') {
        echo configGet('notesfooter');
    }
}
Exemplo n.º 11
0
function X_EMAIL_SEND($em)
{
    $retval = false;
    //scDBConn_Push('admin');
    if (SQLX_TrxLevel() > 0) {
        ErrorAdd("ERROR: Cannot send an email within a transaction");
    } else {
        if (configGet('email_fromaddr')) {
            $from_addr = configGet('email_fromaddr');
            $from_name = configGet('email_fromname');
        } else {
            $from_addr = trim(OPTION_GET("EMAILFROM_ADDR"));
            $from_name = trim(OPTION_GET("EMAILFROM_NAME"));
        }
        $smtp_server = trim(OPTION_GET('SMTP_SERVER', 'localhost'));
        if ($from_addr == "") {
            ErrorAdd("The system's return email address, defined in system variable " . "EMAILFROM_ADDR, must be set to a valid email address.  " . HTMLE_A_STD("System Variables", "variables", ""));
        } else {
            if ($from_name != "") {
                $from_name = '"' . $from_name . '"';
            }
            $from = "From: " . $from_name . " <" . $from_addr . ">";
            include_once 'Mail.php';
            $recipients = $em["email_to"];
            $headers['From'] = $from_name . "<" . $from_addr . ">";
            $headers['To'] = $em["email_to"];
            $headers['Subject'] = $em["email_subject"];
            $headers['Date'] = date("D, j M Y H:i:s O", time());
            foreach ($em['headers'] as $hname => $hval) {
                $headers[$hname] = $hval;
            }
            $body = $em["email_message"];
            $params['sendmail_path'] = '/usr/lib/sendmail';
            $params['host'] = $smtp_server;
            // Create the mail object using the Mail::factory method
            $mail_object = Mail::factory('smtp', $params);
            $mail_object->send($recipients, $headers, $body);
            if (!$mail_object) {
                ErrorAdd("Email was not accepted by server");
            } else {
                $table_ref = DD_TableRef('adm_emails');
                SQLX_Insert($table_ref, $em, false);
                $retval = false;
            }
        }
    }
    //scDBConn_Pop();
    return $retval;
}
Exemplo n.º 12
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();
 }
Exemplo n.º 13
0
function index_hidden_template($mode)
{
    # KFD 1/10/08.  If x6 is set, we follow a completely different
    #               path, x6 settings win out.
    $flagx6 = configGet('flag_x6', 'N');
    $x6template = configGet('x6_template', '');
    $x6group = configGet('x6_group', '');
    if ($flagx6 == 'Y') {
        # In x6, we consider the "app_template()" function first,
        # if it returns something it always wins.
        if (function_exists('app_template')) {
            vgfSet('template', app_template());
        } else {
            if ($x6template == '') {
                vgfSet('template', 'x6');
            } else {
                if (!LoggedIn() || inGroup($x6group)) {
                    vgfSet('template', $x6template);
                } else {
                    vgfSet('template', 'x6');
                }
            }
        }
    } else {
        # this is old x2/x4 mode, begin by obtaining a
        # 'candidate' they may have been set
        $candidate = vgfGet('template');
        # KFD 7/23/08. Give application a chance to
        #              play with setting
        if (function_exists('app_template')) {
            vgfSet('template', app_template($candidate));
        }
        # KFD 7/23/08. If no template has been set by vgfSet,
        #              and the candidate is not empty, pick it
        if ($candidate != '' && vgfGet('template') == '') {
            vgfSet('template', $candidate);
        }
        # KFD 7/23/08. Finally, if we still don't have something,
        #              pick according to mode
        if (vgfGet('template') == '') {
            if ($mode == 'x4') {
                vgfSet('template', 'pixel2');
            } else {
                vgfSet('template', 'rt_pixel');
            }
        }
    }
    # KFD 9/2/08.  We still have one customer with a public
    #        interface that is not a Joomla template.  If the
    #        template is "*" then we DO NOT set up Joomla
    #        compatibility.  The application will use its own
    #        file in the application directory that is specified
    #        with vgaSet('html_pub').
    if (vgfGet('template') == '*') {
        return;
    }
    # Tell the JOOMLA files that we are legit
    # Fool them, that is...
    define("_ANDROMEDA_JOOMLA", 1);
    define("_JOOMLA_ANDROMEDA", 1);
    # Activate the template by creating public $J and calling funcs
    global $J, $AG;
    $J['TEMPLATE'] = vgfGet('template');
    JoomlaCompatibility($J['TEMPLATE']);
    $aphp = $AG['dirs']['root'] . '/templates/' . $J['TEMPLATE'] . '/andromeda.php';
    if (file_exists($aphp)) {
        include $aphp;
    }
    # <----- EARLY RETURN
    # The rest of this is totally superseded, and can
    # be removed after we go live with Beta 1
    return;
    /*
     global $AG;
    # KFD 7/3/08.  Have the vgfGet() value override anything else
    #
    if(vgfGet('template')<>'') {
        # Assign the template to spots where the legacy code will find it
        $AG['template'] = vgfGet('template');
    }
    
    // First conditional fix contributed by Don Organ 9/07, $AG['template']
    // was getting lost on passes 2+
    if(ArraySafe($AG,'template')<>'') {
        SessionSet('TEMPLATE',$AG['template']); 
    }
    else {
        if(SessionGet("TEMPLATE")=='') {
           if(!file_exists(fsDirTop().'templates')) {
              // There is no templates directory, so stop looking
              SessionSet('TEMPLATE','*');
           }
           else {
              if(ArraySafe($AG,'template')<>'') {
                 // if the app or instance specified a template at build time,
                 // use that.
                 SessionSet('TEMPLATE',$AG['template']);
              }
              else {
                 // At this point nobody has told us what to do, pick the
                 // first template we can find.
                 
                 // Big change by KFD 3/15/08  If we do not know what
                 // template to use, prefer to pick rt_pixel, our 
                 // default template, unless we find another one.
                 // In that case we assume that template is there for
                 // a reason and we use it.
                 $dir = $AG['dirs']['root'].'templates/';
                 $DIR = opendir($dir);
                 $rt_pixel = false;
                 while (false!==($filename = readdir($DIR))) {
                    if ($filename=='.')  continue;
                    if ($filename=='..') continue;
                    if ($filename=='andro_classic') continue;
                    if ($filename=='x4') continue;
                    // DO 2-1-2008 Added to ignore SVN directory
                    if ($filename=='.svn') continue;
                    if ($filename=='rt_pixel') $rt_pixel = true; 
                    if (is_dir($dir.$filename)) {
                       SessionSet('TEMPLATE',scFileName($filename));
                       break;
                    }
                 }
                 closedir($DIR);
                 // Here is where we pick rt_pixel if we could not
                 // find anything else
                 if($rt_pixel && SessionGet('TEMPLATE','')=='') {
                     SessionSet('TEMPLATE',$rt_pixel);
                 }
              }
           }
        }
    }
    // Now if a template was identified
    if(SessionGet("TEMPLATE")<>'*') {
       // Notify any code that may need to know that we are in a hybrid
       // Andromeda-joomla situation.  This is for both template code and
       // Andromeda code.  We define both variables in case people forget
       // which one we defined.
       define("_ANDROMEDA_JOOMLA",1); 
       define("_JOOMLA_ANDROMEDA",1); 
       
       // Activate the template by creating public $J and calling funcs
       global $J;
       $J['TEMPLATE']=SessionGet('TEMPLATE');
       JoomlaCompatibility($J['TEMPLATE']);
       $aphp=$AG['dirs']['root'].'/templates/'.$J['TEMPLATE'].'/andromeda.php';
       if(file_exists($aphp)) {
          include($aphp);
       }
    }
    */
}
Exemplo n.º 14
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();
    if ($script != '') {
Exemplo n.º 15
0
function mosShowListMenu($menutype)
{
    // -------------------------------------------------------
    // Andromeda Code: If we are in an Andromeda situation
    // then everything is vastly simplified, we already have
    // the menu and we don't do much conversion
    // -------------------------------------------------------
    if (defined('_ANDROMEDA_JOOMLA')) {
        if (!LoggedIn()) {
            return;
        }
        // KFD 7/6/07, cache the menu so we don't have to do
        // this on every call.
        // Cachegrind cost to build menu          : 259 / 199
        // Cachegrind cost logging in             : 140
        // Cachegrind cost login, cache to session: 2!!!!
        // Cachegrind cost to cache to disk       : 400!
        # KFD 4/17/08, rebuild menu if they switched modes
        # KFD 6/21/08, simplify this by just looking at x4Welcome
        #$menu_mode = gpExists('x4Page')
        #  ? (vgfGet('x4menu',false)==true ? 'x4' : 'classic')
        #  : 'classic';
        $menu_mode = configGet('x4welcome', 'N') == 'Y' ? 'x4' : 'classic';
        vgfSet('menu_mode', $menu_mode);
        # KFD 6/21/08 (END)
        if ($menu_mode != SessionGet('menu_mode')) {
            sessionSet('menu', '');
            sessionSet('menu_mode', $menu_mode);
        }
        $menu = SessionGet('menu', '');
        if ($menu != '') {
            echo $menu;
            return;
        }
        ob_start();
        $children = array();
        $open = array();
        $indents = array(array("<ul>", "<li>", "</li>", "</ul>"));
        $class_sfx = null;
        $hilightid = SessionGET('AGMENU_MODULE');
        $hilightid = '';
        $menus = SessionGET("AGMENU");
        foreach ($menus as $menuid => $menuinfo) {
            //if($menuid=='datadict') continue;
            //if($menuid=='sysref')   continue;
            $x = new joomla_fake();
            $x->type = 'url';
            $x->id = $menuid;
            if (sessionGet('menu_mode') == 'x4') {
                $x->link = 'javascript:void(0);';
            } else {
                $x->link = "?x_module=" . urlencode($menuid);
            }
            $x->browserNav = '';
            $x->name = $menuinfo['description'];
            $children[0][] = $x;
            foreach ($menuinfo['items'] as $page => $pageinfo) {
                $x = new joomla_fake();
                $x->type = 'url';
                $x->id = $page;
                # KFD 6/26/08, the vgfX(x4) was experimental, get rid of it
                #if(vgfGet('x4')===true) {
                #    $pd = $pageinfo['description'];
                #    $x->link="javascript:x4Page('$page','$pd')";
                #}
                #else {
                # KFD 6/26/08, work out the menu mode first
                $xmode = 'x2';
                if (sessionGet('menu_mode') == 'x4') {
                    $xmode = a($pageinfo, 'uix2', 'N') == 'Y' ? 'x2' : 'x4';
                }
                if ($xmode == 'x4') {
                    $x->link = '?x4Page=' . urlencode($page);
                    $x->link .= '&x4Return=' . vgaGet('nopage', 'menu');
                } else {
                    $x->link = "?x_module={$menuid}&x2=1&gp_page=" . urlencode($page);
                }
                if (ArraySafe($pageinfo, 'menu_parms') != '') {
                    $x->link .= '&' . urlencode($pageinfo['menu_parms']);
                }
                #}
                $x->browserNav = '';
                $x->name = $pageinfo['description'];
                $children[$menuid][] = $x;
            }
        }
        mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid);
        $menu = ob_get_clean();
        echo $menu;
        SessionSet('menu', $menu);
        //$fsMenuFileHTML=ob_get_clean();
        //file_put_contents($fsMenuFile,$fsMenuFileHTML);
        //echo $fsMenuFileHTML;
        return;
    }
    // -------------------------------------------------------
    // Andromeda Code: END
    // -------------------------------------------------------
    global $database, $my, $cur_template, $Itemid;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_shownoauth;
    $class_sfx = null;
    $hilightid = null;
    /* If a user has signed in, get their user type */
    $intUserType = 0;
    if ($my->gid) {
        switch ($my->usertype) {
            case 'Super Administrator':
                $intUserType = 0;
                break;
            case 'Administrator':
                $intUserType = 1;
                break;
            case 'Editor':
                $intUserType = 2;
                break;
            case 'Registered':
                $intUserType = 3;
                break;
            case 'Author':
                $intUserType = 4;
                break;
            case 'Publisher':
                $intUserType = 5;
                break;
            case 'Manager':
                $intUserType = 6;
                break;
        }
    } else {
        /* user isn't logged in so make their usertype 0 */
        $intUserType = 0;
    }
    if ($mosConfig_shownoauth) {
        $database->setQuery("SELECT m.*, count(p.parent) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering ");
    } else {
        $database->setQuery("SELECT m.*, sum(case when p.published=1 then 1 else 0 end) as cnt" . "\nFROM #__menu AS m" . "\nLEFT JOIN #__menu AS p ON p.parent = m.id" . "\nWHERE m.menutype='{$menutype}' AND m.published='1' AND m.access <= '{$my->gid}'" . "\nGROUP BY m.id ORDER BY m.parent, m.ordering ");
    }
    $rows = $database->loadObjectList('id');
    echo $database->getErrorMsg();
    //work out if this should be highlighted
    $sql = "SELECT m.* FROM #__menu AS m" . "\nWHERE menutype='" . $menutype . "' AND m.published='1'";
    $database->setQuery($sql);
    $subrows = $database->loadObjectList('id');
    $maxrecurse = 5;
    $parentid = $Itemid;
    //this makes sure toplevel stays hilighted when submenu active
    while ($maxrecurse-- > 0) {
        $parentid = getParentRow($subrows, $parentid);
        if (isset($parentid) && $parentid >= 0 && $subrows[$parentid]) {
            if (vgfGet('menu_mode') != 'x4') {
                $hilightid = $parentid;
            }
        } else {
            break;
        }
    }
    if (vgfGet('menu_mode') == 'x4') {
        $hilightid = '';
    }
    //echo "<!--[if lte IE 7]>\n";
    include_once "{$mosConfig_absolute_path}/templates/" . $cur_template . "/js/ie.js";
    //echo "<![endif]-->\n";
    $indents = array(array("<ul>", "<li>", "</li>", "</ul>"));
    // establish the hierarchy of the menu
    $children = array();
    // first pass - collect children
    foreach ($rows as $v) {
        $pt = $v->parent;
        $list = @$children[$pt] ? $children[$pt] : array();
        array_push($list, $v);
        $children[$pt] = $list;
    }
    // second pass - collect 'open' menus
    $open = array($Itemid);
    $count = 20;
    // maximum levels - to prevent runaway loop
    $id = $Itemid;
    while (--$count) {
        if (isset($rows[$id]) && $rows[$id]->parent > 0) {
            $id = $rows[$id]->parent;
            $open[] = $id;
        } else {
            break;
        }
    }
    $class_sfx = null;
    mosRecurseListMenu(0, 0, $children, $open, $indents, $class_sfx, $hilightid);
}
Exemplo n.º 16
0
 } else {
     if (installerStep() === STEP_DB_REQUIREMENTS) {
         if (isRedirect()) {
             redirectSelf();
         }
         $result['page'] = "DB Requirements";
         $result['mysql_check'] = dbVersionCheck();
         $result['db_config'] = dbGetConfig();
     } else {
         if (installerStep() === STEP_CONFIG) {
             if ($_SERVER['REQUEST_METHOD'] == "GET") {
                 if (isRedirect()) {
                     redirectSelf();
                 }
                 $result['page'] = "Configuration";
                 $result['configuration'] = configGet();
             } else {
                 if ($_SERVER['REQUEST_METHOD'] == "POST") {
                     if (processConfig()) {
                         transitionNextStep();
                     }
                     redirectSelf();
                 }
             }
         } else {
             if (installerStep() == STEP_PERMISSION) {
                 if (isRedirect()) {
                     redirectSelf();
                 }
                 $result['page'] = 'Check Permission';
                 $result['permission'] = permissionProcess();
Exemplo n.º 17
0
/**
* @deprecated
*/
function cssInclude($file, $force_immediate = false)
{
    // This program echos out immediately if not in debug
    // mode, otherwise they all get output as one
    $cssExcludes = vgfGet('cssExcludes', array());
    if (!in_array($file, $cssExcludes)) {
        if (configGet('js_css_debug', 'Y') == 'Y' || $force_immediate) {
            ?>
            <link rel='stylesheet' href='<?php 
            echo tmpPathInsert() . $file;
            ?>
' />
            <?php 
        } else {
            $css = vgfGet('cssIncludes', array());
            $css[] = $file;
            vgfSet('cssIncludes', $css);
        }
    }
}
Exemplo n.º 18
0
    function mainLayout(&$container)
    {
        # load the javascript
        jsInclude("clib/androX4Menu.js");
        # Set focus if requested
        if (($focus = gp('x4Focus')) != '') {
            x4Script("\$('#x4Menu')[0].lastFocusId = 'x4menu_{$focus}'");
        }
        # Other miscellaneous commands
        vgfSet('suppress_hidden', true);
        //vgfSet('show_menu',false);
        # Fetch some text
        $h1 = configGet("x4menutitle", "Extended Desktop Menu");
        $text = configGet("x4menutext", "");
        ob_start();
        ?>
        <div id="x4Menu" class="x4Pane x4Menu">
        <center>
        <h1><?php 
        echo $h1;
        ?>
</h1>
        <?php 
        echo $text;
        ?>
        </center>
        <br/>
        <?php 
        $table = html('table');
        $table->hp['class'] = 'tab100';
        $tr = html('tr', $table);
        $array = SessionGet('AGMENU');
        $first = true;
        $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
        $col = 0;
        $grid = array();
        foreach ($array as $module => $modinfo) {
            if (!$first) {
                $td = html('td', $tr);
                $td->hp['style'] = 'width: 10px';
            }
            $first = false;
            $td = html('td', $tr);
            $td->hp['class'] = 'style1';
            $h3 = html('h3', $td);
            $h3->setHtml($letters[$col] . ') ' . $modinfo['description']);
            $row = 0;
            foreach ($modinfo['items'] as $page => $info) {
                // Add the link
                $a = html('a', $td);
                $a->hp['id'] = 'x4menu_' . $page;
                $a->hp['href'] = "?x4Return=menu&x4Page={$page}";
                $a->setHTML($row . ') ' . $info['description']);
                $a->hp['onkeyup'] = "return \$a.byId('x4Menu').x4KeyUp(event,{$col},{$row})";
                $a->hp['onkeydown'] = "return false;";
                $a->hp['onmouseover'] = '$(this).focus()';
                $a->hp['onfocus'] = "this.className = 'x4MenuOn'";
                $a->hp['onblur'] = "this.className = ''";
                $grid[$col][$row] = 'x4menu_' . $page;
                $row++;
                // Add a BR
                html('br', $td);
            }
            $col++;
        }
        $table->render();
        echo "</div>";
        # put out the grid and set the HTML
        x4data('grid', $grid);
        $container->setHTML(ob_get_clean());
    }