public function handle() { global $ID; global $INPUT; if ($INPUT->has('New')) { $name = $INPUT->str('New'); if (!$name) { return 'manage_files'; } $ID = cleanID(getNS($ID) . ':' . $name); } $path = wikiFN($ID); if (file_exists($path)) { return 'show'; } global $TEXT; $type = strtolower($INPUT->str('type')); switch ($type) { case 'generated': $TEXT = '<generated-file>' . DOKU_LF . '</generated-file>'; break; case 'source': $TEXT = '<source-file>' . DOKU_LF . '</source-file>'; break; case 'project': $ID .= ':'; return 'show'; default: return 'edit'; } saveWikiText($ID, $TEXT, "Created"); unlock($ID); global $INFO; $INFO['exists'] = true; return "show"; }
function sig_handler($signo) { global $check_file; switch ($signo) { case SIGTERM: case SIGINT: unlock(); exit; } }
function ses() { echo 'Start Notification' . PHP_EOL; $this->load->library('lib_feedback'); if (is_running() === FALSE) { lock(); while (TRUE) { if (is_null($this->lib_feedback->process_notification())) { show_error($this->lib_feedback->get_error_message()); } } unlock(); } }
public function doAction($id, $new_page_id = null) { $this->checkPage($id); $this->saveActivity('delete', $id, $new_page_id, !empty($new_page_id) ? true : false, 'new'); lock($id); $this->cleanPage($id); $this->cleanAttic($id); $this->cleanMeta($id); $this->cleanMedia($id); unlock($id); $this->saveActivity('delete', $id, $new_page_id, !empty($new_page_id) ? true : false, 'finished'); if (!empty($new_page_id)) { $this->fixForeignPageLinks($id, $new_page_id); } }
function campaign($count = 99) { echo 'Start Campaign' . PHP_EOL; if (is_running() === FALSE) { lock(); while (TRUE) { $campaign_message = $this->lib_request_scheduled->get_latest_campaign(); if (empty($campaign_message)) { echo 'No task found!' . PHP_EOL; break; } if (is_null($this->lib_request_scheduled->process_campaign($campaign_message, $count))) { show_error($this->lib_request_scheduled->get_error_message()); } } unlock(); } }
function send($count = 9) { echo 'Start send' . PHP_EOL; $this->load->library('lib_archive'); if (is_running() === FALSE) { lock(); while (TRUE) { $messages = $this->lib_archive->get_unsent($count); if (empty($messages)) { echo 'No task found!' . PHP_EOL; break; } if (is_null($this->lib_archive->send($messages))) { show_error($this->lib_archive->get_error_message()); } } unlock(); } }
/** * Start server. */ public function start() { log_console('Starting RPC Server at ' . $this->config['ip'] . ' on port ' . $this->config['port']); $errno = 0; $err = ""; $this->master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // Non block socket type socket_set_option($this->master, SOL_SOCKET, SO_RCVTIMEO, array("sec" => 10, "usec" => 0)); socket_set_option($this->master, SOL_SOCKET, SO_LINGER, array('l_onoff' => 1, 'l_linger' => 0)); socket_set_option($this->master, SOL_SOCKET, SO_REUSEADDR, 1); @socket_bind($this->master, $this->config['ip'], $this->config['port']); while (socket_last_error() === 98) { log_console("Socket terminated but address already in use, wait 2 sec's and try again."); sleep(2); @socket_bind($this->master, $this->config['ip'], $this->config['port']); } $listen = socket_listen($this->master); if ($listen === FALSE) { unlock(); log_console("Can't listen on socket."); exit; } $this->listen(); }
$isValidAddress = $bitcoinController->validateaddress($paymentAddress); if ($isValidAddress) { //Subtract TX fee, donation and site fees $currentBalance = $currentBalance * (1 - $sitepercent / 100) * (1 - $donatepercent / 100) - $txfee; $paid += $currentBalance; //Send money// mysql_query("BEGIN"); try { //Reduce balance amount to zero //echo "UPDATE accountBalance SET balance = '0', paid = '$paid' WHERE userId = $userId\n"; mysql_query("UPDATE accountBalance SET balance = '0', paid = '{$paid}' WHERE userId = {$userId}"); if ($bitcoinController->sendtoaddress($paymentAddress, $currentBalance)) { mysql_query("INSERT INTO payoutHistory (userId, address, amount) VALUES ('" . $resultR->userId . "', '" . $paymentAddress . "', '" . $currentBalance . "')"); mail($resultR->email, "Simplecoin.us Automatic Payout Notification", "Hello,\n\nYour balance of " . $currentBalance . " BTC has exceeded your automatic payment threshold and has been sent to your payment address " . $paymentAddress . ".", "From: Simplecoin.us Notifications <*****@*****.**>"); mysql_query("COMMIT"); } else { mysql_query("ROLLBACK"); echo "Commodity {$currentBalance} failed to send to {$paymentAddress} for userid {$userId}\n"; } } catch (Exception $e) { mysql_query("ROLLBACK"); echo "Commodity {$currentBalance} failed to send to {$paymentAddress} for userid {$userId}\n"; } } } } } catch (Exception $ex) { echo $ex - getMessage(); } unlock("money");
$e_time = time() - $c_time; if ($e_time > 8 * 60) { unlink($lockfile); } else { exit; } } file_put_contents($lockfile, 1, true); try { /*$lock = checkLock(); if($lock){exit;} lock(); */ runProducer(); } catch (Exception $e) { logs('producer run error!'); unlock(); } function runProducer() { $kmlPath = getconfig('kmlPath'); $xml_file = getFileList($kmlPath); $lockfile = '/tmp/producer.lock'; if (empty($xml_file)) { logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty."); unlink($lockfile); exit; } sort($xml_file); $startTime = explode(' ', microtime()); $totalNum = 0; $i = $n = 1;
public function handle() { global $ID; global $INPUT; $this->file = Projects_file::file($ID); $old_text = $INPUT->post->str($this->old_input_name(), ''); $old = $this->split($old_text); $new_text = $INPUT->post->str($this->new_input_name(), ''); $new = $this->split($new_text); $diff = new Diff($old, $new); $now = $this->now(); if ($new == $now) { return "show"; } if ($old != $now) { $check = new Diff($old, $now); $merged = merge3($diff->edits, $check->edits); if ($merged['conflict']) { global $MERGED_DIFF; $MERGED_DIFF = $merged['merged']; return $this->action(); } $diff->edits = $merged['merged']; $new = $diff->closing(); } lock($ID); $text = $this->update($this->merge($new)); if ($text === FALSE) { msg('file has been changed, cannot save!', -1); } else { saveWikiText($ID, $text, ""); } unlock($ID); return "show"; }
/** * Handle 'login', 'logout' * * @author Andreas Gohr <*****@*****.**> * * @param string $act action command * @return string action command */ function act_auth($act) { global $ID; global $INFO; /* @var Input $INPUT */ global $INPUT; //already logged in? if ($INPUT->server->has('REMOTE_USER') && $act == 'login') { return 'show'; } //handle logout if ($act == 'logout') { $lockedby = checklock($ID); //page still locked? if ($lockedby == $INPUT->server->str('REMOTE_USER')) { unlock($ID); //try to unlock } // do the logout stuff auth_logoff(); // rebuild info array $INFO = pageinfo(); act_redirect($ID, 'login'); } return $act; }
*/ //require controller to handle all the work require_once "../src/controller.php"; //define a few regex $pattern = '/^\\/test.(mp3|jpg|mp4)\\/?$/'; $pattern2 = '/^\\/show\\/s\\/test.(mp3|jpg|mp4)\\/?$/'; $pattern3 = '/^\\/show\\/u\\/test.(mp3|jpg|mp4)\\/?$/'; //get request path $path = $_SERVER['REQUEST_URI']; //get request method $method = $_SERVER['REQUEST_METHOD']; //ROUTING LOGIC //route to proper controller function if (preg_match($pattern, $path)) { if ($method == "POST") { unlock($path); } else { if ($method == "GET") { purchase($path); } } } else { if (preg_match($pattern2, $path)) { getScrambledMedia($path); } else { if (preg_match($pattern3, $path)) { getUnscrambledMedia($path); } else { require "index.html"; } }
function clearLock($WIKI_ID) { global $USERNAME; if (!file_exists(wikiFN($WIKI_ID))) { fwrite(STDERR, "{$WIKI_ID} does not yet exist\n"); } $_SERVER['REMOTE_USER'] = $USERNAME; if (checklock($WIKI_ID)) { fwrite(STDERR, "Page {$WIKI_ID} is locked by another user\n"); exit(1); } unlock($WIKI_ID); if (file_exists(wikiLockFN($WIKI_ID))) { fwrite(STDERR, "Unable to clear lock for {$WIKI_ID}\n"); exit(1); } }
function create_dummy($deptid) { db_connect(); # Dummy Vars $cusnum = 0; $salespn = ""; $comm = ""; $salespn = ""; $chrgvat = getSetting("SELAMT_VAT"); $odate = date("Y-m-d"); $ordno = ""; $delchrg = "0.00"; $cordno = ""; $terms = 0; $traddisc = 0; $SUBTOT = 0; $vat = 0; $total = 0; lock(1); # Insert invoice to DB $sql = "INSERT INTO invoices(deptid, cusnum, cordno, ordno, chrgvat, terms, traddisc, salespn, odate, delchrg, subtot, vat, total, balance, comm, username, printed, done, prd, div)"; $sql .= " VALUES('{$deptid}', '{$cusnum}', '{$cordno}', '{$ordno}', '{$chrgvat}', '{$terms}', '{$traddisc}', '{$salespn}', '{$odate}', '{$delchrg}', '{$SUBTOT}', '{$vat}' , '{$total}', '{$total}', '{$comm}', '" . USER_NAME . "', 'n', 'n', '" . PRD_DB . "', '" . USER_DIV . "')"; $rslt = db_exec($sql) or errDie("Unable to insert invoice to Cubit.", SELF); unlock(1); return lastinvid(); }
<?php if(isset($_GET["verbose"])){echo __LINE__." verbose OK<br>\n";$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);} include_once('ressources/class.templates.inc'); include_once('ressources/class.users.menus.inc'); include_once('ressources/class.squid.inc'); include_once('ressources/class.status.inc'); include_once('ressources/class.artica.graphs.inc'); include_once('ressources/class.calendar.inc'); include_once('ressources/class.tcpip.inc'); $users=new usersMenus(); if(!$users->AsDansGuardianAdministrator){die();} if(isset($_GET["events"])){popup_list();exit;} if(isset($_POST["unlock"])){unlock();exit;} if(isset($_POST["biglock"])){biglock();exit;} if(isset($_GET["js"])){FULL_JS();exit;} if(isset($_GET["calendar"])){calendar();exit;} if(isset($_GET["title-zday"])){calendar_title();exit;} if(isset($_GET["build-calendar"])){calendar_build();exit;} if(isset($_POST["reload-unlock"])){reload_unlock();exit;} if(isset($_GET["full-js"])){FULL_JS();exit;} if(isset($_GET["tabs"])){tabs();exit;} if(isset($_GET["week"])){week_table();exit;} if(isset($_GET["week-events"])){week_events();exit;} BlockedSites2(); function FULL_JS(){ header("content-type: application/x-javascript"); $t=$_GET["t"]; $page=CurrentPageName();
$localfile != ".."){ if($debug){ echo "- ".$localfile."<br/>"; } $output = "-"; $current = "content/remote/".$localfile; $trashed = "content/trash/".md5($localfile); @rename($current, $trashed); } } } unlock($lockfile); } echo $output; # - - - - - - - - - - - - - # - - - - - - - - - - - - - # function rmdir_recursive($dir) { foreach(scandir($dir) as $file) { if ('.' === $file || '..' === $file) continue; if (is_dir("$dir/$file")) rmdir_recursive("$dir/$file"); else unlink("$dir/$file");
/** * */ function _editPage($page) { lock($page); $text = rawWiki($page); $offset = 0; foreach ($this->match[$page] as $info) { if ($info['apply']) { $originalLength = strlen($info['original']); $before = substr($text, 0, $info['offest'] + $offset); $after = substr($text, $info['offest'] + $offset + $originalLength); $text = $before . $info['replaced'] . $after; $offset += strlen($info['replaced']) - $originalLength; } } saveWikiText($page, $text, $this->summary, $this->minorEdit); unlock($page); }
function accept_connection($socket) { while (1) { try { $conn = stream_socket_accept($socket, 0); stream_set_blocking($conn, 0); stream_set_timeout($conn, 120); debug("new connection"); $start = time(); while (!feof($conn)) { if (time() - $start > 10) { break; } $req = trim(stream_socket_recvfrom($conn, 1024)); if (strlen($req) == 0) { continue; } debug("received {$req}"); $eof = false; if (strpos($req, "EOF") !== false) { $eof = true; $req = str_replace("EOF", "", $req); } $cmd = explode("|", $req); debug("command count: " . (count($cmd) - 1)); for ($i = 0; $i < count($cmd) - 1; $i++) { $c = $cmd[$i]; debug("command #{$i}: {$c}"); $c = preg_replace('/ 0+(\\d+)$/', ' $1', $c); $id = substr($c, 0, strpos($c, " ")); $c = substr($c, strpos($c, " ") + 1); if (!preg_match(SYNTAX, $c) && !preg_match(SYNTAX_IP, $c) && !preg_match(SYNTAX_PORT, $c) || !is_numeric($id) && $id != '*') { debug("invalid entry: " . $cmd[$i]); continue; } $host = substr($c, strpos($c, "-s ") + strlen("-s "), strpos($c, "/32") - strpos($c, "-s ") - strlen("-s ")); $cmds = array(); $type = substr($c, 0, strpos($c, " ")); debug("type = {$type}"); if ((preg_match(SYNTAX, $c) || preg_match(SYNTAX_IP, $c)) && preg_match('/[^0-9\\.]/', $host)) { debug("getting ip"); $ips = getips($id, $host, $type); //debug("lock block 1 took " .(microtime(true) - $start)); debug("got ip"); // for these hosts, let the rules be evicted rather than remove them, since it will be overkill // as they are used very often foreach ($ips as $ip) { $cmds[] = str_replace($host, $ip, $c); } } else { $cmds[] = $c; } foreach ($cmds as $c) { $c = substr($c, strpos($c, " ") + 1); lock(); //$start = microtime(true); $adds = getVar(); if ($type == '-A') { $exists = $adds[$c]; if ($exists && my_array_search($id, $adds[$c]) !== false) { unlock(); continue; } $adds[$c][] = $id . ":" . time(); setVar($adds); if (!$exists) { debug("adding entry {$c}"); iptables($c, "-A"); } } else { if ($type == '-D') { if (checkDeleted($adds, $id, $c)) { debug("deleting entry {$c}"); iptables($c, "-D"); } } } //debug("lock block 2 took " .(microtime(true) - $start)); unlock(); } } if ($eof) { debug("next.."); break; } usleep(50000); } stream_socket_sendto($conn, "BYE"); @fclose($conn); } catch (Exception $e) { try { unlock(); // in case it was locked unlock(DNS_INDEX); } catch (Exception $ex) { // ignore } } usleep(50000); } }
/** * Handle 'login', 'logout' * * @author Andreas Gohr <*****@*****.**> */ function act_auth($act) { global $ID; global $INFO; //already logged in? if (isset($_SERVER['REMOTE_USER']) && $act == 'login') { return 'show'; } //handle logout if ($act == 'logout') { $lockedby = checklock($ID); //page still locked? if ($lockedby == $_SERVER['REMOTE_USER']) { unlock($ID); } //try to unlock // do the logout stuff auth_logoff(); // rebuild info array $INFO = pageinfo(); act_redirect($ID, 'login'); } return $act; }
/** * Handle 'login', 'logout' * * @author Andreas Gohr <*****@*****.**> */ function act_auth($act) { global $ID; global $INFO; //already logged in? if ($_SERVER['REMOTE_USER'] && $act == 'login') { header("Location: " . wl($ID, '', true)); exit; } //handle logout if ($act == 'logout') { $lockedby = checklock($ID); //page still locked? if ($lockedby == $_SERVER['REMOTE_USER']) { unlock($ID); } //try to unlock // do the logout stuff auth_logoff(); // rebuild info array $INFO = pageinfo(); return 'login'; } return $act; }
/* hotspot_blocklist_edit.php Copyright (C) 2013-2015 Ogün AÇIK All rights reserved. */ require 'guiconfig.inc'; require 'captiveportal.inc'; require 'local_connection.inc'; $pgtitle = array('HOTSPOT ', 'MAC ADRESİ ENGELLE'); /* Get active captiveportal sessions */ if (file_exists("{$g['vardb_path']}/captiveportal.db")) { $captiveportallck = lock('captiveportaldb'); $cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); unlock($captiveportallck); } if ($connection) { if ($_GET['act'] == 'new' && is_mac($_GET['mac'])) { $macFound['mac'] = $_GET['mac']; } if ($_GET['act'] == 'edit' && is_mac($_GET['mac'])) { $mac_addr = $_GET['mac']; $getInfo = $pdo->prepare("\n\t\t\tSELECT mac_addr AS mac, description\n\t\t\tFROM blocklist\n\t\t\tWHERE mac_addr = :mac\n\t\t"); $getInfo->bindParam(':mac', $mac_addr); $getInfo->execute(); $macFound = $getInfo->fetch(PDO::FETCH_ASSOC); if (!$macFound) { $input_errors[] = "'{$mac_addr}' MAC adresi bulunamadı."; } }
/** * Execute the sync action and print the results */ function _sync(&$synclist, $type) { if (!$this->_connect()) { return false; } $no = $this->profno; $sum = $_REQUEST['sum']; if ($type == 'pages') { $lock = $this->_lockfiles($synclist); } // do the sync foreach ((array) $synclist as $id => $dir) { @set_time_limit(30); if ($dir == 0) { $this->_listOut($this->getLang('skipped') . ' ' . $id, 'skipped'); continue; } if ($dir == -2) { //delete local if ($type == 'pages') { saveWikiText($id, '', $sum, false); $this->_listOut($this->getLang('localdelok') . ' ' . $id, 'del_okay'); } else { if (unlink(mediaFN($id))) { $this->_listOut($this->getLang('localdelok') . ' ' . $id, 'del_okay'); } else { $this->_listOut($this->getLang('localdelfail') . ' ' . $id, 'del_fail'); } } continue; } if ($dir == -1) { //pull if ($type == 'pages') { $ok = $this->client->query('wiki.getPage', $id); } else { $ok = $this->client->query('wiki.getAttachment', $id); } if (!$ok) { $this->_listOut($this->getLang('pullfail') . ' ' . $id . ' ' . $this->client->getErrorMessage(), 'pull_fail'); continue; } $data = $this->client->getResponse(); if ($type == 'pages') { saveWikiText($id, $data, $sum, false); } else { if ($this->apiversion < 7) { $data = base64_decode($data); } io_saveFile(mediaFN($id), $data); } $this->_listOut($this->getLang('pullok') . ' ' . $id, 'pull_okay'); continue; } if ($dir == 1) { // push if ($type == 'pages') { $data = rawWiki($id); $ok = $this->client->query('wiki.putPage', $id, $data, array('sum' => $sum)); } else { $data = io_readFile(mediaFN($id), false); if ($this->apiversion < 6) { $data = base64_encode($data); } else { $data = new IXR_Base64($data); } $ok = $this->client->query('wiki.putAttachment', $id, $data, array('ow' => true)); } if (!$ok) { $this->_listOut($this->getLang('pushfail') . ' ' . $id . ' ' . $this->client->getErrorMessage(), 'push_fail'); continue; } $this->_listOut($this->getLang('pushok') . ' ' . $id, 'push_okay'); continue; } if ($dir == 2) { // remote delete if ($type == 'pages') { $ok = $this->client->query('wiki.putPage', $id, '', array('sum' => $sum)); } else { $ok = $this->client->query('wiki.deleteAttachment', $id); } if (!$ok) { $this->_listOut($this->getLang('remotedelfail') . ' ' . $id . ' ' . $this->client->getErrorMessage(), 'del_fail'); continue; } $this->_listOut($this->getLang('remotedelok') . ' ' . $id, 'del_okay'); continue; } } // unlock if ($type == 'pages') { foreach ((array) $synclist as $id => $dir) { unlock($id); } $this->client->query('dokuwiki.setLocks', array('lock' => array(), 'unlock' => $lock)); } }
$lockfile = '/tmp/mytest2.lock'; if (file_exists($lockfile)) { exit; } else { file_put_contents($lockfile, 1, true); } require_once './kafka.php'; require_once './comm_consume.php'; $topic = $argv[1]; try { runConsumer($topic); //lock($topic) } catch (Exception $e) { logs('consume run error!', 1, 'consumer', $topic); unlock(2); } function runConsumer($topic) { $lockfile = '/tmp/mytest2.lock'; $startTime = explode(' ', microtime()); $kmlCachePath = getconfig('kmlCachePath'); //本地缓存里存在数据则优先执行 $cacheFiles = getFileList('./cache/' . $topic); if (!empty($cacheFiles)) { sort($cacheFiles); foreach ($cacheFiles as $f) { $kmls = json_decode(file_get_contents($f)); $items = array_chunk($kmls, 25); foreach ($items as $item) { updataKml($item, $startTime, $f, 2, $topic);
/** * Locks or unlocks a given batch of pages * * Give an associative array with two keys: lock and unlock. Both should contain a * list of pages to lock or unlock * * Returns an associative array with the keys locked, lockfail, unlocked and * unlockfail, each containing lists of pages. */ function setLocks($set) { $locked = array(); $lockfail = array(); $unlocked = array(); $unlockfail = array(); foreach ((array) $set['lock'] as $id) { $id = $this->resolvePageId($id); if (auth_quickaclcheck($id) < AUTH_EDIT || checklock($id)) { $lockfail[] = $id; } else { lock($id); $locked[] = $id; } } foreach ((array) $set['unlock'] as $id) { $id = $this->resolvePageId($id); if (auth_quickaclcheck($id) < AUTH_EDIT || !unlock($id)) { $unlockfail[] = $id; } else { $unlocked[] = $id; } } return array('locked' => $locked, 'lockfail' => $lockfail, 'unlocked' => $unlocked, 'unlockfail' => $unlockfail); }
/** * Save a wiki page * * @author Michael Klier <*****@*****.**> */ function putPage($id, $text, $params) { global $TEXT; global $lang; global $conf; $id = cleanID($id); $TEXT = trim($text); $sum = $params['sum']; $minor = $params['minor']; if (empty($id)) { return new IXR_Error(1, 'Empty page ID'); } if (!page_exists($id) && empty($TEXT)) { return new IXR_ERROR(1, 'Refusing to write an empty new wiki page'); } if (auth_quickaclcheck($id) < AUTH_EDIT) { return new IXR_Error(1, 'You are not allowed to edit this page'); } // Check, if page is locked if (checklock($id)) { return new IXR_Error(1, 'The page is currently locked'); } // SPAM check if (checkwordblock()) { return new IXR_Error(1, 'Positive wordblock check'); } // autoset summary on new pages if (!page_exists($id) && empty($sum)) { $sum = $lang['created']; } // autoset summary on deleted pages if (page_exists($id) && empty($TEXT) && empty($sum)) { $sum = $lang['deleted']; } lock($id); saveWikiText($id, $TEXT, $sum, $minor); unlock($id); // run the indexer if page wasn't indexed yet if (!@file_exists(metaFN($id, '.indexed'))) { // try to aquire a lock $lock = $conf['lockdir'] . '/_indexer.lock'; while (!@mkdir($lock, $conf['dmode'])) { usleep(50); if (time() - @filemtime($lock) > 60 * 5) { // looks like a stale lock - remove it @rmdir($lock); } else { return false; } } if ($conf['dperm']) { chmod($lock, $conf['dperm']); } require_once DOKU_INC . 'inc/indexer.php'; // do the work idx_addPage($id); // we're finished - save and free lock io_saveFile(metaFN($id, '.indexed'), INDEXER_VERSION); @rmdir($lock); } return 0; }
/** * Locks or unlocks a given batch of pages * * Give an associative array with two keys: lock and unlock. Both should contain a * list of pages to lock or unlock * * Returns an associative array with the keys locked, lockfail, unlocked and * unlockfail, each containing lists of pages. */ function setLocks($set) { $locked = array(); $lockfail = array(); $unlocked = array(); $unlockfail = array(); foreach ((array) $set['lock'] as $id) { if (checklock($id)) { $lockfail[] = $id; } else { lock($id); $locked[] = $id; } } foreach ((array) $set['unlock'] as $id) { if (unlock($id)) { $unlocked[] = $id; } else { $unlockfail[] = $id; } } return array('locked' => $locked, 'lockfail' => $lockfail, 'unlocked' => $unlocked, 'unlockfail' => $unlockfail); }
/** * Clear the lock on the given page * * @param string $wiki_id */ protected function clearLock($wiki_id) { if ($this->force) { $this->deleteLock($wiki_id); } $_SERVER['REMOTE_USER'] = $this->username; if (checklock($wiki_id)) { $this->error("Page {$wiki_id} is locked by another user"); exit(1); } unlock($wiki_id); if (file_exists(wikiLockFN($wiki_id))) { $this->error("Unable to clear lock for {$wiki_id}"); exit(1); } }
return $xmlrpc_g['return']['authfail']; } if (!function_exists("get_notices")) { require "notices.inc"; } if (!$params) { $toreturn = get_notices(); } else { $toreturn = get_notices($params); } $response = new XML_RPC_Response(XML_RPC_encode($toreturn)); return $response; } $xmlrpclockkey = lock('xmlrpc', LOCK_EX); /*****************************/ $server = new XML_RPC_Server(array('pfsense.exec_shell' => array('function' => 'exec_shell_xmlrpc', 'signature' => $exec_shell_sig, 'docstring' => $exec_shell_doc), 'pfsense.exec_php' => array('function' => 'exec_php_xmlrpc', 'signature' => $exec_php_sig, 'docstring' => $exec_php_doc), 'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc', 'signature' => $filter_configure_sig, 'docstring' => $filter_configure_doc), 'pfsense.interfaces_carp_configure' => array('function' => 'interfaces_carp_configure_xmlrpc', 'docstring' => $carp_configure_sig), 'pfsense.backup_config_section' => array('function' => 'backup_config_section_xmlrpc', 'signature' => $backup_config_section_sig, 'docstring' => $backup_config_section_doc), 'pfsense.restore_config_section' => array('function' => 'restore_config_section_xmlrpc', 'signature' => $restore_config_section_sig, 'docstring' => $restore_config_section_doc), 'pfsense.merge_config_section' => array('function' => 'merge_config_section_xmlrpc', 'signature' => $merge_config_section_sig, 'docstring' => $merge_config_section_doc), 'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc', 'signature' => $merge_config_section_sig, 'docstring' => $merge_config_section_doc), 'pfsense.host_firmware_version' => array('function' => 'pfsense_firmware_version_xmlrpc', 'signature' => $pfsense_firmware_version_sig, 'docstring' => $host_firmware_version_doc), 'pfsense.reboot' => array('function' => 'reboot_xmlrpc', 'signature' => $reboot_sig, 'docstring' => $reboot_doc), 'pfsense.get_notices' => array('function' => 'get_notices_xmlrpc', 'signature' => $get_notices_sig))); unlock($xmlrpclockkey); function array_overlay($a1, $a2) { foreach ($a1 as $k => $v) { if (!array_key_exists($k, $a2)) { continue; } if (is_array($v) && is_array($a2[$k])) { $a1[$k] = array_overlay($v, $a2[$k]); } else { $a1[$k] = $a2[$k]; } } return $a1; }
<td> <?php echo htmlspecialchars($rollent['comment']); ?> </td> <td> <?php echo htmlspecialchars($used); ?> </td> <td> <?php echo htmlspecialchars($active); ?> </td> <td> <?php echo htmlspecialchars($ready); ?> </td> </tr> <?php $i++; } unlock($voucherlck); ?> </tbody> </table> </div> <?php include "foot.inc";
function write_msg(&$event, $param) { if ($this->allow) { return; } global $ID; echo "<h1> Permission Denied </h1>"; echo "You do not have access to the template " . $_REQUEST['newpagetemplate'] . '</br>'; unlock($ID); $event->preventDefault(); }