예제 #1
0
 public static function getRemainingTime($question)
 {
     if (!empty($question)) {
         $end_at = CDateTime::createFromTimeStamp(strtotime($question->end_at));
         $now = CDateTime::now();
         $diff_in_seconds = $now->diffInSeconds($end_at, true);
         $hrs = sprintf("%02s", floor($diff_in_seconds / 3600));
         $min = sprintf("%02s", floor($diff_in_seconds / 60 % 60));
         $sec = sprintf("%02s", $diff_in_seconds % 60);
         $due_date = $end_at->formatLocalized('%d %B - %A');
         $due_date_day = $end_at->formatLocalized('%d') + 1;
         $due_date_short_month = $end_at->formatLocalized('%b');
         $due_date_long_month = $end_at->formatLocalized('%B');
         $due_date_year = $end_at->formatLocalized('%Y');
         $remaining_time = ['hrs' => $hrs, 'min' => $min, 'sec' => $sec, 'due_date' => $due_date, 'due_date_day' => $due_date_day, 'due_date_short_month' => $due_date_short_month, 'due_date_long_month' => $due_date_long_month, 'due_date_year' => $due_date_year];
     } else {
         $remaining_time = '';
     }
     return $remaining_time;
 }
예제 #2
0
    /** 
     * @return string
     */
    function SelectAllAccounts($pageNumber, $accountPerPage, $sortField, $sortOrder, $searchText)
    {
        $nom = $pageNumber > 0 ? ($pageNumber - 1) * $accountPerPage : 0;
        $dopstr = '';
        $search = trim($searchText);
        if (strlen($searchText) > 0) {
            $search = ' AND (id_acct LIKE %1$s OR email LIKE %1$s OR %2$s LIKE %1$s
							OR logins_count LIKE %1$s OR mail_inc_host LIKE %1$s
							OR mail_out_host LIKE %1$s) ';
            $search = sprintf($search, $this->_escapeString('%' . $searchText . '%'), CDateTime::GetMsSqlDateFormat('last_login'));
        }
        if ($nom > 0) {
            $dopstr = ' AND id_acct NOT IN
						(SELECT id_acct FROM
						(SELECT TOP %d id_acct, acct1.id_user as id_user, deleted, email,
						mail_inc_host, mail_out_host, %s AS nlast_login, logins_count,
						mailbox_size, mailbox_limit, def_acct
						FROM %sawm_accounts AS acct1
						INNER JOIN %sawm_settings AS sett1 ON acct1.id_user = sett1.id_user
						WHERE id_acct > -1 %s
						ORDER BY %s %s, def_acct DESC) AS stable) ';
            $dopstr = sprintf($dopstr, $nom, CDateTime::GetMsSqlDateFormat('last_login'), $this->_settings->DbPrefix, $this->_settings->DbPrefix, $search, $sortField, $sortOrder ? 'DESC' : 'ASC');
        }
        $sql = 'SELECT TOP %d id_acct, acct.id_user as id_user, deleted, email,
						mail_inc_host, mail_out_host, %s AS nlast_login, logins_count,
						mailbox_size, mailbox_limit, def_acct
					FROM %sawm_accounts AS acct
					INNER JOIN %sawm_settings AS sett ON acct.id_user = sett.id_user
					WHERE id_acct > -1 %s%s
					ORDER BY %s %s, def_acct DESC';
        return sprintf($sql, $accountPerPage, CDateTime::GetMsSqlDateFormat('last_login'), $this->_settings->DbPrefix, $this->_settings->DbPrefix, $search, $dopstr, $sortField, $sortOrder ? 'DESC' : 'ASC');
    }
예제 #3
0
 /**
  * @param CDateTime $date
  */
 function SetDate(&$date)
 {
     $this->Headers->SetHeader(new Header(MIMEConst_Date, $date->GetAsStr(), true));
 }
		<div class="col-md-4 col-md-offset-4 col-lg-4 col-lg-offset-4">
			<h2>Edit Question</h2>
		</div>
		<div class="col-md-12 col-lg-15">
			<div class="row">
				<div class="col-lg-3">
					@include('profile.dashboard.sidebarnav')

					@include('elements.submit')
				</div>
				<div class="col-lg-9">
					<div class="panel-wrapper">				
							@foreach ($questions as $q)
								<?php 
$end_at = CDateTime::createFromTimeStamp(strtotime($q->end_at));
$start_at = CDateTime::createFromTimeStamp(strtotime($q->start_at));
$display_end_at = $end_at->formatLocalized('%Y-%m-%d');
$display_start_at = $start_at->formatLocalized('%Y-%m-%d');
?>
							
								{{ Form::open(['route' => ['admin.question.update', $q->id], 'class' => 'form-horizontal form-w-bg']) }}
								<div class="form-group">
									{{ Form::label('question', 'Question', ['class' => 'col-sm-2 control-label']) }}
									<div class="col-sm-10">
										{{ Form::text('question', Tools::fallBack(Input::old('question'), $q->question), ['class' => 'form-control']) }}
										{{ $errors->first('question', '<span class="text-danger">:message</span>') }}
									</div>
								</div>									
								<div class="form-group">
									{{ Form::label('slug', 'Slug', ['class' => 'col-sm-2 control-label']) }}
									<div class="col-sm-10">
예제 #5
0
 /**
  * @param obj $row
  * return WebMailMessage|null
  */
 function &_rowToWebMailMessage($row)
 {
     $msg = null;
     if ($row) {
         $msg = new WebMailMessage();
         $msg->SetFromAsString($row->from_msg);
         $msg->SetToAsString($row->to_msg);
         $msg->SetCcAsString($row->cc_msg);
         $msg->SetBccAsString($row->bcc_msg);
         $date = new CDateTime();
         $date->SetFromANSI($row->nmsg_date);
         $date->TimeStamp += $date->GetServerTimeZoneOffset();
         $msg->SetDate($date);
         $msg->SetSubject($row->subject);
         $msg->IdMsg = $row->id_msg;
         $msg->IdFolder = $row->id_folder_db;
         $msg->Uid = $row->uid;
         $msg->Size = $row->size;
         $msg->DbPriority = $row->priority;
         $msg->DbXSpam = (bool) abs($row->x_spam);
         $msg->DbHasAttachments = $row->attachments;
         $msg->Sensitivity = $row->sensitivity;
         $msg->Flags = 0;
         if ($row->seen) {
             $msg->Flags |= MESSAGEFLAGS_Seen;
         }
         if ($row->flagged) {
             $msg->Flags |= MESSAGEFLAGS_Flagged;
         }
         if ($row->deleted) {
             $msg->Flags |= MESSAGEFLAGS_Deleted;
         }
         if ($row->replied) {
             $msg->Flags |= MESSAGEFLAGS_Answered;
         }
         if ($row->forwarded) {
             $msg->Flags |= MESSAGEFLAGS_Forwarded;
         }
         if ($row->grayed) {
             $msg->Flags |= MESSAGEFLAGS_Grayed;
         }
         $msg->Charset = $row->charset;
     }
     return $msg;
 }
예제 #6
0
			<h2>Archives</h2>
		</div>
		<div class="col-md-12 col-lg-12">
			<div class="row">
				<div class="col-lg-9">
					<div class="archive-list scrollable" data-height="500px">
						<ul class="list-unstyled">
					        @foreach ($show_questions as $q) 
							<?php 
$t_bants = Post::getTopBants($q->id);
if ($t_bants) {
    foreach ($t_bants as $top_bant) {
        if (is_numeric($top_bant->id)) {
            $user = User::getUserProfile($top_bant->user_id);
            $votes = Vote::getPostVotes($top_bant->id);
            $post_date = CDateTime::createFromTimeStamp(strtotime($top_bant->created_at));
            $display_post_date = $post_date->formatLocalized('%b %d, %Y');
            ?>
									<li>
									<div class="row">
										<div class="col-lg-3">
											<div class="avatar">
												<a href="#">
													<img src="{{ Avatar::display('default_avatar.jpg') }}" alt="...">
													<?php 
            echo '<span class="user-name">' . $user[0]->full_name . '</span>';
            echo '@' . $top_bant->username;
            echo '<div class="profile-info">';
            echo '<span class="address"><i class="fa fa-map-marker"></i>' . $user[0]->city . ', ' . $user[0]->state . '</span>';
            echo '<span class="post-date">' . $display_post_date . '</span>';
            echo '<span class="votes">' . count($votes) . ' votes</span>';
예제 #7
0
 /**
  * @param int $id
  * @return Account
  */
 function &SelectAccountData($id)
 {
     $null = null;
     if (!$this->_dbConnection->Execute($this->_commandCreator->SelectAccountData($id))) {
         return $null;
     }
     $account =& new Account();
     if ($row = $this->_dbConnection->GetNextRecord()) {
         $account->Id = (int) $row->id_acct;
         $account->IdUser = (int) $row->id_user;
         $account->DefaultAccount = (bool) abs($row->def_acct);
         $account->Deleted = (bool) abs($row->deleted);
         $account->Email = $row->email;
         $account->MailProtocol = (int) $row->mail_protocol;
         $account->MailIncHost = $row->mail_inc_host;
         $account->MailIncLogin = $row->mail_inc_login;
         $account->MailIncPort = (int) $row->mail_inc_port;
         $account->MailOutHost = $row->mail_out_host;
         $account->MailOutLogin = $row->mail_out_login;
         $account->MailOutPort = (int) $row->mail_out_port;
         $account->MailOutAuthentication = (int) $row->mail_out_auth;
         $account->FriendlyName = $row->friendly_nm;
         $account->UseFriendlyName = (bool) abs($row->use_friendly_nm);
         $account->DefaultOrder = (int) $row->def_order;
         $account->GetMailAtLogin = (bool) abs($row->getmail_at_login);
         $account->MailMode = (int) $row->mail_mode;
         $account->MailsOnServerDays = (int) $row->mails_on_server_days;
         $account->Signature = $row->signature;
         $account->SignatureType = (int) $row->signature_type;
         $account->SignatureOptions = (int) $row->signature_opt;
         $account->HideContacts = (bool) abs($row->hide_contacts);
         $account->MailsPerPage = (int) $row->msgs_per_page > 0 ? (int) $row->msgs_per_page : 20;
         $account->Delimiter = $row->delimiter;
         $account->WhiteListing = (bool) abs($row->white_listing);
         $account->XSpam = (bool) abs($row->x_spam);
         $account->LastLogin = (int) $row->last_login;
         $account->LoginsCount = (int) $row->logins_count;
         $account->DefaultSkin = $row->def_skin;
         $account->DefaultLanguage = $row->def_lang;
         $account->DefaultIncCharset = ConvertUtils::GetCodePageName((int) $row->def_charset_inc);
         $account->DefaultOutCharset = ConvertUtils::GetCodePageName((int) $row->def_charset_out);
         $account->DefaultTimeZone = (int) $row->def_timezone;
         $account->DefaultDateFormat = CDateTime::GetDateFormatFromBd($row->def_date_fmt);
         $account->DefaultTimeFormat = CDateTime::GetTimeFormatFromBd($row->def_date_fmt);
         $account->HideFolders = (bool) abs($row->hide_folders);
         $account->MailboxLimit = (int) $row->mailbox_limit;
         $account->MailboxSize = (int) $row->mailbox_size;
         $account->AllowChangeSettings = (bool) abs($row->allow_change_settings);
         $account->AllowDhtmlEditor = (bool) abs($row->allow_dhtml_editor);
         $account->AllowDirectMode = (bool) abs($row->allow_direct_mode);
         $account->DbCharset = ConvertUtils::GetCodePageName((int) $row->db_charset);
         $account->HorizResizer = (int) $row->horiz_resizer;
         $account->VertResizer = (int) $row->vert_resizer;
         $account->Mark = (int) $row->mark;
         $account->Reply = (int) $row->reply;
         $account->ContactsPerPage = (int) $row->contacts_per_page > 0 ? (int) $row->contacts_per_page : 20;
         $account->ViewMode = (int) $row->view_mode;
         $account->MailIncPassword = ConvertUtils::DecodePassword($row->mail_inc_pass, $account);
         $account->MailOutPassword = ConvertUtils::DecodePassword($row->mail_out_pass, $account);
         $this->_dbConnection->FreeResult();
     } else {
         $account = $null;
     }
     if (!is_object($account) || !$this->_dbConnection->Execute($this->_commandCreator->SelectAccountColumnsData($account->IdUser))) {
         return $null;
     }
     while ($row = $this->_dbConnection->GetNextRecord()) {
         if (!is_object($row)) {
             continue;
         }
         $account->Columns[(int) $row->id_column] = $row->column_value;
     }
     return $account;
 }
예제 #8
0
 /**
  * @param string $strDate
  * @return int
  */
 function GetTimeFromString($strDate)
 {
     $dt = time() - CDateTime::GetServerTimeZoneOffset();
     $matches = array();
     $zone = null;
     $off = null;
     $datePattern = '/^(([a-z]*),[\\s]*){0,1}(\\d{1,2}).([a-z]*).(\\d{2,4})[\\s]*(\\d{1,2}).(\\d{1,2}).(\\d{1,2})([\\s]+([+-]?\\d{1,4}))?([\\s]*(\\(?(\\w+)\\)?))?/i';
     if (preg_match($datePattern, $strDate, $matches)) {
         $year = $matches[5];
         $month = ConvertUtils::GetMonthIndex(strtolower($matches[4]));
         if ($month == -1) {
             $month = 1;
         }
         $day = $matches[3];
         $hour = $matches[6];
         $minute = $matches[7];
         $second = $matches[8];
         $dt = ConvertUtils::GmtMkTime($hour, $minute, $second, $month, $day, $year);
         if (isset($matches[13])) {
             $zone = strtolower($matches[13]);
         }
         if (isset($matches[10])) {
             $off = strtolower($matches[10]);
         }
     }
     $dt = ConvertUtils::ApplyOffsetForDate($dt, $off, $zone);
     return $dt;
 }
예제 #9
0
    /**
     * @param int $pageNumber
     * @param string $condition
     * @param FolderCollection $folders
     * @param bool $inHeadersOnly
     * @param Account $account
     * @return WebMailMessageCollection
     */
    function SearchMessages($pageNumber, $condition, &$folders, $inHeadersOnly, &$account)
    {
        $tempstr = '';
        $foldersId = array();
        $_foldersKeys = array_keys($folders->Instance());
        foreach ($_foldersKeys as $key) {
            $folder =& $folders->Get($key);
            if (!$folder->Hide) {
                $foldersId[] = $folder->IdDb;
            }
            unset($folder);
        }
        unset($folders, $_foldersKeys);
        $filter = '';
        $asc = true;
        $this->_setSortOrder($account->DefaultOrder, $filter, $asc);
        $condition = str_replace('[', '[[]', $condition);
        $condition = $this->_escapeString('%' . $condition . '%');
        $str_foldersId = implode(',', $foldersId);
        if ($inHeadersOnly) {
            if (($pageNumber - 1) * $account->MailsPerPage > 0) {
                $tempstr = ' AND id_msg NOT IN 
								(SELECT TOP %d id_msg FROM %sawm_messages 
								WHERE id_acct = %d AND id_folder_db ' . $this->_inOrNot($foldersId) . ' AND	
								(from_msg LIKE %s OR to_msg LIKE %s OR cc_msg LIKE %s OR bcc_msg
								LIKE %s OR subject LIKE %s) ORDER BY %s %s)';
                $tempstr = sprintf($tempstr, ($pageNumber - 1) * $account->MailsPerPage, $this->_settings->DbPrefix, $account->Id, $str_foldersId, $condition, $condition, $condition, $condition, $condition, $filter, $asc ? 'ASC' : 'DESC');
            }
            $sql = 'SELECT TOP %d id_msg, %s AS uid, id_folder_db, from_msg, to_msg, cc_msg,
							bcc_msg, subject, %s AS nmsg_date, size, priority, x_spam,
							attachments, seen, flagged, deleted, replied, forwarded, grayed, charset, sensitivity
						FROM %sawm_messages
						WHERE id_acct = %d AND id_folder_db ' . $this->_inOrNot($foldersId) . ' AND	
							(from_msg LIKE %s OR to_msg LIKE %s OR cc_msg LIKE %s OR bcc_msg
							LIKE %s OR subject LIKE %s)%s
						ORDER BY %s %s';
            return sprintf($sql, $account->MailsPerPage, $this->_getMsgIdUidFieldName(true, $account->MailProtocol), CDateTime::GetMsSqlDateFormat('msg_date'), $this->_settings->DbPrefix, $account->Id, $str_foldersId, $condition, $condition, $condition, $condition, $condition, $tempstr, $filter, $asc ? 'ASC' : 'DESC');
        } else {
            if (($pageNumber - 1) * $account->MailsPerPage > 0) {
                $tempstr = ' AND id_msg NOT IN 
							(SELECT TOP %d id_msg FROM %sawm_messages
							WHERE id_acct = %d AND id_folder_db ' . $this->_inOrNot($foldersId) . ' AND	
								(from_msg LIKE %s OR to_msg LIKE %s OR cc_msg LIKE %s OR bcc_msg
								LIKE %s OR subject LIKE %s OR body_text LIKE %s) ORDER BY %s %s)';
                $tempstr = sprintf($tempstr, ($pageNumber - 1) * $account->MailsPerPage, $this->_settings->DbPrefix, $account->Id, $str_foldersId, $condition, $condition, $condition, $condition, $condition, $condition, $filter, $asc ? 'ASC' : 'DESC');
            }
            $sql = 'SELECT TOP %d id_msg, %s AS uid, id_folder_db, from_msg, to_msg, cc_msg,
							bcc_msg, subject, %s AS nmsg_date, size, priority, x_spam,
							attachments, seen, flagged, deleted, replied, forwarded, grayed, charset, sensitivity
						FROM %sawm_messages
						WHERE id_acct = %d AND id_folder_db ' . $this->_inOrNot($foldersId) . ' AND	
							(from_msg LIKE %s OR to_msg LIKE %s OR cc_msg LIKE %s OR bcc_msg
							LIKE %s OR subject LIKE %s OR body_text LIKE %s)%s
						ORDER BY %s %s';
            return sprintf($sql, $account->MailsPerPage, $this->_getMsgIdUidFieldName(true, $account->MailProtocol), CDateTime::GetMsSqlDateFormat('msg_date'), $this->_settings->DbPrefix, $account->Id, $str_foldersId, $condition, $condition, $condition, $condition, $condition, $condition, $tempstr, $filter, $asc ? 'ASC' : 'DESC');
        }
    }