Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Image size defaulted to 2 MB
Workaround to fix content being displayed twice when used with some incompatible plugins and themes
UI optimizations
  • Loading branch information
prakashm88 committed Aug 12, 2017
1 parent 331e960 commit 8cd925d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 36 deletions.
55 changes: 28 additions & 27 deletions application/controllers/GenieWPMatrimonyController.php
Expand Up @@ -381,6 +381,7 @@ function load_scripts() {

function gwpm_ajax_call_bootstrap() {
appendLog("Inside the AJAX Controller hook") ;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
if (!wp_verify_nonce($_POST['gwpm_nounce'], 'gwpm'))
die('Busted!');
if (current_user_can('matrimony_user') || current_user_can('level_10')) {
Expand Down Expand Up @@ -440,33 +441,33 @@ function page_route($content) {
ob_end_clean();
return $content;
} else {
if (isset ($_GET['action'])) {
$action = $_GET['action'];
}
$controllerName = 'Gwpm' . ucwords($controller) . 'Controller';
$modelName = 'Gwpm' . ucwords($controller) . 'Model';
$controllerURL = GWPM_APPLICATION_URL . DS . 'controllers' . DS . $controllerName . '.php';
$modelURL = GWPM_APPLICATION_URL . DS . 'models' . DS . $modelName . '.php';
if (!file_exists($controllerURL)) {
$controller = 'index';
$controllerName = 'Gwpm' . ucwords($controller) . 'Controller';
$modelName = 'Gwpm' . ucwords($controller) . 'Model';
$controllerURL = GWPM_APPLICATION_URL . DS . 'controllers' . DS . $controllerName . '.php';
$modelURL = GWPM_APPLICATION_URL . DS . 'models' . DS . $modelName . '.php';
}
require_once ($controllerURL);
require_once ($modelURL);
if ($action == null || $action == '') {
$action = 'view';
}
$queryVariables = $this->get_query_string_values($_SERVER['REQUEST_URI']);
$dispatch = new $controllerName ($controller, $action, $queryVariables, $modelName);
if (isset ($_GET['action'])) {
$action = $_GET['action'];
}
$controllerName = 'Gwpm' . ucwords($controller) . 'Controller';
$modelName = 'Gwpm' . ucwords($controller) . 'Model';
$controllerURL = GWPM_APPLICATION_URL . DS . 'controllers' . DS . $controllerName . '.php';
$modelURL = GWPM_APPLICATION_URL . DS . 'models' . DS . $modelName . '.php';
if (!file_exists($controllerURL)) {
$controller = 'index';
$controllerName = 'Gwpm' . ucwords($controller) . 'Controller';
$modelName = 'Gwpm' . ucwords($controller) . 'Model';
$controllerURL = GWPM_APPLICATION_URL . DS . 'controllers' . DS . $controllerName . '.php';
$modelURL = GWPM_APPLICATION_URL . DS . 'models' . DS . $modelName . '.php';
}
require_once ($controllerURL);
require_once ($modelURL);
if ($action == null || $action == '') {
$action = 'view';
}
$queryVariables = $this->get_query_string_values($_SERVER['REQUEST_URI']);
$dispatch = new $controllerName ($controller, $action, $queryVariables, $modelName);

if ((int) method_exists($controllerName, $action)) {
call_user_func_array(array ($dispatch, $action ), $queryVariables);
} else {
throw new GwpmCommonException("Method " . $action . ' not found in class ' . $controllerName);
}
if ((int) method_exists($controllerName, $action)) {
call_user_func_array(array ($dispatch, $action ), $queryVariables);
} else {
throw new GwpmCommonException("Method " . $action . ' not found in class ' . $controllerName);
}
}

} else {
Expand Down Expand Up @@ -528,4 +529,4 @@ function get_query_string_values($link) {
return $queryStrings;
}

}
}
1 change: 1 addition & 0 deletions application/controllers/GwpmActivityController.php
Expand Up @@ -6,6 +6,7 @@ function addActivityLog() {
}

function view() {
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
if(isset($_GET['pid'])) $pid = $_GET['pid'] ;
else $pid = null ;
$this->set('model', $this->_model->getUserActivity($pid));
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/GwpmGalleryController.php
Expand Up @@ -2,6 +2,7 @@
class GwpmGalleryController extends GwpmMainController {

function view() {
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
if(isset($_GET['pid'])) $pid = $_GET['pid'] ;
else $pid = null ;
$this->set('model', $this->_model->getGalleryImages($pid));
Expand All @@ -12,7 +13,7 @@ function edit() {
}

function update() {
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$user = wp_get_current_user();
$galleryObj = new GwpmGalleryVO() ;
$galleryObj->gwpm_gallery_img = $this->rearrange($_FILES['gwpm_gallery_img']) ;
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/GwpmMessagesController.php
Expand Up @@ -10,6 +10,7 @@ class GwpmMessagesController extends GwpmMainController {

function view() {
$f = 0;
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
if(isset($_GET['f']) && !isNull($_GET['f'])) {
$f = intval($_GET['f']);
}
Expand All @@ -18,6 +19,7 @@ function view() {
}

function update() {
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
$user = wp_get_current_user();
$userId = $user->ID ;
$itrId = $_GET['pid'] ;
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/GwpmProfileController.php
Expand Up @@ -2,6 +2,7 @@
class GwpmProfileController extends GwpmMainController {

function view() {
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
if(isset($_GET['pid'])) $pid = $_GET['pid'] ;
else $pid = null ;
$this->set('model', $this->_model->getUserObj($pid));
Expand All @@ -14,6 +15,7 @@ function edit() {
function update() {

$_keys = getDynamicFieldKeys() ;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$profileObj = new GwpmProfileVO($_POST, $_keys);
$profileObj->gwpm_profile_photo = $_FILES["gwpm_profile_photo"] ;
$validateObj = $profileObj->validate();
Expand Down
1 change: 1 addition & 0 deletions application/controllers/GwpmSearchController.php
Expand Up @@ -7,6 +7,7 @@ function view() {

function update() {
$_keys = getDynamicFieldKeys() ;
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
$searchObj = new GwpmSearchVO($_POST, $_keys);
appendLog("Search Object: " . print_r($searchObj, true) ) ;
$this->set("model", $this->_model->searchUsers($searchObj)) ;
Expand Down
2 changes: 1 addition & 1 deletion application/models/GwpmIndexModel.php
Expand Up @@ -18,7 +18,7 @@ function getAllNotifications() {
function getUnreadMessages() {
global $wpdb;
$userId = get_current_user_id();
// print_r ( $userId );
print_r ( $userId );
$messages_table_name = $wpdb->prefix . "gwpm_messages";
$queryString = "SELECT SUM(unread) counts " .
"FROM " . $messages_table_name .
Expand Down
2 changes: 1 addition & 1 deletion application/views/gwpm_pg_footer.php
@@ -1,2 +1,2 @@
<!-- <span><a href="https://itechgenie.com/myblog/genie-wp-matrimony" target="_blank">Plugin by GWPM</a></span> -->
<!-- <span><a href="https://itechgenie.com/myblog/genie-wp-matrimony" target="_blank">GWPM Plugin by ITechGenie</a></span> -->
</div>
4 changes: 2 additions & 2 deletions config/gwpm_config.php
Expand Up @@ -3,7 +3,7 @@
/** Configuration Variables **/

define('DEVELOPMENT_ENVIRONMENT', true);
define('GWPM_ENABLE_DEBUGGING', false);
define('GWPM_ENABLE_DEBUGGING', true);

define('GWPM_APPLICATION_URL', GWPM_ROOT . DS . 'application');
define('GWPM_LIBRARY_URL', GWPM_ROOT . DS . 'library');
Expand All @@ -19,7 +19,7 @@
define('GWPM_USER_PREFIX', 'gwpm_');
define('GWPM_GALLERY_DIR', WP_CONTENT_DIR . URL_S . 'uploads' . URL_S . 'gwpm_gallery');
define('GWPM_GALLERY_URL', WP_CONTENT_URL . URL_S . 'uploads' . URL_S . 'gwpm_gallery');
define("GWPM_IMAGE_MAX_SIZE", "500"); // In KBs
define("GWPM_IMAGE_MAX_SIZE", "2048"); // In KBs
define("GWPM_GALLERY_MAX_IMAGES", "12");
define("GWPM_CONVERSE_MAX_NOS", "10");
define("GWPM_ACTIVITY_MAX_NOS", "10");
Expand Down
4 changes: 2 additions & 2 deletions library/gwpm_command.class.php
Expand Up @@ -51,7 +51,7 @@ function GwpmCommand($records, $dynamicFields = null, $dynamicFieldsValidation =
function validate() {
$invalidProperties = array ();
foreach (array_keys(get_class_vars(get_class($this))) as $key) {
$value = $this-> $key;
$value = $this-> $key;
$ref = new ReflectionProperty(get_class($this), $key);
$docTagValue = $ref->getDocComment();
if (strpos($docTagValue, 'mandatory') != false) {
Expand All @@ -63,7 +63,7 @@ function validate() {
//print_r($this->containsDynamicField) ;
if($this->containsDynamicField) {
foreach ($this->dynamicFields as $key) {
$value = $this-> $key;
$value = $this-> $key;
if(!$this->checkIfNull($value, $key)) {
$messageValue = $this->dynamicFieldsValidation[$key] ;
if(!isset($messageValue) || $messageValue == null) {
Expand Down
7 changes: 5 additions & 2 deletions library/gwpm_shared.php
Expand Up @@ -434,8 +434,10 @@ function getLoaderImg($dimensions = null, $class_name = 'gwpm_loader' ) {
}

function getStrippedUserId($id) {
$id = explode(GWPM_USER_PREFIX, $id ) ;
return (trim($id[1])) ;
$id = str_replace(GWPM_USER_PREFIX, '', $id ) ;
return trim($id) ;
// $id = explode(GWPM_USER_PREFIX, $id ) ;
// return (trim($id[1])) ;
}

function addMenuItem($menu_id, $pageTitle, $pageId, $parentId, $menuOrder) {
Expand Down Expand Up @@ -478,6 +480,7 @@ function appendLog($message) {
}
}

// @TODO Change to dynamic config
function gwpmValidateLength($input) {
if ( strlen(serialize ( $input )) > 2000 )
throw new GwpmCommonException("Given input is greater than 2000 characters") ;
Expand Down

0 comments on commit 8cd925d

Please sign in to comment.