Example #1
0
function SQL2($sql, $dbconn, &$error = false)
{
    if ($dbconn == null) {
        // 4/4/07.  Rem'd out because if this is a problem we've usually
        // got pleny of other problems.  The only time this can happen
        // w/o a problem is on a new install, and we don't want stray
        // errors there.
        //echo "<b>ERROR: CALL TO SQL2 WITH NO CONNECTION</b>";
        return;
    }
    global $AG;
    # KFD 12/31/08, Control by cookie and group setting
    $debug = inGroup('debugging') && arr($_COOKIE, 'log_Server', 0) == 1;
    #$debug = trim(ConfigGet('js_css_debug','N'));
    # KFD 12/31/08  (END)
    if ($debug == 'Y') {
        $mtime = microtime();
        $mtime = explode(" ", $mtime);
        $mtime = $mtime[1] + $mtime[0];
        $starttime = $mtime;
    }
    pg_send_query($dbconn, $sql);
    if ($debug == 'Y') {
        $mtime = microtime();
        $mtime = explode(" ", $mtime);
        $mtime = $mtime[1] + $mtime[0];
        $endtime = $mtime;
        $totaltime = $endtime - $starttime;
    }
    if ($debug) {
        $dbgsql['sql'] = $sql;
        $dbgsql['time'] = $totaltime;
        # KFD 10/18/08, add stack dump if xdebug installed
        if (function_exists('xdebug_get_function_stack')) {
            ob_start();
            var_dump(xdebug_get_function_stack());
            $dbgsql['stack'] = ob_get_clean();
        } else {
            $dbgsql['stack'] = 'xdebug not installed, no function ' . 'stack available.';
        }
        array_push($GLOBALS['AG']['dbg']['sql'], $dbgsql);
    }
    $results = pg_get_result($dbconn);
    $t = pg_result_error($results);
    $error = false;
    if ($t) {
        $error = true;
        vgfSet('errorSQL', $sql);
        // Made conditional 1/24/07 KFD
        //echo "Error title is".vgfGet("ERROR_TITLE");
        if (SessionGet('ADMIN', false)) {
            //if(true) {
            ErrorAdd("(ADMIN): You are logged in as an administrator, you will see more" . " detail than a regular user.");
            ErrorAdd("(ADMIN): " . $sql);
        } else {
            // KFD 6/27/07, prevent sending this message more than once
            if (!Errors()) {
                ErrorAdd("There was an error attempting to save:");
            }
        }
        $ts = explode(";", $t);
        foreach ($ts as $onerr) {
            if (trim($onerr) == '') {
                continue;
            }
            // KFD 6/27/07, display errors at top and at column level
            //if(SessionGet('ADMIN',true)) {
            //   ErrorAdd("(ADMIN): ".$onerr);
            //}
            ErrorComprehensive($onerr);
        }
    }
    return $results;
}
Example #2
0
     style = "display:none;" 
     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>';
    }
    if ($_POST['vote'] == "yes") {
        redirect(BASEDIR . "group_news.php?view=" . $vnew['vnews_news']);
    } else {
        redirect(BASEDIR . "group.php?view=" . $vnew['vnews_group']);
    }
}
if (isset($_GET['view']) && isnum($_GET['view'])) {
    $news = dbquery("SELECT gn.*, gr.group_name, us.user_name FROM " . DB_GS_NEWS . " gn LEFT JOIN " . DB_GS_GROUPS . " gr ON gr.group_id=gn.news_group LEFT JOIN " . DB_USERS . " us ON us.user_id=gn.news_author WHERE news_id='" . $_GET['view'] . "'");
    if (dbrows($news)) {
        $news = dbarray($news);
        if ($news['news_published'] == "1" || inGroup($news['news_group'])) {
            opentable($locale['gs48']);
            echo "<table width='100%'><tr><td>" . $news['news_title'] . "<br />" . $locale['gs49'] . "<a href='" . BASEDIR . "profile.php?lookup=" . $news['news_author'] . "'>" . $news['user_name'] . "</a> @ <a href='" . BASEDIR . "group.php?view=" . $news['news_group'] . "'>" . $news['group_name'] . "</a> " . $locale['gs50'] . " " . showdate("longdate", $news['news_date']) . "</td></tr><tr><td heigth='20'>&nbsp;</td></tr><tr><td>" . parseubb($news['news_pre']) . "</td></tr><tr><td heigth='20'>&nbsp;</td></tr><tr><td>" . parseubb($news['news_news']) . "</td></tr></table>";
            closetable();
            if ($news['news_published'] == "0" && inGroup($news['news_group'])) {
                opentable($locale['gs51']);
                $new_news = dbquery("SELECT * FROM " . DB_GS_VOTES_NEWS . " WHERE vnews_news='" . $_GET['view'] . "'");
                if (dbrows($new_news)) {
                    //$tuser = dbcount("(guser_id)",DB_GS_GROUP_USERS, "guser_group='".$news['news_group']."'"); $new_new=dbarray($new_news);
                    echo $locale['gs52'] . " <strong style='color:green;'>" . $new_new['vnews_have'] . " (" . round($new_new['vnews_have'] / $new_new['vnews_need'] * 100) . "%)</strong> / <strong style='color:red;'>" . $new_new['vnews_unhave'] . " (" . round($new_new['vnews_unhave'] / $new_new['vnews_need'] * 100) . "%)</strong> ";
                    if (inLine($userdata['user_id'], $new_new['vnews_canvote']) && !inLine($userdata['user_id'], $new_new['vnews_voted'])) {
                        echo "<form name='request" . $new_new['vnews_id'] . "yes' method='post'><input type='hidden' name='vid' value='" . $new_new['vnews_id'] . "' /><input type='hidden' name='vote' value='yes' /><input type='submit' name='vote_news' class='button' value='" . $locale['gs39'] . "' /></form> <form name='request" . $new_new['vnews_id'] . "no' method='post'><input type='hidden' name='vid' value='" . $new_new['vnews_id'] . "' /><input type='hidden' name='vote' value='no' /><input type='submit' name='vote_news' class='button' value='" . $locale['gs40'] . "' /></form>";
                    }
                }
                closetable();
            }
            require_once INCLUDES . "comments_include.php";
            if ($news['news_published'] == "0") {
                showcomments("GU", DB_GS_NEWS, "news_id", $_GET['view'], BASEDIR . "group_news.php?view=" . $_GET['view']);
            } else {
Example #4
0
    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();
    }
            //$tuser = dbcount("(guser_id)",DB_GS_GROUP_USERS, "guser_group='".$_GET['view']."'");
            while ($new_new = dbarray($new_news)) {
                echo ($new_new['vnews_type'] == "1" ? $locale['gs47'] : $locale['gs78']) . "<a href='" . BASEDIR . "group_news.php?view=" . $new_new['vnews_news'] . "'>" . $new_new['news_title'] . "</a>" . ($new_new['news_author'] == $userdata['user_id'] ? " <a href='" . BASEDIR . "news_admin.php?action=edit&id=" . $new_new['news_id'] . "'><img src='" . IMAGES . "edit.png' width='10' /></a> <a href='" . BASEDIR . "news_admin.php?action=delete&id=" . $new_new['news_id'] . "'><img src='" . IMAGES . "no.png' width='10' /></a>" : "") . " <strong style='color:green;'>" . $new_new['vnews_have'] . " (" . round($new_new['vnews_have'] / $new_new['vnews_need'] * 100) . "%)</strong> / <strong style='color:red;'>" . $new_new['vnews_unhave'] . " (" . round($new_new['vnews_unhave'] / $new_new['vnews_need'] * 100) . "%)</strong> ";
                if (inLine($userdata['user_id'], $new_new['vnews_canvote']) && !inLine($userdata['user_id'], $new_new['vnews_voted'])) {
                    echo "<form name='request" . $new_new['vnews_id'] . "yes' method='post'><input type='hidden' name='vid' value='" . $new_new['vnews_id'] . "' /><input type='hidden' name='vote' value='yes' /><input type='submit' name='vote_news' class='button' value='" . $locale['gs39'] . "' /></form> <form name='request" . $new_new['vnews_id'] . "no' method='post'><input type='hidden' name='vid' value='" . $new_new['vnews_id'] . "' /><input type='hidden' name='vote' value='no' /><input type='submit' name='vote_news' class='button' value='" . $locale['gs40'] . "' /></form>";
                }
                echo "<br />";
            }
        }
    }
    if (dbrows($news)) {
        $i = 1;
        echo "<table width='95%'>";
        while ($new = dbarray($news)) {
            echo "<tr><td width='1%'>" . $i . "</td><td><a href='" . BASEDIR . "group_news.php?view=" . $new['news_id'] . "'>" . $new['news_title'] . "</a>";
            /* ".(iMEMBER && $userdata['user_id'] == $group['group_creator'] ? "<a href='".BASEDIR."group.php?action=del&id=".$new['news_id']."'><img src='".IMAGES."no.png' width='10' alt='delete' /></a>" : "")."*/
            echo " " . (iMEMBER && inGroup($_GET['view']) && !checkDelete("n", $new['news_id']) ? "<a href='" . BASEDIR . "group.php?votedelete=" . $new['news_id'] . "'><img src='" . IMAGES . "no.png' width='10' alt='votedelete' /></a>" : "") . "</td></tr>";
        }
        echo "</table>";
    } else {
        echo $locale['gs36'];
    }
    echo "</td></tr></table>";
    closeside();
    openside($locale['gs64'], true, "on");
    echo "<table width='100%'><tr valign='middle'><td class='tbl1' width='40%' align='center'>" . $locale['gs65'] . "<br /><img src='" . INFUSIONS . "al_groups/images/voteshare.gif' border='0' /></td><td class='tbl1' align='center'><textarea name='guyhubcg' class='textbox' rows='4' cols='30'><a href=\"" . $settings['siteurl'] . "group.php?view=" . $group['group_id'] . "&voteshare\" target=\"_blank\" alt=\"Vote!\"><img src=\"" . $settings['siteurl'] . "al_groups/images/voteshare.gif\" border=\"0\" /></a></textarea></td></tr></table>";
    closeside();
} else {
    redirect(BASEDIR . "groups.php");
}
require_once THEMES . "templates/footer.php";
Example #6
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);
       }
    }
    */
}
Example #7
0
 function delfile()
 {
     # If user is not logged in and not in file maintenance,
     # quietly ignore
     if (!LoggedIn()) {
         return;
     }
     if (!inGroup('filemaint')) {
         return;
     }
     $filename = fsDirTop() . 'apppub/' . gp('file');
     unlink($filename);
 }