function getCountryCode($file = null, $name = "") { if ($file == null) { $file = realpath(dirname(__FILE__)) . '/countries'; } $countries = getCountries($file); foreach ($countries as $country) { if ($country[0] == $name) { return strtolower($country[1]); } } return ""; }
function display() { $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $l = Movim\i18n\Locale::start(); $this->view->assign('conf', $cd->get()); $this->view->assign('logs', array(0 => $this->__('log.empty'), 1 => $this->__('log.syslog'), 2 => $this->__('log.syslog_files'))); $this->view->assign('bosh_info4', $this->__('bosh.info4', '<a href="http://wiki.movim.eu/en:install">', '</a>')); $json = requestURL(MOVIM_API . 'websockets', 3); $json = json_decode($json); if (isset($json) && $json->status != 404) { $this->view->assign('websockets', $json); } $this->view->assign('timezones', getTimezoneList()); $this->view->assign('langs', $l->getList()); $this->view->assign('countries', getCountries()); }
function prepareForm($me) { $vcardform = $this->tpl(); $vcardform->assign('me', $me); $vcardform->assign('desc', trim($me->description)); $vcardform->assign('gender', getGender()); $vcardform->assign('marital', getMarital()); $vcardform->assign('countries', getCountries()); $me->isValidDate(); $vcardform->assign('submit', $this->call('ajaxVcardSubmit', "MovimUtils.formToJson('vcard4')")); $vcardform->assign('privacy', $this->call('ajaxChangePrivacy', "this.checked")); // The datepicker arrays $days = $months = $years = []; for ($i = 1; $i <= 31; $i++) { if ($i < 10) { $j = '0' . $i; } else { $j = (string) $i; } $days[$i] = $j; } for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $j = '0' . $i; } else { $j = (string) $i; } $m = getMonths(); $months[$j] = $m[$i]; } for ($i = date('o'); $i >= 1920; $i--) { array_push($years, $i); } $vcardform->assign('days', $days); $vcardform->assign('months', $months); $vcardform->assign('years', $years); return $vcardform->draw('_vcard4_form', true); }
function getCountryCode($n) { $x = getCountries(); return $x[$n]; }
/** * Return full name of a country * * @return String Name of country */ function getFullCountryName($countrycode) { $countriesarray = getCountries(); return isArrayKeyAnEmptyString($countrycode, $countriesarray) ? '' : $countriesarray[$countrycode]; }
<?php require_once "functions.inc.php"; $all_ips = getAllIps(); $countries = getCountries($all_ips); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8> <title>CSF Attack Map</title> <!--CSS--> <link rel="stylesheet" type="text/css" href="css/styles.css"> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <!--JavaScript--> <script type="text/javascript" src="js/jquery-1.9.0.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script> <script> /** * author Remy Sharp * url http://remysharp.com/tag/marquee */ (function ($) { $.fn.marquee = function (klass) { var newMarquee = [], last = this.length; // works out the left or right hand reset position, based on scroll // behavior, current direction and new direction
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <!-- * Created on 28-Nov-08 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates --> <?php include 'Services/DBServices.php'; include 'Services/GeneralServices.php'; include 'Services/UserRegService.php'; $allCountries = getCountries(); $action = $_REQUEST['action']; $status = ""; if ($action == "regUser") { $user_id = $_REQUEST['userId']; $user_name = $_REQUEST['userName']; $user_lstname = $_REQUEST['userLstName']; $password = $_REQUEST['Password']; $user_dob = $_REQUEST['userdob']; //= new date("F j, Y, g:i a"); $user_addr1 = $_REQUEST['useraddr1']; $user_addr2 = $_REQUEST['useraddr2']; $user_city_id = $_REQUEST['city']; $user_country_id = $_REQUEST['country']; //var $user_langugage_id; $user_email = $_REQUEST['useremail'];
public function process() { // check if session is active $session = new Session($this->sessionId); if ($session->sessionId > 0) { // update session $session->update(); // process restricted functions switch ($this->f) { case 'checkLogin': return Login::checkLogin($session->sessionId); case 'getSession': return $session; case 'getWarehouse': if (isset($this->data->update)) { $warehouse = new Warehouse($session->warehouseId, $this->data->update); } else { $warehouse = new Warehouse($session->warehouseId); } $warehouse->dMail = $warehouse->getMail(); $warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled(); $warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled(); return $warehouse; case 'editWarehouse': if (!$session->restricted) { $data = $this->data; $warehouse = new Warehouse($session->warehouseId); // update warehouse data if (isset($data->name)) { $warehouse->name = $data->name; } if (isset($data->description)) { $warehouse->description = $data->description; } if (isset($data->country)) { $warehouse->country = $data->country; } if (isset($data->city)) { $warehouse->city = $data->city; } if (isset($data->password)) { $warehouse->setPassword($data->password); } if (isset($data->passwordRestricted)) { $warehouse->setPasswordRestricted($data->passwordRestricted); } if (isset($data->mail)) { $warehouse->setMail($data->mail); } if (isset($data->disableLocationLess)) { $warehouse->setDisableLocationLess($data->disableLocationLess); } if (isset($data->disablePaletteLess)) { $warehouse->setDisablePaletteLess($data->disablePaletteLess); } // update database entry return $warehouse->edit(); } break; case 'deleteWarehouse': if (!$session->restricted) { $warehouse = new Warehouse($session->warehouseId); if ($warehouse->id > 0 && $warehouse->delete()) { return $session->destroy(); } } break; case 'addCategory': if (!$session->restricted && isset($this->data->name)) { $category = new Category(null, $session->warehouseId); $category->name = $this->data->name; if (isset($this->data->parent)) { $category->parent = $this->data->parent; } if ($category->edit()) { return $category->id; } } break; case 'getCategory': if (isset($this->data->id) && isset($this->data->update)) { return new Category($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Category($this->data->id, $session->warehouseId); } break; case 'deleteCategory': if (!$session->restricted && isset($this->data->id)) { $category = new Category($this->data->id, $session->warehouseId); return $category->delete(); } break; case 'editCategory': if (isset($this->data->id)) { $data = $this->data; $category = new Category($this->data->id, $session->warehouseId); if (!$session->restricted) { if (isset($data->name)) { $category->name = $data->name; } if (isset($data->parent)) { $category->parent = $data->parent; } if (isset($data->male)) { $category->male = $data->male; } if (isset($data->female)) { $category->female = $data->female; } if (isset($data->children)) { $category->children = $data->children; } if (isset($data->baby)) { $category->baby = $data->baby; } if (isset($data->summer)) { $category->summer = $data->summer; } if (isset($data->winter)) { $category->winter = $data->winter; } } if (isset($data->demand)) { $category->demand = $data->demand; } if (isset($data->weight)) { $category->weight = $data->weight; } return $category->edit(); } break; case 'getCategories': if (isset($this->data->parent)) { return Category::getCategories($session->warehouseId, $this->data->parent); } else { return Category::getCategories($session->warehouseId); } case 'addLocation': if (!$session->restricted && isset($this->data->name)) { $location = new Location(null, $session->warehouseId); $location->name = $this->data->name; if ($location->edit()) { return $location->id; } return true; } break; case 'getLocation': if (isset($this->data->id) && isset($this->data->update)) { return new Location($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Location($this->data->id, $session->warehouseId); } break; case 'deleteLocation': if (!$session->restricted && isset($this->data->id)) { $location = new Location($this->data->id, $session->warehouseId); return $location->delete(); } break; case 'editLocation': if (!$session->restricted && isset($this->data->id) && isset($this->data->name)) { $location = new Location($this->data->id, $session->warehouseId); $location->name = $this->data->name; return $location->edit(); } break; case 'getLocations': return Location::getLocations($session->warehouseId); case 'addPalette': $palette = new Palette(null, $session->warehouseId); if (isset($this->data->locationId)) { $palette->locationId = $this->data->locationId; } if ($palette->edit()) { return $palette->id; } break; case 'getPalette': if (isset($this->data->id) && isset($this->data->update)) { return new Palette($this->data->id, $session->warehouseId, $this->data->update); } elseif (isset($this->data->id)) { return new Palette($this->data->id, $session->warehouseId); } break; case 'deletePalette': if (isset($this->data->id)) { $palette = new Palette($this->data->id, $session->warehouseId); return $palette->delete(); } break; case 'editPalette': if (isset($this->data->id)) { $palette = new Palette($this->data->id, $session->warehouseId); if (isset($this->data->locationId)) { $palette->locationId = $this->data->locationId; } return $palette->edit(); } break; case 'getPalettes': return Palette::getPalettes($session->warehouseId); case 'getCarton': if (isset($this->data->id) && isset($this->data->update)) { return new Carton($this->data->id, $session->warehouseId, null, null, $this->data->update); } elseif (isset($this->data->id)) { return new Carton($this->data->id, $session->warehouseId); } break; case 'addCarton': $locationId = null; $paletteId = null; if (isset($this->data->location)) { $locationId = $this->data->location; } if (isset($this->data->palette)) { $paletteId = $this->data->palette; } $carton = new Carton(null, $session->warehouseId, $locationId, $paletteId); return $carton->id; case 'deleteCarton': if (isset($this->data->id)) { $carton = new Carton($this->data->id, $session->warehouseId); return $carton->delete(); } break; case 'editCarton': if (isset($this->data->id)) { $carton = new Carton($this->data->id, $session->warehouseId); if (isset($this->data->location)) { $carton->locationId = $this->data->location; } else { $carton->locationId = null; } if (isset($this->data->palette)) { $carton->paletteId = $this->data->palette; } else { $carton->paletteId = null; } return $carton->edit(); } break; case 'addArticle': if (isset($this->data->carton) && isset($this->data->category) && isset($this->data->amount)) { return Stock::addArticle($this->data->carton, $this->data->category, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->baby : false, isset($this->data->winter) ? $this->data->winter : false, isset($this->data->summer) ? $this->data->summer : false, $this->data->amount >= 0 ? $this->data->amount : 0, $this->data->amount < 0 ? $this->data->amount : 0); } break; case 'getStock': return Stock::getStock($session->warehouseId, isset($this->data->carton) ? $this->data->carton : null, isset($this->data->category) ? $this->data->category : null, isset($this->data->palette) ? $this->data->palette : null, isset($this->data->location) ? $this->data->location : null, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->male : false, isset($this->data->summer) ? $this->data->male : false, isset($this->data->winter) ? $this->data->male : false, isset($this->data->details) ? $this->data->details : false); case 'getBarcodeUri': if (isset($this->data->text)) { // create barcode object $bc = new Barcode39($this->data->text); if (isset($this->data->textSize)) { $bc->barcode_text_size = $this->data->textSize; } if (isset($this->data->barThin)) { $bc->barcode_bar_thin = $this->data->barThin; } if (isset($this->data->barThick)) { $bc->barcode_bar_thick = $this->data->barThick; } // generate barcode image $img = "barcode_" . mt_rand(0, 100) . ".png"; $bc->draw($img); // get data uri $uri = Barcode39::getDataURI($img); unlink($img); return $uri; } break; } } else { // process unrestricted function switch ($this->f) { case 'getActiveSessions': return Session::getActiveSessionsNumber(); case 'getWarehouses': return Warehouse::getWarehouses(); case 'addWarehouse': $data = $this->data; if (isset($data->name) && isset($data->description) && isset($data->country) && isset($data->city) && isset($data->password) && isset($data->mail)) { $warehouse = new Warehouse(); Log::debug('new warehouse' . $warehouse->id); $warehouse->name = $data->name; $warehouse->description = $data->description; $warehouse->country = $data->country; $warehouse->city = $data->city; $warehouse->setPassword($data->password); $warehouse->setMail($data->mail); return $warehouse->edit(); } break; case 'getCountries': return getCountries(); break; case 'getCountryCode': $data = $this->data; if (isset($data->name)) { return getCountryCode(null, $data->name); } return false; } } return false; }
foreach ($t as $k => $v) { echo "<option value={$k} " . ($post_state == '' && $v == 'New South Wales' || "'" . $post_state . "'" == $k ? "selected" : "") . ">" . $v . "</option>"; } ?> </select> </div> </div> <div style="clear: right;"></div><div style="clear: left;"></div> <div class="form_row" style="margin-top:20px;"> <div class="form_tdlabel"> <label>Country :</label> </div> <div class="form_tdinput"> <select class="form_input" style="width: 140px;" name="country" id="country"> <?php $t = getCountries(); foreach ($t as $k => $v) { echo "<option value={$k} " . ($post_country == '' && $v == 'Australia' || "'" . $post_country . "'" == $k ? "selected" : "") . ">" . $v . "</option>"; } ?> </select> </div> </div> <div style="clear: right;"></div><div style="clear: left;"></div> </div> <div class="form" style="margin-right:0px;margin-left:100px;width:222px;margin-top:20px;"> <div class="form_row" style="padding-bottom:10px"> <br><br><br><br><br><br><br><br><br> <div class="form_tdlabel" style="font-size:11px;text-align:left;">
</table> </div> <div id="myaccount-data" style="display:none" class="col-md-6"> <form method="POST" action="<?php echo ACTUAL_URL; ?> ?op=update_data"> <?php echo input('name', 'Nombre', $_GET['op'] == 'update_data' ? $_POST['name'] : $user->name); ?> <?php echo input('vat', 'C.I./RIF/DNI', $_GET['op'] == 'update_data' ? $_POST['vat'] : $user->vat); ?> <!-- <?php echo select('country', 'País', '', getCountries(), $_GET['op'] == 'update_data' ? array($_POST['country']) : array($user->country)); ?> --> <?php echo input('address', 'Dirección', $_GET['op'] == 'update_data' ? $_POST['address'] : $user->address); ?> <?php echo input('phone', 'Teléfono', $_GET['op'] == 'update_data' ? $_POST['phone'] : $user->phone); ?> <button type="button" onclick="$('#myaccount-data').hide()" class="btn btn-info">Cancelar</button> <button type="submit" class="btn btn-default navbar-btn">Actualizar Datos</button> </form> </div> <div id="myaccount-user" style="display:none" class="col-md-6"> <form method="POST" action="<?php echo ACTUAL_URL;
} function executeQuery($query) { $pdo = connect(); $ret = $pdo->query($query); $pdo = close($pdo); return $ret; } if (!empty($_GET['init'])) { if (!empty($_GET['getActors'])) { foreach (getActors() as $actor) { echo '<option value="' . $actor['Id'] . '">' . $actor['Nom'] . '</option>'; } } else { if (!empty($_GET['getCountries'])) { foreach (getCountries() as $country) { echo '<option value="' . $country['Pays'] . '">' . $country['Pays'] . '</option>'; } } } } else { $select = 'SELECT Titre'; $from = 'FROM Film F'; $where = 'WHERE 1'; if (!empty($_GET['actors'])) { $actorsIdsList = urldecode($_GET['actors']); $actorsIdsArray = explode(',', $actorsIdsList); $i = 0; foreach ($actorsIdsArray as $actorId) { $from .= ' JOIN Film_Acteur FA' . $i . ' ON F.Id = FA' . $i . '.IdFilm'; $where .= ' AND FA' . $i . '.IdActeur=' . $actorId;
function getOptionCountry($langSelected, $countrySelected, $title) { $langSelected = checkLang($langSelected); $countryArray = getCountries($langSelected); $options = "<option id=\"default_" . rand() . "\" value=\"" . Select_default . "\""; if ($countrySelected == "") { $options .= " selected=\"selected\""; } $options .= ">" . $title . "</option>\n"; for ($i = 0; $i < $countryArray['Count']; $i++) { $ISO = $countryArray[$i]["Iso"]; // $enName = $countryArray[$i]["En_name"]; $enName = strtr($countryArray[$i]["En_name"], ' ,().\'', '_______'); $Name = $countryArray[$i]["Name"]; $options .= "<option id=\"" . $enName . "\" value=\"" . $ISO . "\""; if ($countrySelected == $ISO) { $options .= " selected=\"selected\""; } $options .= ">" . $Name . "</option>\n"; } return $options; }
function countryName($code) { $list = getCountries(); $code = strtoupper($code); return $list[$code]; }
</div> <!-- /#mapMenu --> <div class="mapBody"> <div class="leftCol"> <div class="af map"></div> <div class="as map"></div> <div class="cr map"></div> <div class="ca map"></div> <div class="eu map" style="display:block;"></div> <div class="na map"></div> <div class="oc map"></div> <div class="sa map"></div> </div> <div class="rightCol"> <h3>Europe</h3> <div id="autoCompleteWrapper"> <?php $airports = readCSV(); echo getCountries('eu', $airports); ?> </div> <div id="autoItemsWrapper"></div> </div> </div> </div> <!-- / #airportsByMap --> </body> </html> <?php }
/** Function getInfoFilm return all movies with all information. It's possible to precised an attribute of the movie @param db connector PDO of the db @param attr array of filter for table movies /!\ Special syntax !!! Look example /!\ @param filter array of filter for other table /!\ Special syntax @return Success = array of Movies, Echec = False @example Example of attributes - field is the field in database - value : is the value for the test ('%r%' or '1', ...) - sign : is the sign for the comparation for permit compart string with special test % or _ ( '=' or 'LIKE', ...) $attr = array( 'field' => array( 'value', 'sign' ); Example of filter - field is the type of filter ('genres', 'countries', 'studios', 'actor', 'writer', 'director', 'producer', ) - value is the value for make filter /!\ add % caracter where you want for actor, writer, director and producer $filter = array( 'field' => value, 'actor' => %sara%toto% ) */ function getInfoMovies($db, $attr = array(), $filter = array()) { //recure filter array $secur = array('genres' => false, 'studios' => false, 'countries' => false, 'actor' => false, 'writer' => false, 'producer' => false, 'director' => false); $filter = array_merge($secur, $filter); $query = 'SELECT * FROM movies '; $query .= 'INNER JOIN files ON files.`fkMovies` = movies.`idMovies` '; $first = true; foreach ($attr as $key => $value) { $sign = $value[1]; if ($first) { $first = false; $query .= "WHERE movies.{$key} {$sign} '{$value[0]}' "; } else { $query .= "AND movies.{$key} {$sign} '{$value[0]}' "; } } $query .= "GROUP BY movies.`idMovies`"; $req = $db->prepare($query); if (!$req->execute()) { $error = $req->errorCode(); $error = "Error occurred during the execution of the request ('{$error}')"; //echo $error; return false; } if ($req->rowCount() >= 1) { $result = $req->fetchAll(); } else { return false; } for ($i = 0, $size = count($result); $i < $size; $i++) { $id = $result[$i]["idMovies"]; /* Need REWORK ! */ if (($result[$i]["genres"] = getGenres($db, $id, $filter['genres'])) === false && $filter['genres'] !== false) { unset($result[$i]); continue; } if (($result[$i]["countries"] = getCountries($db, $id, $filter['countries'])) === false && $filter['countries'] !== false) { unset($result[$i]); continue; } if (($result[$i]["writer"] = getPeople($db, $id, DB_WRITER_TYPE, $filter['writer'])) === false && $filter['writer'] !== false) { unset($result[$i]); continue; } if (($result[$i]["director"] = getPeople($db, $id, DB_DIRECTOR_TYPE, $filter['director'])) === false && $filter['director'] !== false) { unset($result[$i]); continue; } if (($result[$i]["actor"] = getPeople($db, $id, DB_ACTOR_TYPE, $filter['actor'])) === false && $filter['actor'] !== false) { unset($result[$i]); continue; } if (($result[$i]["producer"] = getPeople($db, $id, DB_PRODUCER_TYPE, $filter['producer'])) === false && $filter['producer'] !== false) { unset($result[$i]); continue; } if (($result[$i]["studios"] = getStudios($db, $id, $filter['studios'])) === false && $filter['studios'] !== false) { unset($result[$i]); continue; } } return $result; }
function getCountryName() { if (isEmptyString($this->getCountry())) { return "--"; } if ($this->getCountry() == 'UG') { return "Uganda"; } $countries = getCountries(); return $countries[$this->getCountry()]; }
public function getRelatedCountries() { require_once __DIR__ . '/../../classes/deprecated/countries.php'; $conn = $this->app['phraseanet.appbox']->get_connection(); $sql = 'SELECT DISTINCT Users.country ' . $this->generate_sql_constraints(); $sql .= ' ORDER BY Users.country'; $stmt = $conn->prepare($sql); $stmt->execute($this->sql_params); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); $pays = []; $ctry = \getCountries($this->app['locale']); foreach ($rs as $row) { if (trim($row['country']) === '') { continue; } if (isset($ctry[$row['country']])) { $pays[$row['country']] = $ctry[$row['country']]; } } return $pays; }
<?php $dropFirst = true; $countriesSource = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/iso_3166.xml;hb=HEAD'; $provincesSource = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166_2/iso_3166_2.xml;hb=HEAD'; $co = getCountries($countriesSource); $pr = getProvinces($provincesSource); if ($dropFirst) { printf("DROP TABLE IF EXISTS `meta_country`;\n"); printf("DROP TABLE IF EXISTS `meta_province`;\n"); printf("\n\t\t\tCREATE TABLE IF NOT EXISTS `meta_country` (\n\t\t\t\t`alpha_2` char(2) NOT NULL,\n\t\t\t\t`alpha_3` char(3) NOT NULL,\n\t\t\t\t`numeric` char(3) NOT NULL,\n\t\t\t\t`name` varchar(255) NOT NULL,\n\t\t\t\t`common_name` varchar(255) NOT NULL,\n\t\t\t\t`official_name` varchar(255) NOT NULL,\n\t\t\t\tPRIMARY KEY (`alpha_2`),\n\t\t\t\tINDEX (`alpha_3`)\n\t\t\t)\n\t\t\tENGINE=MYISAM\n\t\t\tCHARACTER SET utf8\n\t\t\tCOLLATE utf8_unicode_ci\n\t\t\tCOMMENT='ISO 3166 Country List';\n\t\t"); printf("\n\t\t\t CREATE TABLE IF NOT EXISTS `meta_province` (\n\t\t\t\t`sys_code` varchar(10) NOT NULL,\n\t\t\t\t`iso_code` varchar(7) NOT NULL,\n\t\t\t\t`country_code` char(2) NOT NULL,\n\t\t\t\t`code` varchar(4) NOT NULL,\n\t\t\t\t`name` varchar(255) NOT NULL,\n\t\t\t\t`type` varchar(30) NOT NULL,\n\t\t\t\t`parent` varchar(7) NOT NULL,\n\t\t\t\t`is_parent` tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY (`sys_code`),\n\t\t\t\tINDEX (`iso_code`),\n\t\t\t\tINDEX (`country_code`)\n\t\t\t)\n\t\t\tENGINE=MYISAM\n\t\t\tCHARACTER SET utf8\n\t\t\tCOLLATE utf8_unicode_ci\n\t\t\tCOMMENT='ISO 3166-2 Administrative Entity List';\n\t\t"); } else { printf("TRUNCATE `meta_country`;\n"); printf("TRUNCATE `meta_province`;\n"); } printf("\n"); $parentCodes = array(); foreach ($co as $country) { $coCode = $country['alpha_2']; foreach ($country as $key => $val) { $country[$key] = mysql_real_escape_string($val); } printf("\nINSERT INTO `meta_country` (`alpha_2`, `alpha_3`, `numeric`, `name`, `common_name`, `official_name`)\n"); printf("VALUES ('%s', '%s', '%s', '%s', '%s', '%s');\n", $country['alpha_2'], $country['alpha_3'], $country['numeric'], $country['name'], $country['common_name'], $country['official_name']); if (!array_key_exists($coCode, $pr)) { continue; } if (!empty($pr[$coCode])) { printf("INSERT INTO `meta_province` (`sys_code`, `iso_code`, `country_code`, `code`, `name`, `type`, `parent`) VALUES\n"); }
$strError = $arrTranslation["structure"]["error"]["noprivileges"]; } } if ($arrGlobalRights[5485] != "deny") { include MODULE_DIR . "productcatalog/actions.product.inc"; } else { $recProduct->recForm->boolClose = true; } } if ($strError) { $recProduct->recError->strError = $strError; } elseif ($recError) { $recProduct->recError->strError = $arrTranslation["structure"]["error"][$recError->type]; if (is_array($recError->fields)) { foreach ($recError->fields as $errField) { $recProduct->recError->{$errField} = "error"; } } } //$engSmarty->debugging = true; $engSmarty->assign("directors", getDirectors()); $engSmarty->assign("countries", getCountries()); $engSmarty->assign("screenings", receiveScreeningsAdmin($_GET['ID'])); $engSmarty->assign("id", $id); adminSplitMultipleData($recProduct, $id); $engSmarty->assign("_GET", $_GET); $engSmarty->assign("boolRefresh", $_GET["refresh"]); $engSmarty->assign("arrTranslation", $arrTranslation); $engSmarty->assign("recProduct", $recProduct); $engSmarty->assign("RELATIVE_DIR", '/' . RELATIVE_DIR); $engSmarty->display("admin/pop.product.tpl");
</div> </div> </div><!-- ad-item --> <?php } ?> <?php } } } if (isset($_GET['action']) && $_GET['action'] == 'edit') { $campaign = getCampaign(intval($_GET['cid'])); $id = $campaign['project_id']; $countries = getCountries(); ?> <div class="content-title">Select your thematic post:</div> <form action="" method="post"> <div class="form-item no-height thematic"> <?php $video = getFeaturingVideo($id); if (!empty($video)) { for ($i = 1; $i < 5; $i++) { ?> <div class="thematic_item"> <label for="thematic_post_<?php echo $i; ?> " class="thematic_post_<?php
function &signup($edit = false) { // Check if there is still a valid session validate_session(!$edit); $valid_input = true; // Create the HTML array with empty values $HTML = array(); $HTML['password'] = ''; $HTML['confirm_password'] = ''; $HTML['email'] = ''; $HTML['city'] = ''; $HTML['countryID'] = ''; $HTML['password_encrypted'] = ''; // Check the submitted field if (getRequest('submitted', true, 'post') !== 'yes') { // Fill in the fields if it is an edit if ($edit) { $fields = getUserInfo(get_SESSION('userID')); $HTML['email'] = $fields['email']; $HTML['city'] = $fields['city']; $HTML['countryID'] = $fields['countryID']; $HTML['password_encrypted'] = $fields['password_encrypted']; } // Populate the select drop down box getCountries($HTML['country_options_escape'], $HTML['countryID']); return $HTML; } // Fill the array with the form data foreach ($HTML as $key => &$value) { $value = getRequest($key, true, 'post'); } // Validate the email if (empty($HTML['email'])) { $HTML['email_error'] = 'Email cannot be empty'; $valid_input = false; } else { if (filter_var($HTML['email'], FILTER_VALIDATE_EMAIL) === false) { $HTML['email_error'] = 'Invalid Email Address'; $valid_input = false; } else { $newID = validate_record($HTML['email']); if ($newID > 0 and (!$edit or $newID !== trim(get_SESSION('userID')))) { $HTML['email_error'] = 'An account already exists with that email'; $valid_input = false; } } } // Validate the password $saved_pass = false; if ($edit and empty($HTML['password']) or $HTML['password'] === PASS_HOLDER and !empty($HTML['password_encrypted'])) { // use the password that was saved before $saved_pass = true; } else { if (empty($HTML['password'])) { $HTML['confirm_password_error'] = 'Password cannot be empty'; $valid_input = false; } else { if ($HTML['password'] !== $HTML['confirm_password']) { $HTML['confirm_password_error'] = 'Passwords do not match'; $valid_input = false; } else { if (!preg_match('/(?=.*\\d)(?=.*[a‐z])(?=.*[A-Z])(?=.*[\\.\\+\\\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\',"~`&@_;\\/#%-]).{6,20}/', $HTML['password'])) { $HTML['confirm_password_error'] = 'Password must be 6-20 chars and more secure!'; $valid_input = false; } } } } // Validate the city if (empty($HTML['city'])) { $HTML['city_error'] = 'City cannot be empty'; $valid_input = false; } else { if (preg_match('/(?=.*[\\d\\.\\+\\\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\'"~`&@_;\\/#%])/', $HTML['city'])) { $HTML['city_error'] = 'Special characters are not allowed'; $valid_input = false; } } // Validate the country if (empty($HTML['countryID'])) { $HTML['countryID_error'] = 'Please select your country'; $valid_input = false; } else { if (!validate_countryID($HTML['countryID'])) { $HTML['countryID_error'] = 'Invalid country submitted'; $valid_input = false; } } if ($valid_input) { // If it is the edit page update the user and return to account page if ($edit) { updateUser($HTML, $saved_pass); set_header('account'); exit; } if (empty($GLOBALS['DB'])) { die('Database Link is not set'); } // Create a user $query = sprintf('INSERT INTO users (email, password, city, countryID) VALUES (\'%s\',\'%s\',\'%s\',\'%s\')', mysql_real_escape_string($HTML['email']), mysql_real_escape_string($saved_pass ? $HTML['password_encrypted'] : md5($HTML['password'])), mysql_real_escape_string($HTML['city']), mysql_real_escape_string($HTML['countryID'])); $result = mysql_query($query); // Make sure it executed properly if (!$result) { $HTML['signup_error'] = 'Error adding user'; return $HTML; } set_SESSION('userID', validate_record($HTML['email'])); set_header('account'); exit; } // Populate the select drop down box since we have to go back to the page getCountries($HTML['country_options_escape'], $HTML['countryID']); // Store the password if it was valid and changed if (empty($HTML['confirm_password_error'])) { if (!empty($HTML['password']) and $HTML['password'] !== PASS_HOLDER) { $HTML['password_encrypted'] = md5($HTML['password']); $HTML['password'] = PASS_HOLDER; $HTML['confirm_password'] = PASS_HOLDER; } // Clear the password if it was invalid or set it back to do not change if it is an edit page } else { if (!$edit) { $HTML['password_encrypted'] = ''; } $HTML['password'] = ''; $HTML['confirm_password'] = ''; } return $HTML; }
exit; } $user = $_SESSION['user']; $error = false; $msj = false; $service = false; $plan_db = false; if ($_GET['currency'] != 'VEF' && $_GET['currency'] != 'USD') { $error = 'La moneda seleccionada no esta soportada por nuestro sistema'; } if (!isset($_GET['id_plan']) || (int) $_GET['id_plan'] < 1) { $error = 'Debe seleccionar un plan.'; } $country = getGeoip(); if ($_GET['currency'] == 'VEF' && ($user->country != 'VE' || $country != 'VE')) { $error = 'Se ha detectado que usted se encuentra en ' . getCountries($user->country != 'VE' ? $user->country : $country) . ', usted sólo puede pagar en U$D.'; } if ($_GET['id_service']) { $service = $db->ls("SELECT * FROM api_invoices INNER JOIN api_services ON api_invoices.id_service = api_services.id_service WHERE api_services.id_usuario = %d AND api_services.id_service = %d ORDER BY date_created DESC LIMIT 1", array($user->id, (int) $_GET['id_service'])); } if ($service && (!(bool) $service['activo'] || strtotime($service['proximo_corte']) - time() >= 15 * 24 * 3600)) { $error = 'El APP que intenta renovar no esta Activo o la fecha de vencimiento es superior a 15 dias.'; } if ($service && !$error && $service['currency'] != $_GET['currency']) { $error = 'Esta intentando pagar con una moneda distinta a la del servicio ya contratado'; } if (!$error) { $plan_db = $db->ls("SELECT planes.*, precios.* FROM api_planes planes INNER JOIN api_precio_planes precios ON planes.id_plan = precios.id_plan WHERE precios.currency = '%s' AND precios.id_plan = '%d'" . (User::isAdmin() ? '' : ' AND planes.activo = 1'), array(secInjection($_GET['currency']), (int) $_GET['id_plan']), true); } if (!$error && !$plan_db) { $error = 'El plan seleccionado no existe o no se encuentra activo para la venta en este momento.';
<script type="text/javascript" src="ajax/ajax.js"></script> </head> <body> <?php if ($errMsg) { echo $errMsg . '<br>'; } ?> <form method="post" action=""> <div class="container"> <div class="row"> <div class="col-lg-6 col-md-6 selection"> <h5><em>Select country:</em></h5> <select name="country" id="countries" onchange="countrySelect(this.value);" > <?php if ($countries = getCountries($selectedCountry)) { echo $countries['options']; $selectedCountry = $countries['selected']; } ?> </select> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-5 col-xs-5 col-lg-offset-9 col-md-offset-9 col-sm-offset-7 col-xs-offset-7 editor" id="countryEditor"> <a href='rest.php?add=country'>add</a> <a href="rest.php?edit=country&id=<?php echo $selectedCountry; ?> ">edit</a> <a href="rest.php?del=country&id=<?php echo $selectedCountry; ?>