Example #1
0
function getAvailableEngines($config)
{
    $aEnginesFinal = null;
    $mg = mg_connect($config, "", "", "");
    if ($mg) {
        $stmt = new mg_stmt_select($mg, "accounts");
        $stmt->setFields(array("id" => "true", "name" => "true"));
        $stmt->setSort(array("name" => 1));
        $count = $stmt->execute();
        if ($count > 0) {
            $aAccountsFinal = array();
            $cursor = $stmt->getCursor();
            while ($cursor->hasNext()) {
                $rs = $cursor->getNext();
                $id = strtolower(trim($rs['id']));
                $name = trim($rs['name']);
                $aEnginesFinal[$id] = $name;
            }
        }
    }
    return $aEnginesFinal;
}
//============================================================================
// (c) 2009-2010, Eolya - All Rights Reserved.
// This source code is the property of Eolya.
// The license applying to this source code is available at :
// http://www.crawl-anywhere.com/licenses/
//============================================================================
require_once "../../init_gpc.inc.php";
require_once "../../init.inc.php";
$action = POSTGET("action");
if ($action == "showaccountlist") {
    $mg = mg_connect($config, "", "", "");
    if ($mg) {
        $res = "<h2>Accounts</h2>";
        $stmt = new mg_stmt_select($mg, "accounts");
        $stmt->setFields(array("id" => "true", "name" => "true"));
        $stmt->setSort(array("name" => 1));
        $count = $stmt->execute();
        if ($count > 0) {
            $cursor = $stmt->getCursor();
            while ($cursor->hasNext()) {
                $rs = $cursor->getNext();
                $account = $rs["name"];
                $res .= $account;
                $res .= "&nbsp;<a href='#' onClick='editAccount(" . $rs["id"] . ");return false;' title='Edit'><img src='images/button_edit.png'></a>";
                $res .= "<br />";
            }
        }
    }
    $res .= "<br /><br /><br /><br /><br /><br />Add new account<a href='#' onClick='displayAddAccount(); return false;'><img src='images/edit_add_32.png'></a>&nbsp;&nbsp;";
    print $res;