public function test_PageLockedByYou() { $page_id = 'test:main'; $GLOBALS['INPUT']->server->set('REMOTE_USER', 'testuser'); saveWikiText($page_id, 'some text', 'some summary'); lock($page_id); $json = $this->doCall($page_id, null, 'testuser'); $this->assertInstanceOf('\\stdClass', $json); $this->assertObjectHasAttribute('error', $json); $this->assertRegExp("/^\\d{2}:\\d{2}:\\d{2} Page is locked by You. You cannot delete page during edit.\$/", $json->error); }
/** * Deleting function * @param id Hardware identifier to be deleted * @param checkLock Tells wether or not the locking system must be used (default true) * @param traceDel Tells wether or not the deleted entities must be inserted in deleted_equiv for tracking purpose (default true) */ function deleteDid($id, $checkLock = true, $traceDel = true, $silent = false) { global $l; //If lock is not user OR it is used and available if (!$checkLock || lock($id)) { $resId = mysql_query("SELECT deviceid,name FROM hardware WHERE id='{$id}'", $_SESSION["readServer"]) or die(mysql_error()); $valId = mysql_fetch_array($resId); $idHard = $id; $did = $valId["deviceid"]; if ($did) { //Deleting a network device if (strpos($did, "NETWORK_DEVICE-") === false) { $resNetm = @mysql_query("SELECT macaddr FROM networks WHERE hardware_id={$idHard}", $_SESSION["writeServer"]) or die(mysql_error()); while ($valNetm = mysql_fetch_array($resNetm)) { @mysql_query("DELETE FROM netmap WHERE mac='" . $valNetm["macaddr"] . "';", $_SESSION["writeServer"]) or die(mysql_error()); } } //deleting a regular computer if ($did != "_SYSTEMGROUP_" and $did != '_DOWNLOADGROUP_') { $tables = array("accesslog", "accountinfo", "bios", "controllers", "drives", "inputs", "memories", "modems", "monitors", "networks", "ports", "printers", "registry", "slots", "softwares", "sounds", "storages", "videos", "devices", "download_history", "download_servers", "groups_cache"); } elseif ($did == "_SYSTEMGROUP_" or $did == '_DOWNLOADGROUP_') { //Deleting a group $tables = array("devices"); $del_groups_server_cache = "DELETE FROM download_servers WHERE group_id='" . $idHard . "'"; mysql_query($del_groups_server_cache, $_SESSION["writeServer"]) or die(mysql_error()); mysql_query("DELETE FROM groups WHERE hardware_id={$idHard}", $_SESSION["writeServer"]) or die(mysql_error()); $resDelete = mysql_query("DELETE FROM groups_cache WHERE group_id={$idHard}", $_SESSION["writeServer"]) or die(mysql_error()); $affectedComputers = mysql_affected_rows($_SESSION["writeServer"]); } if (!$silent) { echo "deleting record " . $valId["name"] . "\n"; } foreach ($tables as $table) { mysql_query("DELETE FROM {$table} WHERE hardware_id={$idHard};", $_SESSION["writeServer"]) or die(mysql_error()); } mysql_query("delete from download_enable where SERVER_ID=" . $idHard, $_SESSION["writeServer"]) or die(mysql_error($_SESSION["writeServer"])); mysql_query("DELETE FROM hardware WHERE id={$idHard};", $_SESSION["writeServer"]) or die(mysql_error()); //Deleted computers tracking if ($traceDel && mysql_num_rows(mysql_query("SELECT IVALUE FROM config WHERE IVALUE>0 AND NAME='TRACE_DELETED'", $_SESSION["writeServer"]))) { mysql_query("insert into deleted_equiv(DELETED,EQUIVALENT) values('{$did}',NULL)", $_SESSION["writeServer"]) or die(mysql_error()); } } //Using lock ? Unlock if ($checkLock) { unlock($id); } } else { errlock(); } }
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 obtainLock($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 already locked by another user\n"); exit(1); } lock($WIKI_ID); $_SERVER['REMOTE_USER'] = '******' . $USERNAME . '_'; if (checklock($WIKI_ID) != $USERNAME) { fwrite(STDERR, "Unable to obtain lock for {$WIKI_ID}\n"); exit(1); } }
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(); } }
/** * Checks if 'newentry' was given as action, if so we * do handle the event our self and no further checking takes place */ function handle_act_preprocess(&$event, $param) { //if ($event->data != 'newentry') return; // nothing to do for us global $ACT; global $ID; echo "param={$param}"; return; // we can handle it -> prevent others $event->stopPropagation(); $event->preventDefault(); $ns = $_REQUEST['ns']; $title = str_replace(':', '', $_REQUEST['title']); $id = ($ns ? $ns . ':' : '') . cleanID($title); // check if we are allowed to create this file if (auth_quickaclcheck($id) >= AUTH_CREATE) { $back = $ID; $ID = $id; $file = wikiFN($ID); //check if locked by anyone - if not lock for my self if (checklock($ID)) { $ACT = 'locked'; } else { lock($ID); } // prepare the new thread file with default stuff if (!@file_exists($file)) { global $TEXT; global $INFO; global $conf; $TEXT = pageTemplate($ns . ':' . $title); if (!$TEXT) { $TEXT = "====== {$title} ======\n\n\n\n" . "~~DISCUSSION~~\n"; } $ACT = 'preview'; } else { $ACT = 'edit'; } } else { $ACT = 'show'; } }
/** * Lock the given page or exit * * @param string $wiki_id */ protected function obtainLock($wiki_id) { if ($this->force) { $this->deleteLock($wiki_id); } $_SERVER['REMOTE_USER'] = $this->username; if (checklock($wiki_id)) { $this->error("Page {$wiki_id} is already locked by another user"); exit(1); } lock($wiki_id); if (checklock($wiki_id)) { $this->error("Unable to obtain lock for {$wiki_id} "); var_dump(checklock($wiki_id)); exit(1); } }
/** * Creates a new entry page */ function _handle_newEntry() { global $ID, $INFO; $ns = cleanID($_REQUEST['ns']); $title = str_replace(':', '', $_REQUEST['title']); $ID = $this->_newEntryID($ns, $title); $INFO = pageinfo(); // check if we are allowed to create this file if ($INFO['perm'] >= AUTH_CREATE) { //check if locked by anyone - if not lock for my self if ($INFO['locked']) { return 'locked'; } else { lock($ID); } // prepare the new thread file with default stuff if (!@file_exists($INFO['filepath'])) { global $TEXT; $TEXT = pageTemplate(array(($ns ? $ns . ':' : '') . $title)); if (!$TEXT) { $data = array('id' => $ID, 'ns' => $ns, 'title' => $title); $TEXT = $this->_pageTemplate($data); } return 'preview'; } else { return 'edit'; } } else { return 'show'; } }
/** * Lock files that will be modified on either side. * * Lock fails are printed and removed from synclist * * @returns list of locked files */ function _lockFiles(&$synclist) { if (!$this->_connect()) { return array(); } // lock the files $lock = array(); foreach ((array) $synclist as $id => $dir) { if ($dir == 0) { continue; } if (checklock($id)) { $this->_listOut($this->getLang('lockfail') . ' ' . hsc($id), 'error'); unset($synclist[$id]); } else { lock($id); // lock local $lock[] = $id; } } // lock remote files $ok = $this->client->query('dokuwiki.setLocks', array('lock' => $lock, 'unlock' => array())); if (!$ok) { $this->_listOut('failed RPC communication'); $synclist = array(); return array(); } $data = $this->client->getResponse(); foreach ((array) $data['lockfail'] as $id) { $this->_listOut($this->getLang('lockfail') . ' ' . hsc($id), 'error'); unset($synclist[$id]); } return $lock; }
/** * 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; }
} } ?> <header id="header"> <h1> <a href="../">PunkSky:MCSE</a> </h1> <nav id="nav"> <ul> <li><a href="index">Home</a></li> <li><a href="http://github.com/zarlo/MCSE/releases/latest">Download</a></li> <li><a href="INFO">INFO</a></li> <?php if ($lock == true) { if (isset($_session['username'])) { if (lock() == false) { echo '<li><a href="../login?url=' . $_SERVER['PHP_SELF'] . '" class="button special">Login</a></li>'; } else { echo '<li><a href="../logout" class="button special">Logout</a></li>'; } } else { echo '<li><a href="../login?url=' . $_SERVER['PHP_SELF'] . '" class="button special">Login</a></li>'; } } else { echo '<li><a href="../login?url=' . $_SERVER['PHP_SELF'] . '" class="button special">Login</a></li>'; } ?> </ul> </nav> </header>
/** * 禁用插件时执行函数,用于删除任务 * @package WordPress * @subpackage Auto-Post-News * @since 0.0.1 */ function unschedule_post_news() { remove_filter('cron_schedules', 'cron_add_quarter'); wp_clear_scheduled_hook('post_news'); if (file_exists(dirname(__FILE__) . '/post.lock')) { lock('delete', dirname(__FILE__) . '/post.lock'); } }
/** * Refresh a page lock and save draft * * Andreas Gohr <*****@*****.**> */ function ajax_lock() { global $conf; global $lang; $id = cleanID($_POST['id']); if (empty($id)) { return; } if (!checklock($id)) { lock($id); echo 1; } if ($conf['usedraft'] && $_POST['wikitext']) { $client = $_SERVER['REMOTE_USER']; if (!$client) { $client = clientIP(true); } $draft = array('id' => $id, 'prefix' => substr($_POST['prefix'], 0, -1), 'text' => $_POST['wikitext'], 'suffix' => $_POST['suffix'], 'date' => (int) $_POST['date'], 'client' => $client); $cname = getCacheName($draft['client'] . $id, '.draft'); if (io_saveFile($cname, serialize($draft))) { echo $lang['draftdate'] . ' ' . dformat(); } } }
<?php /* 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ı."; }
/** * Handle 'edit', 'preview' * * @author Andreas Gohr <*****@*****.**> */ function act_edit($act) { global $ID; global $INFO; //check if locked by anyone - if not lock for my self $lockedby = checklock($ID); if ($lockedby) { return 'locked'; } lock($ID); return $act; }
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // BTC Donations: 163Pv9cUDJTNUbadV4HMRQSSj3ipwLURRc include dirname(__FILE__) . "/../includes/requiredFunctions.php"; //Check that script is run locally ScriptIsRunLocally(); $txfee = 0; if ($settings->getsetting("sitetxfee") > 0) { $txfee = $settings->getsetting("sitetxfee"); } $sitepercent = $settings->getsetting("sitepercent"); /////////Pay users who have reached their threshold payout $resultQ = mysql_query("SELECT b.userId, b.balance, IFNULL(b.paid, 0) as paid, IFNULL(b.sendAddress,'') as sendAddress, u.email, u.donate_percent FROM accountBalance b, webUsers u WHERE b.userId = u.id AND b.threshold >= 1 AND b.balance >= threshold"); lock("money"); try { while ($resultR = mysql_fetch_object($resultQ)) { $currentBalance = $resultR->balance; $paid = $resultR->paid; $paymentAddress = $resultR->sendAddress; $userId = $resultR->userId; $donatepercent = $resultR->donate_percent; if ($paymentAddress != '') { $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");
if (!xmlrpc_auth($params)) { xmlrpc_authfail(); 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]; } }
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(); }
/** * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr <*****@*****.**> */ function act_edit($act) { global $ID; global $INFO; global $TEXT; global $RANGE; global $PRE; global $SUF; global $REV; global $SUM; global $lang; global $DATE; if (!isset($TEXT)) { if ($INFO['exists']) { if ($RANGE) { list($PRE, $TEXT, $SUF) = rawWikiSlices($RANGE, $ID, $REV); } else { $TEXT = rawWiki($ID, $REV); } } else { $TEXT = pageTemplate($ID); } } //set summary default if (!$SUM) { if ($REV) { $SUM = $lang['restored']; } elseif (!$INFO['exists']) { $SUM = $lang['created']; } } // Use the date of the newest revision, not of the revision we edit // This is used for conflict detection if (!$DATE) { $DATE = $INFO['meta']['date']['modified']; } //check if locked by anyone - if not lock for my self $lockedby = checklock($ID); if ($lockedby) { return 'locked'; } lock($ID); return $act; }
/** * 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); }
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); echo "Servers Service started [" . date('d.m.Y h:i', time()) . "] with PID= " . getmypid() . "\n"; include __DIR__ . '/conf.php'; include __corePath . 'libs/service.php'; include __corePath . 'libs/ApiQuery.php'; include __corePath . 'libs/jsonDB.php'; if (checkLock('servers')) { die("Found .lock file, exit.\n"); } lock('servers'); $serversList = new JsonDB(__serversdb); foreach ($serversList->data as $key => $server) { if (checkServerTestTime($server, 60)) { $query = new ApiQuery($server['address'], $server['apiKey']); $info = $query->getServerInfo(true); if ($info['responseStatus'] == 'ok') { $serversList->data[$key]['name'] = $info['serverName']; $serversList->data[$key]['tasksCount'] = $info['tasksCount']; $serversList->data[$key]['tasks'] = $info['tasks']; $serversList->data[$key]['freeSpace'] = $info['freeSpace']; $serversList->data[$key]['lastCheck'] = time(); $serversList->data[$key]['status'] = 1; if ($server['archSync']) { $tasksfiles = $query->getTasksFiles(true); // ---------------------------------- foreach ($tasksfiles as $taskId => $tmpFiles) { $files = array();
echo gettext("used"); ?> </th> <th><?php echo gettext("active"); ?> </th> <th><?php echo gettext("ready"); ?> </th> </tr> </thead> <tbody> <?php $voucherlck = lock("vouche{$cpzone}r"); $i = 0; foreach ($a_roll as $rollent) { $used = voucher_used_count($rollent['number']); $active = count(voucher_read_active_db($rollent['number']), $rollent['minutes']); $ready = $rollent['count'] - $used; /* used also count active vouchers, remove them */ $used = $used - $active; ?> <tr> <td> <?php echo htmlspecialchars($rollent['number']); ?> </td> <td>
$config['voucher'][$cpzone]['privatekey'] = base64_encode($privkey); } } // Check for invalid or expired vouchers if (!isset($config['voucher'][$cpzone]['descrmsgnoaccess'])) { $config['voucher'][$cpzone]['descrmsgnoaccess'] = gettext("Voucher invalid"); } if (!isset($config['voucher'][$cpzone]['descrmsgexpired'])) { $config['voucher'][$cpzone]['descrmsgexpired'] = gettext("Voucher expired"); } $a_roll =& $config['voucher'][$cpzone]['roll']; if ($_GET['act'] == "del") { $id = $_GET['id']; if ($a_roll[$id]) { $roll = $a_roll[$id]['number']; $voucherlck = lock("voucher{$cpzone}"); unset($a_roll[$id]); voucher_unlink_db($roll); unlock($voucherlck); write_config(); } header("Location: services_captiveportal_vouchers.php?zone={$cpzone}"); exit; } else { if ($_GET['act'] == "csv") { $privkey = base64_decode($config['voucher'][$cpzone]['privatekey']); if (strstr($privkey, "BEGIN RSA PRIVATE KEY")) { $fd = fopen("{$g['varetc_path']}/voucher_{$cpzone}.private", "w"); if (!$fd) { $input_errors[] = gettext("Cannot write private key file") . ".\n"; } else {
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); $includeDirectory = "/var/www/includes/"; include $includeDirectory . "requiredFunctions.php"; //Verify source of cron job request if (isset($cronRemoteIP) && $_SERVER['REMOTE_ADDR'] !== $cronRemoteIP) { die(header("Location: /")); } lock("idleworkers.php"); $dt = time() - 3600; //$sql="SELECT donate_percent, id,email,username,deadworker,iwarn FROM webUsers WHERE deadworker='yes' AND iwarn < $dt"; $sql = "SELECT donate_percent, id,email,username,deadworker,iwarn FROM webUsers WHERE deadworker='yes' AND iwarn is NULL"; //echo "$sql\n\n"; $resultQ = mysql_query($sql); while ($resultR = mysql_fetch_object($resultQ)) { $sql = "SELECT username,id FROM pool_worker WHERE active = 0 AND monitor = 'yes' AND associatedUserId = {$resultR->id}"; // echo $sql . "\n\n"; $idleC = 0; $idleworker = "<br>"; $idleQ = mysql_query($sql); while ($idleW = mysql_fetch_object($idleQ)) { $check = $idleW->username; if ($check != NULL) { $idleC++; $idleworker .= "{$check}<br>"; } } echo "{$idleworker}"; $id = $resultR->id;
/** * Refresh a page lock and save draft * * Andreas Gohr <*****@*****.**> */ function ajax_lock() { global $conf; global $lang; global $ID; global $INFO; global $INPUT; $ID = cleanID($INPUT->post->str('id')); if (empty($ID)) { return; } $INFO = pageinfo(); if (!$INFO['writable']) { echo 'Permission denied'; return; } if (!checklock($ID)) { lock($ID); echo 1; } if ($conf['usedraft'] && $INPUT->post->str('wikitext')) { $client = $_SERVER['REMOTE_USER']; if (!$client) { $client = clientIP(true); } $draft = array('id' => $ID, 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), 'text' => $INPUT->post->str('wikitext'), 'suffix' => $INPUT->post->str('suffix'), 'date' => $INPUT->post->int('date'), 'client' => $client); $cname = getCacheName($draft['client'] . $ID, '.draft'); if (io_saveFile($cname, serialize($draft))) { echo $lang['draftdate'] . ' ' . dformat(); } } }
/** * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr <*****@*****.**> */ function act_edit($act) { global $ID; global $INFO; global $TEXT; global $RANGE; global $PRE; global $SUF; global $REV; global $SUM; global $lang; global $DATE; if (!isset($TEXT)) { if ($INFO['exists']) { if ($RANGE) { list($PRE, $TEXT, $SUF) = rawWikiSlices($RANGE, $ID, $REV); } else { $TEXT = rawWiki($ID, $REV); } } else { $TEXT = pageTemplate($ID); } } //set summary default if (!$SUM) { if ($REV) { $SUM = sprintf($lang['restored'], dformat($REV)); } elseif (!$INFO['exists']) { $SUM = $lang['created']; } } // Use the date of the newest revision, not of the revision we edit // This is used for conflict detection if (!$DATE) { $DATE = @filemtime(wikiFN($ID)); } //check if locked by anyone - if not lock for my self //do not lock when the user can't edit anyway if ($INFO['writable']) { $lockedby = checklock($ID); if ($lockedby) { return 'locked'; } lock($ID); } return $act; }
<?php lock(); // Font API define('API_FONT_ADD', 'color.add'); define('API_FONT_GET', 'color.get'); define('API_FONT_REMOVE', 'color.remove'); switch ($action) { case API_FONT_ADD: $screen = intval($route[4]); $x = intval($route[5]); $y = intval($route[6]); if ($screen < 1) { die('Please provide a screen id'); } $font_family = $route[7]; $font_size = intval($route[8]); $font_color = substr($route[9], 0, 6); // check if color already exists in the library $font = array('created' => date('Y-m-d H:i:s'), 'creator' => userid(), 'screen' => $screen, 'x' => $x, 'y' => $y, 'size' => $font_size, 'family' => $font_family, 'color' => 1); $id = $db->insert('font', $font); $font['id'] = $id; header('Content-Type: application/json'); echo json_encode($font); break; case API_FONT_GET: header('Content-Type: application/json'); echo json_encode($result); break; case API_FONT_REMOVE: $id = intval($route[4]);
function append_to_uploads($entry, $tmp_file) { // add system information $entry['uploaded'] = time(); $entry['request'] = $_SERVER; $entry['original_name'] = $entry['name']; $entry['session'] = get_session_id(); $safe_name = safe_file_name($entry['name']); $entry['name'] = $safe_name; $n = 1; while (file_exists($entry['name'])) { // make filename unique $entry['name'] = $n . '_' . $safe_name; $n++; } rename($tmp_file, get_storage_folder() . '/' . $entry['name']); if (lock(get_storage_folder() . '/.lock', true)) { $setup = get_setup(); $setup['uploads'][md5(microtime())] = $entry; save_setup($setup); lock(get_storage_folder() . '/.lock', false); } }