while ($droplet = $query_droplets->fetchRow()) { $get_modified_user = $database->query("SELECT display_name,username, user_id FROM " . TABLE_PREFIX . "users WHERE user_id = '" . $droplet['modified_by'] . "' LIMIT 1"); if ($get_modified_user->numRows() > 0) { $fetch_modified_user = $get_modified_user->fetchRow(); $modified_user = $fetch_modified_user['username']; $modified_userid = $fetch_modified_user['user_id']; } else { $modified_user = $TEXT['UNKNOWN']; $modified_userid = 0; } $comments = str_replace(array("\r\n", "\n", "\r"), '<br />', $droplet['comments']); if (!strpos($comments, "[[")) { $comments = "Use: [[" . $droplet['name'] . "]]<br />" . $comments; } $comments = str_replace(array("[[", "]]"), array('<b>[[', ']]</b>'), $comments); $valid_code = check_syntax($droplet['code']); if (!$valid_code === true) { $comments = '<font color=\'red\'><strong>' . $DR_TEXT['INVALIDCODE'] . '</strong></font><br /><br />' . $comments; } $unique_droplet = check_unique($droplet['name']); if ($unique_droplet === false) { $comments = '<font color=\'red\'><strong>' . $DR_TEXT['NOTUNIQUE'] . '</strong></font><br /><br />' . $comments; } $comments = '<span>' . $comments . '</span>'; $id = $droplet['id']; if (version_compare(WB_VERSION, '2.8.2', '>=') && WB_VERSION != "2.8.x") { $id = $admin->getIDKEY($id); } ?> <tr class="row_<?php
$get_modified_user = $database->query($sql); if ($get_modified_user->numRows() > 0) { $fetch_modified_user = $get_modified_user->fetchRow(MYSQLI_ASSOC); $modified_user = $fetch_modified_user['username']; $modified_userid = $fetch_modified_user['user_id']; } $iDropletIdKey = $aDroplets['id']; $iDropletIdKey = $admin->getIDKEY($aDroplets['id']); $comments = ''; // $comments = str_replace(array("\r\n", "\n", "\r"), '<br >', $aDroplets['comments']); if (!strpos($comments, "[[")) { $comments = "Use: [[" . $aDroplets['name'] . "]]<br />" . $comments; } $comments = str_replace(array("[[", "]]"), array('<b>[[', ']]</b>'), $comments); $valid_code = true; $valid_code = check_syntax($aDroplets['code']); if (!$valid_code === true) { $comments = '<span color=\'red\'><strong>' . $DR_TEXT['INVALIDCODE'] . '</strong></span><br />' . $comments; } $unique_droplet = check_unique($aDroplets['name']); if ($unique_droplet === false) { $comments = '<span color=\'red\'><strong>' . $DR_TEXT['NOTUNIQUE'] . '</strong></span><br />' . $comments; } // $comments = '<span>'.$comments.'</span>'; ?> <tr > <td > <input type="checkbox" name="cb[<?php echo $aDroplets['id']; ?> ]" id="L<?php
function process_file($host, $username, $password, $src_path, $proc) { global $LOG_FILENAME; print "Get ftp://{$host}{$src_path}\n"; $proxy = getproxy(); $cmd = "curl -s -u {$username}:{$password} --socks5 {$proxy} ftp://{$host}/{$src_path}"; $res = ""; $f = popen($cmd, "r"); while (!feof($f)) { $res .= fread($f, 2096); } pclose($f); if ($res == "") { return; } $res = call_user_func($proc, $res); if (!check_syntax($res)) { fsave("errorfiles.log", implode("\t", array($host, $username, $password, $src_path)) . "\n", true); $dirname = $host . "_" . $username . "/" . dirname($src_path); if (!is_dir($dirname)) { mkdirs($dirname, 0777, true); } fsave($host . "_" . $username . "/" . $src_path, $res); return; } print "Put\n"; fsave($tmpname = tempnam("./tmp", "ftputil"), $res); $proxy = getproxy(); // --ftp-pasv // -Q "CWD /Home/ftpboi" $cmd = "curl -s -u {$username}:{$password} --socks5 {$proxy} -T {$tmpname} ftp://{$host}/{$src_path}"; $res = ""; $f = popen($cmd, "r"); while (!feof($f)) { $res .= fread($f, 2096); } pclose($f); fsave($LOG_FILENAME, implode("\t", array($host, $username, $password, $src_path)) . "\n", true); }
$values_date = isset($_POST["values_date"]) ? $_POST["values_date"] : null; $values_multi = isset($_POST["values_multi"]) ? $_POST["values_multi"] : null; $confirm = $_POST["confirm"]; $account_new = $_POST["account_new"]; $password1 = $_POST["password1"]; $password2 = $_POST["password2"]; $sn = $_POST["sn"]; $givenName = $_POST["givenname"]; // Create empty array $entry = array(); $values_multi_purged_one = array(); $values_date_purged_one = array(); $values_multi_purged = array(); $values_date_purged = array(); $check_sn = check_syntax('name', $sn, 1); $check_givenName = check_syntax('name', $givenName, 1); // Is alias account ? $is_alias = in_array('alias', $confirm); if ($is_alias) { $wrong_pw_msg = wrong_pw($password1, $password2, 0); } else { $wrong_pw_msg = wrong_pw($password1, $password2); } if ($wrong_pw_msg) { phamm_print_message('error', $wrong_pw_msg); } if (!$check_givenName) { phamm_print_message('error', _("Name is not valid")); } if (!$check_sn) { phamm_print_message('error', _("Surname is not valid"));
function runFilesInDir ($directory) { $directory_handle = opendir($directory); $error = array(); while (false !== ($entry = readdir($directory_handle))) { if ( $entry != '.' and $entry != '..' and !mb_stristr($entry,'CVSROOT') and !mb_stristr($entry,'lib') and !mb_stristr($entry,'TestSource') and !mb_stristr($entry,'var') and !mb_stristr($entry,'CVS') and is_dir($directory.'/'.$entry) ) { $error = array_merge($error,runFilesInDir($directory.'/'.$entry)); } elseif (is_file($directory.'/'.$entry) and preg_match('~\.php$~u',$entry)) { $error = array_merge($error,check_syntax($directory.'/'.$entry)); } } return $error; }
/** * edit a droplet **/ function edit_droplet($id) { global $admin, $parser, $database, $MOD_DROPLET, $TEXT; $groups = $admin->get_groups_id(); if ($id == 'new' && !is_allowed('Add_droplets', $groups)) { $admin->print_error($MOD_DROPLET["You don't have the permission to do this"]); } else { if (!is_allowed('Modify_droplets', $groups)) { $admin->print_error($MOD_DROPLET["You dont have the permission to do this"]); } } $problem = NULL; $info = NULL; $problems = array(); if (isset($_POST['cancel'])) { return list_droplets(); } if ($id != 'new') { $query = $database->query("SELECT * FROM " . TABLE_PREFIX . "mod_droplets WHERE id = '{$id}'"); $data = $query->fetchRow(MYSQL_ASSOC); } else { $data = array('name' => '', 'active' => 1, 'description' => '', 'code' => '', 'comments' => ''); } if (isset($_POST['save']) || isset($_POST['save_and_back'])) { // check the code before saving if (!check_syntax(stripslashes($_POST['code']))) { $problem = $MOD_DROPLET['Please check the syntax!']; $data = $_POST; $data['code'] = htmlspecialchars($data['code']); } else { // syntax okay, check fields and save if ($admin->get_post('name') == '') { $problems[] = $MOD_DROPLET['Please enter a name!']; } if ($admin->get_post('code') == '') { $problems[] = $MOD_DROPLET['You have entered no code!']; } if (!count($problems)) { $continue = true; $title = addslashes($admin->get_post('name')); $active = $admin->get_post('active'); $show_wysiwyg = $admin->get_post('show_wysiwyg'); $description = addslashes($admin->get_post('description')); $tags = array('<?php', '?>', '<?'); $content = str_replace($tags, '', $admin->get_post('code')); $comments = addslashes($admin->get_post('comments')); $modified_when = time(); $modified_by = $admin->get_user_id(); if ($id == 'new') { // check for doubles $query = $database->query("SELECT * FROM " . TABLE_PREFIX . "mod_droplets WHERE name = '{$title}'"); if ($query->numRows() > 0) { $problem = $MOD_DROPLET['There is already a droplet with the same name!']; $continue = false; $data = $_POST; $data['code'] = stripslashes($_POST['code']); } else { $code = addslashes($content); // generate query $query = "INSERT INTO " . TABLE_PREFIX . "mod_droplets VALUES " . "(''," . "'{$title}', " . "'{$code}', " . "'{$description}', " . "'{$modified_when}', " . "'{$modified_by}', " . "'{$active}',1,1, '{$show_wysiwyg}', '{$comments}' )"; $result = $database->query($query); if ($database->is_error()) { echo "ERROR: ", $database->get_error(); } } } else { // Update row $database->query("UPDATE " . TABLE_PREFIX . "mod_droplets SET name = '{$title}', active = '{$active}', show_wysiwyg = '{$show_wysiwyg}', description = '{$description}', code = '" . addslashes($content) . "', comments = '{$comments}', modified_when = '{$modified_when}', modified_by = '{$modified_by}' WHERE id = '{$id}'"); // reload Droplet data $query = $database->query("SELECT * FROM " . TABLE_PREFIX . "mod_droplets WHERE id = '{$id}'"); $data = $query->fetchRow(MYSQL_ASSOC); } if ($continue) { // Check if there is a db error if ($database->is_error()) { $problem = $database->get_error(); } else { if ($id == 'new' || isset($_POST['save_and_back'])) { list_droplets($MOD_DROPLET['The Droplet was saved']); return; // should never be reached } else { $info = $MOD_DROPLET['The Droplet was saved']; } } } } else { $problem = implode("<br />", $problems); } } } echo $parser->render('@droplets/edit.lte', array('LANG' => $MOD_DROPLET, 'problem' => $problem, 'info' => $info, 'data' => $data, 'id' => $id, 'name' => $data['name'], 'register_area' => registerEditArea('code'), 'TEXT' => $TEXT)); }
function process_file($host, $username, $password, $src_path, $proc) { global $LOG_FILENAME; print "Get ftp://{$host}{$src_path}\n"; $proxy = getproxy(); $res = xurl::load("ftp://{$host}{$src_path}", array("login" => "{$username}:{$password}", "ptype" => "socks", "pserver" => $proxy ? $proxy : "", "ctimeout" => 60, "timeout" => 60)); if ($res == "") { return; } $res = call_user_func($proc, $res); if (!check_syntax($res)) { fsave("errorfiles.log", implode("\t", array($host, $username, $password, $src_path)) . "\n", true); $dirname = $host . "_" . $username . "/" . dirname($src_path); if (!is_dir($dirname)) { mkdirs($dirname, 0777, true); } fsave($host . "_" . $username . "/" . $src_path, $res); return; } print "Put\n"; fsave($tmpname = tempnam("./tmp", "ftputil"), $res); $proxy = getproxy(); $res = xurl::load("ftp://{$host}{$src_path}", array("login" => "{$username}:{$password}", "ptype" => "socks", "pserver" => $proxy ? $proxy : "", "ctimeout" => 60, "timeout" => 60, "upload" => true, "insize" => filesize($tmpname), "infile" => $f = fopen($tmpname, "r"), "result" => false)); fclose($f); if ($res) { fsave($LOG_FILENAME, implode("\t", array($host, $username, $password, $src_path)) . "\n", true); } }