Usually called like this $incomingAjax = new AjaxRequest($_REQUEST) get parameters of request via echo $incomingAjax->getParameter("someAttribute");
 private function build_ajax_request(AjaxRequest $request, array $fields, $condition)
 {
     if (is_array($fields)) {
         foreach ($fields as $field) {
             $request->add_param($field->get_id(), '$FF(\'' . $field->get_id() . '\').getValue()');
         }
     }
     if (!empty($condition)) {
         return 'if (' . $condition . '){' . $request->render() . '}';
     }
     return $request->render();
 }
Example #2
0
 function ListAction()
 {
     $request = Project::getRequest();
     $request_user_id = (int) Project::getUser()->getShowedUser()->id;
     $user_id = (int) Project::getUser()->getDbUser()->id;
     $this->BaseSiteData();
     $info = array();
     $this->BaseSubscribeData($info);
     $filter = (int) $request->getKeyByNumber(0);
     $blog_catalog_page = (int) $request->getKeyByNumber(1);
     if ($filter === 1) {
         $info['only_subscribed'] = true;
         $info['all_tree'] = false;
     } else {
         $info['only_subscribed'] = false;
         $info['all_tree'] = true;
     }
     $info['only_subscribed_link'] = $request->createUrl('Subscribe', 'List', array(1, $blog_catalog_page));
     $info['all_link'] = $request->createUrl('Subscribe', 'List', array(0, $blog_catalog_page));
     $blog_catalog_model = new BlogCatalogModel();
     $pager = new DbPager($blog_catalog_page, $this->getParam('blog_catalog_per_page', 10));
     $blog_catalog_model->setPager($pager);
     if ($filter === 1) {
         $info['blog_catalog'] = $blog_catalog_model->loadSubscribedPage($user_id);
     } else {
         $info['blog_catalog'] = $blog_catalog_model->loadAll();
     }
     $info['level'] = 0;
     foreach ($info['blog_catalog'] as &$item) {
         $item['ajax_param'] = AjaxRequest::getJsonParam('Subscribe', 'AjaxBlogCatalogTree', array($item['id'], $info['level'], $filter, 1));
     }
     $info['direction'] = 1;
     $this->_view->SubscribeList($info);
     $this->_view->parse();
 }
Example #3
0
 function AjaxActionList($info)
 {
     $response = Project::getAjaxResponse();
     $response->save();
     $response->hide('action_list_' . $info['controller_id']);
     //$response -> enable('list_block');
     $info['cancel_param'] = $response->getResponse();
     $response->restore();
     $number = 1;
     foreach ($info['actions_list'] as &$item) {
         $item['number'] = $number;
         $item['change_access_link'] = AjaxRequest::getJsonParam($info['change_access_controller'], $info['change_access_action'], array('id' => $item['id'], 'gid' => $info['user_type_id'], 'cid' => $info['controller_id']));
         $number++;
     }
     $this->set($info);
     $this->setTemplate($this->_dir, 'action_list.tpl.php');
     $response->block('action_list_' . $info['controller_id'], true, $this->parse());
     //$response -> disable('list_block');
 }
Example #4
0
 function AjaxBlogTree($info)
 {
     $response = Project::getAjaxResponse();
     if ($info['direction'] === 1) {
         foreach ($info['blog_catalog'] as $key => &$item) {
             if ($info['id'] == $item['id']) {
                 unset($info['blog_catalog'][$key]);
             } else {
                 $item['ajax_param'] = AjaxRequest::getJsonParam('Subscribe', 'AjaxBlogTree', array($item['id'], $info['level'], $info['filter'], 1));
                 $item['subscribe_param'] = AjaxRequest::getJsonParam('Subscribe', 'Change', array($item['id']));
             }
         }
         $ajax_param = AjaxRequest::getJsonParam('Subscribe', 'AjaxBlogTree', array($info['id'], $info['level'], $info['filter'], 0));
         $response->block('bti_' . $info['id'] . '_' . ($info['level'] - 1), true, '<a href="#" onClick=\'ajax(' . $ajax_param . ');\'><img src="' . $this->image_url . 'icons/minus.gif" /></a>');
         $this->set($info);
         $this->setTemplate($this->_dir, 'blog_tree.tpl.php');
         $response->block('btl_' . $info['id'] . '_' . ($info['level'] - 1), true, $this->parse());
     } else {
         $response->hide('btl_' . $info['id'] . '_' . ($info['level'] - 1));
         $ajax_param = AjaxRequest::getJsonParam('Subscribe', 'AjaxBlogTree', array($info['id'], $info['level'] - 1, $info['filter'], 1));
         $response->block('bti_' . $info['id'] . '_' . ($info['level'] - 1), true, '<a href="#" onClick=\'ajax(' . $ajax_param . ');\'><img src="' . $this->image_url . 'icons/plus.gif" /></a>');
     }
 }
            $query = '>';
        }
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $infoUser = $obj->infoUserLive($_SESSION['authenticated']);
        $response = $obj->getMessages($_SESSION['authenticated'], ' && id ' . $query . ' ' . $offset . '', null);
        ?>
	<?php 
        $countPosts = count($response);
        if ($countPosts != 0) {
            foreach ($response as $key) {
                if ($key['from'] == $_SESSION['authenticated'] && $key['username'] == $infoUser->username) {
                    $key['name'] = $key['name2'];
                    $key['username'] = $key['username2'];
                    $key['avatar'] = $key['avatar2'];
                    $key['type_account'] = $key['type_account2'];
                    $ID = $key['id_2'];
                    $sendTo = '<i class="icon-undo2"></i> ';
                } else {
             echo $gpxWriter->writeGpx($sitesArray);
         }
     }
     return;
 }
 include_once 'lib/AjaxRequest.php';
 if (UrlVar('task') == 'list_sites') {
     AjaxRequest::ListSites();
     return;
 }
 if (UrlVar('task') == 'count_sites') {
     AjaxRequest::CountSites();
     return;
 }
 if (UrlVar('task') == 'site_articles') {
     AjaxRequest::ArticlesForSites();
     return;
 }
 if (UrlVar('task') == 'unit_test') {
     if (Core::Client()->isAdmin()) {
         // TODO: make a phpunit.xml and better unit tests
         // then phpunit --configuration phpunit.xml
         print_r(htmlspecialchars(shell_exec('/usr/local/bin/phpunit ' . escapeshellarg(__DIR__ . DS . 'lib' . DS . 'UtilTest') . ' 2>&1')));
     }
     return;
 }
 /*
  * could implement other ajax commands ie:
  * list number of results actively while user changes selection
  */
 echo 'Ajax Command List: [export]';
Example #7
0
echo $n['name'];
?>
<br>
			</td>
			<td>
				<a href="#" onclick='ajax(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'EditSection', array($n['id']));
?>
)'>[Редактировать]</a> 
				<a href="#" onclick='ajax(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'DeleteSection', array($n['id']));
?>
)'>[Удалить]</a> 
				<a href="#" onclick='ajax(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'SetActive', array($n['id']));
?>
)'>[Активировать]</a> 
				<a href="#" onclick='ajax(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'UpSection', array($n['id']));
?>
)'>[Поднять категорию]</a> 
				<a href="#" onclick='ajax(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'DownSection', array($n['id']));
?>
)'>[Опустить категорию]</a>
			</td>
		</tr>
	<? endforeach;?>
</table>
</div>
error_reporting(0);
if (isset($_POST['name']) && !empty($_POST['name'])) {
    /*
     * --------------------------
     *   Require/Include Files
     * -------------------------
     */
    require_once '../../class_ajax_request/classAjax.php';
    include_once '../../application/functions.php';
    include_once '../../application/DataConfig.php';
    /*
     * ----------------------
     *   Instance Class
     * ----------------------
     */
    $obj = new AjaxRequest();
    $_POST['name'] = _Function::spaces(trim($_POST['name']));
    $_POST['location'] = _Function::spaces(trim(strip_tags($_POST['location'])));
    $_POST['website'] = _Function::spaces(trim($_POST['website']));
    $url = $_POST['website'];
    $_POST['website'] = trim($_POST['website'], '/');
    $_POST['bio'] = _Function::checkTextDb2(trim($_POST['bio']));
    $admin = $obj->getSettings();
    //<-------- * Cutting chain if greater than post_length  * --------->
    if (strlen(utf8_decode($_POST['bio'])) > $admin->post_length) {
        $_POST['bio'] = _Function::cropStringLimit($_POST['bio'], $admin->post_length);
    }
    if ($_POST['name'] == '' || strlen(utf8_decode($_POST['name'])) < 2 || strlen(utf8_decode($_POST['name'])) > 20) {
        echo json_encode(array('response' => $_SESSION['LANG']['full_name_error']));
    } else {
        if (!filter_var($url, FILTER_VALIDATE_URL) && $url != '') {
Example #9
0
                                 Изменить статус</a>';
 }
 echo '   
     					   </td>
     					   <td>' . $newsTreeFeeds['url'] . '</td>
     					   <td>' . $newsTreeFeeds['category_tag'] . '</td>
     					   <td>';
 if ($newsTreeFeeds['news_banner_id']) {
     // we have a banner
     echo '
     					       <a href="javascript:void(0);" class="show_banner">Показать код баннера</a><div class="banner_code"><pre>' . htmlspecialchars($newsTreeFeeds['code']) . '</pre></div><div class="list_status" id="news_banners' . $newsTreeFeeds['news_banner_id'] . '">' . $news_banners_state . '</div>';
     if ($this->isAdmin) {
         echo '<a onclick=\'
         				        document.getElementById("news_banners' . $newsTreeFeeds['news_banner_id'] . '").innerHTML="<img src=' . $this->image_url . 'loader2.gif >";
         				        ajax
         				        (' . AjaxRequest::getJsonParam("News", "ChangeState", array("id" => $newsTreeFeeds['news_banner_id'], "element" => "news_banners"), "POST") . ', true
         				        );
         				        \' href="javascript: void(0);">
                                 Изменить статус</a>';
     }
 } else {
     // no banners in this RSS
     echo 'нет кода баннера';
 }
 echo '
     					   </td>
     					   <td>' . $this->ShowNewsTreeBreadCrumbByNewsTreeId($newsTreeFeeds['news_tree_id']) . '<div class="list_status" id="news_tree' . $newsTreeFeeds['news_tree_id'] . '">' . $news_tree_state . '</div>';
 echo '
     					   </td>
     					   <td>' . $text_parse_type . '</td>
     					   <td><a href="' . $this->createUrl('User', 'Profile', null, $newsTreeFeeds['user_login']) . '">' . $newsTreeFeeds['user_login'] . '</a> [' . $is_partner . ']</td>
<?php

session_start();
error_reporting(0);
if (isset($_GET['_bgPosition']) && !empty($_GET['_bgPosition'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $query = $obj->editBgPosition();
        if ($query == 1) {
            echo json_encode(array('action' => 1, 'result' => $_SESSION['LANG']['saved_successfully']));
        } else {
            echo json_encode(array('action' => 0, 'result' => $_SESSION['LANG']['no_changes']));
        }
    }
    //<-- SESSION
}
//<-- if token id
<?php

/**
 * This handles all Ajax requests for the Data Generator Core. Note that we only include the library.php
 * here, we don't Core::init(). Depending on the context (e.g. installation), that may not be desired.
 */
require_once realpath(dirname(__FILE__) . "/library.php");
// sessions needed here AFTER installation, to get access to $user [or should it be passed &
// validated with all requests?]
header("Cache-Control: private, no-cache, must-revalidate");
$ajaxRequest = new AjaxRequest(@$_POST["action"], $_POST);
$encoded = json_encode($ajaxRequest->getResponse());
$errorCode = json_last_error();
if ($errorCode) {
    switch ($errorCode) {
        case JSON_ERROR_NONE:
            echo ' - No errors';
            break;
        case JSON_ERROR_DEPTH:
            echo ' - Maximum stack depth exceeded';
            break;
        case JSON_ERROR_STATE_MISMATCH:
            echo ' - Underflow or the modes mismatch';
            break;
        case JSON_ERROR_CTRL_CHAR:
            echo ' - Unexpected control character found';
            break;
        case JSON_ERROR_SYNTAX:
            echo ' - Syntax error, malformed JSON';
            break;
        case JSON_ERROR_UTF8:
session_start();
error_reporting(0);
if (isset($_POST['current']) && isset($_POST['new']) && isset($_POST['confirm'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        /*
         * --------------------------
         *  Instance Class
         * -------------------------
         */
        $obj = new AjaxRequest();
        $passCurrent = $obj->infoUserLive($_SESSION['authenticated']);
        include '../../application/functions.php';
        include '../../application/DataConfig.php';
        if (!empty($passCurrent->password) && sha1($_POST['current']) != $passCurrent->password) {
            echo json_encode(array('response' => $_SESSION['LANG']['pass_incorrect'], 'focus' => 'current'));
        } else {
            if (mb_strlen($_POST['new'], 'utf8') < 5 || mb_strlen($_POST['new'], 'utf8') > 20) {
                echo json_encode(array('response' => $_SESSION['LANG']['pass_length'], 'focus' => 'new'));
            } else {
                if (mb_strlen($_POST['confirm'], 'utf8') < 5 || mb_strlen($_POST['confirm'], 'utf8') > 20) {
                    echo json_encode(array('response' => $_SESSION['LANG']['pass_confirm_length'], 'focus' => 'confirm'));
                } else {
                    if ($_POST['confirm'] !== $_POST['new']) {
                        echo json_encode(array('response' => $_SESSION['LANG']['pass_match'], 'focus' => 'confirm'));
                    } else {
session_start();
error_reporting(0);
if (isset($_POST['token']) && !empty($_POST['token']) && isset($_POST['id']) && !empty($_POST['id'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $_POST['token'] = trim($_POST['token']);
        $_POST['id'] = (int) trim($_POST['id']);
        $query = $obj->favorites();
        if ($query == 1) {
            echo '1';
        } else {
            if ($query == 2) {
                echo '2';
            } else {
                if ($query == 3) {
                    echo '3';
                } else {
                    return false;
                }
            }
Example #14
0
</option>
								<?endforeach;?>
							</select>
							
							</div>
  						</td>
					</tr>
				</tbody></table>
				</form>
				<!-- -->

			</td>
			<td class="c_right">&nbsp;</td>
		</tr>
		<tr>
			<td class="b_left">&nbsp;</td>
			<td class="b_cen"><div class="b_delim">
				<div class="button bbig" style="float: right;"><a href="#" onclick='cancel(<?php 
echo $this->cancel_param;
?>
);'>Отмена</a></div>
				<div class="button bbig" style="float: right;"><a href="#" onclick='save(<?php 
echo AjaxRequest::getJsonParam('AdminArticle', 'SaveSection', array($this->cat['id'], 'form_id' => 'edit_form'), "POST");
?>
)'>Сохранить</a></div>
			</td>
			<td class="b_right">&nbsp;</td>
		</tr>
	</tbody>
</table>
            $id_user_favs = $_SESSION['authenticated'];
        }
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $infoUser = $obj->infoUserLive($id_user);
        $infoSessioUsr = $obj->infoUserLive($_SESSION['authenticated']);
        $response = $obj->getAllPosts('WHERE P.user = '******'
			&& P.status = "1"
			&& P.status_general = "1"
			&& U.status = "active"
			&& P.id ' . $query . ' ' . $offset . '
			GROUP BY P.id DESC ', 'LIMIT ' . $postnumbers, $id_user_favs);
        $checkFollow = $obj->checkFollow($_SESSION['authenticated'], $id_user);
        $_countPosts = count($response);
        if ($_countPosts == 0) {
            $nofound = '<span class="notfound">No posts to display</span>';
        }
        $user = $id_user;
        if ($infoUser->mode == 0 && $checkFollow[0]['status'] == 0 && $_SESSION['authenticated'] != $user) {
<?php

session_start();
error_reporting(0);
/*
 * --------------------------
 *   Require/Include Files
 * -------------------------
 */
require_once '../../class_ajax_request/classAjax.php';
include_once '../../application/functions.php';
include_once '../../application/DataConfig.php';
$obj = new AjaxRequest();
$settings = $obj->getSettings();
if ($settings->email_verification == '1') {
    require_once '../../phpmailer/PHPMailerAutoload.php';
    include_once '../../public/ajax/sign_up_verify.php';
} else {
    if ($settings->email_verification == '0') {
        include_once '../../public/ajax/sign_up_no_verify.php';
    }
}
<?php

ini_set('memory_limit', '-1');
session_start();
error_reporting(0);
require '../../class_ajax_request/classAjax.php';
include '../../application/functions.php';
include '../../application/DataConfig.php';
$session_id = $_SESSION['authenticated'];
//$session id
$path = "../../tmp/";
$path_bg = "../backgrounds/";
$obj = new AjaxRequest();
$infoUser = $obj->infoUserLive($_SESSION['authenticated']);
$bg_old = $path_bg . $infoUser->bg;
$defaults = array('0.jpg', '1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', '9.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg');
if (isset($session_id)) {
    $valid_formats = array("jpg", "JPG", "jpeg", "png", "x-png", "gif", "pjpeg");
    if (isset($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") {
        $name = $_FILES['photo']['name'];
        $size = $_FILES['photo']['size'];
        if (strlen($name)) {
            $ext = pathinfo($name);
            if (in_array($ext['extension'], $valid_formats)) {
                if ($size < 1500 * 1500) {
                    $photo_post = 'bg_' . strtolower($infoUser->username) . "_" . $session_id . "" . _Function::randomString(5, FALSE, TRUE, FALSE) . "." . strtolower($ext['extension']);
                    $tmp = $_FILES['photo']['tmp_name'];
                    if (move_uploaded_file($tmp, $path . $photo_post)) {
                        //=============== 440 px =================//
                        $width = _Function::getWidth($path . $photo_post);
                        $height = _Function::getHeight($path . $photo_post);
            $query = '>';
        }
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $response = $obj->searchUsers($_POST['_userId'], ' && U.status = "active" && U.id ' . $query . ' ' . $offset, 'LIMIT ' . $postnumbers, $_SESSION['authenticated']);
        $countPosts = count($response);
        if ($countPosts != 0) {
            foreach ($response as $key) {
                $_idUser = $key['id'];
                $countryUser = $obj->getCountryUser($_idUser);
                //============ VERIFIED
                if ($key['type_account'] == '1') {
                    $verified = ' <i class="fa fa-check-circle verified verified-min showTooltip" title="' . $_SESSION["LANG"]["verified"] . '" data-toggle="tooltip" data-placement="right"></i>';
                } else {
                    $verified = null;
                }
                $checkBlock = $obj->checkUserBlock($_SESSION['authenticated'], $key['id']);
                ?>
				<!-- POSTS -->
Example #19
0
										<?php 
        } else {
            echo '
<a href="javascript: void(0);" 
onclick=\'ajax(' . AjaxRequest::getJsonParam($this->current_controller, $this->current_action, is_array($this->pager_params) ? array_merge($this->pager_params, array("current_page" => $i)) : array("current_page" => $i), "POST") . ', true);\' >
' . ($i + 1) . '</a>';
            ?>
										<?php 
        }
        ?>
									<?php 
    }
    ?>
									<?php 
    if ($this->current_page_number < $this->pages_number - 1) {
        echo '
<a href="javascript: void(0);" 
onclick=\'ajax(' . AjaxRequest::getJsonParam($this->current_controller, $this->current_action, is_array($this->pager_params) ? array_merge($this->pager_params, array("current_page" => $this->current_page_number + 1)) : array("current_page" => $this->current_page_number + 1), "POST") . ', true);\'  title="Следующая страница" >
»</a>';
        ?>
									<?php 
    }
    ?>
			<?php 
}
?>
			</div>
		</div>
<!-- /Листинг -->

if (isset($_POST['add_post']) && !empty($_POST['add_post']) || isset($_POST['photoId']) && !empty($_POST['photoId'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------------
         * Instance Class
         * ----------------------------
         */
        $obj = new AjaxRequest();
        $infoUser = $obj->infoUserLive($_SESSION['authenticated']);
        $admin = $obj->getSettings();
        /*
         * ---------------------------------------------------------
         * Photo Data and Root
         * --------------------------------------------------------
         */
        $path = "../../tmp/";
        $rootUpload = '../../upload/';
        $photoID = $_POST['photoId'];
        $_POST['_geolocation'] = trim(strip_tags($_POST['_geolocation']));
        $_POST['url'] = '';
        $_POST['url_thumbnail'] = '';
        $_POST['url_title'] = '';
        $_POST['url_description'] = '';
session_start();
error_reporting(0);
if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['email']) && !empty($_POST['email'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        $_POST['email'] = trim($_POST['email']);
        $_POST['mode'] = _Function::spaces(trim($_POST['mode']));
        $_POST['username'] = _Function::spaces(trim($_POST['username']));
        $_POST['country'] = _Function::spaces(trim($_POST['country']));
        $infoUser = $obj->infoUserLive($_SESSION['authenticated']);
        $emailAddress = $_POST['email'];
        //<<<--- Defaults Languages
        foreach (_Function::arrayLang() as $key => $value) {
            $defaultsLanguages[] = $value;
        }
        //<<<<--- Languages
        if (!in_array($_POST['lang'], $defaultsLanguages)) {
            $_POST['lang'] = 'en';
     * --------------------------
     *   Require File
     * -------------------------
     */
    require_once '../../class_ajax_request/classAjax.php';
    include_once '../../application/functions.php';
    include_once '../../application/DataConfig.php';
    if (isset($_GET) && $_SERVER['REQUEST_METHOD'] == "GET" && isset($_SESSION['authenticated'])) {
        $since_id = is_numeric($_GET['since_id']) ? $_GET['since_id'] : die;
        $_array = array();
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $infoUser = $obj->infoUserLive($_SESSION['authenticated']);
        $getPosts = $obj->getAllPosts('WHERE P.user = '******'authenticated'] . '
			&& P.status = "1"
			&& U.status = "active"
			&& P.id > ' . $since_id . ' 
			&& P.`repost_of_id` = 0
	|| P.user 
			IN (
					SELECT following FROM followers WHERE follower = ' . $_SESSION['authenticated'] . ' 
					&& status = "1"
			 )  
			 && P.`repost_of_id` = 0
			  && P.status = "1" 
			  && U.status = "active" 
			  && P.id > ' . $since_id . '
session_start();
error_reporting(0);
if (isset($_POST['token']) && !empty($_POST['token']) && isset($_POST['id']) && !empty($_POST['id'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $_POST['token'] = trim($_POST['token']);
        $_POST['id'] = (int) trim($_POST['id']);
        $query = $obj->reposted();
        if ($query == 1) {
            echo '1';
        } else {
            if ($query == 2) {
                echo '2';
            } else {
                if ($query == 3) {
                    echo '3';
                } else {
                    return false;
                }
            }
                    case 'videos':
                        $query_sql_sort = ' && P.video_url != ""';
                        break;
                    case 'links':
                        $query_sql_sort = ' && P.url_host != ""';
                        break;
                }
            } else {
                $query_sql_sort = null;
            }
            /*
             * ----------------------
             *   Instance Class
             * ----------------------
             */
            $obj = new AjaxRequest();
            $infoSessioUsr = $obj->infoUserLive($_SESSION['authenticated']);
            $response = $obj->discover('WHERE P.user != ' . $_SESSION['authenticated'] . ' 
		   && U.status = "active" 
		   && P.status = "1" 
		   && B.id IS NULL 
		   && U.mode = "1" 
		   && P.id ' . $query . ' ' . $offset . ' 
		   && P.repost_of_id = "0"
		   && F.id IS NULL ' . $query_sql_sort . '
		   GROUP BY P.id ORDER BY P.id DESC', 'LIMIT ' . $postnumbers, $_SESSION['authenticated']);
            ?>
	<?php 
            $countPosts = count($response);
            if ($countPosts != 0) {
                foreach ($response as $key) {
if (isset($_POST['id_reply']) && !empty($_POST['id_reply']) && isset($_POST['token_reply']) && !empty($_POST['token_reply']) && isset($_POST['reply_post'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $_POST['id_reply'] = is_numeric($_POST['id_reply']) ? $_POST['id_reply'] : die;
        $_POST['token_reply'] = trim($_POST['token_reply']);
        $_POST['reply_post'] = trim(_Function::checkTextDb($_POST['reply_post']));
        $infoUser = $obj->infoUserLive($_SESSION['authenticated']);
        $admin = $obj->getSettings();
        //<-------- *  * --------->
        if (strlen(utf8_decode($_POST['reply_post'])) > $admin->post_length) {
            $_POST['reply_post'] = _Function::cropStringLimit($_POST['reply_post'], $admin->post_length);
        }
        if (strlen(utf8_decode($_POST['reply_post'])) == 0) {
            return false;
        }
        if ($infoUser->type_account == 1) {
            $verified = ' <i class="fa fa-check-circle verified verified-min showTooltip" title="' . $_SESSION["LANG"]["verified"] . '" data-toggle="tooltip" data-placement="right"></i>';
        } else {
Example #26
0
 public function ChangeCountryAction()
 {
     $request = Project::getRequest();
     $country_id = $request->getKeyByNumber(0);
     if ($country_id) {
         $info = array();
         $state_model = new StateModel();
         $info['state_list'] = $state_model->loadByCountry($country_id);
         $info['change_state_param'] = AjaxRequest::getJsonParam("Social", "ChangeStates", array('#id#'));
         $this->_view->ChangeCountry($info);
         $this->_view->ajax();
     } else {
         $response = Project::getAjaxResponse();
         $response->block('state_div', true, '');
         $response->block('city_div', true, '');
         $this->_view->ajax();
     }
 }
 $_id = is_numeric($_POST['_id']) ? $_POST['_id'] : die;
 $_number = is_numeric($_POST['_number']) ? $_POST['_number'] : die;
 /*
  * --------------------------
  *   Require/Include Files
  * -------------------------
  */
 require_once '../../class_ajax_request/classAjax.php';
 include_once '../../application/functions.php';
 include_once '../../application/DataConfig.php';
 /*
  * ----------------------
  *   Instance Class
  * ----------------------
  */
 $obj = new AjaxRequest();
 $response = $obj->loadMoreMessageId($id_user, $_SESSION['authenticated'], $_id, $_number);
 $countMessagesID = $obj->countMessagesID($id_user, $_SESSION['authenticated']);
 //print_r( $response );
 //<<<<<----- Verified User
 $verified = $obj->checkUser($id_user) ? 1 : 0;
 if ($verified == 0) {
     return false;
 }
 $countPosts = count($response);
 if ($countPosts != 0) {
     //<---------********** FOREACH -----********>
     foreach ($response as $key) {
         //============ VERIFIED
         if ($key['type_account'] == '1') {
             $verified = ' <i class="fa fa-check-circle verified verified-min showTooltip" title="' . $_SESSION["LANG"]["verified"] . '" data-toggle="tooltip" data-placement="right"></i>';
            $id_user_favs = $_SESSION['authenticated'];
        }
        /*
         * --------------------------
         *   Require/Include Files
         * -------------------------
         */
        require_once '../../class_ajax_request/classAjax.php';
        include_once '../../application/functions.php';
        include_once '../../application/DataConfig.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $infoUser = $obj->infoUserLive($id_user);
        $response = $obj->getFollowing('WHERE F.follower = ' . $id_user . ' && F.id ' . $query . ' ' . $offset . '', 'LIMIT ' . $postnumbers, $id_user_favs);
        $checkFollow = $obj->checkFollow($_SESSION['authenticated'], $id_user);
        $_countTotal = count($response);
        $user = $id_user;
        if ($_countTotal == 0) {
            $nofound = '<span class="notfound">No result</span>';
        }
        if ($infoUser->mode == 0 && $checkFollow[0]['status'] == 0 && $_SESSION['authenticated'] != $user) {
            $response = null;
            $nofound = null;
            $mode = '<div class="panel-footer text-center" style="padding: 25px 0; background: url(' . URL_BASE . 'public/img/private.png) right bottom no-repeat;" class="notfound">
		' . $_SESSION['LANG']['profile_private'] . '</div>';
        } else {
            $response = $response;
    {
        parent::__construct();
        define('BE_USER_LOGGED_IN', $this->getLoginStatus('BE_USER_AUTH'));
        define('FE_USER_LOGGED_IN', $this->getLoginStatus('FE_USER_AUTH'));
        \Controller::setStaticUrls('TL_FILES_URL', $GLOBALS['TL_CONFIG']['staticFiles']);
        \Controller::setStaticUrls('TL_SCRIPT_URL', $GLOBALS['TL_CONFIG']['staticSystem']);
        \Controller::setStaticUrls('TL_PLUGINS_URL', $GLOBALS['TL_CONFIG']['staticPlugins']);
    }
    public function run()
    {
        $objModule = $this->Database->prepare("SELECT * FROM tl_module WHERE id=?")->execute(\Input::get('id'));
        $strClass = $this->findFrontendModule($objModule->type);
        if ($this->classFileExists($strClass)) {
            $objModule->typePrefix = 'mod_';
            $objModule = new $strClass($objModule, $strColumn);
            $objModule->generateAjax();
        } else {
        }
        #               if (is_array($GLOBALS['TL_HOOKS']['simpleAjaxFrontend']) && count($GLOBALS['TL_HOOKS']['simpleAjaxFrontend']) > 0) {
        #                       // execute every registered callback
        #                       foreach ($GLOBALS['TL_HOOKS']['simpleAjaxFrontend'] as $callback) {
        #                               $this->import($callback[0]);
        #                               $this->$callback[0]->$callback[1]();
        #                       }
        #               }
        #               header('HTTP/1.1 412 Precondition Failed');
        #               die('Invalid AJAX Request.');
    }
}
$AjaxRequest = new AjaxRequest();
$AjaxRequest->run();
session_start();
error_reporting(0);
if (isset($_POST['_userId']) && !empty($_POST['_userId'])) {
    if (isset($_SESSION['authenticated'])) {
        /*
         * --------------------------
         *   Require File
         * -------------------------
         */
        require '../../class_ajax_request/classAjax.php';
        /*
         * ----------------------
         *   Instance Class
         * ----------------------
         */
        $obj = new AjaxRequest();
        $_POST['_userId'] = is_numeric($_POST['_userId']) ? $_POST['_userId'] : die;
        $query = $obj->reportUser();
        if ($query == 1) {
            echo json_encode(array('status' => 'ok', 'res' => $_SESSION['LANG']['successfully_reported']));
        } else {
            if ($query == 2) {
                echo json_encode(array('status' => 'ok', 'res' => $_SESSION['LANG']['error']));
            } else {
                if ($query == 3) {
                    echo json_encode(array('status' => 'ok', 'res' => $_SESSION['LANG']['already_report']));
                } else {
                    echo json_encode(array('status' => 'error', 'res' => $_SESSION['LANG']['error']));
                }
            }
        }