示例#1
0
/**
 * Scripts that can move submission files from the database to the filesystem and back
 */
function move($entity, $submission_path)
{
    copy_submissions_for_entity($entity, $submission_path . $entity->path());
    foreach ($entity->children() as $child) {
        move($child, $submission_path);
    }
}
示例#2
0
function uploaddelete($fd_cat_id)
{
    $db = new DB_test();
    move($fd_cat_id);
    //调用回收旧数据函数
    $query = "delete  from tb_upload_category_list where fd_cat_id='{$fd_cat_id}'";
    $db->query($query);
}
示例#3
0
function hanoi($n, $from, $transfrom, $to, &$path)
{
    if ($n == 1) {
        move(1, $from, $to, $path);
    } else {
        hanoi($n - 1, $from, $to, $transfrom, $path);
        move($n, $from, $to, $path);
        hanoi($n - 1, $transfrom, $from, $to, $path);
    }
}
function removeFilepath($id)
{
    $dbfile = new DB_file();
    move($id);
    //调用回收旧数据函数
    $query = "delete from  tb_category_list where fd_cat_id='{$id}'";
    $dbfile->query($query);
    //把旧图片移走
    $returnvalue = "success";
    return $returnvalue;
}
示例#5
0
文件: Hanoi.php 项目: test1960/work
function move($n, $a, $b, $c)
{
    if ($n == 1) {
        echo $a . ' -> ' . $c . ' <br/>';
    } else {
        move($n - 1, $a, $c, $b);
        //第n-1个要从a通过c移动到b
        echo $a . ' -> ' . $c . ' <br/>';
        move($n - 1, $b, $a, $c);
        //n-1个移动过来之后b变开始盘,b通过a移动到c,这边很难理解
    }
}
function build_status_tree(&$status_tree, $actions, &$begin_index, &$finish)
{
    $begin = $begin_index;
    $end = count($status_tree);
    $begin_index = count($status_tree);
    for ($i = $begin; $i < $end; $i++) {
        if ($status_tree[$i]['end']) {
            continue;
        }
        move($status_tree, $i, $actions);
    }
    if (count($status_tree) == $end) {
        $finish = true;
    }
}
示例#7
0
function move2($old, $new, $table2, $column, $safe)
{
    global $mysqli;
    move($old, $safe, $table2, $column);
    $stmt = $mysqli->prepare("UPDATE {$table2} SET {$column} = {$column} + 1 WHERE {$column} >= ? AND {$column} < ?");
    if (!$stmt) {
        echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
    }
    sql_exec($stmt, ["ii", $new, $old]);
    $stmt = $mysqli->prepare("UPDATE {$table2} SET {$column} = ? WHERE {$column} = ?");
    if (!$stmt) {
        echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
    }
    sql_exec($stmt, ["ii", $new, $safe]);
    $stmt->close();
}
示例#8
0
function generateSimulationArray($dimension, $startNrC, $startNrH, $startNrP)
{
    $_SESSION["dimension"] = $dimension;
    $simulationArray = array();
    $simulationday = generateDay0($startNrC, $startNrH, $startNrP);
    $simulationArray[] = $simulationday;
    do {
        $simulationeaten = eat($simulationday);
        $simulationloved = love($simulationeaten);
        $simulationfaught = fight($simulationloved);
        $simulationmoved = move($simulationfaught);
        $simulationspawned = spawnOnePlant($simulationmoved);
        $simulationday = $simulationspawned;
        $simulationArray[] = $simulationday;
    } while (count($simulationday) - count(array_keys($simulationday, null)) < $dimension ** 2);
    return $simulationArray;
}
示例#9
0
function travel($endX, $endY, $limit)
{
    global $map, $currentX, $currentY;
    $map[$currentX][$currentY] = 0;
    $move = 1;
    while ($move <= $limit) {
        move($move);
        if ($currentX == $endX && $currentY == $endY) {
            echo "Congratulation!<br />";
            break;
        } else {
            if ($move == $limit) {
                echo "Sorry, not found!<br />";
            }
        }
        $move++;
    }
}
 public function simulate()
 {
     $_SESSION["dimension"] = $_POST["dimension"];
     $_SESSION["startNrPlants"] = $_POST["startNrPlants"];
     $_SESSION["startNrCarnivores"] = $_POST["startNrCarnivore"];
     $_SESSION["startNrHerbivores"] = $_POST["startNrHerbivore"];
     if ($_SESSION["startNrPlants"] + $_SESSION["startNrCarnivores"] + $_SESSION["startNrHerbivores"] > $_SESSION["dimension"] ** 2) {
         header('location:index_tmp.php?toocrowded=true');
         exit(0);
     }
     $day = 0;
     do {
         for ($i = 0; $i < $_SESSION["dimension"] ** 2; $i++) {
             $_SESSION["action"][] = false;
         }
         if ($day == 0) {
             $simulation[$day] = generateDay0();
             $simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
             for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
                 for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
                     if ($simMatrix[$day][$i][$j]) {
                         $_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
                     }
                 }
             }
         }
         $day++;
         $simulation[$day] = $simulation[$day - 1];
         $simulation[$day] = eat($simulation[$day]);
         $simulation[$day] = love($simulation[$day]);
         $simulation[$day] = fight($simulation[$day]);
         $simulation[$day] = move($simulation[$day]);
         $simulation[$day] = spawnOnePlant($simulation[$day]);
         $simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
         for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
             for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
                 if ($simMatrix[$day][$i][$j]) {
                     $_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
                 }
             }
         }
     } while (count($simulation[$day]) - count(array_keys($simulation[$day], null)) < $_SESSION["dimension"] ** 2);
     return $simMatrix;
 }
示例#11
0
function Noidedit($fd_cat_id, $filename, $display = 0, $picurl = 0, $thumurl = 0)
{
    $db = new DB_test();
    if ($picurl) {
        move($dateid, $scatid);
        //调用回收旧数据函数
        //删除图片
        $query = "select *from tb_category_list where fd_cat_dateid='{$dateid}' and fd_cat_scatid='{$scatid}'";
        $db->query($query);
        $db->next_record();
        $url = $db->f(fd_cat_url);
        $thumrul = $db->f(fd_cat_thumurl);
        @unlink($url);
        @unlink($thumrul);
        //更新信息
        $query = "update tb_category_list set fd_cat_name='{$filename}',\n\t\t\tfd_cat_display='{$display}',fd_cat_url='{$picurl}',fd_cat_time=now(),fd_cat_thumurl='{$thumurl}'\n\t\t\twhere fd_cat_id='{$fd_cat_id}'";
    } else {
        $query = "update tb_category_list set fd_cat_name='{$filename}',\n\t\t\tfd_cat_display='{$display}',fd_cat_time=now()\n\t\t\twhere fd_cat_id='{$fd_cat_id}'";
    }
    $db->query($query);
}
示例#12
0
function partTwo($input)
{
    $coords = [0, 0];
    $roboCoords = [0, 0];
    $history = [];
    $history[CK] = 0;
    $history = updateHistory($coords, $history);
    $inputArray = str_split($input);
    $santasMove = true;
    foreach ($inputArray as $direction) {
        if ($santasMove) {
            $coords = move($direction, $coords);
            $history = updateHistory($coords, $history);
            $santasMove = false;
        } else {
            $roboCoords = move($direction, $roboCoords);
            $history = updateHistory($roboCoords, $history);
            $santasMove = true;
        }
    }
    return $history[CK];
}
示例#13
0
 }
 if (api_is_coach()) {
     if (!DocumentManager::is_visible_by_id($_POST['move_file'], $courseInfo, $sessionId, api_get_user_id())) {
         api_not_allowed(true);
     }
 }
 // Get the document data from the ID
 $document_to_move = DocumentManager::get_document_data_by_id($_POST['move_file'], api_get_course_id(), false, $sessionId);
 // Security fix: make sure they can't move files that are not in the document table
 if (!empty($document_to_move)) {
     $real_path_target = $base_work_dir . $moveTo . '/' . basename($document_to_move['path']);
     $fileExist = false;
     if (file_exists($real_path_target)) {
         $fileExist = true;
     }
     if (move($base_work_dir . $document_to_move['path'], $base_work_dir . $moveTo)) {
         update_db_info('update', $document_to_move['path'], $moveTo . '/' . basename($document_to_move['path']));
         //update database item property
         $doc_id = $_POST['move_file'];
         if (is_dir($real_path_target)) {
             api_item_property_update($courseInfo, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $groupId, null, null, null, $sessionId);
             Display::addFlash(Display::return_message(get_lang('DirMv'), 'confirmation'));
         } elseif (is_file($real_path_target)) {
             api_item_property_update($courseInfo, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $groupId, null, null, null, $sessionId);
             Display::addFlash(Display::return_message(get_lang('DocMv'), 'confirmation'));
         }
         // Set the current path
         $curdirpath = $_POST['move_to'];
         $curdirpathurl = urlencode($_POST['move_to']);
     } else {
         if ($fileExist) {
示例#14
0
     post($con, $token, $bid, $ip, $attachs);
 } else {
     if ($ask == "reply") {
         reply($con, $token, $bid, $tid, $ip, $attachs);
     } else {
         if ($ask == "edit") {
             edit($con, $token, $bid, $tid, $pid, $ip, $attachs);
         } else {
             if ($ask == "lock" || $ask == "extr" || $ask == "top") {
                 threads_action($con, $token, $bid, $tid, $ask);
             } else {
                 if ($ask == "delete") {
                     delete($con, $token, $bid, $tid, $pid, $ip);
                 } else {
                     if ($ask == "move") {
                         move($con, $token, $bid, $tid, $to);
                     } else {
                         if ($ask == "lzl") {
                             lzl($con, @$_REQUEST['method'], $fid, $token, $ip);
                         } else {
                             if ($ask == "getpages") {
                                 getpages($con, $bid, $tid);
                             } else {
                                 if ($ask == "getlznum") {
                                     getlznum($con, $bid, $tid);
                                 } else {
                                     if ($ask == "getnum") {
                                         getnum($con);
                                     } else {
                                         if ($ask == "sign_today") {
                                             sign_today($con);
示例#15
0
        cr();
        break;
    case "create":
        create($_REQUEST['nfname'], $_REQUEST['isfolder'], $_REQUEST['ndir']);
        break;
    case "ren":
        ren($_REQUEST['file']);
        break;
    case "rename":
        renam($_REQUEST['rename'], $_REQUEST['nrename'], $folder);
        break;
    case "mov":
        mov($_REQUEST['file']);
        break;
    case "move":
        move($_REQUEST['file'], $_REQUEST['ndir'], $folder);
        break;
    case "printerror":
        printerror($error);
        break;
    case "logout":
        logout();
        break;
    default:
        home();
        break;
}
/****************************************************************/
/* 								MISCELLANEAUS                        */
/*                                                              */
/****************************************************************/
示例#16
0
                    //print "$message\n";
                    break;
            }
            //  send out the message to each number
            //  find out if one or more phone numbers
            $numbers = explode(",", $phonenumbers);
            if (count($numbers) > 1) {
                // more than one number
                foreach ($numbers as $key => $value) {
                    $reply = `echo '{$message}'|{$gnokii} --sendsms {$value}`;
                    move($file, $outfolder, $sentfolder);
                }
            } else {
                // single number
                $reply = `echo '{$message}'|{$gnokii} --sendsms {$phonenumbers}`;
                move($file, $outfolder, $sentfolder);
            }
        }
    }
}
closedir($handle);
sleep(1);
`killall -9 gnokii 1>/dev/null 2>/dev/null`;
$target = "{$sentfolder}/*";
`chown -R herman:apache {$target}`;
//
//      FETCH MESSAGES FROM PHONE
//
//      loop through 14 messages
//
for ($i = 1; $i < 15; $i++) {
        $simulation[$day] = generateDay0();
        $simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
        for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
            for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
                if ($simMatrix[$day][$i][$j]) {
                    $_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
                }
            }
        }
    }
    $day++;
    $simulation[$day] = $simulation[$day - 1];
    $simulation[$day] = eat($simulation[$day]);
    $simulation[$day] = love($simulation[$day]);
    $simulation[$day] = fight($simulation[$day]);
    $simulation[$day] = move($simulation[$day]);
    $simulation[$day] = spawnOnePlant($simulation[$day]);
    $simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
    for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
        for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
            if ($simMatrix[$day][$i][$j]) {
                $_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
            }
        }
    }
} while (count($simulation[$day]) - count(array_keys($simulation[$day], null)) < $_SESSION["dimension"] ** 2);
include 'presentation_temp.php';
?>
<!--<!DOCTYPE html>
<html>
    <head>
示例#18
0
    }
}
$route = "^^<<v<<v><v^^<><>^^<v<v^>>^^^><^>v^>v><><><<vv^^<^>^^<v^>v>v^v>>>^<>v<^<v^><^>>>>><<v>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^<^>v<>v^>v>^^<<<^^vv^<><<<>>v>^^<>v>>>><v<v<^^^v<v<v^><<>v^v<>v>><<<<v^<><^<<^>^<vvv<v^^v>>v^vv^><^v^^<>^^><<v^>>vv>^<v^vv<^^v<>>vvv<^v^>>^<v<v>>^>^^<<^>^>^v><>>^<^^v>^>>^^<><>>>^^>^^vvv>v<^^<>v^v^^<v<<^<v^v^<<>v^v<v<<v<>>><<^^^>>v>^vv>^>^^v<>^^<>v^^<><v<v<vvv^<vv<<>v^><<><v<>vv<<^vvvv><<<v>v>v^>v^<>v^>^<v<vvv^>^<>^>^^v<>><<<><v<^^>^v<v>^^v^v<<<^v^<>^<>v>^^>v<v<v>v>^^<<<><<^>v<v<^vv^v><^^<<vv>^<<v><>^>>>>><v^v<<<^>^v^v<<v<>vvv<<>v>v>>^v^v^>><<<<>v^<v<><<>>>^>>^>><<v>";
$route = str_split($route);
$houses = [new Delivery(0, 0)];
$santaHouse = $houses[0];
$roboHouse = $houses[0];
$santa = true;
foreach ($route as $step) {
    $visited = false;
    if ($santa) {
        $pHouse = $santaHouse;
    } else {
        $pHouse = $roboHouse;
    }
    $house = move($step, $pHouse->getX(), $pHouse->getY());
    foreach ($houses as $hasBeen) {
        if ($hasBeen->getX() == $house->getX() && $hasBeen->getY() == $house->getY()) {
            $visited = true;
        }
    }
    if (!$visited) {
        array_push($houses, $house);
    }
    if ($santa) {
        $santaHouse = $house;
        $santa = false;
    } else {
        $roboHouse = $house;
        $santa = true;
    }
示例#19
0
文件: world.php 项目: hrosalgado/TFG
/**
 * It manages the actions which an element can do
 *
 * @return array|void It depends on the type of action to do
 */
function actionManager(...$args)
{
    switch ($args[1]) {
        case 'see':
            if (canAct($args[0], $args[1])) {
                $see = see($args[0]);
                useAction($args[0], 'see');
                return $see;
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t see, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'see', ''));
            }
            break;
        case 'move':
            if (canAct($args[0], $args[1])) {
                move($args[0], $args[2]);
                useAction($args[0], 'move');
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t move, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'move', ''));
            }
            break;
        case 'sleep':
            if (canAct($args[0], $args[1])) {
                toSleep($args[0]);
                useAction($args[0], 'sleep');
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t sleep, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'sleep', ''));
            }
            break;
        case 'smell':
            if (canAct($args[0], $args[1])) {
                $smell = smell($args[0]);
                useAction($args[0], 'smell');
                return $smell;
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t smell, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'smell', ''));
            }
            break;
        case 'hear':
            if (canAct($args[0], $args[1])) {
                $hear = hear($args[0]);
                useAction($args[0], 'hear');
                return $hear;
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t hear, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'hear', ''));
            }
            break;
        case 'breed':
            if (canAct($args[0], $args[1])) {
                breed($args[0]);
                useAction($args[0], 'breed');
            } else {
                writeFileCSV('Log', array(getTime(), 'It can\'t breed, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'breed', ''));
            }
            break;
    }
}
示例#20
0
 /* -------------------------------------
    MOVE FILE OR DIRECTORY : STEP 2
    -------------------------------------- */
 if (isset($_POST['moveTo'])) {
     $moveTo = $_POST['moveTo'];
     $source = $_POST['source'];
     $sourceXml = $source . '.xml';
     //check if source and destination are the same
     if ($basedir . $source != $basedir . $moveTo or $basedir . $source != $basedir . $moveTo) {
         $r = Database::get()->querySingle("SELECT filename, extra_path FROM document WHERE {$group_sql} AND path=?s", $source);
         $filename = $r->filename;
         $extra_path = $r->extra_path;
         if (empty($extra_path)) {
             if (move($basedir . $source, $basedir . $moveTo)) {
                 if (hasMetaData($source, $basedir, $group_sql)) {
                     move($basedir . $sourceXml, $basedir . $moveTo);
                 }
                 update_db_info('document', 'update', $source, $filename, $moveTo . '/' . my_basename($source));
             }
         } else {
             update_db_info('document', 'update', $source, $filename, $moveTo . '/' . my_basename($source));
         }
         $action_message = "<div class='alert alert-success'>{$langDirMv}</div><br>";
     } else {
         $action_message = "<div class='alert alert-danger'>{$langImpossible}</div><br>";
         /*             * * return to step 1 ** */
         $move = $source;
         unset($moveTo);
     }
 }
 /* -------------------------------------
 function write()
 {
     if (PluginAccesslog::is_admin(NULL, PLUGIN_ACCESSLOG_USE_SESSION, PLUGIN_ACCESSLOG_THROUGH_IF_ADMIN)) {
         return;
     }
     global $vars, $defaultpage;
     $page = isset($vars['refer']) ? $vars['refer'] : (isset($vars['page']) ? $vars['page'] : $defaultpage);
     $cmd = isset($vars['cmd']) ? $vars['cmd'] : (isset($vars['plugin']) ? $vars['plugin'] : '');
     // logdata format
     $logdata = array();
     $logdata['time'] = strftime('%y/%m/%d %H:%M:%S');
     $logdata['ip'] = $_SERVER['REMOTE_ADDR'];
     $logdata['host'] = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : gethostbyaddr($_SERVER['REMOTE_ADDR']);
     $logdata['referer'] = $_SERVER['HTTP_REFERER'];
     $logdata['agent'] = $_SERVER['HTTP_USER_AGENT'];
     $logdata['page'] = $page;
     $logdata['cmd'] = $cmd;
     $line = serialize($logdata) . "\n";
     if (ereg(PLUGIN_ACCESSLOG_EXCEPT_AGENT, $logdata['agent'])) {
         return TRUE;
     }
     if (ereg(PLUGIN_ACCESSLOG_EXCEPT_HOST, $logdata['host'])) {
         return TRUE;
     }
     $date = date('Ymd', time());
     // use localtime simply because time handling ways in pukiwiki plus! and official are different.
     if (file_exists(PLUGIN_ACCESSLOG_FILENAME)) {
         $logdate = rtrim(array_shift(file_head(PLUGIN_ACCESSLOG_FILENAME, 1)));
         if ($logdate != $date) {
             slide_rename(PLUGIN_ACCESSLOG_FILENAME, PLUGIN_ACCESSLOG_KEEPLOG_DAYS, '.%d');
             @move(PLUGIN_ACCESSLOG_FILENAME, PLUGIN_ACCESSLOG_FILENAME . '.1');
             file_put_contents(PLUGIN_ACCESSLOG_FILENAME, $date . "\n");
         }
     } else {
         file_put_contents(PLUGIN_ACCESSLOG_FILENAME, $date . "\n");
     }
     return file_put_contents(PLUGIN_ACCESSLOG_FILENAME, $line, FILE_APPEND);
 }
示例#22
0
 public function addnew($data, $upload = true)
 {
     // dd($data);
     extract($data);
     $pathname = $upload == true ? getFileName('file') : 'default.txt';
     $query = $this->db->prepare('INSERT INTO `surveys` (filename,pathname,sector_id) VALUES (:filename,:pathname,:sector)');
     $query->bindParam(':filename', $filename, PDO::PARAM_STR);
     $query->bindParam(':pathname', $pathname, PDO::PARAM_STR);
     $query->bindParam(':sector', $sector, PDO::PARAM_STR);
     $query->execute();
     getError($query);
     // dd(config('storage_path'));
     if (hasFile('file')) {
         move(config('storage_path_survey'), 'file');
     }
 }
function move($i)
{
    global $genarray, $size, $direction;
    if ($direction == 0) {
        // if vertical
        /***************Обзор родителя******************/
        $par = $genarray[$i]["par"];
        $tempx = $genarray[$i]["x"];
        $genarray[$i]["x"] = ($genarray[$i]["fst"] + $genarray[$i]["lst"]) / 2;
        //Устанавливаем координату родителя как середину между первым и последним ребёнком.
        if ($genarray[$i]["gen"] != 0) {
            $q = $i;
            if ($genarray[$q]["chd"] == 1) {
                //Если человек - первый ребёнок в семье, записываем его координату в поле fst его родителя.
                $genarray[$par]["fst"] = $genarray[$q]["x"];
            }
            if ($genarray[$q]["chd"] == $genarray[$par]["nrc"]) {
                //Если человек - последний ребёнок в семье.
                while ($genarray[$q]["2nd"] == 1) {
                    //Находим последнего (кровного) человека и записываем его координату в поле lst родителя.
                    $q--;
                }
                $genarray[$par]["lst"] = $genarray[$q]["x"];
            }
        }
        $distance = $genarray[$i]["x"] - $tempx;
        //Разница между новой и старой координатой
        /***********************************************/
        /********Обзор семьи человека******************/
        $n = $i + 1;
        //Индекс следующего человека
        while ($genarray[$n]["gen"] == $genarray[$n - 1]["gen"]) {
            //Обзор семьи
            //Если есть дети - устанавливаем координату по середине.
            if (isset($genarray[$n]["fst"]) and isset($genarray[$n]["lst"])) {
                $tempx = $genarray[$n]["x"];
                $genarray[$n]["x"] = ($genarray[$n]["fst"] + $genarray[$n]["lst"]) / 2;
                $distance = $genarray[$n]["x"] - $tempx;
            } else {
                //Иначе, добавляем предыдующую разницу
                $genarray[$n]["x"] += $distance;
            }
            if ($genarray[$n]["gen"] != 0) {
                $c = $n;
                $par = $genarray[$c]["par"];
                //Если человек - первый ребёнок в семье, записываем его координату в поле fst его родителя.
                if ($genarray[$c]["chd"] == 1) {
                    $genarray[$par]["fst"] = $genarray[$c]["x"];
                }
                //Если человек - последний ребёнок в семье,
                //находим последнего (кровного) человека и записываем его координату в поле lst родителя.
                if ($genarray[$c]["chd"] == $genarray[$par]["nrc"]) {
                    while ($genarray[$c]["2nd"] == 1) {
                        // $c++;
                        $c--;
                    }
                    $genarray[$par]["lst"] = $genarray[$c]["x"];
                }
            }
            $n++;
        }
        /***********************************************/
        //Перемещаем родителя
        if ($genarray[$i]["gen"] > 0) {
            $par = $genarray[$i]["par"];
            move($par);
            //РЕКУРСИЯ
        }
    } else {
        // if horizontal
        $par = $genarray[$i]["par"];
        $tempx = $genarray[$i]["y"];
        $genarray[$i]["y"] = ($genarray[$i]["fst"] + $genarray[$i]["lst"]) / 2;
        if ($genarray[$i]["gen"] != 0) {
            $q = $i;
            if ($genarray[$q]["chd"] == 1) {
                $genarray[$par]["fst"] = $genarray[$q]["y"];
            }
            if ($genarray[$q]["chd"] == $genarray[$par]["nrc"]) {
                while ($genarray[$q]["2nd"] == 1) {
                    $q--;
                }
                $genarray[$par]["lst"] = $genarray[$q]["y"];
            }
        }
        $distance = $genarray[$i]["y"] - $tempx;
        $n = $i + 1;
        while ($genarray[$n]["gen"] == $genarray[$n - 1]["gen"]) {
            if (isset($genarray[$n]["fst"]) and isset($genarray[$n]["lst"])) {
                $tempx = $genarray[$n]["y"];
                $genarray[$n]["y"] = ($genarray[$n]["fst"] + $genarray[$n]["lst"]) / 2;
                $distance = $genarray[$n]["y"] - $tempx;
            } else {
                $genarray[$n]["y"] += $distance;
            }
            if ($genarray[$n]["gen"] != 0) {
                $c = $n;
                $par = $genarray[$c]["par"];
                if ($genarray[$c]["chd"] == 1) {
                    $genarray[$par]["fst"] = $genarray[$c]["y"];
                }
                if ($genarray[$c]["chd"] == $genarray[$par]["nrc"]) {
                    while ($genarray[$c]["2nd"] == 1) {
                        $c--;
                    }
                    $genarray[$par]["lst"] = $genarray[$c]["y"];
                }
            }
            $n++;
        }
        if ($genarray[$i]["gen"] > 0) {
            $par = $genarray[$i]["par"];
            move($par);
        }
    }
    // end if horizontal
}
示例#24
0
<?php

session_start();
// included files
include "../../../connection/phpmysqlconnect.php";
include "../../../library/CRUD_lib.php";
include "../../../library/miss_lib.php";
// post data
$modifier = $_SESSION["user"];
// insertion
$column = array('user_id');
$value = array("{$modifier}");
$insert = new crud($conn, 'form_16_download', $column, $value);
$insert->insert();
$sql = 'SELECT * FROM `form_16` WHERE `form_id`= ?';
$query = $conn->prepare($sql);
$query->execute(array('1'));
$row = $query->fetch();
$file_name = $row['form_16'];
move('../../media/' . $file_name);
 /**
  * Copies images into another gallery
  * @param array $images
  * @param int|object $gallery
  * @param boolean $db optionally only copy the image files
  * @param boolean $move move the image instead of copying
  */
 function copy_images($images, $gallery, $db = TRUE, $move = FALSE)
 {
     $retval = FALSE;
     // Ensure we have a valid gallery
     if ($gallery = $this->object->_get_gallery_id($gallery)) {
         $gallery_path = $this->object->get_gallery_abspath($gallery);
         $image_key = $this->object->_image_mapper->get_primary_key_column();
         $retval = TRUE;
         // Iterate through each image to copy...
         foreach ($images as $image) {
             // Copy each image size
             foreach ($this->object->get_image_sizes() as $size) {
                 $image_path = $this->object->get_image_abspath($image, $size);
                 $dst = path_join($gallery_path, basename($image_path));
                 $success = $move ? move($image_path, $dst) : copy($image_path, $dst);
                 if (!$success) {
                     $retval = FALSE;
                 }
             }
             // Copy the db entry
             if ($db) {
                 if (is_numeric($image)) {
                     $this->object->_image_mapper($image);
                 }
                 unset($image->{$image_key});
                 $image->galleryid = $gallery;
             }
         }
     }
     return $retval;
 }
示例#26
0
        move('move_dn');
    } else {
        echo $br;
    }
    echo '</td><td><img src="http://' . img_domain . '/nav/x.gif" width="32" height="16" border="0"><br>';
    if ($map_now['move_ur'] != 'N') {
        $x = $xpos + 1;
        $y = $ynew;
        move('move_ur');
    } else {
        echo $br;
    }
    if ($map_now['move_dr'] != 'N') {
        $x = $xpos + 1;
        $y = $ynew + 1;
        move('move_dr');
    } else {
        echo $br;
    }
    echo '<img src="http://' . img_domain . '/nav/x.gif" width="32" height="16" border="0"><br></td>
<td background="http://' . img_domain . '/nav/quote_rt.gif"><img src="http://' . img_domain . '/nav/x.gif" width="1" height="1" border="0"></td>
</tr><tr><td><img src="http://' . img_domain . '/nav/quote_dl.gif" width="15" height="7" border="0" alt=""></td>
<td background="http://' . img_domain . '/nav/quote_bt.gif" colspan="3"><img src="http://' . img_domain . '/nav/x.gif" width="1" height="1" border="0"></td>
<td><img src="http://' . img_domain . '/nav/quote_dr.gif" width="15" height="7" border="0" alt=""></td>
</tr></table><br>

<center>Карта: <b>' . $map_name . '</b><br>Позиция <font color="#ff0000"> ' . $xpos . ' </font>, <font color="#ff0000">' . $ypos . '</font>';
}
if (function_exists("save_debug")) {
    save_debug();
}
示例#27
0
             $content = generateMoveForm($item_id, $curdirpath, $course_info, $group_id, $session_id);
         }
     }
     break;
 case 'move_to':
     /* Move file command */
     if ($is_allowed_to_edit) {
         $move_to_path = get_work_path($_REQUEST['move_to_id']);
         if ($move_to_path == -1) {
             $move_to_path = '/';
         } elseif (substr($move_to_path, -1, 1) != '/') {
             $move_to_path = $move_to_path . '/';
         }
         // Security fix: make sure they can't move files that are not in the document table
         if ($path = get_work_path($item_id)) {
             if (move($course_dir . '/' . $path, $base_work_dir . $move_to_path)) {
                 // Update db
                 updateWorkUrl($item_id, 'work' . $move_to_path, $_REQUEST['move_to_id']);
                 api_item_property_update($_course, 'work', $_REQUEST['move_to_id'], 'FolderUpdated', $user_id);
                 $message = Display::return_message(get_lang('DirMv'), 'success');
             } else {
                 $message = Display::return_message(get_lang('Impossible'), 'error');
             }
         } else {
             $message = Display::return_message(get_lang('Impossible'), 'error');
         }
         Display::addFlash($message);
         header('Location: ' . $currentUrl);
         exit;
     }
     break;
示例#28
0
}
if (isset($HTTP_POST_VARS['topic_check_status']) || isset($HTTP_GET_VARS['topic_check_status'])) {
    if (!$is_auth['auth_mod']) {
        message_die(GENERAL_ERROR, 'You are not a moderator in this forum.');
    }
    $topic_check_status = isset($HTTP_POST_VARS['topic_check_status']) ? $HTTP_POST_VARS['topic_check_status'] : $HTTP_GET_VARS['topic_check_status'];
    if ($topic_check_status > 0 && $tor_data['topic_check_status'] != $topic_check_status) {
        $sql = "UPDATE " . BT_TORRENTS_TABLE . " SET topic_check_status={$topic_check_status}, topic_check_uid={$user_id}, topic_check_date={$current_time} WHERE topic_id={$tor_data['topic_id']}";
        if (!($result = DB()->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not . . .', '', __LINE__, __FILE__, $sql);
        }
        switch ($topic_check_status) {
            case 2:
                if ($tor_data['topic_check_first_fid']) {
                    require_once FT_ROOT . 'includes/function_topics_move.php';
                    move($forum_id, $tor_data['topic_check_first_fid'], 2, null, $tor_data['topic_id']);
                    sync('forum', $tor_data['topic_check_first_fid']);
                    sync('forum', $forum_id);
                }
                break;
            case 3:
                $user_from_id = $user_id;
                $user_to_id = $tor_data['poster_id'];
                $pm_subject = 'Уведомление о недооформленном релизе.';
                $willmove = $tor_data['move_enable'] ? ' в течение суток, иначе тема будет перенесена в форум неоформленных релизов' : '';
                $pm_message = 'Привет, ' . $tor_data['poster_name'] . '. \\n\\n' . 'Ваша тема: ' . '[url=' . FT_ROOT . '/viewtopic.php?t=' . $tor_data['topic_id'] . ']' . $tor_data['topic_title'] . '[/url]' . ' создана с нарушением правил оформления релизов форума: ' . '[url=' . FT_ROOT . '/viewforum.php?f=' . $tor_data['forum_id'] . ']' . $tor_data['forum_name'] . '[/url]' . ' в связи с этим вам следует исправить недочеты и нажать кнопку "я исправил"' . $willmove . '. Если у вас возникнут вопросы, вы можете отправить мне личное сообщение.';
                send_pm($user_from_id, $user_to_id, $pm_subject, $pm_message);
                break;
            case 4:
                if ($tor_data['move_enable'] && empty($tor_data['topic_check_first_fid'])) {
                    require_once FT_ROOT . 'includes/function_topics_move.php';
示例#29
0
     sell();
 } elseif ($do[0] == "maps") {
     include 'towns.php';
     maps();
 } elseif ($do[0] == "maps2") {
     include 'towns.php';
     maps2($do[1]);
 } elseif ($do[0] == "maps3") {
     include 'towns.php';
     maps3($do[1]);
 } elseif ($do[0] == "gotown") {
     include 'towns.php';
     travelto($do[1]);
 } elseif ($do[0] == "move") {
     include 'explore.php';
     move();
 } elseif ($do[0] == "fight") {
     include 'fight.php';
     fight();
 } elseif ($do[0] == "victory") {
     include 'fight.php';
     victory();
 } elseif ($do[0] == "drop") {
     include 'fight.php';
     drop();
 } elseif ($do[0] == "dead") {
     include 'fight.php';
     dead();
 } elseif ($do[0] == "duelo") {
     include 'duelo.php';
     duelo();
示例#30
0
<?php

require_once "../MysqlJiaguwen.php";
//print_r($_REQUEST);
$srcfile = $_REQUEST["srcfile"];
$imgfile = basename($srcfile);
$destfile = "/tmp/" . $imgfile;
$ret = move($srcfile, $destfile);
echo "ret=" . $ret;