/** * Get a specific country. * * @param string $code * @return string */ function country($code) { $countries = countries(); return head(array_where($countries, function ($key, $country) use($code) { return strtoupper($key) === strtoupper($code); })); }
/** * Show the edit account registration page. * * @return \Illuminate\View\View */ public function edit() { $account = $this->auth->user(); if ($account->canAcceptPendingRegistration()) { return view('theme::account.registration.edit.accept', compact('account')); } elseif ($account->hasPendingRegistration()) { return view('theme::account.registration.edit.request', compact('account')); } $countries = countries(); $years = $this->years(); return view('theme::account.registration.edit.form', compact('account', 'countries', 'years')); }
/** * Generates a html select with all countries * * @access public * @param string * @param string * @param string * @param mixed * @return string */ function countries_menu($default = 'DZ', $class = '', $name = 'countries', $attributes = '') { $CI =& get_instance(); $default or $default = 'DZ'; $menu = '<select name="' . $name . '"'; if ($class !== '') { $menu .= ' class="' . $class . '"'; } $menu .= _stringify_attributes($attributes) . ">\n"; //foreach (timezones() as $key => $val) foreach (countries() as $key => $val) { $selected = $default === $key ? ' selected="selected"' : ''; $menu .= '<option value="' . $key . '"' . $selected . '>' . _dgettext("system", $val['name']) . "</option>\n"; } return $menu . '</select>'; }
/** * Invoke function that redirects to respective functions */ function invoke() { if (!isset($_GET['return'])) { return; } // intialize the system require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); switch ($_GET['return']) { case 'states': return states($config); case 'countries': return countries($config); default: return; } }
//==country by pdq function countries() { global $mc1; $ret = $mc1->get_value('countries::arr'); if ($ret === false) { $res = sql_query("SELECT id, name, flagpic FROM countries ORDER BY name ASC") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_assoc($res)) { $ret[] = $row; } $mc1->cache_value('countries::arr', $ret, $INSTALLER09['expires']['user_flag']); } return $ret; } $country = ''; $countries = countries(); foreach ($countries as $cntry) { if ($cntry['id'] == $user['country']) { $country = "<td class='embedded'><img src=\"{$INSTALLER09['pic_base_url']}flag/{$cntry['flagpic']}\" alt=\"" . htmlspecialchars($cntry['name']) . "\" style='margin-left: 8pt' /></td>"; break; } } $res = sql_query("SELECT p.torrent, p.uploaded, p.downloaded, p.seeder, t.added, t.name as torrentname, t.size, t.category, t.seeders, t.leechers, c.name as catname, c.image FROM peers p LEFT JOIN torrents t ON p.torrent = t.id LEFT JOIN categories c ON t.category = c.id WHERE p.userid={$id}") or sqlerr(); while ($arr = mysql_fetch_assoc($res)) { if ($arr['seeder'] == 'yes') { $seeding[] = $arr; } else { $leeching[] = $arr; } } $HTMLOUT = '';
function validate_inputs($data) { if (isset($data['email']) && !filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { return array('valid_email'); } if (!countries(0, $data['country'])) { return array('valid_country'); } if (!filter_var($data['website'], FILTER_VALIDATE_URL) && !empty($data['website'])) { return array('valid_url'); } if (isset($data['email']) && $this->verify_if_email_exists($this->id, $data['email'])) { return array('email_exists'); } if (strlen($data['description']) > 160) { return array('profile_description', 160); } if (isset($data['password']) && strlen($data['password']) < 3) { return array('password_too_short'); } }
function form_country_dropdown($name, $settings = array()) { $country_list = countries(); foreach ($country_list as $country) { $cl[$country] = $country; } return form_dropdown($name, $cl, $settings); }
/** * Show the registration form. * * @return \Illuminate\View\View */ public function form() { $countries = countries(); $years = $this->years(); return view('theme::account.registration.create.form', compact('countries', 'years')); }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function getRegister() { $page = 'Registratie'; $countries = countries(); return view('dividers.register', compact('page', 'countries')); }
<?php if ($argv[1] == "--dirs") { parsedirs($argv[2]); die; } if ($argv[1] == "www") { www(); die; } if ($argv[1] == "--countries") { countries(); die; } if ($argv[1] == "--replace") { replacesex(); die; } function www() { for ($i = 0; $i < 150; $i++) { echo "http://client{$i}.dropbox.com\n"; } } importlangs(); function importlangs() { echo "importlangs()\n"; $GLOBALS["langs"] = array("fr", "en", "po", "es", "it", "br", "pol"); while (list($num, $val) = each($GLOBALS["langs"])) { echo "COmpile {$val}\n";
function booking_review_shortcode_handler($atts, $content = null) { $output = ''; if (is_empty_booking()) { empty_booking(); redirect_js_script(get_bloginfo('url')); } $room_type_ID = booking_data('room_type_ID'); $countries = countries(); $nights = count_nights(booking_data('date_in'), booking_data('date_out')); $room_price = booking_data('room_price'); $output .= '<div class="reservation-page animatedParent" data-sequence="500">'; //$output .= get_booking_steps(); $output .= '<div class="row">'; $output .= '<form method="post">'; $output .= '<div class="col-md-4 col-lg-3">'; $output .= '<div class="reservation-sidebar animated fadeInLeft" data-id="1">'; $output .= '<div class="reservation-date bg-gray">'; $output .= '<h2 class="reservation-heading">Dates</h2>'; $output .= '<ul>'; $output .= '<li>'; $output .= '<span>Check-In</span>'; $output .= '<span>' . format_date(booking_data('date_in')) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Check-Out</span>'; $output .= '<span>' . format_date(booking_data('date_out')) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Total Nights</span>'; $output .= '<span>' . $nights . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Total Guests</span>'; $output .= '<span>' . booking_data('no_of_adult') . ' Adults ' . booking_data('no_of_child') . ' Children</span>'; $output .= '</li>'; $output .= '</ul>'; $output .= '</div>'; $output .= '<div class="reservation-room-selected bg-gray">'; $output .= '<h2 class="reservation-heading">Selected Room</h2>'; $output .= '<div class="reservation-room-seleted_item">'; $output .= '<div class="reservation-room-seleted_name has-package">'; $output .= '<h2><a href="' . get_the_permalink($room_type_ID) . '">' . get_the_title($room_type_ID) . '</a></h2>'; $output .= '</div>'; $output .= '<ul>'; $output .= '<li>'; $output .= '<span>Max</span>'; $output .= '<span>' . get_field('max_person', $room_type_ID) . ' Person(s)</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Size</span>'; $output .= '<span>' . get_field('room_size', $room_type_ID) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Bed</span>'; $output .= '<span>' . get_field('bed', $room_type_ID) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Occupancy</span>'; $output .= '<span>' . get_field('occupancy', $room_type_ID) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Room Price</span>'; $output .= '<span>' . nf($room_price) . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Total Nights</span>'; $output .= '<span>x ' . $nights . '</span>'; $output .= '</li>'; $output .= '<li>'; $output .= '<span>Total Rooms</span>'; $output .= '<span> x ' . booking_data('no_of_room') . '</span>'; $output .= '</li>'; $output .= '</ul>'; $output .= '</div>'; $output .= '<div class="reservation-room-seleted_total bg-black">'; $output .= '<label>TOTAL</label>'; $output .= '<span class="reservation-total">' . format_price(booking_data('amount'), false) . '</span>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="col-md-8 col-lg-9">'; $output .= '<div class="reservation_content animated fadeInRight" data-id="2">'; $output .= '<div class="reservation-billing-detail">'; $output .= '<h4>BILLING DETAILS</h4>'; $output .= '<div class="row">'; $output .= '<div class="col-sm-8">'; $output .= '<label>Country <sup>*</sup></label>'; $output .= '<select name="country" class="form-control">'; foreach ($countries as $i => $c) { $output .= '<option value="' . $c . '" ' . selected(booking_data('country'), $c, false) . '>' . $c . '</option>'; } $output .= '</select>'; $output .= '</div>'; $output .= '<div class="col-sm-4">'; $output .= '<label>Salutation <sup>*</sup></label>'; $output .= '<select name="salutation" class="form-control">'; foreach (array('Mr', 'Ms', 'Mrs') as $i => $c) { $output .= '<option value="' . $c . '" ' . selected(booking_data('salutation'), $c, false) . '>' . $c . '</option>'; } $output .= '</select>'; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="row">'; $output .= '<div class="col-sm-4">'; $output .= '<label for="first_name">First Name<sup>*</sup></label>'; $output .= '<input type="text" name="first_name" class="form-control" value="' . booking_data('first_name') . '" required>'; $output .= '</div>'; $output .= '<div class="col-sm-4">'; $output .= '<label for="middle_name">Middle Name<sup>*</sup></label>'; $output .= '<input type="text" name="middle_name" class="form-control" value="' . booking_data('middle_name') . '" required>'; $output .= '</div>'; $output .= '<div class="col-sm-4">'; $output .= '<label for="last_name">Last Name<sup>*</sup></label>'; $output .= '<input type="text" name="last_name" class="form-control" value="' . booking_data('last_name') . '" required>'; $output .= '</div>'; $output .= '</div>'; $output .= '<label>Date of Birth<sup>*</sup></label>'; $output .= '<input type="text" name="birth_date" class="form-control bdr-calendar" value="' . booking_data('birth_date') . '" required readonly>'; $output .= '<label>Nationality<sup>*</sup></label>'; $output .= '<input type="text" name="nationality" class="form-control" value="' . booking_data('nationality') . '" required>'; $output .= '<div class="row">'; $output .= '<div class="col-sm-6">'; $output .= '<label>Email Address<sup>*</sup></label>'; $output .= '<input type="email" name="email_address" class="form-control" value="' . booking_data('email_address') . '">'; $output .= '</div>'; $output .= '<div class="col-sm-6">'; $output .= '<label>Phone<sup>*</sup></label>'; $output .= '<input type="text" name="primary_phone" class="form-control" value="' . booking_data('primary_phone') . '">'; $output .= '</div>'; $output .= '</div>'; $output .= '<label>Address<sup>*</sup></label>'; $output .= '<input type="text" name="address_1" class="form-control" placeholder="Street Address" value="' . booking_data('address_1') . '">'; $output .= '<br><br>'; $output .= '<input type="text" name="address_2" class="form-control" placeholder="Apartment, suite, unit etc. (Optional )" value="' . booking_data('address_2') . '">'; $output .= '<div class="row">'; $output .= '<div class="col-sm-4">'; $output .= '<label>Town / City<sup>*</sup></label>'; $output .= '<input type="text" name="city" class="form-control" value="' . booking_data('city') . '">'; $output .= '</div>'; $output .= '<div class="col-sm-4">'; $output .= '<label>Province<sup>*</sup></label>'; $output .= '<input type="text" name="province" class="form-control" value="' . booking_data('province') . '">'; $output .= '</div>'; $output .= '<div class="col-sm-4">'; $output .= '<label>Zip Code<sup>*</sup></label>'; $output .= '<input type="text" name="zipcode" class="form-control" value="' . booking_data('zipcode') . '">'; $output .= '</div>'; $output .= '</div>'; $output .= '<label>Notes</label>'; $output .= '<textarea type="text" name="notes" class="form-controlarea form-control" placeholder="Notes about your book, eg. special notes for room">' . booking_data('notes') . '</textarea>'; $output .= '<input type="hidden" name="action" value="make_reservation" >'; $output .= '<button type="submit" class="bdr-btn bdr-btn-fill-black">BOOK NOW</button>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</form>'; $output .= '</div>'; $output .= '</div>'; return $output; }
function PageMain() { global $TMPL, $LNG, $CONF, $db, $settings; if (isset($_POST['login'])) { $logInAdmin = new logInAdmin(); $logInAdmin->db = $db; $logInAdmin->url = $CONF['url']; $logInAdmin->username = $_POST['username']; $logInAdmin->password = $_POST['password']; $TMPL['message'] = $logInAdmin->in(); } if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) { $loggedInAdmin = new loggedInAdmin(); $loggedInAdmin->db = $db; $loggedInAdmin->url = $CONF['url']; $loggedInAdmin->username = $_SESSION['usernameAdmin']; $loggedInAdmin->password = $_SESSION['passwordAdmin']; $loggedIn = $loggedInAdmin->verify(); if ($loggedIn['username']) { // Set the content to true, change the $skin to content $content = true; $TMPL_old = $TMPL; $TMPL = array(); $TMPL['url'] = $CONF['url']; if ($_GET['b'] == 'security') { // Security Admin Tab $skin = new skin('admin/security'); $page = ''; if (!empty($_POST)) { $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('admin', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=security&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['password_changed']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('info', $LNG['password_not_changed']); } } elseif ($_GET['b'] == 'social') { // Security Admin Tab $skin = new skin('admin/social'); $page = ''; if (!extension_loaded('openssl')) { $TMPL['message'] .= notificationBox('error', $LNG['openssl_error']); } if (!function_exists('curl_exec')) { $TMPL['message'] .= notificationBox('info', $LNG['curl_error']); } $TMPL['fbappid'] = $settings['fbappid']; $TMPL['fbappsecret'] = $settings['fbappsecret']; if (empty($settings['fbapp'])) { $TMPL['fbappoff'] = ' selected="selected"'; } else { $TMPL['fbappon'] = ' selected="selected"'; } if (!empty($_POST)) { $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('settings', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=social&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=social&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] .= notificationBox('success', $LNG['settings_saved']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] .= notificationBox('info', $LNG['nothing_changed']); } } elseif ($_GET['b'] == 'payments') { $managePayments = new managePayments(); $managePayments->db = $db; $managePayments->url = $CONF['url']; $managePayments->per_page = $settings['rperpage']; if (isset($_GET['id'])) { $skin = new skin('admin/payment'); $page = ''; if (isset($_GET['type'])) { $managePayments->updatePayment($_GET['id'], $_GET['type']); } $TMPL['content'] = $managePayments->getPayment($_GET['id']); // If the payment doens't exist if (empty($TMPL['content'])) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=payments&m=i"); } } else { $skin = new skin('admin/manage_payments'); $page = ''; $TMPL['payments'] = $managePayments->getPayments(0); } if ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('error', $LNG['payment_not_exist']); } } elseif ($_GET['b'] == 'pro') { // Security Admin Tab $skin = new skin('admin/pro'); $page = ''; if (!extension_loaded('openssl')) { $TMPL['message'] .= notificationBox('error', $LNG['openssl_error']); } if (!function_exists('curl_exec')) { $TMPL['message'] .= notificationBox('info', $LNG['curl_error']); } $TMPL['ppuser'] = $settings['paypaluser']; $TMPL['pppass'] = $settings['paypalpass']; $TMPL['ppsign'] = $settings['paypalsign']; $TMPL['currentProMonth'] = $settings['promonth']; $TMPL['currentProYear'] = $settings['proyear']; if (empty($settings['paypalapp'])) { $TMPL['ppappoff'] = ' selected="selected"'; } else { $TMPL['ppappon'] = ' selected="selected"'; } if (empty($settings['paypalsand'])) { $TMPL['ppsandoff'] = ' selected="selected"'; } else { $TMPL['ppsandon'] = ' selected="selected"'; } if ($settings['protracksize'] == '5242880') { $TMPL['aprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '10485760') { $TMPL['bprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '26214400') { $TMPL['cprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '52428800') { $TMPL['dprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '104857600') { $TMPL['eprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '262144000') { $TMPL['fprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '524288000') { $TMPL['gprotrack'] = 'selected="selected"'; } elseif ($settings['protracksize'] == '1073741824') { $TMPL['hprotrack'] = 'selected="selected"'; } else { $TMPL['iprotrack'] = 'selected="selected"'; } if ($settings['protracktotal'] == '104857600') { $TMPL['aprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '209715200') { $TMPL['bprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '314572800') { $TMPL['cprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '524288000') { $TMPL['dprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '1073741824') { $TMPL['eprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '5368709120') { $TMPL['fprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '10737418240') { $TMPL['gprototal'] = 'selected="selected"'; } elseif ($settings['protracktotal'] == '26843545600') { $TMPL['hprototal'] = 'selected="selected"'; } else { $TMPL['iprototal'] = 'selected="selected"'; } if ($settings['tracksize'] == '5242880') { $TMPL['atrack'] = 'selected="selected"'; } elseif ($settings['tracksize'] == '10485760') { $TMPL['btrack'] = 'selected="selected"'; } elseif ($settings['tracksize'] == '26214400') { $TMPL['ctrack'] = 'selected="selected"'; } elseif ($settings['tracksize'] == '52428800') { $TMPL['dtrack'] = 'selected="selected"'; } else { $TMPL['etrack'] = 'selected="selected"'; } if ($settings['currency'] == 'USD') { $TMPL['usd_currency'] = 'selected="selected"'; } elseif ($settings['currency'] == 'EUR') { $TMPL['eur_currency'] = 'selected="selected"'; } else { $TMPL['gbp_currency'] = 'selected="selected"'; } if ($settings['tracksizetotal'] == '104857600') { $TMPL['atotal'] = 'selected="selected"'; } elseif ($settings['tracksizetotal'] == '209715200') { $TMPL['btotal'] = 'selected="selected"'; } elseif ($settings['tracksizetotal'] == '314572800') { $TMPL['ctotal'] = 'selected="selected"'; } elseif ($settings['tracksizetotal'] == '524288000') { $TMPL['dtotal'] = 'selected="selected"'; } else { $TMPL['etotal'] = 'selected="selected"'; } if (!empty($_POST)) { $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('settings', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=pro&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=pro&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] .= notificationBox('success', $LNG['settings_saved']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] .= notificationBox('info', $LNG['nothing_changed']); } } elseif ($_GET['b'] == 'stats') { // Security Admin Tab $skin = new skin('admin/stats'); $page = ''; list($TMPL['tracks_total'], $TMPL['tracks_public'], $TMPL['tracks_private'], $TMPL['comments_total'], $TMPL['users_today'], $TMPL['users_this_month'], $TMPL['users_last_30'], $TMPL['users_total'], $TMPL['total_reports'], $TMPL['pending_reports'], $TMPL['safe_reports'], $TMPL['deleted_reports'], $TMPL['total_tracks_reports'], $TMPL['pending_track_reports'], $TMPL['safe_track_reports'], $TMPL['deleted_track_reports'], $TMPL['total_comment_reports'], $TMPL['pending_comment_reports'], $TMPL['safe_comment_reports'], $TMPL['deleted_comment_reports'], $TMPL['total_likes'], $TMPL['likes_today'], $TMPL['likes_this_month'], $TMPL['likes_last_30'], $TMPL['total_plays'], $TMPL['plays_today'], $TMPL['plays_this_month'], $TMPL['plays_last_30'], $TMPL['total_downloads'], $TMPL['downloads_today'], $TMPL['downloads_this_month'], $TMPL['downloads_last_30'], $TMPL['total_playlists'], $TMPL['playlists_today'], $TMPL['playlists_this_month'], $TMPL['playlists_last_30'], $TMPL['total_payments'], $TMPL['payments_today'], $TMPL['payments_this_month'], $TMPL['payments_last_30'], $TMPL['total_earnings'], $TMPL['earnings_today'], $TMPL['earnings_this_month'], $TMPL['earnings_last_30']) = statistics($db, $settings['currency']); $TMPL['currency'] = $settings['currency']; } elseif ($_GET['b'] == 'themes') { $skin = new skin('admin/themes'); $page = ''; $updateSettings = new updateSettings(); $updateSettings->db = $db; $themes = $updateSettings->getThemes(); $TMPL['themes_list'] = $themes[0]; if (isset($_GET['theme'])) { // If theme is in array if (in_array($_GET['theme'], $themes[1])) { $updated = $updateSettings->query_array('settings', array('theme' => $_GET['theme'])); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=themes&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=themes&m=i"); } } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['theme_changed']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('error', $LNG['nothing_changed']); } } elseif ($_GET['b'] == 'reports') { $manageReports = new manageReports(); $manageReports->db = $db; $manageReports->url = $CONF['url']; $manageReports->title = $settings['title']; $manageReports->per_page = $settings['rperpage']; if (ctype_digit($_GET['id'])) { if (isset($_GET['type'])) { // Do the manage report action $manageReport = $manageReports->manageReport($_GET['id'], $_GET['type']); } $skin = new skin('admin/report'); $page = ''; $TMPL['content'] = $manageReports->getReport($_GET['id']); // If the report doesn't exist if (empty($TMPL['content'])) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=reports&m=i"); } } else { $skin = new skin('admin/manage_reports'); $page = ''; $TMPL['reports'] = $manageReports->getReports(0); } if ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('error', $LNG['report_not_exist']); } } elseif ($_GET['b'] == 'users_settings') { $skin = new skin('admin/users_settings'); $page = ''; if ($settings['notificationl'] == '0') { $TMPL['loff'] = 'selected="selected"'; } else { $TMPL['lon'] = 'selected="selected"'; } if ($settings['notificationc'] == '0') { $TMPL['coff'] = 'selected="selected"'; } else { $TMPL['con'] = 'selected="selected"'; } if ($settings['email_comment'] == '0') { $TMPL['ecoff'] = 'selected="selected"'; } else { $TMPL['econ'] = 'selected="selected"'; } if ($settings['email_like'] == '0') { $TMPL['eloff'] = 'selected="selected"'; } else { $TMPL['elon'] = 'selected="selected"'; } if ($settings['email_new_friend'] == '0') { $TMPL['enfoff'] = 'selected="selected"'; } else { $TMPL['enfon'] = 'selected="selected"'; } if ($settings['notificationd'] == '0') { $TMPL['doff'] = 'selected="selected"'; } else { $TMPL['don'] = 'selected="selected"'; } if ($settings['notificationf'] == '0') { $TMPL['foff'] = 'selected="selected"'; } else { $TMPL['fon'] = 'selected="selected"'; } if ($settings['ronline'] == '3') { $TMPL['uone'] = 'selected="selected"'; } elseif ($settings['ronline'] == '7') { $TMPL['utwo'] = 'selected="selected"'; } else { $TMPL['uthree'] = 'selected="selected"'; } if ($settings['nperwidget'] == '5') { $TMPL['none'] = 'selected="selected"'; } elseif ($settings['nperwidget'] == '10') { $TMPL['ntwo'] = 'selected="selected"'; } elseif ($settings['nperwidget'] == '20') { $TMPL['nthree'] = 'selected="selected"'; } else { $TMPL['nfour'] = 'selected="selected"'; } if ($settings['lperpost'] == '5') { $TMPL['likeson'] = 'selected="selected"'; } else { $TMPL['likesoff'] = 'selected="selected"'; } if (!empty($_POST)) { $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('settings', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users_settings&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['settings_saved']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']); } } elseif ($_GET['b'] == 'users') { $manageUsers = new manageUsers(); $manageUsers->db = $db; $manageUsers->url = $CONF['url']; $manageUsers->title = $settings['title']; $manageUsers->per_page = $settings['rperpage']; if (!isset($_GET['id']) && !isset($_GET['idu'])) { $skin = new skin('admin/manage_users'); $page = ''; // Save the array returned into a list $TMPL['users'] = $manageUsers->getUsers(0); } else { $skin = new skin('admin/user'); $page = ''; $getUser = $manageUsers->getUser($_GET['id'], $_GET['idu']); if (!$getUser) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=un"); } // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $getUser['idu']; if (!empty($_POST)) { $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST)); } $userSettings = $updateUserSettings->getSettings(); $TMPL['countries'] = countries(1, $userSettings['country']); $TMPL['username'] = $userSettings['username']; $TMPL['idu'] = $userSettings['idu']; $TMPL['currentFirstName'] = $userSettings['first_name']; $TMPL['currentLastName'] = $userSettings['last_name']; $TMPL['currentEmail'] = $userSettings['email']; $TMPL['currentCity'] = $userSettings['city']; $TMPL['currentWebsite'] = $userSettings['website']; $TMPL['currentDescription'] = $userSettings['description']; $TMPL['currentFacebook'] = $userSettings['facebook']; $TMPL['currentTwitter'] = $userSettings['twitter']; $TMPL['currentGplus'] = $userSettings['gplus']; $TMPL['currentYouTube'] = $userSettings['youtube']; $TMPL['currentSoundCloud'] = $userSettings['soundcloud']; $TMPL['currentLastfm'] = $userSettings['lastfm']; $TMPL['currentMySpace'] = $userSettings['myspace']; $TMPL['currentVimeo'] = $userSettings['vimeo']; $TMPL['currentTumblr'] = $userSettings['tumblr']; $feed = new feed(); $feed->db = $db; $feed->id = $updateUserSettings->id; $manageReports = new manageReports(); $manageReports->db = $db; $manageReports->url = $CONF['url']; $manageReports->per_page = $settings['rperpage']; if (isset($_GET['suspend'])) { $manageUsers->suspendUser($feed->id, $_GET['suspend']); } $user = $manageUsers->getUser($getUser['idu']); $TMPL['username'] = '******' . $CONF['url'] . '/index.php?a=profile&u=' . $user['username'] . '" target="_blank"><img src="' . $CONF['url'] . '/thumb.php?src=' . $user['image'] . '&t=a&w=112&h=112"></a></div> <div class="manage-users-content"><a href="' . $CONF['url'] . '/index.php?a=profile&u=' . $user['username'] . '" target="_blank">' . $user['username'] . '</a><br>' . $user['email'] . '</div>'; $TMPL['reports'] = $manageReports->getReports(0, $feed->getTrackList($feed->id) ? $feed->getTrackList($feed->id) : 1); if (empty($TMPL['reports'])) { $TMPL['hide_r'] = ' style="display: none;"'; } // If the user has payments history $managePayments = new managePayments(); $managePayments->db = $db; $managePayments->url = $CONF['url']; $managePayments->per_page = $settings['rperpage']; $TMPL['history'] = $managePayments->getPayments(0, $updateUserSettings->id); if (empty($TMPL['history'])) { $TMPL['hide_p'] = ' style="display: none;"'; } // Suspend variable for the suspend url $TMPL['suspend'] = $user['suspended'] ? '0' : '1'; $TMPL['status_desc'] = $user['suspended'] ? $LNG['restore_account'] : $LNG['suspend_account']; $TMPL['status'] = $user['suspended'] ? notificationBox('error', $LNG['account_suspended']) : ''; if ($user['suspended']) { $TMPL['suspended'] = $LNG['restore']; } else { $TMPL['suspended'] = $LNG['suspend']; } } // If GET delete is set, delete the user if ($_GET['delete']) { $manageUsers->deleteUser($_GET['delete']); header("Location: " . $CONF['url'] . "/index.php?a=admin&b=users&m=" . $_GET['delete']); } if ($_GET['m'] == 'un') { $TMPL['message'] = notificationBox('error', $LNG['user_not_exist']); } elseif (!empty($_GET['m'])) { $TMPL['message'] = notificationBox('success', sprintf($LNG['user_has_been_deleted'], $_GET['m'])); } } elseif ($_GET['b'] == 'categories') { $manageCategories = new manageCategories(); $manageCategories->db = $db; $manageCategories->url = $CONF['url']; $skin = new skin('admin/manage_categories'); $page = ''; $TMPL['categories'] = $manageCategories->getCategories(); } elseif ($_GET['b'] == 'ads') { $skin = new skin('admin/manage_ads'); $page = ''; $TMPL['ad1'] = $settings['ad1']; $TMPL['ad2'] = $settings['ad2']; $TMPL['ad3'] = $settings['ad3']; $TMPL['ad4'] = $settings['ad4']; $TMPL['ad5'] = $settings['ad5']; $TMPL['ad6'] = $settings['ad6']; $TMPL['ad7'] = $settings['ad7']; if (!empty($_POST)) { // Unset the submit array element $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('settings', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=ads&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&b=ads&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['settings_saved']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']); } } else { $skin = new skin('admin/general'); $page = ''; $TMPL['currentTitle'] = $settings['title']; $TMPL['currentFormat'] = $settings['format']; $TMPL['currentArtFormat'] = $settings['artformat']; $TMPL['currentTrackFormat'] = $settings['trackformat']; if ($settings['captcha'] == '1') { $TMPL['on'] = 'selected="selected"'; } else { $TMPL['off'] = 'selected="selected"'; } if ($settings['time'] == '0') { $TMPL['one'] = 'selected="selected"'; } elseif ($settings['time'] == '1') { $TMPL['two'] = 'selected="selected"'; } elseif ($settings['time'] == '2') { $TMPL['three'] = 'selected="selected"'; } else { $TMPL['four'] = 'selected="selected"'; } if ($settings['volume'] == '0.20') { $TMPL['vtwenty'] = 'selected="selected"'; } elseif ($settings['volume'] == '0.40') { $TMPL['vfourty'] = 'selected="selected"'; } elseif ($settings['volume'] == '0.60') { $TMPL['vsixty'] = 'selected="selected"'; } elseif ($settings['volume'] == '0.80') { $TMPL['veighty'] = 'selected="selected"'; } elseif ($settings['volume'] == '1') { $TMPL['vhundred'] = 'selected="selected"'; } if ($settings['conline'] == '60') { $TMPL['conone'] = 'selected="selected"'; } elseif ($settings['conline'] == '300') { $TMPL['contwo'] = 'selected="selected"'; } else { $TMPL['conthree'] = 'selected="selected"'; } if ($settings['perpage'] == '10') { $TMPL['ten'] = 'selected="selected"'; } elseif ($settings['perpage'] == '20') { $TMPL['twenty'] = 'selected="selected"'; } elseif ($settings['perpage'] == '35') { $TMPL['thirtyfive'] = 'selected="selected"'; } else { $TMPL['fifty'] = 'selected="selected"'; } if ($settings['nperpage'] == '10') { $TMPL['nten'] = 'selected="selected"'; } elseif ($settings['nperpage'] == '25') { $TMPL['ntwentyfive'] = 'selected="selected"'; } elseif ($settings['nperpage'] == '50') { $TMPL['nfifty'] = 'selected="selected"'; } else { $TMPL['nonehundred'] = 'selected="selected"'; } if ($settings['mperpage'] == '5') { $TMPL['mone'] = 'selected="selected"'; } elseif ($settings['mperpage'] == '10') { $TMPL['mtwo'] = 'selected="selected"'; } elseif ($settings['mperpage'] == '25') { $TMPL['mthree'] = 'selected="selected"'; } else { $TMPL['mfour'] = 'selected="selected"'; } if ($settings['mlimit'] == '500') { $TMPL['cone'] = 'selected="selected"'; } elseif ($settings['mlimit'] == '1000') { $TMPL['ctwo'] = 'selected="selected"'; } elseif ($settings['mlimit'] == '2500') { $TMPL['cthree'] = 'selected="selected"'; } else { $TMPL['cfour'] = 'selected="selected"'; } if ($settings['chatr'] == '1') { $TMPL['crone'] = 'selected="selected"'; } elseif ($settings['chatr'] == '2') { $TMPL['crtwo'] = 'selected="selected"'; } elseif ($settings['chatr'] == '3') { $TMPL['crthree'] = 'selected="selected"'; } elseif ($settings['chatr'] == '5') { $TMPL['crfive'] = 'selected="selected"'; } elseif ($settings['chatr'] == '10') { $TMPL['crten'] = 'selected="selected"'; } elseif ($settings['chatr'] == '30') { $TMPL['crthirty'] = 'selected="selected"'; } else { $TMPL['croff'] = 'selected="selected"'; } if ($settings['qperpage'] == '10') { $TMPL['qten'] = 'selected="selected"'; } elseif ($settings['qperpage'] == '20') { $TMPL['qtwenty'] = 'selected="selected"'; } elseif ($settings['qperpage'] == '35') { $TMPL['qthirtyfive'] = 'selected="selected"'; } else { $TMPL['qfifty'] = 'selected="selected"'; } if ($settings['cperpage'] == '5') { $TMPL['cfive'] = 'selected="selected"'; } elseif ($settings['cperpage'] == '10') { $TMPL['cten'] = 'selected="selected"'; } elseif ($settings['cperpage'] == '25') { $TMPL['ctwentyfive'] = 'selected="selected"'; } else { $TMPL['cfifty'] = 'selected="selected"'; } if ($settings['size'] == '1048576') { $TMPL['onemb'] = 'selected="selected"'; } elseif ($settings['size'] == '2097152') { $TMPL['twomb'] = 'selected="selected"'; } elseif ($settings['size'] == '3145728') { $TMPL['threemb'] = 'selected="selected"'; } else { $TMPL['tenmb'] = 'selected="selected"'; } if ($settings['mail'] == '1') { $TMPL['mailon'] = 'selected="selected"'; } else { $TMPL['mailoff'] = 'selected="selected"'; } if ($settings['intervaln'] == '10000') { $TMPL['intonen'] = 'selected="selected"'; } elseif ($settings['intervaln'] == '30000') { $TMPL['inttwon'] = 'selected="selected"'; } elseif ($settings['intervaln'] == '60000') { $TMPL['intthreen'] = 'selected="selected"'; } elseif ($settings['intervaln'] == '120000') { $TMPL['intfourn'] = 'selected="selected"'; } elseif ($settings['intervaln'] == '300000') { $TMPL['intfiven'] = 'selected="selected"'; } elseif ($settings['intervaln'] == '600000') { $TMPL['intsixn'] = 'selected="selected"'; } else { $TMPL['intsevenn'] = 'selected="selected"'; } if ($settings['artsize'] == '1048576') { $TMPL['aart'] = 'selected="selected"'; } elseif ($settings['artsize'] == '2097152') { $TMPL['bart'] = 'selected="selected"'; } elseif ($settings['artsize'] == '3145728') { $TMPL['cart'] = 'selected="selected"'; } else { $TMPL['dart'] = 'selected="selected"'; } if ($settings['rperpage'] == '10') { $TMPL['rpone'] = 'selected="selected"'; } elseif ($settings['rperpage'] == '20') { $TMPL['rptwo'] = 'selected="selected"'; } elseif ($settings['rperpage'] == '50') { $TMPL['rpthree'] = 'selected="selected"'; } else { $TMPL['rpfour'] = 'selected="selected"'; } if ($settings['sperpage'] == '10') { $TMPL['sone'] = 'selected="selected"'; } elseif ($settings['sperpage'] == '20') { $TMPL['stwo'] = 'selected="selected"'; } elseif ($settings['sperpage'] == '35') { $TMPL['sthree'] = 'selected="selected"'; } else { $TMPL['sfour'] = 'selected="selected"'; } if ($settings['aperip'] == '1') { $TMPL['ipone'] = 'selected="selected"'; } elseif ($settings['aperip'] == '3') { $TMPL['iptwo'] = 'selected="selected"'; } elseif ($settings['aperip'] == '5') { $TMPL['ipthree'] = 'selected="selected"'; } elseif ($settings['aperip'] == '10') { $TMPL['ipfour'] = 'selected="selected"'; } else { $TMPL['ipoff'] = 'selected="selected"'; } if (isset($_POST['submit'])) { // Unset the submit array element unset($_POST['submit']); $updateSettings = new updateSettings(); $updateSettings->db = $db; $updated = $updateSettings->query_array('settings', $_POST); if ($updated == 1) { header("Location: " . $CONF['url'] . "/index.php?a=admin&m=s"); } else { header("Location: " . $CONF['url'] . "/index.php?a=admin&m=i"); } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['settings_saved']); } elseif ($_GET['m'] == 'i') { $TMPL['message'] = notificationBox('info', $LNG['nothing_changed']); } } $page .= $skin->make(); $TMPL = $TMPL_old; unset($TMPL_old); $TMPL['settings'] = $page; if (isset($_GET['logout']) == 1) { $loggedInAdmin->logOut(); header("Location: " . $CONF['url'] . "/index.php?a=admin"); } } else { // Set the content to false, change the $skin to log-in. $content = false; } } // Bold the current link if (isset($_GET['b'])) { $LNG["admin_menu_{$_GET['b']}"] = $LNG["admin_menu_{$_GET['b']}"]; $TMPL['welcome'] = $LNG["admin_ttl_{$_GET['b']}"]; } else { $LNG["admin_menu_general"] = $LNG["admin_menu_general"]; $TMPL['welcome'] = $LNG["admin_ttl_general"]; } function adminMenuCounts($db, $type) { // Type 0: Return the reports number if ($type == 0) { $query = $db->query('SELECT COUNT(`id`) as `count` FROM `reports` WHERE `state` = 0'); } $result = $query->fetch_assoc(); return $result['count']; } $adminMenu = array('' => array('admin_menu_general', ''), '&b=users_settings' => array('admin_menu_users_settings', ''), '&b=pro' => array('admin_menu_pro', ''), '&b=social' => array('admin_menu_social', ''), '&b=themes' => array('admin_menu_themes', ''), '&b=stats' => array('admin_menu_stats', ''), '&b=security' => array('admin_menu_security', ''), '&b=users' => array('admin_menu_manage_users', ''), '&b=payments' => array('admin_menu_manage_payments', ''), '&b=reports' => array('admin_menu_manage_reports', adminMenuCounts($db, 0)), '&b=categories' => array('admin_menu_manage_categories', ''), '&b=ads' => array('admin_menu_manage_ads', ''), '&logout=1' => array('admin_menu_logout', '')); foreach ($adminMenu as $link => $title) { if ($link == '&b=' . $_GET['b'] || $link == $_GET['b']) { $TMPL['admin_menu'] .= '<strong>'; $ttl = $LNG[$title[0]]; } $TMPL['admin_menu'] .= '<a href="' . $CONF['url'] . '/index.php?a=admin' . $link . '" ' . ($title[0] == 'admin_menu_logout' ? '' : 'rel="loadpage"') . '>' . $LNG[$title[0]] . ' ' . ($title[1] ? '<span class="admin-notifications-number">' . $title[1] . '</span>' : '') . '</a>'; if ($link == '&b=' . $_GET['b'] || $link == $_GET['b']) { $TMPL['admin_menu'] .= '</strong>'; } } $TMPL['url'] = $CONF['url']; $TMPL['title'] = $LNG['title_admin'] . ' - ' . ($loggedIn['username'] ? $ttl : $LNG['login']) . ' - ' . $settings['title']; if ($content) { $skin = new skin('admin/content'); } else { $skin = new skin('admin/login'); } return $skin->make(); }
function PageMain() { global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings; unset($_POST['suspended']); if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) { $verify = $loggedIn->verify(); if ($verify['username']) { $TMPL_old = $TMPL; $TMPL = array(); $TMPL['url'] = $CONF['url']; if ($_GET['b'] == 'security') { $skin = new skin('settings/security'); $page = ''; // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $verify['idu']; if (!empty($_POST)) { $TMPL['message'] = $updateUserSettings->query_array('users', $_POST); } $userSettings = $updateUserSettings->getSettings(); } elseif ($_GET['b'] == 'avatar') { $skin = new skin('settings/avatar'); $page = ''; // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $verify['idu']; $TMPL['image'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['image'] . '&t=a" width="80" height="80" />'; $TMPL['cover'] = '<img src="' . $CONF['url'] . '/thumb.php?src=' . $verify['cover'] . '&t=c&w=900&h=200" />'; $maxsize = $settings['size']; if (isset($_FILES['avatarselect']['name'])) { foreach ($_FILES['avatarselect']['error'] as $key => $error) { $ext = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION); $size = $_FILES['avatarselect']['size'][$key]; $allowedExt = explode(',', strtolower($settings['format'])); // Get file type validation $image = validateFile($_FILES['avatarselect']['tmp_name'][$key], $_FILES['avatarselect']['name'][$key], $allowedExt, 0); if ($image['valid'] && $size < $maxsize && $size > 0 && !empty($image['width']) && !empty($image['height'])) { $rand = mt_rand(); $tmp_name = $_FILES['avatarselect']['tmp_name'][$key]; $name = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_FILENAME); $fullname = $_FILES['avatarselect']['name'][$key]; $size = $_FILES['avatarselect']['size'][$key]; $type = pathinfo($_FILES['avatarselect']['name'][$key], PATHINFO_EXTENSION); $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext); // Fix image orientation if possible imageOrientation($tmp_name); // Move the file into the uploaded folder move_uploaded_file($tmp_name, 'uploads/avatars/' . $finalName); // Send the image name in array format to the function $image = array('image' => $finalName); $updateUserSettings->query_array('users', $image); header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s"); } elseif ($_FILES['avatarselect']['name'][$key] == '') { // If no file is selected header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf"); } elseif ($size > $maxsize || $size == 0) { // If the file size is higher than allowed or 0 header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs"); } else { // If the file format is not allowed header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf"); } } } if (isset($_FILES['coverselect']['name'])) { foreach ($_FILES['coverselect']['error'] as $key => $error) { $ext = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION); $size = $_FILES['coverselect']['size'][$key]; $allowedExt = explode(',', strtolower($settings['format'])); // Get file type validation $image = validateFile($_FILES['coverselect']['tmp_name'][$key], $_FILES['coverselect']['name'][$key], $allowedExt, 0); if ($image['valid'] && $size < $maxsize && $size > 0 && !empty($image['width']) && !empty($image['height'])) { $rand = mt_rand(); $tmp_name = $_FILES['coverselect']['tmp_name'][$key]; $name = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_FILENAME); $fullname = $_FILES['coverselect']['name'][$key]; $size = $_FILES['coverselect']['size'][$key]; $type = pathinfo($_FILES['coverselect']['name'][$key], PATHINFO_EXTENSION); $finalName = mt_rand() . '_' . mt_rand() . '_' . mt_rand() . '.' . $db->real_escape_string($ext); // Fix image orientation if possible imageOrientation($tmp_name); // Move the file into the uploaded folder move_uploaded_file($tmp_name, 'uploads/covers/' . $finalName); // Send the image name in array format to the function $image = array('cover' => $finalName); $updateUserSettings->query_array('users', $image); header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=s"); } elseif ($_FILES['coverselect']['name'][$key] == '') { // If no file is selected header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=nf"); } elseif ($size > $maxsize || $size == 0) { // If the file size is higher than allowed or 0 header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=fs"); } else { // If the file format is not allowed header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar&m=wf"); } } } if ($_GET['m'] == 's') { $TMPL['message'] = notificationBox('success', $LNG['profile_picture_saved']); } elseif ($_GET['m'] == 'nf') { $TMPL['message'] = notificationBox('error', $LNG['no_file']); } elseif ($_GET['m'] == 'fs') { $TMPL['message'] = notificationBox('error', sprintf($LNG['file_exceeded'], round($maxsize / 1048576, 2))); } elseif ($_GET['m'] == 'wf') { $TMPL['message'] = notificationBox('error', sprintf($LNG['file_format'], $settings['format'])); } } elseif ($_GET['b'] == 'social') { $skin = new skin('settings/social'); $page = ''; // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $verify['idu']; if (!empty($_POST)) { $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST)); } $userSettings = $updateUserSettings->getSettings(); $TMPL['currentFacebook'] = $userSettings['facebook']; $TMPL['currentTwitter'] = $userSettings['twitter']; $TMPL['currentGplus'] = $userSettings['gplus']; $TMPL['currentYouTube'] = $userSettings['youtube']; $TMPL['currentSoundCloud'] = $userSettings['soundcloud']; $TMPL['currentLastfm'] = $userSettings['lastfm']; $TMPL['currentMySpace'] = $userSettings['myspace']; $TMPL['currentVimeo'] = $userSettings['vimeo']; $TMPL['currentTumblr'] = $userSettings['tumblr']; } elseif ($_GET['b'] == 'notifications') { $skin = new skin('settings/notifications'); $page = ''; // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $verify['idu']; if (!empty($_POST)) { $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST)); } $userSettings = $updateUserSettings->getSettings(); if ($userSettings['notificationl'] == '0') { $TMPL['loff'] = 'selected="selected"'; } else { $TMPL['lon'] = 'selected="selected"'; } if ($userSettings['notificationc'] == '0') { $TMPL['coff'] = 'selected="selected"'; } else { $TMPL['con'] = 'selected="selected"'; } if ($userSettings['notificationd'] == '0') { $TMPL['doff'] = 'selected="selected"'; } else { $TMPL['don'] = 'selected="selected"'; } if ($userSettings['notificationf'] == '0') { $TMPL['foff'] = 'selected="selected"'; } else { $TMPL['fon'] = 'selected="selected"'; } if ($userSettings['email_comment'] == '0') { $TMPL['ecoff'] = 'selected="selected"'; } else { $TMPL['econ'] = 'selected="selected"'; } if ($userSettings['email_like'] == '0') { $TMPL['eloff'] = 'selected="selected"'; } else { $TMPL['elon'] = 'selected="selected"'; } if ($userSettings['email_new_friend'] == '0') { $TMPL['enfoff'] = 'selected="selected"'; } else { $TMPL['enfon'] = 'selected="selected"'; } } else { $skin = new skin('settings/general'); $page = ''; // Create the class instance $updateUserSettings = new updateUserSettings(); $updateUserSettings->db = $db; $updateUserSettings->id = $verify['idu']; if (!empty($_POST)) { $TMPL['message'] = $updateUserSettings->query_array('users', array_map("strip_tags_array", $_POST)); } $userSettings = $updateUserSettings->getSettings(); $TMPL['countries'] = countries(1, $userSettings['country']); $TMPL['currentFirstName'] = $userSettings['first_name']; $TMPL['currentLastName'] = $userSettings['last_name']; $TMPL['currentEmail'] = $userSettings['email']; $TMPL['currentCity'] = $userSettings['city']; $TMPL['currentWebsite'] = $userSettings['website']; $TMPL['currentDescription'] = $userSettings['description']; if ($userSettings['private'] == '1') { $TMPL['on'] = 'selected="selected"'; } elseif ($userSettings['private'] == '2') { $TMPL['semi'] = 'selected="selected"'; } else { $TMPL['off'] = 'selected="selected"'; } if ($userSettings['offline'] == '1') { $TMPL['con'] = 'selected="selected"'; } else { $TMPL['coff'] = 'selected="selected"'; } } $page .= $skin->make(); $TMPL = $TMPL_old; unset($TMPL_old); $TMPL['settings'] = $page; } else { // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page $loggedIn->logOut(); header("Location: " . $CONF['url'] . "/index.php?a=welcome"); } } else { // If the session or cookies are not set, redirect to home-page header("Location: " . $CONF['url'] . "/index.php?a=welcome"); } // Bold the current link if (isset($_GET['b'])) { $LNG["user_menu_{$_GET['b']}"] = '<strong>' . $LNG["user_menu_{$_GET['b']}"] . '</strong>'; $TMPL['welcome'] = $LNG["user_ttl_{$_GET['b']}"]; } else { $LNG["user_menu_general"] = '<strong>' . $LNG["user_menu_general"] . '</strong>'; $TMPL['welcome'] = $LNG["user_ttl_general"]; } $TMPL['user_menu'] = ' <a href="' . $CONF['url'] . '/index.php?a=settings" rel="loadpage">' . $LNG['user_menu_general'] . '</a> <a href="' . $CONF['url'] . '/index.php?a=settings&b=avatar" rel="loadpage">' . $LNG['user_menu_avatar'] . '</a> <a href="' . $CONF['url'] . '/index.php?a=settings&b=notifications" rel="loadpage">' . $LNG['user_menu_notifications'] . '</a> <a href="' . $CONF['url'] . '/index.php?a=settings&b=social" rel="loadpage">' . $LNG['user_menu_social'] . '</a> <a href="' . $CONF['url'] . '/index.php?a=settings&b=security" rel="loadpage">' . $LNG['user_menu_security'] . '</a> ' . ($settings['paypalapp'] ? '<a href="' . $CONF['url'] . '/index.php?a=pro" rel="loadpage">' . $LNG['user_menu_plan'] . '</a>' : ''); $TMPL['title'] = $LNG['title_settings'] . ' - ' . $settings['title']; $skin = new skin('settings/content'); return $skin->make(); }
<?php if($argv[1]=="--dirs"){parsedirs($argv[2]);die();} if($argv[1]=="www"){www();die();} if($argv[1]=="--countries"){countries();die();} function www(){ for($i=0;$i<150;$i++){ echo "http://client$i.dropbox.com\n"; } } importlangs(); function importlangs(){ echo "importlangs()\n"; $GLOBALS["langs"]=array("fr","en","po","es","it","br","pol"); while (list ($num, $val) = each ($GLOBALS["langs"]) ){ echo "COmpile $val\n"; CompileLangs($val); } }
/** * Countries list. * * This method returns an array with the names of the countries.<br /> * The key of each element is the country code defined in ISO 3166. * * @return array */ static function countriesList() { $countries = countries(); asort($countries); return $countries; }
<?php sleep(1); // simulates a long search $criteria = array_key_exists('criteria', $_POST) ? strtolower(trim($_POST['criteria'])) : ''; if (strlen($criteria)) { $results = array(); foreach (countries() as $country) { if (strpos(strtolower($country), $criteria) !== false) { $results[] = $country; } } echo sprintf("Found %s countries: %s", count($results), implode(', ', $results)); } function countries() { return array("Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Anguilla", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Brazil", "Bulgaria", "Burundi", "Cambodia", "Cameroon", "Canada", "Chad", "Chile", "China", "Colombia", "Comoros", "Croatia", "Cuba", "Cyprus", "Denmark", "Djibouti", "Dominica", "Ecuador", "Egypt", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "United-Kingdom", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guam", "Guatemala", "Guernsey", "Guinea", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Namibia", "Nauru", "Nepal", "Netherlands", "Nicaragua", "Niger", "Nigeria", "Niue", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Romania", "Russia", "Rwanda", "Samoa", "Senegal", "Seychelles", "Singapore", "Slovakia", "Slovenia", "Somalia", "Spain", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United-Kingdom", "United-States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe"); }