本文整理汇总了PHP中generate_id函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_id函数的具体用法?PHP generate_id怎么用?PHP generate_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the command.
*
* @return void
*/
public function handle()
{
$this->exam->create($this->request->all());
$this->exam->update(['uid' => generate_id()]);
session()->flash('success-message', trans('site.Successfully created'));
event(new Exam\Events\CreatedEvent($this->exam));
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\Model\Course\Course::truncate();
// factory(\Model\Course\Course::class, 10)->create();
\Model\Course\Course::create(['id' => 1, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=9', 'image' => 'img/course/cover/tarih-600x400.jpg', 'code' => 'TAR-251', 'name' => 'Ата Мекен Тарыхы I', 'description' => 'Атамекен (Кыргыз Республикасынын) тарыхын окутууга киришүү Кыргызстандагы этникалык процесстер, кыргыз элинин жаралышы жана калыптанышы жөнүндө', 'approved' => true, 'published' => true, 'order' => 10]);
\Model\Course\Course::create(['id' => 2, 'uid' => generate_id(), 'url' => null, 'image' => 'img/course/cover/ekoloji-600x400.jpg', 'code' => 'CEV-150', 'name' => 'Экология', 'description' => 'Киришүү. Экологиянын маселелери, изилдөө объектиси жана структурасы. Экологиянын дисциплиналар арасындагы мүнөзү', 'approved' => true, 'published' => true, 'order' => 20]);
\Model\Course\Course::create(['id' => 3, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=8', 'image' => 'img/course/cover/turk-uygralik-600x400.jpg', 'code' => 'TAR-202', 'name' => 'Dünya ve Türk Uygarlıkları', 'description' => 'Көчмөн цивлизациялардын өзгөчөлүктөрү', 'approved' => true, 'published' => true, 'order' => 30]);
\Model\Course\Course::create(['id' => 4, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=3', 'image' => 'img/course/cover/manas-600x400.jpg', 'code' => 'TUR-226', 'name' => 'Manasşinaslık', 'description' => '“Манас” эпосу – кыргыз рухунун туу чокусу', 'approved' => true, 'published' => true, 'order' => 40]);
\Model\Course\Course::create(['id' => 5, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=7', 'image' => 'img/course/cover/felsefe-600x400.jpg', 'code' => 'FIL-291', 'name' => 'Felsefe', 'description' => 'Felsefe Tarihi II (İslam ve Ortaçağ Felsefesi)', 'approved' => true, 'published' => true, 'order' => 50]);
\Model\Course\Course::create(['id' => 6, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=12', 'image' => 'img/course/cover/positif-bilimler-600x400.jpg', 'code' => 'FEN-102', 'name' => 'Pozitiv Bilim Kavramları', 'description' => 'Заманбап табият таануу илимдеринин концепциялары курсунун предмети. Коом, маданият жана илим.', 'approved' => true, 'published' => true, 'order' => 60]);
\Model\Course\Course::create(['id' => 7, 'uid' => generate_id(), 'url' => 'http://eders.manas.edu.kg/enrol/index.php?id=2', 'image' => 'img/course/cover/tarih-2-600x400.jpg', 'code' => 'FEN-102', 'name' => 'Ata Meken Tarihi II (TR)', 'description' => 'Türkiye Cumhuriyeti Tarihi', 'approved' => true, 'published' => true, 'order' => 70]);
\Model\Course\Course::create(['id' => 8, 'uid' => generate_id(), 'url' => null, 'image' => 'img/course/cover/ume-333-600x400.jpg', 'code' => 'UME3', 'name' => 'Programming Languages I', 'description' => 'Programming Languages I', 'approved' => true, 'published' => true, 'order' => 80]);
\Model\Course\Course::create(['id' => 9, 'uid' => generate_id(), 'url' => null, 'image' => 'img/course/cover/java-600x400.jpg', 'code' => 'UME4', 'name' => 'Programming Languages II', 'description' => 'Introduction to Programming using Java', 'approved' => true, 'published' => true, 'order' => 90]);
// $courses = \Model\Course\Course::lists('id');
// $users = \Model\User\User::whereIn('role', ['student', 'teacher'])->lists('id')->toArray();
\DB::table('user_course')->insert(['user_id' => 3, 'course_id' => 2]);
\DB::table('user_course')->insert(['user_id' => 4, 'course_id' => 2]);
$students = \Model\User\User::where('role', '=', 'student')->get();
// registering students to course
$arr = [];
foreach ($students as $student) {
$arr[] = ['user_id' => $student->id(), 'course_id' => 2];
}
\DB::table('user_course')->insert($arr);
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\Model\Question\Question::truncate();
/* factory(\Model\Question\Question::class, 100)->create(); */
$section1 = \Model\Section\Section::where('course_id', '=', 2)->first();
$section2 = \Model\Section\Section::where('course_id', '=', 2)->where('id', '>', $section1->id())->first();
$section3 = \Model\Section\Section::where('course_id', '=', 2)->where('id', '>', $section2->id())->first();
$section4 = \Model\Section\Section::where('course_id', '=', 2)->where('id', '>', $section3->id())->first();
\Model\Question\Question::insert([['id' => 1, 'section_id' => $section1->id(), 'uid' => generate_id(), 'text' => '“Экология” терминин сунуштаган окумуштуу'], ['id' => 2, 'section_id' => $section1->id(), 'uid' => generate_id(), 'text' => '“Экосистема” терминин сунуштаган окумуштуу'], ['id' => 3, 'section_id' => $section1->id(), 'uid' => generate_id(), 'text' => 'Биосфера жана ноосфера жөнүндө окуунун негиздөөчүсү'], ['id' => 4, 'section_id' => $section1->id(), 'uid' => generate_id(), 'text' => 'Аутэкологиянын изилдөө предмети'], ['id' => 5, 'section_id' => $section1->id(), 'uid' => generate_id(), 'text' => 'Заманбап экологиянын максаты'], ['id' => 6, 'section_id' => $section2->id(), 'uid' => generate_id(), 'text' => 'Организмдин жашоо чөйрөсү деп эмнени айтабыз?'], ['id' => 7, 'section_id' => $section2->id(), 'uid' => generate_id(), 'text' => 'Эдафикалык факторлор бул:'], ['id' => 8, 'section_id' => $section2->id(), 'uid' => generate_id(), 'text' => 'Орографикалык факторлор бул:'], ['id' => 9, 'section_id' => $section2->id(), 'uid' => generate_id(), 'text' => 'Лимиттенген факторлордун түргө таасири кандай:'], ['id' => 10, 'section_id' => $section2->id(), 'uid' => generate_id(), 'text' => 'Эврибионттор кандай организмдер?'], ['id' => 11, 'section_id' => $section3->id(), 'uid' => generate_id(), 'text' => 'Биогеценоз түшүнүгүн сунуштаган окумуштуу'], ['id' => 12, 'section_id' => $section3->id(), 'uid' => generate_id(), 'text' => 'Экосистема терминин сунуштаган окумуштуу'], ['id' => 13, 'section_id' => $section3->id(), 'uid' => generate_id(), 'text' => 'Бентос бул:'], ['id' => 14, 'section_id' => $section3->id(), 'uid' => generate_id(), 'text' => 'Гетеротрофтор:'], ['id' => 15, 'section_id' => $section3->id(), 'uid' => generate_id(), 'text' => 'Сукцессия бул:'], ['id' => 16, 'section_id' => $section4->id(), 'uid' => generate_id(), 'text' => 'Биосфера бул:'], ['id' => 17, 'section_id' => $section4->id(), 'uid' => generate_id(), 'text' => 'Костук заттар:'], ['id' => 18, 'section_id' => $section4->id(), 'uid' => generate_id(), 'text' => 'Биогендик заттар:'], ['id' => 19, 'section_id' => $section4->id(), 'uid' => generate_id(), 'text' => 'Топурак бул:'], ['id' => 20, 'section_id' => $section4->id(), 'uid' => generate_id(), 'text' => 'Жандуу заттын негизги функцияларынын бири:']]);
}
示例4: add_user
function add_user(&$dbh)
{
while (true) {
$user_id = generate_id();
$q = "INSERT INTO users (id) VALUES (?)";
log_debug($q, $user_id);
$res = $dbh->query($q, $user_id);
if (PEAR::isError($res)) {
if ($res->getCode() == DB_ERROR_ALREADY_EXISTS) {
continue;
}
die_with_code(500, "{$res->message}\n{$q}\n");
}
return get_user($dbh, $user_id);
}
}
示例5: add_form
function add_form(&$dbh, $user_id)
{
while (true) {
$form_id = generate_id();
$q = sprintf('INSERT INTO forms
SET id = %s, user_id = %s', $dbh->quoteSmart($form_id), $dbh->quoteSmart($user_id));
error_log(preg_replace('/\\s+/', ' ', $q));
$res = $dbh->query($q);
if (PEAR::isError($res)) {
if ($res->getCode() == DB_ERROR_ALREADY_EXISTS) {
continue;
}
die_with_code(500, "{$res->message}\n{$q}\n");
}
return get_form($dbh, $form_id);
}
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\Model\Faculty\Faculty::truncate();
// factory(\Model\Faculty\Faculty::class, 10)->create();
\Model\Faculty\Faculty::create(['id' => 1, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'edb', 'name_en' => 'Letters', 'name_tr' => 'Edebiyat', 'name_kg' => 'Гуманитардык', 'name_ru' => 'Гуманитарный']);
\Model\Faculty\Faculty::create(['id' => 2, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'fen', 'name_en' => 'Science', 'name_tr' => 'Fen', 'name_kg' => 'Табигый Илимдер', 'name_ru' => 'Точные Науки']);
\Model\Faculty\Faculty::create(['id' => 3, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'arts', 'name_en' => 'Fine Arts', 'name_tr' => 'Güzel Sanatlar', 'name_kg' => 'Көркөм Өнөр', 'name_ru' => 'Искусство']);
\Model\Faculty\Faculty::create(['id' => 4, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'iibf', 'name_en' => 'Economics and Administrative Science', 'name_tr' => 'İktisadi ve İdari Bilimler', 'name_kg' => 'Экономика жана Башкаруу', 'name_ru' => 'Экономика и Управление']);
\Model\Faculty\Faculty::create(['id' => 5, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'teo', 'name_en' => 'Theology', 'name_tr' => 'İlahiyat', 'name_kg' => 'Теология', 'name_ru' => 'Теология']);
\Model\Faculty\Faculty::create(['id' => 6, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'ilet', 'name_en' => 'Communication', 'name_tr' => 'İletişim', 'name_kg' => 'Комуникация', 'name_ru' => 'Комуникация']);
\Model\Faculty\Faculty::create(['id' => 7, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'muh', 'name_en' => 'Engineering', 'name_tr' => 'Mühendislik', 'name_kg' => 'Инженердик', 'name_ru' => 'Инженерия']);
\Model\Faculty\Faculty::create(['id' => 8, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'vet', 'name_en' => 'Veterinary', 'name_tr' => 'Veteriner', 'name_kg' => 'Ветеринардык', 'name_ru' => 'Ветеринария']);
\Model\Faculty\Faculty::create(['id' => 9, 'type' => 'faculty', 'uid' => generate_id(), 'code' => 'ziraat', 'name_en' => 'Agriculture', 'name_tr' => 'Ziraat', 'name_kg' => 'Айыл Чарба', 'name_ru' => 'Сельскохозяйственный']);
\Model\Faculty\Faculty::create(['id' => 10, 'type' => 'highschool', 'uid' => generate_id(), 'code' => 'foreign', 'name_en' => 'Foreign Languages', 'name_tr' => 'Yabancı Diller', 'name_kg' => 'Чет Тилдер', 'name_ru' => 'Иностранные Языки']);
\Model\Faculty\Faculty::create(['id' => 11, 'type' => 'highschool', 'uid' => generate_id(), 'code' => 'beden', 'name_en' => 'Physical Education and Sports', 'name_tr' => 'Beden Eğitimi ve Spor', 'name_kg' => 'Физкультура жана Спорт', 'name_ru' => 'Физкультура и Спорт']);
\Model\Faculty\Faculty::create(['id' => 12, 'type' => 'highschool', 'uid' => generate_id(), 'code' => 'turizm', 'name_en' => 'Tourism and Hotel Management', 'name_tr' => 'Turizm ve Otelcilik', 'name_kg' => 'Туризм жана Мейманкана Иштетүү', 'name_ru' => 'Туризм и Гостиничное Дело']);
\Model\Faculty\Faculty::create(['id' => 13, 'type' => 'highschool', 'uid' => generate_id(), 'code' => 'meslek', 'name_en' => 'Vocational High School', 'name_tr' => 'Meslek Yüksekokulu', 'name_kg' => 'Кесиптик Жогорку Мектеби', 'name_ru' => 'Профессиональная Высшая Школа']);
}
示例7: persist
function persist()
{
$sql = "REPLACE INTO " . $_prefix . $this->_table . " SET ";
//echo "<br><br>";
$fields = sqlListFields($this->_table);
$db = get_db();
$pkeys = $db->MetaPrimaryKeys($this->_table);
foreach ($fields as $field) {
$func = "get_" . $field;
//echo "f: $field m: $func status: " . (is_callable(array($this,$func))? "yes" : "no") . "<br>";
if (is_callable(array($this, $func))) {
$val = call_user_func(array($this, $func));
//modified 01-2010 by BGM to centralize to formdata.inc.php
// have place several debug statements to allow standardized testing over next several months
if (!is_array($val)) {
//DEBUG LINE - error_log("ORDataObject persist before strip: ".$val, 0);
$val = strip_escape_custom($val);
//DEBUG LINE - error_log("ORDataObject persist after strip: ".$val, 0);
}
if (in_array($field, $pkeys) && empty($val)) {
$last_id = generate_id();
call_user_func(array(&$this, "set_" . $field), $last_id);
$val = $last_id;
}
if (!empty($val)) {
//echo "s: $field to: $val <br>";
//modified 01-2010 by BGM to centralize to formdata.inc.php
// have place several debug statements to allow standardized testing over next several months
$sql .= " `" . $field . "` = '" . add_escape_custom(strval($val)) . "',";
//DEBUG LINE - error_log("ORDataObject persist after escape: ".add_escape_custom(strval($val)), 0);
//DEBUG LINE - error_log("ORDataObject persist after escape and then stripslashes test: ".stripslashes(add_escape_custom(strval($val))), 0);
//DEBUG LINE - error_log("ORDataObject original before the escape and then stripslashes test: ".strval($val), 0);
}
}
}
if (strrpos($sql, ",") == strlen($sql) - 1) {
$sql = substr($sql, 0, strlen($sql) - 1);
}
//echo "<br>sql is: " . $sql . "<br /><br>";
sqlQuery($sql);
return true;
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\Model\Department\Department::truncate();
// factory(\Model\Department\Department::class, 10)->create();
\Model\Department\Department::create(['id' => 1001, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'tar', 'name_en' => 'History', 'name_tr' => 'Tarih', 'name_kg' => 'Тарых', 'name_ru' => 'История']);
\Model\Department\Department::create(['id' => 1002, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'tur', 'name_en' => 'Turkology', 'name_tr' => 'Türkoloji', 'name_kg' => 'Түркология', 'name_ru' => 'Тюркология']);
\Model\Department\Department::create(['id' => 1003, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'fls', 'name_en' => 'Philosophy', 'name_tr' => 'Felsefe', 'name_kg' => 'Философия', 'name_ru' => 'Философия']);
\Model\Department\Department::create(['id' => 1004, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'sos', 'name_en' => 'Sociology', 'name_tr' => 'Sosyoloji', 'name_kg' => 'Социология', 'name_ru' => 'Социология']);
\Model\Department\Department::create(['id' => 1005, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'pdr', 'name_en' => 'Psychological Counseling And Guidance', 'name_tr' => 'Psikolojik Danışmanlık ve Rehberlik', 'name_kg' => 'Психологиялык Кеңеш Жана Көмөк', 'name_ru' => 'Психологическая Консультация И Помощ']);
\Model\Department\Department::create(['id' => 1006, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'cde', 'name_en' => 'Eastern Languages (Chinese Language and Literature)', 'name_tr' => 'Doğu Dilleri (Çin Dili Ve Edebiyatı)', 'name_kg' => 'Чыгыш Тилдери (Кытай Тили жана Адабияты)', 'name_ru' => 'Восточные Языки (Китайский Язык и Литература)']);
\Model\Department\Department::create(['id' => 1007, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'rde', 'name_en' => 'Eastern Languages (Russian Language and Literature)', 'name_tr' => 'Doğu Dilleri (Rus Dili Ve Edebiyatı)', 'name_kg' => 'Чыгыш Тилдери (Орус Тили жана Адабияты)', 'name_ru' => 'Восточные Языки (Русский Язык и Литература)']);
\Model\Department\Department::create(['id' => 1008, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'ide', 'name_en' => 'Western Languages (English Language and Literature)', 'name_tr' => 'Batı Dilleri (İngiliz Dili Ve Edebiyatı)', 'name_kg' => 'Батыш Тилдери (Англис Тили жана Адабияты)', 'name_ru' => 'Западные Языки (Англиский Язык и Литература)']);
\Model\Department\Department::create(['id' => 1009, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'tki', 'name_en' => 'Simultaneous Interpreting (Kyrgyz-English)', 'name_tr' => 'Mütercim-Tercümanlık (Kırgızca-İngilizce)', 'name_kg' => 'Синхрондук Котормо (Кыргызча-Англисче)', 'name_ru' => 'Синхронный Перевод (Кыргызско-Английский)']);
\Model\Department\Department::create(['id' => 1010, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'tkt', 'name_en' => 'Simultaneous Interpreting (Kyrgyz-Turkish)', 'name_tr' => 'Mütercim-Tercümanlık (Kırgızca-Türkçe)', 'name_kg' => 'Синхрондук Котормо (Кыргызча-Түркчө)', 'name_ru' => 'Синхронный Перевод (Кыргызско-Турецкий)']);
\Model\Department\Department::create(['id' => 1011, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'trt', 'name_en' => 'Simultaneous Interpreting (Russsian-Turkish)', 'name_tr' => 'Mütercim-Tercümanlık (Rusça-Türkçe)', 'name_kg' => 'Синхрондук Котормо (Орусча-Түркчө)', 'name_ru' => 'Синхронный Перевод (Русско-Турецкий)']);
\Model\Department\Department::create(['id' => 1012, 'faculty_id' => 1, 'uid' => generate_id(), 'code' => 'eyd', 'name_en' => 'Education Management and Supervision', 'name_tr' => 'Eğitim Yönetimi ve Denetimi', 'name_kg' => 'Билим Берүүнү Башкаруу жана Инспекциялоо', 'name_ru' => 'Менеджмент и Инспектирование Образования']);
\Model\Department\Department::create(['id' => 2001, 'faculty_id' => 2, 'uid' => generate_id(), 'code' => 'ume', 'name_en' => 'Applied Mathematics and Informatics', 'name_tr' => 'Uygulamalı Matematik ve Enformatik', 'name_kg' => 'Колдонмо Математика жана Информатика', 'name_ru' => 'Прикладная Математика и Информатика']);
\Model\Department\Department::create(['id' => 2002, 'faculty_id' => 2, 'uid' => generate_id(), 'code' => 'mat', 'name_en' => 'Mathematics', 'name_tr' => 'Matematik', 'name_kg' => 'Математика', 'name_ru' => 'Математика']);
\Model\Department\Department::create(['id' => 2003, 'faculty_id' => 2, 'uid' => generate_id(), 'code' => 'bio', 'name_en' => 'Biology', 'name_tr' => 'Biyoloji', 'name_kg' => 'Биология', 'name_ru' => 'Биология']);
\Model\Department\Department::create(['id' => 3001, 'faculty_id' => 3, 'uid' => generate_id(), 'code' => 'res', 'name_en' => 'Painting', 'name_tr' => 'Resim', 'name_kg' => 'Сүрөт', 'name_ru' => 'Живопись']);
\Model\Department\Department::create(['id' => 3002, 'faculty_id' => 3, 'uid' => generate_id(), 'code' => 'grf', 'name_en' => 'Graphics', 'name_tr' => 'Grafik', 'name_kg' => 'Графика', 'name_ru' => 'Графика']);
\Model\Department\Department::create(['id' => 3003, 'faculty_id' => 3, 'uid' => generate_id(), 'code' => 'muz', 'name_en' => 'Music Arts', 'name_tr' => 'Müzik Sanatı', 'name_kg' => 'Эстрадалык Вокал', 'name_ru' => 'Эстрадный Вокал']);
\Model\Department\Department::create(['id' => 3004, 'faculty_id' => 3, 'uid' => generate_id(), 'code' => 'tis', 'name_en' => 'Scene Arts', 'name_tr' => 'Sahne Sanatları', 'name_kg' => 'Актердук Өнөр', 'name_ru' => 'Актерское Искусство']);
\Model\Department\Department::create(['id' => 4001, 'faculty_id' => 4, 'uid' => generate_id(), 'code' => 'ekn', 'name_en' => 'Economy', 'name_tr' => 'İktisat', 'name_kg' => 'Экономика', 'name_ru' => 'Экономика']);
\Model\Department\Department::create(['id' => 4002, 'faculty_id' => 4, 'uid' => generate_id(), 'code' => 'isl', 'name_en' => 'Management', 'name_tr' => 'İşletme', 'name_kg' => 'Менеджмент', 'name_ru' => 'Менеджмент']);
\Model\Department\Department::create(['id' => 4003, 'faculty_id' => 4, 'uid' => generate_id(), 'code' => 'mab', 'name_en' => 'Finance', 'name_tr' => 'Maliye', 'name_kg' => 'Финанс', 'name_ru' => 'Финансы']);
\Model\Department\Department::create(['id' => 4004, 'faculty_id' => 4, 'uid' => generate_id(), 'code' => 'uls', 'name_en' => 'International Relations', 'name_tr' => 'Uluslararası İlişkiler', 'name_kg' => 'Эл Аралык Мамилелер', 'name_ru' => 'Международные Отношения']);
\Model\Department\Department::create(['id' => 4005, 'faculty_id' => 4, 'uid' => generate_id(), 'code' => 'fin', 'name_en' => 'Finance and Banking', 'name_tr' => 'Finans ve Bankacılık', 'name_kg' => 'Финанс жана Кредит', 'name_ru' => 'Финансы и Кредит']);
\Model\Department\Department::create(['id' => 5001, 'faculty_id' => 5, 'uid' => generate_id(), 'code' => 'ilh', 'name_en' => 'Islamic Studies', 'name_tr' => 'İslam Bilimleri', 'name_kg' => 'Ислам Билимдери', 'name_ru' => 'Исламоведение']);
\Model\Department\Department::create(['id' => 5002, 'faculty_id' => 5, 'uid' => generate_id(), 'code' => 'dib', 'name_en' => 'Religious Studies', 'name_tr' => 'Din Bilimleri', 'name_kg' => 'Дин Билимдери', 'name_ru' => 'Религиоведение']);
\Model\Department\Department::create(['id' => 6001, 'faculty_id' => 6, 'uid' => generate_id(), 'code' => 'gzt', 'name_en' => 'Journalism', 'name_tr' => 'Gazetecilik', 'name_kg' => 'Журналистика', 'name_ru' => 'Журналистика']);
\Model\Department\Department::create(['id' => 6002, 'faculty_id' => 6, 'uid' => generate_id(), 'code' => 'hir', 'name_en' => 'Public Relations and Advertising', 'name_tr' => 'Halkla İlişkiler ve Reklamcılık', 'name_kg' => 'Коом менен Байланыш жана Реклама', 'name_ru' => 'Связь с Общественностью и Рекламное Дело']);
\Model\Department\Department::create(['id' => 6003, 'faculty_id' => 6, 'uid' => generate_id(), 'code' => 'rts', 'name_en' => 'Radio, Television and Cinema', 'name_tr' => 'Radyo, Televizyon ve Sinema', 'name_kg' => 'Радио, Телевидение жана Кино', 'name_ru' => 'Радио, Телевидение и Кино']);
\Model\Department\Department::create(['id' => 7001, 'faculty_id' => 7, 'uid' => generate_id(), 'code' => 'bil', 'name_en' => 'Computer Engineering', 'name_tr' => 'Bilgisayar Mühendisliği', 'name_kg' => 'Компьютер Инженердиги', 'name_ru' => 'Компьютерная Инженерия']);
\Model\Department\Department::create(['id' => 7002, 'faculty_id' => 7, 'uid' => generate_id(), 'code' => 'cev', 'name_en' => 'Ecological Engineering', 'name_tr' => 'Çevre Mühendisliği', 'name_kg' => 'Экологиялык Инженердиги', 'name_ru' => 'Экологическая Инженерия']);
\Model\Department\Department::create(['id' => 7003, 'faculty_id' => 7, 'uid' => generate_id(), 'code' => 'kmu', 'name_en' => 'Chemical Engineering', 'name_tr' => 'Kimya Mühendisliği', 'name_kg' => 'Химия Инженердиги', 'name_ru' => 'Химическая Инженерия']);
\Model\Department\Department::create(['id' => 7004, 'faculty_id' => 7, 'uid' => generate_id(), 'code' => 'gid', 'name_en' => 'Food Engineering', 'name_tr' => 'Gıda Mühendisliği', 'name_kg' => 'Тамак-Аш Инженердиги', 'name_ru' => 'Пищевая Инженерия']);
\Model\Department\Department::create(['id' => 8001, 'faculty_id' => 8, 'uid' => generate_id(), 'code' => 'vet', 'name_en' => 'Veterinary', 'name_tr' => 'Veteriner', 'name_kg' => 'Ветеринардык', 'name_ru' => 'Ветеринария']);
\Model\Department\Department::create(['id' => 9001, 'faculty_id' => 9, 'uid' => generate_id(), 'code' => 'btb', 'name_en' => 'Horticulture and Agronomy', 'name_tr' => 'Bahçe ve Tarla Bitkileri', 'name_kg' => 'Мөмө-жемиш жана Талаа өсүмдүктөрү', 'name_ru' => 'Плодоовощеводство']);
\Model\Department\Department::create(['id' => 9002, 'faculty_id' => 9, 'uid' => generate_id(), 'code' => 'bko', 'name_en' => 'Plant Protection', 'name_tr' => 'Bitki Koruma', 'name_kg' => 'Өсүмдүктөрдү Коргоо', 'name_ru' => 'Защита Растений']);
\Model\Department\Department::create(['id' => 9003, 'faculty_id' => 9, 'uid' => generate_id(), 'code' => 'zoo', 'name_en' => 'Animal Science', 'name_tr' => 'Zootekni', 'name_kg' => 'Зоотехника', 'name_ru' => 'Зоотехника']);
}
示例9: send_mail_etu
function send_mail_etu()
{
//generation de l' id
generate_id();
require_once 'MSN.php';
//Parametres du mail
$subject = "[Master Upmc voeux inscription M1] Verification d'email";
$message = "Bonjour " . $_SESSION['prenom'] . ".<br/> Votre identifiant de session est : " . $_SESSION['ident'];
//Pour envoyer un mail HTML, l'en-tête Content-type doit être defini
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
//En-têtes additionnels
$headers .= 'From: ' . $msn[$_SESSION['spe']] . "\r\n";
//envoi du mail
if (mail($_SESSION['mail'], $subject, $message, $headers)) {
header("Location: saisie_identifiant.php");
} else {
echo "Une erreur s'est produite!";
exit;
//sortie
}
}
示例10: add_scan
function add_scan(&$dbh, $user_id)
{
while (true) {
$scan_id = generate_id();
if ($user_id != null) {
// TODO why doesn't this work wth params? Broken PEAR::DB version?
$q = sprintf("INSERT INTO scans (id, user_id) VALUES (%s, %s)", $dbh->quoteSmart($scan_id), $dbh->quoteSmart($user_id));
log_debug($q);
$res = $dbh->query($q);
} else {
$q = 'INSERT INTO scans (id) VALUES (?)';
log_debug($q, $scan_id);
$res = $dbh->query($q, $scan_id);
}
if (PEAR::isError($res)) {
if ($res->getCode() == DB_ERROR_ALREADY_EXISTS) {
continue;
}
die_with_code(500, "{$res->message}\n{$q}\n");
}
return get_scan($dbh, $scan_id);
}
}
示例11: add_mbtiles
function add_mbtiles(&$dbh, $user_id, $url, $file_name, $file_path)
{
$mbtiles_data = get_mbtiles_data($file_path);
$mbtiles_id = generate_id();
$q = sprintf('INSERT INTO mbtiles
SET id = %s,
user_id = %s,
url = %s,
uploaded_file = %s,
min_zoom = %d,
max_zoom = %d,
center_zoom = %d,
center_x_coord = %d,
center_y_coord = %d', $dbh->quoteSmart($mbtiles_id), $dbh->quoteSmart($user_id), $dbh->quoteSmart($url), $dbh->quoteSmart($file_name), $dbh->quoteSmart($mbtiles_data['min_zoom']), $dbh->quoteSmart($mbtiles_data['max_zoom']), $dbh->quoteSmart($mbtiles_data["center_coordinates"]['zoom']), $dbh->quoteSmart($mbtiles_data["center_coordinates"]['x']), $dbh->quoteSmart($mbtiles_data["center_coordinates"]['y']));
error_log(preg_replace('/\\s+/', ' ', $q));
$res = $dbh->query($q);
if (PEAR::isError($res)) {
if ($res->getCode() == DB_ERROR_ALREADY_EXISTS) {
continue;
}
die_with_code(500, "{$res->message}\n{$q}\n");
}
return get_mbtiles_by_id($dbh, $mbtiles_id);
}
示例12: save
function save($params, $data)
{
global $message, $api, $base_path;
$title = $params['title'];
$bbcode = $params['bbcode'];
if (strlen($title) < 3 && strlen($bbcode) < 7) {
if ($api) {
return_json(array('error' => 'Would not save empty data, sorry'));
} else {
$message = 'Would not save empty data, sorry';
}
return;
}
if (strlen($title) > 250) {
$spacepos = strrpos($title, ' ');
$title = substr($title, 0, $spacepos !== false ? $spacepos : 250);
}
$db = getdb();
if ($data && isset($params['key']) && $data['editid'] == $params['key']) {
// update
$codeid = $params['id'];
$editid = $params['key'];
$sql = !$db ? '' : "update " . DB_TABLE . " set updated=now(), title='" . $db->escape_string($title) . "', bbcode='" . $db->escape_string($bbcode) . "' where codeid = '{$codeid}'";
cache_remove($codeid, 'code');
cache_remove(false, 'user');
// yup, now a lot of users can have their libraries updated
} else {
$editid = generate_id(EDIT_HASH_LENGTH);
$tries = 10;
do {
$codeid = generate_id(HASH_LENGTH);
$exists = get_data($codeid) !== false;
} while ($exists);
$sql = !$db ? '' : "insert into " . DB_TABLE . " (created, updated, codeid, editid, title, bbcode) values(now(), now(), '{$codeid}', '{$editid}', '" . $db->escape_string($title) . "', '" . $db->escape_string($bbcode) . "')";
}
if ($db) {
$res = $db->query($sql);
} else {
// put code to cache
$assoc = array('editid' => $editid, 'title' => $title, 'bbcode' => $bbcode);
cache_put($codeid, 'code', $assoc);
$res = true;
}
if (!$api) {
if (!$res) {
$message = 'Failed to insert entry in the database: ' . $db->error;
} else {
header("Location: " . $base_path . "/{$codeid}/{$editid}");
exit;
}
} else {
if (!$res) {
return_json(array('error' => 'Failed to insert entry in the database: ' . $db->error));
} else {
return_json(array('codeid' => $codeid, 'editid' => $editid, 'viewurl' => $base_path . "/{$codeid}", 'editurl' => $base_path . "/{$codeid}/{$editid}"));
}
exit;
}
}
示例13: creating
public function creating($model)
{
$model->uid = generate_id();
}
示例14: generateSequenceID
public function generateSequenceID()
{
return generate_id();
}
示例15: process_tv
function process_tv()
{
global $config, $twitter;
$shows_added = 0;
$mail_string = '';
print date($config['logging']['date_format']) . 'hellaVCR/' . $config['version'] . "\n";
print date($config['logging']['date_format']) . "processing tv...\n";
//check to make sure the file exists
if (file_exists($config['xml_tv'])) {
//create a SimpleXML object
$xml = simplexml_load_file($config['xml_tv']) or die("Can't read XML");
//loop over each show
$shows = $xml->xpath('/tv/show');
foreach ($shows as $show) {
//extra show name info
$nameExtra = array();
if (array_key_exists(strval($show->format), $GLOBALS['formats'])) {
$nameExtra[] = $GLOBALS['formats'][strval($show->format)];
}
if (array_key_exists(strval($show->language), $GLOBALS['languages'])) {
$nameExtra[] = $GLOBALS['languages'][strval($show->language)];
}
if (array_key_exists(strval($show->source), $GLOBALS['sources'])) {
$nameExtra[] = $GLOBALS['sources'][strval($show->source)];
}
$nameExtra = implode(', ', $nameExtra);
if (strlen($nameExtra) > 0) {
$nameExtra = ' (' . $nameExtra . ')';
}
//full show name
$name = htmlspecialchars_decode($show->name) . $nameExtra;
print date($config['logging']['date_format']) . $name . "\n";
//add timestamp
if (empty($show['updated'])) {
$show->addAttribute('updated', 0);
}
//get info from tv scraper if past the refresh time
$show_info = get_show_info($show);
//no show info (skip)
if (empty($show_info)) {
print date($config['logging']['date_format']) . ' get show info FAILED! (' . $config['info_scraper'] . " likely down)\n";
continue;
}
//update timestamp
if (!$show_info['cached']) {
$show['updated'] = time();
}
//make sure it has an ID
if (empty($show['id'])) {
print "adding ID";
$show->addAttribute('id', generate_id());
}
//make sure it has a downloads node
if (!$show->downloads) {
$show->addChild('downloads', '');
} else {
$remove = 0;
foreach ($show->downloads->download as $download) {
if (!empty($download->episode)) {
$ep_parts = explode('x', $download->episode);
$double_parts = explode('-', $ep_parts[1]);
//add new nodes
foreach ($double_parts as $ep) {
$d = $show->downloads->addChild('download');
$d->addAttribute('season', intval($ep_parts[0]));
$d->addAttribute('episode', intval($ep));
$d->addAttribute('timestamp', $download->timestamp);
}
$remove++;
}
}
//remove old nodes
while ($remove-- > 0) {
unset($show->downloads->download[0]);
}
}
if (!$show_info['cached']) {
//auto update show name to match info scraper
if ($config['update_show_name'] && strlen(trim($show_info['name'])) > 0 && trim($show->name) != $show_info['name']) {
$show->name = $show_info['name'];
print date($config['logging']['date_format']) . ' name updated to match ' . $config['info_scraper'] . ': ' . $show->name . "\n";
}
//update tvrage series id
if (!$show->tvrageid) {
$show->addChild('tvrageid', $show_info['tvrageid']);
} else {
$show->tvrageid = trim($show_info['tvrageid']);
}
//update thetvdb series id
if (!$show->thetvdbid) {
$show->addChild('thetvdbid', $show_info['thetvdbid']);
} else {
$show->thetvdbid = trim($show_info['thetvdbid']);
}
//episode list (seasons, eps)
if (!$show->episodelist) {
$show->addChild('episodelist', '');
}
if (!empty($show_info['episodelist'])) {
foreach ($show_info['episodelist'] as $season => $episodes) {
//.........这里部分代码省略.........