当前位置: 首页>>代码示例>>PHP>>正文


PHP SJB_Request::isAjax方法代码示例

本文整理汇总了PHP中SJB_Request::isAjax方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_Request::isAjax方法的具体用法?PHP SJB_Request::isAjax怎么用?PHP SJB_Request::isAjax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SJB_Request的用法示例。


在下文中一共展示了SJB_Request::isAjax方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $profiler = SJB_Profiler::getInstance();
     if ($profiler->isProfilerEnable() && !SJB_Request::isAjax()) {
         $memory = $profiler->getMemoryUsage();
         $time = $profiler->getTimeElapsed();
         $queries = $profiler->getQueries();
         $functions = $profiler->getFunctions();
         $countOfQueries = count($queries);
         for ($i = 0; $i < $countOfQueries; $i++) {
             $debugCount = count($queries[$i]['debug']);
             for ($j = 0; $j <= $debugCount; $j++) {
                 if (isset($queries[$i]['debug'][$j]['args'])) {
                     unset($queries[$i]['debug'][$j]['args']);
                 }
                 if (isset($queries[$i]['debug'][$j]['object'])) {
                     unset($queries[$i]['debug'][$j]['object']);
                 }
             }
         }
         $tp = SJB_System::getTemplateProcessor();
         $tp->assign('functionCount', count($functions));
         $tp->assign('queryCount', count($queries));
         $tp->assign('functionInfo', $functions);
         $tp->assign('queryInfo', $queries);
         $tp->assign('memory', $memory);
         $tp->assign('time', $time);
         $tp->display('profiler.tpl');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:30,代码来源:profiler.php

示例2: getInstance

 /**
  * @param SJB_TemplateProcessor $tp
  * @param array $info
  * @return SJB_Captcha
  */
 public static function getInstance(SJB_TemplateProcessor $tp, $info = array())
 {
     if (self::$instance === null) {
         $windowType = SJB_Request::isAjax() ? 'modal' : '';
         self::$instance = new self($info, $windowType);
         self::$instance->createCaptchaForm();
     }
     self::$instance->init($tp);
     return self::$instance;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:15,代码来源:Captcha.php

示例3: SaveSubAdminNotifications

 /**
  *
  * @param int $subAdminSID
  * @param string $name
  * @param string $value
  */
 public static function SaveSubAdminNotifications($subAdminSID, $name, $value)
 {
     if (SJB_Request::isAjax() && $name && $value) {
         $perm = 'true' === $value ? 'allow' : 'deny';
         if (SJB_SubAdminAcl::setSubAdminNotificationByPermName($subAdminSID, $name, $perm)) {
             exit('saved');
         }
         exit('failed');
     }
     return false;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:17,代码来源:SubAdminManager.php

示例4: execute

 public function execute()
 {
     $cachePath = SJB_BASE_DIR . "system/cache/markers";
     if (SJB_Request::isAjax()) {
         $fileSystem = new SJB_Filesystem();
         $markers = $fileSystem->getFileNames($cachePath);
         $response = count($markers) ? json_encode($markers) : '';
         exit($response);
     }
     $grayImage = SJB_BASE_DIR . "templates/_system/main/images/marker_gray.gif";
     $greenImage = SJB_BASE_DIR . "templates/_system/main/images/marker_green.gif";
     $orangeImage = SJB_BASE_DIR . "templates/_system/main/images/marker_orange.gif";
     $blueImage = SJB_BASE_DIR . "templates/_system/main/images/marker_blue.gif";
     $pinkImage = SJB_BASE_DIR . "templates/_system/main/images/marker_pink.gif";
     $type = SJB_Request::getVar('type', 'Job');
     $text = SJB_Request::getVar('text', '');
     $filename = '';
     $assets = array('Job' => $orangeImage, 'priority' => $orangeImage, 'indeed' => $blueImage, 'simplyHired' => $greenImage, 'beyond' => $grayImage, 'Resume' => $orangeImage);
     if (array_key_exists($type, $assets)) {
         $filename = $assets[$type];
     } else {
         $filename = $grayImage;
     }
     $cacheFilename = $cachePath . "/marker_" . $type . '_' . $text . ".gif";
     $img = null;
     if (!file_exists($cacheFilename)) {
         if ($filename == $pinkImage || !empty($text) && is_string($text) && !empty($filename)) {
             $img = imagecreatefromgif($filename);
             $imageSx = imagesx($img);
             $imageSy = imagesy($img);
             $fontSize = 8;
             $textLen = strlen($text);
             $black = imageColorAllocate($img, 0, 0, 0);
             $white = imageColorAllocate($img, 255, 255, 255);
             if (!empty($text)) {
                 imagettftext($img, $fontSize, 0, $imageSx / 2 - floor($fontSize / 2 * $textLen) + 2, 13, $black, SJB_BASE_DIR . "templates/_system/main/images/arial.ttf", $text);
             }
             if (!file_exists($cachePath)) {
                 mkdir($cachePath, 0777);
             }
             imagegif($img, $cachePath . "/marker_" . $type . '_' . $text . ".gif");
         }
     } else {
         $img = imagecreatefromgif($cacheFilename);
     }
     if (!is_null($img)) {
         header("Content-type: image/gif");
         imagegif($img);
     }
     exit;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:51,代码来源:get_image_marker.php

示例5: execute

 public function execute()
 {
     if (SJB_Request::isAjax()) {
         die(json_encode($this->getPayPalStateList()));
     }
     $getInvoiceId = SJB_Request::getInt('payment_id', 0, 'GET');
     $this->invoice = SJB_InvoiceManager::getObjectBySID($getInvoiceId);
     if ($this->invoiceValidation($this->invoice)) {
         if ($this->isPayNowButtonPressed()) {
             $this->processPayNowButtonClick();
         } else {
             $this->displayForm();
         }
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:15,代码来源:paypal_pro_fill_payment_card.php

示例6: getPage

 /**
  * 
  * @param SJB_PageConfig $page_config
  */
 public static function getPage($page_config)
 {
     SJB_System::setPageTitle($page_config->getPageTitle());
     SJB_System::setGlobalTemplateVariable('user_page_uri', $page_config->getPageUri());
     SJB_System::setPageKeywords($page_config->getPageKeywords());
     SJB_System::setPageDescription($page_config->getPageDescription());
     if ($page_config->getMainContentFunction() == 'add_listing') {
         $passed_parameters_via_uri = SJB_Request::getVar('passed_parameters_via_uri', false);
         if ($passed_parameters_via_uri) {
             $passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
             if (isset($passed_parameters_via_uri[2])) {
                 $page_config->setMainContentFunction('add_listing_step');
             }
         }
     }
     $maincontent = SJB_System::executeFunction($page_config->getMainContentModule(), $page_config->getMainContentFunction(), $page_config->getParameters(), $page_config->getPageUri());
     if ($page_config->hasRawOutput()) {
         return $maincontent;
     }
     $page_templates_set_name = SJB_System::getSystemSettings('PAGE_TEMPLATES_MODULE_NAME');
     $template_supplier = new SJB_TemplateSupplier($page_templates_set_name);
     $tp = new SJB_TemplateProcessor($template_supplier);
     // assign 'highlight_templates' variable to main or index template
     if (SJB_Settings::getSettingByName('highlight_templates') == 1 && SJB_Request::getVar('admin_mode', false, 'COOKIE')) {
         $tp->assign('highlight_templates', true);
     }
     if ($errors = SJB_Error::getErrorContent()) {
         SJB_FlashMessages::getInstance()->addWarning($errors);
     }
     $tp->assign('MAIN_CONTENT', $maincontent);
     $tp->registerGlobalVariables();
     $tp->assign('sjb_version', SJB_System::getSystemSettings('SJB_VERSION'));
     $template = $page_config->getPageTemplate();
     $template_supplier->addContainerTemplate($template);
     if (SJB_Request::isAjax()) {
         $template = SJB_System::getSettingByName('default_page_template_by_http');
     } elseif (SJB_FormBuilderManager::getIfBuilderModeIsSet()) {
         $template = 'index_b.tpl';
     } else {
         if (empty($template)) {
             $template = SJB_Settings::getSettingByName('DEFAULT_PAGE_TEMPLATE');
         }
     }
     return $tp->fetch($template);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:49,代码来源:PageConstructor.php

示例7: execute

 public function execute()
 {
     $bannersObj = new SJB_Banners();
     $params = $_REQUEST;
     $bannerId = $params['bannerId'];
     if (SJB_Request::isAjax()) {
         $response = array('success' => $bannersObj->deleteBannerImage($bannerId), 'error' => SJB_I18N::getInstance()->gettext('Backend', $bannersObj->bannersError));
         die(json_encode($response));
     }
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $banner = array_merge($bannersObj->getBannerProperties($bannerId), $params);
     $form_submitted = SJB_Request::getVar('submit');
     $filesDir = SJB_System::getSystemSettings('FILES_DIR');
     if (isset($_REQUEST['action'])) {
         $action_name = $_REQUEST['action'];
         switch ($action_name) {
             case 'edit':
                 // ERRORS
                 if ($params['title'] == '') {
                     $errors[] = 'Banner Title is empty.';
                 }
                 if ($params['link'] == '' && $params['bannerType'] != 'code') {
                     $errors[] = 'Banner link mismatched!';
                 }
                 if ($params['bannerType'] == 'code' && $params['code'] == '') {
                     $errors[] = 'Banner code is empty.';
                 }
                 if ($params['bannerType'] == 'file' && $_FILES['image']['name'] == '' && empty($params['imagePath'])) {
                     $errors[] = 'No image attached!';
                 }
                 if ($_FILES['image']['name'] && $_FILES['image']['error']) {
                     $errors[SJB_UploadFileManager::getErrorId($_FILES['image']['error'])] = 1;
                 }
                 if ($errors) {
                     break;
                 }
                 // if image changed - save it
                 if ($_FILES['image']['name'] != '' && $_FILES['image']['tmp_name'] != '') {
                     $hashName = md5(time() * $_FILES['image']['size'] . "_" . $_FILES['image']['name']);
                     $ext = preg_match("|\\.(\\w{3})\\b|", $_FILES['image']['name'], $arr);
                     $bannerFilePath = $filesDir . "banners/" . $hashName . "." . $arr[1];
                     // move file from temporary folder, and fill banner info to DB
                     $copy = copy($_FILES['image']['tmp_name'], $bannerFilePath);
                     if (!$copy) {
                         $errors = 'Cannot copy file from TMP dir to Banners Dir';
                         break;
                     }
                     if ($_FILES['image']['type'] != 'application/x-shockwave-flash') {
                         // array of bannerInfo
                         // [0] - width
                         // [1] - height
                         // [2] - ??
                         // [3] - width & height in next view: width="104" height="150"
                         // [bits] - bit size of image
                         // [channels]
                         // [mime] - type, (image/jpeg, image/gif, image/png )
                         $bannerInfo = getimagesize($bannerFilePath);
                         if ($params['width'] != '' && $params['height'] != '') {
                             $sx = $params['width'];
                             $sy = $params['height'];
                         } else {
                             $sx = $bannerInfo[0];
                             $sy = $bannerInfo[1];
                         }
                         $type = $bannerInfo['mime'];
                     } else {
                         if ($params['width'] == '' || $params['height'] == '') {
                             $errors[] = 'SIZE_PARAMETER_MISMATCHED';
                             break;
                         }
                         $sx = $params['width'];
                         $sy = $params['height'];
                         $type = $_FILES['image']['type'];
                     }
                     $bannerFilePath = "/" . str_replace("../", "/", str_replace(SJB_BASE_DIR, '', $bannerFilePath));
                     // now delete old banner image
                     $bannersObj->deleteBannerImage($bannerId);
                 } else {
                     // if image not changed - leave it as is
                     $bannerOldInfo = $bannersObj->getBannerProperties($params['bannerId']);
                     $sx = $bannerOldInfo['width'];
                     $sy = $bannerOldInfo['height'];
                     if ($params['width'] != '' && $params['height'] != '') {
                         if ($params['width'] != $sx || $params['height'] != $sy) {
                             $sx = $params['width'];
                             $sy = $params['height'];
                         }
                     }
                     $type = $bannerOldInfo['type'];
                     $bannerFilePath = $bannerOldInfo['image_path'];
                 }
                 $title = $params['title'];
                 $link = $params['link'];
                 $active = $params['active'];
                 $group = $params['groupSID'];
                 // check 'link' for correct. If it hasn't 'http://' or 'https://' - add them
                 $expr = preg_match("/^(https?:\\/\\/)/", $link);
                 if ($expr != true && $params['bannerType'] != 'code') {
                     $link = "http://" . $link;
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:edit_banner.php

示例8: execute


//.........这里部分代码省略.........
                if ($_REQUEST['submit'] == 'save') {
                    SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/');
                } else {
                    $parameter = $mailID ? '?edit=' . $mailID : '';
                    SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/' . $parameter);
                }
            }
        }
        if (SJB_Request::getVar('delete')) {
            $mailings = SJB_Request::getVar('mailing');
            if (is_array($mailings)) {
                foreach ($mailings as $id => $value) {
                    SJB_DB::query('DELETE FROM `mailing` WHERE `id` = ?n', $id);
                    SJB_DB::query('DELETE FROM `mailing_info` WHERE `mailing_id` = ?n', $id);
                }
            } else {
                $idToDelete = SJB_Request::getInt('delete', 0);
                SJB_DB::query('DELETE FROM `mailing` WHERE `id` = ?n', $idToDelete);
                SJB_DB::query('DELETE FROM `mailing_info` WHERE `mailing_id` = ?n', $idToDelete);
            }
            SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/');
        }
        if (isset($_REQUEST['edit'])) {
            $idToEdit = SJB_Request::getInt('edit', 0);
            $mail_arr = SJB_DB::query('SELECT * FROM mailing WHERE id = ?n', $idToEdit);
            $tp->assign("mail_id", $mail_arr[0]['id']);
            $tp->assign("subject", $mail_arr[0]['subject']);
            $tp->assign("text", $mail_arr[0]['text']);
            $tp->assign("file", $mail_arr[0]['file']);
            $tp->assign("file_url", $mail_arr[0]['file']);
            $tp->assign("param", unserialize($mail_arr[0]['param']));
        }
        // get products by UserGroup ID
        if (SJB_Request::isAjax()) {
            $userGroupID = SJB_Request::getVar('usergr', 0);
            if ($userGroupID > 0) {
                $products = SJB_ProductsManager::getProductsInfoByUserGroupSID($userGroupID);
            } else {
                $products = SJB_ProductsManager::getAllProductsInfo();
            }
            $tp->assign("products", $products);
            $tp->display("mailing_products.tpl");
            exit;
        }
        $mail_list = SJB_DB::query('SELECT * FROM mailing');
        foreach ($mail_list as $key => $var) {
            $param = unserialize($mail_list[$key]['param']);
            $where = '';
            $join = '';
            $numSentEmails = SJB_DB::queryValue('SELECT count(*) FROM `mailing_info` WHERE `mailing_id` = ?n AND `status`=0', $var['id']);
            if ($param["language"] != 'any') {
                $where .= " and language='{$param['language']}'";
            }
            if ($param["users"] != '0') {
                $where .= ' and u.user_group_sid=' . $param['users'];
            }
            if ($param["without_cv"]) {
                $join = "left join listings l on l.user_sid = u.sid";
                $where .= " and l.sid is null";
            }
            // user status
            if (!empty($param['status'])) {
                $where .= ' and `u`.`active`=' . (int) $param['status'];
            }
            // registration date
            if (!empty($param['registration']) && is_array($param['registration'])) {
开发者ID:Maxlander,项目名称:shixi,代码行数:67,代码来源:mailing.php

示例9: execute

 public function execute()
 {
     $errors = array();
     if (SJB_Request::isAjax()) {
         $response = null;
         if ($logoId = SJB_Request::getVar('logo_id')) {
             SJB_UploadFileManager::deleteUploadedFileByID($logoId, 'logo');
             $parsersId = SJB_Request::getVar('id');
             SJB_DB::query("UPDATE `parsers` SET `xml_logo` = NULL WHERE id = ?n", $parsersId);
         } elseif ($userName = SJB_Request::getVar('parser_user')) {
             $userType = SJB_Request::getVar('user_type');
             $products = SJB_XmlImport::getProducts($userType, $userName, $errors);
             $response = array('products' => empty($products) ? '' : SJB_XmlImport::translateProductsName($products), 'error' => empty($errors) ? '' : array_pop($errors));
             $response = json_encode($response);
         }
         die($response);
     }
     $tp = SJB_System::getTemplateProcessor();
     $original_xml = !empty($_REQUEST['xml']) ? $_REQUEST['xml'] : '';
     $xml = $original_xml;
     $tree = '';
     $listing_fields = array();
     $parsing_name = isset($_REQUEST['parser_name']) ? $_REQUEST['parser_name'] : '';
     $usr_name = isset($_REQUEST['parser_user']) ? $_REQUEST['parser_user'] : '';
     $pars_url = isset($_REQUEST['parser_url']) ? $_REQUEST['parser_url'] : '';
     $form_description = isset($_POST['form_description']) ? $_POST['form_description'] : "";
     $type_id = isset($_POST['type_id']) ? intval($_POST['type_id']) : "";
     $custom_script = SJB_Request::getVar('custom_script', '');
     $custom_script_users = SJB_Request::getVar('custom_script_users', '');
     $add_new_user = isset($_POST['add_new_user']) ? intval($_POST['add_new_user']) : 0;
     $username = SJB_Request::getVar('username', '');
     $external_id = SJB_Request::getVar('external_id', '');
     $defaultValue = array();
     $logo_options_array = array('not_logo' => 'Do Not Import Logo', 'import_logo' => 'Import Logo with Listings', 'upload_logo' => 'Upload Logo for Imported Listings');
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
     $selected = array();
     $a_selected = array();
     $selectedLogoOption = null;
     $selectedLogoField = null;
     $xml_logo = null;
     $selectedProduct = SJB_Request::getVar('postUnderProduct');
     $save_error = SJB_Request::getVar('save_error');
     if ($save_error) {
         $errors[] = base64_decode($save_error);
     }
     if (!empty($_REQUEST['xml']) || $id > 0) {
         // step 2 OR edit exist
         if ($id > 0) {
             // load exist parser
             $parser_from_id = SJB_XmlImport::getSystemParsers($id);
             if (isset($parser_from_id[0]['name'])) {
                 $parser_from_id = $parser_from_id[0];
             }
             $parsing_name = $parser_from_id['name'];
             $usr_id = $parser_from_id['usr_id'];
             $usr_name = $parser_from_id['usr_name'];
             $form_description = $parser_from_id['description'];
             $pars_url = $parser_from_id['url'];
             $type_id = $parser_from_id['type_id'];
             $custom_script = $parser_from_id['custom_script'];
             $custom_script_users = $parser_from_id['custom_script_users'];
             $add_new_user = $parser_from_id['add_new_user'];
             $importType = $parser_from_id['import_type'];
             $xml = $parser_from_id['xml'];
             $xml_logo = $parser_from_id['xml_logo'];
             $xml = SJB_XmlImport::cleanXmlFromImport($xml);
             $defaultValue = $parser_from_id['default_value'] != '' ? unserialize($parser_from_id['default_value']) : array();
             $username = $parser_from_id['username'];
             $map = unserialize($parser_from_id['maper']);
             $external_id = str_replace('@', '_dog_', $parser_from_id['external_id']);
             $selected_logo_options = unserialize($parser_from_id['logo_options']);
             $selectedLogoOption = $selected_logo_options['option'];
             $selectedLogoField = $selected_logo_options['field'];
             if ($selected_logo_options['option'] == 'upload_logo') {
                 $upload_manager = new SJB_UploadPictureManager();
                 $upload_manager->getUploadedPictureInfo($xml_logo . '_thumb');
                 $logo_link = $upload_manager->getUploadedFileLink($xml_logo . '_thumb');
                 $tp->assign('logo_link', $logo_link);
             }
             foreach ($map as $key => $val) {
                 unset($map[$key]);
                 $key = SJB_XmlImport::encodeSpecialEntities($key);
                 $map[$key] = $val;
             }
             $selected = array_values($map);
             $a_selected = array_keys($map);
             $selectedProduct = $parser_from_id['product_sid'];
         } else {
             $xml = SJB_XmlImport::cleanXmlFromImport($_REQUEST['xml']);
         }
         $sxml = new simplexml();
         $xml = stripslashes($xml);
         $tree = $sxml->xml_load_file($xml, 'array');
         if (isset($tree['@content'])) {
             $tree = $tree[0];
         }
         if (is_array($tree)) {
             $tree = SJB_XmlImport::convertArray($tree);
             foreach ($tree as $key => $val) {
                 unset($tree[$key]);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:edit_import.php

示例10: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $registration_form_template = 'registration_form.tpl';
     if (SJB_Authorization::isUserLoggedIn()) {
         $tp->display('already_logged_in.tpl');
         return;
     }
     $tp->assign('terms_of_use_check', SJB_System::getSettingByName('terms_of_use_check'));
     $user_group_id = SJB_Request::getVar('user_group_id', null);
     if (!is_null($user_group_id)) {
         $user_group_sid = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
         if (empty($user_group_sid)) {
             $errors['NO_SUCH_USER_GROUP_IN_THE_SYSTEM'] = 1;
         }
     }
     $this->setSessionValueForRedirectAfterRegister();
     if (!is_null($user_group_id) && empty($errors)) {
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
         $user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
         if (SJB_Request::isAjax() || 'true' == SJB_Request::getVar('isajaxrequest')) {
             $field = SJB_Request::getVar('type');
             if ('email' == $field) {
                 $user->getProperty($field)->type->disableEmailConfirmation();
             }
             echo $user->getProperty($field)->isValid();
             exit;
         }
         $user->deleteProperty('active');
         $user->deleteProperty('featured');
         $form_submitted = SJB_Request::getVar('action', false) == 'register';
         if (class_exists('MobilePlugin') && MobilePlugin::isMobileThemeOn()) {
             $user->prepareRegistrationFields();
         }
         $registration_form = SJB_ObjectMother::createForm($user);
         $registration_form->registerTags($tp);
         if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) && $form_submitted) {
             $email = $user->getPropertyValue('email');
             if (is_array($email)) {
                 $email = $email['original'];
             }
             $user->setPropertyValue('username', $email);
         }
         if ($form_submitted && $registration_form->isDataValid($errors)) {
             $user->deleteProperty('captcha');
             $defaultProduct = SJB_UserGroupManager::getDefaultProduct($user_group_sid);
             SJB_UserManager::saveUser($user);
             SJB_Statistics::addStatistics('addUser', $user->getUserGroupSID(), $user->getSID());
             $availableProductIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($user_group_sid);
             if ($defaultProduct && in_array($defaultProduct, $availableProductIDs)) {
                 $contract = new SJB_Contract(array('product_sid' => $defaultProduct));
                 $contract->setUserSID($user->getSID());
                 $contract->saveInDB();
             }
             // >>> SJB-1197
             // needs to check session for ajax-uploaded files, and set it to user profile
             $formToken = SJB_Request::getVar('form_token');
             $tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
             if (!empty($formToken)) {
                 $tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
                 if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
                     // prepare user profile fields array
                     $userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
                     $userProfileFields = array();
                     foreach ($userProfileFieldsInfo as $field) {
                         $userProfileFields[$field['id']] = $field;
                     }
                     // look for temporary values
                     foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
                         // check field ID for valid ID in user profile fields
                         if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
                             continue;
                         }
                         $fieldType = $userProfileFields[$fieldId]['type'];
                         $profilePropertyId = $fieldId . '_' . $user->getSID();
                         switch (strtolower($fieldType)) {
                             case 'video':
                             case 'file':
                                 // change temporary file ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             case 'logo':
                                 // change temporary file ID and thumb ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             default:
                                 break;
                         }
                         $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
                     }
                     // save user with new values
                     SJB_UserManager::saveUser($user);
                     // clean temporary storage
                     $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:registration.php

示例11: init

 public static function init()
 {
     SJB_DB::init(SJB_System::getSystemSettings('DBHOST'), SJB_System::getSystemSettings('DBUSER'), SJB_System::getSystemSettings('DBPASSWORD'), SJB_System::getSystemSettings('DBNAME'));
     ini_set('zlib.output_compression', SJB_System::getSettingByName('gzip_compression'));
     $GLOBALS['fatal_error_reserve_buffer'] = str_repeat('x', 1024 * 200);
     ob_start(array('SJB_Error', 'fatalErrorHandler'));
     SJB_Session::init(SJB_System::getSystemSettings('SITE_URL'));
     $sessionId = SJB_DB::queryValue("SELECT `session_id` FROM `user_session_data_storage` WHERE `session_id` = ?s", SJB_Session::getSessionId());
     // if not updated (row not exists) - insert that value
     if (empty($sessionId)) {
         SJB_DB::query("INSERT INTO `user_session_data_storage` SET `last_activity` = NOW(), `session_id` = ?s", SJB_Session::getSessionId());
     } else {
         SJB_DB::query("UPDATE `user_session_data_storage` SET `last_activity` = NOW() WHERE `session_id` = ?s", $sessionId);
     }
     //set timezone
     if (SJB_Settings::getSettingByName('timezone')) {
         ini_set('date.timezone', SJB_Settings::getSettingByName('timezone'));
     }
     // Set Error Handler and Shutdown function
     set_error_handler(array('SJB_Error', 'errorHandler'));
     register_shutdown_function(array('SJB_System', 'shutdownFunction'));
     SJB_System::prepareGlobalArrays();
     SJB_System::setGlobalTemplateVariable('is_ajax', SJB_Request::isAjax());
     SJB_System::setGlobalTemplateVariable('site_url', SJB_System::getSystemSettings('SITE_URL'));
     SJB_System::setGlobalTemplateVariable('user_site_url', SJB_System::getSystemSettings('USER_SITE_URL'));
     SJB_System::setGlobalTemplateVariable('admin_site_url', SJB_System::getSystemSettings('ADMIN_SITE_URL'));
     SJB_System::setGlobalTemplateVariable('radius_search_unit', SJB_System::getSettingByName('radius_search_unit'));
     SJB_System::setGlobalTemplateVariable('settings', SJB_Settings::getSettings());
     ThemeManager::getCurrentTheme();
     SJB_PluginManager::loadPlugins(SJB_System::getSystemSettings('PLUGINS_DIR'));
     SJB_System::setGlobalTemplateVariable('plugins', SJB_PluginManager::getAllPluginsList());
     $GLOBALS['System']['MODULE_MANAGER'] = new SJB_ModuleManager();
     SJB_Event::dispatch('moduleManagerCreated');
     $GLOBALS['System']['MODULE_MANAGER']->executeModulesStartupFunctions();
     // define if subadmin loged in and set subamdinmode for templates
     if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') && SJB_SubAdmin::getSubAdminSID()) {
         SJB_System::setGlobalTemplateVariable('subAdminSID', SJB_SubAdmin::getSubAdminSID());
     }
     $GLOBALS['uri'] = SJB_Navigator::getURI();
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:40,代码来源:System.php

示例12: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $parent_name = null;
     $user_sid = SJB_Request::getVar('user_sid', false);
     if (!is_null($user_sid)) {
         $user_info = SJB_UserManager::getUserInfoBySID($user_sid);
         $user_info = array_merge($user_info, $_REQUEST);
         $form_submitted = SJB_Request::getVar('action_name');
         $user = new SJB_User($user_info, $user_info['user_group_sid']);
         if (!empty($user_info['parent_sid'])) {
             $props = $user->getProperties();
             $allowedProperties = array('username', 'email', 'password');
             foreach ($props as $prop) {
                 if (!in_array($prop->getID(), $allowedProperties)) {
                     $user->deleteProperty($prop->getID());
                 }
             }
             $parent_name = SJB_UserManager::getUserNameByUserSID($user_info['parent_sid']);
         }
         $user->setSID($user_info['sid']);
         $user->getProperty('email')->type->disableEmailConfirmation();
         $user->deleteProperty("active");
         $user->makePropertyNotRequired("password");
         if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_info['user_group_sid'])) {
             if ($form_submitted) {
                 $email = $user->getPropertyValue('email');
                 if (is_array($email)) {
                     $email = $email['original'];
                 }
                 $user->setPropertyValue('username', $email);
             }
         }
         $user->addExtUserIDProperty($user_info['extUserID']);
         $edit_user_form = new SJB_Form($user);
         $errors = array();
         if ($form_submitted && $edit_user_form->isDataValid($errors)) {
             $password_value = $user->getPropertyValue('password');
             $properties = null;
             if (empty($password_value['original'])) {
                 $properties = $user->getProperties();
                 $user->deleteProperty('password');
             }
             SJB_UserManager::saveUser($user);
             // >>> SJB-1197
             // needs to check session for ajax-uploaded files, and set it to user profile
             $tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
             $formToken = SJB_Request::getVar('form_token');
             if (!empty($formToken)) {
                 $tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
                 if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
                     // prepare user profile fields array
                     $userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
                     $userProfileFields = array();
                     foreach ($userProfileFieldsInfo as $field) {
                         $userProfileFields[$field['id']] = $field;
                     }
                     // look for temporary values
                     foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
                         // check field ID for valid ID in user profile fields
                         if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
                             continue;
                         }
                         $fieldType = $userProfileFields[$fieldId]['type'];
                         $profilePropertyId = $fieldId . '_' . $user->getSID();
                         switch (strtolower($fieldType)) {
                             case 'video':
                             case 'file':
                                 // change temporary file ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             case 'logo':
                                 // change temporary file ID and thumb ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             default:
                                 break;
                         }
                         $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
                     }
                     // and save user with new fields data
                     SJB_UserManager::saveUser($user);
                     SJB_Authorization::updateCurrentUserSession();
                     // clean temporary storage
                     $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
                     // CLEAR TEMPORARY SESSION STORAGE
                     SJB_Session::setValue('tmp_uploads_storage', $tmpUploadsStorage);
                 }
             }
             // <<< SJB-1197
             if (SJB_Request::isAjax()) {
                 echo "<p class=\"green\">User Saved</p>";
                 exit;
             }
             if ($form_submitted == 'save_info') {
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:edit_user.php

示例13: execute

 public function execute()
 {
     $errors = array();
     if (SJB_Request::isAjax()) {
         $response = null;
         $user_type = SJB_Request::getVar('user_type');
         $user_name = SJB_Request::getVar('parser_user');
         $products = SJB_XmlImport::getProducts($user_type, $user_name, $errors);
         $response = array('products' => empty($products) ? '' : SJB_XmlImport::translateProductsName($products), 'error' => empty($errors) ? '' : array_pop($errors));
         die(json_encode($response));
     }
     $tp = SJB_System::getTemplateProcessor();
     $add_level = SJB_Request::getVar('add_level', 1);
     // check for errors
     if ($add_level == '3') {
         $selectUserType = SJB_Request::getVar('selectUserType');
         $addNewUser = 0;
         if ($selectUserType == 'username') {
             $usr_name = isset($_REQUEST['parser_user']) ? SJB_DB::quote($_REQUEST['parser_user']) : '';
             $usr_id = SJB_UserManager::getUserSIDbyUsername($usr_name);
             if (empty($usr_name)) {
                 $errors[] = 'Please enter user name of existing user to the "User Name" field';
                 $usr_name = '';
             } else {
                 $user_sid_exists = SJB_UserManager::getUserSIDbyUsername($usr_name);
                 if (empty($user_sid_exists)) {
                     $errors[] = 'User "' . $usr_name . '" not exists. Please enter user name of existing user to the "User Name" field';
                     $usr_name = '';
                 }
             }
         } elseif ($selectUserType == 'group') {
             $userGroupSid = isset($_REQUEST['parser_user']) ? $_REQUEST['parser_user'] : 0;
             $usr_id = $userGroupSid;
             $usr_name = SJB_UserGroupManager::getUserGroupIDBySID($usr_id);
             $addNewUser = 1;
         }
         if ($errors) {
             $add_level = 2;
         }
     }
     $listings_type = SJB_ListingTypeManager::getAllListingTypesInfo();
     $types = array();
     foreach ($listings_type as $one) {
         $types[$one['sid']] = $one['id'];
     }
     $tp->assign('types', $types);
     $selected_logo_options = null;
     switch ($add_level) {
         case '1':
             $template = 'add_step_one.tpl';
             /*
             $types = array();
             foreach ( $listings_type as $one ) {
             					  $types[$one['sid']] = $one['id'];
             }
             $tp->assign('types', $types);
             */
             $tp->display('add_step_one.tpl');
             break;
         case '2':
             $template = 'add_step_two.tpl';
             $original_xml = SJB_Request::getVar('xml');
             $xml = $original_xml;
             $tree = '';
             $listing_fields = array();
             $logo_options_array = array('not_logo' => 'Do Not Import Logo', 'import_logo' => 'Import Logo with Listings', 'upload_logo' => 'Upload Logo for Imported Listings');
             $parsing_name = SJB_Request::getVar('parser_name');
             $usr_name = SJB_Request::getVar('parser_user');
             $pars_url = SJB_Request::getVar('parser_url');
             $form_description = SJB_Request::getVar('form_description', '', 'POST');
             $type_id = SJB_Request::getVar('type_id', '', 'POST');
             $selectedLogoOption = SJB_Request::getVar('logo_options');
             $selectedLogoField = SJB_Request::getVar('import_logo_field');
             $selectedProduct = SJB_Request::getVar('postUnderProduct');
             $id = SJB_Request::getVar('id', 0, 'GET');
             $selected = array();
             $a_selected = array();
             if (!empty($_REQUEST['xml']) || $id > 0) {
                 // step 2 OR edit exist
                 if ($id > 0) {
                     // load exist parser
                     $parser_from_id = SJB_XmlImport::getSystemParsers($id);
                     if (isset($parser_from_id[0]['name'])) {
                         $parser_from_id = $parser_from_id[0];
                     }
                     $parsing_name = $parser_from_id['name'];
                     $usr_id = $parser_from_id['usr_id'];
                     $usr_name = $parser_from_id['usr_name'];
                     $form_description = $parser_from_id['description'];
                     $pars_url = $parser_from_id['url'];
                     $type_id = $parser_from_id['type_id'];
                     $selected_logo_options = unserialize($parser_from_id['logo_options']);
                     $selectedLogoOption = $selected_logo_options['option'];
                     $selectedLogoField = $selected_logo_options['field'];
                     $selectedProduct = $parser_from_id['product_sid'];
                     $xml = $parser_from_id['xml'];
                     $xml = SJB_XmlImport::cleanXmlFromImport($xml);
                     $map = unserialize($parser_from_id['maper']);
                     $selected = array_values($map);
                     $a_selected = array_keys($map);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:add_import.php

示例14: execute

 public function execute()
 {
     $listing_id = SJB_Request::getVar('listing_id', null);
     $listing_info = SJB_ListingManager::getListingInfoBySID($listing_id);
     $listingTypeInfo = SJB_ListingTypeManager::getListingTypeInfoBySID($listing_info['listing_type_sid']);
     if (!is_null($listing_info)) {
         $filename = SJB_Request::getVar('filename', false);
         if ($filename) {
             $file = SJB_UploadFileManager::openFile($filename, $listing_id);
             $errors['NO_SUCH_FILE'] = true;
         }
         if (isset($_REQUEST['Occupations']) && isset($_REQUEST['Occupations']['tree']) && !$_REQUEST['Occupations']['tree']) {
             unset($_REQUEST['Occupations']['tree']);
         }
         $listing_info = array_merge($listing_info, $_REQUEST);
         if (isset($_REQUEST['Occupations']) && isset($_REQUEST['Occupations']['tree']) && $_REQUEST['Occupations']['tree']) {
             $listing_info['Occupations'] = $_REQUEST['Occupations']['tree'];
         }
         $listing = new SJB_Listing($listing_info, $listing_info['listing_type_sid']);
         $listing->setSID($listing_id);
         $listing_edit_form = new SJB_Form($listing);
         $form_is_submitted = SJB_Request::getVar('action');
         $errors = array();
         if ($form_is_submitted) {
             $listing->addProperty(array('id' => 'access_list', 'type' => 'multilist', 'value' => SJB_Request::getVar('list_emp_ids'), 'is_system' => true));
         }
         if ($form_is_submitted && $listing_edit_form->isDataValid($errors)) {
             $listingSid = $listing->getID();
             SJB_BrowseDBManager::deleteListings($listingSid);
             SJB_ListingManager::saveListing($listing);
             SJB_BrowseDBManager::addListings($listingSid);
             $formToken = SJB_Request::getVar('form_token');
             $sessionFilesStorage = SJB_Session::getValue('tmp_uploads_storage');
             $uploadedFields = SJB_Array::getPath($sessionFilesStorage, $formToken);
             if (!empty($uploadedFields)) {
                 foreach ($uploadedFields as $fieldId => $fieldValue) {
                     // get field of listing
                     $isComplex = false;
                     if (strpos($fieldId, ':') !== false) {
                         $isComplex = true;
                     }
                     $tmpUploadedFileId = $fieldValue['file_id'];
                     // rename it to real listing field value
                     $newFileId = $fieldId . "_" . $listing->getSID();
                     SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` =?s", $newFileId, $tmpUploadedFileId);
                     if ($isComplex) {
                         list($parentField, $subField, $complexStep) = explode(':', $fieldId);
                         $parentProp = $listing->getProperty($parentField);
                         $parentValue = $parentProp->getValue();
                         // look for complex property with current $fieldID and set it to new value of property
                         if (!empty($parentValue)) {
                             foreach ($parentValue as $id => $value) {
                                 if ($id == $subField) {
                                     $parentValue[$id][$complexStep] = $newFileId;
                                 }
                             }
                             $listing->setPropertyValue($parentField, $parentValue);
                         }
                     } else {
                         $listing->setPropertyValue($fieldId, $newFileId);
                     }
                     // unset value from session temporary storage
                     $sessionFilesStorage = SJB_Array::unsetValueByPath($sessionFilesStorage, "{$formToken}/{$fieldId}");
                 }
                 //and remove token key from temporary storage
                 $sessionFilesStorage = SJB_Array::unsetValueByPath($sessionFilesStorage, "{$formToken}");
                 SJB_Session::setValue('tmp_uploads_storage', $sessionFilesStorage);
                 SJB_ListingManager::saveListing($listing);
             }
             SJB_Event::dispatch('listingEdited', $listingSid);
             if (SJB_Request::isAjax()) {
                 echo '<p class="green">Listing Saved</p>';
                 exit;
             }
             if ($form_is_submitted == 'save_info') {
                 $listingTypeId = SJB_ListingTypeManager::getListingTypeIDBySID($listing_info['listing_type_sid']);
                 $listingType = $listingTypeId != 'Job' && $listingTypeId != 'Resume' ? $listingTypeId . '-listings' : $listingTypeId . 's';
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/manage-" . strtolower($listingType) . "/?restore=1");
             }
         }
         $listing->deleteProperty('access_list');
         $comments = SJB_CommentManager::getEnabledCommentsToListing($listing_id);
         $comments_total = count($comments);
         $rate = SJB_Rating::getRatingNumToListing($listing_id);
         $form_fields = $listing_edit_form->getFormFieldsInfo();
         $pages = SJB_PostingPagesManager::getPagesByListingTypeSID($listing->getListingTypeSID());
         $realFormFields = array();
         foreach ($pages as $page) {
             $listingFields = SJB_PostingPagesManager::getAllFieldsByPageSIDForForm($page['sid']);
             foreach ($listingFields as $fieldID => $listingField) {
                 if (isset($form_fields[$fieldID])) {
                     $realFormFields[$fieldID] = $form_fields[$fieldID];
                 }
             }
         }
         $adminFields = array();
         foreach ($form_fields as $fieldName => $field) {
             if (!isset($realFormFields[$fieldName])) {
                 $adminFields[$fieldName] = $field;
             }
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:edit_listing.php


注:本文中的SJB_Request::isAjax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。