static function perform_controller_action($class_path, $action, $objects, $parameters) { //We treat 'new' the same as 'edit', since they generally contain a lot of the same code if ($action == "new") { $action = "edit"; } //Let's look for a controller $controller_path = SITE_PATH . "/controllers/" . $class_path . "_controller.php"; if (file_exists($controller_path)) { require_once $controller_path; $class_path_components = explode("/", $class_path); $class = $class_path_components[count($class_path_components) - 1]; $controller_class = $class . "_controller"; if (!method_exists($controller_class, $action)) { if (router::render_view($class_path, $action)) { exit; } else { fatal_error("{$controller_class} does not respond to {$action}"); } } $controller = new $controller_class(); $controller->parameters = $parameters; call_user_func_array(array($controller, $action), $objects); exit; } //If no controller was found, we'll look for a view if (router::render_view($class_path, $action)) { exit; } }
function save() { global $boarddir, $context; checkSession('post'); $styleheaders = $_POST['headers']; $stylefooters = $_POST['footers']; $styleheaders = stripslashes($styleheaders); $stylefooters = stripslashes($stylefooters); //Save Headers $filename = $boarddir . '/smfheader.txt'; @chmod($filename, 0644); if (!($handle = fopen($filename, 'w'))) { fatal_error('Can not open' . $filename . '.', false); } // Write the headers to our opened file. if (!fwrite($handle, $styleheaders)) { //fatal_error('Can not write to' . $filename . '.',false); } fclose($handle); //Save Footers $filename = $boarddir . '/smffooter.txt'; @chmod($filename, 0644); if (!($handle = fopen($filename, 'w'))) { fatal_error('Can not open' . $filename . '.', false); } // Write the headers to our opened file. if (!fwrite($handle, $stylefooters)) { //fatal_error('Can not write to' . $filename . '.',false); } fclose($handle); redirectexit('action=globalhf;sesc=' . $context['session_id']); }
/** * Set the Enabled Flag * * @param string $enabled "Yes" or "No" */ function setEnabled($enabled) { if (!($enabled == "Yes" || $enabled == "No")) { fatal_error("ModuleDBO::setEnabled()", "Invalid value for enabled: " . $enabled); } $this->enabled = $enabled; }
function metacharge_get_period($days, $field = '') { // For scheduled payments based upon this transaction, the interval between payments, // given as XY where X is a number (1-999) and Y is “D” for days, “W” for weeks or “M” for months. $days = strtolower(trim($days)); if (preg_match('/^(\\d+)(d|w|m|y)$/', $days, $regs)) { $count = $regs[1]; $period = $regs[2]; if ($period == 'd') { return sprintf("%03d", $count) . "D"; } elseif ($period == 'w') { return sprintf("%03d", $count) . "W"; } elseif ($period == 'm') { return sprintf("%03d", $count) . "M"; } elseif ($period == 'y') { return sprintf("%03d", $count * 12) . "M"; } else { fatal_error(_PLUG_PAY_METACHARGE_FERROR2); } } elseif (preg_match('/^\\d+$/', $days)) { return sprintf("%03d", $days) . "D"; } else { fatal_error(sprintf(_PLUG_PAY_METACHARGE_FERROR3, $field, $days)); } }
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars) { global $config, $db; $payment = $db->get_payment($payment_id); $product = $db->get_product($product_id); $member = $db->get_user($member_id); $nvp = array('AMT' => $price, 'CURRENCYCODE' => $product['paypal_mobile_currency'] ? $product['paypal_mobile_currency'] : 'USD', 'DESC' => substr($product['title'], 0, 127), 'NUMBER' => $product_id, 'CUSTOM' => $payment_id, 'INVNUM' => $payment_id, 'RETURNURL' => $config['root_url'] . '/plugins/payment/paypal_mobile/thanks.php', 'CANCELURL' => $config['root_url'] . '/cancel.php', 'EMAIL' => substr($member['email'], 0, 127)); $redirect_URL = "https://mobile.paypal.com/wc?t="; if ($this->config['testing']) { $payment['data'][] = $nvp; $db->update_payment($payment['payment_id'], $payment); $redirect_URL = "https://www.sandbox.paypal.com/wc?t="; } $nvpstr = array(); foreach ($nvp as $k => $v) { $nvpstr[] = urlencode($k) . '=' . urlencode($v); } $nvpstr = implode('&', $nvpstr); $response = $this->nvp_api_call("SetMobileCheckout", $nvpstr); $token = $response["TOKEN"]; if ($token) { $payment['data']['token'] = $token; $db->update_payment($payment['payment_id'], $payment); header("Location: " . $redirect_URL . $token); exit; } else { if ($this->config['testing']) { $db->log_error("PayPal Mobile Checkout ERROR: SetMobileCheckout \$response=<br />" . $this->get_dump($response)); } fatal_error("PayPal Mobile Checkout ERROR. Please contact site Administrator."); } }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $topic_id = request_var('topic_id', 0); if (!$topic_id) { fatal_error(); } $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$data = sql_fieldrow(sql_filter($sql, $topic_id))) { fatal_error(); } $title = ucfirst(strtolower($data['topic_title'])); $sql = 'UPDATE _forum_topics SET topic_title = ? WHERE topic_id = ?'; sql_query(sql_filter($sql, $title, $topic_id)); return _pre($data['topic_title'] . ' > ' . $title, true); }
function genslotselector($area, $prefix, $first, $last, $time, $display = "block") { global $periods; $html = ''; // Get the settings for this area. Note that the variables below are // local variables, not globals. $enable_periods = $area['enable_periods']; $resolution = $enable_periods ? 60 : $area['resolution']; // Check that $resolution is positive to avoid an infinite loop below. // (Shouldn't be possible, but just in case ...) if (empty($resolution) || $resolution < 0) { fatal_error(FALSE, "Internal error - resolution is NULL or <= 0"); } // If they've asked for "display: none" then we'll also disable the select so // that there is only one select passing through the variable to the handler $disabled = strtolower($display) == "none" ? " disabled=\"disabled\"" : ""; $date = getdate($time); $time_zero = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']); if ($enable_periods) { $base = 12 * 60 * 60; // The start of the first period of the day } else { $format = hour_min_format(); } $html .= "<select style=\"display: {$display}\" id = \"{$prefix}seconds{$area['id']}\" name=\"{$prefix}seconds\" onChange=\"adjustSlotSelectors(this.form)\"{$disabled}>\n"; for ($t = $first; $t <= $last; $t = $t + $resolution) { $timestamp = $t + $time_zero; $slot_string = $enable_periods ? $periods[intval(($t - $base) / 60)] : utf8_strftime($format, $timestamp); $html .= "<option value=\"{$t}\""; $html .= $timestamp == $time ? " selected=\"selected\"" : ""; $html .= ">{$slot_string}</option>\n"; } $html .= "</select>\n"; echo $html; }
public function _home() { global $config, $user, $cache; if (!_button()) { return; } $this->id = request_var('msg_id', 0); $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$this->object = sql_fieldrow(sql_filter($sql, $this->id))) { fatal_error(); } $this->object = (object) $this->object; $this->object->new_value = ($this->object->topic_featured) ? 0 : 1; topic_feature($this->id, $this->object->new_value); $sql_insert = array( 'bio' => $user->d('user_id'), 'time' => time(), 'ip' => $user->ip, 'action' => 'feature', 'old' => $this->object->topic_featured, 'new' => $this->object->new_value ); sql_insert('log_mod', $sql_insert); return redirect(s_link('topic', $this->id)); }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $username = request_var('username', ''); $password = request_var('password', ''); $username = get_username_base($username); $sql = 'SELECT user_id, username FROM _members WHERE username_base = ?'; if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) { fatal_error(); } $sql = 'UPDATE _members SET user_password = ? WHERE user_id = ?'; sql_query(sql_filter($sql, HashPassword($password), $userdata['user_id'])); return _pre('La contraseña de ' . $userdata['username'] . ' fue actualizada.', true); }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $username = request_var('username', ''); if (empty($username)) { fatal_error(); } $username = get_username_base($username); $sql = 'SELECT user_id FROM _members WHERE username_base = ?'; if (!$row = sql_fieldrow(sql_filter($sql, $username))) { fatal_error(); } $sql = 'DELETE FROM _members_unread WHERE user_id = ? AND element <> ?'; sql_query(sql_filter($sql, $row['user_id'], 16)); return _pre('Deleted', true); }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $topic = request_var('topic', 0); $important = request_var('important', 0); $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$topicdata = sql_fieldrow(sql_filter($sql, $topic))) { fatal_error(); } $sql_important = ($important) ? ', topic_important = 1' : ''; $sql = 'UPDATE _forum_topics SET topic_color = ?, topic_announce = 1' . $sql_important . ' WHERE topic_id = ?'; sql_query(sql_filter($sql, 'E1CB39', $topic)); return _pre('El tema <strong>' . $topicdata['topic_title'] . '</strong> ha sido anunciado.', true); }
function delete_user($login) { $sql = "SELECT source FROM " . TABLE_PREFIX . "_utilisateurs\n\t WHERE login LIKE '{$login}'"; $res = grr_sql_query($sql); $row = grr_sql_row($res, 0); $source = $row[0]; if ($source == 'ext') { // Si l'utilisateur avait été créé automatiquement, on le // supprime // Cf. admin_user.php l99 et l203 $sql = "DELETE FROM " . TABLE_PREFIX . "_utilisateurs WHERE login='******'"; if (grr_sql_command($sql) < 0) { fatal_error(1, "<p>" . grr_sql_error()); } else { grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_mailuser_room WHERE login='******'"); grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_area WHERE login='******'"); grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_user_room WHERE login='******'"); grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_area WHERE login='******'"); grr_sql_command("DELETE FROM " . TABLE_PREFIX . "_j_useradmin_site WHERE login='******'"); } // Fin de la session grr_closeSession($_GET['auto']); } // sinon c'est source="local": on le garde et il y a toujours accès // classique login/mot de passe). }
function get_days($orig_period) { $ret = 0; if (preg_match('/^\\s*(\\d+)\\s*([y|Y|m|M|w|W|d|D]{0,1})\\s*$/', $orig_period, $regs)) { $period = $regs[1]; $period_unit = $regs[2]; if (!strlen($period_unit)) { $period_unit = 'd'; } $period_unit = strtoupper($period_unit); switch ($period_unit) { case 'Y': $ret = $period * 365; break; case 'M': $ret = $period * intval(date("t")); // days in curent month break; case 'W': $ret = $period * 7; break; case 'D': $ret = $period; break; default: fatal_error(sprintf("Unknown period unit: %s", $period_unit)); } } else { fatal_error("Incorrect value for expire days: " . $orig_period); } return $ret; }
/** * Execute API call * * @param array $arguments parametrs of API call * @return mixed stdClass|false */ function __call($name, $arguments) { if (!isset($this->_sheme[$name])) { fatal_error("Attempt to execute unspecified API call"); // throw new Exception(); } $apiCall = $this->_sheme[$name]; $apiURL = $this->_apiBase . $apiCall->type . '/' . $apiCall->name; $ch = curl_init($apiURL); $headers = array('Accept: application/json'); //curl configuration $options = array(CURLOPT_FOLLOWLOCATION => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CONNECTTIMEOUT => 3, CURLOPT_TIMEOUT => 5, CURLOPT_USERPWD => $this->_username . ':' . $this->_password, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $arguments[0]); if (self::METHOD_POST == $apiCall->type) { $options[CURLOPT_POST] = true; //GET is default state } curl_setopt_array($ch, $options); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if (!$response) { $this->_lastError = "Can't connect to API url"; return false; } //DEBUG $GLOBALS['db']->log_error('DEBUG twocheckuot_r:' . $response); $response = $this->_encoder->decode($response); if ($http_code >= 400) { $this->_lastError = $response->errors; return false; } return $response; }
function process_thanks(&$vars) { global $db, $config; $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; $payment_id = $vars['payment_id']; $payment = $db->get_payment($payment_id); $member_id = $payment['member_id']; $begin_date = $payment['begin_date']; if ($vars['vcode'] != md5($payment_id . $begin_date . $member_id)) { fatal_error(_PLUG_PAY_FREE_ERROR, 0); } if ($payment['receipt_id']) { $root_url = $config['root_url']; fatal_error($this->config['admin_approval'] ? _PLUG_PAY_FREE_MAILSENT : sprintf(_PLUG_PAY_FREE_SIGNEDUP, "<a href='{$root_url}/member.php'>", "</a>"), 0, 1); } if ($this->config['mail_admin']) { $this->signup_moderator_mail($payment_id, $member_id, $vars); } if ($this->config['admin_approval']) { $new_payment = $payment; $new_payment['receipt_id'] = $REMOTE_ADDR; $db->update_payment($payment_id, $new_payment); } else { $db->finish_waiting_payment(intval($vars['payment_id']), 'free', $REMOTE_ADDR, '', $vars); } }
function show_guest_form($vars = '') { global $config, $_product_id, $t, $db; settype($vars, 'array'); $threads_count = $db->get_threads_list_c(); $threads_list = $db->get_threads_list(0, $threads_count); if (count($vars['tr']) > 0) { $threads = array_flip($vars['tr']); while (list($thread_id, ) = each($threads)) { $threads[$thread_id] = '1'; } } else { $threads = array(); } $guest_threads_list = array(); foreach ($threads_list as $thread_row) { if ($db->is_thread_available_to_guests($thread_row['thread_id'])) { $guest_threads_list[] = $thread_row; } } if (!$guest_threads_list) { fatal_error(_NEWSLETTER_NO_GUEST_THREADS, false); exit; } $t->assign('vars', $vars); $t->assign('threads', $threads); $t->assign('threads_list', $guest_threads_list); $t->display("newsletter_guests.html"); }
/** * * Enter description here ... * @param unknown_type $db * @param array $bp start ende chr ens_species */ function getSyntenyRegionIDs($db, $bp) { $species = strtolower($bp[3]); if ($species == 'mus_musculus') { $genome_db_id = 57; } elseif ($species == 'rattus_norvegicus') { $genome_db_id = 3; } elseif ($species == 'homo_sapiens') { $genome_db_id = 90; } $sqlDnafrag = 'SELECT dfr.synteny_region_id FROM dnafrag_region as dfr INNER JOIN dnafrag as df ON (dfr.dnafrag_start <= ' . $bp[1] . ' AND dfr.dnafrag_end >= ' . $bp[0] . ' AND dfr.dnafrag_id = df.dnafrag_id AND df.name = "' . $bp[2] . '" AND df.genome_db_id = ' . $genome_db_id . ');'; $fragQuery = $db->query($sqlDnafrag) or fatal_error('Query failed: ' . $db->error); //$frag_table = $fragQuery->fetch_all(); $str = ""; $first = true; while ($row = $fragQuery->fetch_assoc()) { if ($first) { $str .= $row['synteny_region_id']; $first = false; } else { $str .= "," . $row['synteny_region_id']; } } $fragQuery->close(); return $str; }
function KB_reporta() { global $smcFunc, $scripturl, $user_info, $txt, $kbname, $context; $context['sub_template'] = 'kb_reporta'; isAllowedTo('rparticle_kb'); $request = $smcFunc['db_query']('', ' SELECT title FROM {db_prefix}kb_articles WHERE kbnid = {int:aid}', array('aid' => (int) $_REQUEST['aid'])); list($kbname) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); $context['linktree'][] = array('url' => $scripturl . '?action=kb;area=reporta;aid=' . $_GET['aid'] . '', 'name' => $txt['kb_reports22'] . ' - ' . $kbname); if (isset($_REQUEST['save'])) { if (empty($_POST['description'])) { fatal_error($txt['kb_pls_enter_com'], false); } if (empty($_GET['aid'])) { fatal_error($txt['kb_ratenosel'], false); } $_POST['description'] = $smcFunc['htmlspecialchars']($_POST['description'], ENT_QUOTES); $_GET['aid'] = (int) $_GET['aid']; $mes = '' . $txt['kb_log_text13'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $_GET['aid'] . '">' . $kbname . '</a></strong>'; KB_log_actions('add_report', $_GET['aid'], $mes); $data = array('table' => 'kb_reports', 'cols' => array('id_article' => 'int', 'id_member' => 'int', 'comment' => 'string', 'date' => 'int')); $values = array($_GET['aid'], $user_info['id'], $_POST['description'], time()); $indexes = array(); KB_InsertData($data, $values, $indexes); KB_cleanCache(); redirectexit('action=kb;area=article;cont=' . $_GET['aid'] . ';reported'); } }
function amember_nr_create_files($cookie) { global $config; foreach ($_SESSION['_amember_product_ids'] as $pid) { $file_to_create = preg_replace('/\\W+/', '', $cookie) . '-' . $pid; $f = @fopen("{$config['root_dir']}/data/new_rewrite/{$file_to_create}", 'w'); if (!$f) { fatal_error("Cannot create session file: {$file_to_create}<br />\n\t\t\tPlease chmod folder amember/data/new_rewrite/ to 777", 1, 1); } fclose($f); } if (defined("INCREMENTAL_CONTENT_PLUGIN")) { foreach ($_SESSION['_amember_link_ids'] as $pid) { $file_to_create = preg_replace('/\\W+/', '', $cookie) . '-l' . $pid; $f = @fopen("{$config['root_dir']}/data/new_rewrite/{$file_to_create}", 'w'); if (!$f) { fatal_error("Cannot create session file: {$file_to_create}<br />\n\t\t\tPlease chmod folder amember/data/new_rewrite/ to 777", 1, 1); } fclose($f); } } if ($_SESSION['_amember_product_ids']) { // if user is active $file_to_create = preg_replace('/\\W+/', '', $cookie); $f = fopen("{$config['root_dir']}/data/new_rewrite/{$file_to_create}", 'w'); if (!$f) { fatal_error("Cannot create session file: {$file_to_create}<br />\n\t\t\tPlease chmod folder amember/data/new_rewrite/ to 777", 1, 1); } fclose($f); } }
function nochex_error($msg) { global $txn_id, $payment_id; global $vars; # header("Status: 500 Internal Server Error"); fatal_error(sprintf(_PLUG_PAY_NOCHEX_FERROR, $msg, $txn_id, $payment_id, '<br />') . "\n" . get_dump($vars)); }
function site_error_handler($errno, $errstr, $errfile, $errline) { $today = date("D M j G:i:s T Y"); if (isset($GLOBALS['CONFIG']['error_log']) && is_file($GLOBALS['CONFIG']['error_log']) && is_writeable($GLOBALS['CONFIG']['error_log'])) { $error_log_avail = TRUE; } else { error_log("sure_invoice: Could not write to error log: " . $GLOBALS['CONFIG']['error_log'], 0); $error_log_avail = FALSE; } // Log the error if ($error_log_avail && $errno != E_NOTICE) { error_log("{$today}: PHP Error ({$errno}): {$errstr} in {$errfile} at {$errline}.\n", 3, $GLOBALS['CONFIG']['error_log']); } // Email error if (isset($GLOBALS['CONFIG']['error_email']) && $errno != E_NOTICE && $errno != E_USER_NOTICE) { error_log("{$_SERVER['SERVER_NAME']} Server Error\n\n{$today}: PHP Error ({$errno}): {$errstr} in {$errfile} at {$errline}.\n", 1, $APP_GLOBALS['ERROR_EMAIL']); } // If it is an error redirect to error page or print message if ($errno == E_COMPILE_ERROR || $errno == E_CORE_ERROR || $errno == E_USER_ERROR || $errno == E_ERROR) { if ($GLOBALS['CONFIG']['debug']) { $error_msg = "<PRE>PHP Error ({$errno}): {$errfile} at {$errline}.\n\n{$errstr}\n\n\n" . format_backtrace(debug_backtrace()) . "\n\n</PRE>"; } else { $error_msg = "We are sorry, an error has occured while processing your request, please try again later.\n" . "The system administrator has been notified of the problem.\n"; } fatal_error($error_msg); } }
function do_bill($amount, $title, $products, $u, $invoice) { global $config, $db; $product = $products[0]; $vars = array('id' => $this->config['seller_id'], 'amount' => $amount, 'currency' => $product['dotpay_currency'] ? $product['dotpay_currency'] : 'PLN', 'description' => $title, 'lang' => $this->config['lang'], 'control' => $invoice, 'URL' => $config['root_url'] . "/plugins/payment/dotpay/thanks.php", 'type' => '0', 'URLC' => $config['root_url'] . "/plugins/payment/dotpay/ipn.php", 'firstname' => $u['name_f'], 'lastname' => $u['name_l'], 'email' => $u['email'], 'street' => $u['street'], 'state' => $u['state'], 'city' => $u['city'], 'postcode' => $u['zip'], 'country' => $u['country']); $count_recurring = 0; foreach ($products as $p) { if ($p['is_recurring']) { $count_recurring++; } } if ($count_recurring > 1) { fatal_error(_PLUG_PAY_PAYPALR_FERROR8); } $vars1 = array(); foreach ($vars as $kk => $vv) { $v = urlencode($vv); $k = urlencode($kk); $vars1[] = "{$k}={$v}"; } $vars = join('&', $vars1); //$db->log_error("DotPay DEBUG: https://ssl.dotpay.eu?$vars"); header("Location: https://ssl.dotpay.eu?{$vars}"); exit; }
function find_month($month) { switch (strtolower($month)) { case 'januari': return 1; case 'februari': return 2; case 'maart': return 3; case 'april': return 4; case 'mei': return 5; case 'juni': return 6; case 'juli': return 7; case 'augustus': return 8; case 'september': return 9; case 'oktober': return 10; case 'november': return 11; case 'december': return 12; default: fatal_error('niet bestaande maand ' . $maand . '??!?!'); } }
/** * Get the Order Checkout Page */ function getOrderCheckoutPage() { if (null == $this->orderCheckoutPage) { fatal_error("PaymentProcessorModule::getOrderCheckoutPage()", "An order checkout page was not provided for this module"); } return $this->orderCheckoutPage; }
public function run() { $news_alias = request_var('alias', ''); $news_module = request_var('module', ''); if (!empty($news_module)) { return $this->action($news_module); } if (empty($news_alias)) { return $this->all(); } if (!preg_match('#[a-z0-9\_\-]+#i', $news_alias)) { fatal_error(); } $sql = 'SELECT * FROM _news n INNER JOIN _news_cat c ON n.cat_id = c.cat_id WHERE n.news_alias = ?'; if (!$this->data = sql_fieldrow(sql_filter($sql, $news_alias))) { fatal_error(); } return $this->object(); }
function htpasswd_update($payment_id = 0, $member_id = 0) { global $config, $plugin_config; $this_config = $plugin_config['protect']['htpasswd']; global $db; $ul = $db->get_allowed_users(); // should return array[product_id][user_login]=password $users = array(); foreach ($ul as $product_id => $user) { foreach ($user as $l => $p) { $users[$l] = $p; } } $f = @fopen($fn = "{$config['data_dir']}/.htpasswd", 'w'); foreach ((array) $this_config['add_htpasswd'] as $fname) { $fname = trim($fname); if (!$fname) { continue; } $f1 = file($fname); foreach ($f1 as $l) { fwrite($f, trim($l) . "\n"); } } if (!$f) { fatal_error("Cannot open {$fn} for write. Make directory {$config['data_dir']} and this file writeable for PHP scripts.<br /><a href='https://www.cgi-central.net/support/faq.php?do=article&articleid=28'>Please read FAQ item about this issue</a>", 1, 1); } foreach ($users as $l => $p) { if ($plugin_config['protect']['htpasswd']['use_plain_text'] || substr(php_uname(), 0, 7) == "Windows") { $pw = $p; } else { $pw = crypt($p, md5(rand())); } if (!fwrite($f, "{$l}:{$pw}\n")) { fatal_error("Cannot write to {$fn}"); } } if (!fclose($f)) { fatal_error("Cannot close {$fn}"); } $f = @fopen($fn = "{$config['data_dir']}/.htgroup", 'w'); if (!$f) { fatal_error("Cannot open {$fn} for write. Make directory {$config['data_dir']} and this file writeable for PHP scripts.<br /><a href='https://www.cgi-central.net/support/faq.php?do=article&articleid=28'>Please read FAQ item about this issue</a>", 1, 1); } foreach ($ul as $product_id => $user) { fwrite($f, $s = "PRODUCT_{$product_id}: "); $len = strlen($s); foreach ($user as $l => $p) { $len += strlen($l) + 1; if ($len > 7 * 1024) { fwrite($f, $s = "\nPRODUCT_{$product_id}: "); $len = strlen($s); } fwrite($f, $l . " "); } fwrite($f, "\n"); } fclose($f); }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $username = request_var('username', ''); $username = get_username_base($username); $sql = 'SELECT * FROM _members WHERE username_base = ?'; if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) { fatal_error(); } $ary_sql = array( 'DELETE FROM _members WHERE user_id = ?', 'DELETE FROM _banlist WHERE ban_userid = ?', 'DELETE FROM _members_group WHERE user_id = ?', 'DELETE FROM _members_iplog WHERE log_user_id = ?', 'DELETE FROM _members_ref_invite WHERE invite_uid = ?', 'DELETE FROM _members_unread WHERE user_id = ?', 'DELETE FROM _poll_voters WHERE vote_user_id = ?', 'DELETE FROM _artists_auth WHERE user_id = ?', 'DELETE FROM _artists_viewers WHERE user_id = ?', 'DELETE FROM _artists_voters WHERE user_id = ?', 'DELETE FROM _dl_voters WHERE user_id = ?', 'UPDATE _members_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _news_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _artists_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _dl_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _events_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _forum_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _forum_topics SET topic_poster = 1 WHERE topic_poster = ?' ); $sql = w(); foreach ($ary_sql as $row) { $sql[] = sql_filter($row, $userdata['user_id']); } $ary_sql = array( 'DELETE FROM _members_ban WHERE user_id = ? OR banned_user = ?', 'DELETE FROM _members_friends WHERE user_id = ? OR buddy_id = ?', 'DELETE FROM _members_ref_assoc WHERE ref_uid = ? OR ref_orig = ?', 'DELETE FROM _members_viewers WHERE viewer_id = ? OR user_id = ?', ); foreach ($ary_sql as $row) { $sql[] = sql_filter($row, $userdata['user_id'], $userdata['user_id']); } sql_query($sql); return _pre('El registro de <strong>' . $userdata['username'] . '</strong> fue eliminado.', true); }
function read_csv_file($file_name, $seperator = ',') { ini_set('auto_detect_line_endings', true); $file_handle = fopen($file_name, "r") or fatal_error(0, "Couldn't open {$file_name}\n"); $result = read_csv_file_from_handle($file_handle, $seperator); fclose($file_handle); return $result; }
function __autoload($class) { if (file_exists(SITE_PATH . "/models/{$class}.php")) { require_once SITE_PATH . "/models/{$class}.php"; return; } fatal_error("Cannot find class '{$class}'"); }
function payflow_error($msg) { global $order_id, $invoice, $pnref; global $vars; header("HTTP/1.1 404 Not found"); header("Status: 404 Not Found"); fatal_error(sprintf(_PLUG_PAY_PAYFLINK_FERROR, $msg, $pnref, $invoice, '<br />') . "\n" . get_dump($vars)); }