Example #1
0
 function __construct()
 {
     //-----vytvorenie objektu menu
     $menu = new MenuItem();
     $menu->menuAction();
     //-----vytvorenie objektu node
     $node = new node();
     $node->nodeAction();
     MT::addContent($menu->render(), 'leftHolder');
     try {
         if (isset($_GET['id_menu_item']) or isset($_GET['addMenuItem']) or isset($_GET['changeMenuItem'])) {
             MT::addTemplate(APP_DIR . '/templates/admin/modulHolder.phtml', 'modulHolder');
             MT::addVar('modulHolder', 'type_modul', dibi::fetchAll("SELECT * FROM [type_modul] WHERE visible_for_user='******'"));
         }
         //zobrazenie zmeny polozky pre menu
         if (isset($_GET['changeMenuItem'])) {
             $menu->showChangeMenuItem($_GET['id_menu_item']);
         }
         if (isset($_GET['id_menu_item']) and !isset($_GET['changeMenuItem'])) {
             $node->showModul();
         }
         //pridanie polozky do menu
         if (isset($_GET['addMenuItem'])) {
             $menu->showAddMenuItem();
         }
         //zachytenie vynimie
     } catch (NodeException $e) {
         echo '<div style="border: 2px solid red; padding: 5px;">' . $e->getMessage() . '</div>';
         exit;
     }
 }
Example #2
0
 public function build($node, $matches, $options = array())
 {
     $link = new node('a');
     $link->set_attribute('href', rawurldecode($matches[1][0]));
     $this->apply($link, $matches[2][0], $options);
     $node->append($link);
 }
Example #3
0
 public function getSectorLink($x, $y, &$i)
 {
     if (isset($this->data[$i]) && $this->data[$i]['x'] == $x && $this->data[$i]['y'] == $y) {
         if ($this->data[$i]['type'] != 2) {
             $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(labels[' . $this->data[$i]['type'] . '], \'-\', \'-\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
         } else {
             $node = new node();
             $node->get('id', $this->data[$i]['id']);
             $user = new user();
             $user->get('id', $node->data['user']);
             $alliancename = '-';
             if ($user->data['alliance']) {
                 $alliance = new alliance();
                 $alliance->get('user', $user->data['id']);
                 $alliancename = $alliance->data['name'];
             }
             $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(\'' . $node->data['name'] . '\', \'' . $user->data['name'] . '\', \'' . $alliancename . '\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
         }
         if ($i < count($this->data) - 1) {
             $i++;
         }
     } else {
         $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')"';
     }
     return $output;
 }
 function testNodesSimple()
 {
     $node = new node('', '');
     $this->assertEqual($node->getName(), $node->name);
     $this->assertEqual($node->getData(), $node->data);
     $this->assertEqual(node::getNodeData($node), '');
 }
Example #5
0
 public function build($node, $matches, $options = array())
 {
     $img = new node('img');
     $img->set_attribute('src', $matches[1][0]);
     $alt = isset($matches[2]) ? $matches[2][0] : '';
     $img->set_attribute('alt', preg_replace('/~(.)/', '$1', $alt));
     $node->append($img);
 }
 public function build($node, $matches, $options = array())
 {
     if (isset($options['interwiki'])) {
         preg_match('/(.*?):(.*)/', $matches[1][0], $m);
     }
     if (!isset($m[1]) || !isset($options['interwiki'][$m[1]])) {
         return parent::build($node, $matches, $options);
     }
     $format = $options['interwiki'][$m[1]];
     $link = new node('a');
     $link->set_attribute('href', $this->format_link(preg_replace('/~(.)/', '$1', $m[2]), $format));
     $this->apply($link, $matches[2][0], $options);
     $node->append($link);
 }
Example #7
0
 public function add($nodeId)
 {
     global $db, $game;
     $alliance = new alliance();
     if ($alliance->get('name', $this->data['name']) == 'noAlliance') {
         $node = new node();
         if ($node->get('id', $nodeId) == 'done') {
             $node->checkResources(time());
             $addCost = $game['factions'][$node->data['faction']]['costs']['alliance'];
             $addCostData = $node->checkCost($addCost, 'alliance');
             if ($addCostData['ok']) {
                 $ok = 1;
                 foreach ($addCost as $cost) {
                     $node->resources[$cost['resource']]['value'] -= $cost['value'] * $game['users']['cost']['alliance'];
                     $db->query('update resources set value="' . $node->resources[$cost['resource']]['value'] . '" where node="' . $node->data['id'] . '" and id="' . $cost['resource'] . '"');
                     if ($db->affected_rows() == -1) {
                         $ok = 0;
                     }
                 }
                 $this->data['id'] = misc::newId('alliances');
                 $db->query('insert into alliances (id, user, name) values ("' . $this->data['id'] . '", "' . $node->data['user'] . '", "' . $this->data['name'] . '")');
                 if ($db->affected_rows() == -1) {
                     $ok = 0;
                 }
                 $db->query('update users set alliance="' . $this->data['id'] . '" where id="' . $this->data['user'] . '"');
                 if ($db->affected_rows() == -1) {
                     $ok = 0;
                 }
                 if ($ok) {
                     $status = 'done';
                 } else {
                     $status = 'error';
                 }
             } else {
                 $status = 'notEnoughResources';
             }
         } else {
             $status = 'noNode';
         }
     } else {
         $status = 'nameTaken';
     }
     return $status;
 }
 function view_contact()
 {
     $node = new Node(arg(2));
     tpl_set('page_title', $node->title);
     tpl_set('page_description', 'Contact Card');
     tpl_set('node', objectArray($node));
     tpl_set('keys', array_flip(objectArray($node)));
     //Get the default contact template
     $type = node::lookup_type_id('contacts');
     $template = node::load_node_template($type);
 }
 function add_contact_submit($form)
 {
     $node = node::add_new('title', $form['fields']['title']['value'], 1);
     //Now loop through the rest of this array and add it to the node.
     foreach ($form['fields'] as $k => $v) {
         $node->add_field($v['name'], $v['value']);
     }
     serum_set_message('Contact has been added successfully.');
     // We need to return the form again. I dont like this much...
     header('location: ' . base_path() . 'contacts');
 }
Example #10
0
 /**
  * Deletes values of current attribute given in arguments.
  *
  * This method takes a variable number of arguments each representing
  * existing value of current attribute to be deleted/removed. Since empty
  * strings are ignored, there may be no value to delete. In that case
  * no values are deleted at all.
  *
  * @throws protocol_exception
  * @param string $firstValueToDelete first value of attribute to delete
  * @return attribute current instance
  */
 public function delete($firstValueToDelete)
 {
     if (!$this->faking) {
         $values = array_filter(array_map(function ($a) {
             return trim($a);
         }, func_get_args()), function ($a) {
             return $a !== '';
         });
         if (count($values)) {
             if ($this->node->isAdjusting()) {
                 $this->node->adjust($this, array_diff($this->read(), $values));
             } else {
                 if (!@ldap_mod_del($this->node->getLink(), $this->node->getDN(), array($this->name => $values))) {
                     throw new protocol_exception(sprintf('failed to delete values of attribute %s', $this->name), $this->node->getLink(), $this->node->getDN());
                 }
             }
         }
     }
     return $this;
 }
Example #11
0
 function saveGMap($values, $id_node)
 {
     $tmp = dibi::fetch("SELECT * FROM [gmap] WHERE id_node=%i", $id_node);
     unset($values['id_node']);
     unset($values['saveGMap']);
     //odstranenie premennych ktore niesu v databaze
     $tmp = (array) $tmp;
     foreach ($values as $key => $v) {
         if (!array_key_exists($key, $tmp)) {
             unset($values[$key]);
         }
     }
     $values['googleBar'] = (int) $values['googleBar'];
     $values['enableScrollWheelZoom'] = (int) $values['enableScrollWheelZoom'];
     $values['doubleClickZoom'] = (int) $values['doubleClickZoom'];
     if (isset($values['modul_visible'])) {
         node::changeVisibility($id_node, $values['modul_visible']);
     }
     dibi::query("UPDATE gmap SET ", $values, " WHERE id_node=%i", $id_node);
     Log::addLog($this, "Uprava gmap", "Menil:" . NEnvironment::getSession('Authentication')->login_form, '', $id_node);
 }
Example #12
0
 function actOnJavascriptPlanActions($actionPackets)
 {
     $plansConvergence = false;
     $constraintsArray = array();
     //Setup the javascript collections
     for ($index = 0; $index < sizeof($actionPackets); $index++) {
         $constraintsArray[$index] = new javaScriptCollection();
     }
     while (!$plansConvergence) {
         //Plans have have converged to a single plan
         $actionArray = array();
         $packetCollection = array();
         for ($index = 0; $index < sizeof($actionPackets); $index++) {
             $actionNode = $actionPackets[$index]->getAction();
             $data = $actionNode->getData();
             $actionPredicate = node::getNodeData($data);
             //Find the values for this conditional action
             $predicateValues = $actionPredicate->getPredicateValues();
             //Create a new javascript constraint
             $javaScriptConstraint = new javaScriptConstraint($predicateValues[1]->toString(), $predicateValues[2]->toString(), $predicateValues);
             //Add this constraint to the associated collection
             $constraintsArray[$index]->addConstraint($javaScriptConstraint);
             //Find the next action for this action packet
             $nextActionPackets = planAction::fetchNextAction($actionPackets[$index]->getPlans());
             $nextAction = $nextActionPackets[1];
             $actionArray[$index] = $nextAction[0]->toString();
             $packetCollection = array_merge($packetCollection, $nextActionPackets[0]);
         }
         $plansConvergence = arrays::allEqual($actionArray);
         if (!$plansConvergence) {
             $actionPackets = $packetCollection;
         }
     }
     //Plans must have convereged so it does not matter which one we return!
     return array('actionPackets' => $actionPackets[0], 'constraints' => $constraintsArray);
     //return $actionPackets[0];
 }
Example #13
0
    }, $text);
    return $rtext;
}
/**
 * @param $text
 *
 * @return mixed
 */
function markdown_text($text)
{
    global $f3;
    $node = $f3->get('firtz');
    return $node->markdown->text($text);
}
// ----------------------------- set podcast
$firtz = new node($f3);
$firtz->loadAllTheExtensions($f3);
$f3->set('firtz', $firtz);
$podcasts = array();
foreach (glob($f3->get('PODCASTDIR') . '/*', GLOB_ONLYDIR) as $dir) {
    if (substr(basename($dir), 0, 1) != "_") {
        $podcasts[] = basename($dir);
    }
}
$f3->set('podcasts', $podcasts);
// ----------------------------- login
function login($array)
{
    $user_password = $array;
    return $user_password;
}
Example #14
0
     $edgeProgressionResult = $edgeProgressionPacket['match'];
     //Retrive the selected action packet
     $selectedActionPacket = $edgeProgressionPacket['actionPacket'];
     if ($edgeProgressionResult) {
         //The edgeprogression test succeded
         //Check the chosen action packet
         if ($selectedActionPacket->atGoal()) {
             //At goal node
             $goal = true;
             planArchieving::archive($_POST['workflowID']);
             systemMessages::message("Goal node reached!");
         } else {
             //Only one action packet should be returned
             $plans = $selectedActionPacket->getPlans();
             $newPlannerProgress = planAction::fetchNextAction($plans);
             $action = node::getNodeData($newPlannerProgress[1]);
             if ($action->getPredicateName() != 'edgeProgression') {
                 $match = true;
             } else {
             }
             $plannerProgress = $newPlannerProgress;
             $newPlannerProgress = array();
         }
     }
 }
 debug::message("edge progression test :" . $edgeProgressionResult);
 if ($edgeProgressionResult) {
     if (!$goal) {
         //No point in updating plans if we have reached the goal
         planningAgent::updatePlans($plans);
     }
Example #15
0
                         $message = $ui[$status];
                     }
                 } else {
                     $message = $ui['accessDenied'];
                 }
             }
         } else {
             $message = $ui[$status];
         }
     } else {
         $message = $ui['insufficientData'];
     }
     break;
 case 'move':
     if (isset($_GET['nodeId'])) {
         $node = new node();
         $status = $node->get('id', $_GET['nodeId']);
         if ($status == 'done') {
             if (isset($_POST['x'], $_POST['y'])) {
                 if ($node->data['user'] == $_SESSION[$shortTitle . 'User']['id']) {
                     if ($game['factions'][$node->data['faction']]['costs']['move'][0]['resource'] > -1) {
                         $message = $ui[$node->move($_POST['x'], $_POST['y'])];
                     } else {
                         $message = $ui['nodeMoveDisabled'];
                     }
                 } else {
                     $message = $ui['accessDenied'];
                 }
             }
         } else {
             $message = $ui[$status];
Example #16
0
?>
</head>
<body class="skin-blue">
<?php 
include_once 'lib/nav.inc.php';
include_once 'lib/slidebar_left.inc.php';
//更新
if (!empty($_POST)) {
    $node_id = $_POST['node_id'];
    $node_name = $_POST['node_name'];
    $node_type = $_POST['node_type'];
    $node_server = $_POST['node_server'];
    $node_info = $_POST['node_info'];
    $node_status = $_POST['node_status'];
    $node_order = $_POST['node_order'];
    $n = new node($node_id);
    $query = $n->update($node_name, $node_type, $node_server, $node_info, $node_status, $node_order);
    if ($query) {
        echo ' <script>alert("更新成功!")</script> ';
        echo " <script>window.location='node.php';</script> ";
    }
}
if (!empty($_GET)) {
    //获取id
    $id = $_GET['id'];
    $sql = "SELECT * FROM `ss_node` WHERE id = '{$id}' ";
    $query = $dbc->query($sql);
    $rs = $query->fetch_array();
}
?>
<!-- Right side column. Contains the navbar and content of the page -->
 /**
  * Will return a new node object
  * 
  * @param string $table is the table id (not needed most of the time)
  * @param integer $id is the id needed
  * @param array $data may contain the data of the node, in order to preload it with data
  * 
  */
 function newNode($table = "node", $id = false, $data = false)
 {
     // will include the right module class if needed, for example, specialized modules like ftp datasource
     // currently the base module is used
     if ($table != '') {
         require_once 'node.class.php';
         $node = new node($table);
         // experimental optimized node class support :
         /*
         require_once('node_cached.class.php');
         $node = new node_cached($table);
         */
         if ($id) {
             $node->setId($id);
         }
         // if a data array is passed, we assign it to the node, and assume it is loaded. This is an optimization
         if ($data) {
             $node->loadByArray($data);
         }
         return $node;
     } else {
         trigger_error('thinkedit::newNode() $table not defined');
         return false;
     }
     return false;
 }
 function submit_register_form($form)
 {
     $notifications = new notifications();
     $node = node::add_new('title', $form['fields']['name']['value'], 1);
     $node->add_field('email', $form['fields']['email']['value']);
     $node->add_field('password', sha1($form['fields']['password']['value']));
     // Create the activation code.
     $activation_code = uniqid() . rand();
     $node->add_field('activation_code', $activation_code);
     // Then send the code to the new user.
     $reg_email = array('from' => '*****@*****.**', 'from_name' => 'Serum Core', 'is_html' => true, 'to' => $form['fields']['email']['value'], 'subject' => 'Activate your Serum Core login', 'message' => 'Activation code: ' . $activation_code);
     $notifications->mail($reg_email);
     header('location:' . base_path() . 'register/2/' . $node->id);
 }
Example #19
0
 /**
  * Moves/renames current node/entry.
  *
  * If $newParent is given this entry/node is moved in LDAP tree to its new
  * position.
  *
  * @example
  *
  *       DN of entry:  cn=John Doe,ou=people,dc=example,dc=com
  * RDN of same entry:  cn=John Doe
  *
  * @throws protocol_exception
  * @param string $newRDN relative DN of current entry
  * @param node $newParent node entry entry is subordinated to on moving, omit to rename locally
  * @param boolean $keepPreviousRDN true to keep previous RDN as "normal" attribute
  * @return node current instance
  */
 public function move($newRDN, node $newParent = null, $keepPreviousRDN = true)
 {
     if ($this->isAdjusting()) {
         throw new protocol_exception('must not move while adjusting entry', $this->link, $this->getDN());
     }
     if ($newParent) {
         $superRDN = $newParent->getDN();
     } else {
         $superRDN = trim(preg_replace('/^[^,]+,/', '', $this->getDN()));
     }
     if (!@ldap_rename($this->link, $this->getDN(), $newRDN, $superRDN, !!$keepPreviousRDN)) {
         throw new protocol_exception('failed to move entry', $this->link, $this->getDN());
     }
     return $this;
 }
 function getParentUntilRoot()
 {
     $this->loadCache();
     if (isset($this->cache['parents_until_root'])) {
         if (is_array($this->cache['parents_until_root'])) {
             global $thinkedit;
             foreach ($this->cache['parents_until_root'] as $parent) {
                 $parents[] = $thinkedit->newNode($this->table, $parent);
             }
             return $parents;
         } else {
             return false;
         }
     } else {
         $parents = parent::getParentUntilRoot();
         if (is_array($parents)) {
             foreach ($parents as $parent) {
                 $this->cache['parents_until_root'][] = $parent->getId();
             }
         } else {
             $this->cache['parents_until_root'] = false;
         }
         $this->saveCache();
         return $parents;
     }
 }
Example #21
0
 public function move($x, $y)
 {
     global $db, $game;
     $this->getModules();
     $this->getResources();
     $this->getLocation();
     $moveCost = $game['factions'][$this->data['faction']]['costs']['move'];
     $distance = ceil(sqrt(pow($this->location['x'] - $x, 2) + pow($this->location['y'] - $y, 2)));
     $moveCostData = $this->checkCost($moveCost, 'move');
     if ($moveCostData['ok']) {
         $node = new node();
         if ($node->get('id', $this->data['id']) == 'done') {
             $sector = grid::getSector($x, $y);
             if ($sector['type'] == 1) {
                 $ok = 1;
                 $db->query('update grid set type="1", id=floor(1+rand()*9) where x="' . $this->location['x'] . '" and y="' . $this->location['y'] . '"');
                 if ($db->affected_rows() == -1) {
                     $ok = 0;
                 }
                 $this->location['x'] = $x;
                 $this->location['y'] = $y;
                 $db->query('update grid set type="2", id="' . $this->data['id'] . '" where x="' . $this->location['x'] . '" and y="' . $this->location['y'] . '"');
                 if ($db->affected_rows() == -1) {
                     $ok = 0;
                 }
                 foreach ($moveCost as $cost) {
                     $this->resources[$cost['resource']]['value'] -= $cost['value'] * $game['users']['cost']['move'];
                     $db->query('update resources set value="' . $this->resources[$cost['resource']]['value'] . '" where node="' . $this->data['id'] . '" and id="' . $cost['resource'] . '"');
                     if ($db->affected_rows() == -1) {
                         $ok = 0;
                     }
                 }
                 if ($ok) {
                     $status = 'done';
                 } else {
                     $status = 'error';
                 }
             } else {
                 $status = 'invalidGridSector';
             }
         } else {
             $status = 'noNode';
         }
     } else {
         $status = 'notEnoughResources';
     }
     return $status;
 }
Example #22
0
             foreach ($node->queue['combat'] as $item) {
                 $cancel = '';
                 if (!$item['stage']) {
                     if ($item['sender'] == $node->data['id']) {
                         $action = 'outgoing';
                         $cancel = '<div class="cell"> | <a class="link" href="combat.php?action=cancel&nodeId=' . $node->data['id'] . '&combatId=' . $item['id'] . '">x</a></div>';
                     } else {
                         $action = 'incoming';
                     }
                 } else {
                     if ($item['sender'] == $node->data['id']) {
                         $action = 'returning';
                     }
                 }
                 $remaining = $item['start'] + $item['duration'] * 60 - time();
                 $otherNode = new node();
                 if ($item['sender'] == $node->data['id']) {
                     $status = $otherNode->get('id', $item['recipient']);
                 } else {
                     $status = $otherNode->get('id', $item['sender']);
                 }
                 if ($status == 'done') {
                     echo '<div><div class="cell">' . $ui[$action] . ' ' . $ui['combat'] . '</div><div class="cell">"' . $otherNode->data['name'] . '"</div><div class="cell"><span id="combat_' . $item['id'] . '">' . implode(':', misc::sToHMS($remaining)) . '</span><script type="text/javascript">timedJump("combat_' . $item['id'] . '", "node.php?action=get&nodeId=' . $node->data['id'] . '");</script></div>' . $cancel . '</div>';
                 }
             }
             echo '</div>';
         }
     }
     break;
 case 'set':
     if (isset($node->data['id'])) {
Example #23
0
include 'core/game.php';
include 'locales/' . $_SESSION[$shortTitle . 'User']['locale'] . '/gl.php';
if (isset($_POST['attackerGroupUnitIds'], $_POST['defenderGroupUnitIds'])) {
    foreach ($_POST as $key => $value) {
        if (!in_array($key, array('attackerGroupUnitIds', 'defenderGroupUnitIds', 'attackerGroups', 'defenderGroups', 'attackerFocus', 'defenderFocus'))) {
            $_POST[$key] = misc::clean($value, 'numeric');
        } else {
            if (!in_array($key, array('attackerFocus', 'defenderFocus'))) {
                $nr = count($_POST[$key]);
                for ($i = 0; $i < $nr; $i++) {
                    $_POST[$key][$i] = misc::clean($_POST[$key][$i], 'numeric');
                }
            } else {
                $_POST[$key] = misc::clean($value);
            }
        }
    }
    $data = array();
    $data['input']['attacker']['focus'] = $_POST['attackerFocus'];
    $data['input']['attacker']['faction'] = $_POST['attackerFaction'];
    foreach ($_POST['attackerGroupUnitIds'] as $key => $unitId) {
        $data['input']['attacker']['groups'][$key] = array('unitId' => $unitId, 'quantity' => $_POST['attackerGroups'][$key]);
    }
    $data['input']['defender']['focus'] = $_POST['defenderFocus'];
    $data['input']['defender']['faction'] = $_POST['defenderFaction'];
    foreach ($_POST['defenderGroupUnitIds'] as $key => $unitId) {
        $data['input']['defender']['groups'][$key] = array('unitId' => $unitId, 'quantity' => $_POST['defenderGroups'][$key]);
    }
    $data = node::doCombat($data);
}
include 'templates/' . $_SESSION[$shortTitle . 'User']['template'] . '/simulator.php';
 function delete()
 {
     $results = parent::delete();
     global $thinkedit;
     $db = $thinkedit->getDb();
     $db->clearCache();
     $this->refreshNodeList();
     return $results;
 }
Example #25
0
 static function subscribe_button($user_id, $node_id)
 {
     if (!$user_id) {
         return '<button type="button" class="btn-whoaverse-paging btn-xs btn-default" onclick="mustLogin();">订阅</button>';
     }
     $relation = node::user_node_relation($user_id, $node_id);
     if ($relation) {
         return '<button type="button" class="btn-whoaverse-paging btn-xs btn-default" onclick="unsubscribe(this,' . $node_id . ');">取消订阅</button>';
     } else {
         return '<button type="button" class="btn-whoaverse-paging btn-xs btn-default" onclick="subscribe(this,' . $node_id . ');">订阅</button>';
     }
 }
Example #26
0
 public static function removeInactive($maxIdleTime)
 {
     global $db;
     $fromWhen = time() - $maxIdleTime * 86400;
     $fromWhen = strftime('%Y-%m-%d %H:%M:%S', $fromWhen);
     $usersResult = $db->query('select id from users where (lastVisit<"' . $fromWhen . '" or level=0) and level<2');
     $pendingCount = $removedCount = 0;
     while ($userRow = db::fetch($usersResult)) {
         $pendingCount++;
         $result = $db->query('select id from nodes where user="******"');
         while ($row = db::fetch($result)) {
             node::remove($row['id']);
         }
         $ok = 1;
         $db->query('delete from activations where user="******"');
         $messagesResult = $db->query('select id from messages where recipient="' . $userRow['id'] . '" or sender="' . $userRow['id'] . '"');
         while ($row = db::fetch($messagesResult)) {
             $db->query('insert into free_ids (id, type) values ("' . $row['id'] . '", "messages")');
             if ($db->affected_rows() == -1) {
                 $ok = 0;
             }
             $db->query('delete from messages where id="' . $row['id'] . '"');
             if ($db->affected_rows() == -1) {
                 $ok = 0;
             }
         }
         $db->query('insert into free_ids (id, type) values ("' . $userRow['id'] . '", "users")');
         if ($db->affected_rows() == -1) {
             $ok = 0;
         }
         $db->query('delete from users where id="' . $userRow['id'] . '"');
         if ($db->affected_rows() == -1) {
             $ok = 0;
         }
         if ($ok) {
             $status = 'done';
         } else {
             $status = 'error';
         }
         if ($ok) {
             $removedCount++;
         }
     }
     return array('found' => $pendingCount, 'removed' => $removedCount);
 }
Example #27
0
include_once 'lib/header.inc.php';
?>
</head>
<body class="skin-blue">
<?php 
include_once 'lib/nav.inc.php';
include_once 'lib/slidebar_left.inc.php';
if (!empty($_POST)) {
    $node_name = $_POST['node_name'];
    $node_type = $_POST['node_type'];
    $node_server = $_POST['node_server'];
    $node_method = $_POST['node_method'];
    $node_info = $_POST['node_info'];
    $node_status = $_POST['node_status'];
    $node_order = $_POST['node_order'];
    $n = new node(0);
    $query = $n->add($node_name, $node_type, $node_server, $node_method, $node_info, $node_status, $node_order);
    if ($query) {
        echo ' <script>alert("添加成功!")</script> ';
        echo " <script>window.location='node.php';</script> ";
    }
}
?>
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="right-side">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            节点列表
            <small>Node List</small>
        </h1>
Example #28
0
             $message = $ui['insufficientData'];
         }
     }
     break;
 case 'add':
     if ($status == 'noAlliance') {
         $nodes = node::getList($_SESSION[$shortTitle . 'User']['id']);
         if ($nodes) {
             $nodeList = '';
             foreach ($nodes as $node) {
                 $nodeList .= '<option value="' . $node->data['id'] . '">' . $node->data['name'] . '</option>';
             }
             if (isset($_POST['nodeId'], $_POST['name'])) {
                 if ($_POST['name'] != '') {
                     $alliance = new alliance();
                     $node = new node();
                     $status = $node->get('id', $_POST['nodeId']);
                     if ($status == 'done') {
                         if ($node->data['user'] == $_SESSION[$shortTitle . 'User']['id']) {
                             $alliance->data['name'] = $_POST['name'];
                             $alliance->data['user'] = $_SESSION[$shortTitle . 'User']['id'];
                             $status = $alliance->add($node->data['id']);
                             if ($status == 'done') {
                                 $status = $alliance->get('name', $_POST['name']);
                                 if ($status == 'done') {
                                     $_SESSION[$shortTitle . 'User']['alliance'] = $alliance->data['id'];
                                 }
                             }
                             $message = $ui[$status];
                         } else {
                             $message = $ui['accessDenied'];
Example #29
0
 if (isset($_POST['name'], $_POST['attackerGroupUnitIds'], $_POST['attackerGroups'])) {
     foreach ($_POST as $key => $value) {
         if (!in_array($key, array('name', 'attackerGroupUnitIds', 'attackerGroups', 'attackerFocus'))) {
             $_POST[$key] = misc::clean($value, 'numeric');
         } else {
             if (!in_array($key, array('name', 'attackerFocus'))) {
                 $nr = count($_POST[$key]);
                 for ($i = 0; $i < $nr; $i++) {
                     $_POST[$key][$i] = misc::clean($_POST[$key][$i], 'numeric');
                 }
             } else {
                 $_POST[$key] = misc::clean($value);
             }
         }
     }
     $target = new node();
     if ($target->get('name', $_POST['name']) == 'done') {
         $targetUser = new user();
         if ($targetUser->get('id', $target->data['user']) == 'done') {
             $alliance = new alliance();
             $targetAlliance = new alliance();
             if ($targetAlliance->get('id', $targetUser->data['alliance']) == 'done' && $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']) == 'done') {
                 $war = $alliance->getWar($targetAlliance->data['id']);
                 if (isset($war['type'])) {
                     $gotStatic = false;
                     $data = array();
                     $data['input']['attacker']['focus'] = $_POST['attackerFocus'];
                     $data['input']['attacker']['faction'] = $node->data['faction'];
                     foreach ($_POST['attackerGroupUnitIds'] as $key => $unitId) {
                         $data['input']['attacker']['groups'][$key] = array('unitId' => $unitId, 'quantity' => $_POST['attackerGroups'][$key]);
                         if (!$game['units'][$node->data['faction']][$unitId]['speed']) {
Example #30
0
<?php

//引入配置文件
require_once 'user_check.php';
include_once 'lib/header.inc.php';
$id = $_GET['id'];
$n = new node($id);
$query = $n->del();
echo ' <script>alert("删除成功!")</script> ';
echo " <script>window.location='node.php';</script> ";