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


PHP Params::setParam方法代码示例

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


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

示例1: getDBParams

 private function getDBParams()
 {
     $p_iPage = 1;
     if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) {
         Params::setParam('iPage', $p_iPage);
         $this->iPage = $p_iPage;
     } else {
         $this->iPage = Params::getParam('iPage');
     }
     $this->showAll = Params::getParam('showAll');
     foreach ($this->_get as $k => $v) {
         if ($k == 'resourceId' && !empty($v)) {
             $this->resourceID = intval($v);
         }
         if ($k == 'iDisplayStart') {
             $this->start = intval($v);
         }
         if ($k == 'iDisplayLength') {
             $this->limit = intval($v);
         }
     }
     // set start and limit using iPage param
     $start = ((int) $this->iPage - 1) * $this->_get['iDisplayLength'];
     $this->start = intval($start);
     $this->limit = intval($this->_get['iDisplayLength']);
 }
开发者ID:semul,项目名称:Osclass,代码行数:26,代码来源:comments_processing.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     $this->mSearch = Search::newInstance();
     $this->uri = preg_replace('|^' . REL_WEB_URL . '|', '', $_SERVER['REQUEST_URI']);
     $this->nice_url = false;
     if (!stripos($_SERVER['REQUEST_URI'], 'search') && osc_rewrite_enabled()) {
         $this->nice_url = true;
     }
     if ($this->nice_url) {
         // redirect if it ends with a slash
         if (preg_match('|/$|', $this->uri)) {
             $redirectURL = osc_base_url() . $this->uri;
             $redirectURL = preg_replace('|/$|', '', $redirectURL);
             $this->redirectTo($redirectURL);
         }
         $search_uri = preg_replace('|/[0-9]+$|', '', $this->uri);
         $this->_exportVariableToView('search_uri', $search_uri);
         // remove seo_url_search_prefix
         if (osc_get_preference('seo_url_search_prefix') != '') {
             $this->uri = str_replace(osc_get_preference('seo_url_search_prefix') . '/', '', $this->uri);
         }
         // get page if it's set in the url
         $iPage = preg_replace('|.*/([0-9]+)$|', '$01', $this->uri);
         if ($iPage > 0) {
             Params::setParam('iPage', $iPage);
             // redirect without number of pages
             if ($iPage == 1) {
                 $this->redirectTo(osc_base_url() . $search_uri);
             }
         }
         if (Params::getParam('iPage') > 1) {
             $this->_exportVariableToView('canonical', osc_base_url() . $search_uri);
         }
         $params = preg_split('|_|', preg_replace('|.*?/|', '', $search_uri));
         if (preg_match('|r([0-9]+)$|', $params[0], $r)) {
             $region = Region::newInstance()->findByPrimaryKey($r[1]);
             Params::setParam('sRegion', $region['pk_i_id']);
         } else {
             if (preg_match('|c([0-9]+)$|', $params[0], $c)) {
                 $city = City::newInstance()->findByPrimaryKey($c[1]);
                 Params::setParam('sCity', $city['pk_i_id']);
             } else {
                 Params::setParam('sCategory', $search_uri);
             }
         }
         if (count($params) == 2) {
             $location = $params[1];
             if (preg_match('|r([0-9]+)$|', $location, $r)) {
                 $region = Region::newInstance()->findByPrimaryKey($r[1]);
                 Params::setParam('sRegion', $region['pk_i_id']);
             }
             if (preg_match('|c([0-9]+)$|', $location, $c)) {
                 $city = City::newInstance()->findByPrimaryKey($c[1]);
                 Params::setParam('sCity', $city['pk_i_id']);
             }
         }
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:59,代码来源:search.php

示例3: setupSources

 /**
  * Set up groups of files as sources
  * 
  * @param array $options controller and Minify options
  * @return array Minify options
  * 
  */
 public function setupSources($options)
 {
     // PHP insecure by default: realpath() and other FS functions can't handle null bytes.
     if (Params::existParam('files')) {
         Params::setParam('files', str_replace("", '', (string) Params::getParam('files')));
     }
     self::_setupDefines();
     if (MINIFY_USE_CACHE) {
         $cacheDir = defined('MINIFY_CACHE_DIR') ? MINIFY_CACHE_DIR : '';
         Minify::setCache($cacheDir);
     }
     $options['badRequestHeader'] = 'HTTP/1.0 404 Not Found';
     $options['contentTypeCharset'] = MINIFY_ENCODING;
     // The following restrictions are to limit the URLs that minify will
     // respond to. Ideally there should be only one way to reference a file.
     if (!Params::existParam('files') || !preg_match('/^[^,]+\\.(css|js)(,[^,]+\\.\\1)*$/', Params::getParam('files'), $m) || strpos(Params::getParam('files'), '//') !== false || strpos(Params::getParam('files'), '\\') !== false || preg_match('/(?:^|[^\\.])\\.\\//', Params::getParam('files'))) {
         return $options;
     }
     $files = explode(',', Params::getParam('files'));
     if (count($files) > MINIFY_MAX_FILES) {
         return $options;
     }
     // strings for prepending to relative/absolute paths
     $prependRelPaths = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR;
     $prependAbsPaths = $_SERVER['DOCUMENT_ROOT'];
     $goodFiles = array();
     $hasBadSource = false;
     $allowDirs = isset($options['allowDirs']) ? $options['allowDirs'] : MINIFY_BASE_DIR;
     foreach ($files as $file) {
         // prepend appropriate string for abs/rel paths
         $file = ($file[0] === '/' ? $prependAbsPaths : $prependRelPaths) . $file;
         // make sure a real file!
         $file = realpath($file);
         // don't allow unsafe or duplicate files
         if (parent::_fileIsSafe($file, $allowDirs) && !in_array($file, $goodFiles)) {
             $goodFiles[] = $file;
             $srcOptions = array('filepath' => $file);
             $this->sources[] = new Minify_Source($srcOptions);
         } else {
             $hasBadSource = true;
             break;
         }
     }
     if ($hasBadSource) {
         $this->sources = array();
     }
     if (!MINIFY_REWRITE_CSS_URLS) {
         $options['rewriteCssUris'] = false;
     }
     return $options;
 }
开发者ID:oanav,项目名称:closetshare,代码行数:58,代码来源:Version1.php

示例4: __construct

 function __construct($params)
 {
     $this->_get = $params;
     $p_iPage = 1;
     if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) {
         $this->_get['iPage'] = $p_iPage;
         Params::setParam('iPage', $p_iPage);
     }
     // set start and limit using iPage param
     $start = ((int) $this->_get['iPage'] - 1) * $this->_get['iDisplayLength'];
     $this->start = intval($start);
     $this->limit = intval($this->_get['iDisplayLength']);
     $this->pages = Page::newInstance()->listAll(0, null, $this->start, $this->limit);
     $this->total = Page::newInstance()->count(0);
     $this->total_filtered = $this->total;
 }
开发者ID:semul,项目名称:Osclass,代码行数:16,代码来源:pages_processing.php

示例5: doModel

        function doModel()
        {
            $user_menu = false;
            if(Params::existParam('route')) {
                $routes = Rewrite::newInstance()->getRoutes();
                $rid = Params::getParam('route');
                $file = '../';
                if(isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                    $file = $routes[$rid]['file'];
                    $user_menu = $routes[$rid]['user_menu'];
                }
            } else {
                // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                // This will be REMOVED in 3.4
                $file = Params::getParam('file');
            }

            // valid file?
            if( strpos($file, '../') !== false || strpos($file, '..\\') !==false || stripos($file, '/admin/') !== false ) { //If the file is inside an "admin" folder, it should NOT be opened in frontend
                $this->do404();
                return;
            }

            // check if the file exists
            if( !file_exists(osc_plugins_path() . $file) ) {
                $this->do404();
                return;
            }

            osc_run_hook('custom_controller');

            $this->_exportVariableToView('file', $file);
            if($user_menu) {
                if(osc_is_web_user_logged_in()) {
                    Params::setParam('in_user_menu', true);
                    $this->doView('user-custom.php');
                } else {
                    $this->redirectTo(osc_user_login_url());
                }
            } else {
                $this->doView('custom.php');
            }
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:43,代码来源:custom.php

示例6: __construct

 function __construct($params)
 {
     $this->_get = $params;
     $p_iPage = 1;
     if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) {
         Params::setParam('iPage', $p_iPage);
     }
     // force ORDER BY
     $this->order_by['column_name'] = $this->column_names[4];
     $this->order_by['type'] = 'desc';
     $this->getDBParams();
     $this->media = ItemResource::newInstance()->getResources($this->resourceID, $this->start, $this->limit, $this->order_by['column_name'] ? $this->order_by['column_name'] : 'pk_i_id', $this->order_by['type'] ? $this->order_by['type'] : 'desc');
     $this->total = ItemResource::newInstance()->countResources();
     if ($this->resourceID == null) {
         $this->total_filtered = $this->total;
     } else {
         $this->total_filtered = ItemResource::newInstance()->countResources($this->resourceID);
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:19,代码来源:media_processing.php

示例7: uriToParams

 /**
  * 提取地址中的参数
  * 
  * @param array $uriArray
  */
 private function uriToParams($uriArray = null)
 {
     $array = null;
     if (is_array($uriArray)) {
         array_splice($uriArray, 0, 3);
     }
     if (!empty($uriArray)) {
         foreach ($uriArray as $key => $value) {
             if ($key % 2 == 0) {
                 $array[$value] = null;
             } else {
                 $array[$uriArray[$key - 1]] = $value;
             }
         }
         foreach ($array as $key => $value) {
             if ($value !== null) {
                 $this->_params->setParam($key, $value);
             }
         }
     }
 }
开发者ID:kissthink,项目名称:MiniFramework,代码行数:26,代码来源:App.php

示例8: getDBParams

 /**
  * Set variables to perform the search from $_GET
  * 
  * @access private
  * @since unkwnon 
  */
 private function getDBParams()
 {
     // default values
     if (!isset($this->_get['iDisplayStart'])) {
         $this->_get['iDisplayStart'] = 0;
     }
     $p_iPage = 1;
     if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) {
         Params::setParam('iPage', $p_iPage);
         $this->iPage = $p_iPage;
     } else {
         $this->iPage = Params::getParam('iPage');
     }
     $this->order_by['column_name'] = 'pk_i_id';
     $this->order_by['type'] = 'DESC';
     foreach ($this->_get as $k => $v) {
         if ($k == 'user') {
             $this->search = $v;
         }
         if ($k == 'userId' && $v != '') {
             $this->withUserId = true;
             $this->userId = $v;
         }
         /* for sorting */
         if ($k == 'iSortCol_0') {
             $this->order_by['column_name'] = $this->column_names[$v];
         }
         if ($k == 'sSortDir_0') {
             $this->order_by['type'] = $v;
         }
     }
     // set start and limit using iPage param
     $start = ($this->iPage - 1) * $this->_get['iDisplayLength'];
     $this->start = intval($start);
     $this->limit = intval($this->_get['iDisplayLength']);
 }
开发者ID:semul,项目名称:Osclass,代码行数:42,代码来源:users_processing.php

示例9: doModel


//.........这里部分代码省略.........
             $this->redirectTo(osc_admin_base_url(true) . '?page=languages');
             break;
         case 'delete':
             osc_csrf_check();
             if (is_array(Params::getParam('id'))) {
                 $default_lang = osc_language();
                 foreach (Params::getParam('id') as $code) {
                     if ($default_lang != $code) {
                         if ($this->localeManager->deleteLocale($code)) {
                             if (!osc_deleteDir(osc_translations_path() . $code)) {
                                 osc_add_flash_error_message(sprintf(_m("Directory '%s' couldn't be removed"), $code), 'admin');
                             } else {
                                 osc_add_flash_ok_message(sprintf(_m('Directory "%s" has been successfully removed'), $code), 'admin');
                             }
                         } else {
                             osc_add_flash_error_message(sprintf(_m("Directory '%s' couldn't be removed;)"), $code), 'admin');
                         }
                     } else {
                         osc_add_flash_error_message(sprintf(_m("Directory '%s' couldn't be removed because it's the default language. Set another language as default first and try again"), $code), 'admin');
                     }
                 }
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=languages');
             break;
         default:
             if (Params::getParam('checkUpdated') != '') {
                 osc_admin_toolbar_update_languages(true);
             }
             if (Params::getParam("action") != "") {
                 osc_run_hook("language_bulk_" . Params::getParam("action"), Params::getParam('id'));
             }
             // -----
             if (Params::getParam('iDisplayLength') == '') {
                 Params::setParam('iDisplayLength', 10);
             }
             // ?
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             $p_iPage = 1;
             if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1) {
                 $p_iPage = Params::getParam('iPage');
             }
             Params::setParam('iPage', $p_iPage);
             $aLanguages = OSCLocale::newInstance()->listAll();
             // pagination
             $start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
             $limit = Params::getParam('iDisplayLength');
             $count = count($aLanguages);
             $displayRecords = $limit;
             if ($start + $limit > $count) {
                 $displayRecords = $start + $limit - $count;
             }
             // ----
             $aLanguagesToUpdate = json_decode(osc_get_preference('languages_to_update'));
             $bLanguagesToUpdate = is_array($aLanguagesToUpdate) ? true : false;
             // ----
             $aData = array();
             $max = $start + $limit;
             if ($max > $count) {
                 $max = $count;
             }
             for ($i = $start; $i < $max; $i++) {
                 $l = $aLanguages[$i];
                 $row = array();
                 $row[] = '<input type="checkbox" name="id[]" value="' . $l['pk_c_code'] . '" />';
                 $options = array();
                 $options[] = '<a href="' . osc_admin_base_url(true) . '?page=languages&amp;action=edit&amp;id=' . $l['pk_c_code'] . '">' . __('Edit') . '</a>';
开发者ID:naneri,项目名称:Osclass,代码行数:67,代码来源:languages.php

示例10: oc_install_example_data

function oc_install_example_data()
{
    require_once LIB_PATH . 'osclass/formatting.php';
    require LIB_PATH . 'osclass/installer/basic_data.php';
    require_once LIB_PATH . 'osclass/model/Category.php';
    $mCat = Category::newInstance();
    if (!function_exists('osc_apply_filter')) {
        function osc_apply_filter($dummyfilter, $str)
        {
            return $str;
        }
    }
    foreach ($categories as $category) {
        $fields['pk_i_id'] = $category['pk_i_id'];
        $fields['fk_i_parent_id'] = $category['fk_i_parent_id'];
        $fields['i_position'] = $category['i_position'];
        $fields['i_expiration_days'] = 0;
        $fields['b_enabled'] = 1;
        $aFieldsDescription[osc_current_admin_locale()]['s_name'] = $category['s_name'];
        $mCat->insert($fields, $aFieldsDescription);
    }
    require_once LIB_PATH . 'osclass/model/Item.php';
    require_once LIB_PATH . 'osclass/model/ItemComment.php';
    require_once LIB_PATH . 'osclass/model/ItemLocation.php';
    require_once LIB_PATH . 'osclass/model/ItemResource.php';
    require_once LIB_PATH . 'osclass/model/ItemStats.php';
    require_once LIB_PATH . 'osclass/model/User.php';
    require_once LIB_PATH . 'osclass/model/Country.php';
    require_once LIB_PATH . 'osclass/model/Region.php';
    require_once LIB_PATH . 'osclass/model/City.php';
    require_once LIB_PATH . 'osclass/model/CityArea.php';
    require_once LIB_PATH . 'osclass/model/Field.php';
    require_once LIB_PATH . 'osclass/model/Page.php';
    require_once LIB_PATH . 'osclass/model/Log.php';
    require_once LIB_PATH . 'osclass/model/CategoryStats.php';
    require_once LIB_PATH . 'osclass/model/CountryStats.php';
    require_once LIB_PATH . 'osclass/model/RegionStats.php';
    require_once LIB_PATH . 'osclass/model/CityStats.php';
    require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
    require_once LIB_PATH . 'osclass/helpers/hValidate.php';
    require_once LIB_PATH . 'osclass/helpers/hUsers.php';
    require_once LIB_PATH . 'osclass/ItemActions.php';
    $mItem = new ItemActions(true);
    foreach ($item as $k => $v) {
        if ($k == 'description' || $k == 'title') {
            Params::setParam($k, array(osc_current_admin_locale() => $v));
        } else {
            Params::setParam($k, $v);
        }
    }
    $mItem->prepareData(true);
    $successItem = $mItem->add();
    $successPageresult = Page::newInstance()->insert(array('s_internal_name' => $page['s_internal_name'], 'b_indelible' => 0, 's_meta' => json_encode('')), array(osc_current_admin_locale() => array('s_title' => $page['s_title'], 's_text' => $page['s_text'])));
}
开发者ID:mylastof,项目名称:os-class,代码行数:54,代码来源:install-functions.php

示例11: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             switch (Params::getParam('bulk_actions')) {
                 case 'delete_all':
                     $ids = Params::getParam("id");
                     if (is_array($ids)) {
                         foreach ($ids as $id) {
                             osc_deleteResource($id, true);
                         }
                         $log_ids = substr(implode(",", $ids), 0, 250);
                         Log::newInstance()->insertLog('media', 'delete bulk', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
                         $this->resourcesManager->deleteResourcesIds($ids);
                     }
                     osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
                     break;
                 default:
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=media');
             break;
         case 'delete':
             $ids = Params::getParam('id');
             if (is_array($ids)) {
                 foreach ($ids as $id) {
                     osc_deleteResource($id, true);
                 }
                 $log_ids = substr(implode(",", $ids), 0, 250);
                 Log::newInstance()->insertLog('media', 'delete', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
                 $this->resourcesManager->deleteResourcesIds($ids);
             }
             osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . '?page=media');
             break;
         default:
             if (Params::getParam('iDisplayLength') == '') {
                 Params::setParam('iDisplayLength', 10);
             }
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             require_once osc_admin_base_path() . 'ajax/media_processing.php';
             $params = Params::getParamsAsArray("get");
             $media_processing = new MediaProcessingAjax($params);
             $aData = $media_processing->result($params);
             $page = (int) Params::getParam('iPage');
             if (count($aData['aaData']) == 0 && $page != 1) {
                 $total = (int) $aData['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $aData['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . $_SERVER['QUERY_STRING'];
                 if ($maxPage == 0) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
                     $this->redirectTo($url);
                 }
                 if ($page > 1) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
                     $this->redirectTo($url);
                 }
             }
             $this->_exportVariableToView('aMedia', $aData);
             $this->doView('media/index.php');
             break;
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:65,代码来源:media.php

示例12: doModel


//.........这里部分代码省略.........
                                    }
                                    osc_csrf_check();
                                    // deleting and admin
                                    $isDeleted = false;
                                    $adminId   = Params::getParam('id');

                                    if( !is_array($adminId) ) {
                                        osc_add_flash_error_message( _m("The admin id isn't in the correct format"), 'admin');
                                        $this->redirectTo(osc_admin_base_url(true) . '?page=admins');
                                    }

                                    // Verification to avoid an administrator trying to remove to itself
                                    if( in_array(Session::newInstance()->_get('adminId'), $adminId) ) {
                                        osc_add_flash_error_message( _m("The operation hasn't been completed. You're trying to remove yourself!"), 'admin');
                                        $this->redirectTo(osc_admin_base_url(true) . '?page=admins');
                                    }

                                    $isDeleted = $this->adminManager->deleteBatch( $adminId );

                                    if( $isDeleted ) {
                                        osc_add_flash_ok_message( _m('The admin has been deleted correctly'), 'admin');
                                    } else {
                                        osc_add_flash_error_message( _m('The admin couldn\'t be deleted'), 'admin');
                                    }
                                    $this->redirectTo(osc_admin_base_url(true) . '?page=admins');
                break;
                default:

                                    if(Params::getParam("action")!="") {
                                        osc_run_hook("admin_bulk_".Params::getParam("action"), Params::getParam('id'));
                                    }

                                    if( Params::getParam('iDisplayLength') == '' ) {
                                        Params::setParam('iDisplayLength', 10 );
                                    }

                                    $p_iPage      = 1;
                                    if( is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1 ) {
                                        $p_iPage = Params::getParam('iPage');
                                    }
                                    Params::setParam('iPage', $p_iPage);

                                    $admins = $this->adminManager->listAll();

                                    // pagination
                                    $start = ($p_iPage-1) * Params::getParam('iDisplayLength');
                                    $limit = Params::getParam('iDisplayLength');
                                    $count = count( $admins );

                                    $displayRecords = $limit;
                                    if( ($start+$limit ) > $count ) {
                                        $displayRecords = ($start+$limit) - $count;
                                    }
                                    // ----
                                    $aData = array();
                                    $max = ($start+$limit);
                                    if($max > $count) $max = $count;
                                    for($i = $start; $i < $max; $i++) {

                                        $admin = $admins[$i];

                                        $options = array();
                                        $options[] = '<a href="' . osc_admin_base_url(true) . '?page=admins&action=edit&amp;id='  . $admin['pk_i_id'] . '">' . __('Edit') . '</a>';
                                        $options[] = '<a onclick="return delete_dialog(\'' . $admin['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=admins&action=delete&amp;id[]=' . $admin['pk_i_id'] . '">' . __('Delete') . '</a>';
                                        $auxOptions = '<ul>'.PHP_EOL;
                                        foreach( $options as $actual ) {
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:admins.php

示例13: processPayment

 public static function processPayment()
 {
     require_once osc_plugins_path() . osc_plugin_folder(__FILE__) . 'lib/Stripe.php';
     if (osc_get_preference('stripe_sandbox', 'payment') == 0) {
         $stripe = array("secret_key" => osc_get_preference('stripe_secret_key', 'payment'), "publishable_key" => osc_get_preference('stripe_public_key', 'payment'));
     } else {
         $stripe = array("secret_key" => osc_get_preference('stripe_secret_key_test', 'payment'), "publishable_key" => osc_get_preference('stripe_public_key_test', 'payment'));
     }
     Stripe::setApiKey($stripe['secret_key']);
     $token = Params::getParam('stripeToken');
     $data = payment_get_custom(Params::getParam('extra'));
     $amount = payment_get_amount($data['product']);
     if ($amount <= 0) {
         return PAYMENT_FAILED;
     }
     $customer = Stripe_Customer::create(array('email' => $data['email'], 'card' => $token));
     try {
         $charge = @Stripe_Charge::create(array('customer' => $customer->id, 'amount' => $amount * 100, 'currency' => osc_get_preference("currency", "payment")));
         if ($charge->__get('paid') == 1) {
             $exists = ModelPayment::newInstance()->getPaymentByCode($charge->__get('id'), 'STRIPE');
             if (isset($exists['pk_i_id'])) {
                 return PAYMENT_ALREADY_PAID;
             }
             $product_type = explode('x', $data['product']);
             Params::setParam('stripe_transaction_id', $charge->__get('id'));
             // SAVE TRANSACTION LOG
             $payment_id = ModelPayment::newInstance()->saveLog($data['concept'], $charge->__get('id'), $charge->__get('amount') / 100, $charge->__get('currency'), $data['email'], $data['user'], $data['itemid'], $product_type[0], 'STRIPE');
             //source
             if ($product_type[0] == '101') {
                 ModelPayment::newInstance()->payPublishFee($product_type[2], $payment_id);
             } else {
                 if ($product_type[0] == '201') {
                     ModelPayment::newInstance()->payPremiumFee($product_type[2], $payment_id);
                 } else {
                     ModelPayment::newInstance()->addWallet($data['user'], $charge->__get('amount') / 100);
                 }
             }
             return PAYMENT_COMPLETED;
         }
         return PAYMENT_FAILED;
     } catch (Stripe_CardError $e) {
         return PAYMENT_FAILED;
     }
     return PAYMENT_FAILED;
 }
开发者ID:virsoni,项目名称:plugin-payment,代码行数:45,代码来源:StripePayment.php

示例14: prepareData

 /**
  * Return an array with all data necessary for do the action (ADD OR EDIT)
  * @param <type> $is_add
  * @return array
  */
 public function prepareData($is_add)
 {
     $aItem = array();
     // prepare user
     $userId = null;
     if ($this->is_admin) {
         if (Params::getParam('userId') != '') {
             $userId = Params::getParam('userId');
         }
     } else {
         $userId = Session::newInstance()->_get('userId');
         if ($userId == '') {
             $userId = NULL;
         }
     }
     if ($is_add) {
         // ADD
         if ($this->is_admin) {
             $active = 'ACTIVE';
         } else {
             if (osc_moderate_items() > 0) {
                 // HAS TO VALIDATE
                 if (!osc_is_web_user_logged_in()) {
                     // NO USER IS LOGGED, VALIDATE
                     $active = 'INACTIVE';
                 } else {
                     // USER IS LOGGED
                     if (osc_logged_user_item_validation()) {
                         //USER IS LOGGED, BUT NO NEED TO VALIDATE
                         $active = 'ACTIVE';
                     } else {
                         // USER IS LOGGED, NEED TO VALIDATE, CHECK NUMBER OF PREVIOUS ITEMS
                         $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
                         if ($user['i_items'] < osc_moderate_items()) {
                             $active = 'INACTIVE';
                         } else {
                             $active = 'ACTIVE';
                         }
                     }
                 }
             } else {
                 if (osc_moderate_items() == 0) {
                     if (osc_is_web_user_logged_in() && osc_logged_user_item_validation()) {
                         $active = 'ACTIVE';
                     } else {
                         $active = 'INACTIVE';
                     }
                 } else {
                     $active = 'ACTIVE';
                 }
             }
         }
         if ($userId != null) {
             $data = User::newInstance()->findByPrimaryKey($userId);
             $aItem['contactName'] = $data['s_name'];
             $aItem['contactEmail'] = $data['s_email'];
             Params::setParam('contactName', $data['s_name']);
             Params::setParam('contactEmail', $data['s_email']);
         } else {
             $aItem['contactName'] = Params::getParam('contactName');
             $aItem['contactEmail'] = Params::getParam('contactEmail');
         }
         $aItem['active'] = $active;
         $aItem['userId'] = $userId;
     } else {
         // EDIT
         $aItem['secret'] = Params::getParam('secret');
         $aItem['idItem'] = Params::getParam('id');
         if ($userId != null) {
             $data = User::newInstance()->findByPrimaryKey($userId);
             $aItem['contactName'] = $data['s_name'];
             $aItem['contactEmail'] = $data['s_email'];
             Params::setParam('contactName', $data['s_name']);
             Params::setParam('contactEmail', $data['s_email']);
         } else {
             $aItem['contactName'] = Params::getParam('contactName');
             $aItem['contactEmail'] = Params::getParam('contactEmail');
         }
         $aItem['userId'] = $userId;
     }
     // get params
     $aItem['catId'] = Params::getParam('catId');
     $aItem['countryId'] = Params::getParam('countryId');
     $aItem['country'] = Params::getParam('country');
     $aItem['region'] = Params::getParam('region');
     $aItem['regionId'] = Params::getParam('regionId');
     $aItem['city'] = Params::getParam('city');
     $aItem['cityId'] = Params::getParam('cityId');
     $aItem['price'] = Params::getParam('price') != '' ? Params::getParam('price') : null;
     $aItem['cityArea'] = Params::getParam('cityArea');
     $aItem['address'] = Params::getParam('address');
     $aItem['currency'] = Params::getParam('currency');
     $aItem['showEmail'] = Params::getParam('showEmail') != '' ? 1 : 0;
     $aItem['title'] = Params::getParam('title');
     $aItem['description'] = Params::getParam('description');
//.........这里部分代码省略.........
开发者ID:ranjithinnergys,项目名称:OSClass,代码行数:101,代码来源:ItemActions.php

示例15: extractParams

 public function extractParams($uri = '')
 {
     $uri_array = explode('?', $uri);
     $url = substr($uri_array[0], 1);
     $length_i = count($uri_array);
     for ($var_i = 1; $var_i < $length_i; $var_i++) {
         if (preg_match_all('|&([^=]+)=([^&]*)|', '&' . $uri_array[$var_i] . '&', $matches)) {
             $length = count($matches[1]);
             for ($var_k = 0; $var_k < $length; $var_k++) {
                 Params::setParam($matches[1][$var_k], $matches[2][$var_k]);
             }
         }
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:14,代码来源:Rewrite.php


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