protected function loadDriver($sqlserver, $sqlusername, $sqlpassword, $sqldatabase) { $driverloc = "drivers/" . $this->config['sql']['driver']; if (fileexists($driverloc)) { require_once $driverloc; return new sqldriver($sqlserver, $sqlusername, $sqlpassword, $sqldatabase); } else { $this->err_msg = "Driver does not exist"; return 0; } }
$sform->addElement($button_tray); $sform->display(); xoops_cp_footer(); } exit(); } if ($action == 'rename') { if ( $confirm == '1') { $new_filename = "{$_POST['workpath']}/{$_POST['new_filename']}"; $old_filename = "{$_POST['workpath']}/{$_POST['old_filename']}"; //safemodeon($_POST['workpath'], '', $_POST['new_filename'], 'renamed'); filecheck($_POST['workpath'], '', $_POST['new_filename'], ''); fileexists($_POST['workpath'], $new_filename,'', 'File'); folderwrite($_POST['workpath'], '','', 'rename'); filewrite($_POST['workpath'], '$new_filename','', 'rename'); renameit($_POST['workpath'], $old_filename, $new_filename, 'File'); redirect_header("javascript:history.go(-1)",1,"Unknown Error: File not renamed!"); exit(); } else { include XOOPS_ROOT_PATH."/class/xoopsformloader.php"; xoops_cp_header(); $sform = new XoopsThemeForm("Rename File", "op", "filemanager.php?action=rename&confirm=1"); $sform->addElement(new XoopsFormLabel(_AM_CURRENTFILENAME, basename($file))); $sform->addElement(new XoopsFormText("Rename File: ", 'new_filename', 30, 80, basename($file)), false); $sform->addElement(new XoopsFormHidden('old_filename', basename(htmlentities($file)))); $sform->addElement(new XoopsFormHidden('workpath', $_GET['workpath'])); $button_tray = new XoopsFormElementTray('','');
function drkmn_masternodes_portcheck_get($mysqli, $mnkeys, $testnet = 0) { $cacheserial = sha1(serialize($mnkeys)); $cachefnam = CACHEFOLDER . sprintf("dashninja_masternodes_portcheck_get_%d_%d_%s", $testnet, count($mnkeys), $cacheserial); $cachefnamupdate = $cachefnam . ".update"; $cachevalid = is_readable($cachefnam) && (filemtime($cachefnam) + 300 >= time() || file_exists($cachefnamupdate)); if ($cachevalid) { $portcheck = unserialize(file_get_contents($cachefnam)); } else { touch($cachefnamupdate); // Retrieve the portcheck info for the specific ip:ports $sql = sprintf("SELECT inet_ntoa(NodeIP) NodeIP, NodePort, NodePortCheck, NodeSubVer, UNIX_TIMESTAMP(NextCheck) NextCheck, ErrorMessage, NodeCountry, NodeCountryCode FROM cmd_portcheck WHERE NodeTestNet = %d", $testnet); // Add the filtering to ip:ports (in $mnkeys parameter) if (count($mnkeys) > 0) { $sql .= " AND ("; $sqls = ''; foreach ($mnkeys as $mnipstr) { $mnip = explode(':', $mnipstr); if (strlen($sqls) > 0) { $sqls .= ' OR '; } $sqls .= sprintf("(NodeIP = %d AND NodePort = %d)", $mnip[0], $mnip[1]); } $sql .= $sqls . ")"; } $sql .= " ORDER BY NodeIP, NodePort"; // Run the query $numnodes = 0; if ($result = $mysqli->query($sql)) { $portcheck = array(); // Group the result by masternode ip:port (status is per protocolversion and nodename) while ($row = $result->fetch_assoc()) { $portcheck[$row['NodeIP'] . ':' . $row['NodePort']] = array("Result" => $row['NodePortCheck'], "SubVer" => $row['NodeSubVer'], "NextCheck" => $row['NextCheck'], "ErrorMessage" => $row['ErrorMessage'], "Country" => $row['NodeCountry'], "CountryCode" => $row['NodeCountryCode']); } } else { $portcheck = false; } file_put_contents($cachefnam . ".new", serialize($portcheck), LOCK_EX); rename($cachefnam . ".new", $cachefnam); if (fileexists($cachefnamupdate)) { unlink($cachefnamupdate); } } return $portcheck; }
function imageCacher($url, $name = NULL) { if (!fileexists(strtolower(str_replace(" ", "_", $name)))) { $new_w = 100; $new_h = 100; $orig_w = imagesx($source_img); $orig_h = imagesy($source_img); $w_ratio = $new_w / $orig_w; $h_ratio = $new_h / $orig_h; if ($orig_w > $orig_h) { //landscape $crop_w = round($orig_w * $h_ratio); $crop_h = $new_h; $src_x = ceil(($orig_w - $orig_h) / 2); $src_y = 0; } elseif ($orig_w < $orig_h) { //portrait $crop_h = round($orig_h * $w_ratio); $crop_w = $new_w; $src_x = 0; $src_y = ceil(($orig_h - $orig_w) / 2); } else { //square $crop_w = $new_w; $crop_h = $new_h; $src_x = 0; $src_y = 0; } $dest_img = imagecreatetruecolor($new_w, $new_h); imagecopyresampled($dest_img, $source_img, 0, 0, $src_x, $src_y, $crop_w, $crop_h, $orig_w, $orig_h); } }
$sform->addElement(new XoopsFormHidden('file', $_GET['file'])); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormButton('', 'save', "Delete", 'submit')); $sform->addElement($button_tray); $sform->display(); xoops_cp_footer(); } exit; } if ($action == 'rename') { if ($confirm == '1') { $new_filename = "{$HTTP_POST_VARS['workpath']}/{$HTTP_POST_VARS['new_filename']}"; $old_filename = "{$HTTP_POST_VARS['workpath']}/{$HTTP_POST_VARS['old_filename']}"; //safemodeon($HTTP_POST_VARS['workpath'], '', $HTTP_POST_VARS['new_filename'], 'renamed'); filecheck($HTTP_POST_VARS['workpath'], '', $HTTP_POST_VARS['new_filename'], ''); fileexists($HTTP_POST_VARS['workpath'], $new_filename, '', 'File'); folderwrite($HTTP_POST_VARS['workpath'], '', '', 'rename'); filewrite($HTTP_POST_VARS['workpath'], '$new_filename', '', 'rename'); renameit($HTTP_POST_VARS['workpath'], $old_filename, $new_filename, 'File'); redirect_header("javascript:history.go(-1)", 1, "Unknown Error: File not renamed!"); exit; } else { include XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; xoops_cp_header(); $sform = new XoopsThemeForm("Rename File", "op", "filemanager.php?action=rename&confirm=1"); $sform->addElement(new XoopsFormLabel(_AM_CURRENTFILENAME, basename($file))); $sform->addElement(new XoopsFormText("Rename File: ", 'new_filename', 30, 80, basename($file)), false); $sform->addElement(new XoopsFormHidden('old_filename', basename(htmlentities($file)))); $sform->addElement(new XoopsFormHidden('workpath', $_GET['workpath'])); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormButton('', 'save', "Rename", 'submit'));