Example #1
0
function xmldb_assignment_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($result && $oldversion < 2007091900) {
        /// MDL-11268
        /// Changing nullability of field data1 on table assignment_submissions to null
        $table = new XMLDBTable('assignment_submissions');
        $field = new XMLDBField('data1');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
        /// Launch change of nullability for field data1
        $result = $result && change_field_notnull($table, $field);
        /// Changing nullability of field data2 on table assignment_submissions to null
        $field = new XMLDBField('data2');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
        /// Launch change of nullability for field data2
        $result = $result && change_field_notnull($table, $field);
    }
    if ($result && $oldversion < 2007091902) {
        // add draft tracking default to existing upload assignments
        $sql = "UPDATE {$CFG->prefix}assignment SET var4=1 WHERE assignmenttype='upload'";
        $result = execute_sql($sql);
    }
    //===== 1.9.0 upgrade line ======//
    if ($result && $oldversion < 2007101511) {
        notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
        // change grade typo to text if no grades MDL-13920
        require_once $CFG->dirroot . '/mod/assignment/lib.php';
        // too much debug output
        $db->debug = false;
        assignment_update_grades();
        $db->debug = true;
    }
    return $result;
}
Example #2
0
 public function postSend(Request $request)
 {
     if (Auth::check()) {
         $this->validate($request, ["message" => "required|min:5|max:1000"]);
         $email = Auth::user()->email;
     } else {
         $this->validate($request, ["email" => "required|email|max:255", "message" => "required|min:5|max:1000", 'g-recaptcha-response' => 'required']);
         $recaptcha = new \ReCaptcha\ReCaptcha(Config::get('site.recaptcha_secret'));
         $resp = $recaptcha->verify($request->input('g-recaptcha-response'));
         if (!$resp->isSuccess()) {
             return redirect()->back();
         }
         $email = $request->input('email');
     }
     $mess = $request->input('message');
     $admins = User::whereHas('permissions', function ($query) {
         $query->where('is_admin', true);
     })->get();
     $from = $email;
     foreach ($admins as $admin) {
         $to = $admin->email;
         Mail::send('emails.contact.send', ['mess' => $mess, 'from' => $from], function ($message) use($to) {
             $message->subject('Contact us')->to($to);
         });
     }
     notify()->flash('Thank you', 'success', ['text' => 'Your message sent to our inbox.']);
     return redirect()->route('contact');
 }
Example #3
0
 public function vehiculoUpdate(Request $request)
 {
     $this->validate($request, ['descripcion' => 'required', 'modelo' => 'required|max:4', 'matricula' => 'required', 'numero_de_serie' => 'required|min:16|max:16', 'numero_de_motor' => 'required', 'capacidad' => 'required|max:3', 'uso' => 'required']);
     Vehiculo::find($request->input('vehiculo_id'))->update($request->all());
     notify()->flash('Datos del vehiculo actualizados con exito', 'success');
     return Redirect::back();
 }
Example #4
0
function close_this_page($msg = null)
{
    if (isset($msg)) {
        notify($msg);
    }
    echo "<script type='text/javascript'>javascript:window.close();</script>";
}
Example #5
0
function cronNotify()
{
    global $evtList;
    //initialize
    $todayT = time() + 43200;
    //today 12:00
    $todayD00 = date("Y-m-d", $todayT);
    //today
    $todayD30 = date("Y-m-d", $todayT + 2592000);
    //today + 30 days
    $sentTo = '';
    //set filter
    $filter = 'notify >= 0';
    //retrieve and process events
    retrieve($todayD00, $todayD30, '', $filter);
    if ($evtList) {
        foreach ($evtList as $date => &$events) {
            $daysDue = round((mktime(12, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)) - $todayT) / 86400);
            foreach ($events as $evt) {
                if (($daysDue == $evt['rem'] or $date == $todayD00) and $evt['mde'] <= 1 and $evt['rml']) {
                    //due and mail addresses to notify
                    $sentTo .= notify($evt, $date, $daysDue) . "\n";
                    //send reminder email
                }
            }
        }
    }
    return $sentTo;
}
Example #6
0
 public function disagree($id = 0, $cid = 0)
 {
     $myID = getUserID();
     $cid = (int) $cid;
     $query = $this->mdb->get_feed_info($id);
     $errMsg = '';
     if ($query->num_rows() == 0) {
         generate_json(array('status' => 0, 'message' => 'Post not found.'));
     } else {
         $row = $query->row();
         if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID))) {
             generate_json(array('status' => 0, 'message' => 'You are not authorized to do this.'));
         } else {
             $do = $this->mdb->disagree($row->id, $cid, $myID);
             $result = $this->mdb->get_adc_counts($row->id, $cid);
             if ($do > 0) {
                 if ($cid > 0) {
                     //notify commentor
                     $qComment = $this->mdb->get_comment_details($row->id, $cid);
                     if ($qComment->num_rows()) {
                         $commentRow = $qComment->row();
                         notify('comment_disagree', $commentRow->user_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id, 'comment_id' => $cid));
                     }
                 } else {
                     //notify poster
                     notify('post_disagree', $row->poster_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id));
                 }
             }
             generate_json(array('status' => 1, 'response' => $result->row()));
         }
     }
 }
Example #7
0
 public function index()
 {
     $myID = getUserID();
     $id = (int) $this->input->get('id');
     if ($id == $myID) {
         generate_json(array('status' => 0, 'message' => 'You cannot add yourself.'));
     } else {
         $query = $this->mdb->get_contact($myID, $id);
         if ($query->num_rows()) {
             generate_json(array('status' => 0, 'message' => 'You are already in contact with this user.'));
         } else {
             $query = $this->model->getUserInfo(array('id' => $id));
             if ($query->num_rows()) {
                 $this->mdb->add_contact($myID, $id);
                 notify('contact_added', $id);
                 // Send mail
                 $myName = $this->session->userdata('display_name');
                 $redirectLink = base_url('#/app/profile/' . $myID);
                 do_sendmail($id, "New Contact", "{$myName} added you to his/her address book. Visit <a href='{$redirectLink}'>" . $myName . "</a>");
                 generate_json(array('status' => 1));
             } else {
                 generate_json(array('status' => 0, 'message' => 'User not found.'));
             }
         }
     }
 }
Example #8
0
 public function actionEdit($id)
 {
     $ticket = Tickets::model()->with(array('category', 'user'))->findByPk($id);
     if ($ticket === NULL) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('backend', 'Тикет не найден.'));
         $this->redirect(array('/backend/tickets/index'));
     }
     if (!$ticket->user) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('backend', 'Связь с таблицей "Users" была нарушена.'));
         $this->redirect(array('/backend/tickets/index'));
     }
     // Убираю статус нового сообщения
     if ($ticket->new_message_for_admin == Tickets::STATUS_NEW_MESSAGE_ON) {
         $ticket->new_message_for_admin = 0;
         $ticket->save(FALSE, array('new_message_for_admin', 'updated_at'));
     }
     // Ответы
     $answersDataProvider = new CActiveDataProvider('TicketsAnswers', array('criteria' => array('condition' => 'ticket_id = :ticket_id', 'params' => array('ticket_id' => $ticket->id), 'order' => 't.created_at DESC', 'with' => 'userInfo'), 'pagination' => array('pageSize' => 10, 'pageVar' => 'page')));
     $model = new TicketsAnswers();
     if (isset($_POST['TicketsAnswers'])) {
         $model->setAttributes($_POST['TicketsAnswers']);
         $model->ticket_id = $id;
         if ($model->save()) {
             // change new message status
             $ticket->new_message_for_user = 1;
             $ticket->save(FALSE, array('new_message_for_user', 'updated_at'));
             notify()->userNoticeTicketAnswer($ticket->user->email, array('ticket' => $ticket, 'user' => $ticket->user));
             user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('backend', 'Ответ добавлен.'));
             $this->refresh();
         }
     }
     $this->render('//tickets/edit', array('ticket' => $ticket, 'model' => $model, 'answersDataProvider' => $answersDataProvider));
 }
 public function changePassword()
 {
     try {
         $l2 = $this->getL2();
         $newPassword = $l2->passwordEncrypt($this->getNewPassword());
         $login = user()->get('login');
         $res = $l2->getDb()->createCommand("UPDATE {{accounts}} SET password = :password WHERE login = :login LIMIT 1")->bindParam('password', $newPassword, PDO::PARAM_STR)->bindParam('login', $login, PDO::PARAM_STR)->execute();
         if ($res !== FALSE) {
             if (user()->get('email')) {
                 notify()->changePassword(user()->get('email'), array('password' => $this->getNewPassword()));
             }
             // Логирую действие юзера
             if (app()->params['user_actions_log']) {
                 $log = new UserActionsLog();
                 $log->user_id = user()->getId();
                 $log->action_id = UserActionsLog::ACTION_CHANGE_PASSWORD;
                 $log->save(FALSE);
             }
             return TRUE;
         }
     } catch (Exception $e) {
         Yii::log("Не удалось сменить пароль от аккаунта\nOld password: "******"\nNew password: "******"\nError: " . $e->getMessage() . "\n", CLogger::LEVEL_ERROR, 'cabinet_change_password');
     }
     return FALSE;
 }
Example #10
0
 public function actionActivated($_hash)
 {
     $cache = new CFileCache();
     $cache->init();
     $hash = $cache->get('registerActivated' . $_hash);
     $cache->delete('registerActivated' . $_hash);
     // Ключ не найден, возможно пытаются подобрать или истекло время отведенное для активации аккаунта
     if ($hash === FALSE) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Ключ для активации аккаунта не найден.'));
         $this->redirect(array('index'));
     }
     $user = Users::model()->findByPk($hash['user_id']);
     if (!$user) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Аккаунт не найден.'));
     } elseif ($user->isActivated()) {
         user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Аккаунт уже активирован.'));
     } else {
         // Создаю игровой аккаунт
         try {
             $l2 = l2('ls', $user->ls_id)->connect();
             $l2->insertAccount($user->login, $hash['password']);
             $user->activated = Users::STATUS_ACTIVATED;
             $user->save(FALSE);
             user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('main', 'Активация аккаунта прошла успешно. Приятной игры!'));
             notify()->registerStep2($hash['email'], array('login' => $user->login, 'password' => $hash['password']));
         } catch (Exception $e) {
             user()->setFlash(FlashConst::MESSAGE_ERROR, $e->getMessage());
         }
     }
     $this->redirect(array('index'));
 }
Example #11
0
function xmldb_hotpot_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    //===== 1.9.0 upgrade line ======//
    if ($result && $oldversion < 2007101512) {
        // save and disable setting to display debugging messages
        $debug = $db->debug;
        $db->debug = false;
        notify('Fixing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
        hotpot_fix_grades();
        // restore $db->debug
        $db->debug = $debug;
    }
    // update hotpot grades from sites earlier than Moodle 1.9, 27th March 2008
    if ($result && $oldversion < 2007101513) {
        // ensure "hotpot_update_grades" function is available
        require_once $CFG->dirroot . '/mod/hotpot/lib.php';
        // save and disable setting to display debugging messages
        $debug = $db->debug;
        $db->debug = false;
        notify('Processing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
        hotpot_update_grades();
        // restore $db->debug
        $db->debug = $debug;
    }
    return $result;
}
 /**
  * Updating profile, all info details can be retain
  * Sessions are initial value in view (previous details)
  */
 public function update()
 {
     if (!is_logged_in()) {
         redirect(url('login/index'));
     }
     $user_id = User::getId($_SESSION['username']);
     $user = User::get($user_id);
     $_SESSION['fname'] = $user->fname;
     $_SESSION['lname'] = $user->lname;
     $_SESSION['email'] = $user->email;
     $status = "";
     if ($user_id) {
         $user->username = Param::get('username');
         $user->password = Param::get('password');
         $user->fname = Param::get('fname');
         $user->lname = Param::get('lname');
         $user->email = Param::get('email');
         if ($user->username) {
             try {
                 $user->update($user_id, $_SESSION['username'], $_SESSION['email']);
                 $status = notify("Edit Success");
                 $_SESSION['username'] = $user->username;
             } catch (AppException $e) {
                 $status = notify($e->getMessage(), 'error');
             }
         }
     }
     $this->set(get_defined_vars());
 }
Example #13
0
 function get_question_options(&$question)
 {
     // Get the question answers and their respective tolerances
     // Note: question_numerical is an extension of the answer table rather than
     //       the question table as is usually the case for qtype
     //       specific tables.
     global $CFG;
     if (!($question->options->answers = get_records_sql("SELECT a.*, n.tolerance " . "FROM {$CFG->prefix}question_answers a, " . "     {$CFG->prefix}question_numerical n " . "WHERE a.question = {$question->id} " . "    AND   a.id = n.answer " . "ORDER BY a.id ASC"))) {
         notify('Error: Missing question answer!');
         return false;
     }
     $this->get_numerical_units($question);
     // If units are defined we strip off the default unit from the answer, if
     // it is present. (Required for compatibility with the old code and DB).
     if ($defaultunit = $this->get_default_numerical_unit($question)) {
         foreach ($question->options->answers as $key => $val) {
             $answer = trim($val->answer);
             $length = strlen($defaultunit->unit);
             if ($length && substr($answer, -$length) == $defaultunit->unit) {
                 $question->options->answers[$key]->answer = substr($answer, 0, strlen($answer) - $length);
             }
         }
     }
     return true;
 }
function getListOfTopics($course, $current)
{
    $section = 0;
    while ($section <= $course->numsections) {
        if (!($thissection = get_record('course_sections', 'course', $course->id, 'section', $section))) {
            notify('Error getting course_sections!');
        }
        $desc = format_text($thissection->summary, FORMAT_MOODLE, null, $course->id);
        $textByLines = explode("<br />", $desc);
        //we use <br /> to explode because the wysiwig editor add this element for line return
        $descTxt = strip_tags($textByLines[0]);
        $minidesc = substr($descTxt, 0, 20);
        if ($thissection->summary != null && strlen($descTxt) > 20) {
            $minidesc .= "...";
        } else {
            if ($thissection->summary == null) {
                $minidesc = "Topic";
            }
        }
        if ($current == $section) {
            echo '<OPTION selected value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
        } else {
            echo '<OPTION value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
        }
        $section++;
    }
}
 /**
  * Delete Comment using Username
  */
 public function delete()
 {
     $comment_id = Param::get('comment_id');
     $comment = Comment::get(Param::get('comment_id'));
     $page = Param::get('page_next', 'delete');
     $status = "";
     switch ($page) {
         case 'delete':
             break;
         case 'delete_end':
             try {
                 if (Param::get('reply') == 'no') {
                     redirect(url('thread/index'));
                 } else {
                     $comment->delete($_SESSION['username']);
                 }
             } catch (ValidationException $e) {
                 $status = notify($e->getMessage(), "error");
                 $page = 'delete';
             }
             break;
         default:
             throw new PageNotFoundException("{$page} is not found");
             break;
     }
     $this->set(get_defined_vars());
     $this->render($page);
 }
Example #16
0
 function follow($q)
 {
     $profileActionButton = "none";
     //---get profile information---//
     $profileid = match("users", "username", "userid", $q);
     //---get user information---//
     $sessionid = $_SESSION["sessionid"];
     $random = $_SESSION["random"];
     $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     //---profileActionButton---//
     if ($row["userid"] > 0) {
         $myid = $row["userid"];
         $query = "SELECT * FROM users WHERE userid = '{$myid}' ";
         $recordSet = mysql_query($query) or die(mysql_error());
         $row = mysql_fetch_array($recordSet);
         $arrayFollowing = explode(":||:", $row["following"]);
         if ($profileid === $myid) {
             $profileActionButton = "edit_profile";
         } elseif (in_array($profileid, $arrayFollowing)) {
             $profileActionButton = "unfollow";
         } else {
             array_push($arrayFollowing, $profileid);
             $following = implode(":||:", $arrayFollowing);
             $query = "UPDATE users SET following = '{$following}' WHERE userid = '{$myid}' ";
             mysql_query($query) or die(mysql_error());
             $profileActionButton = "unfollow";
             include "notify.php";
             notify($profileid, "@{" . $myid . "}@ is now following you.");
         }
     }
     return $profileActionButton;
 }
Example #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param StationRequest|Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(StationRequest $request)
 {
     $command = new AddStationJob($request);
     $this->dispatch($command);
     notify(null, 'The station was added;');
     return redirect('/station');
 }
Example #18
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('auth.signin');
         }
     } else {
         $user = $this->auth->user();
         if ($user->ban) {
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {
                 $this->auth->logout();
                 notify()->flash('Banned', 'error', ['text' => $user->ban_reason]);
                 return redirect()->route('auth.signin');
             }
         }
     }
     /*$ipInfo = getIpInfo($request->getClientIp());
       if($ipInfo){
           if(isset($ipInfo['timezone'])){
               if($ipInfo['timezone'] != $this->auth->user()->timezone){
                   $this->auth->user()->update([
                       'timezone' => $ipInfo['timezone']
                   ]);
               }
           }
       }*/
     return $next($request);
 }
Example #19
0
function run($accounts)
{
    require 'IbParser.php';
    $notifier = new IbParser();
    $datadir = dirname(__FILE__) . '/data';
    if (!is_dir($datadir)) {
        mkdir($datadir);
    }
    // Langkah-langkah untuk setiap akun
    foreach ($accounts as $account) {
        // Periksa file data, kalau false langsung lanjut ke akun berikut
        if (!($balance = checkDataFile($account, $datadir))) {
            continue;
        }
        // Ambil balance, kalau false langsung lanjut
        if (!($new_balance = $notifier->getBalance($account[0], $account[1], $account[2]))) {
            continue;
        }
        $balance = json_decode($balance)->balance;
        // Update file data walaupun balancenya sama
        updateDataFile($account, $datadir, $new_balance);
        // Bandingkan balance, kalau sama langsung lanjut
        if ($balance == $new_balance) {
            continue;
        }
        // Ambil transaksi
        $transactions = $notifier->getTransactions($account[0], $account[1], $account[2]);
        // Kirim email
        notify($account, $balance, $new_balance, $transactions);
    }
}
function resource_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004013101) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name');");
    }
    if ($oldversion < 2004071000) {
        table_column("resource", "", "popup", "text", "", "", "", "", "alltext");
        if ($resources = get_records_select("resource", "type='3' OR type='5'", "", "id, alltext")) {
            foreach ($resources as $resource) {
                $resource->popup = addslashes($resource->alltext);
                $resource->alltext = "";
                if (!update_record("resource", $resource)) {
                    notify("Error updating popup field for resource id = {$resource->id}");
                }
            }
        }
        require_once "{$CFG->dirroot}/course/lib.php";
        rebuild_course_cache();
    }
    if ($oldversion < 2004071300) {
        table_column("resource", "", "options", "varchar", "255", "", "", "", "popup");
    }
    if ($oldversion < 2004071303) {
        table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
        modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
        modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
        modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
        modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
    }
    if ($oldversion < 2004080801) {
        modify_database("", "UPDATE prefix_resource SET alltext=reference,type='html' WHERE type='reference';");
        rebuild_course_cache();
    }
    if ($oldversion < 2004111200) {
        //drop first to avoid conflicts when upgrading
        execute_sql("DROP INDEX {$CFG->prefix}resource_course_idx;", false);
        modify_database('', 'CREATE INDEX prefix_resource_course_idx ON prefix_resource (course);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        $wtm->update('resource', 'alltext', 'options');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
Example #21
0
 /**
  * Loads the question type specific options for the question.
  *
  * @return boolean to indicate success or failure
  */
 function get_question_options(&$question)
 {
     // Get additional information from database
     // and attach it to the question object
     if (!($question->options = get_record('question_fileresponse', 'question', $question->id))) {
         notify('Error: Missing question options!');
         return false;
     }
     return true;
 }
Example #22
0
function xmldb_enrol_authorize_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    $result = true;
    //===== 1.9.0 upgrade line ======//
    if ($result && $oldversion < 2008020500 && is_enabled_enrol('authorize')) {
        require_once $CFG->dirroot . '/enrol/authorize/localfuncs.php';
        if (!check_curl_available()) {
            notify("You are using the authorize.net enrolment plugin for payment handling but cUrl is not available.\n                    PHP must be compiled with cURL+SSL support (--with-curl --with-openssl)");
        }
    }
    if ($result && $oldversion < 2008092700) {
        /// enrol_authorize.transid
        /// Define index transid (not unique) to be dropped form enrol_authorize
        $table = new xmldb_table('enrol_authorize');
        $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
        if ($dbman->index_exists($table, $index)) {
            $dbman->drop_index($table, $index);
        }
        /// Changing precision of field transid on table enrol_authorize to (20)
        $table = new xmldb_table('enrol_authorize');
        $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'userid');
        $dbman->change_field_precision($table, $field);
        /// Launch add index transid again
        $table = new xmldb_table('enrol_authorize');
        $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
        $dbman->add_index($table, $index);
        /// enrol_authorize_refunds.transid
        /// Define index transid (not unique) to be dropped form enrol_authorize_refunds
        $table = new xmldb_table('enrol_authorize_refunds');
        $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
        if ($dbman->index_exists($table, $index)) {
            $dbman->drop_index($table, $index);
        }
        /// Changing precision of field transid on table enrol_authorize_refunds to (20)
        $table = new xmldb_table('enrol_authorize_refunds');
        $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, '0', 'amount');
        $dbman->change_field_precision($table, $field);
        /// Launch add index transid again
        $table = new xmldb_table('enrol_authorize_refunds');
        $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
        $dbman->add_index($table, $index);
    }
    /// Dropping all enums/check contraints from core. MDL-18577
    if ($result && $oldversion < 2009042700) {
        /// Changing list of values (enum) of field paymentmethod on table enrol_authorize to none
        $table = new xmldb_table('enrol_authorize');
        $field = new xmldb_field('paymentmethod', XMLDB_TYPE_CHAR, '6', null, XMLDB_NOTNULL, null, 'cc', 'id');
        /// Launch change of list of values for field paymentmethod
        $dbman->drop_enum_from_field($table, $field);
    }
    return $result;
}
Example #23
0
 /**
  * Save & Update data  instansi
  *
  */
 public function save()
 {
     if ($this->session->userdata('group_id') == 3) {
         $this->session->set_flashdata('notif', notify('Maaf untuk User Demo tidak diperkenankan menambah, menghapus atau mengubah data!', 'danger', 'Perhatian'));
     }
     if ($this->input->post()) {
         $this->instansis->update($this->_do_upload());
         $this->session->set_flashdata('notif', notify('Data berhasil di update', 'success'));
     }
     redirect('instansi');
 }
function clean_data()
{
    global $DB;
    // cleaning up all the tables for Crot plugin except teachers' settings: delete_records("plagiarism_crot_config")
    $DB->delete_records("plagiarism_crot_files");
    $DB->delete_records("plagiarism_crot_documents");
    $DB->delete_records("plagiarism_crot_fingerprint");
    $DB->delete_records("plagiarism_crot_spair");
    $DB->delete_records("plagiarism_crot_webdoc");
    notify(get_string('tables_cleaned_up', 'plagiarism_crot'), 'notifysuccess');
}
Example #25
0
 public function poliza(Request $request)
 {
     $lookFor = $request->input('poliza');
     $poliza = Poliza::where('folio', $lookFor)->get();
     if ($poliza->count() > 0) {
         return Redirect::route('poliza.show', ['id' => $poliza[0]['id']]);
     } else {
         notify()->flash('No existe el folio que has buscado', 'error', ['timer' => 1500]);
         return Redirect::route('dashboard');
     }
 }
Example #26
0
function cc_convert($dir)
{
    $manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml';
    $moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml';
    $schema_file = 'cc' . DIRECTORY_SEPARATOR . '' . DIRECTORY_SEPARATOR . 'schemas' . DIRECTORY_SEPARATOR . 'cclibxml2validator.xsd';
    if (is_readable($manifest_file) && !is_readable($moodle_file)) {
        $is_cc = detect_cc_format($manifest_file);
        if ($is_cc) {
            $detected_requirements = detect_requirements();
            if (!$detected_requirements["php5"]) {
                notify(get_string('cc_import_req_php5', 'imscc'));
                return false;
            }
            if (!$detected_requirements["dom"]) {
                notify(get_string('cc_import_req_dom', 'imscc'));
                return false;
            }
            if (!$detected_requirements["libxml"]) {
                notify(get_string('cc_import_req_libxml', 'imscc'));
                return false;
            }
            if (!$detected_requirements["libxmlminversion"]) {
                notify(get_string('cc_import_req_libxmlminversion', 'imscc'));
                return false;
            }
            if (!$detected_requirements["xsl"]) {
                notify(get_string('cc_import_req_xsl', 'imscc'));
                return false;
            }
            echo get_string('cc2moodle_checking_schema', 'imscc') . '<br />';
            $cc_manifest = new DOMDocument();
            if ($cc_manifest->load($manifest_file)) {
                if ($cc_manifest->schemaValidate($schema_file)) {
                    echo get_string('cc2moodle_valid_schema', 'imscc') . '<br />';
                    $cc2moodle = new cc2moodle($manifest_file);
                    if (!$cc2moodle->is_auth()) {
                        return $cc2moodle->generate_moodle_xml();
                    } else {
                        notify(get_string('cc2moodle_req_auth', 'imscc'));
                        return false;
                    }
                } else {
                    notify(get_string('cc2moodle_invalid_schema', 'imscc'));
                    return false;
                }
            } else {
                notify(get_string('cc2moodle_manifest_dont_load', 'imscc'));
                return false;
            }
        }
    }
    return true;
}
 /**
  * Loads the question type specific options for the question.
  *
  * @return boolean to indicate success or failure
  */
 function get_question_options(&$question)
 {
     // Get additional information from database
     // and attach it to the question object
     if (!($question->options = get_record('question_imagedit', 'question', $question->id))) {
         notify('Error: Missing question options!');
         return false;
     }
     // Get data from question_answers (for feedback)
     parent::get_question_options($question);
     return true;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, ClientEditRequest $request)
 {
     $user = User::find($id);
     $user->fill($request->all());
     $user->save();
     if ($user->save()) {
         notify()->flash('Usuario editado de forma correcta', 'success', ['timer' => 3000, 'text' => '']);
     } else {
         notify()->flash('Usuario no pudo ser editado de forma correcta', 'success', ['timer' => 3000, 'text' => '']);
     }
     return redirect()->to('client/home');
 }
Example #29
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             notify()->flash('Were do you think you\'re going?', 'success', ['text' => 'You must be logged in to view this page!']);
             return redirect()->route('auth.signin');
         }
     }
     return $next($request);
 }
Example #30
0
function xmldb_forum_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    /// And upgrade begins here. For each one, you'll need one
    /// block of code similar to the next one. Please, delete
    /// this comment lines once this file start handling proper
    /// upgrade code.
    /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
    ///     $result = result of "/lib/ddllib.php" function calls
    /// }
    if ($result && $oldversion < 2007101000) {
        /// Define field timemodified to be added to forum_queue
        $table = new XMLDBTable('forum_queue');
        $field = new XMLDBField('timemodified');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'postid');
        /// Launch add field timemodified
        $result = $result && add_field($table, $field);
    }
    //===== 1.9.0 upgrade line ======//
    if ($result and $oldversion < 2007101511) {
        notify('Processing forum grades, this may take a while if there are many forums...', 'notifysuccess');
        //MDL-13866 - send forum ratins to gradebook again
        require_once $CFG->dirroot . '/mod/forum/lib.php';
        // too much debug output
        $db->debug = false;
        forum_update_grades();
        $db->debug = true;
    }
    if ($result && $oldversion < 2007101512) {
        /// Cleanup the forum subscriptions
        notify('Removing stale forum subscriptions', 'notifysuccess');
        $roles = get_roles_with_capability('moodle/course:view', CAP_ALLOW);
        $roles = array_keys($roles);
        $roles = implode(',', $roles);
        $sql = "SELECT fs.userid, f.id AS forumid\n                  FROM {$CFG->prefix}forum f\n                       JOIN {$CFG->prefix}course c                 ON c.id = f.course\n                       JOIN {$CFG->prefix}context ctx              ON (ctx.instanceid = c.id AND ctx.contextlevel = " . CONTEXT_COURSE . ")\n                       JOIN {$CFG->prefix}forum_subscriptions fs   ON fs.forum = f.id\n                       LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ({$roles}))\n                 WHERE ra.id IS NULL";
        if ($rs = get_recordset_sql($sql)) {
            $db->debug = false;
            while ($remove = rs_fetch_next_record($rs)) {
                delete_records('forum_subscriptions', 'userid', $remove->userid, 'forum', $remove->forumid);
                echo '.';
            }
            $db->debug = true;
            rs_close($rs);
        }
    }
    if ($result && $oldversion < 2007101513) {
        delete_records('forum_ratings', 'post', 0);
        /// Clean existing wrong rates. MDL-18227
    }
    return $result;
}