A fully RESTful server implementation for CodeIgniter using one library, one config file and one controller.
Author: Phil Sturgeon, Chris Kacerguis
Inheritance: extends MX_Controller
Example #1
1
 public function __construct()
 {
     parent::__construct();
     /*
     $token_value = $this->get('token');
     
     $token = new Token();
     $token->where('value',$token_value);
     $token->get();
     
     if (!$token->exists())
     {
     	$this->response(
     		array(
     			'error'=>'Invalid Token'
     		)
     	);
     }
     
     
     $this->user = $token->user;
     $this->application = $token->application;
     */
     $this->user_id = $this->session->userdata('user_id');
     if (!$this->user_id) {
         $this->response(array('error' => 'Not Logged In'));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->model('prescription/prescription');
     $this->load->model('sms/sms');
     $simbanic_json = array();
 }
 function __construct()
 {
     parent::__construct();
     $this->load->model("Property_model");
     $this->load->database();
     //$autoload['model'] = array('property_model');
 }
Example #4
0
 public function __construct()
 {
     parent::__construct();
     if (!$this->session->userdata('auth')) {
         redirect('login', 'refresh');
     }
 }
 function __construct()
 {
     parent::__construct();
     $this->ci =& get_instance();
     $this->ci->load->database();
     $this->load->model('Village_data_model');
 }
 function __construct()
 {
     parent::__construct();
     $this->load->library('common');
     global $messages_lang;
     $messages_lang = $this->common->set_language_for_server_api('base_api', array('missing_fields', 'invalid_credential', 'authorized', 'not_authorized', 'logout_success', 'logout_failure', 'unexpected_errors'));
 }
 function __construct()
 {
     parent::__construct();
     $this->load->library('form_validation');
     // $this->load->helper(array('form','url'));
     $this->load->model('meeting_model');
 }
Example #8
0
 function __construct()
 {
     // Construct the parent class
     parent::__construct();
     $this->load->model('Evaluator_model', 'evaluator');
     $this->load->helper('url');
 }
Example #9
0
 function __construct()
 {
     parent::__construct();
     header("Content-type: text/html; charset=utf-8");
     //		header("Content-type: application/json; charset=utf-8");
     $this->kq = new Kqavos();
 }
Example #10
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('Penduduk');
     $this->baseCols = array('nama', 'tempat_lahir', 'tanggal_lahir', 'jenis_kelamin', 'golongan_darah', 'tanggal_diterbitkan', 'nip_pencatat', 'kewarganegaraan');
     $this->baseUpdatableCols = array('nik', 'agama', 'foto', 'alamat', 'rt', 'rw', 'kecamatan', 'kelurahan', 'kabupaten', 'provinsi', 'status_perkawinan', 'pekerjaan', 'pendidikan_terakhir');
 }
Example #11
0
 function __construct()
 {
     parent::__construct();
     $this->validate_user();
     $this->load->helper('json');
     $this->load->model(array('Project', 'Screen', 'Comment', 'Hotspot', 'Project_Statistic', 'Drawing'));
 }
Example #12
0
 public function __construct()
 {
     header('Access-Control-Allow-Origin: *');
     header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
     header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, HEAD, DELETE");
     $method = $_SERVER['REQUEST_METHOD'];
     if ($method == "OPTIONS") {
         die;
     }
     parent::__construct();
     $this->file_cache_base = FCPATH . '/files/';
     $library_files = scandir('application/libraries');
     foreach ($library_files as $file) {
         $end = '_task.php';
         $pos = strpos($file, $end);
         if ($pos == strlen($file) - strlen($end)) {
             $lang = substr($file, 0, $pos);
             require_once "application/libraries/{$file}";
             $class = $lang . '_Task';
             $version = $class::getVersion();
             $this->languages[$lang] = $version;
         }
     }
     if ($this->config->item('rest_enable_limits')) {
         $this->load->config('per_method_limits');
         $limits = $this->config->item('per_method_limits');
         foreach ($limits as $method => $limit) {
             $this->methods[$method]['limit'] = $limit;
         }
     }
 }
Example #13
0
 function __construct()
 {
     // Call the Model constructor
     parent::__construct();
     date_default_timezone_set('Asia/Seoul');
     $this->load->model('general_model');
     $this->load->model('order_model');
     $this->load->model('token_model');
     $this->load->model('customer_model');
     $this->load->model('email_model');
     $result = $this->token_model->checkToken($this->get('token'), 1, false);
     if ($result['status'] != true) {
         $this->response(array('error' => 'Your token is not valid'), 404);
     } else {
         if (!$this->get('id')) {
             $this->response(array('error' => 'You must give order info'), 404);
         } else {
             //본 주문에 관련있는 사람인지 혹인
             $order = $this->order_model->readOrder($this->get('id'));
             if ($order == false) {
                 $this->response(array('error' => 'order is not valid'), 404);
             } else {
                 $seller_number = $this->token_model->readSellerNumber($this->get('token'));
                 $userkey = $this->token_model->readUserkey($this->get('token'));
                 if ($order['customer_number'] != $userkey && $order['editor_number'] != $seller_number && $seller_number != 1) {
                     $this->response(array('error' => "This info is not accessible"), 404);
                 }
             }
         }
     }
 }
Example #14
0
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 function __construct()
 {
     parent::__construct();
     $this->load->model('user', '', TRUE);
     $this->load->model('device', '', TRUE);
     if (!in_array($this->router->method, $this->config->item('allowed_calls_without_token'))) {
         $headers = getallheaders();
         if (isset($headers['Token'])) {
             if (isset($headers['Userid'])) {
                 if (!$this->device->validToken($headers['Userid'], $headers['Token'])) {
                     $data["header"]["error"] = "1";
                     $data["header"]["message"] = "Please provide valid token";
                     $this->response($data, 200);
                 }
             } else {
                 $data["header"]["error"] = "1";
                 $data["header"]["message"] = "Please provide user id (header)";
                 $this->response($data, 200);
             }
         } else {
             $data["header"]["error"] = "1";
             $data["header"]["message"] = "Please provide access token";
             $this->response($data, 200);
         }
     }
 }
Example #15
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model("m_ebook", "", TRUE);
     $this->load->model("m_user", "", TRUE);
     $this->load->model("m_comment", "", TRUE);
 }
Example #16
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('CORE_Controller');
     $this->core_controller->set_response_helper($this);
     $this->load->model('transaction_model');
 }
Example #17
0
 function __construct()
 {
     parent::__construct();
     $this->validate_user();
     $this->load->helper('json');
     $this->load->model(array('Team', 'Project', 'Activity'));
 }
Example #18
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library(array('session', 'ion_auth'));
     $this->load->helper(array('url'));
     $this->ion_auth->add_auth_rules(array('get_data_from_url' => true, 'save_review_data' => true, 'unicode_decode' => true, 'replace_unicode_escape_sequence' => true, 'get_batches_list' => true, 'start_export' => true, 'start_import' => true, 'get_crawled_data' => true, 'SendMailToSuppliers' => true));
 }
Example #19
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model("modelo");
     header('Access-Control-Allow-Origin: *');
     header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE");
 }
Example #20
0
 function __construct()
 {
     // Call the Model constructor
     parent::__construct();
     date_default_timezone_set('Asia/Seoul');
     $this->load->model('general_model');
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->model('reservaModel');
     $this->load->model('clienteModel');
     $this->load->model('facturaModel');
 }
Example #22
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('App_user_model');
     $this->load->model('App_sms_model');
     $this->load->model('App_otp_model');
 }
Example #23
0
 function __construct()
 {
     // Construct the parent class
     parent::__construct();
     $this->load->model('user_model');
     $this->load->model('auth_model');
 }
Example #24
0
 function __construct()
 {
     parent::__construct();
     $this->load->helper('url');
     $qString = $this->get();
     $this->start = isset($qString['st']) && $qString['st'] > 0 ? $qString['st'] : 0;
     $this->limit = isset($qString['lt']) && $qString['lt'] > 0 ? $qString['lt'] : 10;
     $this->order = isset($qString['od']) && $qString['od'] != '' ? $qString['od'] : 'ASC';
     $this->order_by = isset($qString['ob']) && $qString['ob'] != '' ? $qString['ob'] : null;
     if (isset($qString['at']) && $qString['at'] != '') {
         $flag = $this->validrequest($qString['at']);
         if ($flag) {
         } else {
             $this->response(array('status' => 0, 'error' => 'Invalid App Token'));
         }
     } elseif (isset($qString['ut']) && $qString['ut'] != '') {
         $flag = $this->validrequest($qString['ut'], 'user');
         if ($flag) {
         } else {
             $this->response(array('status' => 0, 'error' => 'Invalid User Token'));
         }
     } else {
         if ($this->uri->segment(2) == 'users' && $this->uri->segment(3) == 'applogin') {
             return true;
         } else {
             $this->response(array('status' => 0, 'error' => 'Invalid Request'));
         }
     }
 }
Example #25
0
 function __construct()
 {
     parent::__construct();
     $this->validate_user();
     $this->load->helper('json');
     $this->load->model(array('Project', 'Project_Invite', 'Template', 'Screen', 'Comment', 'Project_Statistic'));
 }
Example #26
0
 function __construct()
 {
     header('Access-Control-Allow-Headers: CC-API-KEY');
     header('Access-Control-Expose-Headers: Authorized');
     // Construct our parent class
     parent::__construct();
     $this->headers = getallheaders();
     $this->_check_key($this->headers['CC-API-KEY']);
     $this->load->library('ion_auth');
     // Configure limits on our controller methods. Ensure
     // you have created the 'limits' table and enabled 'limits'
     // within application/config/rest.php
     $this->methods['user_get']['limit'] = 500;
     //500 requests per hour per user/key
     $this->methods['user_post']['limit'] = 100;
     //100 requests per hour per user/key
     $this->methods['user_delete']['limit'] = 50;
     //50 requests per hour per user/key
     if ($this->request->method == 'options') {
         $this->response('', 200);
     }
     if ($this->ion_auth->logged_in()) {
         $this->user = new Person($this->ion_auth->user()->row()->id);
         print_r($this->user());
     }
 }
Example #27
0
 public function __construct()
 {
     parent::__construct();
     $this->load->helper('url');
     $this->load->library('mmsecurity');
     $this->mmUser = $this->mmsecurity->getMmUser();
 }
Example #28
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library(array('session', 'ion_auth'));
     $this->load->library('form_validation');
     $this->load->helper(array('url'));
     $this->ion_auth->add_auth_rules(array('GetAllFeaturesForCustomer' => true, 'GetAllBucketsForCustomer' => true, 'GetAssessData' => true, 'UpdateBucketValues' => true, 'UpdateFeatureValues' => true, 'CreateBucket' => true, 'DeleteBucket' => true, 'CreateFeature' => true, 'DeleteFeature' => true, 'RecalcMedianContentHealthScore' => true, 'UpdateMedianAndFactor' => true, 'GetMedianContentHealthScore' => true, 'GetNormalizedScores' => true, 'GetFeaturesToCreate' => true, 'UploadCategoriesFile' => true, 'StartMedianRecalc' => true, 'AddMatchPair' => true, 'UploadMatchFile' => true, 'GetNumberofItemsInBatch' => true, 'GetBatchStatus' => true, 'UploadBatchFile' => true, 'GetAllQueuedOrLockedCount' => true, 'GetBatchID' => true, 'GetBatchCrawlStatus' => true, 'GenerateFiltersCombo' => true, 'SetBatchCrawlStatus' => true, 'GetNonAdminInstances' => true, 'SaveSummaryGroups' => true, 'AddSecondary' => true, 'GetBatchNameFromID' => true, 'QueueBatch' => true, 'QueueURLs' => true, 'GetCrawlData' => true, 'GetAllBatchesToCrawl' => true, 'GetSummaryData' => true, 'GetCreateCrawlersStatus' => true, 'UpdateCreateCrawlersStatus' => true, 'curl_request' => true, 'CreateProcess' => true, 'ExportTemplate' => true, 'GetNumInstances' => true, 'delete_scheduled_batch' => true, 'GetNumURLsForDoStats' => true, 'GetTrendlineDatesStatus' => true, 'GetFiltersStatus' => true, 'GetInstanceSize' => true, 'GetURLsForRecrawl' => true, 'ImportTemplate' => true, 'UrlMatchesFiles' => true, 'CreateBatch' => true, 'generate_xml_from_array' => true, 'RunInstances' => true, 'getChangedProducts' => true, 'TerminateInstances' => true, 'DoStatsByBatch' => true, 'StartTrendlineDates' => true, 'GenerateFilters' => true, 'RememberBatches' => true, 'GetFiltersIds' => true, 'GetBatchValues' => true, 'results_details_export' => true, 'read_session_for_export' => true, 'GetBatchesByCustomerName' => true, 'GetAllCustomers' => true, 'GetCategoriesByBatch' => true, 'ChangeBatchSorting' => true, 'GetBrandsByTermAndBatch' => true, 'SaveExcludeState' => true, 'GetColumnsOfProductsTable' => true, 'ChangeColumnsOfProductsTable' => true, 'GetFilters' => true, 'keywordsSuggestion' => true, 'GetAssessInfo' => true, 'RecieveInsightActions' => true, 'RecieveFavoriteInsightActions' => true, 'GetBrandsAndFilters' => true, 'StoreInsightActions' => true, 'SaveFiltersValuesViewConf' => true, 'SaveUserActiveFilters' => true, 'SaveUserFiltersGroupVisibilities' => true, 'ResetUserOrders' => true, 'ScheduleBatch' => true, 'CustomBatchIndex' => true, 'CustomersList' => true, 'GetBatchType' => true, 'FilterStyleByCustomerName' => true, 'GetBatchInfo' => true, 'GetCustomerByBatchId' => true, 'GetUrlsByBatch' => true, 'getChronicleSource' => true, 'GetBatchesExcludeOwnCustomer' => true, 'CreateNewCustomBatch' => true, 'CreateNewSubset' => true, 'GetBatchesSummaryCombinations' => true, 'UpdateBatchesSummaryCombinationsItem' => true, 'DeleteBatchesSummaryCombinationsItem' => true, 'DeleteBatch' => true, 'RenameBatch' => true, 'UploadCsv' => true, 'ImportCsvBatch' => true, 'AddUrlsToBatch' => true, 'DeleteUrlsFromBatch' => true, 'ShareUrls' => true, 'CustomGradesIndex' => true, 'updatePendingEditsCount' => true, 'refreshModalTabsCounts' => true, 'GradesViewSelected' => true, 'SaveCustomGrades' => true, 'WorkOrderHistoryIndex' => true, 'SendMailCreateWorkOrder' => true, 'ExportAssess' => true, 'DeleteExportedFile' => true, 'UpdateFavoriteInsightActions' => true, 'RemoveFavoriteInsightActions' => true, 'StoreFavoriteInsightActions' => true, 'ExportBrandsAndFilters' => true, 'SaveBatchesSummaryCombinationsItem' => true, 'AddFlaggedItems' => true, 'ExcludeFromBatch' => true, 'CountFlaggedItems' => true, 'GetSubsetsWithDatesList' => true, 'DeleteFromBatch' => true, 'IncludeInAssessReportCheck' => true, 'GetCListStatusByResDataID' => true, 'StringDiff' => true, 'DeleteSecondaryMatch' => true, 'CrawlAll' => true, 'setSupplierBatches' => true, 'SaveItemToStatisticsNewArchive' => true, 'FetchUrlDates' => true, 'getSecondaryBatchCustomers' => true, 'FetchUrlData' => true, 'FetchSummaryData' => true, 'FetchFilterNumbers' => true, 'FetchFilterUrls' => true, 'UpdateRankingViewForUser' => true, 'GetCustomersByUserId' => true, 'AlertsTableIndex' => true, 'GetDefaultRecipient' => true, 'GetAvailableBrandsForSite' => true, 'GetAvailableKeywordGroup' => true, 'GetAvailableDatesForSite' => true, 'GetAssociatedKeywords' => true, 'GetRecentQueryParams' => true, 'GetTermRanking' => true, 'SaveRecentQueryParams' => true, 'GetSavedQueryParams' => true, 'GetRecentQueryParamsById' => true, 'SaveSavedQueryParams' => true, 'GetSavedQueryParamsById' => true, 'UpdateSavedQueryParam' => true, 'RemoveSavedQueryParam' => true, 'DeleteRecentQueryParams' => true, 'EditAlertView' => true, 'UpdateAlert' => true, 'GetAlertsTabs' => true, 'AddAlert' => true, 'getLogo' => true, 'GetRecipientsListBySearchTerm' => true, 'RefreshRecipientsGroupsList' => true, 'AddRecipientGroup' => true, 'GetRecipientsListByGroupId' => true, 'UpdateRecipient' => true, 'AddRecipientsToGroup' => true, 'UpdateRecipientGroup' => true, 'RemoveRecipientFromGroup' => true, 'DeleteRecipientGroup' => true, 'RevertRecipientsGroupChanges' => true, 'AlertsTableManage' => true, 'AddRecipientToAlert' => true, 'DeleteRecipientFromAlert' => true, 'DeleteAlert' => true, 'SendOrShowAlert' => true, 'ChartsGetRankingViewData' => true, 'exportApproveRejectProducts' => true, 'GetBrandingTableColumns' => true, 'approveRejectChangedProduct' => true, 'SaveRankingTableSettings' => true, 'AddKeywordToGroup' => true, 'GetKeywordGroupsList' => true, 'GetKeywordsListByGroupId' => true, 'SaveGearPopupState' => true, 'GetGearPopupState' => true, 'EditKeyword' => true, 'EditKeywordGroup' => true, 'GetSitesByKeywordGroupId' => true, 'KeywordGroupExists' => true, 'AddSitesToGroup' => true, 'AddKeywordCronJobs' => true, 'RemoveKeywordGroup' => true, 'GetBrandGroup' => true, 'AddNewRankingBrandGroup' => true, 'GetBrandsListByName' => true, 'AddBrandToGroup' => true, 'CHExportSku' => true, 'UpdateRankingBrandGroup' => true, 'GetRankingBrandsByGroupId' => true, 'RemoveRankingBrandGroup' => true, 'UndoBrandGroupChanges' => true, 'RemoveBrandFromGroup' => true, 'submitChangesToRetailer' => true, 'submitContentToRetailer' => true, 'RemoveKeywordFromGroup' => true, 'getAllDatesForBatch' => true, 'getPendingEdits' => true, 'getTotalPendingProductsCount' => true, 'getSupplier' => true, 'addSupplier' => true, 'deleteSupplier' => true, 'updateSupplier' => true, 'getNewChangedProducts' => true, 'GetDashboardSummary' => true, 'getOriginalProductDescriptions' => true, 'RefreshRecipientsList' => true, 'CreateRecipient' => true, 'UploadBatch' => true, 'BrandReportRanking' => true, 'sendMailApproveRejectProduct' => true, 'GetSitebyBrandId' => true, 'GetKeywordsAndBrandsByItsGroups' => true, 'GetRanking' => true, 'getDefaultSetings' => true, 'GetRakingChartData' => true, 'CreateBatchFromRanking' => true, 'AlertRecipientsManage' => true, 'DropSelectionScan' => true, 'GetScheduleCrawlsList' => true, 'CheckBatchDatesCount' => true, 'GetFamilyNamesList' => true, 'GetBrandsInFamily' => true, 'SaveFamily' => true, 'DeleteFamily' => true, 'RemoveBrandsFromFamily' => true, 'GetBrandsToAddInFamily' => true, 'RecrawlBatch' => true, 'getAverageGroupVals' => true, 'getColumns' => true, 'getCustomerList' => true, 'getExcludeLists' => true, 'getExcluded' => true, 'getFilterItemsWithGroups' => true, 'getFiltersValuesViewConf' => true, 'string_diff2' => true, 'getModeToFilterClassPair' => true, 'getModeToGroupClassPair' => true, 'getRole' => true, 'getSelectableColumns' => true, 'SortByBatch' => true, 'getUserFilters' => true, 'UserIsAdmin' => true, 'getUserVisibleGroups' => true, 'getTableColumns' => true, 'SetChangeOrderItem' => true, 'CreateChangeOrder' => true, 'getScraperOutputUrl' => true, 'Export_Product' => true, 'ViewChangeOrderItem' => true, 'DeleteChangeOrderItem' => true, 'ViewChangeOrder' => true, 'GetUserDateFormat' => true, 'checkSuperFilters' => true, 'SetTime' => true, 'Get_Last_Change_Of_Product' => true, 'Get_Product_By_Id' => true, 'Get_Changed_Products' => true, 'Get_Date_If_Product_Changed' => true, 'Delete_All_Changed_Products' => true, 'Set_Status_Of_Product' => true, 'Get_History' => true, 'StoreRejectComment' => true, 'Export_Changed_Products' => true, 'getBatchesForZabbix' => true, 'setBatchDisplayedOnDashBoard' => true, 'getBatchDisplayedOnDashBoard' => true, 'isAnalysingBatch' => true, 'updateBatch' => true, 'lookUpChronicleId' => true, 'saveChangedFiltersConfig' => true, 'getUniqueSpecifications' => true, 'exportBatchUrls' => true, 'exportBatchUrlsProgress' => true, 'GetChronicles' => true, 'GetSummaryInfo' => true, 'GetDetails' => true, 'ChangeUrlsStatus' => true, 'ch_save_get_delete_selection' => true, 'GetSkuFilters' => true, 'GetSkusByFilter' => true, 'GetTrafficData' => true, 'purgeBatchDate' => true, 'exportBatchDate' => true, 'importBatchDate' => true, 'VadGetSettings' => true, 'VadSaveSettings' => true, 'createBatchContent' => true, 'VadGetUniqueSkusTotal' => true, 'checkExportStatus' => true, 'checkImportStatus' => true, 'importBatchCrawl' => true, 'exportBatchCrawl' => true, 'checkExportedFile' => true, 'renameExportedFile' => true, 'getLastExpoertedFiles' => true, 'getChronicleInfo' => true, 'validateChronicle' => true, 'checkValidationChronicleStatus' => true, 'uploadImagesFromSite' => true, 'uploadImagesFromComputer' => true, 'saveUploadedImages' => true, 'deleteUploadedImage' => true, 'imageUploadAndDeleteState' => true, 'archiveBatchDate' => true, 'downloadProductImages' => true, 'downloadTabImages' => true, 'downloadFromRedyForSubmission' => true));
     //$this->action = trim($this->input->post('action'));
     //$this->timestump = trim($this->input->post('timestamp'));
     //$this->signature = trim($this->input->post('signature'));
     //$string = $this->action . $this->timestump . $this->access_id;
     //$string = strtolower($string);
     if ($this->input->get_post('access_id')) {
         $this->access_id = trim($this->input->get_post('access_id'));
     } else {
         $this->response(array('type' => 'missing_parameter_error', 'message' => 'Missing access id.'), 400);
     }
     if (!$this->check_access_id($this->access_id)) {
         $this->response(array('type' => 'processing_error', 'message' => 'Wrong access id.'), 400);
     } else {
         $this->user_data = $this->check_access_id($this->access_id);
         $this->user_id = $this->user_data['id'];
         $this->number_of_items = 0;
     }
     $this->uuid = $this->config->item('uuid');
 }
 public function __construct()
 {
     parent::__construct();
     $this->module = 'customer';
     $this->load->model('customer/customer');
     $simbanic_json = array();
 }
 public function __construct($config = 'rest')
 {
     parent::__construct();
     header('Access-Control-Allow-Origin: *');
     header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
     $this->load->model('Karyawan');
 }