Esempio n. 1
0
 public static function init()
 {
     /* Set root url */
     self::set('root_url', 'http://' . data_essence::get('server', 'HTTP_HOST') . str_replace(data_essence::get('server', 'DOCUMENT_ROOT'), '', dirname(data_essence::get('server', 'SCRIPT_FILENAME'))) . '/');
     /* Set root dir */
     self::set('root_dir', dirname(data_essence::get('server', 'SCRIPT_FILENAME')) . '/');
 }
Esempio n. 2
0
											</td>
											
										</tr>
										
										<tr>
											
											<td class="label">
												
												ICQ
												
											</td>
											
											<td class="value">
												
												<input type="text" class="text" name="authorization-contact-icq" value="<?php 
echo data_essence::get('post', 'authorization-contact-icq', array('trim'));
?>
" />
												
												<span class="validation"><?php 
echo $validation->get('authorization-contact-icq');
?>
</span>
												
											</td>
											
										</tr>
										
										<tr>
											
											<td colspan="2" class="control">
Esempio n. 3
0
 public static function get_url()
 {
     return urldecode(strtolower('http://' . data_essence::get('server', 'HTTP_HOST') . preg_replace('|^(.*?)&(.*?)$|si', '$1', preg_replace('|' . preg_quote(config_essence::get('url_suffics', 'request'), '|') . '$|si', '', str_replace('?' . data_essence::get('server', 'QUERY_STRING'), '', data_essence::get('server', 'REQUEST_URI'))))));
 }
Esempio n. 4
0
							</th>

						</tr>
						
						<tr>
							
							<td class="label">
								
								Логин <span class="required">*</span>
								
							</td>
								
							<td class="value">
								
								<input type="text" class="text" name="authorization-login" value="<?php 
echo data_essence::get('post', 'authorization-login', array('trim'));
?>
" />
									
								<span class="validation"><?php 
echo $validation->get('authorization-login');
?>
</span>
								
							</td>
							
						</tr>
						
						<tr>
							
							<td class="label">
Esempio n. 5
0
 public static function validate_login()
 {
     $validation = new validation_object();
     /* Validate: post data */
     if (empty($_POST)) {
         $validation->set('empty', true);
         return $validation;
     }
     /* Validate: required user login */
     if (!($user_login = data_essence::get('post', 'authorization-login', array('trim')))) {
         $validation->set('authorization-login', 'Введите логин');
     } else {
         /* Validate: valid user login */
         if (!data_essence::validate('login', $user_login)) {
             $validation->set('authorization-login', 'Введите правильный логин');
         } else {
             /* Validate: if this login already exist */
             if (!($user = user_model::get_user_by_login($user_login))) {
                 $validation->set('authorization-login', 'Такой логин не существует');
             }
         }
     }
     /* Validate: required user password */
     if (!($user_password = data_essence::get('post', 'authorization-password', array('trim')))) {
         $validation->set('authorization-password', 'Введите пароль');
     } else {
         /* Validate: valid user password */
         if (!data_essence::validate('password', $user_password)) {
             $validation->set('authorization-password', 'Введите правильный пароль');
         } else {
             if ($user->get_password() != md5($user_password)) {
                 $validation->set('authorization-password', 'Введите верный пароль');
             }
         }
     }
     return $validation;
 }
Esempio n. 6
0
				</td>
				
			</tr>
			
			<tr>
				
				<td class="label">
					
					Описание
					
				</td>
				
				<td class="value">
					
					<textarea name="file-content"><?php 
echo data_essence::get('post', 'file-content', array('trim'));
?>
</textarea>
					
					<span class="validation"><?php 
echo $validation->get('file-content');
?>
</span>
					
				</td>
				
			</tr>
			
			<tr>
				
				<td colspan="2" class="control">
Esempio n. 7
0
 public static function add_comment($file_id = 0, $comment_parent_id = 0)
 {
     if (!($me = session_essence::get('me'))) {
         request_essence::load_request();
     }
     if ($file_id) {
         if ($file = file_model::get_file_by_id($file_id)) {
             if ($comment_parent_id > 0) {
                 if (!($comment = comment_model::get_comment_by_id($comment_parent_id))) {
                     request_essence::load_request();
                 } else {
                     if ($comment->get_file_id() != $file_id) {
                         request_essence::load_request();
                     }
                 }
             }
             $comment = new comment_object();
             $comment->set_parent_id($comment_parent_id);
             $comment->set_content(data_essence::get('post', 'comment-content', array('trim', 'striptags')));
             $comment->set_file_id($file_id);
             $comment->set_user_id($me->get_id());
             if (comment_model::add_comment($comment)) {
                 request_essence::load_request('file', 'view', array($file_id));
             } else {
                 request_essence::load_request();
             }
         } else {
             request_essence::load_request();
         }
     } else {
         request_essence::load_request();
     }
 }