Esempio n. 1
0
function allSites()
{
    global $pdo;
    // Select all the rows in the markers table
    $result = $pdo->query("SELECT id, sitename, city, country, ST_X(ST_CENTROID(geometry)) AS lon, ST_Y(ST_CENTROID(geometry)) AS lat FROM sites;");
    if (!$result) {
        die('Invalid query: ' . error_database());
    }
    // Iterate through the rows, adding XML nodes for each
    while ($row = @$result->fetch(PDO::FETCH_ASSOC)) {
        addNode($row);
    }
}
Esempio n. 2
0
    $amount = 0;
}
// AMOUNT - Out of money
if ($amount < 50) {
    $amount = 0;
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', $company . ' (' . $symbol . ')');
addNode($doc, $navigation, 'title', 'Bully Bully - Signal');
addNode($doc, $navigation, 'pagename', $fundname . ' - Signal Detail');
// build content - signal detail
$occ = $doc->createElement('content');
// <content>
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'symbol', $symbol);
addNode($doc, $occ, 'company', $company);
addNode($doc, $occ, 'low120', $low120);
addNode($doc, $occ, 'high120', $high120);
addNode($doc, $occ, 'price', $price);
addNode($doc, $occ, 'process', $process);
addNode($doc, $occ, 's1date', $s1date);
addNode($doc, $occ, 's1price', $s1price);
addNode($doc, $occ, 's2date', $s2date);
addNode($doc, $occ, 's2price', $s2price);
addNode($doc, $occ, 'amount', $amount);
echo $doc->saveXML();
Esempio n. 3
0
/**
 * Import nodes and connections from the given CIF url for the selected nodeids into the given map.
 * The node import limit is set by '$CFG->ImportLimit'.
 * @param url the url for the CIF data to load
 * @param mapid the id of the map to get alerts for
 * @param selectedids an array of the CIF node ides to import
 * @param poses an array of the positions of the nodes in the map each array item is in
 * the format 'x:y' and the position in the array should correspond ot the position of
 * its node in the selectednodeids array.
 * before it is considered out of date and should be refetched and recalculated.
 * Defaults to 60 seconds.
 * @param private true if the data should be created as private, else false.
 * @return View object of the map or Error.
 *
 */
function addNodesAndConnectionsFromJsonld($url, $mapid, $selectedids, $poses, $private)
{
    global $USER, $HUB_FLM, $CFG, $ERROR;
    require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/catalyst_jsonld_reader.class.php");
    require_once $HUB_FLM->getCodeDirPath("core/lib/url-validation.class.php");
    //error_log(print_r($selectedids, true));
    if (count($selectedids) > $CFG->ImportLimit) {
        $ERROR = new error();
        $ERROR->createAccessDeniedError();
        return $ERROR;
    }
    //error_log(print_r($poses, true));
    // Check if the map is in a group and if so get the group id.
    $groupid = "";
    $v = new View($mapid);
    $view = $v->load();
    if (!$view instanceof Error) {
        if (isset($view->viewnode->groups)) {
            $groups = $view->viewnode->groups;
            if (count($groups) > 0) {
                $groupid = $groups[0]->groupid;
            }
        }
    } else {
        return $view;
    }
    // make sure current user in group, if group set.
    if ($groupid != "") {
        $group = new Group($groupid);
        if (!$group instanceof Error) {
            if (!$group->ismember($USER->userid)) {
                $error = new Error();
                return $error->createNotInGroup($group->name);
            }
        }
    }
    $withhistory = false;
    $withvotes = false;
    $reader = new catalyst_jsonld_reader();
    $reader = $reader->load($url, $withhistory, $withvotes);
    if (!$reader instanceof Error) {
        $nodeset = $reader->nodeSet;
        $nodes = $nodeset->nodes;
        $count = count($nodes);
        $newnodeSet = new NodeSet();
        $newNodeCheck = array();
        for ($i = 0; $i < $count; $i++) {
            $node = $nodes[$i];
            $position = array_search($node->nodeid, $selectedids);
            //error_log("position:".$position);
            if ($position !== FALSE) {
                $position = intval($position);
                $positem = $poses[$position];
                $positemArray = explode(":", $positem);
                $xpos = "";
                $ypos = "";
                if (count($positemArray) == 2) {
                    $xpos = $positemArray[0];
                    $ypos = $positemArray[1];
                }
                //error_log("xpos:".$xpos.":ypos:".$ypos);
                $role = getRoleByName($node->rolename);
                $description = "";
                if (isset($node->description)) {
                    $description = $node->description;
                }
                $newnode = addNode($node->name, $description, $private, $role->roleid);
                //error_log(print_r($newnode, true));
                if (!$newnode instanceof Error) {
                    $newNodeCheck[$node->nodeid] = $newnode;
                    //error_log($node->nodeid);
                    // if we have positioning information add the node to the map.
                    if ($xpos != "" && $ypos != "") {
                        $viewnode = $view->addNode($newnode->nodeid, $xpos, $ypos);
                        //if (!$viewnode instanceof Error) {
                    }
                    if (isset($node->homepage) && $node->homepage != "") {
                        $URLValidator = new mrsnk_URL_validation($node->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
                        if ($URLValidator->isValid()) {
                            $urlObj = addURL($node->homepage, $node->homepage, "", $private, "", "", "", "cohere", "");
                            $newnode->addURL($urlObj->urlid, "");
                            // Add url to group? - not done on forms at present
                        } else {
                            error_log('Invalid node homepage: ' . $node->homepage . ': for ' . $node->nodeid);
                        }
                    }
                    if (isset($node->users[0])) {
                        $user = $node->users[0];
                        if (isset($user->homepage) && $user->homepage != "") {
                            $URLValidator = new mrsnk_URL_validation($user->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
                            if ($URLValidator->isValid()) {
                                $urlObj = addURL($user->homepage, $user->homepage, "", $private, "", "", "", "cohere", "");
                                $newnode->addURL($urlObj->urlid, "");
                                // Add url to group? - not done on forms at present
                            } else {
                                error_log('Invalid user homepage: ' . $user->homepage . ': for ' . $user->userid);
                            }
                        }
                    }
                    //if ($groupid != "") {
                    //	$newnode->addGroup($groupid);
                    //}
                    $newnodeSet->add($newnode);
                } else {
                    error_log(print_r($newnode, true));
                }
            }
        }
        $connectionset = $reader->connectionSet;
        $connections = $connectionset->connections;
        $count = count($connections);
        for ($i = 0; $i < $count; $i++) {
            $conn = $connections[$i];
            $from = $conn->from;
            $to = $conn->to;
            $fromrole = $conn->fromrole;
            $torole = $conn->torole;
            if (isset($newNodeCheck[$from->nodeid]) && isset($newNodeCheck[$to->nodeid])) {
                $newFromNode = $newNodeCheck[$from->nodeid];
                $newToNode = $newNodeCheck[$to->nodeid];
                // Might not need this as it might be done already
                //if ($newFromNode->role->name != $fromrole->name) {
                //	updateNodeRole($newFromNode->nodeid,$fromrole->name);
                //}
                $linklabelname = $conn->linklabelname;
                //error_log($linklabelname);
                $lt = getLinkTypeByLabel($linklabelname);
                if (!$lt instanceof Error) {
                    $linkType = $lt->linktypeid;
                    //$frole = getRoleByName($fromrole->name);
                    //$trole = getRoleByName($torole->name);
                    $connection = addConnection($newFromNode->nodeid, $newFromNode->role->roleid, $linkType, $newToNode->nodeid, $newToNode->role->roleid, 'N', "");
                    //error_log(print_r($connection, true));
                    if (!$connection instanceof Error) {
                        // add to group
                        if (isset($groupid) && $groupid != "") {
                            $connection->addGroup($groupid);
                        }
                        $viewcon = $view->addConnection($connection->connid);
                        //error_log(print_r($viewcon,true));
                    } else {
                        error_log(print_r($connection, true));
                    }
                } else {
                    error_log("for label:" . $linklabelname . ":" . print_r($lt, true));
                }
            }
        }
    } else {
        return $reader;
    }
    return $view;
}
Esempio n. 4
0
header('Content-type: text/xml');
include '../bully.inc';
$db = new Database();
$doc = new DomDocument('1.0');
// create a new XML document
$root = $doc->createElement('root');
// <root>
$root = $doc->appendChild($root);
// build fund list
$sql = "select id, name from funds order by id desc";
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
while ($cols = mysql_fetch_array($rows)) {
    $occ = $doc->createElement('funds');
    // <funds>
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'id', $cols['id']);
    // <funds><id>
    addNode($doc, $occ, 'name', $cols['name']);
    // <funds><name>
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', '0');
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', 'Signin for Administrative Privliages');
addNode($doc, $navigation, 'title', 'Bully Bully - Signin');
addNode($doc, $navigation, 'pagename', 'Administration - Signin');
addNode($doc, $navigation, 'signedin', 'yes');
echo $doc->saveXML();
Esempio n. 5
0
addNode($doc, $occ, 'symbol', $cols['symbol']);
addNode($doc, $occ, 'company', $cols['company']);
addNode($doc, $occ, 'enabled', $cols['enabled']);
addNode($doc, $occ, 'price', $cols['price']);
addNode($doc, $occ, 'day10', $cols['day10']);
addNode($doc, $occ, 'low120', $cols['low120']);
addNode($doc, $occ, 'high120', $cols['high120']);
addNode($doc, $occ, 'process', $cols['process']);
addNode($doc, $occ, 's1date', $s1date);
addNode($doc, $occ, 's1price', $s1price);
addNode($doc, $occ, 's2date', $s2date);
addNode($doc, $occ, 's2price', $s2price);
addNode($doc, $occ, 'buydate', $buydate);
addNode($doc, $occ, 'buyprice', $buyprice);
addNode($doc, $occ, 'amount', $amount);
addNode($doc, $occ, 'days', $days);
addNode($doc, $occ, 'selldate', $selldate);
addNode($doc, $occ, 'sellprice', $sellprice);
if (floatval($stop) > floatval($cols['low120'])) {
    addNode($doc, $occ, 'stop', $stop);
} else {
    addNode($doc, $occ, 'stop', $cols['low120']);
}
// Javascript
if ($_GET[s] == 'y') {
    $js = $doc->createElement('javascript');
    // <javascript>
    $js = $root->appendChild($js);
    addNode($doc, $js, 'script', 'js/viewtrade.js');
}
echo $doc->saveXML();
Esempio n. 6
0
     clearSession();
     $response = new Result("logout", "logged out");
     break;
     /** NODES **/
 /** NODES **/
 case "getnode":
     $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
     $response = getNode($nodeid, $style);
     break;
 case "addnode":
     $name = required_param('name', PARAM_TEXT);
     $desc = required_param('desc', PARAM_HTML);
     $nodetypeid = optional_param('nodetypeid', "", PARAM_ALPHANUMEXT);
     $imageurlid = optional_param('imageurlid', "", PARAM_TEXT);
     $imagethumbnail = optional_param('imagethumbnail', "", PARAM_TEXT);
     $response = addNode($name, $desc, $private, $nodetypeid, $imageurlid, $imagethumbnail);
     break;
 case "addnodeandconnect":
     $name = required_param('name', PARAM_TEXT);
     $desc = required_param('desc', PARAM_HTML);
     $nodetypename = required_param('nodetypename', PARAM_TEXT);
     $focalnodeid = required_param('focalnodeid', PARAM_ALPHANUMEXT);
     $linktypename = required_param('linktypename', PARAM_TEXT);
     $direction = optional_param('direction', 'from', PARAM_ALPHA);
     $groupid = optional_param('groupid', "", PARAM_ALPHANUMEXT);
     $imageurlid = optional_param('imageurlid', "", PARAM_TEXT);
     $imagethumbnail = optional_param('imagethumbnail', "", PARAM_TEXT);
     $resources = optional_param('resources', "", PARAM_TEXT);
     $response = addNodeAndConnect($name, $desc, $nodetypename, $focalnodeid, $linktypename, $direction, $groupid, $private, $imageurlid, $imagethumbnail, $resources);
     break;
 case "editnode":
Esempio n. 7
0
    }
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', $_GET[m]);
addNode($doc, $navigation, 'pagedescr', "Review the Fund's Operational Settings");
addNode($doc, $navigation, 'title', 'Bully Bully - Settings');
addNode($doc, $navigation, 'pagename', $fundname . ' - Settings');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content
$ss = $doc->createElement('settings');
// <settings>
$ss = $root->appendChild($ss);
addNode($doc, $ss, 'risk', getorset($_GET[t], 'Percentage of Equity Risked Per Trade', '2'));
addNode($doc, $ss, 'positions', getorset($_GET[t], 'Number of Concurrent Open Positions', '15'));
addNode($doc, $ss, 'maxprice', getorset($_GET[t], 'Maximum Price Per Share', '30'));
// Javascript
if ($_GET[s] == 'y') {
    $js = $doc->createElement('javascript');
    // <javascript>
    $js = $root->appendChild($js);
    addNode($doc, $js, 'script', 'js/fundsettings.js');
}
echo $doc->saveXML();
Esempio n. 8
0
$clonenodeid = optional_param("clonenodeid", "", PARAM_HTML);
if (isset($_POST["addissue"])) {
    $private = optional_param("private", "Y", PARAM_ALPHA);
} else {
    $private = optional_param("private", $USER->privatedata, PARAM_ALPHA);
}
if (isset($_POST["addissue"])) {
    if ($issue == "") {
        array_push($errors, $LNG->FORM_ISSUE_ENTER_SUMMARY_ERROR);
    }
    if (empty($errors)) {
        // GET ROLES AND LINKS AS USER
        $r = getRoleByName("Issue");
        $roleIssue = $r->roleid;
        // CREATE THE ISSUE NODE
        $issuenode = addNode($issue, $desc, $private, $roleIssue);
        if (!$issuenode instanceof Error) {
            // Add a see also to the chat comment node this was cread from if chatnodeid exists
            if ($clonenodeid != "") {
                $clonenode = getNode($clonenodeid);
                $clonerolename = $clonenode->role->name;
                $r = getRoleByName($clonerolename);
                $roleClone = $r->roleid;
                $lt = getLinkTypeByLabel($CFG->LINK_COMMENT_BUILT_FROM);
                $linkComment = $lt->linktypeid;
                $connection = addConnection($issuenode->nodeid, $roleIssue, $linkComment, $clonenodeid, $roleClone, "N");
            }
            /*if ($_FILES['image']['error'] == 0) {
            					$imagedir = $HUB_FLM->getUploadsNodeDir($issuenode->nodeid);
            
            					$photofilename = uploadImageToFit('image',$errors,$imagedir);
Esempio n. 9
0
<?php

header('Content-type: text/xml');
include '../bully.inc';
$rc = '0';
$message = 'Setting Successfuly Changed.';
$db = new Database();
$sql = '';
if ($_GET[c] == '1') {
    $sql = 'insert into fundstocks (fund, stock) values ( ' . $_GET[f] . ', ' . $_GET[s] . ' )';
} else {
    $sql = 'delete from fundstocks where fund = ' . $_GET[f] . ' and stock = ' . $_GET[s];
}
if (!mysql_query($sql)) {
    $rc = '4';
    $message = mysql_error();
}
$doc = new DomDocument('1.0');
$root = $doc->createElement('root');
$root = $doc->appendChild($root);
$result = $doc->createElement('result');
$result = $root->appendChild($result);
addNode($doc, $result, 'code', $rc);
addNode($doc, $result, 'message', $message);
echo $doc->saveXML();
<?php

set_time_limit(0);
function addNode($title, $content, $date)
{
    $node = new stdClass();
    $node->type = 'test_perf_1';
    node_object_prepare($node);
    $node->language = LANGUAGE_NONE;
    $node->uid = 1;
    $node->changed_by = 1;
    $node->status = 1;
    $node->created = time() - mt_rand(1000, 1451610061);
    $node->title = $title;
    $node->body[LANGUAGE_NONE][0] = array('value' => $content, 'format' => 'full_html');
    $node->field_test_date[LANGUAGE_NONE][0] = array('value' => $date, 'timezone' => 'UTC', 'timezone_db' => 'UTC');
    node_save($node);
}
for ($i = 0; $i < 20000; $i++) {
    addNode('dummy node ' . $i, '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi convallis mi quis finibus vulputate. Etiam auctor eros sed posuere viverra. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec quis risus vulputate, tempor augue non, molestie arcu. Nulla a lectus lorem. Donec pretium magna eget efficitur tempus. Ut vel risus cursus, rhoncus nunc eu, vulputate ex. Sed placerat euismod augue in venenatis. Suspendisse condimentum, odio eget vehicula imperdiet, eros eros vulputate nunc, aliquam tincidunt erat ipsum in lacus.</p>', date("Y-m-d H:i:s", mt_rand(1000, 1451610061)));
}
Esempio n. 11
0
            array_push($errors, $LNG->ADMIN_NEWS_MISSING_NAME_ERROR);
        }
    } else {
        array_push($errors, $LNG->ADMIN_NEWS_ID_ERROR);
    }
} else {
    if (isset($_POST["addnews"])) {
        if ($name != "") {
            //become the news admin user
            $currentuser = $USER;
            $admin = new User($CFG->adminUserID);
            $admin = $admin->load();
            $USER = $admin;
            $r = getRoleByName('News');
            $roleType = $r->roleid;
            $node = addNode($name, $desc, 'N', $roleType);
            $USER = $currentuser;
        } else {
            array_push($errors, $LNG->ADMIN_NEWS_MISSING_NAME_ERROR);
        }
    } else {
        if (isset($_POST["deletenews"])) {
            if ($nodeid != "") {
                if (!adminDeleteNews($nodeid)) {
                    array_push($errors, $LNG->ADMIN_MANAGE_NEWS_DELETE_ERROR . ' ' . $nodeid);
                }
            } else {
                array_push($errors, $LNG->ADMIN_NEWS_ID_ERROR);
            }
        }
    }
Esempio n. 12
0
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content
$fund = $_GET[t];
$date = getorset('0', 'Last Process Date', '2007-06-13');
// Get Deposits
$sql = "select ifnull(sum(amount),0) deposits from deposits where fund = " . $fund;
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$deposits = $cols['deposits'];
// Get Profits
$sql = "select ifnull(sum((amount / buyprice) * (sellprice - buyprice)),0) profit from trades where fund = " . $fund . " and selldate < '" . $date . "'";
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$profit = $cols['profit'];
// Get Gain & Holdings
$sql = "select ifnull(sum(t.amount),0) holdings, ifnull(sum((t.amount / t.buyprice) * (ifnull(t.sellprice,p.price) - t.buyprice) ),0) gain from trades t, prices p where t.stock = p.stock and p.thedate = '" . $date . "' and t.fund = " . $fund . " and ifnull(t.selldate,'" . $date . "') >= '" . $date . "'";
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$holdings = $cols['holdings'];
$gain = $cols['gain'];
// Calculate Cash & Equity
$cash = $deposits + $profit - $holdings;
$equity = $deposits + $profit + $gain;
$portfolio = $equity - $cash;
$content = $doc->createElement('content');
$content = $root->appendChild($content);
addNode($doc, $content, 'cash', $cash);
addNode($doc, $content, 'stocks', $portfolio);
echo $doc->saveXML();
Esempio n. 13
0
             header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
             exit;
         } else {
             $delError = 1;
         }
     } else {
         deleteNode($_GET['id']);
         header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
         exit;
     }
 } elseif (($action == 'add' || $action == 'edit') && $_POST['formSent']) {
     $_POST['categoryCode'] = trim($_POST['categoryCode']);
     $_POST['categoryName'] = trim($_POST['categoryName']);
     if (!empty($_POST['categoryCode']) && !empty($_POST['categoryName'])) {
         if ($action == 'add') {
             $ret = addNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $category);
         } else {
             $ret = editNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $id);
         }
         if ($ret) {
             $action = '';
         } else {
             $errorMsg = get_lang('CatCodeAlreadyUsed');
         }
     } else {
         $errorMsg = get_lang('PleaseEnterCategoryInfo');
     }
 } elseif ($action == 'edit') {
     if (!empty($id)) {
         $categoryCode = $id;
         $sql = "SELECT name, auth_course_child FROM {$tbl_category} WHERE code='{$id}'";
Esempio n. 14
0
$identifierarray = optional_param("identifierarray", "", PARAM_TEXT);
$resourcenodeidsarray = optional_param("resourcenodeidsarray", "", PARAM_TEXT);
$resourcecliparray = optional_param("resourcecliparray", "", PARAM_TEXT);
$resourceclippatharray = optional_param("resourceclippatharray", "", PARAM_TEXT);
$clonenodeid = optional_param("clonenodeid", "", PARAM_HTML);
if (isset($_POST["addsolution"])) {
    if ($solution == "") {
        array_push($errors, $LNG->FORM_SOLUTION_ENTER_SUMMARY_ERROR);
    }
    if (empty($errors)) {
        $currentUser = $USER;
        // GET ROLE FOR USER
        $r = getRoleByName("Solution");
        $roleSolution = $r->roleid;
        // CREATE THE solution NODE
        $solutionnode = addNode($solution, $desc, $private, $roleSolution);
        if (!$solutionnode instanceof Error) {
            // Add a see also to the chat comment node this was cread from if chatnodeid exists
            if ($clonenodeid != "") {
                $clonenode = getNode($clonenodeid);
                $clonerolename = $clonenode->role->name;
                $r = getRoleByName($clonerolename);
                $roleClone = $r->roleid;
                $lt = getLinkTypeByLabel($CFG->LINK_COMMENT_BUILT_FROM);
                $linkComment = $lt->linktypeid;
                $connection = addConnection($solutionnode->nodeid, $roleSolution, $linkComment, $clonenodeid, $roleClone, "N");
            }
            /** ADD RESOURCES **/
            if (empty($errors)) {
                $lt = getLinkTypeByLabel('is related to');
                $linkRelated = $lt->linktypeid;
Esempio n. 15
0
$resourceurlarray = optional_param("resourceurlarray", "", PARAM_URL);
$identifierarray = optional_param("identifierarray", "", PARAM_TEXT);
$resourcenodeidsarray = optional_param("resourcenodeidsarray", "", PARAM_TEXT);
$resourcecliparray = optional_param("resourcecliparray", "", PARAM_TEXT);
$resourceclippatharray = optional_param("resourceclippatharray", "", PARAM_TEXT);
if (isset($_POST["addcomment"])) {
    $label = $summary;
    trim($label);
    if ($label == "") {
        array_push($errors, $LNG->FORM_COMMENT_ENTER_SUMMARY_ERROR);
    }
    if (empty($errors)) {
        $r = getRoleByName("Idea");
        $roleComment = $r->roleid;
        // CREATE THE NODE
        $commentnode = addNode($label, $desc, $private, $roleComment);
        if (empty($errors) && isset($commentnode) && !$commentnode instanceof Error) {
            if ($_FILES['image']['error'] == 0) {
                $imagedir = $HUB_FLM->getUploadsNodeDir($commentnode->nodeid);
                $photofilename = uploadImageToFitComments('image', $errors, $imagedir, 155, 45);
                if ($photofilename == "") {
                    $photofilename = $CFG->DEFAULT_ISSUE_PHOTO;
                }
                $commentnode->updateImage($photofilename);
            }
            /** ADD RESOURCES **/
            $lt = getLinkTypeByLabel('is related to');
            $linkRelated = $lt->linktypeid;
            $i = 0;
            foreach ($resourceurlarray as $resourceurl) {
                $resourcetitle = trim($resourcetitlearray[$i]);
Esempio n. 16
0
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'id', $id);
addNode($doc, $occ, 'symbol', $cols['symbol']);
addNode($doc, $occ, 'company', $cols['company']);
addNode($doc, $occ, 'enabled', $cols['enabled']);
addNode($doc, $occ, 'price', $cols['price']);
addNode($doc, $occ, 'day10', $cols['day10']);
addNode($doc, $occ, 'low120', $cols['low120']);
addNode($doc, $occ, 'high120', $cols['high120']);
addNode($doc, $occ, 'process', $cols['process']);
addNode($doc, $occ, 's1date', $s1date);
addNode($doc, $occ, 's1price', $s1price);
addNode($doc, $occ, 's2date', $s2date);
addNode($doc, $occ, 's2price', $s2price);
addNode($doc, $occ, 'buydate', $buydate);
addNode($doc, $occ, 'buyprice', $buyprice);
addNode($doc, $occ, 'amount', $amount);
addNode($doc, $occ, 'days', $days);
if (floatval($stop) > floatval($cols['low120'])) {
    addNode($doc, $occ, 'stop', $stop);
} else {
    addNode($doc, $occ, 'stop', $cols['low120']);
}
// Javascript
if ($_GET[s] == 'y') {
    $js = $doc->createElement('javascript');
    // <javascript>
    $js = $root->appendChild($js);
    addNode($doc, $js, 'script', 'js/viewposition.js');
}
echo $doc->saveXML();
Esempio n. 17
0
     addSingPoint($coors, $CableLineId, $networkNode, "NULL", "NULL", $meterSign, $note);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "deleteSingPoint") {
     deleteSingPoint($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "deleteCableLine") {
     deleteCableLine($CableLineId, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "addNode") {
     $NetworkBoxId = $obj->{'NetworkBoxId'};
     $apartment = NULL;
     $building = NULL;
     $note = $obj->{'note'};
     $name = $obj->{'name'};
     $place = $obj->{'place'};
     addNode($coors, $name, $NetworkBoxId, $note, NULL, $building, $apartment, $place, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "deleteNode") {
     deleteNode($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "moveNode") {
     moveNode($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "divCableLine") {
     $nodeInfo['name'] = $obj->{'name'};
     $nodeInfo['NetworkBoxId'] = $obj->{'NetworkBoxId'};
     /*$nodeInfo[ 'apartment' ] = $obj->{'apartment'};
       $nodeInfo[ 'building' ] = $obj->{'building'};*/
     $nodeInfo['note'] = $obj->{'note'};
     $nodeInfo['place'] = $obj->{'place'};
     $ret = divCableLine($coors, $CableLineId, $nodeInfo, TRUE);
Esempio n. 18
0
function addNode(&$dest, &$src)
{
    if (!is_array($src) || count($src) < 1) {
        return;
    }
    foreach ($src as $key => $subnode) {
        if ($key != "___flag") {
            addNode($dest[$key], $subnode);
        }
    }
}
Esempio n. 19
0
    $date = date("Y-m-d", $today);
    $occ = $doc->createElement('content');
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'date', $date);
    addNode($doc, $occ, 'datestring', date("l, F j, Y", $today));
    $signals = array();
    if ($i == 0) {
        getAlerts(&$signals);
    }
    // getSignals( &$signals, $date );
    getBuys(&$signals, $date);
    getSells(&$signals, $date);
    foreach ($signals as $detail) {
        $det = $doc->createElement('detail');
        $det = $occ->appendChild($det);
        addNode($doc, $det, 'signal', $detail);
    }
}
echo $doc->saveXML();
// --------- Functions -------------------------
function getAlerts($signals)
{
    // System Alert - GM 47% Price Change
    // System Alert - GM is in multiple funds
    $sql = "select symbol, price, day10, ( 100 * (price - day10) / price) gain from stocks where enabled = 'Y' and ( ( 100 * (price - day10) / price) > 35 or ( 100 * (price - day10) / price) < -35 )";
    $rows = mysql_query($sql);
    while ($cols = mysql_fetch_array($rows)) {
        $symbol = $cols['symbol'];
        $gain = intval($cols['gain']);
        if ($gain < 0) {
            $gain = 0 - $gain;
Esempio n. 20
0
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
$cols = mysql_fetch_array($rows) or die('stock not found. id: ' . $_GET[d]);
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', $cols['company'] . ' (' . $cols['symbol'] . ')');
addNode($doc, $navigation, 'title', 'Bully Bully - Stock');
addNode($doc, $navigation, 'pagename', $fundname . ' - Stock Detail');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content - stock detail
$occ = $doc->createElement('content');
// <content>
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'id', $cols['id']);
addNode($doc, $occ, 'symbol', $cols['symbol']);
addNode($doc, $occ, 'company', $cols['company']);
addNode($doc, $occ, 'enabled', $cols['enabled']);
if ($cols['enabled'] == 'Y') {
    addNode($doc, $occ, 'price', $cols['price']);
    addNode($doc, $occ, 'day10', $cols['day10']);
    addNode($doc, $occ, 'low120', $cols['low120']);
    addNode($doc, $occ, 'high120', $cols['high120']);
}
echo $doc->saveXML();
Esempio n. 21
0
<?php

header('Content-type: text/xml');
include '../bully.inc';
$db = new Database();
$sql = "select id, name from funds order by id desc";
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
$doc = new DomDocument('1.0');
// create a new XML document
$root = $doc->createElement('root');
// <root>
$root = $doc->appendChild($root);
while ($cols = mysql_fetch_array($rows)) {
    $occ = $doc->createElement('funds');
    // <funds>
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'id', $cols['id']);
    // <funds><id>
    addNode($doc, $occ, 'name', $cols['name']);
    // <funds><name>
}
echo $doc->saveXML();
Esempio n. 22
0
$i = 0;
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
while ($cols = mysql_fetch_array($rows)) {
    if ($cols['checked'] != '0' || $_GET[s] == 'y') {
        $occ = $doc->createElement('content');
        // <content>
        $occ = $root->appendChild($occ);
        addNode($doc, $occ, 'id', $cols['id']);
        addNode($doc, $occ, 'symbol', $cols['symbol']);
        addNode($doc, $occ, 'company', $cols['company']);
        addNode($doc, $occ, 'enabled', $cols['enabled']);
        addNode($doc, $occ, 'line', $i++);
        if ($cols['enabled'] == 'Y') {
            addNode($doc, $occ, 'price', $cols['price']);
            addNode($doc, $occ, 'day10', $cols['day10']);
        }
        if ($cols['checked'] == '0') {
            addNode($doc, $occ, 'checked', 'no');
        } else {
            addNode($doc, $occ, 'checked', 'yes');
        }
    }
}
// Javascript
if ($_GET[s] == 'y') {
    $js = $doc->createElement('javascript');
    // <javascript>
    $js = $root->appendChild($js);
    addNode($doc, $js, 'script', 'js/fundstocks.js');
}
echo $doc->saveXML();
Esempio n. 23
0
     if ($sdate >= $edate) {
         array_push($errors, $LNG->FORM_ISSUE_START_END_DATE_ERROR);
     }
     if ($votingstart != "") {
         $vdate = strtotime($votingstart);
         if ($vdate > $edate || $vdate < $sdate) {
             array_push($errors, $LNG->FORM_ISSUE_VOTE_START_DATE_ERROR);
         }
     }
 }
 if (empty($errors)) {
     // GET ROLES AND LINKS AS USER
     $r = getRoleByName("Issue");
     $roleIssue = $r->roleid;
     // CREATE THE ISSUE NODE
     $issuenode = addNode($issue, $desc, 'N', $roleIssue);
     if (!$issuenode instanceof Error) {
         // ISSUE DATES
         $issuenode->updateStartDate($utcstarttime);
         $issuenode->updateEndDate($utcendtime);
         // DISCUSSION
         if ($utcdiscussionendtime != 0) {
             $issuenode->updateNodeProperty('discussionstart', $utcstarttime);
         }
         $issuenode->updateNodeProperty('discussionend', $utcdiscussionendtime);
         // LEMONING
         $issuenode->updateNodeProperty('lemoningon', $lemoningon);
         $issuenode->updateNodeProperty('lemoningstart', $utclemoningstarttime);
         $issuenode->updateNodeProperty('lemoningend', $utclemoningendtime);
         // VOTING
         $issuenode->updateNodeProperty('votingon', $votingon);
Esempio n. 24
0
$sql = "select id, name from funds order by id desc";
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
while ($cols = mysql_fetch_array($rows)) {
    $occ = $doc->createElement('funds');
    // <funds>
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'id', $cols['id']);
    // <funds><id>
    addNode($doc, $occ, 'name', $cols['name']);
    // <funds><name>
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', '0');
addNode($doc, $navigation, 'menu', '8');
addNode($doc, $navigation, 'pagedescr', "Make a Backup of the System's Database");
addNode($doc, $navigation, 'title', 'Bully Bully - Backup');
addNode($doc, $navigation, 'pagename', 'Administration - Backup');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// Javascript
$js = $doc->createElement('javascript');
// <javascript>
$js = $root->appendChild($js);
addNode($doc, $js, 'script', 'js/backup.js');
echo $doc->saveXML();
Esempio n. 25
0
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', '0');
addNode($doc, $navigation, 'menu', '2');
addNode($doc, $navigation, 'pagedescr', 'Process New Stock Prices And Market Signals');
addNode($doc, $navigation, 'title', 'Bully Bully - Process');
addNode($doc, $navigation, 'pagename', 'Administration - Process');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content
$sql = 'select current_date() today';
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$today = $cols['today'];
$ss = $doc->createElement('settings');
// <settings>
$ss = $root->appendChild($ss);
addNode($doc, $ss, 'lastprocess', getorset('0', 'Last Process Date', '2007-06-13'));
addNode($doc, $ss, 'today', $today);
// Javascript
$js = $doc->createElement('javascript');
// <javascript>
$js = $root->appendChild($js);
addNode($doc, $js, 'script', 'js/process.js');
echo $doc->saveXML();
Esempio n. 26
0
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'year', '2006');
addNode($doc, $occ, 'deposits', '5000');
addNode($doc, $occ, 'earnings', '85');
addNode($doc, $occ, 'return', '4');
addNode($doc, $occ, 'balance', '5085');
$occ = $doc->createElement('content');
// 2007
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'year', '2007');
addNode($doc, $occ, 'deposits', 6000);
addNode($doc, $occ, 'earnings', 1906);
addNode($doc, $occ, 'return', '28');
addNode($doc, $occ, 'balance', 12991);
$occ = $doc->createElement('content');
// 2008
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'year', '2008');
addNode($doc, $occ, 'deposits', $deposits - 11000);
addNode($doc, $occ, 'earnings', $equity - ($deposits - 11000) - 12991);
addNode($doc, $occ, 'return', '0');
addNode($doc, $occ, 'balance', $equity);
$occ = $doc->createElement('totals');
// Totals
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'year', 'Total');
addNode($doc, $occ, 'deposits', $deposits);
addNode($doc, $occ, 'earnings', $equity - $deposits);
addNode($doc, $occ, 'return', '22');
addNode($doc, $occ, 'balance', $equity);
echo $doc->saveXML();
Esempio n. 27
0
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', $cols['company'] . ' (' . $cols['symbol'] . ')');
addNode($doc, $navigation, 'title', 'Bully Bully - Stocks');
addNode($doc, $navigation, 'pagename', 'Administration - Stock Detail');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content - stock list
$occ = $doc->createElement('content');
// <content>
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'id', $cols['id']);
addNode($doc, $occ, 'symbol', $cols['symbol']);
addNode($doc, $occ, 'company', $cols['company']);
addNode($doc, $occ, 'enabled', $cols['enabled']);
if ($cols['enabled'] == 'Y') {
    addNode($doc, $occ, 'price', $cols['price']);
    addNode($doc, $occ, 'day10', $cols['day10']);
    addNode($doc, $occ, 'low120', $cols['low120']);
    addNode($doc, $occ, 'high120', $cols['high120']);
}
// Javascript
if ($_GET[s] == 'y') {
    $js = $doc->createElement('javascript');
    // <javascript>
    $js = $root->appendChild($js);
    addNode($doc, $js, 'script', 'js/editstock.js');
}
echo $doc->saveXML();
Esempio n. 28
0
    addNode($doc, $occ, 'name', $cols['name']);
    // <funds><name>
    if ($cols['id'] == $_GET[t]) {
        $fundname = $cols['name'];
    }
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', $_GET[m]);
addNode($doc, $navigation, 'pagedescr', "Review The Fund's Deposits And Withdrawals");
addNode($doc, $navigation, 'title', 'Bully Bully - Deposits');
addNode($doc, $navigation, 'pagename', $fundname . ' - Deposits');
if ($_GET[s] == 'y') {
    addNode($doc, $navigation, 'signedin', 'yes');
} else {
    addNode($doc, $navigation, 'signedin', 'no');
}
// build content - deposits
$sql = "select thedate, amount from deposits where fund = " . $_GET[t];
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
while ($cols = mysql_fetch_array($rows)) {
    $occ = $doc->createElement('content');
    // <content>
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'thedate', $cols['thedate']);
    addNode($doc, $occ, 'amount', $cols['amount']);
}
echo $doc->saveXML();
Esempio n. 29
0
     if (api_get_multiple_access_url()) {
         if (api_get_current_access_url_id() == 1 || isset($_configuration['enable_multiple_url_support_for_course_category']) && $_configuration['enable_multiple_url_support_for_course_category']) {
             deleteNode($categoryId);
             Display::addFlash(Display::return_message(get_lang('Deleted')));
             header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
             exit;
         }
     } else {
         deleteNode($categoryId);
         Display::addFlash(Display::return_message(get_lang('Deleted')));
         header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
         exit;
     }
 } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
     if ($action == 'add') {
         $ret = addNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $category);
         Display::addFlash(Display::return_message(get_lang('Created')));
     } else {
         $ret = editNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $categoryId);
         Display::addFlash(Display::return_message(get_lang('Updated')));
     }
     if ($ret) {
         $action = '';
     } else {
         $errorMsg = get_lang('CatCodeAlreadyUsed');
     }
 } elseif ($action == 'moveUp') {
     moveNodeUp($categoryId, $_GET['tree_pos'], $category);
     header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
     Display::addFlash(Display::return_message(get_lang('Updated')));
     exit;
Esempio n. 30
0
function mergeSelectedNodes($issuenodeid, $groupid, $ids, $title, $desc)
{
    global $CFG;
    $mainConnections = getConnectionsByNode($issuenodeid, 0, -1, 'date', 'ASC', 'all', '', 'Solution');
    $mainconns = $mainConnections->connections;
    $r = getRoleByName("Solution");
    $rolesolution = $r->roleid;
    // CREATE THE solution NODE
    $solutionnode = addNode($title, $desc, 'N', $rolesolution);
    if (!$solutionnode instanceof Error) {
        // Add to group
        if (isset($groupid) && $groupid != "") {
            addGroupToNode($solutionnode->nodeid, $groupid);
        }
        // CONNECT NODE TO FOCAL
        $node = getNode($issuenodeid);
        $r = getRoleByName($node->role->name);
        $focalroleid = $r->roleid;
        $lt = getLinkTypeByLabel($CFG->LINK_SOLUTION_ISSUE);
        $linkType = $lt->linktypeid;
        $conndesc = "";
        $connection = addConnection($solutionnode->nodeid, $rolesolution, $linkType, $issuenodeid, $focalroleid, "N", $conndesc);
        if (!$connection instanceof Error) {
            // add to group
            if (isset($groupid) && $groupid != "") {
                addGroupToConnection($connection->connid, $groupid);
            }
            // CONNECT NEW NODE TO SELECT NODES
            $lt2 = getLinkTypeByLabel($CFG->LINK_BUILT_FROM);
            $linkTypeBuiltFrom = $lt2->linktypeid;
            //error_log(print_r($linkTypeBuiltFrom, true));
            $nodesArr = split(",", $ids);
            foreach ($nodesArr as $nodeid2) {
                $n = new CNode($nodeid2);
                $n = $n->load();
                $r = getRoleByName($n->role->name);
                $roleid = $r->roleid;
                $connection2 = addConnection($solutionnode->nodeid, $rolesolution, $linkTypeBuiltFrom, $nodeid2, $roleid, "N", $conndesc);
                //error_log(print_r($connection2, true));
                if (!$connection2 instanceof Error) {
                    // add to group
                    if (isset($groupid) && $groupid != "") {
                        addGroupToConnection($connection2->connid, $groupid);
                    }
                    // Link kids to new parent
                    $conSetKids = getConnectionsByNode($nodeid2, 0, -1, 'date', 'ASC', 'all', '', 'Pro,Con,Comment');
                    $conns = $conSetKids->connections;
                    foreach ($conns as $con) {
                        $from = $con->from;
                        $r2 = getRoleByName($from->role->name);
                        $fromroleid = $r2->roleid;
                        //error_log('nextfrom:'.print_r($from, true));
                        $lt3 = getLinkTypeByLabel($CFG->LINK_COMMENT_NODE);
                        $linkType3 = $lt3->linktypeid;
                        if ($from->role->name == "Pro") {
                            $lt3 = getLinkTypeByLabel($CFG->LINK_PRO_SOLUTION);
                            $linkType3 = $lt3->linktypeid;
                        } else {
                            if ($from->role->name == "Con") {
                                $lt3 = getLinkTypeByLabel($CFG->LINK_CON_SOLUTION);
                                $linkType3 = $lt3->linktypeid;
                            }
                        }
                        // Connect the children of each node being merged to the new node
                        $connection3 = addConnection($from->nodeid, $fromroleid, $linkType3, $solutionnode->nodeid, $rolesolution, "N", $conndesc);
                        if (!$connection3 instanceof Error) {
                            // add to group
                            if (isset($groupid) && $groupid != "") {
                                addGroupToConnection($connection3->connid, $groupid);
                            }
                        } else {
                            //error_log(print_r($connection3, true));
                        }
                        // retire old connection
                        $con->updateStatus($CFG->STATUS_RETIRED);
                    }
                    // retire connection to parent
                    foreach ($mainconns as $con) {
                        $from = $con->from;
                        if ($from->nodeid == $nodeid2) {
                            $con->updateStatus($CFG->STATUS_RETIRED);
                        }
                    }
                    // retire node
                    $n->updateStatus($CFG->STATUS_RETIRED);
                } else {
                    return $connection2;
                }
            }
        } else {
            return $connection;
        }
    }
    return $solutionnode;
}